Fwd: [PATCH 1/2] hwmon: (lm75) Add support for TMP75B

From: Iker Perez del Palomar
Date: Tue Apr 23 2019 - 06:11:36 EST


The TMP75B has a different control register, supports 12-bit
resolution and the default conversion rate is 37 Hz.

Signed-off-by: Iker Perez del Palomar Sustatxa <iker.perez@xxxxxxxxxxxxxxx>
---
ÂDocumentation/hwmon/lm75 |Â 5 +++--
Âdrivers/hwmon/lm75.cÂÂÂÂ | 13 +++++++++++++
Â2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/Documentation/hwmon/lm75 b/Documentation/hwmon/lm75
index 010583608f12..baf052935761 100644
--- a/Documentation/hwmon/lm75
+++ b/Documentation/hwmon/lm75
@@ -47,8 +47,8 @@ Supported chips:
ÂÂÂÂ Addresses scanned: none
ÂÂÂÂ Datasheet: Publicly available at the ST website
ÂÂÂÂ ÂÂÂÂÂÂ https://www.st.com/resource/en/datasheet/stlm75.pdf
-Â * Texas Instruments TMP100, TMP101, TMP105, TMP112, TMP75, TMP75C, TMP175, TMP275
-ÂÂÂ Prefixes: 'tmp100', 'tmp101', 'tmp105', 'tmp112', 'tmp175', 'tmp75', 'tmp75c', 'tmp275'
+Â * Texas Instruments TMP100, TMP101, TMP105, TMP112, TMP75, TMP75B, TMP75C, TMP175, TMP275
+ÂÂÂ Prefixes: 'tmp100', 'tmp101', 'tmp105', 'tmp112', 'tmp175', 'tmp75', 'tmp75b', 'tmp75c', 'tmp275'
ÂÂÂÂ Addresses scanned: none
ÂÂÂÂ Datasheet: Publicly available at the Texas Instruments website
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ http://www.ti.com/product/tmp100
@@ -56,6 +56,7 @@ Supported chips:
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ http://www.ti.com/product/tmp105
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ http://www.ti.com/product/tmp112
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ http://www.ti.com/product/tmp75
+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂ http://www.ti.com/product/tmp75b
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ http://www.ti.com/product/tmp75c
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ http://www.ti.com/product/tmp175
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ http://www.ti.com/product/tmp275
diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c
index 62acb9f16ec5..1b5c32cbdc62 100644
--- a/drivers/hwmon/lm75.c
+++ b/drivers/hwmon/lm75.c
@@ -32,6 +32,7 @@
Â#include "lm75.h"


+
Â/*
 * This driver handles the LM75 and compatible digital temperature sensors.
 */
@@ -59,6 +60,7 @@ enum lm75_type {ÂÂÂ ÂÂÂ /* keep sorted in alphabetical order */
ÂÂÂÂ tmp175,
ÂÂÂÂ tmp275,
ÂÂÂÂ tmp75,
+ÂÂÂ tmp75b,
ÂÂÂÂ tmp75c,
Â};

@@ -378,6 +380,12 @@ lm75_probe(struct i2c_client *client, const struct i2c_device_id *id)
ÂÂÂÂ ÂÂÂ data->resolution = 12;
ÂÂÂÂ ÂÂÂ data->sample_time = MSEC_PER_SEC / 2;
ÂÂÂÂ ÂÂÂ break;
+ÂÂÂ case tmp75b:
+ÂÂÂ ÂÂÂ clr_mask |= 1 << 15;ÂÂÂ ÂÂÂ /* not one-shot mode */
+ÂÂÂ ÂÂÂ data->resolution = 12;
+ÂÂÂ ÂÂÂ data->sample_time = MSEC_PER_SEC / 32;
+ÂÂÂ ÂÂÂ break;
+
ÂÂÂÂ case tmp75c:
ÂÂÂÂ ÂÂÂ clr_mask |= 1 << 5;ÂÂÂ ÂÂÂ /* not one-shot mode */
ÂÂÂÂ ÂÂÂ data->resolution = 12;
@@ -438,6 +446,7 @@ static const struct i2c_device_id lm75_ids[] = {
ÂÂÂÂ { "tmp175", tmp175, },
ÂÂÂÂ { "tmp275", tmp275, },
ÂÂÂÂ { "tmp75", tmp75, },
+ÂÂÂ { "tmp75b", tmp75b,},
ÂÂÂÂ { "tmp75c", tmp75c, },
ÂÂÂÂ { /* LIST END */ }
Â};
@@ -537,6 +546,10 @@ static const struct of_device_id lm75_of_match[] = {
ÂÂÂÂ ÂÂÂ .data = (void *)tmp75
ÂÂÂÂ },
ÂÂÂÂ {
+ÂÂÂ ÂÂÂ .compatible = "ti,tmp75b",
+ÂÂÂ ÂÂÂ .data = (void *)tmp75b
+ÂÂÂ },
+ÂÂÂ {
ÂÂÂÂ ÂÂÂ .compatible = "ti,tmp75c",
ÂÂÂÂ ÂÂÂ .data = (void *)tmp75c
ÂÂÂÂ },

--
2.11.0

--
Iker Perez del Palomar, Software Engineer
Codethink Ltd 35 Dale St, Manchester M1 2HF
http://www.codethink.co.uk/ Manchester, M1 2JW, United Kingdom
We respect your privacy. See https://www.codethink.co.uk/privacy.html