]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ENGR00269945: gpio: pca953x: add device_reset() call
authorShawn Guo <shawn.guo@freescale.com>
Sun, 14 Jul 2013 13:52:38 +0000 (21:52 +0800)
committerJason Liu <r64343@freescale.com>
Wed, 30 Oct 2013 01:53:46 +0000 (09:53 +0800)
The pca953x type of devices, e.g. max7310, may have a reset which needs
to be handled to get the device start working.  Add a device_reset()
call for that, and defer the probe if the reset controller for that is
not ready yet.

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
drivers/gpio/gpio-pca953x.c

index 426c51dd420c618613f96153e8b19275c9ce247a..74f7008af3f2df512e07b9ff51a96bfd2b6feb55 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/irqdomain.h>
 #include <linux/i2c.h>
 #include <linux/i2c/pca953x.h>
+#include <linux/reset.h>
 #include <linux/slab.h>
 #ifdef CONFIG_OF_GPIO
 #include <linux/of_platform.h>
@@ -752,6 +753,10 @@ static int pca953x_probe(struct i2c_client *client,
 
        mutex_init(&chip->i2c_lock);
 
+       ret = device_reset(&client->dev);
+       if (ret == -ENODEV)
+               return -EPROBE_DEFER;
+
        /* initialize cached registers from their original values.
         * we can't share this chip with another i2c master.
         */