Skip to contentSkip to conversation

dt-bindings: hwmon: add MAX31827

PATCH In review Daniel Matyas 3 participants 4 messages Jun 8, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v11 1/2 dt-bindings: hwmon: add MAX31827

MAX31827 is a low-power temperature switch with I2C interface.

The device is a ±1°C accuracy from -40°C to +125°C (12 bits) local temperature switch and sensor with I2C/SM- Bus interface. The combination of small 6-bump wafer-lev- el package (WLP) and high accuracy makes this temper- ature sensor/switch ideal for a wide range of applications.

---

Change log:
v10 -> v11: No change.
v9 -> v10: Added proper change log.
v8 -> v9: Did not use '--base'.
v7 -> v8: Added '--base=[Linux 6.4-rc1 commmit]' when using 'git format-patch' v6 -> v7: No change.
v5 -> v6: Added Reviewed-by tag.
v3 -> v5: Forgot to add Reviewed-by tag.
v2 -> v3: Made max31828 and max31829 compatible with max31827.
v1 -> v2: Resolved dt_binding_check errors. Dropped status at i2c node. Made node name generic.

 .../bindings/hwmon/adi,max31827.yaml          | 54 +++++++++++++++++++
 MAINTAINERS                                   |  7 +++
 2 files changed, 61 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwmon/adi,max31827.yaml
Documentation/devicetree/bindings/hwmon/adi,max31827.yaml new file +54 -0
new file mode 100644
index 000000000000..2dc8b07b4d3b
@@ -0,0 +1,54 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/hwmon/adi,max31827.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Analog Devices MAX31827, MAX31828, MAX31829 Low-Power Temperature Switch
+
+maintainers:
+  - Daniel Matyas <[email protected]>
+
+description: |
+  Analog Devices MAX31827, MAX31828, MAX31829 Low-Power Temperature Switch with
+  I2C Interface
+  https://www.analog.com/media/en/technical-documentation/data-sheets/MAX31827-MAX31829.pdf
+
+properties:
+  compatible:
+    oneOf:
+      - const: adi,max31827
+      - items:
+          - enum:
+              - adi,max31828
+              - adi,max31829
+          - const: adi,max31827
+
+  reg:
+    maxItems: 1
+
+  vref-supply:
+    description:
+      Must have values in the interval (1.6V; 3.6V) in order for the device to
+      function correctly.
+
+required:
+  - compatible
+  - reg
+  - vref-supply
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        temperature-sensor@42 {
+            compatible = "adi,max31827";
+            reg = <0x42>;
+            vref-supply = <&reg_vdd>;
+        };
+    };
+...
MAINTAINERS +7 -0
index 27ef11624748..752c7e9c4e4a 100644
@@ -12612,6 +12612,13 @@ F:	Documentation/userspace-api/media/drivers/max2175.rst
 F:	drivers/media/i2c/max2175*
 F:	include/uapi/linux/max2175.h
 
+MAX31827 TEMPERATURE SWITCH DRIVER
+M:	Daniel Matyas <[email protected]>
+L:	[email protected]
+S:	Supported
+W:	http://ez.analog.com/community/linux-device-drivers
+F:	Documentation/devicetree/bindings/hwmon/adi,max31827.yaml
+
 MAX6650 HARDWARE MONITOR AND FAN CONTROLLER DRIVER
 L:	[email protected]
 S:	Orphan
Signature · 1 line
2.34.1
#1 lore raw

PATCH v11 2/2 hwmon: max31827: add MAX31827 driver

MAX31827 is a low-power temperature switch with I2C interface.

The device is a ±1°C accuracy from -40°C to +125°C (12 bits) local temperature switch and sensor with I2C/SM- Bus interface. The combination of small 6-bump wafer-lev- el package (WLP) and high accuracy makes this temper- ature sensor/switch ideal for a wide range of applications.

---

v10 -> v11: Modified compatible field of the of_device_id struct from "max31827" to "adi,max31827". Now it matches the binding.

v9 -> v10: Added a proper change log.

v8 -> v9: No change.

v7 -> v8: Initialised ret in max31827_read function, so that it has a value, even if 'type == hwmon_chip && attr != hwmon_chip_update_interval'. (in reality it will never go there, but needed to this this, because compiler warning)

v6 -> v7 : Used goto instead of return in write_alarm_val function. Unlocked mutex in goto label. Used mutex for enable. Now update_interval can only be modified if the device is enabled. I did this, b.c. modifying the update interval, when the device is in shutdown mode, automatically enables the device.

v5 -> v6: Corrected the mistakes with mutex. Explained why I shift the last 4 bits in the .rst file. (because the LSB is 0.0625 degrees Celsius).

v4 -> v5: Used sign_extend32 to convert to and from milli-degrees.

v3 -> v4: Made consistency tweaks. Extended mutex_lock to every instance of reading from or writing to st->enable. Added conversion to and from milli-degrees. Added of_table.

v2 -> v3: Added mutex protection to reading and writing to configuration register. Dropped of_table. Converted update_interval to Hertz.

