9
0
Fork 0

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 <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Andrey Smirnov 2016-11-15 06:46:45 -08:00 committed by Sascha Hauer
parent 883fa87397
commit 28dde40d1a
1 changed files with 7 additions and 0 deletions

View File

@ -45,6 +45,8 @@
#include <i2c/i2c-algo-bit.h>
#include <i2c/i2c-mux.h>
#include <init.h>
#include <gpio.h>
#include <of_gpio.h>
#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.
*/