From 28dde40d1a8fff59d47721327dcef3307c313d2a Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Tue, 15 Nov 2016 06:46:45 -0800 Subject: i2c-mux-pca954x: Add code to control reset line Most recent device tree binding for that mux support specifying a GPIO connected to a reset line of that chip. Add code to handle that binding in order to be able to use the chip on boards that leverage aforementioned functionality. Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- drivers/i2c/muxes/i2c-mux-pca954x.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'drivers/i2c') diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c index baeae7bb94..0d5515b716 100644 --- a/drivers/i2c/muxes/i2c-mux-pca954x.c +++ b/drivers/i2c/muxes/i2c-mux-pca954x.c @@ -45,6 +45,8 @@ #include #include #include +#include +#include #define PCA954X_MAX_NCHANS 8 @@ -179,6 +181,7 @@ static int pca954x_probe(struct device_d *dev) int num, force; struct pca954x *data; int ret = -ENODEV; + int gpio; data = kzalloc(sizeof(struct pca954x), GFP_KERNEL); if (!data) { @@ -188,6 +191,10 @@ static int pca954x_probe(struct device_d *dev) i2c_set_clientdata(client, data); + gpio = of_get_named_gpio(dev->device_node, "reset-gpios", 0); + if (gpio_is_valid(gpio)) + gpio_direction_output(gpio, 1); + /* Read the mux register at addr to verify * that the mux is in fact present. */ -- cgit v1.2.3