]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
i2c-parport: Give powered devices some time to settle
authorJean Delvare <khali@linux-fr.org>
Tue, 2 Mar 2010 11:23:41 +0000 (12:23 +0100)
committerJean Delvare <khali@linux-fr.org>
Tue, 2 Mar 2010 11:23:41 +0000 (12:23 +0100)
When the i2c-parport adapter is reponsible for powering devices, it
would seem reasonable to give them some time to settle before trying
to access them.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
drivers/i2c/busses/i2c-parport-light.c
drivers/i2c/busses/i2c-parport.c

index 322c5691e38eb72072c8135f8036dd35e991d958..5383f64c53729aa3e44458a184a5746a779958ea 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
+#include <linux/delay.h>
 #include <linux/platform_device.h>
 #include <linux/ioport.h>
 #include <linux/i2c.h>
@@ -127,8 +128,11 @@ static int __devinit i2c_parport_probe(struct platform_device *pdev)
        parport_setsda(NULL, 1);
        parport_setscl(NULL, 1);
        /* Other init if needed (power on...) */
-       if (adapter_parm[type].init.val)
+       if (adapter_parm[type].init.val) {
                line_set(1, &adapter_parm[type].init);
+               /* Give powered devices some time to settle */
+               msleep(100);
+       }
 
        parport_adapter.dev.parent = &pdev->dev;
        err = i2c_bit_add_bus(&parport_adapter);
index 0d8998610c740e180d27960e5a4825e5b84de95c..056af18209933c7dc8c1938af57922d111fb75dc 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
+#include <linux/delay.h>
 #include <linux/parport.h>
 #include <linux/i2c.h>
 #include <linux/i2c-algo-bit.h>
@@ -185,8 +186,11 @@ static void i2c_parport_attach (struct parport *port)
        parport_setsda(port, 1);
        parport_setscl(port, 1);
        /* Other init if needed (power on...) */
-       if (adapter_parm[type].init.val)
+       if (adapter_parm[type].init.val) {
                line_set(port, 1, &adapter_parm[type].init);
+               /* Give powered devices some time to settle */
+               msleep(100);
+       }
 
        if (i2c_bit_add_bus(&adapter->adapter) < 0) {
                printk(KERN_ERR "i2c-parport: Unable to register with I2C\n");