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>
This commit is contained in:
Victor Duicu
2026-04-11 00:02:13 -07:00
committed by Guenter Roeck
parent a345c1e3cd
commit e2fe950f34
6 changed files with 1124 additions and 0 deletions
+1
View File
@@ -175,6 +175,7 @@ Hardware Monitoring Kernel Drivers
mc33xs2410_hwmon
mc34vr500
mcp3021
mcp9982
menf21bmc
mlxreg-fan
mp2856
+111
View File
@@ -0,0 +1,111 @@
.. SPDX-License-Identifier: GPL-2.0+
Kernel driver MCP998X
=====================
Supported chips:
* Microchip Technology MCP998X/MCP9933 and MCP998XD/MCP9933D
Prefix: 'mcp9982'
Datasheet:
https://ww1.microchip.com/downloads/aemDocuments/documents/MSLD/ProductDocuments/DataSheets/MCP998X-Family-Data-Sheet-DS20006827.pdf
Authors:
- Victor Duicu <victor.duicu@microchip.com>
Description
-----------
This driver implements support for the MCP998X family containing: MCP9982,
MCP9982D, MCP9983, MCP9983D, MCP9984, MCP9984D, MCP9985, MCP9985D,
MCP9933 and MCP9933D.
The MCP998X Family is a high accuracy 2-wire multichannel automotive
temperature monitor.
The chips in the family have different numbers of external channels,
ranging from 1 (MCP9982) to 4 channels (MCP9985). Reading diodes in
anti-parallel connection is supported by MCP9984/85/33 and
MCP9984D/85D/33D. Dedicated hardware shutdown circuitry is present
only in MCP998XD and MCP9933D.
Temperatures are read in millidegrees Celsius, ranging from -64 to
191.875 with 0.125 precision.
Each channel has a minimum, maximum, and critical limit alongside associated alarms.
The chips also implement a hysteresis mechanism which applies only to the maximum
and critical limits. The relative difference between a limit and its hysteresis
is the same for both and the value is kept in a single register.
The chips measure temperatures with a variable conversion rate.
Update_interval = Conversion/Second, so the available options are:
- 16000 (ms) = 1 conv/16 sec
- 8000 (ms) = 1 conv/8 sec
- 4000 (ms) = 1 conv/4 sec
- 2000 (ms) = 1 conv/2 sec
- 1000 (ms) = 1 conv/sec
- 500 (ms) = 2 conv/sec
- 250 (ms) = 4 conv/sec
- 125 (ms) = 8 conv/sec
- 64 (ms) = 16 conv/sec
- 32 (ms) = 32 conv/sec
- 16 (ms) = 64 conv/sec
Usage Notes
-----------
Parameters that can be configured in devicetree:
- anti-parallel diode mode operation
- resistance error correction on channels 1 and 2
- resistance error correction on channels 3 and 4
- power state
Chips 82/83 and 82D/83D do not support anti-parallel diode mode.
For chips with "D" in the name resistance error correction must be on.
Please see Documentation/devicetree/bindings/hwmon/microchip,mcp9982.yaml
for details.
There are two power states:
- Active state: in which the chip is converting on all channels at the
programmed rate.
- Standby state: in which the host must initiate a conversion cycle.
Chips with "D" in the name work in Active state only and those without
can work in either state.
Chips with "D" in the name can't set update interval slower than 1 second.
Among the hysteresis attributes, only the tempX_crit_hyst ones are writeable
while the others are read only. Setting tempX_crit_hyst writes the difference
between tempX_crit and tempX_crit_hyst in the hysteresis register. The new value
applies automatically to the other limits. At power up the device starts with
a 10 degree hysteresis.
Sysfs entries
-------------
The following attributes are supported. The temperature limits and
update_interval are read-write. The attribute tempX_crit_hyst is read-write,
while tempX_max_hyst is read only. All other attributes are read only.
======================= ==================================================
temp[1-5]_label User name for channel.
temp[1-5]_input Measured temperature for channel.
temp[1-5]_crit Critical temperature limit.
temp[1-5]_crit_alarm Critical temperature limit alarm.
temp[1-5]_crit_hyst Critical temperature limit hysteresis.
temp[1-5]_max High temperature limit.
temp[1-5]_max_alarm High temperature limit alarm.
temp[1-5]_max_hyst High temperature limit hysteresis.
temp[1-5]_min Low temperature limit.
temp[1-5]_min_alarm Low temperature limit alarm.
update_interval The interval at which the chip will update readings.
======================= ==================================================
+2
View File
@@ -17363,6 +17363,8 @@ M: Victor Duicu <victor.duicu@microchip.com>
L: linux-hwmon@vger.kernel.org
S: Supported
F: Documentation/devicetree/bindings/hwmon/microchip,mcp9982.yaml
F: Documentation/hwmon/mcp9982.rst
F: drivers/hwmon/mcp9982.c
MICROCHIP MMC/SD/SDIO MCI DRIVER
M: Aubin Constans <aubin.constans@microchip.com>
+11
View File
@@ -1378,6 +1378,17 @@ config SENSORS_MCP3021
This driver can also be built as a module. If so, the module
will be called mcp3021.
config SENSORS_MCP9982
tristate "Microchip Technology MCP9982 driver"
depends on I2C
select REGMAP_I2C
help
Say yes here to include support for Microchip Technology's MCP998X/33
and MCP998XD/33D Multichannel Automotive Temperature Monitor Family.
This driver can also be built as a module. If so, the module
will be called mcp9982.
config SENSORS_MLXREG_FAN
tristate "Mellanox FAN driver"
depends on MELLANOX_PLATFORM
+1
View File
@@ -170,6 +170,7 @@ obj-$(CONFIG_SENSORS_MC13783_ADC)+= mc13783-adc.o
obj-$(CONFIG_SENSORS_MC33XS2410) += mc33xs2410_hwmon.o
obj-$(CONFIG_SENSORS_MC34VR500) += mc34vr500.o
obj-$(CONFIG_SENSORS_MCP3021) += mcp3021.o
obj-$(CONFIG_SENSORS_MCP9982) += mcp9982.o
obj-$(CONFIG_SENSORS_TC654) += tc654.o
obj-$(CONFIG_SENSORS_TPS23861) += tps23861.o
obj-$(CONFIG_SENSORS_MLXREG_FAN) += mlxreg-fan.o
File diff suppressed because it is too large Load Diff