diff options
author | Tang Yuantian <yuantian.tang@freescale.com> | 2013-06-19 10:50:20 +0400 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2013-06-27 21:31:42 +0400 |
commit | 31e7ad74f6044ffec112fd4975c07b797589d89c (patch) | |
tree | 220cacb4384d156c3fc723ce043974aecc36e442 /drivers | |
parent | 87438c2c5483a7ab445c14a8855fd309ae79b4e6 (diff) | |
download | linux-31e7ad74f6044ffec112fd4975c07b797589d89c.tar.xz |
hwmon: (ina2xx) Add device tree support to pass the shunt resistor
Adding another way that is device tree to pass the shunt resistor
value to driver except for platform data.
Signed-off-by: Tang Yuantian <Yuantian.Tang@freescale.com>
[Guenter Roeck: Added missing of.h include]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/hwmon/ina2xx.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c index 4958b2f89dce..d917a2d8c30f 100644 --- a/drivers/hwmon/ina2xx.c +++ b/drivers/hwmon/ina2xx.c @@ -34,6 +34,7 @@ #include <linux/hwmon.h> #include <linux/hwmon-sysfs.h> #include <linux/jiffies.h> +#include <linux/of.h> #include <linux/platform_data/ina2xx.h> @@ -221,6 +222,7 @@ static int ina2xx_probe(struct i2c_client *client, struct ina2xx_data *data; struct ina2xx_platform_data *pdata; int ret; + u32 val; long shunt = 10000; /* default shunt value 10mOhms */ if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WORD_DATA)) @@ -234,6 +236,9 @@ static int ina2xx_probe(struct i2c_client *client, pdata = (struct ina2xx_platform_data *)client->dev.platform_data; shunt = pdata->shunt_uohms; + } else if (!of_property_read_u32(client->dev.of_node, + "shunt-resistor", &val)) { + shunt = val; } if (shunt <= 0) |