summaryrefslogtreecommitdiff
path: root/drivers/hwmon/lm90.c
diff options
context:
space:
mode:
authorHolger Brunck <holger.brunck@hitachienergy.com>2022-05-17 16:56:14 +0300
committerGuenter Roeck <linux@roeck-us.net>2022-05-22 21:32:32 +0300
commit45988d907859b8e6c620c7b8742f65f5b1fbb565 (patch)
tree47ca39eb3e1761deeb4f0293dd61bb4442f71fcc /drivers/hwmon/lm90.c
parent8dd248fa00db2b0145de95a7ef2b50b8fa71e1b0 (diff)
downloadlinux-45988d907859b8e6c620c7b8742f65f5b1fbb565.tar.xz
hwmon: (lm90) enable extended range according to DTS node
Some lm90 compatible devices can operate in an extended temperature mode. This feature is now enabled if the property is set in the corresponding device tree node. Signed-off-by: Holger Brunck <holger.brunck@hitachienergy.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20220517135614.8185-2-holger.brunck@hitachienergy.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/lm90.c')
-rw-r--r--drivers/hwmon/lm90.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
index 1c9493c70813..3820f0e61510 100644
--- a/drivers/hwmon/lm90.c
+++ b/drivers/hwmon/lm90.c
@@ -1707,6 +1707,7 @@ static void lm90_restore_conf(void *_data)
static int lm90_init_client(struct i2c_client *client, struct lm90_data *data)
{
+ struct device_node *np = client->dev.of_node;
int config, convrate;
convrate = lm90_read_reg(client, LM90_REG_R_CONVRATE);
@@ -1727,6 +1728,9 @@ static int lm90_init_client(struct i2c_client *client, struct lm90_data *data)
/* Check Temperature Range Select */
if (data->flags & LM90_HAVE_EXTENDED_TEMP) {
+ if (of_property_read_bool(np, "ti,extended-range-enable"))
+ config |= 0x04;
+
if (config & 0x04)
data->flags |= LM90_FLAG_ADT7461_EXT;
}