mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3 0/3] hwmon: (lm75) add MAX31875 support
@ 2026-10-09 11:56 John Erasmus Mari Geronimo
  2026-10-09 11:56 ` [PATCH v3 1/3] dt-bindings: hwmon: lm75: add MAX31875 John Erasmus Mari Geronimo
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: John Erasmus Mari Geronimo @ 2026-10-09 11:56 UTC (permalink / raw)
  To: linux
  Cc: robh, krzk+dt, conor+dt, corbet, skhan, jdelvare, linux-hwmon,
	devicetree, linux-kernel, linux-doc

Add support for the Analog Devices MAX31875 I2C temperature sensor by
extending the existing lm75 driver.

The MAX31875 provides a 16-bit configuration register, selectable
resolution of 8, 9, 10, or 12 bits, conversion rates of 125 ms, 250 ms,
1 s, or 4 s, and an alarm output.

Changes since v2:
- dt-bindings: expand the commit message to explain why the MAX31875
  needs its own compatible string instead of reusing an existing
  lm75-family one, and pick up Conor Dooley's Acked-by given
  conditional on that fix.
- driver: drop the bogus .resolutions table, which incorrectly tied
  resolution to the sample-time index even though the two are
  independently configurable on this chip (Guenter Roeck).
- driver: use the BIT() idiom for the alarm bit read to match the
  rest of the file (Guenter Roeck).

Changes since v1:
- Rework the implementation to use the existing lm75 driver instead of
  the previously selected max31827 base driver.
- Add the MAX31875 Device Tree binding, documentation, and driver
  configuration for resolution, conversion rate, and alarm reporting.

John Erasmus Mari Geronimo (3):
  dt-bindings: hwmon: lm75: add MAX31875
  hwmon: (lm75) add MAX31875 documentation
  hwmon: (lm75) add MAX31875 support

 .../devicetree/bindings/hwmon/lm75.yaml       |  1 +
 Documentation/hwmon/lm75.rst                  |  6 +++--
 drivers/hwmon/Kconfig                         |  2 +-
 drivers/hwmon/lm75.c                          | 24 +++++++++++++++++++
 4 files changed, 30 insertions(+), 3 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v3 1/3] dt-bindings: hwmon: lm75: add MAX31875
  2026-10-09 11:56 [PATCH v3 0/3] hwmon: (lm75) add MAX31875 support John Erasmus Mari Geronimo
@ 2026-10-09 11:56 ` John Erasmus Mari Geronimo
  2026-10-09 11:56 ` [PATCH v3 2/3] hwmon: (lm75) add MAX31875 documentation John Erasmus Mari Geronimo
  2026-10-09 11:56 ` [PATCH v3 3/3] hwmon: (lm75) add MAX31875 support John Erasmus Mari Geronimo
  2 siblings, 0 replies; 4+ messages in thread
From: John Erasmus Mari Geronimo @ 2026-10-09 11:56 UTC (permalink / raw)
  To: linux
  Cc: robh, krzk+dt, conor+dt, corbet, skhan, jdelvare, linux-hwmon,
	devicetree, linux-kernel, linux-doc, Conor Dooley

Add MAX31875 compatible string to lm75 dt-bindings.

The MAX31875 cannot reuse an existing lm75-family compatible such as
adi,adt75: it has a 16-bit configuration register (instead of 8-bit),
four independently selectable conversion rates (125 ms, 250 ms, 1 s,
4 s) and four independently selectable resolutions (8, 9, 10, 12
bits), and reports its alarm through a different configuration
register bit. These differences require dedicated handling in the
lm75 driver, so a distinct compatible string is needed to select it.

Signed-off-by: John Erasmus Mari Geronimo <johnerasmusmari.geronimo@analog.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
---
 Documentation/devicetree/bindings/hwmon/lm75.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/hwmon/lm75.yaml b/Documentation/devicetree/bindings/hwmon/lm75.yaml
