[alsa-devel] [PATCH 2/5] ALSA: hda - Add external module hda-i915 for power well

Wang Xingchao xingchao.wang at linux.intel.com
Mon May 13 09:37:25 CEST 2013


This new added external module hda_i915 only built in when
gfx i915 module built in. It includes hda_display_power()
api implementation for hda controller driver, which will
ask gfx driver for reqeust/release power well on Intel Haswell.

Signed-off-by: Wang Xingchao <xingchao.wang at linux.intel.com>
---
 sound/pci/hda/Kconfig    |   13 +++++++++++++
 sound/pci/hda/Makefile   |    6 ++++++
 sound/pci/hda/hda_i915.c |   37 +++++++++++++++++++++++++++++++++++++
 sound/pci/hda/hda_i915.h |   10 ++++++++++
 4 files changed, 66 insertions(+)
 create mode 100644 sound/pci/hda/hda_i915.c
 create mode 100644 sound/pci/hda/hda_i915.h

diff --git a/sound/pci/hda/Kconfig b/sound/pci/hda/Kconfig
index 80a7d44..8347325 100644
--- a/sound/pci/hda/Kconfig
+++ b/sound/pci/hda/Kconfig
@@ -152,6 +152,19 @@ config SND_HDA_CODEC_HDMI
 	  snd-hda-codec-hdmi.
 	  This module is automatically loaded at probing.
 
+config SND_HDA_I915
+	bool "Build Display HD-audio controller/codec power well support for i915 cards"
+	depends on DRM_I915
+	default y
+	help
+	  Say Y here to include full HDMI and DisplayPort HD-audio controller/codec
+	  support for Intel Haswell graphics cards based on the i915 driver.
+
+	  When the HD-audio driver is built as a module, the controller/codec
+	  support code is also built as another module,
+	  snd-hda-i915.
+	  This module is automatically loaded at probing.
+
 config SND_HDA_CODEC_CIRRUS
 	bool "Build Cirrus Logic codec support"
 	default y
diff --git a/sound/pci/hda/Makefile b/sound/pci/hda/Makefile
index 24a2514..00768dd 100644
--- a/sound/pci/hda/Makefile
+++ b/sound/pci/hda/Makefile
@@ -6,6 +6,9 @@ snd-hda-codec-$(CONFIG_PROC_FS) += hda_proc.o
 snd-hda-codec-$(CONFIG_SND_HDA_HWDEP) += hda_hwdep.o
 snd-hda-codec-$(CONFIG_SND_HDA_INPUT_BEEP) += hda_beep.o
 
+# for haswell power well
+snd-hda-i915-objs :=	hda_i915.o
+
 # for trace-points
 CFLAGS_hda_codec.o := -I$(src)
 CFLAGS_hda_intel.o := -I$(src)
@@ -59,6 +62,9 @@ endif
 ifdef CONFIG_SND_HDA_CODEC_HDMI
 obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-codec-hdmi.o
 endif
+ifdef CONFIG_SND_HDA_I915
+obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-i915.o
+endif
 
 # this must be the last entry after codec drivers;
 # otherwise the codec patches won't be hooked before the PCI probe
diff --git a/sound/pci/hda/hda_i915.c b/sound/pci/hda/hda_i915.c
new file mode 100644
index 0000000..7e8ddaa
--- /dev/null
+++ b/sound/pci/hda/hda_i915.c
@@ -0,0 +1,37 @@
+/*
+ *  patch_hdmi_i915.c - routines for Haswell HDMI/DisplayPort power well
+ *
+ *  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.
+ */
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <sound/core.h>
+#include <drm/i915_powerwell.h>
+#include "hda_i915.h"
+
+/* Power well has impact on Haswell controller and codecs */
+void hda_display_power(bool enable)
+{
+	snd_printk(KERN_INFO "HDA display power %d \n", enable);
+	if (enable)
+		i915_request_power_well("hda");
+	else
+		i915_release_power_well("hda");
+}
+EXPORT_SYMBOL(hda_display_power);
+
+MODULE_DESCRIPTION("HDA power well");
+MODULE_LICENSE("GPL");
diff --git a/sound/pci/hda/hda_i915.h b/sound/pci/hda/hda_i915.h
new file mode 100644
index 0000000..a7e5324
--- /dev/null
+++ b/sound/pci/hda/hda_i915.h
@@ -0,0 +1,10 @@
+#ifndef __SOUND_HDA_I915_H
+#define __SOUND_HDA_I915_H
+
+#ifdef CONFIG_SND_HDA_I915
+void hda_display_power(bool enable);
+#else
+void hda_display_power(bool enable) {}
+#endif
+
+#endif
-- 
1.7.9.5



More information about the Alsa-devel mailing list