mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Artur Weber <aweber.kernel@gmail.com>
Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Rob Herring <robh@kernel.org>, Conor Dooley <conor+dt@kernel.org>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Alim Akhtar <alim.akhtar@samsung.com>,
	alsa-devel@alsa-project.org, linux-sound@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org,
	~postmarketos/upstreaming@lists.sr.ht
Subject: Re: [PATCH v3 4/8] ASoC: samsung: midas_wm1811: Add GPIO-based headset jack detection
Date: Mon, 20 May 2024 15:41:17 +0100	[thread overview]
Message-ID: <2c4c0aeb-2870-4905-bcfc-642ae40c87f1@sirena.org.uk> (raw)
In-Reply-To: <20240519-midas-wm1811-gpio-jack-v3-4-0c1736144c0e@gmail.com>

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

On Sun, May 19, 2024 at 10:17:50AM +0200, Artur Weber wrote:

> +	if (priv->reg_headset_mic_bias) {
> +		/*
> +		 * Get state of Headset Mic switch by checking the headset mic
> +		 * bias regulator
> +		 */
> +		bias_already_on = \
> +			regulator_is_enabled(priv->reg_headset_mic_bias);

If you're going to do this you need to use regulator_get_exclusive() to
ensure that nothing else can enable the regulator, otherwise you should
just unconditionally enable the regulator.

> +	/*
> +	 * Revert the headset mic bias supply to its previous state
> +	 * (i.e. if it was disabled before the check, disable it again)
> +	 */
> +	if (priv->reg_headset_mic_bias && bias_already_on == 0) {
> +		ret = regulator_disable(priv->reg_headset_mic_bias);
> +		if (ret)
> +			pr_err("%s: Failed to disable micbias: %d\n",
> +			       __func__, ret);
> +	}

Given that you're just briefly bouncing the regulator on and off it'd be
best to just unconditionally enable and disable here, I can't see what
the enable check gains you other than possible race conditions.

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

  reply	other threads:[~2024-05-20 14:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-19  8:17 [PATCH v3 0/8] ASoC: samsung: midas-audio: " Artur Weber
2024-05-19  8:17 ` [PATCH v3 1/8] ASoC: dt-bindings: samsung,midas-audio: Add headset mic bias supply Artur Weber
2024-05-19  8:17 ` [PATCH v3 2/8] ASoC: dt-bindings: samsung,midas-audio: Add GPIO-based headset jack detection Artur Weber
2024-05-19  8:17 ` [PATCH v3 3/8] ASoC: samsung: midas_wm1811: Add headset mic bias supply support Artur Weber
2024-05-20 14:35   ` Mark Brown
2024-05-22 16:20     ` Artur Weber
2024-05-22 16:22       ` Mark Brown
2024-05-19  8:17 ` [PATCH v3 4/8] ASoC: samsung: midas_wm1811: Add GPIO-based headset jack detection Artur Weber
2024-05-20 14:41   ` Mark Brown [this message]
2024-05-19  8:17 ` [PATCH v3 5/8] ASoC: samsung: midas_wm1811: Use dev_err_probe where appropriate Artur Weber
2024-05-19  8:17 ` [PATCH v3 6/8] ARM: dts: samsung: exynos4212-tab3: Fix headset mic, add jack detection Artur Weber
2024-05-19  8:17 ` [PATCH v3 7/8] ARM: dts: samsung: exynos4212-tab3: Add MCLK2 clock to WM1811 codec config Artur Weber
2024-05-19  8:17 ` [PATCH v3 8/8] ARM: dts: samsung: exynos4212-tab3: Drop interrupt from WM1811 codec Artur Weber

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=2c4c0aeb-2870-4905-bcfc-642ae40c87f1@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=alim.akhtar@samsung.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=aweber.kernel@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=robh@kernel.org \
    --cc=s.nawrocki@samsung.com \
    --cc=tiwai@suse.com \
    --cc=~postmarketos/upstreaming@lists.sr.ht \
    /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®