From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: Mark Brown <broonie@kernel.org>
Cc: alsa-devel@alsa-project.org,
Banajit Goswami <bgoswami@codeaurora.org>,
Patrick Lai <plai@codeaurora.org>,
linux-kernel@vger.kernel.org, Takashi Iwai <tiwai@suse.com>
Subject: Re: [PATCH v1 5/6] ASoC: codecs: msm8916-wcd-analog: add MBHC support
Date: Fri, 28 Jul 2017 15:12:06 +0100 [thread overview]
Message-ID: <4f5d7239-5591-68db-5d1f-9fcc7cf45f6b@linaro.org> (raw)
In-Reply-To: <20170728135156.ifdo2ev44eldrw4r@sirena.org.uk>
On 28/07/17 14:51, Mark Brown wrote:
> On Wed, Jul 26, 2017 at 02:35:11AM +0200, srinivas.kandagatla@linaro.org wrote:
>
>> + if (wcd->hphl_jack_type_normally_open)
>> + plug_type = CDC_A_HPHL_PLUG_TYPE_NO;
>> +
>> + if (wcd->gnd_jack_type_normally_open)
>> + plug_type |= CDC_A_GND_PLUG_TYPE_NO;
>
> It'd be clearer to use |= consistently, this is just confusing as it
> makes it look like there's a path where things aren't initialized.
Yep, I will fix this in next version.
>
>> + btn_result = snd_soc_read(codec, CDC_A_MBHC_RESULT_1) &
>> + CDC_A_MBHC_RESULT_1_BTN_RESULT_MASK;
>> +
>> + if (!btn_result)
>> + priv->mbhc_btn0_pressed = false;
>> +
>> + snd_jack_report(priv->jack->jack, 0);
>
> This checks to see if the read worked, uses it to decide if it should
> clear the button pressed flag but unconditionally reports that the
> button is not pressed. It also discards the read error if there was one
> without reporting that. This needs cleanup.
Okay, will clean this part in next version.
>
>> + btn_result = snd_soc_read(codec, CDC_A_MBHC_RESULT_1) &
>> + CDC_A_MBHC_RESULT_1_BTN_RESULT_MASK;
>> +
>> + switch (btn_result) {
>> + case 0xf:
>> + snd_jack_report(priv->jack->jack, SND_JACK_BTN_4);
>> + break;
>> + case 0x7:
>> + snd_jack_report(priv->jack->jack, SND_JACK_BTN_3);
>> + break;
>> + case 0x3:
>> + snd_jack_report(priv->jack->jack, SND_JACK_BTN_2);
>> + break;
>> + case 0x1:
>> + snd_jack_report(priv->jack->jack, SND_JACK_BTN_1);
>> + break;
>> + case 0:
>> + priv->mbhc_btn0_pressed = true;
>> + snd_jack_report(priv->jack->jack, SND_JACK_BTN_0);
>> + break;
>> + }
>
> Here we silently ignore any value we get back from the chip that we
> didn't expect and all read errors.
I would not expect anyother values if the vrefs are programmed
correctly, however i will add a error message in default case to notify
this to user.
>
>> +struct msm8916_wcd_mbhc_data {
>> + /* Voltage threshold when internal current source of 100uA is used */
>> + int vref_btn_cs[MBHC_MAX_BUTTONS];
>> + /* Voltage threshold when microphone bias is ON */
>> + int vref_btn_micb[MBHC_MAX_BUTTONS];
>> +};
>
> I'd expect to see some mechanism for configuring the threasholds via DT,
> not all vendors use the same specs for resistive buttons.
Yep makes sense, I will do this in next version.
>
next prev parent reply other threads:[~2017-07-28 14:12 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-26 0:35 [PATCH v1 0/6] ASoC: codecs: msm8916-wcd-analog: Add support to MBHC srinivas.kandagatla
2017-07-26 0:35 ` [PATCH v1 1/6] ASoC: jack: fix snd_soc_codec_set_jack return error srinivas.kandagatla
2017-08-08 11:06 ` Applied "ASoC: jack: fix snd_soc_codec_set_jack return error" to the asoc tree Mark Brown
2017-07-26 0:35 ` [PATCH v1 2/6] ASoC: codecs: msm8916-analog: fix DIG_CLK_CTL_RXD3_CLK_EN define srinivas.kandagatla
2017-07-28 13:36 ` Mark Brown
2017-07-26 0:35 ` [PATCH v1 3/6] ASoC: codecs: msm8916-wcd-analog: move codec reset to probe srinivas.kandagatla
2017-07-28 13:40 ` Mark Brown
2017-07-28 14:06 ` Srinivas Kandagatla
2017-08-10 15:42 ` Applied "ASoC: codecs: msm8916-wcd-analog: move codec reset to probe" to the asoc tree Mark Brown
2017-07-26 0:35 ` [PATCH v1 4/6] ASoC: codecs: msm8916-wcd-analog: set default micbias voltage to 1.8 srinivas.kandagatla
2017-07-28 13:40 ` Mark Brown
2017-07-28 13:54 ` Srinivas Kandagatla
2017-07-28 14:01 ` Mark Brown
2017-07-28 14:45 ` Srinivas Kandagatla
2017-07-31 10:07 ` Mark Brown
2017-07-31 10:27 ` Srinivas Kandagatla
2017-07-26 0:35 ` [PATCH v1 5/6] ASoC: codecs: msm8916-wcd-analog: add MBHC support srinivas.kandagatla
2017-07-28 13:51 ` Mark Brown
2017-07-28 14:12 ` Srinivas Kandagatla [this message]
2017-07-26 0:35 ` [PATCH v1 6/6] ASoC: qcom: apq8016-sbc: Add support to Headset JACK srinivas.kandagatla
-- strict thread matches above, loose matches on Subject: below --
2017-07-26 19:35 [alsa-devel] [PATCH v1 5/6] ASoC: codecs: msm8916-wcd-analog: add MBHC support Damien Riegel
2017-07-27 10:03 ` 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=4f5d7239-5591-68db-5d1f-9fcc7cf45f6b@linaro.org \
--to=srinivas.kandagatla@linaro.org \
--cc=alsa-devel@alsa-project.org \
--cc=bgoswami@codeaurora.org \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=plai@codeaurora.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).