[media] marvell-cam: Right-shift i2c slave ID's in the cafe driver
authorJonathan Corbet <corbet@lwn.net>
Sat, 11 Jun 2011 17:46:47 +0000 (14:46 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 27 Jul 2011 20:53:00 +0000 (17:53 -0300)
This makes the cafe i2c implement consistent with the rest of Linux so that
the core can use the same slave ID everywhere.

Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/marvell-ccic/cafe-driver.c
drivers/media/video/marvell-ccic/mcam-core.c

index 1027265d46ab9e38b350f205581fc296b24ab0af..3dbc7e55499d05794e57d8ff1f0ee13acbd14f92 100644 (file)
@@ -84,7 +84,14 @@ struct cafe_camera {
 #define          TWSIC0_EN       0x00000001    /* TWSI enable */
 #define          TWSIC0_MODE     0x00000002    /* 1 = 16-bit, 0 = 8-bit */
 #define          TWSIC0_SID      0x000003fc    /* Slave ID */
-#define          TWSIC0_SID_SHIFT 2
+/*
+ * Subtle trickery: the slave ID field starts with bit 2.  But the
+ * Linux i2c stack wants to treat the bottommost bit as a separate
+ * read/write bit, which is why slave ID's are usually presented
+ * >>1.  For consistency with that behavior, we shift over three
+ * bits instead of two.
+ */
+#define          TWSIC0_SID_SHIFT 3
 #define          TWSIC0_CLKDIV   0x0007fc00    /* Clock divider */
 #define          TWSIC0_MASKACK  0x00400000    /* Mask ack from sensor */
 #define          TWSIC0_OVMAGIC  0x00800000    /* Make it work on OV sensors */
index 0d6023435557732832dc0e663fdcaa6a21a0efd4..d5f18a300094d40c93b2ea7ab723e8aed311449a 100644 (file)
@@ -1549,7 +1549,7 @@ int mccic_register(struct mcam_camera *cam)
 {
        struct i2c_board_info ov7670_info = {
                .type = "ov7670",
-               .addr = 0x42,
+               .addr = 0x42 >> 1,
                .platform_data = &sensor_cfg,
        };
        int ret;