i2c: New-style devices can support driver model wakeup flags
authorDavid Brownell <david-b@pacbell.net>
Sat, 13 Oct 2007 21:56:29 +0000 (23:56 +0200)
committerJean Delvare <khali@hyperion.delvare>
Sat, 13 Oct 2007 21:56:29 +0000 (23:56 +0200)
We need to be able to flag I2C devices, such as RTCs, which can issue wake
events (usually through IRQ lines).  This adds an i2c_board_info.flags bit,
and uses it to initialize the i2c device node.  (And shrinks a few lines
that were overly long.)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
drivers/i2c/i2c-core.c
include/linux/i2c.h

index 910a62de190d4e00e5320fcfaa5a8b1c2d26c9a6..06b4b9e1a23eb43a088b8dbf876f9253b755a31f 100644 (file)
@@ -226,7 +226,9 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info)
        client->adapter = adap;
 
        client->dev.platform_data = info->platform_data;
-       client->flags = info->flags;
+       device_init_wakeup(&client->dev, info->flags & I2C_CLIENT_WAKE);
+
+       client->flags = info->flags & ~I2C_CLIENT_WAKE;
        client->addr = info->addr;
        client->irq = info->irq;
 
index 2a32f2fd940d56fc6bf4d63ced9f9f75aa13995d..e4793feac2bb867a1c2cedea81cca2bb0730869a 100644 (file)
@@ -342,9 +342,10 @@ static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data)
 }
 
 /*flags for the client struct: */
-#define I2C_CLIENT_PEC  0x04                   /* Use Packet Error Checking */
-#define I2C_CLIENT_TEN 0x10                    /* we have a ten bit chip address       */
-                                               /* Must equal I2C_M_TEN below */
+#define I2C_CLIENT_PEC 0x04            /* Use Packet Error Checking */
+#define I2C_CLIENT_TEN 0x10            /* we have a ten bit chip address */
+                                       /* Must equal I2C_M_TEN below */
+#define I2C_CLIENT_WAKE        0x80            /* for board_info; true iff can wake */
 
 /* i2c adapter classes (bitmask) */
 #define I2C_CLASS_HWMON                (1<<0)  /* lm_sensors, ... */