From 5dad5e15293db9693b0c23db447062b786495d88 Mon Sep 17 00:00:00 2001
From: Wang Xingchao <xingchao.wang@linux.intel.com>
Date: Fri, 3 May 2013 15:00:32 +0800
Subject: [RFC PATCH 2/4] Alsa: hda - Add put/get power well api in hdmi_i915
 driver

Signed-off-by: Wang Xingchao <xingchao.wang@linux.intel.com>
---
 sound/pci/hda/hdmi_i915.c |   54 +++++++++++++++++++++++++++++++++++++--------
 sound/pci/hda/hdmi_i915.h |   28 +++++++++++++++++++++++
 2 files changed, 73 insertions(+), 9 deletions(-)
 create mode 100644 sound/pci/hda/hdmi_i915.h

diff --git a/sound/pci/hda/hdmi_i915.c b/sound/pci/hda/hdmi_i915.c
index ca0916e..c3d8347 100644
--- a/sound/pci/hda/hdmi_i915.c
+++ b/sound/pci/hda/hdmi_i915.c
@@ -9,25 +9,61 @@
  *  Free Software Foundation;  either version 2 of the  License, or (at your
  *  option) any later version.
  */
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/pm.h>
+#include <drm/audio_drm.h>
+#include "hdmi_i915.h"
 
 //TODO:
 //1. Add i915 private APIs here
 //2. register the private data to device side(hda_codec)
 
-struct hdmi_i915_private {
-	//place callbacks here
-};
+static void hdmi_get_power_well(void)
+{
+	request_power_well();
+}
+
+static void hdmi_put_power_well(void)
+{
+	release_power_well();
+}
+
+static int hdmi_i915_probe(struct device *dev)
+{
+	struct hdmi_i915_private *i915_data;
+
+	i915_data = kzalloc(sizeof(*i915_data), GFP_KERNEL);
+	if (!i915_data)
+		return -ENOMEM;
+	i915_data->get_power_well = hdmi_get_power_well;
+	i915_data->put_power_well = hdmi_put_power_well;
+
+	dev_set_drvdata(dev, i915_data);
+
+	return 0;
+}
+
+static int hdmi_i915_remove(struct device *dev)
+{
+	struct hdmi_i915_private *i915_data;
+	
+	i915_data = dev_get_drvdata(dev);
+	kfree(i915_data);
+
+	return 0;
+}
 
 static struct device_driver hdmi_i915_driver = {
 	.name =		"hdmi-i915",
 	.bus =		&hda_bus_type,
 	.owner =	THIS_MODULE,
-#if 0
-	.probe =	wm97xx_probe,
-	.remove =	wm97xx_remove,
-	.suspend =	wm97xx_suspend,
-	.resume =	wm97xx_resume,
-#endif
+	.probe =	hdmi_i915_probe,
+	.remove =	hdmi_i915_remove,
+	//.suspend =	hdmi_i915_suspend,
+	//.resume =	hdmi_i915_resume,
 };
 
 static int __init hdmi_i915_init(void)
diff --git a/sound/pci/hda/hdmi_i915.h b/sound/pci/hda/hdmi_i915.h
new file mode 100644
index 0000000..c48cc49
--- /dev/null
+++ b/sound/pci/hda/hdmi_i915.h
@@ -0,0 +1,28 @@
+/*  hdmi_i915.h - header for hdmi_i915 driver
+ *
+ *  This program is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License as published by the Free
+ *  Software Foundation; either version 2 of the License, or (at your option)
+ *  any later version.
+ *
+ *  This program is distributed in the hope that it will be useful, but WITHOUT
+ *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ *  more details.
+ *
+ *  You should have received a copy of the GNU General Public License along with
+ *  this program; if not, write to the Free Software Foundation, Inc., 59
+ *  Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+#ifndef __SOUND_HDMI_I915_H
+#define __SOUND_HDMI_I915_H
+
+struct hdmi_i915_private {
+	//place callbacks here
+	void (*get_power_well)(void);
+	void (*put_power_well)(void);
+};
+
+#endif /* __SOUND_HDMI_I915_H */
+
-- 
1.7.9.5

