Skip to content

Commit 229d495

Browse files
Krellangroeck
authored andcommitted
hwmon: (lm90) Add max6654 support to lm90 driver
Add support for the Maxim MAX6654 to the lm90 driver. The MAX6654 is a temperature sensor, similar to the others, but with some differences regarding the configuration register, and the sampling rate at which extended resolution becomes possible. Signed-off-by: Josh Lehan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
1 parent 036855a commit 229d495

File tree

3 files changed

+67
-10
lines changed

3 files changed

+67
-10
lines changed

Documentation/hwmon/lm90.rst

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,18 @@ Supported chips:
123123

124124
http://www.maxim-ic.com/quick_view2.cfm/qv_pk/3497
125125

126+
* Maxim MAX6654
127+
128+
Prefix: 'max6654'
129+
130+
Addresses scanned: I2C 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b,
131+
132+
0x4c, 0x4d and 0x4e
133+
134+
Datasheet: Publicly available at the Maxim website
135+
136+
https://www.maximintegrated.com/en/products/sensors/MAX6654.html
137+
126138
* Maxim MAX6657
127139

128140
Prefix: 'max6657'
@@ -301,6 +313,13 @@ ADT7461, ADT7461A, NCT1008:
301313
* Extended temperature range (breaks compatibility)
302314
* Lower resolution for remote temperature
303315

316+
MAX6654:
317+
* Better local resolution
318+
* Selectable address
319+
* Remote sensor type selection
320+
* Extended temperature range
321+
* Extended resolution only available when conversion rate <= 1 Hz
322+
304323
MAX6657 and MAX6658:
305324
* Better local resolution
306325
* Remote sensor type selection
@@ -336,8 +355,8 @@ SA56004X:
336355

337356
All temperature values are given in degrees Celsius. Resolution
338357
is 1.0 degree for the local temperature, 0.125 degree for the remote
339-
temperature, except for the MAX6657, MAX6658 and MAX6659 which have a
340-
resolution of 0.125 degree for both temperatures.
358+
temperature, except for the MAX6654, MAX6657, MAX6658 and MAX6659 which have
359+
a resolution of 0.125 degree for both temperatures.
341360

342361
Each sensor has its own high and low limits, plus a critical limit.
343362
Additionally, there is a relative hysteresis value common to both critical

drivers/hwmon/Kconfig

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,10 +1198,11 @@ config SENSORS_LM90
11981198
help
11991199
If you say yes here you get support for National Semiconductor LM90,
12001200
LM86, LM89 and LM99, Analog Devices ADM1032, ADT7461, and ADT7461A,
1201-
Maxim MAX6646, MAX6647, MAX6648, MAX6649, MAX6657, MAX6658, MAX6659,
1202-
MAX6680, MAX6681, MAX6692, MAX6695, MAX6696, ON Semiconductor NCT1008,
1203-
Winbond/Nuvoton W83L771W/G/AWG/ASG, Philips SA56004, GMT G781, and
1204-
Texas Instruments TMP451 sensor chips.
1201+
Maxim MAX6646, MAX6647, MAX6648, MAX6649, MAX6654, MAX6657, MAX6658,
1202+
MAX6659, MAX6680, MAX6681, MAX6692, MAX6695, MAX6696,
1203+
ON Semiconductor NCT1008, Winbond/Nuvoton W83L771W/G/AWG/ASG,
1204+
Philips SA56004, GMT G781, and Texas Instruments TMP451
1205+
sensor chips.
12051206

12061207
This driver can also be built as a module. If so, the module
12071208
will be called lm90.

drivers/hwmon/lm90.c

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@
3535
* explicitly as max6659, or if its address is not 0x4c.
3636
* These chips lack the remote temperature offset feature.
3737
*
38+
* This driver also supports the MAX6654 chip made by Maxim. This chip can
39+
* be at 9 different addresses, similar to MAX6680/MAX6681. The MAX6654 is
40+
* otherwise similar to MAX6657/MAX6658/MAX6659. Extended range is available
41+
* by setting the configuration register accordingly, and is done during
42+
* initialization. Extended precision is only available at conversion rates
43+
* of 1 Hz and slower. Note that extended precision is not enabled by
44+
* default, as this driver initializes all chips to 2 Hz by design.
45+
*
3846
* This driver also supports the MAX6646, MAX6647, MAX6648, MAX6649 and
3947
* MAX6692 chips made by Maxim. These are again similar to the LM86,
4048
* but they use unsigned temperature values and can report temperatures
@@ -94,8 +102,8 @@
94102
* have address 0x4d.
95103
* MAX6647 has address 0x4e.
96104
* MAX6659 can have address 0x4c, 0x4d or 0x4e.
97-
* MAX6680 and MAX6681 can have address 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b,
98-
* 0x4c, 0x4d or 0x4e.
105+
* MAX6654, MAX6680, and MAX6681 can have address 0x18, 0x19, 0x1a, 0x29,
106+
* 0x2a, 0x2b, 0x4c, 0x4d or 0x4e.
99107
* SA56004 can have address 0x48 through 0x4F.
100108
*/
101109

