hwmon: (lm70) Add support for TI TMP122/124
authorFlorian Fainelli <f.fainelli@gmail.com>
Sat, 21 Jan 2017 19:20:10 +0000 (11:20 -0800)
committerGuenter Roeck <linux@roeck-us.net>
Sat, 21 Jan 2017 20:26:38 +0000 (12:26 -0800)
Add support for Texas Instruments TMP122/124 which are nearly identical to
their TMP121/123 except that they also support programmable temperature
thresholds.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Documentation/devicetree/bindings/hwmon/lm70.txt
Documentation/hwmon/lm70
drivers/hwmon/lm70.c

index e7fd921aa4f1a93f1ccbc8d658ddc9ab30625953..ea417a0d32af52adf5bd2ee63b3ee3060ae10c96 100644 (file)
@@ -4,6 +4,7 @@ Required properties:
 - compatible: one of
                "ti,lm70"
                "ti,tmp121"
+               "ti,tmp122"
                "ti,lm71"
                "ti,lm74"
 
index 1bb2db4406717ec02f4033553fd7df6c16d2951a..c3a1f2ea017d5b3112c99a0a3b55d38693645398 100644 (file)
@@ -6,6 +6,8 @@ Supported chips:
     Datasheet: http://www.national.com/pf/LM/LM70.html
   * Texas Instruments TMP121/TMP123
     Information: http://focus.ti.com/docs/prod/folders/print/tmp121.html
+  * Texas Instruments TMP122/TMP124
+    Information: http://www.ti.com/product/tmp122
   * National Semiconductor LM71
     Datasheet: http://www.ti.com/product/LM71
   * National Semiconductor LM74
@@ -35,8 +37,10 @@ As a real (in-tree) example of this "SPI protocol driver" interfacing
 with a "SPI master controller driver", see drivers/spi/spi_lm70llp.c
 and its associated documentation.
 
-The LM74 and TMP121/TMP123 are very similar; main difference is 13-bit
-temperature data (0.0625 degrees celsius resolution).
+The LM74 and TMP121/TMP122/TMP123/TMP124 are very similar; main difference is
+13-bit temperature data (0.0625 degrees celsius resolution).
+
+The TMP122/TMP124 also feature configurable temperature thresholds.
 
 The LM71 is also very similar; main difference is 14-bit temperature
 data (0.03125 degrees celsius resolution).
index 52c5cdd00448572f0806c0b98db5cc723cc04d24..543556dc563b870f5dc0e11a8418052d601e07d7 100644 (file)
@@ -46,6 +46,7 @@
 #define LM70_CHIP_TMP121       1       /* TI TMP121/TMP123 */
 #define LM70_CHIP_LM71         2       /* NS LM71 */
 #define LM70_CHIP_LM74         3       /* NS LM74 */
+#define LM70_CHIP_TMP122       4       /* TI TMP122/TMP124 */
 
 struct lm70 {
        struct spi_device *spi;
@@ -92,7 +93,7 @@ static ssize_t temp1_input_show(struct device *dev,
         * Celsius.
         * So it's equivalent to multiplying by 0.25 * 1000 = 250.
         *
-        * LM74 and TMP121/TMP123:
+        * LM74 and TMP121/TMP122/TMP123/TMP124:
         * 13 bits of 2's complement data, discard LSB 3 bits,
         * resolution 0.0625 degrees celsius.
         *
@@ -106,6 +107,7 @@ static ssize_t temp1_input_show(struct device *dev,
                break;
 
        case LM70_CHIP_TMP121:
+       case LM70_CHIP_TMP122:
        case LM70_CHIP_LM74:
                val = ((int)raw / 8) * 625 / 10;
                break;
@@ -142,6 +144,10 @@ static const struct of_device_id lm70_of_ids[] = {
                .compatible = "ti,tmp121",
                .data = (void *) LM70_CHIP_TMP121,
        },
+       {
+               .compatible = "ti,tmp122",
+               .data = (void *) LM70_CHIP_TMP122,
+       },
        {
                .compatible = "ti,lm71",
                .data = (void *) LM70_CHIP_LM71,
@@ -191,6 +197,7 @@ static int lm70_probe(struct spi_device *spi)
 static const struct spi_device_id lm70_ids[] = {
        { "lm70",   LM70_CHIP_LM70 },
        { "tmp121", LM70_CHIP_TMP121 },
+       { "tmp122", LM70_CHIP_TMP122 },
        { "lm71",   LM70_CHIP_LM71 },
        { "lm74",   LM70_CHIP_LM74 },
        { },