Commit 12d3c69b authored by Srinivas Kandagatla's avatar Srinivas Kandagatla Committed by Krzysztof Kozlowski
Browse files

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: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Tested-by: default avatarChristopher Obbard <christopher.obbard@linaro.org>
Reviewed-by: default avatarJohan Hovold <johan+linaro@kernel.org>
Tested-by: default avatarJohan 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: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
parent e9c69506
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
#include <linux/mux/driver.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/regulator/consumer.h>

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;