i2c: muxes: pca954x: Switch to gpiod api
PATCH 1/1 i2c: muxes: pca954x: Switch to gpiod api
Switch the driver to gpiod API, this should help with different polarity of RESET signal.
Signed-off-by Alexander Shiyan <[email protected]>
--- drivers/i2c/muxes/i2c-mux-pca954x.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/i2c/muxes/i2c-mux-pca954x.c +7 -6
@@ -41,8 +41,7 @@#include <i2c/i2c.h> #include <i2c/i2c-algo-bit.h> #include <i2c/i2c-mux.h> -#include <gpio.h> -#include <of_gpio.h> +#include <linux/gpio/consumer.h> #define PCA954X_MAX_NCHANS 8
@@ -187,7 +186,7 @@ static int pca954x_probe(struct device *dev)int num;struct pca954x *data;int ret = -ENODEV ; -int gpio; +struct gpio_desc *gpio;bool idle_disconnect; data =kzalloc (sizeof (struct pca954x ),GFP_KERNEL );
@@ -198,9 +197,11 @@ static int pca954x_probe(struct device *dev)i2c_set_clientdata (client, data); - gpio =of_get_named_gpio (dev->of_node,"reset-gpios" ,0 ); -if (gpio_is_valid (gpio)) -gpio_direction_output (gpio,1 ); + gpio =gpiod_get_optional (dev,"reset" ,GPIOD_OUT_HIGH ); +if (IS_ERR (gpio)) +return PTR_ERR (gpio); + +gpiod_set_value (gpio,0 );/* Write the mux register at addr to verify * that the mux is in fact present. This also
Signature · 1 line
2.38.2
Sascha Hauer
AppliedQuoted 4 lines · Alexander Shiyan
Switch the driver to gpiod API, this should help with different polarity of RESET signal.
Applied, thanks!
[1/1] i2c: muxes: pca954x: Switch to gpiod api
https://git.pengutronix.de/cgit/barebox/commit/?id=0ac2b7068be3 (link may not be stable)
Best regards,
Signature · 1 line
Sascha Hauer <[email protected]>