Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH 2/4] ALSA: hda/senary: Implement proper resume callback
@ 2026-03-05  3:27 wangdich9700
  2026-03-05 11:35 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: wangdich9700 @ 2026-03-05  3:27 UTC (permalink / raw)
  To: bo.liu, perex, tiwai; +Cc: linux-sound, linux-kernel, wangdicheng

From: wangdicheng <wangdicheng@kylinos.cn>

The SN6186 codec requires register re-synchronization after resume from
S3 state. The current driver lacks a resume callback, which may lead to
loss of hardware state or audio malfunction after system resume.

This patch adds a resume callback that:
1. Syncs the regcache to restore register values.
2. Re-applies the vendor-specific hardware init verbs.
3. Reports jack status to update the audio path.

Signed-off-by: wangdicheng <wangdicheng@kylinos.cn>
---
 sound/hda/codecs/senarytech.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/sound/hda/codecs/senarytech.c b/sound/hda/codecs/senarytech.c
index f9a389df3a17..8ebd974817ac 100644
--- a/sound/hda/codecs/senarytech.c
+++ b/sound/hda/codecs/senarytech.c
@@ -205,6 +205,18 @@ static int senary_suspend(struct hda_codec *codec)
 	return 0;
 }
 
+static int senary_resume(struct hda_codec *codec)
+{
+	/* Re-sync registers */
+	regcache_sync(codec->core.regmap);
+
+	/* Re-run init verbs to restore hardware state */
+	senary_init_verb(codec);
+
+	snd_hda_jack_report_sync(codec);
+	return 0;
+}
+
 static int senary_probe(struct hda_codec *codec, const struct hda_device_id *id)
 {
 	struct senary_spec *spec;
@@ -286,6 +298,7 @@ static const struct hda_codec_ops senary_codec_ops = {
 	.init = senary_init,
 	.unsol_event = snd_hda_jack_unsol_event,
 	.suspend = senary_suspend,
+	.resume = senary_resume,
 	.check_power_status = snd_hda_gen_check_power_status,
 	.stream_pm = snd_hda_gen_stream_pm,
 };
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/4] ALSA: hda/senary: Implement proper resume callback
  2026-03-05  3:27 [PATCH 2/4] ALSA: hda/senary: Implement proper resume callback wangdich9700
@ 2026-03-05 11:35 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2026-03-05 11:35 UTC (permalink / raw)
  To: wangdich9700; +Cc: bo.liu, perex, tiwai, linux-sound, linux-kernel, wangdicheng

On Thu, 05 Mar 2026 04:27:28 +0100,
wangdich9700@163.com wrote:
> 
> From: wangdicheng <wangdicheng@kylinos.cn>
> 
> The SN6186 codec requires register re-synchronization after resume from
> S3 state.

When no resume callback is set, regcache_sync() is called via
snd_hdac_regmap_sync(), but after snd_hda_codec_init().

So this looks superfluous to me.  Please check whether something
really missing or not.


thanks,

Takashi


> The current driver lacks a resume callback, which may lead to
> loss of hardware state or audio malfunction after system resume.
> 
> This patch adds a resume callback that:
> 1. Syncs the regcache to restore register values.
> 2. Re-applies the vendor-specific hardware init verbs.
> 3. Reports jack status to update the audio path.
> 
> Signed-off-by: wangdicheng <wangdicheng@kylinos.cn>
> ---
>  sound/hda/codecs/senarytech.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/sound/hda/codecs/senarytech.c b/sound/hda/codecs/senarytech.c
> index f9a389df3a17..8ebd974817ac 100644
> --- a/sound/hda/codecs/senarytech.c
> +++ b/sound/hda/codecs/senarytech.c
> @@ -205,6 +205,18 @@ static int senary_suspend(struct hda_codec *codec)
>  	return 0;
>  }
>  
> +static int senary_resume(struct hda_codec *codec)
> +{
> +	/* Re-sync registers */
> +	regcache_sync(codec->core.regmap);
> +
> +	/* Re-run init verbs to restore hardware state */
> +	senary_init_verb(codec);
> +
> +	snd_hda_jack_report_sync(codec);
> +	return 0;
> +}
> +
>  static int senary_probe(struct hda_codec *codec, const struct hda_device_id *id)
>  {
>  	struct senary_spec *spec;
> @@ -286,6 +298,7 @@ static const struct hda_codec_ops senary_codec_ops = {
>  	.init = senary_init,
>  	.unsol_event = snd_hda_jack_unsol_event,
>  	.suspend = senary_suspend,
> +	.resume = senary_resume,
>  	.check_power_status = snd_hda_gen_check_power_status,
>  	.stream_pm = snd_hda_gen_stream_pm,
>  };
> -- 
> 2.25.1
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-03-05 11:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-05  3:27 [PATCH 2/4] ALSA: hda/senary: Implement proper resume callback wangdich9700
2026-03-05 11:35 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox