Skip to contentSkip to conversation

Support for TMP75B temperature sensor

PATCH In review Iker Perez 2 participants 4 messages May 3, 2019

Subsystems (3)
lore
Share & tools
lore

Iker Perez

author
#0 lore raw

v4 cover Support for TMP75B temperature sensor

From: Iker Perez del Palomar Sustatxa <[email protected]>

This patch series adds support for the TMP75 temperature sensor to the lm75.c driver. Although the TMP75B has a configurable conversion rate, this series just sets it to the default rate of 37Hz. Sample rate is set close to this.

In the future, I want to develop a function that allows the user choose the preferred conversion rate from user-land.

Iker Perez del Palomar Sustatxa (2):
hwmon: (lm75) Add support for TMP75B
dt-bindings: hwmon: Add tmp75b to lm75.txt

 Documentation/devicetree/bindings/hwmon/lm75.txt |  1 +
 Documentation/hwmon/lm75                         |  7 +++++--
 drivers/hwmon/lm75.c                             | 11 +++++++++++
 3 files changed, 17 insertions(+), 2 deletions(-)
Signature · 1 line
2.11.0
author
#1 lore raw

PATCH v4 1/2 hwmon: (lm75) Add support for TMP75B

From: Iker Perez del Palomar Sustatxa <[email protected]>

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

---
 Documentation/hwmon/lm75 |  7 +++++--
 drivers/hwmon/lm75.c     | 11 +++++++++++
 2 files changed, 16 insertions(+), 2 deletions(-)

Version log:

- v4:
- Correct the sample time to 37 ms.
- v3:
- Bad assignment, missing spaces before and after "=".
- Divide in two lines longer than 80 characters.
- Separate dt-bindings and driver-documentation into different commits.
- V2:
- Delete empty lines.
- Restore replaced tabs by spaces

Documentation/hwmon/lm75 +5 -2
index 010583608f12..0cff924cdbba 100644
@@ -47,8 +47,10 @@ 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 +58,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
drivers/hwmon/lm75.c +11 -0
index 447af07450f1..5673fa541f16 100644
@@ -59,6 +59,7 @@ enum lm75_type {		/* keep sorted in alphabetical order */
 	tmp175,
 	tmp275,
 	tmp75,
+	tmp75b,
 	tmp75c,
 };
 
@@ -378,6 +379,11 @@ 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:  /* not one-shot mode, Conversion rate 37Hz */
+		clr_mask |= 1 << 15 | 0x3 << 13;
+		data->resolution = 12;
+		data->sample_time = MSEC_PER_SEC / 37;
+		break;
 	case tmp75c:
 		clr_mask |= 1 << 5;		/* not one-shot mode */
 		data->resolution = 12;
@@ -438,6 +444,7 @@ static const struct i2c_device_id lm75_ids[] = {
 	{ "tmp175", tmp175, },
 	{ "tmp275", tmp275, },
 	{ "tmp75", tmp75, },
+	{ "tmp75b", tmp75b, },
 	{ "tmp75c", tmp75c, },
 	{ /* LIST END */ }
 };
@@ -537,6 +544,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
 	},
Signature · 1 line
2.11.0
author
#2 lore raw

PATCH v4 2/2 dt-bindings: hwmon: Add tmp75b to lm75.txt

In reply to Iker Perez

From: Iker Perez del Palomar Sustatxa <[email protected]>

Update the LM75's devicetree definition to allow Texas Instruments TMP75B be probed.

---
 Documentation/devicetree/bindings/hwmon/lm75.txt | 1 +
 1 file changed, 1 insertion(+)

Version log:

- V4:
- Improve the commit description message.
- V3:
- Separate dt-bindings and driver-documentation into different commits.

Documentation/devicetree/bindings/hwmon/lm75.txt +1 -0
index 12d8cf7cf592..586b5ed70be7 100644
@@ -25,6 +25,7 @@ Required properties:
 		"ti,tmp175",
 		"ti,tmp275",
 		"ti,tmp75",
+		"ti,tmp75b",
 		"ti,tmp75c",
 
 - reg: I2C bus address of the device
Signature · 1 line
2.11.0
maintainer
#3 lore raw
In reply to Iker Perez
Quoted 7 lines · Iker Perez

From: Iker Perez del Palomar Sustatxa <[email protected]>

This patch series adds support for the TMP75 temperature sensor to the lm75.c driver. Although the TMP75B has a configurable conversion rate, this series just sets it to the default rate of 37Hz. Sample rate is set close to this.

Quoted 8 lines

In the future, I want to develop a function that allows the user choose the preferred conversion rate from user-land.

Iker Perez del Palomar Sustatxa (2):
hwmon: (lm75) Add support for TMP75B
dt-bindings: hwmon: Add tmp75b to lm75.txt

Series applied to hwmon-next.

Thanks,
Guenter