* [PATCH] ALSA: hda/conexant: Fix microphone mute after power-on reboot
@ 2026-07-01 6:55 dengxiang
2026-07-01 7:37 ` Takashi Iwai
0 siblings, 1 reply; 4+ messages in thread
From: dengxiang @ 2026-07-01 6:55 UTC (permalink / raw)
To: tiwai, bo.liu; +Cc: linux-sound, linux-kernel, alsa-devel, dengxiang
Some devices have mute settings in their firmware set by the factory.
This is to stop popping noise when the devices turn on. But this setting
makes the microphones unable to record sound properly. This patch
solves this problem and is compatible with conexant chips.
Signed-off-by: dengxiang <os_dengxiang82@126.com>
---
sound/hda/codecs/conexant.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/sound/hda/codecs/conexant.c b/sound/hda/codecs/conexant.c
index 3d92262763f6..3229f9ef5969 100644
--- a/sound/hda/codecs/conexant.c
+++ b/sound/hda/codecs/conexant.c
@@ -1184,6 +1184,24 @@ static void add_cx5051_fake_mutes(struct hda_codec *codec)
spec->gen.dac_min_mute = true;
}
+static void cxt_fixed_mic_boost(struct hda_codec *codec, hda_nid_t node_id)
+{
+ struct conexant_spec *spec = codec->spec;
+ unsigned int value = 0;
+
+ value = snd_hda_codec_read(codec, node_id, 0, AC_VERB_GET_AMP_GAIN_MUTE, 0);
+ snd_hda_codec_amp_stereo(codec, node_id, HDA_INPUT, 0, HDA_AMP_VOLMASK, value);
+}
+
+static void cxt_capture_hook(struct hda_pcm_stream *hinfo, struct hda_codec *codec,
+ struct snd_pcm_substream *substream, int action)
+{
+ struct conexant_spec *spec = codec->spec;
+ hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
+
+ cxt_fixed_mic_boost(codec, mux_pin);
+}
+
static int cx_probe(struct hda_codec *codec, const struct hda_device_id *id)
{
struct conexant_spec *spec;
@@ -1271,6 +1289,9 @@ static int cx_probe(struct hda_codec *codec, const struct hda_device_id *id)
if (err < 0)
goto error;
+ if (spec->gen.pcm_capture_hook == NULL)
+ spec->gen.pcm_capture_hook = cxt_capture_hook;
+
/* Some laptops with Conexant chips show stalls in S3 resume,
* which falls into the single-cmd mode.
* Better to make reset, then.
--
2.39.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ALSA: hda/conexant: Fix microphone mute after power-on reboot
2026-07-01 6:55 [PATCH] ALSA: hda/conexant: Fix microphone mute after power-on reboot dengxiang
@ 2026-07-01 7:37 ` Takashi Iwai
[not found] ` <235d28fc.65dd.19f1cc1a68d.Coremail.os_dengxiang82@126.com>
0 siblings, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2026-07-01 7:37 UTC (permalink / raw)
To: dengxiang; +Cc: tiwai, bo.liu, linux-sound, linux-kernel, alsa-devel
On Wed, 01 Jul 2026 08:55:33 +0200,
dengxiang wrote:
>
> Some devices have mute settings in their firmware set by the factory.
> This is to stop popping noise when the devices turn on. But this setting
> makes the microphones unable to record sound properly. This patch
> solves this problem and is compatible with conexant chips.
>
> Signed-off-by: dengxiang <os_dengxiang82@126.com>
Hmm, this doesn't look like a right solution.
Is it only the problem after the boot? Or is it an issue after the
runtime PM suspend? The amp value must be restored by the runtime
resume, and if this doesn't work expected, it's a thing to be
addressed there, not in the PCM hook at all.
thanks,
Takashi
> ---
> sound/hda/codecs/conexant.c | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/sound/hda/codecs/conexant.c b/sound/hda/codecs/conexant.c
> index 3d92262763f6..3229f9ef5969 100644
> --- a/sound/hda/codecs/conexant.c
> +++ b/sound/hda/codecs/conexant.c
> @@ -1184,6 +1184,24 @@ static void add_cx5051_fake_mutes(struct hda_codec *codec)
> spec->gen.dac_min_mute = true;
> }
>
> +static void cxt_fixed_mic_boost(struct hda_codec *codec, hda_nid_t node_id)
> +{
> + struct conexant_spec *spec = codec->spec;
> + unsigned int value = 0;
> +
> + value = snd_hda_codec_read(codec, node_id, 0, AC_VERB_GET_AMP_GAIN_MUTE, 0);
> + snd_hda_codec_amp_stereo(codec, node_id, HDA_INPUT, 0, HDA_AMP_VOLMASK, value);
> +}
> +
> +static void cxt_capture_hook(struct hda_pcm_stream *hinfo, struct hda_codec *codec,
> + struct snd_pcm_substream *substream, int action)
> +{
> + struct conexant_spec *spec = codec->spec;
> + hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
> +
> + cxt_fixed_mic_boost(codec, mux_pin);
> +}
> +
> static int cx_probe(struct hda_codec *codec, const struct hda_device_id *id)
> {
> struct conexant_spec *spec;
> @@ -1271,6 +1289,9 @@ static int cx_probe(struct hda_codec *codec, const struct hda_device_id *id)
> if (err < 0)
> goto error;
>
> + if (spec->gen.pcm_capture_hook == NULL)
> + spec->gen.pcm_capture_hook = cxt_capture_hook;
> +
> /* Some laptops with Conexant chips show stalls in S3 resume,
> * which falls into the single-cmd mode.
> * Better to make reset, then.
> --
> 2.39.5
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ALSA: hda/conexant: Fix microphone mute after power-on reboot
[not found] ` <235d28fc.65dd.19f1cc1a68d.Coremail.os_dengxiang82@126.com>
@ 2026-07-01 8:30 ` Takashi Iwai
[not found] ` <4932c551.6ece.19f1cdd10ba.Coremail.os_dengxiang82@126.com>
0 siblings, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2026-07-01 8:30 UTC (permalink / raw)
To: os_dengxiang82; +Cc: tiwai, bo.liu, linux-sound, linux-kernel, alsa-devel
On Wed, 01 Jul 2026 10:18:00 +0200,
os_dengxiang82 wrote:
>
>
> Hi Takashi,
>
> This failure occurs during bootup as well as after runtime resume. Does
> runtime resume here refer to the resume handler, like .resume = cx_resume? or
> something else? Looking forward to your reply.
It's hda_codec_runtime_resume(). We have no Conexant-specific resume
callback, hence the standard procedure is applied, i.e.
regcache_mark_dirty() and snd_hda_regmap_sync() make the codec verbs
resumed that have been touched. So, you'd need to check whether the
needed amp has been already accessed via regmap, and check whether the
value gets restored properly in the procedure above.
Takashi
>
> xiang
>
> At 2026-07-01 15:37:22, "Takashi Iwai" <tiwai@suse.de> wrote:
> >On Wed, 01 Jul 2026 08:55:33 +0200,
> >dengxiang wrote:
> >>
> >> Some devices have mute settings in their firmware set by the factory.
> >> This is to stop popping noise when the devices turn on. But this setting
> >> makes the microphones unable to record sound properly. This patch
> >> solves this problem and is compatible with conexant chips.
> >>
> >> Signed-off-by: dengxiang <os_dengxiang82@126.com>
> >
> >Hmm, this doesn't look like a right solution.
> >
> >Is it only the problem after the boot? Or is it an issue after the
> >runtime PM suspend? The amp value must be restored by the runtime
> >resume, and if this doesn't work expected, it's a thing to be
> >addressed there, not in the PCM hook at all.
> >
> >
> >thanks,
> >
> >Takashi
> >
> >> ---
> >> sound/hda/codecs/conexant.c | 21 +++++++++++++++++++++
> >> 1 file changed, 21 insertions(+)
> >>
> >> diff --git a/sound/hda/codecs/conexant.c b/sound/hda/codecs/conexant.c
> >> index 3d92262763f6..3229f9ef5969 100644
> >> --- a/sound/hda/codecs/conexant.c
> >> +++ b/sound/hda/codecs/conexant.c
> >> @@ -1184,6 +1184,24 @@ static void add_cx5051_fake_mutes(struct hda_codec *codec)
> >> spec->gen.dac_min_mute = true;
> >> }
> >>
> >> +static void cxt_fixed_mic_boost(struct hda_codec *codec, hda_nid_t node_id)
> >> +{
> >> + struct conexant_spec *spec = codec->spec;
> >> + unsigned int value = 0;
> >> +
> >> + value = snd_hda_codec_read(codec, node_id, 0, AC_VERB_GET_AMP_GAIN_MUTE, 0);
> >> + snd_hda_codec_amp_stereo(codec, node_id, HDA_INPUT, 0, HDA_AMP_VOLMASK, value);
> >> +}
> >> +
> >> +static void cxt_capture_hook(struct hda_pcm_stream *hinfo, struct hda_codec *codec,
> >> + struct snd_pcm_substream *substream, int action)
> >> +{
> >> + struct conexant_spec *spec = codec->spec;
> >> + hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
> >> +
> >> + cxt_fixed_mic_boost(codec, mux_pin);
> >> +}
> >> +
> >> static int cx_probe(struct hda_codec *codec, const struct hda_device_id *id)
> >> {
> >> struct conexant_spec *spec;
> >> @@ -1271,6 +1289,9 @@ static int cx_probe(struct hda_codec *codec, const struct hda_device_id *id)
> >> if (err < 0)
> >> goto error;
> >>
> >> + if (spec->gen.pcm_capture_hook == NULL)
> >> + spec->gen.pcm_capture_hook = cxt_capture_hook;
> >> +
> >> /* Some laptops with Conexant chips show stalls in S3 resume,
> >> * which falls into the single-cmd mode.
> >> * Better to make reset, then.
> >> --
> >> 2.39.5
> >>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ALSA: hda/conexant: Fix microphone mute after power-on reboot
[not found] ` <4932c551.6ece.19f1cdd10ba.Coremail.os_dengxiang82@126.com>
@ 2026-07-01 8:50 ` Takashi Iwai
0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2026-07-01 8:50 UTC (permalink / raw)
To: os_dengxiang82; +Cc: tiwai, bo.liu, linux-sound, linux-kernel, alsa-devel
On Wed, 01 Jul 2026 10:47:57 +0200,
os_dengxiang82 wrote:
>
>
> I have already tried calling regcache_mark_dirty() and snd_hda_regmap_sync()
> inside the resume callback, and I’ve also attempted this during the bootup
> phase. But the issue is still present.
Then you need to investigate why this doesn't suffice, instead of an
ad hoc workaround :) We can take a workaround fix, too, but only when
it's the only appropriate solution.
thanks,
Takashi
> At 2026-07-01 16:30:22, "Takashi Iwai" <tiwai@suse.de> wrote:
> >On Wed, 01 Jul 2026 10:18:00 +0200,
> >os_dengxiang82 wrote:
> >>
> >>
> >> Hi Takashi,
> >>
> >> This failure occurs during bootup as well as after runtime resume. Does
> >> runtime resume here refer to the resume handler, like .resume = cx_resume? or
> >> something else? Looking forward to your reply.
> >
> >It's hda_codec_runtime_resume(). We have no Conexant-specific resume
> >callback, hence the standard procedure is applied, i.e.
> >regcache_mark_dirty() and snd_hda_regmap_sync() make the codec verbs
> >resumed that have been touched. So, you'd need to check whether the
> >needed amp has been already accessed via regmap, and check whether the
> >value gets restored properly in the procedure above.
> >
> >
> >Takashi
> >
> >>
> >> xiang
> >>
> >> At 2026-07-01 15:37:22, "Takashi Iwai" <tiwai@suse.de> wrote:
> >> >On Wed, 01 Jul 2026 08:55:33 +0200,
> >> >dengxiang wrote:
> >> >>
> >> >> Some devices have mute settings in their firmware set by the factory.
> >> >> This is to stop popping noise when the devices turn on. But this setting
> >> >> makes the microphones unable to record sound properly. This patch
> >> >> solves this problem and is compatible with conexant chips.
> >> >>
> >> >> Signed-off-by: dengxiang <os_dengxiang82@126.com>
> >> >
> >> >Hmm, this doesn't look like a right solution.
> >> >
> >> >Is it only the problem after the boot? Or is it an issue after the
> >> >runtime PM suspend? The amp value must be restored by the runtime
> >> >resume, and if this doesn't work expected, it's a thing to be
> >> >addressed there, not in the PCM hook at all.
> >> >
> >> >
> >> >thanks,
> >> >
> >> >Takashi
> >> >
> >> >> ---
> >> >> sound/hda/codecs/conexant.c | 21 +++++++++++++++++++++
> >> >> 1 file changed, 21 insertions(+)
> >> >>
> >> >> diff --git a/sound/hda/codecs/conexant.c b/sound/hda/codecs/conexant.c
> >> >> index 3d92262763f6..3229f9ef5969 100644
> >> >> --- a/sound/hda/codecs/conexant.c
> >> >> +++ b/sound/hda/codecs/conexant.c
> >> >> @@ -1184,6 +1184,24 @@ static void add_cx5051_fake_mutes(struct hda_codec *codec)
> >> >> spec->gen.dac_min_mute = true;
> >> >> }
> >> >>
> >> >> +static void cxt_fixed_mic_boost(struct hda_codec *codec, hda_nid_t node_id)
> >> >> +{
> >> >> + struct conexant_spec *spec = codec->spec;
> >> >> + unsigned int value = 0;
> >> >> +
> >> >> + value = snd_hda_codec_read(codec, node_id, 0, AC_VERB_GET_AMP_GAIN_MUTE, 0);
> >> >> + snd_hda_codec_amp_stereo(codec, node_id, HDA_INPUT, 0, HDA_AMP_VOLMASK, value);
> >> >> +}
> >> >> +
> >> >> +static void cxt_capture_hook(struct hda_pcm_stream *hinfo, struct hda_codec *codec,
> >> >> + struct snd_pcm_substream *substream, int action)
> >> >> +{
> >> >> + struct conexant_spec *spec = codec->spec;
> >> >> + hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
> >> >> +
> >> >> + cxt_fixed_mic_boost(codec, mux_pin);
> >> >> +}
> >> >> +
> >> >> static int cx_probe(struct hda_codec *codec, const struct hda_device_id *id)
> >> >> {
> >> >> struct conexant_spec *spec;
> >> >> @@ -1271,6 +1289,9 @@ static int cx_probe(struct hda_codec *codec, const struct hda_device_id *id)
> >> >> if (err < 0)
> >> >> goto error;
> >> >>
> >> >> + if (spec->gen.pcm_capture_hook == NULL)
> >> >> + spec->gen.pcm_capture_hook = cxt_capture_hook;
> >> >> +
> >> >> /* Some laptops with Conexant chips show stalls in S3 resume,
> >> >> * which falls into the single-cmd mode.
> >> >> * Better to make reset, then.
> >> >> --
> >> >> 2.39.5
> >> >>
> >>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-07-01 8:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-01 6:55 [PATCH] ALSA: hda/conexant: Fix microphone mute after power-on reboot dengxiang
2026-07-01 7:37 ` Takashi Iwai
[not found] ` <235d28fc.65dd.19f1cc1a68d.Coremail.os_dengxiang82@126.com>
2026-07-01 8:30 ` Takashi Iwai
[not found] ` <4932c551.6ece.19f1cdd10ba.Coremail.os_dengxiang82@126.com>
2026-07-01 8:50 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox