[PATCH 2/3] ASoC: codecs: wcd938x: add support power on hp audio switch

From: srinivas . kandagatla
Date: Wed Mar 19 2025 - 05:20:26 EST


From: Srinivas Kandagatla <srinivas.kandagatla@xxxxxxxxxx>

On some platforms to minimise pop and click during switching between
CTIA and OMTP headset an additional HiFi Switch is used. Most common
case is that this switch is switched on by default, but on some
platforms this needs a regulator enable. Enable this regulator if
platform is setup with regulator.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@xxxxxxxxxx>
---
sound/soc/codecs/wcd938x.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c
index f2a4f3262bdb..a00845089e13 100644
--- a/sound/soc/codecs/wcd938x.c
+++ b/sound/soc/codecs/wcd938x.c
@@ -3267,6 +3267,13 @@ static int wcd938x_populate_dt_data(struct wcd938x_priv *wcd938x, struct device
return dev_err_probe(dev, PTR_ERR(wcd938x->us_euro_gpio),
"us-euro swap Control GPIO not found\n");

+ ret = devm_regulator_get_enable_optional(dev, "vdd-hp-switch");
+ if (ret && ret != -ENODEV) {
+ if (ret != -EPROBE_DEFER)
+ dev_err(dev, "Couldn't retrieve/enable audio switch supply\n");
+ return ret;
+ }
+
cfg->swap_gnd_mic = wcd938x_swap_gnd_mic;

wcd938x->supplies[0].supply = "vdd-rxtx";
--
2.39.5