提交 3ad86700 编写于 作者: L Lothar Felten 提交者: Guenter Roeck

hwmon: (ina2xx) fix sysfs shunt resistor read access

fix the sysfs shunt resistor read access: return the shunt resistor
value, not the calibration register contents.

update email address
Signed-off-by: NLothar Felten <lothar.felten@gmail.com>
Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
上级 5b394b2d
...@@ -32,7 +32,7 @@ Supported chips: ...@@ -32,7 +32,7 @@ Supported chips:
Datasheet: Publicly available at the Texas Instruments website Datasheet: Publicly available at the Texas Instruments website
http://www.ti.com/ http://www.ti.com/
Author: Lothar Felten <l-felten@ti.com> Author: Lothar Felten <lothar.felten@gmail.com>
Description Description
----------- -----------
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* Bi-directional Current/Power Monitor with I2C Interface * Bi-directional Current/Power Monitor with I2C Interface
* Datasheet: http://www.ti.com/product/ina230 * Datasheet: http://www.ti.com/product/ina230
* *
* Copyright (C) 2012 Lothar Felten <l-felten@ti.com> * Copyright (C) 2012 Lothar Felten <lothar.felten@gmail.com>
* Thanks to Jan Volkering * Thanks to Jan Volkering
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -329,6 +329,15 @@ static int ina2xx_set_shunt(struct ina2xx_data *data, long val) ...@@ -329,6 +329,15 @@ static int ina2xx_set_shunt(struct ina2xx_data *data, long val)
return 0; return 0;
} }
static ssize_t ina2xx_show_shunt(struct device *dev,
struct device_attribute *da,
char *buf)
{
struct ina2xx_data *data = dev_get_drvdata(dev);
return snprintf(buf, PAGE_SIZE, "%li\n", data->rshunt);
}
static ssize_t ina2xx_store_shunt(struct device *dev, static ssize_t ina2xx_store_shunt(struct device *dev,
struct device_attribute *da, struct device_attribute *da,
const char *buf, size_t count) const char *buf, size_t count)
...@@ -403,7 +412,7 @@ static SENSOR_DEVICE_ATTR(power1_input, S_IRUGO, ina2xx_show_value, NULL, ...@@ -403,7 +412,7 @@ static SENSOR_DEVICE_ATTR(power1_input, S_IRUGO, ina2xx_show_value, NULL,
/* shunt resistance */ /* shunt resistance */
static SENSOR_DEVICE_ATTR(shunt_resistor, S_IRUGO | S_IWUSR, static SENSOR_DEVICE_ATTR(shunt_resistor, S_IRUGO | S_IWUSR,
ina2xx_show_value, ina2xx_store_shunt, ina2xx_show_shunt, ina2xx_store_shunt,
INA2XX_CALIBRATION); INA2XX_CALIBRATION);
/* update interval (ina226 only) */ /* update interval (ina226 only) */
......
/* /*
* Driver for Texas Instruments INA219, INA226 power monitor chips * Driver for Texas Instruments INA219, INA226 power monitor chips
* *
* Copyright (C) 2012 Lothar Felten <l-felten@ti.com> * Copyright (C) 2012 Lothar Felten <lothar.felten@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册