Re:Re: [PATCH] ALSA: hda/conexant: Fix microphone mute after power-on reboot

os_dengxiang82 <[email protected]> Wed, 1 Jul 2026 16:47:57 +0800 (CST)
Newsgroups org.alsa-project.alsa-devel
Message-ID <[email protected]>
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.
At 2026-07-01 16:30:22, "Takashi Iwai" <[email protected]> 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" <[email protected]> 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 <[email protected]>
>> >
>> >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
>> >>
>>