From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: Mark Brown <broonie@kernel.org>
Cc: perex@perex.cz, alsa-devel@alsa-project.org,
linux-kernel@vger.kernel.org, lgirdwood@gmail.com
Subject: Re: [PATCH 4/7] ASoC: codecs: wcd938x: add basic controls
Date: Mon, 15 Mar 2021 10:04:46 +0000 [thread overview]
Message-ID: <509b836d-520d-4528-0f1a-da0c21e86c68@linaro.org> (raw)
In-Reply-To: <20210312155547.GJ5348@sirena.org.uk>
Thanks Mark for review,
On 12/03/2021 15:55, Mark Brown wrote:
> On Thu, Mar 11, 2021 at 05:34:13PM +0000, Srinivas Kandagatla wrote:
>
>> + if (wcd938x->variant == WCD9380) {
>
> switch statements please.
>
>> + if (mode_val == CLS_H_HIFI || mode_val == CLS_AB_HIFI) {
>> + dev_info(component->dev,
>> + "%s:Invalid HPH Mode, default to CLS_H_ULP\n",
>> + __func__);
>> + mode_val = CLS_H_ULP;
>> + }
>
> If the value can't be set an error should be returned rather than the
> input ignored.
I agree with all the comments related to switch statements and ignoring
return values, will address them in next version.
>
>> +static int wcd938x_ear_pa_gain_get(struct snd_kcontrol *kcontrol,
>> + struct snd_ctl_elem_value *ucontrol)
>> +{
>> + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
>> +
>> + ucontrol->value.integer.value[0] = snd_soc_component_read_field(component,
>> + WCD938X_ANA_EAR_COMPANDER_CTL,
>> + WCD938X_EAR_GAIN_MASK);
>> +
>> + return 0;
>> +}
>
> This just looks like a normal operation?
>
Yes, this can probably go into a TLV control, will fix this in next version.
--srini
>> +static int wcd938x_ear_pa_gain_put(struct snd_kcontrol *kcontrol,
>> + struct snd_ctl_elem_value *ucontrol)
>> +{
>> + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
>> + struct wcd938x_sdw_priv *wcd = snd_soc_component_get_drvdata(component);
>> + struct wcd938x_priv *wcd938x = wcd->wcd938x;
>> +
>> + if (!wcd938x->comp1_enable) {
>> + snd_soc_component_write_field(component,
>> + WCD938X_ANA_EAR_COMPANDER_CTL,
>> + WCD938X_EAR_GAIN_MASK,
>> + ucontrol->value.integer.value[0]);
>> + }
>
> Again, values should not be ignored on error.
>
>> + if (wcd938x->variant == WCD9380) {
>> + ret = snd_soc_add_component_controls(component, wcd9380_snd_controls,
>> + ARRAY_SIZE(wcd9380_snd_controls));
>> + if (ret < 0) {
>> + dev_err(component->dev,
>> + "%s: Failed to add snd ctrls for variant: %d\n",
>> + __func__, wcd938x->variant);
>> + goto err;
>> + }
>> + }
>> + if (wcd938x->variant == WCD9385) {
>
> Again, switch statements - I'll never understand why people seem so
> intent on writing if trees :(
>
next prev parent reply other threads:[~2021-03-15 10:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-11 17:34 [PATCH 0/7] ASoC: codecs: add wcd938x support Srinivas Kandagatla
2021-03-11 17:34 ` [PATCH 1/7] ASoC: dt-bindings: wcd938x: add bindings for wcd938x Srinivas Kandagatla
2021-03-12 15:21 ` Mark Brown
2021-03-15 10:05 ` Srinivas Kandagatla
2021-03-11 17:34 ` [PATCH 2/7] ASoC: codecs: wcd-clsh: add new version support Srinivas Kandagatla
2021-03-11 17:34 ` [PATCH 3/7] ASoC: codecs: wcd938x: add basic driver Srinivas Kandagatla
2021-03-12 15:34 ` Mark Brown
2021-03-15 10:04 ` Srinivas Kandagatla
2021-03-11 17:34 ` [PATCH 4/7] ASoC: codecs: wcd938x: add basic controls Srinivas Kandagatla
2021-03-12 15:55 ` Mark Brown
2021-03-15 10:04 ` Srinivas Kandagatla [this message]
2021-03-11 17:34 ` [PATCH 5/7] ASoC: codecs: wcd938x: add playback dapm widgets Srinivas Kandagatla
2021-03-11 17:34 ` [PATCH 6/7] ASoC: codecs: wcd938x: add capture " Srinivas Kandagatla
2021-03-11 17:34 ` [PATCH 7/7] ASoC: codecs: wcd938x: add audio routing Srinivas Kandagatla
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=509b836d-520d-4528-0f1a-da0c21e86c68@linaro.org \
--to=srinivas.kandagatla@linaro.org \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
/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;
as well as URLs for NNTP newsgroup(s).