Skip to contentSkip to conversation

i2c/tps65010, update for current i2c-omap

PATCH New David Brownell 1 participant 1 message Sep 29, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c/tps65010, update for current i2c-omap

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.

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

drivers/i2c/chips/tps65010.c +35 -3
@@ -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 */