linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c-parport: Give powered devices some time to settle
@ 2010-02-11 11:16 Jean Delvare
  0 siblings, 0 replies; only message in thread
From: Jean Delvare @ 2010-02-11 11:16 UTC (permalink / raw)
  To: Linux I2C

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-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
---
 drivers/i2c/busses/i2c-parport-light.c |    6 +++++-
 drivers/i2c/busses/i2c-parport.c       |    6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

--- linux-2.6.33-rc7.orig/drivers/i2c/busses/i2c-parport-light.c	2009-06-10 05:05:27.000000000 +0200
+++ linux-2.6.33-rc7/drivers/i2c/busses/i2c-parport-light.c	2010-02-11 12:11:27.000000000 +0100
@@ -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(s
 	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);
--- linux-2.6.33-rc7.orig/drivers/i2c/busses/i2c-parport.c	2010-02-11 11:39:03.000000000 +0100
+++ linux-2.6.33-rc7/drivers/i2c/busses/i2c-parport.c	2010-02-11 12:03:40.000000000 +0100
@@ -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 p
 	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");


-- 
Jean Delvare

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-02-11 11:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-11 11:16 [PATCH] i2c-parport: Give powered devices some time to settle Jean Delvare

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).