Skip to contentSkip to conversation

hwmon: (tmp401) Support extended temperature range

PATCH In review Camel Guo 2 participants 3 messages Apr 6, 2022

Subsystems (2)
lore
Share & tools
lore

Camel Guo

author
#0 lore raw

PATCH 1/1 hwmon: (tmp401) Support extended temperature range

From: Camel Guo <[email protected]>

This patch only applies to tmp431 and devicetree configuration.

---
 Documentation/hwmon/tmp401.rst | 13 +++++++++++++
 drivers/hwmon/tmp401.c         |  5 +++++
 2 files changed, 18 insertions(+)
Documentation/hwmon/tmp401.rst +13 -0
index 3aacf3d3bdf3..d12e9c9ba40f 100644
@@ -78,3 +78,16 @@ some additional features.
 
 TMP432 is compatible with TMP401 and TMP431. It supports two external
 temperature sensors.
+
+Device tree
+-----------
+TMP431 has support for the device tree parameter "extended-range" which enables
+the extended range in the chip.
+
+Example:
+
+main-temp@4c {
+  compatible = "ti,tmp431";
+  reg = <0x4c>;
+  extended-range;
+};
drivers/hwmon/tmp401.c +5 -0
index b86d9df7105d..6efd2475ffda 100644
@@ -557,6 +557,11 @@ static int tmp401_init_client(struct tmp401_data *data)
 	config_orig = config;
 	config &= ~TMP401_CONFIG_SHUTDOWN;
 
+	if (of_property_read_bool(data->client->dev.of_node, "extended-range")) {
+		/* Enable extended range */
+		config |= TMP401_CONFIG_RANGE;
+	}
+
 	data->extended_range = !!(config & TMP401_CONFIG_RANGE);
 
 	if (config != config_orig)
Signature · 1 line
2.30.2
maintainer
#1 lore raw
Quoted 15 lines · Camel Guo

From: Camel Guo <[email protected]>

This patch only applies to tmp431 and devicetree configuration.

---
  Documentation/hwmon/tmp401.rst | 13 +++++++++++++
  drivers/hwmon/tmp401.c         |  5 +++++
  2 files changed, 18 insertions(+)
Documentation/hwmon/tmp401.rst +0 -0
index 3aacf3d3bdf3..d12e9c9ba40f 100644

Documentation/hwmon/tmp401.rst some additional features. · line 86

Quoted 9 lines
Documentation/hwmon/tmp401.rst +6 -0
@@ -78,3 +78,16 @@ some additional features.
 
  TMP432 is compatible with TMP401 and TMP431. It supports two external
  temperature sensors.
+
+Device tree
+-----------
+TMP431 has support for the device tree parameter "extended-range" which enables
+the extended range in the chip.
+

There is no practical reason to limit support for this to TMP431, nor does the actual code make such a distinction.

Documentation/hwmon/tmp401.rst some additional features. · line 93

Quoted 7 lines
Documentation/hwmon/tmp401.rst +7 -0
+Example:
+
+main-temp@4c {
+  compatible = "ti,tmp431";
+  reg = <0x4c>;
+  extended-range;
+};

This is not an acceptable way to describe devicetree properties. You would have to write a bindings document (Documentation/devicetree/bindings/hwmon/ti,tmp401.yaml) and describe the property there.

Guenter

Quoted 16 lines
drivers/hwmon/tmp401.c +5 -0
index b86d9df7105d..6efd2475ffda 100644
@@ -557,6 +557,11 @@ static int tmp401_init_client(struct tmp401_data *data)
  	config_orig = config;
  	config &= ~TMP401_CONFIG_SHUTDOWN;
 
+	if (of_property_read_bool(data->client->dev.of_node, "extended-range")) {
+		/* Enable extended range */
+		config |= TMP401_CONFIG_RANGE;
+	}
+
  	data->extended_range = !!(config & TMP401_CONFIG_RANGE);
 
  	if (config != config_orig)
maintainer
#2 lore raw
Quoted 28 lines · Guenter Roeck
Quoted 17 lines · Camel Guo

From: Camel Guo <[email protected]>

This patch only applies to tmp431 and devicetree configuration.

---
  Documentation/hwmon/tmp401.rst | 13 +++++++++++++ drivers/hwmon/tmp401.c         |  5 +++++

  2 files changed, 18 insertions(+)
Documentation/hwmon/tmp401.rst +0 -0
index 3aacf3d3bdf3..d12e9c9ba40f 100644
@@ -78,3 +78,16 @@ some additional features.

  TMP432 is compatible with TMP401 and TMP431. It supports two external temperature sensors.

Documentation/hwmon/tmp401.rst some additional features. · line 86

Quoted 6 lines
Documentation/hwmon/tmp401.rst +6 -0
+
+Device tree
+-----------
+TMP431 has support for the device tree parameter "extended-range" which enables
+the extended range in the chip.
+

There is no practical reason to limit support for this to TMP431, nor does the actual code make such a distinction.

Quoted 13 lines

Documentation/hwmon/tmp401.rst some additional features. · line 93

Quoted 7 lines
Documentation/hwmon/tmp401.rst +7 -0
+Example:
+
+main-temp@4c {
+  compatible = "ti,tmp431";
+  reg = <0x4c>;
+  extended-range;
+};

This is not an acceptable way to describe devicetree properties. You would have to write a bindings document (Documentation/devicetree/bindings/hwmon/ti,tmp401.yaml) and describe the property there.

... and that should be modeled after ti,tmp421.yaml and also support other configuration parameters, specifically beta compensation and n-factor correction.

Guenter