diff options
author | Tang Yuantian <yuantian.tang@freescale.com> | 2013-10-17 02:51:39 (GMT) |
---|---|---|
committer | Rivera Jose-B46482 <German.Rivera@freescale.com> | 2013-10-17 20:31:52 (GMT) |
commit | 3221372d75cd4e905aedbe7adb035f63446b76ef (patch) | |
tree | e7af50de782e5eda97c56f61bb6ae85a78d5aa94 /drivers/hwmon | |
parent | cb05704ace07a3c3ae19f7b01b965548c3ff06d6 (diff) | |
download | linux-fsl-qoriq-3221372d75cd4e905aedbe7adb035f63446b76ef.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>
Change-Id: I6596e57de7e9021a19d16e6060c3c78f83cc81c3
Reviewed-on: http://git.am.freescale.net:8181/4786
Reviewed-by: Hongtao Jia <hongtao.jia@freescale.com>
Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com>
Reviewed-by: Rivera Jose-B46482 <German.Rivera@freescale.com>
Diffstat (limited to 'drivers/hwmon')
-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 8e7158c..0ddfa16 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) |