Skip to content

Commit 12d3c69

Browse files
Srinivas-Kandagatlakrzk
authored andcommitted
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 <srinivas.kandagatla@linaro.org> Tested-by: Christopher Obbard <christopher.obbard@linaro.org> Reviewed-by: Johan Hovold <johan+linaro@kernel.org> Tested-by: Johan Hovold <johan+linaro@kernel.org> 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 <krzysztof.kozlowski@linaro.org>
1 parent e9c6950 commit 12d3c69

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/mux/gpio.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/mux/driver.h>
1616
#include <linux/platform_device.h>
1717
#include <linux/property.h>
18+
#include <linux/regulator/consumer.h>
1819

1920
struct mux_gpio {
2021
struct gpio_descs *gpios;
@@ -80,6 +81,10 @@ static int mux_gpio_probe(struct platform_device *pdev)
8081
mux_chip->mux->idle_state = idle_state;
8182
}
8283

84+
ret = devm_regulator_get_enable_optional(dev, "mux");
85+
if (ret && ret != -ENODEV)
86+
return dev_err_probe(dev, ret, "failed to get/enable mux supply\n");
87+
8388
ret = devm_mux_chip_register(dev, mux_chip);
8489
if (ret < 0)
8590
return ret;

0 commit comments

Comments
 (0)