[patch 2.6.18-git] i2c/tps65010, update for current i2c-omap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This updates the TPS6501x driver to stop trying to use the faked-out
I2C probe protocol (never guaranteed to work), since the OMAP I2C
driver merged to kernel.org no longer tries to support it.

Until the I2C stack is updated to offer full driver model support from
static board-specific device tables, and is able to pass things like
IRQ resources and chip IDs, the only way to address this type of issue
is for drivers to have board-specific info kick in before registering
the driver (for addressing), and in the probe code (for other resources).
So that's what this patch adds.

Signed-off-by: David Brownell <[email protected]>

------
please merge for 2.6.18-rc ...

--- osk.orig/drivers/i2c/chips/tps65010.c	2006-09-28 19:27:51.000000000 -0700
+++ osk/drivers/i2c/chips/tps65010.c	2006-09-28 21:06:10.000000000 -0700
@@ -42,15 +42,38 @@
 
 /*-------------------------------------------------------------------------*/
 
-#define	DRIVER_VERSION	"2 May 2005"
+#define	DRIVER_VERSION	"28 Sept 2006"
 #define	DRIVER_NAME	(tps65010_driver.driver.name)
 
 MODULE_DESCRIPTION("TPS6501x Power Management Driver");
 MODULE_LICENSE("GPL");
 
-static unsigned short normal_i2c[] = { 0x48, /* 0x49, */ I2C_CLIENT_END };
 
-I2C_CLIENT_INSMOD;
+/* The i2c-omap driver doesn't support the i2c request used to fake probes,
+ * so we need board-specific tables saying what devices exist.
+ *
+ * Until the I2C stack doesn't support such tables, we need to fake them
+ * in the module initialization code (and in driver init for IRQs etc).
+ *
+ * Note we expect only ONE tps chip per board; no point in having more.
+ */
+
+static unsigned short force[3] __devinitdata = {
+	0, 0x48,		/* default address */
+	I2C_CLIENT_END,
+};
+static unsigned short *forces[] __devinitdata = { force, NULL, };
+
+static unsigned short ignore[] __devinitdata = {
+	I2C_CLIENT_END, I2C_CLIENT_END,
+};
+
+static struct i2c_client_address_data addr_data __devinitdata = {
+	.forces		= forces,
+	.probe		= ignore,
+	.normal_i2c	= ignore,
+	.ignore		= ignore,
+};
 
 static struct i2c_driver tps65010_driver;
 
@@ -990,6 +1013,15 @@ static int __init tps_init(void)
 	u32	tries = 3;
 	int	status = -ENODEV;
 
+#ifdef	CONFIG_ARM
+	if (machine_is_omap_osk()
+			|| machine_is_omap_h2()
+			|| machine_is_omap_h3())
+		/* ok */ ;
+	else
+		return status;
+#endif
+
 	printk(KERN_INFO "%s: version %s\n", DRIVER_NAME, DRIVER_VERSION);
 
 	/* some boards have startup glitches */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux