mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>
Cc: Srinivas Kandagatla <srini@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Alexey Klimov <alexey.klimov@linaro.org>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	linux-arm-msm@vger.kernel.org, linux-sound@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 3/4] ASoC: codecs: pm4125: Keep the micbias reference count balanced
Date: Thu, 15 Oct 2026 20:03:20 +0100	[thread overview]
Message-ID: <a3df845a-ab58-4945-9221-ff671c3dc378@sirena.org.uk> (raw)
In-Reply-To: <20261015-pm4125_mbhc_support-v1-3-8bc1212db6f7@oss.qualcomm.com>

[-- Attachment #1: Type: text/plain, Size: 1353 bytes --]

On Thu, Oct 15, 2026 at 07:43:11PM +0530, Mohammad Rafi Shaik wrote:

> The analog master bias is shared between the microphone bias supplies
> and the playback and capture paths, so pm4125_global_mbias_enable() and
> pm4125_global_mbias_disable() reference count it and only touch
> PM4125_ANA_MBIAS_EN for the first user and the last one.

> MICB_DISABLE clamps the per-supply reference count at zero but then
> evaluates the enable and pull-up counts regardless, so a release that
> has no matching request still reaches pm4125_global_mbias_disable() and
> drops a reference it never took. The MBHC framework issues exactly such
> a release: it takes MIC_BIAS_2 once when it starts detecting a plug
> type and releases it both at the end of the correction work and again
> from wcd_micbias_disable(). Inserting a jack while a stream is running
> therefore switches the analog master bias off underneath it, leaving
> the path up but silent, and it stays silent until another stream takes
> the first reference again.
> 
> Return early when there is nothing to release, so the hardware is only
> touched for a request that was actually made.

This feels like a bodge for poor reference counting elsewhere - in
particular the MBHC seems to be fairly clearly double freeing.  The fix
here just silently eats double frees AFAICT?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2026-10-15 19:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15 14:13 [PATCH 0/4] ASoC: codecs: pm4125: Enable MBHC jack detection Mohammad Rafi Shaik
2026-10-15 14:13 ` [PATCH v1 1/4] ASoC: dt-bindings: qcom,pm4125-codec: Add the MBHC jack properties Mohammad Rafi Shaik
2026-10-16  6:47   ` Ajay Kumar Nandam
2026-10-15 14:13 ` [PATCH v1 2/4] ASoC: codecs: pm4125: Fix MBHC button threshold programming Mohammad Rafi Shaik
2026-10-15 14:13 ` [PATCH v1 3/4] ASoC: codecs: pm4125: Keep the micbias reference count balanced Mohammad Rafi Shaik
2026-10-15 19:03   ` Mark Brown [this message]
2026-11-02 10:55     ` Mohammad Rafi Shaik
2026-10-15 14:13 ` [PATCH v1 4/4] ASoC: codecs: pm4125: Add the MBHC callbacks needed for jack detection Mohammad Rafi Shaik

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=a3df845a-ab58-4945-9221-ff671c3dc378@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=alexey.klimov@linaro.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.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=mohammad.rafi.shaik@oss.qualcomm.com \
    --cc=perex@perex.cz \
    --cc=robh@kernel.org \
    --cc=srini@kernel.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

all inboxes | Powered by JetHome®