Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Wang Xingchao <xingchao.wang@linux.intel.com>
To: tiwai@suse.de, daniel@ffwll.ch, liam.r.girdwood@intel.com
Cc: alsa-devel@alsa-project.org, paulo.r.zanoni@intel.com,
	jocelyn.li@intel.com, mengdong.lin@intel.com,
	intel-gfx@lists.freedesktop.org,
	Wang Xingchao <xingchao.wang@linux.intel.com>,
	jesse.barnes@intel.com, david.henningsson@canonical.com
Subject: [PATCH 2/5] ALSA: hda - Add external module hda-i915 for power well
Date: Mon, 13 May 2013 15:37:25 +0800	[thread overview]
Message-ID: <1368430648-2353-3-git-send-email-xingchao.wang@linux.intel.com> (raw)
In-Reply-To: <1368430648-2353-1-git-send-email-xingchao.wang@linux.intel.com>

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@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

  parent reply	other threads:[~2013-05-13  7:38 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-13  7:37 [PATCH 0/5] Power-well API implementation for Haswell Wang Xingchao
2013-05-13  7:37 ` [PATCH 1/5] drm/915: Add private api for power well usage Wang Xingchao
2013-05-13 12:29   ` Takashi Iwai
2013-05-13  7:37 ` Wang Xingchao [this message]
2013-05-13 12:32   ` [PATCH 2/5] ALSA: hda - Add external module hda-i915 for power well Takashi Iwai
2013-05-13  7:37 ` [PATCH 3/5] ALSA: hda - Power well request/release for hda controller Wang Xingchao
2013-05-13  7:37 ` [PATCH 4/5] ALSA: hda - Fix module dependency with gfx i915 Wang Xingchao
2013-05-13 12:34   ` Takashi Iwai
2013-05-13  7:37 ` [PATCH 5/5] ALSA/i915: Check power well API existense before calling Wang Xingchao
2013-05-13  8:28   ` David Henningsson
2013-05-13  8:55     ` Jaroslav Kysela
2013-05-13  8:59       ` [alsa-devel] " Takashi Iwai
2013-05-13  9:53         ` Jaroslav Kysela
2013-05-13 12:00       ` Wang, Xingchao
2013-05-13 11:55     ` [alsa-devel] " Wang, Xingchao
2013-05-13 12:13       ` David Henningsson
2013-05-13 13:50         ` Wang, Xingchao
2013-05-13 15:37           ` David Henningsson
2013-05-13 12:17       ` Takashi Iwai
2013-05-13 13:43         ` Wang, Xingchao
2013-05-13 12:38   ` [alsa-devel] " Takashi Iwai
2013-05-13  7:51 ` [alsa-devel] [PATCH 0/5] Power-well API implementation for Haswell Wang, Xingchao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1368430648-2353-3-git-send-email-xingchao.wang@linux.intel.com \
    --to=xingchao.wang@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=daniel@ffwll.ch \
    --cc=david.henningsson@canonical.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jesse.barnes@intel.com \
    --cc=jocelyn.li@intel.com \
    --cc=liam.r.girdwood@intel.com \
    --cc=mengdong.lin@intel.com \
    --cc=paulo.r.zanoni@intel.com \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox