public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: srinivas.kandagatla@linaro.org
Cc: peda@axentia.se, 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,
	dmitry.baryshkov@oss.qualcomm.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 v6 5/6] ASoC: codecs: wcd938x: add mux control support for hp audio mux
Date: Wed, 2 Apr 2025 11:12:04 +0200	[thread overview]
Message-ID: <Z-z_ZAyVBK5ui50k@hovoldconsulting.com> (raw)
In-Reply-To: <20250327100633.11530-6-srinivas.kandagatla@linaro.org>

On Thu, Mar 27, 2025 at 10:06:32AM +0000, Srinivas Kandagatla wrote:
> From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> 
> On some platforms to minimise pop and click during switching between
> CTIA and OMTP headset an additional HiFi mux is used. Most common
> case is that this switch is switched on by default, but on some
> platforms this needs a regulator enable.
> 
> move to using mux control to enable both regulator and handle gpios,
> deprecate the usage of gpio.
> 
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> Tested-by: Christopher Obbard <christopher.obbard@linaro.org>

> @@ -3261,11 +3276,26 @@ static int wcd938x_populate_dt_data(struct wcd938x_priv *wcd938x, struct device
>  		return dev_err_probe(dev, wcd938x->reset_gpio,
>  				     "Failed to get reset gpio\n");
>  
> -	wcd938x->us_euro_gpio = devm_gpiod_get_optional(dev, "us-euro",
> -						GPIOD_OUT_LOW);
> -	if (IS_ERR(wcd938x->us_euro_gpio))
> -		return dev_err_probe(dev, PTR_ERR(wcd938x->us_euro_gpio),
> -				     "us-euro swap Control GPIO not found\n");
> +	wcd938x->us_euro_mux = devm_mux_control_get(dev, NULL);

Running with this patch on the CRD I noticed that this now prints an
error as there is no optional mux (or gpio) defined:

	wcd938x_codec audio-codec: /audio-codec: failed to get mux-control (0)

You need to suppress that error in mux_get() to allow for optional muxes
to be looked up like this.

> +	if (IS_ERR(wcd938x->us_euro_mux)) {
> +		if (PTR_ERR(wcd938x->us_euro_mux) == -EPROBE_DEFER)
> +			return -EPROBE_DEFER;
> +
> +		/* mux is optional and now fallback to using gpio */
> +		wcd938x->us_euro_mux = NULL;
> +		wcd938x->us_euro_gpio = devm_gpiod_get_optional(dev, "us-euro", GPIOD_OUT_LOW);
> +		if (IS_ERR(wcd938x->us_euro_gpio))
> +			return dev_err_probe(dev, PTR_ERR(wcd938x->us_euro_gpio),
> +					     "us-euro swap Control GPIO not found\n");
> +	} else {
> +		ret = mux_control_try_select(wcd938x->us_euro_mux, wcd938x->mux_state);
> +		if (ret) {
> +			dev_err(dev, "Error (%d) Unable to select us/euro mux state\n", ret);
> +			wcd938x->mux_setup_done = false;
> +			return ret;
> +		}
> +		wcd938x->mux_setup_done = true;
> +	}

Johan

  parent reply	other threads:[~2025-04-02  9:12 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-27 10:06 [PATCH v6 0/6] ASoC: wcd938x: enable t14s audio headset srinivas.kandagatla
2025-03-27 10:06 ` [PATCH v6 1/6] dt-bindings: mux: add optional regulator binding to gpio mux srinivas.kandagatla
2025-05-08 12:57   ` (subset) " Krzysztof Kozlowski
2025-03-27 10:06 ` [PATCH v6 2/6] mux: gpio: add optional regulator support srinivas.kandagatla
2025-04-01 10:16   ` Mark Brown
2025-04-02  8:11     ` Srinivas Kandagatla
2025-04-02  8:05   ` Johan Hovold
2025-05-08 12:45     ` Johan Hovold
2025-05-08 12:54       ` Krzysztof Kozlowski
2025-05-08 12:57   ` (subset) " Krzysztof Kozlowski
2025-03-27 10:06 ` [PATCH v6 3/6] ASoC: codecs: wcd-mbhc: cleanup swap_gnd_mic api srinivas.kandagatla
2025-03-27 12:11   ` Dmitry Baryshkov
2025-03-27 10:06 ` [PATCH v6 4/6] ASoC: dt-bindings: wcd93xx: add bindings for audio mux controlling hp srinivas.kandagatla
2025-03-27 10:06 ` [PATCH v6 5/6] ASoC: codecs: wcd938x: add mux control support for hp audio mux srinivas.kandagatla
2025-03-27 12:13   ` Dmitry Baryshkov
2025-04-02  8:06   ` Johan Hovold
2025-04-02  9:12   ` Johan Hovold [this message]
2025-04-03 12:19     ` Srinivas Kandagatla
2025-04-03 14:29       ` Johan Hovold
2025-04-05 17:27       ` Dmitry Baryshkov
2025-03-27 10:06 ` [PATCH v6 6/6] arm64: dts: qcom: x1e78100-t14s: Enable audio headset support srinivas.kandagatla
2025-04-02  8:08   ` Johan Hovold
2025-05-08 12:47     ` Johan Hovold
2025-05-08 12:55       ` Krzysztof Kozlowski
2025-05-17  5:57   ` (subset) " Bjorn Andersson
2025-04-08 12:49 ` (subset) [PATCH v6 0/6] ASoC: wcd938x: enable t14s audio headset 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=Z-z_ZAyVBK5ui50k@hovoldconsulting.com \
    --to=johan@kernel.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=srinivas.kandagatla@linaro.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