2023-04-06 16:51:50

by Matyas, Daniel

[permalink] [raw]
Subject: [PATCH 0/2] Hwmon driver for MAX31827 temperature switch

The driver was tested on Raspberry Pi 4 Model B.

The implemented functionalities of it are: reading a 1shot input value
and changing and reading the overtemperature and undertemperature alarm
and hysteresis values. The read values are raw: signed 16 bit int
format. To obtain the real value one must multiply the value with 0.0625.

Daniel Matyas (2):
dt-bindings: hwmon: add MAX31827
hwmon: max31827: add MAX31827 driver

.../bindings/hwmon/adi,max31827.yaml | 48 ++++
.../devicetree/bindings/trivial-devices.yaml | 2 +
MAINTAINERS | 8 +
drivers/hwmon/Kconfig | 11 +
drivers/hwmon/Makefile | 1 +
drivers/hwmon/max31827.c | 240 ++++++++++++++++++
6 files changed, 310 insertions(+)
create mode 100644 Documentation/devicetree/bindings/hwmon/adi,max31827.yaml
create mode 100644 drivers/hwmon/max31827.c

--
2.34.1


2023-04-06 16:52:05

by Matyas, Daniel

[permalink] [raw]
Subject: [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.

Signed-off-by: Daniel Matyas <[email protected]>
---
.../bindings/hwmon/adi,max31827.yaml | 48 +++++++++++++++++++
.../devicetree/bindings/trivial-devices.yaml | 2 +
MAINTAINERS | 7 +++
3 files changed, 57 insertions(+)
create mode 100644 Documentation/devicetree/bindings/hwmon/adi,max31827.yaml

diff --git a/Documentation/devicetree/bindings/hwmon/adi,max31827.yaml b/Documentation/devicetree/bindings/hwmon/adi,max31827.yaml
new file mode 100644
index 000000000000..b6ed2d46a35d
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwmon/adi,max31827.yaml
@@ -0,0 +1,48 @@
+# 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
+
+ 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>;
+ status = "okay";
+ max31827: max31827@42 {
+ compatible = "adi,max31827";
+ reg = <0x42>;
+ vref-supply = <&reg_vdd>;
+ };
+ };
+...
\ No newline at end of file
diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Documentation/devicetree/bindings/trivial-devices.yaml
index 6f482a254a1d..7763610b97bc 100644
--- a/Documentation/devicetree/bindings/trivial-devices.yaml
+++ b/Documentation/devicetree/bindings/trivial-devices.yaml
@@ -43,6 +43,8 @@ properties:
- adi,adp5589
# Analog Devices LT7182S Dual Channel 6A, 20V PolyPhase Step-Down Silent Switcher
- adi,lt7182s
+ # MAX31827 Low-Power Temperature Switch with I2C interface
+ - adi,max31827
# AMS iAQ-Core VOC Sensor
- ams,iaq-core
# i2c serial eeprom (24cxx)
diff --git a/MAINTAINERS b/MAINTAINERS
index 90abe83c02f3..549cea6bc340 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -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
--
2.34.1

2023-04-06 18:18:28

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH 1/2] dt-bindings: hwmon: add MAX31827


On Thu, 06 Apr 2023 19:43:26 +0300, Daniel Matyas wrote:
> 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 | 48 +++++++++++++++++++
> .../devicetree/bindings/trivial-devices.yaml | 2 +
> MAINTAINERS | 7 +++
> 3 files changed, 57 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/hwmon/adi,max31827.yaml
>

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:
./Documentation/devicetree/bindings/hwmon/adi,max31827.yaml:48:4: [error] no new line character at the end of file (new-line-at-end-of-file)

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/hwmon/adi,max31827.example.dtb: max31827@42: 'vref-supply' does not match any of the regexes: 'pinctrl-[0-9]+'
From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/trivial-devices.yaml

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.

2023-04-06 19:25:20

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 1/2] dt-bindings: hwmon: add MAX31827

On 06/04/2023 18:43, Daniel Matyas wrote:
> 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 | 48 +++++++++++++++++++
> .../devicetree/bindings/trivial-devices.yaml | 2 +
> MAINTAINERS | 7 +++

> 3 files changed, 57 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/hwmon/adi,max31827.yaml
>
> diff --git a/Documentation/devicetree/bindings/hwmon/adi,max31827.yaml b/Documentation/devicetree/bindings/hwmon/adi,max31827.yaml
> new file mode 100644
> index 000000000000..b6ed2d46a35d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/hwmon/adi,max31827.yaml
> @@ -0,0 +1,48 @@
> +# 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

Where are the compatibles? I expect them in such case to be compatible
with this 31827.

> +
> +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

Missing blank line

> +properties:
> + compatible:
> + enum:
> + - 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>;
> + status = "okay";

Drop status

> + max31827: max31827@42 {

Node names should be generic.
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation

Drop also label. You do not use it.


> + compatible = "adi,max31827";
> + reg = <0x42>;
> + vref-supply = <&reg_vdd>;
> + };
> + };
> +...
> \ No newline at end of file

Patch error to fix.

> diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Documentation/devicetree/bindings/trivial-devices.yaml
> index 6f482a254a1d..7763610b97bc 100644
> --- a/Documentation/devicetree/bindings/trivial-devices.yaml
> +++ b/Documentation/devicetree/bindings/trivial-devices.yaml
> @@ -43,6 +43,8 @@ properties:
> - adi,adp5589
> # Analog Devices LT7182S Dual Channel 6A, 20V PolyPhase Step-Down Silent Switcher
> - adi,lt7182s
> + # MAX31827 Low-Power Temperature Switch with I2C interface
> + - adi,max31827

No need for this.

Best regards,
Krzysztof