From: Takashi Iwai <tiwai@suse.de>
To: wangdich9700@163.com
Cc: bo.liu@senarytech.com, perex@perex.cz, tiwai@suse.com,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
wangdicheng <wangdicheng@kylinos.cn>
Subject: Re: [PATCH 4/4] ALSA: hda/senary: Fix microphone boost stability
Date: Thu, 05 Mar 2026 12:39:01 +0100 [thread overview]
Message-ID: <87cy1iy08a.wl-tiwai@suse.de> (raw)
In-Reply-To: <20260305032756.236440-1-wangdich9700@163.com>
On Thu, 05 Mar 2026 04:27:56 +0100,
wangdich9700@163.com wrote:
>
> From: wangdicheng <wangdicheng@kylinos.cn>
>
> Some SN6186 platforms experience microphone gain fluctuation.
What does this mean actually...?
> This patch adds a capture sync hook to lock the microphone boost
> to a default value read during initialization, ensuring stable
> recording levels.
But it means that the mic boost value changed by users (via mixer)
won't be followed at all? Sounds fishy.
thanks,
Takashi
>
> Signed-off-by: wangdicheng <wangdicheng@kylinos.cn>
> ---
> sound/hda/codecs/senarytech.c | 33 +++++++++++++++++++++++++++++++++
> 1 file changed, 33 insertions(+)
>
> diff --git a/sound/hda/codecs/senarytech.c b/sound/hda/codecs/senarytech.c
> index c589b3b01171..9c6bad6e3866 100644
> --- a/sound/hda/codecs/senarytech.c
> +++ b/sound/hda/codecs/senarytech.c
> @@ -31,6 +31,7 @@ struct senary_spec {
> unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
>
> int mute_led_polarity;
> + unsigned char default_mic_boost[0x25];
> unsigned int gpio_led;
> unsigned int gpio_mute_led_mask;
> unsigned int gpio_mic_led_mask;
> @@ -162,6 +163,30 @@ static void senary_playback_hook(struct hda_pcm_stream *hinfo,
> }
> }
>
> +static void senary_fixed_mic_boost(struct hda_codec *codec, hda_nid_t nid)
> +{
> + unsigned char value;
> + struct senary_spec *spec = codec->spec;
> +
> + if (!spec->default_mic_boost[nid])
> + return;
> +
> + value = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_AMP_GAIN_MUTE, 0);
> + if (value != spec->default_mic_boost[nid])
> + snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
> + HDA_AMP_VOLMASK, spec->default_mic_boost[nid]);
> +}
> +
> +static void senary_cap_sync_hook(struct hda_codec *codec,
> + struct snd_kcontrol *kcontrol,
> + struct snd_ctl_elem_value *ucontrol)
> +{
> + struct senary_spec *spec = codec->spec;
> + hda_nid_t nid = spec->gen.imux_pins[spec->gen.cur_mux[0]];
> +
> + senary_fixed_mic_boost(codec, nid);
> +}
> +
> static void senary_auto_turn_eapd(struct hda_codec *codec, int num_pins,
> const hda_nid_t *pins, bool on)
> {
> @@ -251,6 +276,7 @@ static int senary_probe(struct hda_codec *codec, const struct hda_device_id *id)
> {
> struct senary_spec *spec;
> int err;
> + int i;
>
> codec_info(codec, "%s: BIOS auto-probing.\n", codec->core.chip_name);
>
> @@ -307,6 +333,13 @@ static int senary_probe(struct hda_codec *codec, const struct hda_device_id *id)
> if (codec->core.vendor_id == 0x1fa86186)
> spec->gen.pcm_playback_hook = senary_playback_hook;
>
> + /* Initialize and fix mic boost */
> + for (i = 0; i < ARRAY_SIZE(spec->default_mic_boost); i++) {
> + spec->default_mic_boost[i] = snd_hda_codec_read(codec, i, 0,
> + AC_VERB_GET_AMP_GAIN_MUTE, 0);
> + }
> + spec->gen.cap_sync_hook = senary_cap_sync_hook;
> +
> /* Some laptops with Senary chips show stalls in S3 resume,
> * which falls into the single-cmd mode.
> * Better to make reset, then.
> --
> 2.25.1
>
prev parent reply other threads:[~2026-03-05 11:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-05 3:27 [PATCH 4/4] ALSA: hda/senary: Fix microphone boost stability wangdich9700
2026-03-05 11:39 ` 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=87cy1iy08a.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=bo.liu@senarytech.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
--cc=wangdich9700@163.com \
--cc=wangdicheng@kylinos.cn \
/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