mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 10:01:39 -05:00
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>
This commit is contained in:
committed by
Krzysztof Kozlowski
parent
e9c695067b
commit
12d3c69ba2
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user