Commit 14f4eefa authored by Jean Delvare's avatar Jean Delvare Committed by Greg Kroah-Hartman

[PATCH] I2C: Fix MAX6657/8/9 detection in lm90

I received no additional feedback about my MAX6657/8/9 detection fix.
Since it was correct for the only chips I got a report for, I propose we
apply it. After all, maybe people don't know they have such a chip
because the detection was previously not correct.

The patch below is the one I sent to the LM Sensors and Linux Kernel
mailing-lists two weeks ago, unchanged. Thanks.
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent d3b02eff
...@@ -35,12 +35,13 @@ ...@@ -35,12 +35,13 @@
* Among others, it has a higher accuracy than the LM90, much like the * Among others, it has a higher accuracy than the LM90, much like the
* LM86 does. * LM86 does.
* *
* This driver also supports the MAX6657 and MAX6658, sensor chips made * This driver also supports the MAX6657, MAX6658 and MAX6659 sensor
* by Maxim. These chips are similar to the LM86. Complete datasheet * chips made by Maxim. These chips are similar to the LM86. Complete
* can be obtained at Maxim's website at: * datasheet can be obtained at Maxim's website at:
* http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2578 * http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2578
* Note that there is no way to differenciate between both chips (but * Note that there is no easy way to differenciate between the three
* no need either). * variants. The extra address and features of the MAX6659 are not
* supported by this driver.
* *
* Since the LM90 was the first chipset supported by this driver, most * Since the LM90 was the first chipset supported by this driver, most
* comments will refer to this chipset, but are actually general and * comments will refer to this chipset, but are actually general and
...@@ -70,9 +71,11 @@ ...@@ -70,9 +71,11 @@
/* /*
* Addresses to scan * Addresses to scan
* Address is fully defined internally and cannot be changed. * Address is fully defined internally and cannot be changed except for
* MAX6659.
* LM86, LM89, LM90, LM99, ADM1032, MAX6657 and MAX6658 have address 0x4c. * LM86, LM89, LM90, LM99, ADM1032, MAX6657 and MAX6658 have address 0x4c.
* LM89-1, and LM99-1 have address 0x4d. * LM89-1, and LM99-1 have address 0x4d.
* MAX6659 can have address 0x4c, 0x4d or 0x4e (unsupported).
*/ */
static unsigned short normal_i2c[] = { 0x4c, 0x4d, I2C_CLIENT_END }; static unsigned short normal_i2c[] = { 0x4c, 0x4d, I2C_CLIENT_END };
...@@ -386,8 +389,17 @@ static int lm90_detect(struct i2c_adapter *adapter, int address, int kind) ...@@ -386,8 +389,17 @@ static int lm90_detect(struct i2c_adapter *adapter, int address, int kind)
} }
} else } else
if (man_id == 0x4D) { /* Maxim */ if (man_id == 0x4D) { /* Maxim */
if (address == 0x4C /*
&& (reg_config1 & 0x1F) == 0 * The Maxim variants do NOT have a chip_id register.
* Reading from that address will return the last read
* value, which in our case is those of the man_id
* register. Likewise, the config1 register seems to
* lack a low nibble, so the value will be those of the
* previous read, so in our case those of the man_id
* register.
*/
if (chip_id == man_id
&& (reg_config1 & 0x1F) == (man_id & 0x0F)
&& reg_convrate <= 0x09) { && reg_convrate <= 0x09) {
kind = max6657; kind = max6657;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment