ASoC: codec: hdac_hdmi add device_link to card device
PATCH v2 1/1 ASoC: codec: hdac_hdmi add device_link to card device
From: Libin Yang <[email protected]>
In resume from S3, HDAC HDMI codec driver dapm event callback may be operated before HDMI codec driver turns on the display audio power domain because of the contest between display driver and hdmi codec driver.
This patch adds the device_link between soc card device (consumer) and hdmi codec device (supplier) to make sure the sequence is always correct.
--- sound/soc/codecs/hdac_hdmi.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
sound/soc/codecs/hdac_hdmi.c +11 -0
@@ -1855,6 +1855,17 @@ static int hdmi_codec_probe(struct snd_soc_component *component) hdmi->card = dapm->card->snd_card;/* +* Setup a device_link between card device and HDMI codec device. +* The card device is the consumer and the HDMI codec device is +* the supplier. With this setting, we can make sure that the audio +* domain in display power will be always turned on before operating +* on the HDMI audio codec registers. +* Let's use the flag DL_FLAG_AUTOREMOVE_CONSUMER. This can make +* sure the device link is freed when the machine driver is removed. +*/ +device_link_add (component->card->dev, &hdev->dev,DL_FLAG_RPM_ACTIVE | +DL_FLAG_AUTOREMOVE_CONSUMER ); +/* * hdac_device core already sets the state to active and calls * get_noresume. So enable runtime and set the device to suspend. */
Signature · 1 line
2.7.4
Quoted 11 lines · On Sat, 13 Apr 2019 15:18:12 +0200, [email protected] wrote:
From: Libin Yang <[email protected]>
In resume from S3, HDAC HDMI codec driver dapm event callback may be operated before HDMI codec driver turns on the display audio power domain because of the contest between display driver and hdmi codec driver.
This patch adds the
device_linkbetween soc card device (consumer) and hdmi codec device (supplier) to make sure the sequence is always correct.Signed-off-by Libin Yang <[email protected]>
Is it an issue that has been present for older released kernels? If so, it deserves for Cc-to-stable.
thanks,
Takashi
Quoted 29 lines
--- sound/soc/codecs/hdac_hdmi.c | 11 +++++++++++ 1 file changed, 11 insertions(+)sound/soc/codecs/hdac_hdmi.c +11
-0@@ -1855,6 +1855,17 @@ static int hdmi_codec_probe(struct snd_soc_component *component) hdmi->card = dapm->card->snd_card;/* +* Setup a device_link between card device and HDMI codec device. +* The card device is the consumer and the HDMI codec device is +* the supplier. With this setting, we can make sure that the audio +* domain in display power will be always turned on before operating +* on the HDMI audio codec registers. +* Let's use the flag DL_FLAG_AUTOREMOVE_CONSUMER. This can make +* sure the device link is freed when the machine driver is removed. +*/ +device_link_add (component->card->dev, &hdev->dev,DL_FLAG_RPM_ACTIVE | +DL_FLAG_AUTOREMOVE_CONSUMER ); +/* * hdac_device core already sets the state to active and calls * get_noresume. So enable runtime and set the device to suspend. */ Signature · 1 line
2.7.4
Quoted 12 lines · Takashi Iwai
Quoted 10 lines · On Sat, 13 Apr 2019 15:18:12 +0200, [email protected] wrote:
From: Libin Yang <[email protected]>
In resume from S3, HDAC HDMI codec driver dapm event callback may be operated before HDMI codec driver turns on the display audio power domain because of the contest between display driver and hdmi codec driver.
This patch adds the
device_linkbetween soc card device (consumer) and hdmi codec device (supplier) to make sure the sequence is always correct.
Quoted 6 lines
Quoted 1 line
Signed-off-by Libin Yang <[email protected]>Reviewed-by Takashi Iwai <[email protected]>Is it an issue that has been present for older released kernels? If so, it deserves for Cc-to-stable.
Yes and no. In theory the same problem impacts the Skylake driver. However its support for HDMI has been flaky at best, see e.g. the probe/timing issues on Linus' laptop and a variety of devices in December, and the only real distribution using it - ChromeOS - does not resume from S3. Not to mention that products typically use 3.18 to 4.9.
Quoted 14 lines
Quoted 4 lines
Quoted 4 lines
In resume from S3, HDAC HDMI codec driver dapm event callback may be operated before HDMI codec driver turns on the display audio power domain because of the contest between display driver and hdmi codec
driver.
Quoted 3 lines
Quoted 3 lines
This patch adds the
device_linkbetween soc card device (consumer) and hdmi codec device (supplier) to make sure the sequence is alwayscorrect.
Quoted 5 lines
Quoted 2 lines
Signed-off-by Libin Yang <[email protected]>Reviewed-by Takashi Iwai <[email protected]>
Quoted 8 lines
Quoted 2 lines
Is it an issue that has been present for older released kernels? If so, it deserves for Cc-to-stable.
Yes and no. In theory the same problem impacts the Skylake driver. However its support for HDMI has been flaky at best, see e.g. the probe/timing issues on Linus' laptop and a variety of devices in December, and the only real distribution using it - ChromeOS - does not resume from S3. Not to mention that products typically use 3.18 to 4.9.
Agree with Pierre. I have tested on 4.1x before (I didn't remember the exact version number), it works well. On some later stable versions, for example 5.0.0, we can easily reproduce this issue.
And for other earlier version, I didn't have ever test on it.
Regards,
Libin
Hi Takashi,
Quoted 17 lines
-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Tuesday, April 16, 2019 6:24 PM
To: Yang, Libin <[email protected]>
Cc: [email protected]; [email protected]; pierre- [email protected]
Subject: Re: [alsa-devel] [PATCH v2] ASoC: codec:hdac_hdmiadddevice_linkto card deviceQuoted 6 lines · On Sat, 13 Apr 2019 15:18:12 +0200, [email protected] wrote:
From: Libin Yang <[email protected]>
In resume from S3, HDAC HDMI codec driver dapm event callback may be operated before HDMI codec driver turns on the display audio power domain because of the contest between display driver and hdmi codec
Quoted 8 lines
driver.
Quoted 5 lines
This patch adds the
device_linkbetween soc card device (consumer) and hdmi codec device (supplier) to make sure the sequence is always correct.Signed-off-by Libin Yang <[email protected]>Reviewed-by Takashi Iwai <[email protected]>
Thanks for the review.
Quoted 3 lines
Is it an issue that has been present for older released kernels? If so, it deserves for Cc-to-stable.
It is for all released kernels, and the rates of reproduce are different. It's graphics driver related.
Regards,
Libin
Quoted 38 lines
thanks,
Takashi
sound/soc/codecs/hdac_hdmi.c static int hdmi_codec_probe(struct
Quoted 9 lines
--- sound/soc/codecs/hdac_hdmi.c | 11 +++++++++++ 1 file changed, 11 insertions(+)(quoted diff) +0
-0
b/sound/soc/codecs/hdac_hdmi.cindex 5eeb0fe..4de1fbf 100644sound/soc/codecs/hdac_hdmi.c +0
-0@@ -1855,6 +1855,17 @@ static int hdmi_codec_probe(struct
snd_soc_component*component)sound/soc/codecs/hdac_hdmi.c static int hdmi_codec_probe(struct snd_soc_component *component)
Quoted 9 lines
sound/soc/codecs/hdac_hdmi.c +6
-0hdmi->card = dapm->card->snd_card;/* +* Setup a device_link between card device and HDMI codec device. +* The card device is the consumer and the HDMI codec device is +* the supplier. With this setting, we can make sure that the audio +* domain in display power will be always turned on before operating +* on the HDMI audio codec registers. +* Let's use the flag DL_FLAG_AUTOREMOVE_CONSUMER. This can make
sound/soc/codecs/hdac_hdmi.c static int hdmi_codec_probe(struct snd_soc_component *component)
Quoted 3 lines
sound/soc/codecs/hdac_hdmi.c +3
-0+* sure the device link is freed when the machine driver is removed. +*/ + device_link_add(component->card->dev, &hdev->dev,
DL_FLAG_RPM_ACTIVE|Quoted 8 lines
sound/soc/codecs/hdac_hdmi.c +2
-1+ DL_FLAG_AUTOREMOVE_CONSUMER); +/* * hdac_device core already sets the state to active and calls * get_noresume. So enable runtime and set the device to suspend. */ --2.7.4
Quoted 10 lines · On 4/13/19 8:18 AM, [email protected] wrote:
From: Libin Yang <[email protected]>
In resume from S3, HDAC HDMI codec driver dapm event callback may be operated before HDMI codec driver turns on the display audio power domain because of the contest between display driver and hdmi codec driver.
This patch adds the
device_linkbetween soc card device (consumer) and hdmi codec device (supplier) to make sure the sequence is always correct.Signed-off-by Libin Yang <[email protected]>
Libin, please follow-up on the question from Takashi on CC:ing to stable. I would guess this probably would be needed for 4.14+, older stuff is unlikely to work anyways due to other issues.
Quoted 27 lines
--- sound/soc/codecs/hdac_hdmi.c | 11 +++++++++++ 1 file changed, 11 insertions(+)sound/soc/codecs/hdac_hdmi.c +11
-0@@ -1855,6 +1855,17 @@ static int hdmi_codec_probe(struct snd_soc_component *component) hdmi->card = dapm->card->snd_card;/* +* Setup a device_link between card device and HDMI codec device. +* The card device is the consumer and the HDMI codec device is +* the supplier. With this setting, we can make sure that the audio +* domain in display power will be always turned on before operating +* on the HDMI audio codec registers. +* Let's use the flag DL_FLAG_AUTOREMOVE_CONSUMER. This can make +* sure the device link is freed when the machine driver is removed. +*/ +device_link_add (component->card->dev, &hdev->dev,DL_FLAG_RPM_ACTIVE | +DL_FLAG_AUTOREMOVE_CONSUMER ); +/* * hdac_device core already sets the state to active and calls * get_noresume. So enable runtime and set the device to suspend. */