v1 -> v2: Added max31827.rst documentation. Removed unused defines. Removed i2c_client from private struct. Made code consistent and cleaner. Resolved ABI abuse in hwmon_temp_enable. Added alarm attribute support. Added write_alarm_value function to put the device in shutdown mode before changing the alarm value and hysteresis registers. Removed redundant error message if something went wrong with regmap_init. Used sizeof(*st) instead of sizeof(struct max31827_state) in kzalloc.

 Documentation/hwmon/index.rst    |   1 +
 Documentation/hwmon/max31827.rst |  90 ++++++
 MAINTAINERS                      |   2 +
 drivers/hwmon/Kconfig            |  11 +
 drivers/hwmon/Makefile           |   2 +-
 drivers/hwmon/max31827.c         | 466 +++++++++++++++++++++++++++++++
 6 files changed, 571 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/hwmon/max31827.rst
 create mode 100644 drivers/hwmon/max31827.c
Documentation/hwmon/index.rst +1 -0
index fa1208c62855..8cc0922f3b36 100644
@@ -140,6 +140,7 @@ Hardware Monitoring Kernel Drivers
    max31760
    max31785
    max31790
+   max31827
    max34440
    max6620
    max6639
Documentation/hwmon/max31827.rst new file +90 -0

90 lines not on this page · raw message

MAINTAINERS +2 -0
index 752c7e9c4e4a..53f5bd58989a 100644
@@ -12618,6 +12618,8 @@ L:	[email protected]
 S:	Supported
 W:	http://ez.analog.com/community/linux-device-drivers
 F:	Documentation/devicetree/bindings/hwmon/adi,max31827.yaml
+F:	Documentation/hwmon/max31827.rst
+F:	drivers/hwmon/max31827.c
 
 MAX6650 HARDWARE MONITOR AND FAN CONTROLLER DRIVER
 L:	[email protected]
drivers/hwmon/Kconfig +11 -0
index fc640201a2de..12bd17075dc4 100644
@@ -1097,6 +1097,17 @@ config SENSORS_MAX31760
 	  This driver can also be built as a module. If so, the module
 	  will be called max31760.
 
+config MAX31827
+	tristate "MAX31827 low-power temperature switch and similar devices"
+	depends on I2C
+	select REGMAP_I2C
+	help
+	  If you say yes here you get support for MAX31827, MAX31828 and
+	  MAX31829 low-power temperature switches and sensors connected with I2C.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called max31827.
+
 config SENSORS_MAX6620
 	tristate "Maxim MAX6620 fan controller"
 	depends on I2C
drivers/hwmon/Makefile +1 -1
index cd8c568c80a9..8a8021f9ca9e 100644
@@ -149,6 +149,7 @@ obj-$(CONFIG_SENSORS_MAX6642)	+= max6642.o
 obj-$(CONFIG_SENSORS_MAX6650)	+= max6650.o
 obj-$(CONFIG_SENSORS_MAX6697)	+= max6697.o
 obj-$(CONFIG_SENSORS_MAX31790)	+= max31790.o
+obj-$(CONFIG_MAX31827) += max31827.o
 obj-$(CONFIG_SENSORS_MC13783_ADC)+= mc13783-adc.o
 obj-$(CONFIG_SENSORS_MC34VR500)	+= mc34vr500.o
 obj-$(CONFIG_SENSORS_MCP3021)	+= mcp3021.o
@@ -224,4 +225,3 @@ obj-$(CONFIG_SENSORS_PECI)	+= peci/
 obj-$(CONFIG_PMBUS)		+= pmbus/
 
 ccflags-$(CONFIG_HWMON_DEBUG_CHIP) := -DDEBUG
-
drivers/hwmon/max31827.c new file +466 -0

466 lines not on this page · raw message

Signature · 1 line
2.34.1
#2 lore raw
In reply to Daniel Matyas
Quoted 8 lines · Daniel Matyas

MAX31827 is a low-power temperature switch with I2C interface.

The device is a ±1°C accuracy from -40°C to +125°C (12 bits) local temperature switch and sensor with I2C/SM- Bus interface. The combination of small 6-bump wafer-lev- el package (WLP) and high accuracy makes this temper- ature sensor/switch ideal for a wide range of applications.

Quoted 6 lines

---

Change log:
v10 -> v11: No change.

Wasn't this applied? Why do you send it again?

Best regards,
Krzysztof

maintainer
#3 lore raw
Quoted 9 lines · Krzysztof Kozlowski
Quoted 8 lines · Daniel Matyas

MAX31827 is a low-power temperature switch with I2C interface.

The device is a ±1°C accuracy from -40°C to +125°C (12 bits) local temperature switch and sensor with I2C/SM- Bus interface. The combination of small 6-bump wafer-lev- el package (WLP) and high accuracy makes this temper- ature sensor/switch ideal for a wide range of applications.

Quoted 9 lines
Quoted 6 lines

---

Change log:
v10 -> v11: No change.

Wasn't this applied? Why do you send it again?

There was a problem reported in the driver implementation (bad compatible entry). The submitter chose to send v11 instead of a patch fixing the already applied driver.

I'll fix up the original driver patch instead. Please ignore.

Guenter