MLK-11293: gpio: pca953x: add device_reset() call
authorShawn Guo <shawn.guo@freescale.com>
Sun, 14 Jul 2013 13:52:38 +0000 (21:52 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:46:52 +0000 (14:46 -0500)
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>
Signed-off-by: Fugang Duan <B38611@freescale.com>
(cherry picked from commit: d3264091b30b777d94a18efda9823a06668d5b10)

drivers/gpio/gpio-pca953x.c

index fe731f0..f0bb7b5 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/interrupt.h>
 #include <linux/i2c.h>
 #include <linux/platform_data/pca953x.h>
+#include <linux/reset.h>
 #include <linux/slab.h>
 #include <asm/unaligned.h>
 #include <linux/of_platform.h>
@@ -813,6 +814,10 @@ static int pca953x_probe(struct i2c_client *client,
        lockdep_set_subclass(&chip->i2c_lock,
                             i2c_adapter_depth(client->adapter));
 
+       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.
         */