Re: [PATCH] i2c driver fixes for 2.6.0

Greg KH
2003-12-30T22:24:04Z

ChangeSet 1.1496.8.31, 2003/12/17 16:04:10-08:00, mhoffman@lightlink.com

[PATCH] I2C: improve chip detection in w83781d.c driver

This patch improves chip detection. It was forward ported from the
lm_sensors project CVS, from these revisions:

1.104 (Khali) Enhance chip detection (stricter).
1.108 (Khali) Fix W83627HF detection.

drivers/i2c/chips/w83781d.c | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)

diff -Nru a/drivers/i2c/chips/w83781d.c b/drivers/i2c/chips/w83781d.c
--- a/drivers/i2c/chips/w83781d.c Tue Dec 30 12:30:38 2003
+++ b/drivers/i2c/chips/w83781d.c Tue Dec 30 12:30:38 2003
@@ -24,10 +24,11 @@
Supports following chips:

Chip #vin #fanin #pwm #temp wchipid vendid i2c ISA
- as99127f 7 3 1? 3 0x30 0x12c3 yes no
- asb100 "bach" (type_name = as99127f) 0x30 0x0694 yes no
- w83781d 7 3 0 3 0x10 0x5ca3 yes yes
- w83627hf 9 3 2 3 0x20 0x5ca3 yes yes(LPC)
+ as99127f 7 3 1? 3 0x31 0x12c3 yes no
+ as99127f rev.2 (type_name = 1299127f) 0x31 0x5ca3 yes no
+ asb100 "bach" (type_name = as99127f) 0x31 0x0694 yes no
+ w83781d 7 3 0 3 0x10-1 0x5ca3 yes yes
+ w83627hf 9 3 2 3 0x21 0x5ca3 yes yes(LPC)
w83627thf 9 3 2 3 0x90 0x5ca3 no yes(LPC)
w83782d 9 3 2-4 3 0x30 0x5ca3 yes yes
w83783s 5-6 3 2 1-2 0x40 0x5ca3 yes no
@@ -1264,7 +1265,7 @@
goto ERROR2;
}
/* If Winbond SMBus, check address at 0x48.
- Asus doesn't support */
+ Asus doesn't support, except for as99127f rev.2 */
if ((!is_isa) && (((!(val1 & 0x80)) && (val2 == 0xa3)) ||
((val1 & 0x80) && (val2 == 0x5c)))) {
if (w83781d_read_value
@@ -1295,18 +1296,17 @@
goto ERROR2;
}

- /* mask off lower bit, not reliable */
- val1 =
- w83781d_read_value(new_client, W83781D_REG_WCHIPID) & 0xfe;
- if (val1 == 0x10 && vendid == winbond)
+ val1 = w83781d_read_value(new_client, W83781D_REG_WCHIPID);
+ if ((val1 == 0x10 || val1 == 0x11) && vendid == winbond)
kind = w83781d;
else if (val1 == 0x30 && vendid == winbond)
kind = w83782d;
- else if (val1 == 0x40 && vendid == winbond && !is_isa)
+ else if (val1 == 0x40 && vendid == winbond && !is_isa
+ && address == 0x2d)
kind = w83783s;
- else if ((val1 == 0x20 || val1 == 0x90) && vendid == winbond)
+ else if ((val1 == 0x21 || val1 == 0x90) && vendid == winbond)
kind = w83627hf;
- else if (val1 == 0x30 && vendid == asus && !is_isa)
+ else if (val1 == 0x31 && !is_isa && address >= 0x28)
kind = as99127f;
else if (val1 == 0x60 && vendid == winbond && is_isa)
kind = w83697hf;