index b48bf3fd721fe..d56f3ec299105 100644
--- a/Documentation/devicetree/bindings/hwmon/lm75.yaml
+++ b/Documentation/devicetree/bindings/hwmon/lm75.yaml
@@ -14,6 +14,7 @@ properties:
   compatible:
     enum:
       - adi,adt75
+      - adi,max31875
       - ams,as6200
       - atmel,at30ts74
       - dallas,ds1775
-- 
2.34.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v3 2/3] hwmon: (lm75) add MAX31875 documentation
  2026-10-09 11:56 [PATCH v3 0/3] hwmon: (lm75) add MAX31875 support John Erasmus Mari Geronimo
  2026-10-09 11:56 ` [PATCH v3 1/3] dt-bindings: hwmon: lm75: add MAX31875 John Erasmus Mari Geronimo
@ 2026-10-09 11:56 ` John Erasmus Mari Geronimo
  2026-10-09 11:56 ` [PATCH v3 3/3] hwmon: (lm75) add MAX31875 support John Erasmus Mari Geronimo
  2 siblings, 0 replies; 4+ messages in thread
From: John Erasmus Mari Geronimo @ 2026-10-09 11:56 UTC (permalink / raw)
  To: linux
  Cc: robh, krzk+dt, conor+dt, corbet, skhan, jdelvare, linux-hwmon,
	devicetree, linux-kernel, linux-doc

Document the Maxim MAX31875 I2C temperature sensor as a supported
chip in the lm75 driver documentation.

Signed-off-by: John Erasmus Mari Geronimo <johnerasmusmari.geronimo@analog.com>
---
 Documentation/hwmon/lm75.rst | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Documentation/hwmon/lm75.rst b/Documentation/hwmon/lm75.rst
index ca46754e028b3..54a6a75e8a71b 100644
--- a/Documentation/hwmon/lm75.rst
+++ b/Documentation/hwmon/lm75.rst
@@ -66,9 +66,9 @@ Supported chips:
 
 	       http://www.microchip.com/
 
-  * Analog Devices ADT75
+  * Analog Devices ADT75, MAX31875
 
-    Prefix: 'adt75'
+    Prefix: 'adt75', 'max31875'
 
     Addresses scanned: none
 
@@ -76,6 +76,8 @@ Supported chips:
 
 	       https://www.analog.com/adt75
 
+	       https://www.analog.com/max31875
+
   * ST Microelectronics STDS75
 
     Prefix: 'stds75'
-- 
2.34.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v3 3/3] hwmon: (lm75) add MAX31875 support
  2026-10-09 11:56 [PATCH v3 0/3] hwmon: (lm75) add MAX31875 support John Erasmus Mari Geronimo
  2026-10-09 11:56 ` [PATCH v3 1/3] dt-bindings: hwmon: lm75: add MAX31875 John Erasmus Mari Geronimo
  2026-10-09 11:56 ` [PATCH v3 2/3] hwmon: (lm75) add MAX31875 documentation John Erasmus Mari Geronimo
@ 2026-10-09 11:56 ` John Erasmus Mari Geronimo
  2 siblings, 0 replies; 4+ messages in thread
From: John Erasmus Mari Geronimo @ 2026-10-09 11:56 UTC (permalink / raw)
  To: linux
  Cc: robh, krzk+dt, conor+dt, corbet, skhan, jdelvare, linux-hwmon,
	devicetree, linux-kernel, linux-doc

Add support for the Maxim MAX31875 I2C temperature sensor by
extending the lm75 driver. The MAX31875 features a 16-bit
configuration register, configurable resolution (8, 9, 10, or
12 bits), and selectable conversion rates (125ms, 250ms, 1s, 4s).

Suggested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: John Erasmus Mari Geronimo <johnerasmusmari.geronimo@analog.com>
---
 drivers/hwmon/Kconfig |  2 +-
 drivers/hwmon/lm75.c  | 24 ++++++++++++++++++++++++
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index e4c4f2b09732d..c68b6c3c2f866 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -1525,7 +1525,7 @@ config SENSORS_LM75
 	  If you say yes here you get support for one common type of
 	  temperature sensor chip, with models including:
 
-		- Analog Devices ADT75
+		- Analog Devices ADT75, MAX31875
 		- Atmel (now Microchip) AT30TS74
 		- Dallas Semiconductor DS75, DS1775 and DS7505
 		- Global Mixed-mode Technology (GMT) G751
diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c
index 104149a03bad0..2fc5659a3d6bf 100644
--- a/drivers/hwmon/lm75.c
+++ b/drivers/hwmon/lm75.c
@@ -39,6 +39,7 @@ enum lm75_type {		/* keep sorted in alphabetical order */
 	max6625,
 	max6626,
 	max31725,
+	max31875,
 	mcp980x,
 	p3t1750,
 	p3t1755,
@@ -223,6 +224,14 @@ static const struct lm75_params device_params[] = {
 		.default_resolution = 16,
 		.default_sample_time = MSEC_PER_SEC / 20,
 	},
+	[max31875] = {
+		.config_reg_16bits = true,
+		.default_resolution = 10,
+		.default_sample_time = 4000,
+		.num_sample_times = 4,
+		.sample_times = (unsigned int []){ 125, 250, 1000, 4000 },
+		.alarm = true,
+	},
 	[tcn75] = {
 		.default_resolution = 9,
 		.default_sample_time = MSEC_PER_SEC / 18,
@@ -421,6 +430,9 @@ static int lm75_read(struct device *dev, enum hwmon_sensor_types type,
 			case tmp112:
 				*val = !!(regval & BIT(13)) == !!(regval & BIT(2));
 				break;
+			case max31875:
+				*val = !!(regval & BIT(7));
+				break;
 			default:
 				return -EINVAL;
 			}
@@ -495,6 +507,13 @@ static int lm75_update_interval(struct device *dev, long val)
 			return err;
 		data->sample_time = data->params->sample_times[index];
 		break;
+	case max31875:
+		err = regmap_update_bits(data->regmap, LM75_REG_CONF,
+					 0x0600, (3 - index) << 9);
+		if (err < 0)
+			return err;
+		data->sample_time = data->params->sample_times[index];
+		break;
 	case pct2075:
 		err = regmap_write(data->regmap, PCT2075_REG_IDLE, index + 1);
 		if (err)
@@ -848,6 +867,7 @@ static const struct i2c_device_id lm75_i2c_ids[] = {
 	{ .name = "max6626", .driver_data = max6626 },
 	{ .name = "max31725", .driver_data = max31725 },
 	{ .name = "max31726", .driver_data = max31725 },
+	{ .name = "max31875", .driver_data = max31875 },
 	{ .name = "mcp980x", .driver_data = mcp980x },
 	{ .name = "p3t1750", .driver_data = p3t1750 },
 	{ .name = "p3t1755", .driver_data = p3t1755 },
@@ -905,6 +925,10 @@ static const struct of_device_id lm75_of_match[] = {
 		.compatible = "adi,adt75",
 		.data = (void *)adt75
 	},
+	{
+		.compatible = "adi,max31875",
+		.data = (void *)max31875
+	},
 	{
 		.compatible = "ams,as6200",
 		.data = (void *)as6200
-- 
2.34.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-10-09 11:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-09 11:56 [PATCH v3 0/3] hwmon: (lm75) add MAX31875 support John Erasmus Mari Geronimo
2026-10-09 11:56 ` [PATCH v3 1/3] dt-bindings: hwmon: lm75: add MAX31875 John Erasmus Mari Geronimo
2026-10-09 11:56 ` [PATCH v3 2/3] hwmon: (lm75) add MAX31875 documentation John Erasmus Mari Geronimo
2026-10-09 11:56 ` [PATCH v3 3/3] hwmon: (lm75) add MAX31875 support John Erasmus Mari Geronimo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®