From: Takashi Iwai <tiwai@suse.de>
To: bo liu <bo.liu@senarytech.com>
Cc: perex@perex.cz, tiwai@suse.com, linux-sound@vger.kernel.org
Subject: Re: [PATCH V4] Initialize the gain and boost values of the ADC in the SN6180 chip to achieve a better recording experience.
Date: Tue, 25 Mar 2025 11:54:20 +0100 [thread overview]
Message-ID: <87msd9crdv.wl-tiwai@suse.de> (raw)
In-Reply-To: <20250325060956.1139955-1-bo.liu@senarytech.com>
On Tue, 25 Mar 2025 07:09:56 +0100,
bo liu wrote:
>
> Signed-off-by: bo liu <bo.liu@senarytech.com>
First off, could you use a proper subject line? It should be more
concise, and have a prefix such as "ALSA: hda/conexant:".
Then put more information in the patch description, instead of putting
to the subject line.
About the code change:
>
> +static void cxt_setup_capture_default_boost_gain(struct hda_codec *codec)
> +{
Better to give more comments about what this function actually does.
> + struct conexant_spec *spec = codec->spec;
> + struct hda_gen_spec *gen = &(spec->gen);
No need for parentheses.
> + hda_nid_t adc_id = 0, nid = 0;
Why initializing those?
> + int nids;
This should be either u32 or unsigned int.
> + size_t i = 0;
It's superfluous initialization.
> +
> + for (i = 0; i < gen->num_all_adcs; i++) {
> + int index;
> +
> + adc_id = gen->all_adcs[i];
> +
> + index = snd_hda_codec_read(codec, adc_id, 0, AC_VERB_GET_CONNECT_SEL, 0);
> + nids = snd_hda_codec_read(codec, adc_id, 0, AC_VERB_GET_CONNECT_LIST, 0);
> + nid = ((nids & (0xFF << (8*index))) >> (8*index));
It's simpler and clearer to do right-shift at first, then mask.
> + if (nid < codec->core.start_nid || nid > codec->core.end_nid) {
> + codec_err(codec, "Error, invalid nid 0x%02x.\n", nid);
> + continue;
> + }
> +
> + snd_hda_codec_write(codec, adc_id, 0, (0x370|(index&0xF)), 0x4A);
Too cryptic. Use the defined verbs.
> + snd_hda_codec_write(codec, nid, 0, 0x370, 0x2);
Ditto.
> + }
> +}
> +
> +static void cxt_init_capture_boost_gain(struct hda_codec *codec)
> +{
> + cxt_setup_capture_default_boost_gain(codec);
> +}
Why nested calls...?
thanks,
Takashi
prev parent reply other threads:[~2025-03-25 10:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-25 6:09 [PATCH V4] Initialize the gain and boost values of the ADC in the SN6180 chip to achieve a better recording experience bo liu
2025-03-25 10:54 ` 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=87msd9crdv.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=bo.liu@senarytech.com \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--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