Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for MAX31875 #2635

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions Documentation/devicetree/bindings/hwmon/adi,max31827.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,19 @@
$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
title: Analog Devices MAX31827, MAX31828, MAX31829, MAX31875 Low-Power Temperature Switch

maintainers:
- Daniel Matyas <daniel.matyas@analog.com>
- John Erasmus Mari Geronimo <johnerasmusmari.geronimo@analog.com>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should mention this change in the commit message. You'll likely be asked why if we can have a fallback device for this one (one of the devices that the driver already supports). So you should also mention in the commit message why that is not possible.

Also speaking about the commit message, you're only stating the obvious there :). Give a small description of the HW.


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

Analog Devices MAX31875 Low-Power I2C Temperature Sensor in WLP Package
https://www.analog.com/media/en/technical-documentation/data-sheets/MAX31875.pdf

properties:
compatible:
oneOf:
Expand All @@ -22,6 +25,7 @@ properties:
- enum:
- adi,max31828
- adi,max31829
- adi,max31875
- const: adi,max31827

reg:
Expand Down Expand Up @@ -93,6 +97,16 @@ allOf:
adi,fault-q:
default: 4

- if:
properties:
compatible:
contains:
const: adi,max31875

then:
properties:
adi,fault-q:
enum: [1, 2, 4, 6]

required:
- compatible
Expand Down
40 changes: 30 additions & 10 deletions Documentation/hwmon/max31827.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,18 @@ Supported chips:

Datasheet: Publicly available at the Analog Devices website

* Maxim MAX31875

Prefix: 'max31875'

Addresses scanned: I2C 0x48 - 0x4f

Datasheet: Publicly available at the Analog Devices website


Authors:
- Daniel Matyas <[email protected]>
- John Erasmus Mari Geronimo <[email protected]>

Description
-----------
Expand All @@ -45,13 +54,20 @@ 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 implements a temperature sensor with a 6 WLP packaging scheme. This
sensor measures the temperature of the chip itself.
This driver also supports the MAX31875. Its fault queue is set to 1 and it has
no alarm polarity.

MAX31827 implements a temperature sensor with a 6 WLP packaging scheme while
MAX31875 has a 4 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.

MAX31875 has only an over temperature alarm with an effective value and a
hysteresis value: +80 and +75 degrees.

The alarm can be configured in comparator and interrupt mode from the
devicetree. 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
Expand All @@ -75,19 +91,22 @@ 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 manual with the one-shot functionality and automatic with
a set frequency. When powered on, the chip measures temperatures with 1 conv/s.
a set frequency. When powered on, the MAX31827 measures temperatures with 1
conv/s while the MAX31875 measures temperatures with 0.25 conv/s or 1 conv/4s.
The conversion rate can be modified with update_interval attribute of the chip.
Conversion/second = 1/update_interval. Thus, the available options according to
the data sheet are:

- 64000 (ms) = 1 conv/64 sec
- 32000 (ms) = 1 conv/32 sec
- 16000 (ms) = 1 conv/16 sec
- 4000 (ms) = 1 conv/4 sec
- 1000 (ms) = 1 conv/sec (default)
- 4000 (ms) = 1 conv/4 sec (MAX31875 default)
- 1000 (ms) = 1 conv/sec (MAX31827 default)
- 250 (ms) = 4 conv/sec
- 125 (ms) = 8 conv/sec

The MAX31875 only supports the last four values above.

Enabling the device when it is already enabled has the side effect of setting
the conversion frequency to 1 conv/s. The conversion time varies depending on
the resolution.
Expand All @@ -97,16 +116,16 @@ available resolutions are:

- 8 bit -> 8.75 ms conversion time
- 9 bit -> 17.5 ms conversion time
- 10 bit -> 35 ms conversion time
- 12 bit (default) -> 140 ms conversion time
- 10 bit (MAX31875 default) -> 35 ms conversion time
- 12 bit (MAX31827 default) -> 140 ms conversion time

There is a temp1_resolution attribute which indicates the unit change in the
input temperature in milli-degrees C.

- 1000 mC -> 8 bit
- 500 mC -> 9 bit
- 250 mC -> 10 bit
- 62 mC -> 12 bit (default) - actually this is 62.5, but the fil returns 62
- 250 mC -> 10 bit (MAX31875 default)
- 62 mC -> 12 bit (MAX31827 default) - actually this is 62.5, but the fil returns 62

When chip is in shutdown mode and a read operation is requested, one-shot is
triggered, the device waits for <conversion time> ms, and only after that is
Expand All @@ -125,7 +144,8 @@ Bus timeout resets the I2C-compatible interface when SCL is low for more than

Alarm polarity determines if the active state of the alarm is low or high. The
behavior for both settings is dependent on the Fault Queue setting. The ALARM
pin is an open-drain output and requires a pullup resistor to operate.
pin is an open-drain output and requires a pullup resistor to operate. The
MAX31875 does not have this feature.

The Fault Queue bits select how many consecutive temperature faults must occur
before overtemperature or undertemperature faults are indicated in the
Expand Down
Loading