Skip to content

Commit

Permalink
drivers: hwmon: max31827: add max31875
Browse files Browse the repository at this point in the history
Add support for MAX31875 Low-Power I2C Temperature Sensor in
MAX31827 driver

Signed-off-by: John Erasmus Mari Geronimo <[email protected]>
  • Loading branch information
jemfgeronimo committed Nov 13, 2024
1 parent b5df72b commit 1a82903
Show file tree
Hide file tree
Showing 2 changed files with 354 additions and 79 deletions.
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

0 comments on commit 1a82903

Please sign in to comment.