The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: os_dengxiang82  <os_dengxiang82@126.com>
Cc: tiwai@suse.com, bo.liu@senarytech.com,
	linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
	alsa-devel@alsa-project.org
Subject: Re: [PATCH] ALSA: hda/conexant: Fix microphone mute after power-on reboot
Date: Wed, 01 Jul 2026 10:50:55 +0200	[thread overview]
Message-ID: <87ldbvum8g.wl-tiwai@suse.de> (raw)
In-Reply-To: <4932c551.6ece.19f1cdd10ba.Coremail.os_dengxiang82@126.com>

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
> >> >>
> >>
> 

      parent reply	other threads:[~2026-07-01  8:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ldbvum8g.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=bo.liu@senarytech.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=os_dengxiang82@126.com \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox