[PATCH 6/8] hwmon: (lm90) enable the extended temperature range

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Slawomir Stepien <slawomir.stepien@xxxxxxxxx>

Enable the extended temperature range if it was requested from
device-tree node.

Signed-off-by: Slawomir Stepien <slawomir.stepien@xxxxxxxxx>
---
 drivers/hwmon/lm90.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
index f642c6fd1641..67d48707a8d6 100644
--- a/drivers/hwmon/lm90.c
+++ b/drivers/hwmon/lm90.c
@@ -1914,6 +1914,7 @@ static const struct hwmon_ops lm90_ops = {
 static int lm90_probe(struct i2c_client *client)
 {
 	struct device *dev = &client->dev;
+	const struct device_node *np = dev->of_node;
 	struct i2c_adapter *adapter = client->adapter;
 	struct hwmon_channel_info *info;
 	struct regulator *regulator;
@@ -2017,6 +2018,17 @@ static int lm90_probe(struct i2c_client *client)
 	/* Set maximum conversion rate */
 	data->max_convrate = lm90_params[data->kind].max_convrate;
 
+	/* Parse device-tree information */
+	if (np) {
+		if (data->flags & LM90_HAVE_EXTENDED_TEMP) {
+			if (of_property_read_bool(np, "extended-range-enable")) {
+				err = lm90_update_confreg(data, data->config | 0x04);
+				if (err)
+					return err;
+			}
+		}
+	}
+
 	/* Initialize the LM90 chip */
 	err = lm90_init_client(client, data);
 	if (err < 0) {
-- 
2.36.1




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux