From: han.lu@intel.com
To: daniel.vetter@intel.com, tiwai@suse.de, jani.nikula@intel.com,
libin.yang@intel.com, mengdong.lin@intel.com,
intel-gfx@lists.freedesktop.org
Cc: "Lu, Han" <han.lu@intel.com>
Subject: [PATCH-V2 2/2] ALSA:hda - reset display codec when power on
Date: Tue, 28 Apr 2015 18:38:47 +0800 [thread overview]
Message-ID: <1430217527-19937-2-git-send-email-han.lu@intel.com> (raw)
In-Reply-To: <1430217527-19937-1-git-send-email-han.lu@intel.com>
From: "Lu, Han" <han.lu@intel.com>
In SKL, HDMI/DP codec and PCH HD Audio Controller are in different
power wells, so it's necessary to reset display audio codecs when
power well on, otherwise display audio codecs will disappear when
resume from low power state.
The reset step when power on is:
enable codec wakeup -> azx_init_chip() -> disable codec wakeup
The callback is defined in drivers/gpu/drm/i915/.
The caller is in sound/pci/hda/.
Signed-off-by: Lu, Han <han.lu@intel.com>
diff --git a/sound/pci/hda/hda_i915.c b/sound/pci/hda/hda_i915.c
index 3052a2b..e5ebedc 100644
--- a/sound/pci/hda/hda_i915.c
+++ b/sound/pci/hda/hda_i915.c
@@ -33,6 +33,23 @@
#define AZX_REG_EM4 0x100c
#define AZX_REG_EM5 0x1010
+int hda_set_codec_wakeup(struct hda_intel *hda, bool enable)
+{
+ struct i915_audio_component *acomp = &hda->audio_component;
+
+ if (!acomp->ops)
+ return -ENODEV;
+
+ dev_dbg(&hda->chip.pci->dev, "%s codec wakeup\n",
+ enable ? "enable" : "disable");
+ if (enable)
+ acomp->ops->enable_codec_wakeup(acomp->dev);
+ else
+ acomp->ops->disable_codec_wakeup(acomp->dev);
+
+ return 0;
+}
+
int hda_display_power(struct hda_intel *hda, bool enable)
{
struct i915_audio_component *acomp = &hda->audio_component;
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 34040d2..b0f2490 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -819,6 +819,8 @@ static int azx_resume(struct device *dev)
if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) {
hda_display_power(hda, true);
haswell_set_bclk(hda);
+ /* generate codec wakeup signal */
+ hda_set_codec_wakeup(hda, true);
}
if (chip->msi)
if (pci_enable_msi(pci) < 0)
@@ -829,6 +831,10 @@ static int azx_resume(struct device *dev)
azx_init_chip(chip, true);
+ /* disable codec wakeup signal */
+ if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL)
+ hda_set_codec_wakeup(hda, false);
+
snd_power_change_state(card, SNDRV_CTL_POWER_D0);
return 0;
}
@@ -888,6 +894,8 @@ static int azx_runtime_resume(struct device *dev)
if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) {
hda_display_power(hda, true);
haswell_set_bclk(hda);
+ /* generate codec wakeup signal */
+ hda_set_codec_wakeup(hda, true);
}
/* Read STATESTS before controller reset */
@@ -896,6 +904,10 @@ static int azx_runtime_resume(struct device *dev)
azx_init_pci(chip);
azx_init_chip(chip, true);
+ /* disable codec wakeup signal */
+ if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL)
+ hda_set_codec_wakeup(hda, false);
+
bus = chip->bus;
if (status && bus) {
list_for_each_codec(codec, bus)
@@ -1450,6 +1462,7 @@ static int azx_first_init(struct azx *chip)
int dev = chip->dev_index;
struct pci_dev *pci = chip->pci;
struct snd_card *card = chip->card;
+ struct hda_intel *hda = container_of(chip, struct hda_intel, chip);
int err;
unsigned short gcap;
unsigned int dma_bits = 64;
@@ -1582,14 +1595,17 @@ static int azx_first_init(struct azx *chip)
azx_init_pci(chip);
if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) {
- struct hda_intel *hda;
-
- hda = container_of(chip, struct hda_intel, chip);
haswell_set_bclk(hda);
+ /* generate codec wakeup signal */
+ hda_set_codec_wakeup(hda, true);
}
azx_init_chip(chip, (probe_only[dev] & 2) == 0);
+ /* disable codec wakeup signal */
+ if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL)
+ hda_set_codec_wakeup(hda, false);
+
/* codec detection */
if (!chip->codec_mask) {
dev_err(card->dev, "no codecs found!\n");
diff --git a/sound/pci/hda/hda_intel.h b/sound/pci/hda/hda_intel.h
index d5231f7..5d2bb07 100644
--- a/sound/pci/hda/hda_intel.h
+++ b/sound/pci/hda/hda_intel.h
@@ -48,11 +48,16 @@ struct hda_intel {
};
#ifdef CONFIG_SND_HDA_I915
+int hda_set_codec_wakeup(struct hda_intel *hda, bool enable);
int hda_display_power(struct hda_intel *hda, bool enable);
void haswell_set_bclk(struct hda_intel *hda);
int hda_i915_init(struct hda_intel *hda);
int hda_i915_exit(struct hda_intel *hda);
#else
+static inline int hda_set_codec_wakeup(struct hda_intel *hda, bool enable)
+{
+ return 0;
+}
static inline int hda_display_power(struct hda_intel *hda, bool enable)
{
return 0;
--
1.9.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-04-28 10:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-28 10:38 [PATCH-V2 1/2] drm/i915: add callback to enable/disable codec wakeup han.lu
2015-04-28 10:38 ` han.lu [this message]
2015-04-28 14:57 ` [PATCH-V2 2/2] ALSA:hda - reset display codec when power on shuang.he
2015-04-28 14:21 ` [PATCH-V2 1/2] drm/i915: add callback to enable/disable codec wakeup Jani Nikula
2015-04-29 9:41 ` Lu, Han
2015-05-04 15:07 ` Daniel Vetter
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=1430217527-19937-2-git-send-email-han.lu@intel.com \
--to=han.lu@intel.com \
--cc=daniel.vetter@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@intel.com \
--cc=libin.yang@intel.com \
--cc=mengdong.lin@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