LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>, broonie@kernel.org
Cc: robh@kernel.org, alsa-devel@alsa-project.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
lgirdwood@gmail.com
Subject: Re: [PATCH v3 2/4] ASoC: codecs: wcd: add multi button Headset detection support
Date: Mon, 2 Aug 2021 19:03:19 -0500 [thread overview]
Message-ID: <139e6867-2d29-09e0-d059-399917e5962d@linux.intel.com> (raw)
In-Reply-To: <20210604115230.23259-3-srinivas.kandagatla@linaro.org>
Hi Srinivas,
cppcheck reports an issue with the use of 'hphpa_on' below
> +static irqreturn_t wcd_mbhc_adc_hs_rem_irq(int irq, void *data)
> +{
> + struct wcd_mbhc *mbhc = data;
> + unsigned long timeout;
> + int adc_threshold, output_mv, retry = 0;
> + bool hphpa_on = false;
assigned here
> +
> + mutex_lock(&mbhc->lock);
> + timeout = jiffies + msecs_to_jiffies(WCD_FAKE_REMOVAL_MIN_PERIOD_MS);
> + adc_threshold = wcd_mbhc_adc_get_hs_thres(mbhc);
> +
> + do {
> + retry++;
> + /*
> + * read output_mv every 10ms to look for
> + * any change in IN2_P
> + */
> + usleep_range(10000, 10100);
> + output_mv = wcd_measure_adc_once(mbhc, MUX_CTL_IN2P);
> +
> + /* Check for fake removal */
> + if ((output_mv <= adc_threshold) && retry > FAKE_REM_RETRY_ATTEMPTS)
> + goto exit;
> + } while (!time_after(jiffies, timeout));
> +
> + /*
> + * ADC COMPLETE and ELEC_REM interrupts are both enabled for
> + * HEADPHONE, need to reject the ADC COMPLETE interrupt which
> + * follows ELEC_REM one when HEADPHONE is removed.
> + */
> + if (mbhc->current_plug == MBHC_PLUG_TYPE_HEADPHONE)
> + mbhc->extn_cable_hph_rem = true;
> +
> + wcd_mbhc_write_field(mbhc, WCD_MBHC_DETECTION_DONE, 0);
> + wcd_mbhc_write_field(mbhc, WCD_MBHC_ADC_MODE, 0);
> + wcd_mbhc_write_field(mbhc, WCD_MBHC_ADC_EN, 0);
> + wcd_mbhc_elec_hs_report_unplug(mbhc);
> + wcd_mbhc_write_field(mbhc, WCD_MBHC_BTN_ISRC_CTL, 0);
not used, so hphpa_on == false
> + if (hphpa_on) {
> + hphpa_on = false;
> + wcd_mbhc_write_field(mbhc, WCD_MBHC_HPH_PA_EN, 3);
> + }
And this branch is never taken.
Is there a missing hphpa = true assignment somewhere?
There's an additional issue while I am at it:
sound/soc/codecs/wcd-mbhc-v2.c:1225:17: style: Variable 'clamp_state' is
assigned a value that is never used. [unreadVariable]
u8 clamp_state = 0;
^
-Pierre
next prev parent reply other threads:[~2021-08-03 13:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-04 11:52 [PATCH v3 0/4] ASoC: codecs: wcd934x: add Headset and button " Srinivas Kandagatla
2021-06-04 11:52 ` [PATCH v3 1/4] ASoC: dt-bindings: wcd934x: add bindings for Headset Button detection Srinivas Kandagatla
2021-06-04 11:52 ` [PATCH v3 2/4] ASoC: codecs: wcd: add multi button Headset detection support Srinivas Kandagatla
2021-08-03 0:03 ` Pierre-Louis Bossart [this message]
2021-06-04 11:52 ` [PATCH v3 3/4] ASoC: codecs: wcd934x: add mbhc support Srinivas Kandagatla
2021-06-04 11:52 ` [PATCH v3 4/4] ASoC: qcom: sdm845: add jack support for WCD934x Srinivas Kandagatla
2021-06-04 16:32 ` [PATCH v3 0/4] ASoC: codecs: wcd934x: add Headset and button detection support Mark Brown
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=139e6867-2d29-09e0-d059-399917e5962d@linux.intel.com \
--to=pierre-louis.bossart@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=robh@kernel.org \
--cc=srinivas.kandagatla@linaro.org \
--subject='Re: [PATCH v3 2/4] ASoC: codecs: wcd: add multi button Headset detection support' \
/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
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).