From 12d3c69ba2734b5908e0ac8ac2dcbd0cc28fef3a Mon Sep 17 00:00:00 2001 From: Srinivas Kandagatla Date: Thu, 27 Mar 2025 10:06:29 +0000 Subject: [PATCH] mux: gpio: add optional regulator support Some of the external muxes needs powering up using a regulator. This is the case with Lenovo T14s laptop which has a external audio mux to handle US/EURO headsets. Add support to the driver to handle this optional regulator. Signed-off-by: Srinivas Kandagatla Tested-by: Christopher Obbard Reviewed-by: Johan Hovold Tested-by: Johan Hovold Link: https://lore.kernel.org/r/20250327100633.11530-3-srinivas.kandagatla@linaro.org [krzk: Adjust dev_err message per Johan's review] Signed-off-by: Krzysztof Kozlowski --- drivers/mux/gpio.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/mux/gpio.c b/drivers/mux/gpio.c index 5710879cd47f8..4cc3202c58f36 100644 --- a/drivers/mux/gpio.c +++ b/drivers/mux/gpio.c @@ -15,6 +15,7 @@ #include #include #include +#include struct mux_gpio { struct gpio_descs *gpios; @@ -80,6 +81,10 @@ static int mux_gpio_probe(struct platform_device *pdev) mux_chip->mux->idle_state = idle_state; } + ret = devm_regulator_get_enable_optional(dev, "mux"); + if (ret && ret != -ENODEV) + return dev_err_probe(dev, ret, "failed to get/enable mux supply\n"); + ret = devm_mux_chip_register(dev, mux_chip); if (ret < 0) return ret; -- 2.47.2