From: libin.yang@intel.com
To: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org
Cc: liam.r.girdwood@linux.intel.com, mengdong.lin@intel.com,
libin.yang@intel.com, pierre-louis.bossart@linux.intel.com
Subject: [RFC PATCH v2 1/2] ASoC: refine ASoC hdmi audio suspend/resume
Date: Mon, 7 Jan 2019 10:22:00 +0800 [thread overview]
Message-ID: <1546827721-25586-1-git-send-email-libin.yang@intel.com> (raw)
From: Libin Yang <libin.yang@intel.com>
hdmi_codec_prepare() will trigger hdmi runtime resume, which will set
the bitmask of hdev->addr. And skl_suspend() will clear the bitmask of
HDA_CODEC_IDX_CONTROLLER. HDMI codec idx is not the same as
HDA_CODEC_IDX_CONTROLLER, which means i915 power will not be released
when suspend.
On the other hand, hdmi_codec_prepare() don't need to call
pm_runtime_get_sync() to wake up the audio subsystem (HDMI auido)
for setting the codec registers. Turning display power on with
snd_hdac_display_power() is enough.
Let's use S3 without playback as an example:
hdmi_codec_prepare() invokes the runtime resume of codec =>
snd_hdac_display_power(bus, hdev->addr, true)
skl runtime resume
skl_suspend() =>
snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, false);
THis means hdev->addr will never release the display power when
suspend.
The new sequence will be:
hdmi_codec_prepare() =>
snd_hdac_display_power(bus, hdev->addr, true)
snd_hdac_display_power(bus, hdev->addr, false)
skl runtime resume
skl suspned
Signed-off-by: Libin Yang <libin.yang@intel.com>
---
sound/soc/codecs/hdac_hdmi.c | 6 ++++--
sound/soc/intel/skylake/skl.c | 7 -------
2 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c
index 3ab2949..782b323 100644
--- a/sound/soc/codecs/hdac_hdmi.c
+++ b/sound/soc/codecs/hdac_hdmi.c
@@ -1895,7 +1895,7 @@ static int hdmi_codec_prepare(struct device *dev)
{
struct hdac_device *hdev = dev_to_hdac_dev(dev);
- pm_runtime_get_sync(&hdev->dev);
+ snd_hdac_display_power(hdev->bus, hdev->addr, true);
/*
* Power down afg.
@@ -1906,6 +1906,7 @@ static int hdmi_codec_prepare(struct device *dev)
*/
snd_hdac_codec_read(hdev, hdev->afg, 0, AC_VERB_SET_POWER_STATE,
AC_PWRST_D3);
+ snd_hdac_display_power(hdev->bus, hdev->addr, false);
return 0;
}
@@ -1915,6 +1916,7 @@ static void hdmi_codec_complete(struct device *dev)
struct hdac_device *hdev = dev_to_hdac_dev(dev);
struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
+ snd_hdac_display_power(hdev->bus, hdev->addr, true);
/* Power up afg */
snd_hdac_codec_read(hdev, hdev->afg, 0, AC_VERB_SET_POWER_STATE,
AC_PWRST_D0);
@@ -1930,7 +1932,7 @@ static void hdmi_codec_complete(struct device *dev)
*/
hdac_hdmi_present_sense_all_pins(hdev, hdmi, false);
- pm_runtime_put_sync(&hdev->dev);
+ snd_hdac_display_power(hdev->bus, hdev->addr, false);
}
#else
#define hdmi_codec_prepare NULL
diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c
index 60c9483..89f4d66 100644
--- a/sound/soc/intel/skylake/skl.c
+++ b/sound/soc/intel/skylake/skl.c
@@ -336,9 +336,6 @@ static int skl_suspend(struct device *dev)
skl->skl_sst->fw_loaded = false;
}
- if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI))
- snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, false);
-
return 0;
}
@@ -350,10 +347,6 @@ static int skl_resume(struct device *dev)
struct hdac_ext_link *hlink = NULL;
int ret;
- /* Turned OFF in HDMI codec driver after codec reconfiguration */
- if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI))
- snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, true);
-
/*
* resume only when we are not in suspend active, otherwise need to
* restore the device
--
2.7.4
next reply other threads:[~2019-01-07 2:33 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-07 2:22 libin.yang [this message]
2019-01-07 2:22 ` [RFC PATCH v2 2/2] ASoC: add asoc hdmi audio trigger handler libin.yang
2019-01-07 16:58 ` [RFC PATCH v2 1/2] ASoC: refine ASoC hdmi audio suspend/resume Pierre-Louis Bossart
2019-01-08 7:53 ` Yang, Libin
2019-01-08 11:14 ` Takashi Iwai
2019-01-09 8:16 ` Yang, Libin
2019-01-09 8:29 ` Takashi Iwai
2019-01-09 9:13 ` Takashi Iwai
2019-01-10 5:30 ` Yang, Libin
2019-01-10 12:16 ` Takashi Iwai
2019-01-11 5:20 ` Yang, Libin
2019-01-11 13:34 ` Takashi Iwai
2019-01-11 14:24 ` Takashi Iwai
2019-01-11 15:43 ` Takashi Iwai
2019-01-12 1:46 ` Yang, Libin
2019-01-12 7:43 ` Takashi Iwai
2019-01-14 1:16 ` Keyon Jie
2019-01-14 6:44 ` Takashi Iwai
2019-01-11 14:35 ` Yang, Libin
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=1546827721-25586-1-git-send-email-libin.yang@intel.com \
--to=libin.yang@intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=liam.r.girdwood@linux.intel.com \
--cc=mengdong.lin@intel.com \
--cc=pierre-louis.bossart@linux.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.