Skip to content

Commit e2fe950

Browse files
Victor Duicugroeck
authored andcommitted
hwmon: add support for MCP998X
Add driver for Microchip MCP998X/33 and MCP998XD/33D Multichannel Automotive Temperature Monitor Family. Signed-off-by: Victor Duicu <victor.duicu@microchip.com> Link: https://lore.kernel.org/r/20260403-add-mcp9982-hwmon-v12-2-b3bfb26ff136@microchip.com [groeck: Add missing break; to avoid build warning] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
1 parent a345c1e commit e2fe950

6 files changed

Lines changed: 1124 additions & 0 deletions

File tree

Documentation/hwmon/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ Hardware Monitoring Kernel Drivers
175175
mc33xs2410_hwmon
176176
mc34vr500
177177
mcp3021
178+
mcp9982
178179
menf21bmc
179180
mlxreg-fan
180181
mp2856

Documentation/hwmon/mcp9982.rst

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
.. SPDX-License-Identifier: GPL-2.0+
2+
3+
Kernel driver MCP998X
4+
=====================
5+
6+
Supported chips:
7+
8+
* Microchip Technology MCP998X/MCP9933 and MCP998XD/MCP9933D
9+
10+
Prefix: 'mcp9982'
11+
12+
Datasheet:
13+
https://ww1.microchip.com/downloads/aemDocuments/documents/MSLD/ProductDocuments/DataSheets/MCP998X-Family-Data-Sheet-DS20006827.pdf
14+
15+
Authors:
16+
17+
- Victor Duicu <victor.duicu@microchip.com>
18+
19+
Description
20+
-----------
21+
22+
This driver implements support for the MCP998X family containing: MCP9982,
23+
MCP9982D, MCP9983, MCP9983D, MCP9984, MCP9984D, MCP9985, MCP9985D,
24+
MCP9933 and MCP9933D.
25+
26+
The MCP998X Family is a high accuracy 2-wire multichannel automotive
27+
temperature monitor.
28+
29+
The chips in the family have different numbers of external channels,
30+
ranging from 1 (MCP9982) to 4 channels (MCP9985). Reading diodes in
31+
anti-parallel connection is supported by MCP9984/85/33 and
32+
MCP9984D/85D/33D. Dedicated hardware shutdown circuitry is present
33+
only in MCP998XD and MCP9933D.
34+
35+
Temperatures are read in millidegrees Celsius, ranging from -64 to
36+
191.875 with 0.125 precision.
37+
38+
Each channel has a minimum, maximum, and critical limit alongside associated alarms.
39+
The chips also implement a hysteresis mechanism which applies only to the maximum
40+
and critical limits. The relative difference between a limit and its hysteresis
41+
is the same for both and the value is kept in a single register.
42+
43+
The chips measure temperatures with a variable conversion rate.
44+
Update_interval = Conversion/Second, so the available options are:
45+
- 16000 (ms) = 1 conv/16 sec
46+
- 8000 (ms) = 1 conv/8 sec
47+
- 4000 (ms) = 1 conv/4 sec
48+
- 2000 (ms) = 1 conv/2 sec
49+
- 1000 (ms) = 1 conv/sec
50+
- 500 (ms) = 2 conv/sec
51+
- 250 (ms) = 4 conv/sec
52+
- 125 (ms) = 8 conv/sec
53+
- 64 (ms) = 16 conv/sec
54+
- 32 (ms) = 32 conv/sec
55+
- 16 (ms) = 64 conv/sec
56+
57+
Usage Notes
58+
-----------
59+
60+
Parameters that can be configured in devicetree:
61+
- anti-parallel diode mode operation
62+
- resistance error correction on channels 1 and 2
63+
- resistance error correction on channels 3 and 4
64+
- power state
65+
66+
Chips 82/83 and 82D/83D do not support anti-parallel diode mode.
67+
For chips with "D" in the name resistance error correction must be on.
68+
Please see Documentation/devicetree/bindings/hwmon/microchip,mcp9982.yaml
69+
for details.
70+
71+
There are two power states:
72+
- Active state: in which the chip is converting on all channels at the
73+
programmed rate.
74+
75+
- Standby state: in which the host must initiate a conversion cycle.
76+
77+
Chips with "D" in the name work in Active state only and those without
78+
can work in either state.
79+
80+
Chips with "D" in the name can't set update interval slower than 1 second.
81+
82+
Among the hysteresis attributes, only the tempX_crit_hyst ones are writeable
83+
while the others are read only. Setting tempX_crit_hyst writes the difference
84+
between tempX_crit and tempX_crit_hyst in the hysteresis register. The new value
85+
applies automatically to the other limits. At power up the device starts with
86+
a 10 degree hysteresis.
87+
88+
Sysfs entries
89+
-------------
90+
91+
The following attributes are supported. The temperature limits and
92+
update_interval are read-write. The attribute tempX_crit_hyst is read-write,
93+
while tempX_max_hyst is read only. All other attributes are read only.
94+
95+
======================= ==================================================
96+
temp[1-5]_label User name for channel.
97+
temp[1-5]_input Measured temperature for channel.
98+
99+
temp[1-5]_crit Critical temperature limit.
100+
temp[1-5]_crit_alarm Critical temperature limit alarm.
101+
temp[1-5]_crit_hyst Critical temperature limit hysteresis.
102+
103+
temp[1-5]_max High temperature limit.
104+
temp[1-5]_max_alarm High temperature limit alarm.
105+
temp[1-5]_max_hyst High temperature limit hysteresis.
106+
107+
temp[1-5]_min Low temperature limit.
108+
temp[1-5]_min_alarm Low temperature limit alarm.
109+
110+
update_interval The interval at which the chip will update readings.
111+
======================= ==================================================

MAINTAINERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17363,6 +17363,8 @@ M: Victor Duicu <victor.duicu@microchip.com>
1736317363
L: linux-hwmon@vger.kernel.org
1736417364
S: Supported
1736517365
F: Documentation/devicetree/bindings/hwmon/microchip,mcp9982.yaml
17366+
F: Documentation/hwmon/mcp9982.rst
17367+
F: drivers/hwmon/mcp9982.c
1736617368

1736717369
MICROCHIP MMC/SD/SDIO MCI DRIVER
1736817370
M: Aubin Constans <aubin.constans@microchip.com>

drivers/hwmon/Kconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,6 +1378,17 @@ config SENSORS_MCP3021
13781378
This driver can also be built as a module. If so, the module
13791379
will be called mcp3021.
13801380

1381+
config SENSORS_MCP9982
1382+
tristate "Microchip Technology MCP9982 driver"
1383+
depends on I2C
1384+
select REGMAP_I2C
1385+
help
1386+
Say yes here to include support for Microchip Technology's MCP998X/33
1387+
and MCP998XD/33D Multichannel Automotive Temperature Monitor Family.
1388+
1389+
This driver can also be built as a module. If so, the module
1390+
will be called mcp9982.
1391+
13811392
config SENSORS_MLXREG_FAN
13821393
tristate "Mellanox FAN driver"
13831394
depends on MELLANOX_PLATFORM

drivers/hwmon/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ obj-$(CONFIG_SENSORS_MC13783_ADC)+= mc13783-adc.o
170170
obj-$(CONFIG_SENSORS_MC33XS2410) += mc33xs2410_hwmon.o
171171
obj-$(CONFIG_SENSORS_MC34VR500) += mc34vr500.o
172172
obj-$(CONFIG_SENSORS_MCP3021) += mcp3021.o
173+
obj-$(CONFIG_SENSORS_MCP9982) += mcp9982.o
173174
obj-$(CONFIG_SENSORS_TC654) += tc654.o
174175
obj-$(CONFIG_SENSORS_TPS23861) += tps23861.o
175176
obj-$(CONFIG_SENSORS_MLXREG_FAN) += mlxreg-fan.o

0 commit comments

Comments
 (0)