From: Mark Brown <broonie@kernel.org>
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.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: Fri, 12 Mar 2021 15:55:47 +0000 [thread overview]
Message-ID: <20210312155547.GJ5348@sirena.org.uk> (raw)
In-Reply-To: <20210311173416.25219-5-srinivas.kandagatla@linaro.org>
[-- Attachment #1: Type: text/plain, Size: 1888 bytes --]
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.
> +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?
> +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 :(
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2021-03-12 15:57 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 [this message]
2021-03-15 10:04 ` Srinivas Kandagatla
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=20210312155547.GJ5348@sirena.org.uk \
--to=broonie@kernel.org \
--cc=alsa-devel@alsa-project.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=srinivas.kandagatla@linaro.org \
/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
Powered by JetHome