-
Notifications
You must be signed in to change notification settings - Fork 878
Add support for MAX31875 #2600
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
Closed
Closed
Add support for MAX31875 #2600
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) | ||
# Copyright 2024 Analog Devices Inc. | ||
%YAML 1.2 | ||
--- | ||
$id: http://devicetree.org/schemas/hwmon/adi,max31875.yaml# | ||
$schema: http://devicetree.org/meta-schemas/core.yaml# | ||
|
||
title: Analog Devices MAX31875 Low-Power I2C Temperature Sensor | ||
|
||
maintainers: | ||
- John Erasmus Mari Geronimo <[email protected]> | ||
|
||
description: | | ||
The MAX31875 is a ±1°C-accurate local temperature sensor with I2C/SMBus | ||
interface. The combination of tiny package and excellent temperature | ||
measurement accuracy makes this product ideal for a variety of equipment. | ||
https://www.analog.com/media/en/technical-documentation/data-sheets/MAX31875.pdf | ||
|
||
properties: | ||
compatible: | ||
enum: | ||
- adi,max31875 | ||
|
||
reg: | ||
maxItems: 1 | ||
|
||
vdd-supply: | ||
description: | ||
Must have values in the interval (1.6V; 3.6V) in order for the device to | ||
function correctly. Must also have regulator-name of "vref". | ||
|
||
adi,extended-format: | ||
description: | ||
If present, the temperature register is read in extended format. If not | ||
present, the temperature register is read in normal format (default). | ||
type: boolean | ||
|
||
adi,comp-int: | ||
description: | ||
If present, the Overtemperature Status bit operates in interrupt mode. If | ||
not present, it operates in comparator mode (default). | ||
type: boolean | ||
|
||
adi,timeout-disable: | ||
description: | ||
Disables timeout. Bus timeout resets the I2C-compatible interface when SCL | ||
is low for more than 30ms (nominal). | ||
type: boolean | ||
|
||
adi,fault-q: | ||
description: | ||
Select how many consecutive overtemperature faults must occur before an | ||
overtemperature fault is indicated in the Overtemperature Status bit. | ||
$ref: /schemas/types.yaml#/definitions/uint32 | ||
enum: [1, 2, 4, 6] | ||
|
||
required: | ||
- compatible | ||
- reg | ||
- vdd-supply | ||
|
||
additionalProperties: false | ||
|
||
examples: | ||
- | | ||
i2c { | ||
#address-cells = <1>; | ||
#size-cells = <0>; | ||
status = "okay"; | ||
|
||
temperature-sensor@48 { | ||
compatible = "adi,max31875"; | ||
reg = <0x48>; | ||
vdd-supply = <&vdd>; | ||
|
||
adi,extended-format; | ||
adi,comp-int; | ||
adi,timeout-disable; | ||
adi,fault-q = <1>; | ||
}; | ||
}; | ||
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -138,6 +138,7 @@ Hardware Monitoring Kernel Drivers | |
max31785 | ||
max31790 | ||
max31827 | ||
max31875 | ||
max34440 | ||
max6620 | ||
max6639 | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12596,6 +12596,15 @@ F: Documentation/devicetree/bindings/hwmon/adi,max31827.yaml | |
F: Documentation/hwmon/max31827.rst | ||
F: drivers/hwmon/max31827.c | ||
|
||
MAX31875 TEMPERATURE SENSOR DRIVER | ||
M: John Erasmus Mari Geronimo <[email protected]> | ||
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]> | ||
L: [email protected] | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.