Skip to content

Commit

Permalink
overlays: Add MAX31856 support to maxtherm overlay
Browse files Browse the repository at this point in the history
Extend the maxtherm overlay with support for the MAX31856.
The driver reads the thermocouple type from a property, which is much
more civilised.

See: raspberrypi/linux#3915

Signed-off-by: Phil Elwell <[email protected]>
Signed-off-by: Fang Yafen <[email protected]>
  • Loading branch information
pelwell authored and Fang Yafen committed Feb 25, 2021
1 parent 2118da9 commit 5cdc27e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 5 deletions.
18 changes: 13 additions & 5 deletions arch/arm/boot/dts/overlays/README
Original file line number Diff line number Diff line change
Expand Up @@ -1666,20 +1666,19 @@ Params: no-sdmode Driver does not manage the state of the DAC's


Name: maxtherm
Info: Configure a MAX6675 or MAX31855 thermocouple as an IIO device.
Info: Configure a MAX6675, MAX31855 or MAX31856 thermocouple as an IIO device.

For devices on spi1 or spi2, the interfaces should be enabled
with one of the spi1-1/2/3cs and/or spi2-1/2/3cs overlays.
The overlay expects to disable the relevant spidev node, so also using
e.g. cs0_spidev=off is unnecessary.

Note: with the 5.7 kernel (and later) there will also be
overlays for MAX31855E, MAX31855J, MAX31855K,
MAX31885N, MAX31855R, MAX31855S and MAX31855T.

Example:
MAX31855 on /dev/spidev0.0
dtoverlay=maxtherm,spi0-0,max31855
MAX31856 using a type J thermocouple on /dev/spidev2.1
dtoverlay=spi2-2cs
dtoverlay=maxtherm,spi2-1,max31856,type_j

Load: dtoverlay=maxtherm,<param>=<val>
Params: spi<n>-<m> Configure device at spi<n>, cs<m>
Expand All @@ -1693,6 +1692,15 @@ Params: spi<n>-<m> Configure device at spi<n>, cs<m>
max31855r Enable support for the MAX31855R
max31855s Enable support for the MAX31855S
max31855t Enable support for the MAX31855T
max31856 Enable support for the MAX31856 (with type K)
type_b Select a type B sensor for max31856
type_e Select a type E sensor for max31856
type_j Select a type J sensor for max31856
type_k Select a type K sensor for max31856
type_n Select a type N sensor for max31856
type_r Select a type R sensor for max31856
type_s Select a type S sensor for max31856
type_t Select a type T sensor for max31856


Name: mbed-dac
Expand Down
20 changes: 20 additions & 0 deletions arch/arm/boot/dts/overlays/maxtherm-overlay.dts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
/dts-v1/;
/plugin/;

#include <dt-bindings/iio/temperature/thermocouple.h>

/ {
compatible = "brcm,bcm2835";

Expand Down Expand Up @@ -128,6 +130,15 @@
};
};

fragment@16 {
target = <&max>;
__dormant__ {
compatible = "maxim,max31856";
spi-cpha;
thermocouple-type = <THERMOCOUPLE_TYPE_K>;
};
};

__overrides__ {
spi0-0 = <0>, "+0",
<&maxfrag>,"target:0=",<&spi0>,
Expand Down Expand Up @@ -162,5 +173,14 @@
max31855r = <0>,"+13";
max31855s = <0>,"+14";
max31855t = <0>,"+15";
max31856 = <0>,"+16";
type_b = <&max>,"thermocouple-type:0=",<THERMOCOUPLE_TYPE_B>;
type_e = <&max>,"thermocouple-type:0=",<THERMOCOUPLE_TYPE_E>;
type_j = <&max>,"thermocouple-type:0=",<THERMOCOUPLE_TYPE_J>;
type_k = <&max>,"thermocouple-type:0=",<THERMOCOUPLE_TYPE_K>;
type_n = <&max>,"thermocouple-type:0=",<THERMOCOUPLE_TYPE_N>;
type_r = <&max>,"thermocouple-type:0=",<THERMOCOUPLE_TYPE_R>;
type_s = <&max>,"thermocouple-type:0=",<THERMOCOUPLE_TYPE_S>;
type_t = <&max>,"thermocouple-type:0=",<THERMOCOUPLE_TYPE_T>;
};
};

0 comments on commit 5cdc27e

Please sign in to comment.