overlays: Add MAX31856 support to maxtherm overlay
authorPhil Elwell <phil@raspberrypi.com>
Thu, 22 Oct 2020 16:11:12 +0000 (17:11 +0100)
committerpopcornmix <popcornmix@gmail.com>
Wed, 27 Jan 2021 19:13:24 +0000 (19:13 +0000)
Extend the maxtherm overlay with support for the MAX31856.
The driver reads the thermocouple type from a property, which is much
more civilised.

See: https://github.com/raspberrypi/linux/issues/3915

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
arch/arm/boot/dts/overlays/README
arch/arm/boot/dts/overlays/maxtherm-overlay.dts

index 33727b4..c373b91 100644 (file)
@@ -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>
@@ -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
index 34d5727..9964e24 100644 (file)
@@ -5,6 +5,8 @@
 /dts-v1/;
 /plugin/;
 
+#include <dt-bindings/iio/temperature/thermocouple.h>
+
 / {
        compatible = "brcm,bcm2835";
 
                };
        };
 
+       fragment@16 {
+               target = <&max>;
+               __dormant__ {
+                       compatible = "maxim,max31856";
+                       spi-cpha;
+                       thermocouple-type = <THERMOCOUPLE_TYPE_K>;
+               };
+       };
+
        __overrides__ {
                spi0-0 = <0>, "+0",
                         <&maxfrag>,"target:0=",<&spi0>,
                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>;
        };
 };