lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220406092901.408861-1-camel.guo@axis.com>
Date:   Wed, 6 Apr 2022 11:29:01 +0200
From:   Camel Guo <camel.guo@...s.com>
To:     Guenter Roeck <linux@...ck-us.net>,
        Jean Delvare <jdelvare@...e.com>,
        Jonathan Corbet <corbet@....net>
CC:     <kernel@...s.com>, Camel Guo <camelg@...s.com>,
        <linux-hwmon@...r.kernel.org>, <linux-doc@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>
Subject: [PATCH] hwmon: (tmp401) Support extended temperature range

From: Camel Guo <camelg@...s.com>

This patch only applies to tmp431 and devicetree configuration.

Signed-off-by: Camel Guo <camelg@...s.com>
---
 Documentation/hwmon/tmp401.rst | 13 +++++++++++++
 drivers/hwmon/tmp401.c         |  5 +++++
 2 files changed, 18 insertions(+)

diff --git a/Documentation/hwmon/tmp401.rst b/Documentation/hwmon/tmp401.rst
index 3aacf3d3bdf3..d12e9c9ba40f 100644
--- a/Documentation/hwmon/tmp401.rst
+++ b/Documentation/hwmon/tmp401.rst
@@ -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;
+};
diff --git a/drivers/hwmon/tmp401.c b/drivers/hwmon/tmp401.c
index b86d9df7105d..6efd2475ffda 100644
--- a/drivers/hwmon/tmp401.c
+++ b/drivers/hwmon/tmp401.c
@@ -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)
-- 
2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