Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] marvell-cam: Right-shift i2c slave ID's in the cafe driver

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>

authored by

Jonathan Corbet and committed by
Mauro Carvalho Chehab
1c68f889 f8ff6a96

+9 -2
+8 -1
drivers/media/video/marvell-ccic/cafe-driver.c
··· 84 84 #define TWSIC0_EN 0x00000001 /* TWSI enable */ 85 85 #define TWSIC0_MODE 0x00000002 /* 1 = 16-bit, 0 = 8-bit */ 86 86 #define TWSIC0_SID 0x000003fc /* Slave ID */ 87 - #define TWSIC0_SID_SHIFT 2 87 + /* 88 + * Subtle trickery: the slave ID field starts with bit 2. But the 89 + * Linux i2c stack wants to treat the bottommost bit as a separate 90 + * read/write bit, which is why slave ID's are usually presented 91 + * >>1. For consistency with that behavior, we shift over three 92 + * bits instead of two. 93 + */ 94 + #define TWSIC0_SID_SHIFT 3 88 95 #define TWSIC0_CLKDIV 0x0007fc00 /* Clock divider */ 89 96 #define TWSIC0_MASKACK 0x00400000 /* Mask ack from sensor */ 90 97 #define TWSIC0_OVMAGIC 0x00800000 /* Make it work on OV sensors */
+1 -1
drivers/media/video/marvell-ccic/mcam-core.c
··· 1549 1549 { 1550 1550 struct i2c_board_info ov7670_info = { 1551 1551 .type = "ov7670", 1552 - .addr = 0x42, 1552 + .addr = 0x42 >> 1, 1553 1553 .platform_data = &sensor_cfg, 1554 1554 }; 1555 1555 int ret;