|
69 | 69 | * This driver also supports the G781 from GMT. This device is compatible
|
70 | 70 | * with the ADM1032.
|
71 | 71 | *
|
72 |
| - * This driver also supports TMP451 from Texas Instruments. This device is |
73 |
| - * supported in both compatibility and extended mode. It's mostly compatible |
74 |
| - * with ADT7461 except for local temperature low byte register and max |
75 |
| - * conversion rate. |
| 72 | + * This driver also supports TMP451 and TMP461 from Texas Instruments. |
| 73 | + * Those devices are supported in both compatibility and extended mode. |
| 74 | + * They are mostly compatible with ADT7461 except for local temperature |
| 75 | + * low byte register and max conversion rate. |
76 | 76 | *
|
77 | 77 | * Since the LM90 was the first chipset supported by this driver, most
|
78 | 78 | * comments will refer to this chipset, but are actually general and
|
@@ -112,7 +112,7 @@ static const unsigned short normal_i2c[] = {
|
112 | 112 | 0x4d, 0x4e, 0x4f, I2C_CLIENT_END };
|
113 | 113 |
|
114 | 114 | enum chips { lm90, adm1032, lm99, lm86, max6657, max6659, adt7461, max6680,
|
115 |
| - max6646, w83l771, max6696, sa56004, g781, tmp451, max6654 }; |
| 115 | + max6646, w83l771, max6696, sa56004, g781, tmp451, tmp461, max6654 }; |
116 | 116 |
|
117 | 117 | /*
|
118 | 118 | * The LM90 registers
|
@@ -168,8 +168,12 @@ enum chips { lm90, adm1032, lm99, lm86, max6657, max6659, adt7461, max6680,
|
168 | 168 |
|
169 | 169 | #define LM90_MAX_CONVRATE_MS 16000 /* Maximum conversion rate in ms */
|
170 | 170 |
|
171 |
| -/* TMP451 registers */ |
| 171 | +/* TMP451/TMP461 registers */ |
172 | 172 | #define TMP451_REG_R_LOCAL_TEMPL 0x15
|
| 173 | +#define TMP451_REG_CONALERT 0x22 |
| 174 | + |
| 175 | +#define TMP461_REG_CHEN 0x16 |
| 176 | +#define TMP461_REG_DFC 0x24 |
173 | 177 |
|
174 | 178 | /*
|
175 | 179 | * Device flags
|
@@ -230,6 +234,7 @@ static const struct i2c_device_id lm90_id[] = {
|
230 | 234 | { "w83l771", w83l771 },
|
231 | 235 | { "sa56004", sa56004 },
|
232 | 236 | { "tmp451", tmp451 },
|
| 237 | + { "tmp461", tmp461 }, |
233 | 238 | { }
|
234 | 239 | };
|
235 | 240 | MODULE_DEVICE_TABLE(i2c, lm90_id);
|
@@ -327,6 +332,10 @@ static const struct of_device_id __maybe_unused lm90_of_match[] = {
|
327 | 332 | .compatible = "ti,tmp451",
|
328 | 333 | .data = (void *)tmp451
|
329 | 334 | },
|
| 335 | + { |
| 336 | + .compatible = "ti,tmp461", |
| 337 | + .data = (void *)tmp461 |
| 338 | + }, |
330 | 339 | { },
|
331 | 340 | };
|
332 | 341 | MODULE_DEVICE_TABLE(of, lm90_of_match);
|
@@ -428,6 +437,13 @@ static const struct lm90_params lm90_params[] = {
|
428 | 437 | .max_convrate = 9,
|
429 | 438 | .reg_local_ext = TMP451_REG_R_LOCAL_TEMPL,
|
430 | 439 | },
|
| 440 | + [tmp461] = { |
| 441 | + .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT |
| 442 | + | LM90_HAVE_BROKEN_ALERT | LM90_HAVE_EXTENDED_TEMP, |
| 443 | + .alert_alarms = 0x7c, |
| 444 | + .max_convrate = 9, |
| 445 | + .reg_local_ext = TMP451_REG_R_LOCAL_TEMPL, |
| 446 | + }, |
431 | 447 | };
|
432 | 448 |
|
433 | 449 | /*
|
@@ -1628,18 +1644,26 @@ static int lm90_detect(struct i2c_client *client,
|
1628 | 1644 | && convrate <= 0x08)
|
1629 | 1645 | name = "g781";
|
1630 | 1646 | } else
|
1631 |
| - if (address == 0x4C |
1632 |
| - && man_id == 0x55) { /* Texas Instruments */ |
1633 |
| - int local_ext; |
| 1647 | + if (man_id == 0x55 && chip_id == 0x00 && |
| 1648 | + (config1 & 0x1B) == 0x00 && convrate <= 0x09) { |
| 1649 | + int local_ext, conalert, chen, dfc; |
1634 | 1650 |
|
1635 | 1651 | local_ext = i2c_smbus_read_byte_data(client,
|
1636 | 1652 | TMP451_REG_R_LOCAL_TEMPL);
|
1637 |
| - |
1638 |
| - if (chip_id == 0x00 /* TMP451 */ |
1639 |
| - && (config1 & 0x1B) == 0x00 |
1640 |
| - && convrate <= 0x09 |
1641 |
| - && (local_ext & 0x0F) == 0x00) |
1642 |
| - name = "tmp451"; |
| 1653 | + conalert = i2c_smbus_read_byte_data(client, |
| 1654 | + TMP451_REG_CONALERT); |
| 1655 | + chen = i2c_smbus_read_byte_data(client, TMP461_REG_CHEN); |
| 1656 | + dfc = i2c_smbus_read_byte_data(client, TMP461_REG_DFC); |
| 1657 | + |
| 1658 | + if ((local_ext & 0x0F) == 0x00 && |
| 1659 | + (conalert & 0xf1) == 0x01 && |
| 1660 | + (chen & 0xfc) == 0x00 && |
| 1661 | + (dfc & 0xfc) == 0x00) { |
| 1662 | + if (address == 0x4c && !(chen & 0x03)) |
| 1663 | + name = "tmp451"; |
| 1664 | + else if (address >= 0x48 && address <= 0x4f) |
| 1665 | + name = "tmp461"; |
| 1666 | + } |
1643 | 1667 | }
|
1644 | 1668 |
|
1645 | 1669 | if (!name) { /* identification failed */
|
|
0 commit comments