@@ -104,7 +112,7 @@ static const unsigned short normal_i2c[] = {
104112
0x4d, 0x4e, 0x4f, I2C_CLIENT_END };
105113

106114
enum chips { lm90, adm1032, lm99, lm86, max6657, max6659, adt7461, max6680,
107-
max6646, w83l771, max6696, sa56004, g781, tmp451 };
115+
max6646, w83l771, max6696, sa56004, g781, tmp451, max6654 };
108116

109117
/*
110118
* The LM90 registers
@@ -145,7 +153,7 @@ enum chips { lm90, adm1032, lm99, lm86, max6657, max6659, adt7461, max6680,
145153
#define LM90_REG_R_TCRIT_HYST 0x21
146154
#define LM90_REG_W_TCRIT_HYST 0x21
147155

148-
/* MAX6646/6647/6649/6657/6658/6659/6695/6696 registers */
156+
/* MAX6646/6647/6649/6654/6657/6658/6659/6695/6696 registers */
149157

150158
#define MAX6657_REG_R_LOCAL_TEMPL 0x11
151159
#define MAX6696_REG_R_STATUS2 0x12
@@ -209,6 +217,7 @@ static const struct i2c_device_id lm90_id[] = {
209217
{ "max6646", max6646 },
210218
{ "max6647", max6646 },
211219
{ "max6649", max6646 },
220+
{ "max6654", max6654 },
212221
{ "max6657", max6657 },
213222
{ "max6658", max6657 },
214223
{ "max6659", max6659 },
@@ -269,6 +278,10 @@ static const struct of_device_id __maybe_unused lm90_of_match[] = {
269278
.compatible = "dallas,max6649",
270279
.data = (void *)max6646
271280
},
281+
{
282+
.compatible = "dallas,max6654",
283+
.data = (void *)max6654
284+
},
272285
{
273286
.compatible = "dallas,max6657",
274287
.data = (void *)max6657
@@ -367,6 +380,11 @@ static const struct lm90_params lm90_params[] = {
367380
.max_convrate = 6,
368381
.reg_local_ext = MAX6657_REG_R_LOCAL_TEMPL,
369382
},
383+
[max6654] = {
384+
.alert_alarms = 0x7c,
385+
.max_convrate = 7,
386+
.reg_local_ext = MAX6657_REG_R_LOCAL_TEMPL,
387+
},
370388
[max6657] = {
371389
.flags = LM90_PAUSE_FOR_CONFIG,
372390
.alert_alarms = 0x7c,
@@ -1557,6 +1575,16 @@ static int lm90_detect(struct i2c_client *client,
15571575
&& (config1 & 0x3f) == 0x00
15581576
&& convrate <= 0x07) {
15591577
name = "max6646";
1578+
} else
1579+
/*
1580+
* The chip_id of the MAX6654 holds the revision of the chip.
1581+
* The lowest 3 bits of the config1 register are unused and
1582+
* should return zero when read.
1583+
*/
1584+
if (chip_id == 0x08
1585+
&& (config1 & 0x07) == 0x00
1586+
&& convrate <= 0x07) {
1587+
name = "max6654";
15601588
}
15611589
} else
15621590
if (address == 0x4C
@@ -1660,6 +1688,15 @@ static int lm90_init_client(struct i2c_client *client, struct lm90_data *data)
16601688
if (data->kind == max6680)
16611689
config |= 0x18;
16621690

1691+
/*
1692+
* Put MAX6654 into extended range (0x20, extend minimum range from
1693+
* 0 degrees to -64 degrees). Note that extended resolution is not
1694+
* possible on the MAX6654 unless conversion rate is set to 1 Hz or
1695+
* slower, which is intentionally not done by default.
1696+
*/
1697+
if (data->kind == max6654)
1698+
config |= 0x20;
1699+
16631700
/*
16641701
* Select external channel 0 for max6695/96
16651702
*/

0 commit comments

Comments
 (0)