[PATCH 2/5][SRU][OEM-5.14][U] ALSA: hda: conexant: Turn off EAPD at suspend, too

You-Sheng Yang vicamo.yang at canonical.com
Fri Sep 3 08:45:31 UTC 2021


From: Takashi Iwai <tiwai at suse.de>

BugLink: https://bugs.launchpad.net/bugs/1942043

Conexant codecs have a workaround for the noise at shutdown to turn
off EAPD, but it wasn't applied at suspend.  In the later patch, we'll
switch from reboot_notify callback to the general suspend-at-shutdown,
so let's apply the workaround to the suspend case, too.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=214045
Link: https://lore.kernel.org/r/20210813081230.4268-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai at suse.de>
(cherry picked from commit 95dc85dba05fa8f84c6db5fee3990fa4dd9fb499)
Signed-off-by: You-Sheng Yang <vicamo.yang at canonical.com>
---
 sound/pci/hda/patch_conexant.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index d111258c6f45..6d2bdef7f017 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -177,13 +177,18 @@ static int cx_auto_init(struct hda_codec *codec)
 	return 0;
 }
 
-static void cx_auto_reboot_notify(struct hda_codec *codec)
+static void cx_auto_shutdown(struct hda_codec *codec)
 {
 	struct conexant_spec *spec = codec->spec;
 
 	/* Turn the problematic codec into D3 to avoid spurious noises
 	   from the internal speaker during (and after) reboot */
 	cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, false);
+}
+
+static void cx_auto_reboot_notify(struct hda_codec *codec)
+{
+	cx_auto_shutdown(codec);
 	snd_hda_gen_reboot_notify(codec);
 }
 
@@ -193,6 +198,14 @@ static void cx_auto_free(struct hda_codec *codec)
 	snd_hda_gen_free(codec);
 }
 
+#ifdef CONFIG_PM
+static int cx_auto_suspend(struct hda_codec *codec)
+{
+	cx_auto_shutdown(codec);
+	return 0;
+}
+#endif
+
 static const struct hda_codec_ops cx_auto_patch_ops = {
 	.build_controls = snd_hda_gen_build_controls,
 	.build_pcms = snd_hda_gen_build_pcms,
@@ -201,6 +214,7 @@ static const struct hda_codec_ops cx_auto_patch_ops = {
 	.free = cx_auto_free,
 	.unsol_event = snd_hda_jack_unsol_event,
 #ifdef CONFIG_PM
+	.suspend = cx_auto_suspend,
 	.check_power_status = snd_hda_gen_check_power_status,
 #endif
 };
-- 
2.32.0




More information about the kernel-team mailing list