From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: Peter Rosin <peda@axentia.se>,
Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Cc: broonie@kernel.org, andersson@kernel.org, krzk+dt@kernel.org,
ivprusov@salutedevices.com, luca.ceresoli@bootlin.com,
zhoubinbin@loongson.cn, paulha@opensource.cirrus.com,
lgirdwood@gmail.com, robh@kernel.org, conor+dt@kernel.org,
konradybcio@kernel.org, perex@perex.cz, tiwai@suse.com,
linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
johan+linaro@kernel.org,
Christopher Obbard <christopher.obbard@linaro.org>
Subject: Re: [PATCH v4 5/6] ASoC: codecs: wcd938x: add mux control support for hp audio mux
Date: Mon, 24 Mar 2025 16:49:50 +0000 [thread overview]
Message-ID: <1f090804-2ad6-4ab4-a6a3-aa5d482f320b@linaro.org> (raw)
In-Reply-To: <8fbc8cd7-f8e7-e33b-74df-cdea389ac9a4@axentia.se>
On 24/03/2025 16:33, Peter Rosin wrote:
> Hi!
>
> 2025-03-24 at 16:58, Srinivas Kandagatla wrote:
>>
>>
>> On 24/03/2025 15:18, Dmitry Baryshkov wrote:
>>> On Mon, Mar 24, 2025 at 01:58:06PM +0000, Srinivas Kandagatla wrote:
>>>>
>>>>
>>>> On 24/03/2025 13:50, Dmitry Baryshkov wrote:
>>>>> On Mon, 24 Mar 2025 at 15:01, <srinivas.kandagatla@linaro.org> wrote:
>>>>>>
>>>>>> From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
>
> *snip*
>
>>>>>> + int ret = mux_control_try_select(wcd938x->us_euro_mux, state);
>>>>>
>>>>> Hmm. Does this really work? You have selected the mux in probe
>>>>> function, now you are trying to select it again. If I'm reading the
>>>>> code correctly, you will get -EBUSY here.
>>>>
>>>> On successful selection of mux state, the mux will be kept available
>>>> (mux_control_deselect) for any new callers.
>>>>
>>>> So we will not get EBUSY for the second caller.
>>>
>>> No. wcd938x_populate_dt_data() selects the state by calling
>>> wcd938x_select_mux_state().
>>
>> At this point we also released it (both in success and error case).
>>
>> This will hold on to the previous state unless we have defined a fallback idle-state.
>>
>>
>> Then you call mux_control_try_select() here.
>>> As far as I understand, it will return -EBUSY as the sempahore is > already taken. Moreover, this is not how the MUX API is supposed to be
>>> used. The driver is supposed to hold a state while it is still in use.
>
> Dmitry is correct. A mux consumer is supposed to keep the mux selected
> while it needs the mux to remain in a certain state. Relying on details
> such as idle as-is and that no other consumer butts in and clobbers the
> state is fragile. Mux access is not exclusive, at least not until a
> mux state is selected.
Thanks Peter, I agree that its fragile to depend on idle as-is flags.
Will update accordingly.
--srini
>
> Cheers,
> Peter
next prev parent reply other threads:[~2025-03-24 16:49 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-24 13:00 [PATCH v4 0/6] ASoC: wcd938x: enable t14s audio headset srinivas.kandagatla
2025-03-24 13:00 ` [PATCH v4 1/6] dt-bindings: mux: add optional regulator binding to gpio mux srinivas.kandagatla
2025-03-24 20:34 ` Rob Herring (Arm)
2025-03-24 13:00 ` [PATCH v4 2/6] mux: gpio: add optional regulator support srinivas.kandagatla
2025-03-24 13:00 ` [PATCH v4 3/6] ASoC: codecs: wcd-mbhc: cleanup swap_gnd_mic api srinivas.kandagatla
2025-03-24 13:00 ` [PATCH v4 4/6] ASoC: dt-bindings: wcd93xx: add bindings for audio mux controlling hp srinivas.kandagatla
2025-03-24 13:00 ` [PATCH v4 5/6] ASoC: codecs: wcd938x: add mux control support for hp audio mux srinivas.kandagatla
2025-03-24 13:50 ` Dmitry Baryshkov
2025-03-24 13:58 ` Srinivas Kandagatla
2025-03-24 15:18 ` Dmitry Baryshkov
2025-03-24 15:58 ` Srinivas Kandagatla
2025-03-24 16:18 ` Dmitry Baryshkov
2025-03-24 16:33 ` Peter Rosin
2025-03-24 16:49 ` Srinivas Kandagatla [this message]
2025-03-24 13:00 ` [PATCH v4 6/6] arm64: dts: qcom: x1e78100-t14s: Enable audio headset support 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=1f090804-2ad6-4ab4-a6a3-aa5d482f320b@linaro.org \
--to=srinivas.kandagatla@linaro.org \
--cc=andersson@kernel.org \
--cc=broonie@kernel.org \
--cc=christopher.obbard@linaro.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=ivprusov@salutedevices.com \
--cc=johan+linaro@kernel.org \
--cc=konradybcio@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=luca.ceresoli@bootlin.com \
--cc=paulha@opensource.cirrus.com \
--cc=peda@axentia.se \
--cc=perex@perex.cz \
--cc=robh@kernel.org \
--cc=tiwai@suse.com \
--cc=zhoubinbin@loongson.cn \
/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).