Hwmon driver for MAX31827 temperature switch
Subsystems (3)
v2 cover Hwmon driver for MAX31827 temperature switch
There are new functionalities: max_alarm, min_alarm and update_interval.
Modified enable attribute: it switches between 1Hz periodic conversions and shutdown mode.
When requesting a temperature read in shutdown mode 1shot is triggered, the driver waits until the conversion is completed and then displays the read value.
Added new write_alarm_val function which puts the device in shutdown mode, modifies the value of an alarm attribute and the reenables the device with the previous configurations. I used more bitwise operations in this functions instead of regmap_update_bits, because this way only 2 write and 2 read operations are performed. With regmap_update_bits 3 write operations and 2 read operations would be performed.
Added support for the other 2 chips from the datasheet: max31828, max31829.
Added documentation for the driver.
Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/max31827-max31829.pdf
*** BLURB HERE ***
Daniel Matyas (2):
dt-bindings: hwmon: add MAX31827
hwmon: max31827: add MAX31827 driver
.../bindings/hwmon/adi,max31827.yaml | 51 +++ Documentation/hwmon/max31827.rst | 88 +++++ MAINTAINERS | 9 + drivers/hwmon/Kconfig | 11 + drivers/hwmon/Makefile | 1 + drivers/hwmon/max31827.c | 324 ++++++++++++++++++ 6 files changed, 484 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/adi,max31827.yaml create mode 100644 Documentation/hwmon/max31827.rst create mode 100644 drivers/hwmon/max31827.c
Signature · 1 line
2.34.1
PATCH 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.
--- .../bindings/hwmon/adi,max31827.yaml | 51 +++++++++++++++++++ MAINTAINERS | 7 +++ 2 files changed, 58 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/adi,max31827.yaml
Documentation/devicetree/bindings/hwmon/adi,max31827.yaml new file +51 -0
@@ -0,0 +1,51 @@ +# 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: + enum: + - adi,max31827 + - adi,max31828 + - adi,max31829 + + 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 = <®_vdd>; + }; + }; +...
MAINTAINERS +7 -0
@@ -12535,6 +12535,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
PATCH 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.
--- Documentation/hwmon/max31827.rst | 88 +++++++++ MAINTAINERS | 2 + drivers/hwmon/Kconfig | 11 ++ drivers/hwmon/Makefile | 1 + drivers/hwmon/max31827.c | 324 +++++++++++++++++++++++++++++++ 5 files changed, 426 insertions(+) create mode 100644 Documentation/hwmon/max31827.rst create mode 100644 drivers/hwmon/max31827.c
Documentation/hwmon/max31827.rst new file +88 -0
@@ -0,0 +1,88 @@ +.. SPDX-License-Identifier: GPL-2.0 + +Kernel driver max31827 +====================== + +Supported chips: + + * Maxim MAX31827 + + Prefix: 'max31827' + + Addresses scanned: I2C 0x40 - 0x5f + + Datasheet: Publicly available at the Analog Devices website + + * Maxim MAX31828 + + Prefix: 'max31828' + + Addresses scanned: I2C 0x40 - 0x5f + + Datasheet: Publicly available at the Analog Devices website + + * Maxim MAX31829 + + Prefix: 'max31829' + + Addresses scanned: I2C 0x40 - 0x5f + + Datasheet: Publicly available at the Analog Devices website + + +Authors: + - Daniel Matyas <[email protected]> + +Description +----------- + +The chips supported by this driver are quite similar. The only difference +between them is found in the default power-on behaviour of the chips. While the +MAX31827's fault queue is set to 1, the other two chip's fault queue is set to +4. Besides this, the MAX31829's alarm active state is high, while the other two +chip's alarms are active on low. It is important to note that the chips can be +configured to operate in the same manner with 1 write operation to the +configuration register. From here on, we will refer to all these chips as +MAX31827. + +MAX31827 implemets a temperature sensor with a 6 WLP packaging scheme. This +sensor measures the temperature of the chip itself. + +MAX31827 has low and over temperature alarms with an effective value and a +hysteresis value: -40 and -30 degrees for under temperature alarm and +100 and ++90 degrees for over temperature alarm. + +The alarm can be configured in comparator (default) and interrupt mode. In +Comparator mode, the OT/UT status bits have a value of 1 when the temperature +rises above the TH value or falls below TL, which is also subject to the Fault +Queue selection. OT status returns to 0 when the temperature drops below the +TH_HYST value or when shutdown mode is entered. Similarly, UT status returns to +0 when the temperature rises above TL_HYST value or when shutdown mode is +entered. + +In Interrupt mode exceeding TH also sets OT status to 1, which remains set until +a read operation is performed on the configuration/status register; at this +point, it returns to 0. Once OT status is set to 1 from exceeding TH and reset, +it is set to 1 again only when the temperature drops below TH_HYST. The output +remains asserted until it is reset by a read. It is set again if the temperature +rises above TH, and so on. The same logic applies to the operation of the UT +status bit. + +Putting the MAX31827 into shutdown mode also resets the OT/UT status bits. Note +that if the mode is changed while OT/UT status bits are set, an OT/UT status +reset may be required before it begins to behave normally. To prevent this, +it is recommended to perform a read of the configuration/status register to +clear the status bits before changing the operating mode. + +The conversions can be manuel with the one-shot functionality and automatic with +a set frequency. When powered on, the chip measures temperatures with 1 conv/s. +The conversion time varies depending on the resolution. The conversion time +doubles with every bit of increased resolution. For 10 bit resolution +35ms are needed, while for 12 bit resolution (default) 140ms. + + +Notes +----- + +Currently fault queue, alarm polarity and resolution cannot be modified. +PEC is not implemented either.
MAINTAINERS +2 -0
@@ -12541,6 +12541,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
@@ -2401,4 +2401,15 @@ config SENSORS_ASUS_EC endif # ACPI +config MAX31827 + tristate "MAX31827 low-power temperature switch" + depends on I2C + select REGMAP_I2C + help + If you say yes here you get support for MAX31827 + low-power temperature switch and sensor connected with I2C. + + This driver can also be built as a module. If so, the module + will be called max31827. + endif # HWMON
drivers/hwmon/Makefile +1 -0
@@ -224,3 +224,4 @@ obj-$(CONFIG_PMBUS) += pmbus/ ccflags-$(CONFIG_HWMON_DEBUG_CHIP) := -DDEBUG +obj-$(CONFIG_MAX31827) += max31827.o
drivers/hwmon/max31827.c new file +324 -0
324 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH v2 1/2] [PATCH v1 1/2] dt-bindings: hwmon: add MAX31827
In reply to Daniel MatyasQuoted 33 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.
Signed-off-by Daniel Matyas <[email protected]>--- .../bindings/hwmon/adi,max31827.yaml | 51 +++++++++++++++++++ MAINTAINERS | 7 +++ 2 files changed, 58 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/adi,max31827.yamlDocumentation/devicetree/bindings/hwmon/adi,max31827.yaml new file +12
-0@@ -0,0 +1,51 @@ +# 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: |
Documentation/devicetree/bindings/hwmon/adi,max31827.yaml line 22
Quoted 10 lines
Documentation/devicetree/bindings/hwmon/adi,max31827.yaml new file +10
-0+ 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: + enum: + - adi,max31827 + - adi,max31828 + - adi,max31829
Why suddenly these are all incompatible? This is not what I suggested.
Documentation/devicetree/bindings/hwmon/adi,max31827.yaml line 26
Quoted 4 lines
Documentation/devicetree/bindings/hwmon/adi,max31827.yaml new file +4
-0+ + reg: + maxItems: 1 +
Best regards,
Krzysztof
Unclear what to do with compatibility
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.
--- .../bindings/hwmon/adi,max31827.yaml | 51 +++++++++++++++++++ MAINTAINERS | 7 +++ 2 files changed, 58 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/adi,max31827.yaml
Documentation/devicetree/bindings/hwmon/adi,max31827.yaml new file +23 -0
@@ -0,0 +1,51 @@ +# 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: + enum: + - adi,max31827 + - adi,max31828 + - adi,max31829 +
I am really sorry, but I do not understand what I should do.
Should I add oneOf or items to the compatibility property?
+ 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 = <®_vdd>;
+ };
+ };
+...
MAINTAINERS +7 -0
@@ -12535,6 +12535,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 · 4 lines
2.34.1 Best regards, Daniel
Re: Unclear what to do with compatibility
Quoted 1 line · Daniel Matyas
MAX31827 is a low-power temperature switch with I2C interface.
You sent a new patch. With a weird subject. I don't understand exactly what is this.
Quoted 44 lines
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.
Signed-off-by Daniel Matyas <[email protected]>--- .../bindings/hwmon/adi,max31827.yaml | 51 +++++++++++++++++++ MAINTAINERS | 7 +++ 2 files changed, 58 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/adi,max31827.yamlDocumentation/devicetree/bindings/hwmon/adi,max31827.yaml new file +23
-0@@ -0,0 +1,51 @@ +# 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: + enum: + - adi,max31827 + - adi,max31828 + - adi,max31829 +
Quoted 3 lines
I am really sorry, but I do not understand what I should do.
Should I add oneOf or items to the compatibility property?
The devices should be marked as compatible with each other, so you can drop useless match table entries.
and fix this in the driver.
Best regards,
Krzysztof