]>
Commit | Line | Data |
---|---|---|
9880552d GKH |
1 | From 806b07c29b711aaf90c81d2a19711607769f8246 Mon Sep 17 00:00:00 2001 |
2 | From: Jean Delvare <khali@linux-fr.org> | |
3 | Date: Wed, 26 May 2010 10:05:11 -0300 | |
4 | Subject: V4L/DVB: FusionHDTV: Use quick reads for I2C IR device probing | |
5 | ||
6 | From: Jean Delvare <khali@linux-fr.org> | |
7 | ||
8 | commit 806b07c29b711aaf90c81d2a19711607769f8246 upstream. | |
9 | ||
10 | IR support on FusionHDTV cards is broken since kernel 2.6.31. One side | |
11 | effect of the switch to the standard binding model for IR I2C devices | |
12 | was to let i2c-core do the probing instead of the ir-kbd-i2c driver. | |
13 | There is a slight difference between the two probe methods: i2c-core | |
14 | uses 0-byte writes, while the ir-kbd-i2c was using 0-byte reads. As | |
15 | some IR I2C devices only support reads, the new probe method fails to | |
16 | detect them. | |
17 | ||
18 | For now, revert to letting the driver do the probe, using 0-byte | |
19 | reads. In the future, i2c-core will be extended to let callers of | |
20 | i2c_new_probed_device() provide a custom probing function. | |
21 | ||
22 | Signed-off-by: Jean Delvare <khali@linux-fr.org> | |
23 | Tested-by: "Timothy D. Lenz" <tlenz@vorgon.com> | |
24 | Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> | |
25 | Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> | |
26 | ||
27 | --- | |
28 | drivers/media/video/cx23885/cx23885-i2c.c | 12 +++++++++++- | |
29 | drivers/media/video/cx88/cx88-i2c.c | 16 +++++++++++++++- | |
30 | 2 files changed, 26 insertions(+), 2 deletions(-) | |
31 | ||
32 | --- a/drivers/media/video/cx23885/cx23885-i2c.c | |
33 | +++ b/drivers/media/video/cx23885/cx23885-i2c.c | |
34 | @@ -365,7 +365,17 @@ int cx23885_i2c_register(struct cx23885_ | |
35 | ||
36 | memset(&info, 0, sizeof(struct i2c_board_info)); | |
37 | strlcpy(info.type, "ir_video", I2C_NAME_SIZE); | |
38 | - i2c_new_probed_device(&bus->i2c_adap, &info, addr_list); | |
39 | + /* | |
40 | + * We can't call i2c_new_probed_device() because it uses | |
41 | + * quick writes for probing and the IR receiver device only | |
42 | + * replies to reads. | |
43 | + */ | |
44 | + if (i2c_smbus_xfer(&bus->i2c_adap, addr_list[0], 0, | |
45 | + I2C_SMBUS_READ, 0, I2C_SMBUS_QUICK, | |
46 | + NULL) >= 0) { | |
47 | + info.addr = addr_list[0]; | |
48 | + i2c_new_device(&bus->i2c_adap, &info); | |
49 | + } | |
50 | } | |
51 | ||
52 | return bus->i2c_rc; | |
53 | --- a/drivers/media/video/cx88/cx88-i2c.c | |
54 | +++ b/drivers/media/video/cx88/cx88-i2c.c | |
55 | @@ -188,10 +188,24 @@ int cx88_i2c_init(struct cx88_core *core | |
56 | 0x18, 0x6b, 0x71, | |
57 | I2C_CLIENT_END | |
58 | }; | |
59 | + const unsigned short *addrp; | |
60 | ||
61 | memset(&info, 0, sizeof(struct i2c_board_info)); | |
62 | strlcpy(info.type, "ir_video", I2C_NAME_SIZE); | |
63 | - i2c_new_probed_device(&core->i2c_adap, &info, addr_list); | |
64 | + /* | |
65 | + * We can't call i2c_new_probed_device() because it uses | |
66 | + * quick writes for probing and at least some R receiver | |
67 | + * devices only reply to reads. | |
68 | + */ | |
69 | + for (addrp = addr_list; *addrp != I2C_CLIENT_END; addrp++) { | |
70 | + if (i2c_smbus_xfer(&core->i2c_adap, *addrp, 0, | |
71 | + I2C_SMBUS_READ, 0, | |
72 | + I2C_SMBUS_QUICK, NULL) >= 0) { | |
73 | + info.addr = *addrp; | |
74 | + i2c_new_device(&core->i2c_adap, &info); | |
75 | + break; | |
76 | + } | |
77 | + } | |
78 | } | |
79 | return core->i2c_rc; | |
80 | } |