From: Neil Armstrong <neil.armstrong@linaro.org>
To: Mark Brown <broonie@kernel.org>
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
Banajit Goswami <bgoswami@quicinc.com>,
Andy Gross <agross@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konrad.dybcio@linaro.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Conor Dooley <conor+dt@kernel.org>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org,
linux-sound@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 5/5] ASoC: codecs: Add WCD939x Codec driver
Date: Fri, 15 Dec 2023 14:11:58 +0100 [thread overview]
Message-ID: <eb805e37-20a5-4462-8285-8942f8bfc74c@linaro.org> (raw)
In-Reply-To: <4dae5296-9984-4c3b-803a-f6024edd0dd9@sirena.org.uk>
On 13/12/2023 20:20, Mark Brown wrote:
> On Thu, Dec 07, 2023 at 11:28:08AM +0100, Neil Armstrong wrote:
>
>> +static int wcd939x_rx_hph_mode_put(struct snd_kcontrol *kcontrol,
>> + struct snd_ctl_elem_value *ucontrol)
>> +{
>> + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
>> + struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component);
>> + u32 mode_val;
>> +
>> + mode_val = ucontrol->value.enumerated.item[0];
>> +
>> + if (wcd939x->variant == WCD9390) {
>> + if (mode_val == CLS_H_HIFI || mode_val == CLS_AB_HIFI) {
>> + dev_dbg(component->dev, "%s: Invalid HPH Mode\n", __func__);
>> + return -EINVAL;
>> + }
>> + }
>> + if (mode_val == CLS_H_NORMAL) {
>> + dev_dbg(component->dev, "%s: Unsupported HPH Mode\n", __func__);
>> + return -EINVAL;
>> + }
>> +
>> + wcd939x->hph_mode = mode_val;
>
> This seems strange - the code will accept any value other than a small
> number of specifically enumerated ones? I would have expected us to
> check a defined list of modes and reject anything that isn't in that
> list. This also means that the get() function can return out of bounds
> values which is buggy. Please use the mixer-test selftest on a card
> with this driver running, it should identify at least that issue.
>
>> +
>> + return 1;
>> +}
>
> This will also unconditionally report that the value of the mux changed,
> the function should return 0 if the value written is the control value
> hasn't changed.
Ack, I'll fix this, I wasn't happy anyway with the design
Neil
prev parent reply other threads:[~2023-12-15 13:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-07 10:28 [PATCH v3 0/5] ASoC: codecs: add support for WCD939x Codec Neil Armstrong
2023-12-07 10:28 ` [PATCH v3 1/5] ASoC: dt-bindings: qcom,wcd938x: move out common properties Neil Armstrong
2023-12-07 10:28 ` [PATCH v3 2/5] ASoC: dt-bindings: document WCD939x Audio Codec Neil Armstrong
2023-12-07 10:28 ` [PATCH v3 3/5] ASoC: codec: wcd-mbhc-v2: add support when connected behind an USB-C audio mux Neil Armstrong
2023-12-07 10:28 ` [PATCH v3 4/5] ASoC: codecs: Add WCD939x Soundwire devices driver Neil Armstrong
2023-12-13 18:31 ` Mark Brown
2023-12-15 13:19 ` Neil Armstrong
2023-12-07 10:28 ` [PATCH v3 5/5] ASoC: codecs: Add WCD939x Codec driver Neil Armstrong
2023-12-13 19:20 ` Mark Brown
2023-12-15 13:11 ` Neil Armstrong [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=eb805e37-20a5-4462-8285-8942f8bfc74c@linaro.org \
--to=neil.armstrong@linaro.org \
--cc=agross@kernel.org \
--cc=alsa-devel@alsa-project.org \
--cc=andersson@kernel.org \
--cc=bgoswami@quicinc.com \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=konrad.dybcio@linaro.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=robh+dt@kernel.org \
--cc=srinivas.kandagatla@linaro.org \
--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;
as well as URLs for NNTP newsgroup(s).