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 #2600

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions Documentation/hwmon/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ Hardware Monitoring Kernel Drivers
max31785
max31790
max31827
max31875
max34440
max6620
max6639
Expand Down
99 changes: 99 additions & 0 deletions Documentation/hwmon/max31875.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
.. SPDX-License-Identifier: GPL-2.0

Kernel driver max31875
======================

Supported chips:

* Maxim MAX31875

Prefix: 'max31875'

Addresses scanned: I2C 0x48 - 0x4f

Datasheet: Publicly available at the Analog Devices website


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

Description
-----------

MAX31875 implements a temperature sensor with a 4 WLP packaging scheme. This
sensor measures the temperature of the chip itself.

MAX31875 has 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 status bit have a value of 1 when the
temperature rises above the T_OS value, which is also subject to the Fault Queue
selection. OT status returns to 0 when the temperature drops below the T_HYST
value or when shutdown mode is entered.

In interrupt mode exceeding T_OS also sets OT status to 1, which remains set
until a read operation is performed on any of the registers; at this point, it
returns to 0. Once OT status is set to 1 from exceeding T_OS and reset, it is
set to 1 again only when the temperature drops below T_HYST. The output remains
asserted until it is reset by a read. It is set again if the temperature rises
above T_OS, and so on.

Putting the MAX31875 into shutdown mode also resets the OT status. Note that if
the mode is changed while OT status is set, an OT 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 manual with the one-shot functionality and automatic with
a set frequency. When powered on, the chip measures temperatures with 0.25
conv/s. 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:

- 4000 (ms) = 0.25 conv/sec (default)
- 1000 (ms) = 1 conv/sec
- 250 (ms) = 4 conv/sec
- 125 (ms) = 8 conv/sec

Enabling the device when it is already enabled has the side effect of setting
the conversion frequency to 0.25 conv/s. The conversion time varies depending on
the resolution.

The conversion time doubles with every bit of increased resolution. The
available resolutions are:

- 8 bit -> 8.75 ms conversion time
- 9 bit -> 17.5 ms conversion time
- 10 bit (default) -> 35 ms conversion time
- 12 bit -> 140 ms conversion time
- 13 bit (extended) -> 280 ms conversion time

There is a temp1_resolution attribute which indicates the unit change in the
input temperature in milli-degrees C. In extended format, the MSB is given a
value of 128 degrees C (compared to normal format: 64 degrees C), which allows
temperatures as high as 150 degrees C to be measured.

- 1000 mC -> 8 bit
- 500 mC -> 9 bit
- 250 mC -> 10 bit (default)
- 62 mC -> 12 bit - actually this is 62.5, but the file returns 62
- 62 mC -> 13 bit (extended) - actually this is 62.5, but the file 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
the temperature value register read. Note that the conversion times are rounded
up to the nearest possible integer.

The LSB of the temperature values is 0.0625 degrees Celsius, but the values of
the temperatures are displayed in milli-degrees. This means, that some data is
lost. The step between 2 consecutive values is 62 or 63. This effect can be seen
in the writing of alarm values too. For positive numbers the user-input value
will always be rounded down to the nearest possible value, for negative numbers
the user-input will always be rounded up to the nearest possible value.

Bus timeout resets the I2C-compatible interface when SCL is low for more than
30ms (nominal).

The Fault Queue bits select how many consecutive temperature faults must occur
before overtemperature fault is indicated in the OT status bit.
2 changes: 2 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -12602,6 +12602,8 @@ L: [email protected]
S: Supported
W: http://ez.analog.com/community/linux-device-drivers
F: Documentation/devicetree/bindings/hwmon/adi,max31875.yaml
F: Documentation/hwmon/max31875.rst
F: drivers/hwmon/max31875.c

MAX31335 RTC DRIVER
M: Antoniu Miclaus <[email protected]>
Expand Down
11 changes: 11 additions & 0 deletions drivers/hwmon/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1102,6 +1102,17 @@ config MAX31827
This driver can also be built as a module. If so, the module
will be called max31827.

config SENSORS_MAX31875
tristate "MAX31875 low-power I2C temperature sensor"
depends on I2C
help
If you say yes here you get support for MAX31875 temperature sensor.
The MAX31875 is a +-1 degree C-accurate local temperature sensor with
I2C/SMBus interface.

This driver can also be built as a module. If so, the module
will be called max31875.

config SENSORS_MAX6620
tristate "Maxim MAX6620 fan controller"
depends on I2C
Expand Down
1 change: 1 addition & 0 deletions drivers/hwmon/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ 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_MAX31875) += max31875.o
obj-$(CONFIG_SENSORS_MC13783_ADC)+= mc13783-adc.o
obj-$(CONFIG_SENSORS_MCP3021) += mcp3021.o
obj-$(CONFIG_SENSORS_TC654) += tc654.o
Expand Down
Loading