* [PATCH v2 0/4] Make max expected current configurable for ina2xx drivers [not found] <CGME20171012123623eucas1p18dd41d52069240a3172c0bcec8f63553@eucas1p1.samsung.com> @ 2017-10-12 12:36 ` Maciej Purski [not found] ` <CGME20171012123632eucas1p1638754631a455ec6ff5f9770f6c33a95@eucas1p1.samsung.com> ` (3 more replies) 0 siblings, 4 replies; 12+ messages in thread From: Maciej Purski @ 2017-10-12 12:36 UTC (permalink / raw) To: devicetree-u79uwXL29TY76Z2rM5mHXA, linux-hwmon-u79uwXL29TY76Z2rM5mHXA, linux-doc-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA, linux-iio-u79uwXL29TY76Z2rM5mHXA Cc: Rob Herring, Mark Rutland, Guenter Roeck, Jean Delvare, Jonathan Corbet, Russell King, Kukjin Kim, Krzysztof Kozlowski, Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler, Bartlomiej Zolnierkiewicz, Marek Szyprowski, Maciej Purski Hi all, this patchset makes it possible to calibrate ina2xx drivers with different calibration values, which are calculated using max expected current value. It can be read from device tree, platform data or changed during run-time using sysfs. If it isn't specified in device tree or platform data, the driver uses default value, thanks to which the behaviour of the driver doesn't change in this case. There are two drivers for ina2xx: hwmon and iio. Changes are made for both of them and their bindings as well. These changes allow setting sensor's precision to the required by the board. It is useful in Odroid XU3. Therefore this patchset also sets max-expected-current in OdroidXU3 device tree to values from documentation. Best Regards, Maciej Purski --- Changes in v2: - make scale attribute for current iio channel writable as instead of adding new attribute max_expected_current - use currX_max standard attribute in hwmon instead of adding new attribute - fix max expected current property name - update commit messages Maciej Purski (4): iio: adc: ina2xx: Make max expected current configurable hwmon: (ina2xx) Make max expected current configurable dt-bindings: hwmon: Add ti-max-expected-current-microamp property to ina2xx ARM: dts: Add ti-max-expected-current-microamp properties for ina231 in Odroid XU3 Documentation/devicetree/bindings/hwmon/ina2xx.txt | 4 +- Documentation/hwmon/ina2xx | 3 + arch/arm/boot/dts/exynos5422-odroidxu3.dts | 4 + drivers/hwmon/ina2xx.c | 106 ++++++++++++++++++--- drivers/iio/adc/ina2xx-adc.c | 97 ++++++++++++++----- include/linux/platform_data/ina2xx.h | 2 + 6 files changed, 178 insertions(+), 38 deletions(-) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 12+ messages in thread
[parent not found: <CGME20171012123632eucas1p1638754631a455ec6ff5f9770f6c33a95@eucas1p1.samsung.com>]
* [PATCH v2 1/4] iio: adc: ina2xx: Make max expected current configurable [not found] ` <CGME20171012123632eucas1p1638754631a455ec6ff5f9770f6c33a95@eucas1p1.samsung.com> @ 2017-10-12 12:36 ` Maciej Purski 0 siblings, 0 replies; 12+ messages in thread From: Maciej Purski @ 2017-10-12 12:36 UTC (permalink / raw) To: devicetree, linux-hwmon, linux-doc, linux-arm-kernel, linux-samsung-soc, linux-iio Cc: Rob Herring, Mark Rutland, Guenter Roeck, Jean Delvare, Jonathan Corbet, Russell King, Kukjin Kim, Krzysztof Kozlowski, Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler, Bartlomiej Zolnierkiewicz, Marek Szyprowski, Maciej Purski Max expected current is used for calculating calibration register value, Current LSB and Power LSB according to equations found in ina datasheet: current_lsb = max_expected_current / 2^15 calibration_register = 0.00512 / (current_lsb * r_shunt) power_lsb = 25 * current_lsb (for ina231, 230, 226) power_lsb = 20 * current_lsb (for older ones) Max expected current is now implicitly set to default value, which is 2^15, thanks to which Current LSB is equal to 1 mA and Power LSB is equal to 20000 uW or 25000 uW depending on ina model, but users have no impact on the precision of the device. Make max expected current configurable from device tree or platform_data. Allow changing current_lsb from sysfs. It is exposed in sysfs as scale attribute for IIO current channel. Update calibration register and power_lsb value on each scale change. Signed-off-by: Maciej Purski <m.purski@samsung.com> --- drivers/iio/adc/ina2xx-adc.c | 96 ++++++++++++++++++++++++++---------- include/linux/platform_data/ina2xx.h | 2 + 2 files changed, 73 insertions(+), 25 deletions(-) diff --git a/drivers/iio/adc/ina2xx-adc.c b/drivers/iio/adc/ina2xx-adc.c index a16f8c6..7f1ae79 100644 --- a/drivers/iio/adc/ina2xx-adc.c +++ b/drivers/iio/adc/ina2xx-adc.c @@ -56,6 +56,7 @@ #define INA226_DEFAULT_IT 1110 #define INA2XX_RSHUNT_DEFAULT 10000 +#define INA2XX_MAX_EXPECTED_MA_DEFAULT BIT(15) /* current_lsb = 1 mA */ /* * bit masks for reading the settings in the configuration register @@ -114,7 +115,7 @@ struct ina2xx_config { int shunt_div; int bus_voltage_shift; int bus_voltage_lsb; /* uV */ - int power_lsb; /* uW */ + int power_lsb_factor; enum ina2xx_ids chip_id; }; @@ -123,7 +124,9 @@ struct ina2xx_chip_info { struct task_struct *task; const struct ina2xx_config *config; struct mutex state_lock; - unsigned int shunt_resistor; + unsigned int shunt_resistor; /* uOhms */ + int current_lsb; /* uA */ + int power_lsb; /* uW */ int avg; int int_time_vbus; /* Bus voltage integration time uS */ int int_time_vshunt; /* Shunt voltage integration time uS */ @@ -137,7 +140,7 @@ static const struct ina2xx_config ina2xx_config[] = { .shunt_div = 100, .bus_voltage_shift = 3, .bus_voltage_lsb = 4000, - .power_lsb = 20000, + .power_lsb_factor = 20, .chip_id = ina219, }, [ina226] = { @@ -146,7 +149,7 @@ static const struct ina2xx_config ina2xx_config[] = { .shunt_div = 400, .bus_voltage_shift = 0, .bus_voltage_lsb = 1250, - .power_lsb = 25000, + .power_lsb_factor = 25, .chip_id = ina226, }, }; @@ -210,14 +213,15 @@ static int ina2xx_read_raw(struct iio_dev *indio_dev, case INA2XX_POWER: /* processed (mW) = raw*lsb (uW) / 1000 */ - *val = chip->config->power_lsb; + *val = chip->power_lsb; *val2 = 1000; return IIO_VAL_FRACTIONAL; case INA2XX_CURRENT: - /* processed (mA) = raw (mA) */ - *val = 1; - return IIO_VAL_INT; + /* processed (mA) = raw*lsb (uA) / 1000 */ + *val = chip->current_lsb; + *val2 = 1000; + return IIO_VAL_FRACTIONAL; } } @@ -353,6 +357,36 @@ static int ina219_set_int_time_vshunt(struct ina2xx_chip_info *chip, return 0; } +/* + * Calculate calibration value according to equation 1 in ina226 datasheet + * http://www.ti.com/lit/ds/symlink/ina226.pdf. + * Current LSB is in uA and RShunt is in uOhms, so RShunt should be + * converted to mOhms in order to keep the scale. + * There is no need to expose the CALIBRATION register + * to the user for now. But we need to reset this register + * if the user updates RShunt or max expected current after driver + * init, e.g upon reading an EEPROM/Probe-type value. + */ +static int ina2xx_set_calibration(struct ina2xx_chip_info *chip) +{ + unsigned int rshunt = DIV_ROUND_CLOSEST(chip->shunt_resistor, 1000); + u16 regval = DIV_ROUND_CLOSEST(chip->config->calibration_factor, + chip->current_lsb * rshunt); + + return regmap_write(chip->regmap, INA2XX_CALIBRATION, regval); +} + +static int ina2xx_set_scale(struct ina2xx_chip_info *chip, unsigned int val) +{ + if (val <= 0 || val > chip->config->calibration_factor) + return -EINVAL; + + chip->current_lsb = val; + chip->power_lsb = chip->current_lsb * chip->config->power_lsb_factor; + + return 0; +} + static int ina2xx_write_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, int val, int val2, long mask) @@ -394,7 +428,18 @@ static int ina2xx_write_raw(struct iio_dev *indio_dev, &tmp); } break; - + case IIO_CHAN_INFO_SCALE: + switch (chan->type) { + case IIO_CURRENT: + val = val * 1000 + DIV_ROUND_CLOSEST(val2, 1000); + ret = ina2xx_set_scale(chip, val); + if (!ret) + ret = ina2xx_set_calibration(chip); + break; + default: + ret = -EINVAL; + } + break; default: ret = -EINVAL; } @@ -433,22 +478,6 @@ static ssize_t ina2xx_allow_async_readout_store(struct device *dev, return len; } -/* - * Set current LSB to 1mA, shunt is in uOhms - * (equation 13 in datasheet). We hardcode a Current_LSB - * of 1.0 x10-6. The only remaining parameter is RShunt. - * There is no need to expose the CALIBRATION register - * to the user for now. But we need to reset this register - * if the user updates RShunt after driver init, e.g upon - * reading an EEPROM/Probe-type value. - */ -static int ina2xx_set_calibration(struct ina2xx_chip_info *chip) -{ - u16 regval = DIV_ROUND_CLOSEST(chip->config->calibration_factor, - chip->shunt_resistor); - - return regmap_write(chip->regmap, INA2XX_CALIBRATION, regval); -} static int set_shunt_resistor(struct ina2xx_chip_info *chip, unsigned int val) { @@ -849,6 +878,23 @@ static int ina2xx_probe(struct i2c_client *client, if (ret) return ret; + if (of_property_read_u32(client->dev.of_node, + "ti-max-expected-current-microamp", &val) < 0) { + struct ina2xx_platform_data *pdata = + dev_get_platdata(&client->dev); + + if (pdata && pdata->max_mA != 0) + val = pdata->max_mA; + else + val = INA2XX_MAX_EXPECTED_MA_DEFAULT; + } + + /* Calculate current_lsb: max-expected-current / 2^15 */ + val = DIV_ROUND_CLOSEST(val * 1000, (1 << 15)); + ret = ina2xx_set_scale(chip, val); + if (ret) + return ret; + /* Patch the current config register with default. */ val = chip->config->config_default; diff --git a/include/linux/platform_data/ina2xx.h b/include/linux/platform_data/ina2xx.h index 9abc0ca..f02b1d8 100644 --- a/include/linux/platform_data/ina2xx.h +++ b/include/linux/platform_data/ina2xx.h @@ -13,7 +13,9 @@ /** * struct ina2xx_platform_data - ina2xx info * @shunt_uohms shunt resistance in microohms + * @max_mA max expected current in mA */ struct ina2xx_platform_data { long shunt_uohms; + int max_mA; }; -- 2.7.4 ^ permalink raw reply related [flat|nested] 12+ messages in thread
[parent not found: <CGME20171012123633eucas1p2b76006dfc295beab89de68cbfe8839ad@eucas1p2.samsung.com>]
* [PATCH v2 2/4] hwmon: (ina2xx) Make max expected current configurable [not found] ` <CGME20171012123633eucas1p2b76006dfc295beab89de68cbfe8839ad@eucas1p2.samsung.com> @ 2017-10-12 12:36 ` Maciej Purski 0 siblings, 0 replies; 12+ messages in thread From: Maciej Purski @ 2017-10-12 12:36 UTC (permalink / raw) To: devicetree, linux-hwmon, linux-doc, linux-arm-kernel, linux-samsung-soc, linux-iio Cc: Rob Herring, Mark Rutland, Guenter Roeck, Jean Delvare, Jonathan Corbet, Russell King, Kukjin Kim, Krzysztof Kozlowski, Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler, Bartlomiej Zolnierkiewicz, Marek Szyprowski, Maciej Purski Max expected current is used for calculating calibration register value, Current LSB and Power LSB according to equations found in ina datasheet: current_lsb = max_expected_current / 2^15 calibration_register = 0.00512 / (current_lsb * r_shunt) power_lsb = 25 * current_lsb (for ina231, 230, 226) power_lsb = 20 * current_lsb (for older ones) Max expected current is now implicitly set to default value, which is 2^15, thanks to which Current LSB is equal to 1 mA and Power LSB is equal to 20000 uW or 25000 uW depending on ina model, but users have no impact on the precision of the device. Make max expected current configurable from device tree or platform_data. Allow changing it from sysfs as currX_max attribute. Update calibration register and power_lsb value on each currX_max change. Signed-off-by: Maciej Purski <m.purski@samsung.com> --- drivers/hwmon/ina2xx.c | 107 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 95 insertions(+), 12 deletions(-) diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c index 62e38fa..bcaf814 100644 --- a/drivers/hwmon/ina2xx.c +++ b/drivers/hwmon/ina2xx.c @@ -80,6 +80,8 @@ /* common attrs, ina226 attrs and NULL */ #define INA2XX_MAX_ATTRIBUTE_GROUPS 3 +#define INA2XX_MAX_EXPECTED_MA_DEFAULT BIT(15) /* current_lsb = 1 mA */ + /* * Both bus voltage and shunt voltage conversion times for ina226 are set * to 0b0100 on POR, which translates to 2200 microseconds in total. @@ -100,13 +102,16 @@ struct ina2xx_config { int shunt_div; int bus_voltage_shift; int bus_voltage_lsb; /* uV */ - int power_lsb; /* uW */ + int power_lsb_factor; }; struct ina2xx_data { const struct ina2xx_config *config; - long rshunt; + long rshunt; /* uOhms */ + unsigned int max_expected_current; /* mA */ + int current_lsb; /* uA */ + int power_lsb; /* uW */ struct mutex config_lock; struct regmap *regmap; @@ -121,7 +126,7 @@ static const struct ina2xx_config ina2xx_config[] = { .shunt_div = 100, .bus_voltage_shift = 3, .bus_voltage_lsb = 4000, - .power_lsb = 20000, + .power_lsb_factor = 20, }, [ina226] = { .config_default = INA226_CONFIG_DEFAULT, @@ -130,7 +135,7 @@ static const struct ina2xx_config ina2xx_config[] = { .shunt_div = 400, .bus_voltage_shift = 0, .bus_voltage_lsb = 1250, - .power_lsb = 25000, + .power_lsb_factor = 25, }, }; @@ -169,10 +174,17 @@ static u16 ina226_interval_to_reg(int interval) return INA226_SHIFT_AVG(avg_bits); } +/* + * Calculate calibration value according to equation 1 in ina226 datasheet + * http://www.ti.com/lit/ds/symlink/ina226.pdf. + * Current LSB is in uA and RShunt is in uOhms, so in order to keep + * calibration value scaled RShunt must be converted to mOhms. + */ static int ina2xx_calibrate(struct ina2xx_data *data) { + int r_shunt = DIV_ROUND_CLOSEST(data->rshunt, 1000); u16 val = DIV_ROUND_CLOSEST(data->config->calibration_factor, - data->rshunt); + data->current_lsb * r_shunt); return regmap_write(data->regmap, INA2XX_CALIBRATION, val); } @@ -187,13 +199,29 @@ static int ina2xx_init(struct ina2xx_data *data) if (ret < 0) return ret; - /* - * Set current LSB to 1mA, shunt is in uOhms - * (equation 13 in datasheet). - */ return ina2xx_calibrate(data); } +/* + * Set max_expected_current (mA) and calculate current_lsb (uA), + * according to equation 2 in ina226 datasheet. Power LSB is calculated + * by multiplying Current LSB by a given factor, which may vary depending + * on ina version. + */ +static int ina2xx_set_max_expected_current(struct ina2xx_data *data, + unsigned int val) +{ + if (val <= 0 || val > data->config->calibration_factor) + return -EINVAL; + + data->max_expected_current = val; + data->current_lsb = DIV_ROUND_CLOSEST(data->max_expected_current * 1000, + 1 << 15); + data->power_lsb = data->current_lsb * data->config->power_lsb_factor; + + return 0; +} + static int ina2xx_read_reg(struct device *dev, int reg, unsigned int *regval) { struct ina2xx_data *data = dev_get_drvdata(dev); @@ -268,11 +296,11 @@ static int ina2xx_get_value(struct ina2xx_data *data, u8 reg, val = DIV_ROUND_CLOSEST(val, 1000); break; case INA2XX_POWER: - val = regval * data->config->power_lsb; + val = regval * data->power_lsb; break; case INA2XX_CURRENT: - /* signed register, LSB=1mA (selected), in mA */ - val = (s16)regval; + val = (s16)regval * data->current_lsb; + val = DIV_ROUND_CLOSEST(val, 1000); break; case INA2XX_CALIBRATION: val = DIV_ROUND_CLOSEST(data->config->calibration_factor, @@ -369,6 +397,39 @@ static ssize_t ina226_show_interval(struct device *dev, return snprintf(buf, PAGE_SIZE, "%d\n", ina226_reg_to_interval(regval)); } +static ssize_t ina2xx_max_current_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct ina2xx_data *data = dev_get_drvdata(dev); + + return sprintf(buf, "%d\n", data->max_expected_current); +} + +static ssize_t ina2xx_max_current_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t len) +{ + struct ina2xx_data *data = dev_get_drvdata(dev); + unsigned long val; + int ret; + + ret = kstrtoul(buf, 10, &val); + if (ret) + return ret; + + ret = ina2xx_set_max_expected_current(data, val); + if (ret) + return ret; + + /* Update the Calibration register */ + ret = ina2xx_calibrate(data); + if (ret) + return ret; + + return len; +} + /* shunt voltage */ static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, ina2xx_show_value, NULL, INA2XX_SHUNT_VOLTAGE); @@ -390,6 +451,11 @@ static SENSOR_DEVICE_ATTR(shunt_resistor, S_IRUGO | S_IWUSR, ina2xx_show_value, ina2xx_set_shunt, INA2XX_CALIBRATION); +/* max expected current */ +static SENSOR_DEVICE_ATTR(curr1_max, S_IRUGO | S_IWUSR, + ina2xx_max_current_show, + ina2xx_max_current_store, 0); + /* update interval (ina226 only) */ static SENSOR_DEVICE_ATTR(update_interval, S_IRUGO | S_IWUSR, ina226_show_interval, ina226_set_interval, 0); @@ -401,6 +467,7 @@ static struct attribute *ina2xx_attrs[] = { &sensor_dev_attr_curr1_input.dev_attr.attr, &sensor_dev_attr_power1_input.dev_attr.attr, &sensor_dev_attr_shunt_resistor.dev_attr.attr, + &sensor_dev_attr_curr1_max.dev_attr.attr, NULL, }; @@ -453,6 +520,22 @@ static int ina2xx_probe(struct i2c_client *client, data->rshunt = val; + if (of_property_read_u32(dev->of_node, + "ti-max-expected-current-microamp", + &val) < 0) { + struct ina2xx_platform_data *pdata = + dev_get_platdata(&client->dev); + + if (pdata && pdata->max_mA != 0) + val = pdata->max_mA; + else + val = INA2XX_MAX_EXPECTED_MA_DEFAULT; + } + + ret = ina2xx_set_max_expected_current(data, val); + if (ret < 0) + return ret; + ina2xx_regmap_config.max_register = data->config->registers; data->regmap = devm_regmap_init_i2c(client, &ina2xx_regmap_config); -- 2.7.4 ^ permalink raw reply related [flat|nested] 12+ messages in thread
[parent not found: <CGME20171012123635eucas1p1ff9a982db9d541cd0475d44d114ff92a@eucas1p1.samsung.com>]
* [PATCH v2 3/4] dt-bindings: hwmon: Add ti-max-expected-current-microamp property to ina2xx [not found] ` <CGME20171012123635eucas1p1ff9a982db9d541cd0475d44d114ff92a@eucas1p1.samsung.com> @ 2017-10-12 12:36 ` Maciej Purski 2017-10-12 12:39 ` Krzysztof Kozlowski 2017-10-17 20:36 ` Rob Herring 0 siblings, 2 replies; 12+ messages in thread From: Maciej Purski @ 2017-10-12 12:36 UTC (permalink / raw) To: devicetree, linux-hwmon, linux-doc, linux-arm-kernel, linux-samsung-soc, linux-iio Cc: Rob Herring, Mark Rutland, Guenter Roeck, Jean Delvare, Jonathan Corbet, Russell King, Kukjin Kim, Krzysztof Kozlowski, Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler, Bartlomiej Zolnierkiewicz, Marek Szyprowski, Maciej Purski Add optional max expected current property which allows calibrating the ina sensor in order to achieve requested measure scale. Document the changes in Documentation/hwmon/ina2xx. Signed-off-by: Maciej Purski <m.purski@samsung.com> --- Documentation/devicetree/bindings/hwmon/ina2xx.txt | 4 +++- Documentation/hwmon/ina2xx | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/hwmon/ina2xx.txt b/Documentation/devicetree/bindings/hwmon/ina2xx.txt index 02af0d9..49ef0be 100644 --- a/Documentation/devicetree/bindings/hwmon/ina2xx.txt +++ b/Documentation/devicetree/bindings/hwmon/ina2xx.txt @@ -14,11 +14,13 @@ Optional properties: - shunt-resistor Shunt resistor value in micro-Ohm - +- ti-max-expected-current-microamp + Max expected current value in mA Example: ina220@44 { compatible = "ti,ina220"; reg = <0x44>; shunt-resistor = <1000>; + ti-max-expected-current-microamp = <3000>; }; diff --git a/Documentation/hwmon/ina2xx b/Documentation/hwmon/ina2xx index cfd31d9..30620e8 100644 --- a/Documentation/hwmon/ina2xx +++ b/Documentation/hwmon/ina2xx @@ -55,6 +55,9 @@ The shunt value in micro-ohms can be set via platform data or device tree at compile-time or via the shunt_resistor attribute in sysfs at run-time. Please refer to the Documentation/devicetree/bindings/i2c/ina2xx.txt for bindings if the device tree is used. +The max expected current value in miliamp can be set via platform data +or device tree at compile-time or via currX_max attribute in sysfs +at run-time. Additionally ina226 supports update_interval attribute as described in Documentation/hwmon/sysfs-interface. Internally the interval is the sum of -- 2.7.4 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v2 3/4] dt-bindings: hwmon: Add ti-max-expected-current-microamp property to ina2xx 2017-10-12 12:36 ` [PATCH v2 3/4] dt-bindings: hwmon: Add ti-max-expected-current-microamp property to ina2xx Maciej Purski @ 2017-10-12 12:39 ` Krzysztof Kozlowski [not found] ` <CAJKOXPc1B1uqravtmHrh4eUK5JiQRiZLeoveSMk5qVyF-mK7Kw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2017-10-17 20:36 ` Rob Herring 1 sibling, 1 reply; 12+ messages in thread From: Krzysztof Kozlowski @ 2017-10-12 12:39 UTC (permalink / raw) To: Maciej Purski Cc: devicetree, linux-hwmon, linux-doc, linux-arm-kernel, linux-samsung-soc, linux-iio, Rob Herring, Mark Rutland, Guenter Roeck, Jean Delvare, Jonathan Corbet, Russell King, Kukjin Kim, Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler, Bartlomiej Zolnierkiewicz, Marek Szyprowski On Thu, Oct 12, 2017 at 2:36 PM, Maciej Purski <m.purski@samsung.com> wrote: > Add optional max expected current property which allows calibrating > the ina sensor in order to achieve requested measure scale. Document > the changes in Documentation/hwmon/ina2xx. > > Signed-off-by: Maciej Purski <m.purski@samsung.com> > --- > Documentation/devicetree/bindings/hwmon/ina2xx.txt | 4 +++- > Documentation/hwmon/ina2xx | 3 +++ > 2 files changed, 6 insertions(+), 1 deletion(-) > > diff --git a/Documentation/devicetree/bindings/hwmon/ina2xx.txt b/Documentation/devicetree/bindings/hwmon/ina2xx.txt > index 02af0d9..49ef0be 100644 > --- a/Documentation/devicetree/bindings/hwmon/ina2xx.txt > +++ b/Documentation/devicetree/bindings/hwmon/ina2xx.txt > @@ -14,11 +14,13 @@ Optional properties: > > - shunt-resistor > Shunt resistor value in micro-Ohm > - > +- ti-max-expected-current-microamp > + Max expected current value in mA > Example: > > ina220@44 { > compatible = "ti,ina220"; > reg = <0x44>; > shunt-resistor = <1000>; > + ti-max-expected-current-microamp = <3000>; > }; > diff --git a/Documentation/hwmon/ina2xx b/Documentation/hwmon/ina2xx > index cfd31d9..30620e8 100644 > --- a/Documentation/hwmon/ina2xx > +++ b/Documentation/hwmon/ina2xx > @@ -55,6 +55,9 @@ The shunt value in micro-ohms can be set via platform data or device tree at > compile-time or via the shunt_resistor attribute in sysfs at run-time. Please > refer to the Documentation/devicetree/bindings/i2c/ina2xx.txt for bindings > if the device tree is used. > +The max expected current value in miliamp can be set via platform data mili or micro? BR, Krzysztof > +or device tree at compile-time or via currX_max attribute in sysfs > +at run-time. > > Additionally ina226 supports update_interval attribute as described in > Documentation/hwmon/sysfs-interface. Internally the interval is the sum of > -- > 2.7.4 > ^ permalink raw reply [flat|nested] 12+ messages in thread
[parent not found: <CAJKOXPc1B1uqravtmHrh4eUK5JiQRiZLeoveSMk5qVyF-mK7Kw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH v2 3/4] dt-bindings: hwmon: Add ti-max-expected-current-microamp property to ina2xx [not found] ` <CAJKOXPc1B1uqravtmHrh4eUK5JiQRiZLeoveSMk5qVyF-mK7Kw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2017-10-12 13:00 ` Maciej Purski 2017-10-12 13:55 ` Guenter Roeck 0 siblings, 1 reply; 12+ messages in thread From: Maciej Purski @ 2017-10-12 13:00 UTC (permalink / raw) To: Krzysztof Kozlowski Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, linux-hwmon-u79uwXL29TY76Z2rM5mHXA, linux-doc-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA, linux-iio-u79uwXL29TY76Z2rM5mHXA, Rob Herring, Mark Rutland, Guenter Roeck, Jean Delvare, Jonathan Corbet, Russell King, Kukjin Kim, Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler, Bartlomiej Zolnierkiewicz, Marek Szyprowski On 10/12/2017 02:39 PM, Krzysztof Kozlowski wrote: > On Thu, Oct 12, 2017 at 2:36 PM, Maciej Purski <m.purski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> wrote: >> Add optional max expected current property which allows calibrating >> the ina sensor in order to achieve requested measure scale. Document >> the changes in Documentation/hwmon/ina2xx. >> >> Signed-off-by: Maciej Purski <m.purski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> >> --- >> Documentation/devicetree/bindings/hwmon/ina2xx.txt | 4 +++- >> Documentation/hwmon/ina2xx | 3 +++ >> 2 files changed, 6 insertions(+), 1 deletion(-) >> >> diff --git a/Documentation/devicetree/bindings/hwmon/ina2xx.txt b/Documentation/devicetree/bindings/hwmon/ina2xx.txt >> index 02af0d9..49ef0be 100644 >> --- a/Documentation/devicetree/bindings/hwmon/ina2xx.txt >> +++ b/Documentation/devicetree/bindings/hwmon/ina2xx.txt >> @@ -14,11 +14,13 @@ Optional properties: >> >> - shunt-resistor >> Shunt resistor value in micro-Ohm >> - >> +- ti-max-expected-current-microamp >> + Max expected current value in mA >> Example: >> >> ina220@44 { >> compatible = "ti,ina220"; >> reg = <0x44>; >> shunt-resistor = <1000>; >> + ti-max-expected-current-microamp = <3000>; >> }; >> diff --git a/Documentation/hwmon/ina2xx b/Documentation/hwmon/ina2xx >> index cfd31d9..30620e8 100644 >> --- a/Documentation/hwmon/ina2xx >> +++ b/Documentation/hwmon/ina2xx >> @@ -55,6 +55,9 @@ The shunt value in micro-ohms can be set via platform data or device tree at >> compile-time or via the shunt_resistor attribute in sysfs at run-time. Please >> refer to the Documentation/devicetree/bindings/i2c/ina2xx.txt for bindings >> if the device tree is used. >> +The max expected current value in miliamp can be set via platform data > > mili or micro? > > BR, > Krzysztof Sorry, these should be mili everywhere. I'll fix this. > >> +or device tree at compile-time or via currX_max attribute in sysfs >> +at run-time. >> >> Additionally ina226 supports update_interval attribute as described in >> Documentation/hwmon/sysfs-interface. Internally the interval is the sum of >> -- >> 2.7.4 >> > > > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 3/4] dt-bindings: hwmon: Add ti-max-expected-current-microamp property to ina2xx 2017-10-12 13:00 ` Maciej Purski @ 2017-10-12 13:55 ` Guenter Roeck [not found] ` <79da3a8b-e885-8a02-cbba-dfd1834450db-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org> 0 siblings, 1 reply; 12+ messages in thread From: Guenter Roeck @ 2017-10-12 13:55 UTC (permalink / raw) To: Maciej Purski, Krzysztof Kozlowski Cc: devicetree, linux-hwmon, linux-doc, linux-arm-kernel, linux-samsung-soc, linux-iio, Rob Herring, Mark Rutland, Jean Delvare, Jonathan Corbet, Russell King, Kukjin Kim, Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler, Bartlomiej Zolnierkiewicz, Marek Szyprowski On 10/12/2017 06:00 AM, Maciej Purski wrote: > > > On 10/12/2017 02:39 PM, Krzysztof Kozlowski wrote: >> On Thu, Oct 12, 2017 at 2:36 PM, Maciej Purski <m.purski@samsung.com> wrote: >>> Add optional max expected current property which allows calibrating >>> the ina sensor in order to achieve requested measure scale. Document >>> the changes in Documentation/hwmon/ina2xx. >>> >>> Signed-off-by: Maciej Purski <m.purski@samsung.com> >>> --- >>> Documentation/devicetree/bindings/hwmon/ina2xx.txt | 4 +++- >>> Documentation/hwmon/ina2xx | 3 +++ >>> 2 files changed, 6 insertions(+), 1 deletion(-) >>> >>> diff --git a/Documentation/devicetree/bindings/hwmon/ina2xx.txt b/Documentation/devicetree/bindings/hwmon/ina2xx.txt >>> index 02af0d9..49ef0be 100644 >>> --- a/Documentation/devicetree/bindings/hwmon/ina2xx.txt >>> +++ b/Documentation/devicetree/bindings/hwmon/ina2xx.txt >>> @@ -14,11 +14,13 @@ Optional properties: >>> >>> - shunt-resistor >>> Shunt resistor value in micro-Ohm >>> - >>> +- ti-max-expected-current-microamp >>> + Max expected current value in mA >>> Example: >>> >>> ina220@44 { >>> compatible = "ti,ina220"; >>> reg = <0x44>; >>> shunt-resistor = <1000>; >>> + ti-max-expected-current-microamp = <3000>; >>> }; >>> diff --git a/Documentation/hwmon/ina2xx b/Documentation/hwmon/ina2xx >>> index cfd31d9..30620e8 100644 >>> --- a/Documentation/hwmon/ina2xx >>> +++ b/Documentation/hwmon/ina2xx >>> @@ -55,6 +55,9 @@ The shunt value in micro-ohms can be set via platform data or device tree at >>> compile-time or via the shunt_resistor attribute in sysfs at run-time. Please >>> refer to the Documentation/devicetree/bindings/i2c/ina2xx.txt for bindings >>> if the device tree is used. >>> +The max expected current value in miliamp can be set via platform data >> >> mili or micro? >> >> BR, >> Krzysztof > > Sorry, these should be mili everywhere. I'll fix this. > You sure ? I think DT usually uses micro. Guenter >> >>> +or device tree at compile-time or via currX_max attribute in sysfs >>> +at run-time. >>> >>> Additionally ina226 supports update_interval attribute as described in >>> Documentation/hwmon/sysfs-interface. Internally the interval is the sum of >>> -- >>> 2.7.4 >>> >> >> >> > ^ permalink raw reply [flat|nested] 12+ messages in thread
[parent not found: <79da3a8b-e885-8a02-cbba-dfd1834450db-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>]
* Re: [PATCH v2 3/4] dt-bindings: hwmon: Add ti-max-expected-current-microamp property to ina2xx [not found] ` <79da3a8b-e885-8a02-cbba-dfd1834450db-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org> @ 2017-10-12 14:13 ` Maciej Purski 0 siblings, 0 replies; 12+ messages in thread From: Maciej Purski @ 2017-10-12 14:13 UTC (permalink / raw) To: Guenter Roeck, Krzysztof Kozlowski Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, linux-hwmon-u79uwXL29TY76Z2rM5mHXA, linux-doc-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA, linux-iio-u79uwXL29TY76Z2rM5mHXA, Rob Herring, Mark Rutland, Jean Delvare, Jonathan Corbet, Russell King, Kukjin Kim, Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler, Bartlomiej Zolnierkiewicz, Marek Szyprowski On 10/12/2017 03:55 PM, Guenter Roeck wrote: > On 10/12/2017 06:00 AM, Maciej Purski wrote: >> >> >> On 10/12/2017 02:39 PM, Krzysztof Kozlowski wrote: >>> On Thu, Oct 12, 2017 at 2:36 PM, Maciej Purski <m.purski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> wrote: >>>> Add optional max expected current property which allows calibrating >>>> the ina sensor in order to achieve requested measure scale. Document >>>> the changes in Documentation/hwmon/ina2xx. >>>> >>>> Signed-off-by: Maciej Purski <m.purski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> >>>> --- >>>> Documentation/devicetree/bindings/hwmon/ina2xx.txt | 4 +++- >>>> Documentation/hwmon/ina2xx | 3 +++ >>>> 2 files changed, 6 insertions(+), 1 deletion(-) >>>> >>>> diff --git a/Documentation/devicetree/bindings/hwmon/ina2xx.txt >>>> b/Documentation/devicetree/bindings/hwmon/ina2xx.txt >>>> index 02af0d9..49ef0be 100644 >>>> --- a/Documentation/devicetree/bindings/hwmon/ina2xx.txt >>>> +++ b/Documentation/devicetree/bindings/hwmon/ina2xx.txt >>>> @@ -14,11 +14,13 @@ Optional properties: >>>> >>>> - shunt-resistor >>>> Shunt resistor value in micro-Ohm >>>> - >>>> +- ti-max-expected-current-microamp >>>> + Max expected current value in mA >>>> Example: >>>> >>>> ina220@44 { >>>> compatible = "ti,ina220"; >>>> reg = <0x44>; >>>> shunt-resistor = <1000>; >>>> + ti-max-expected-current-microamp = <3000>; >>>> }; >>>> diff --git a/Documentation/hwmon/ina2xx b/Documentation/hwmon/ina2xx >>>> index cfd31d9..30620e8 100644 >>>> --- a/Documentation/hwmon/ina2xx >>>> +++ b/Documentation/hwmon/ina2xx >>>> @@ -55,6 +55,9 @@ The shunt value in micro-ohms can be set via platform data >>>> or device tree at >>>> compile-time or via the shunt_resistor attribute in sysfs at run-time. Please >>>> refer to the Documentation/devicetree/bindings/i2c/ina2xx.txt for bindings >>>> if the device tree is used. >>>> +The max expected current value in miliamp can be set via platform data >>> >>> mili or micro? >>> >>> BR, >>> Krzysztof >> >> Sorry, these should be mili everywhere. I'll fix this. >> > > You sure ? I think DT usually uses micro. > > Guenter Yeah, you're right. I was intending to make it milli, but I haven't checked that all DTS use micro. Sorry for confusion. Best Regards, Maciej > >>> >>>> +or device tree at compile-time or via currX_max attribute in sysfs >>>> +at run-time. >>>> >>>> Additionally ina226 supports update_interval attribute as described in >>>> Documentation/hwmon/sysfs-interface. Internally the interval is the sum of >>>> -- >>>> 2.7.4 >>>> >>> >>> >>> >> > > > > -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 3/4] dt-bindings: hwmon: Add ti-max-expected-current-microamp property to ina2xx 2017-10-12 12:36 ` [PATCH v2 3/4] dt-bindings: hwmon: Add ti-max-expected-current-microamp property to ina2xx Maciej Purski 2017-10-12 12:39 ` Krzysztof Kozlowski @ 2017-10-17 20:36 ` Rob Herring 2017-10-17 20:58 ` Guenter Roeck 1 sibling, 1 reply; 12+ messages in thread From: Rob Herring @ 2017-10-17 20:36 UTC (permalink / raw) To: Maciej Purski Cc: devicetree, linux-hwmon, linux-doc, linux-arm-kernel, linux-samsung-soc, linux-iio, Mark Rutland, Guenter Roeck, Jean Delvare, Jonathan Corbet, Russell King, Kukjin Kim, Krzysztof Kozlowski, Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler, Bartlomiej Zolnierkiewicz, Marek Szyprowski On Thu, Oct 12, 2017 at 02:36:04PM +0200, Maciej Purski wrote: > Add optional max expected current property which allows calibrating > the ina sensor in order to achieve requested measure scale. Document > the changes in Documentation/hwmon/ina2xx. > > Signed-off-by: Maciej Purski <m.purski@samsung.com> > --- > Documentation/devicetree/bindings/hwmon/ina2xx.txt | 4 +++- > Documentation/hwmon/ina2xx | 3 +++ > 2 files changed, 6 insertions(+), 1 deletion(-) > > diff --git a/Documentation/devicetree/bindings/hwmon/ina2xx.txt b/Documentation/devicetree/bindings/hwmon/ina2xx.txt > index 02af0d9..49ef0be 100644 > --- a/Documentation/devicetree/bindings/hwmon/ina2xx.txt > +++ b/Documentation/devicetree/bindings/hwmon/ina2xx.txt > @@ -14,11 +14,13 @@ Optional properties: > > - shunt-resistor > Shunt resistor value in micro-Ohm > - > +- ti-max-expected-current-microamp > + Max expected current value in mA ti,max-... The property name is a bit long. Does "expected" add anything? Is there a max unexpected current? > Example: > > ina220@44 { > compatible = "ti,ina220"; > reg = <0x44>; > shunt-resistor = <1000>; > + ti-max-expected-current-microamp = <3000>; > }; > diff --git a/Documentation/hwmon/ina2xx b/Documentation/hwmon/ina2xx > index cfd31d9..30620e8 100644 > --- a/Documentation/hwmon/ina2xx > +++ b/Documentation/hwmon/ina2xx > @@ -55,6 +55,9 @@ The shunt value in micro-ohms can be set via platform data or device tree at > compile-time or via the shunt_resistor attribute in sysfs at run-time. Please > refer to the Documentation/devicetree/bindings/i2c/ina2xx.txt for bindings > if the device tree is used. > +The max expected current value in miliamp can be set via platform data > +or device tree at compile-time or via currX_max attribute in sysfs > +at run-time. > > Additionally ina226 supports update_interval attribute as described in > Documentation/hwmon/sysfs-interface. Internally the interval is the sum of > -- > 2.7.4 > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 3/4] dt-bindings: hwmon: Add ti-max-expected-current-microamp property to ina2xx 2017-10-17 20:36 ` Rob Herring @ 2017-10-17 20:58 ` Guenter Roeck 2017-10-18 8:12 ` Jonathan Cameron 0 siblings, 1 reply; 12+ messages in thread From: Guenter Roeck @ 2017-10-17 20:58 UTC (permalink / raw) To: Rob Herring Cc: Maciej Purski, devicetree, linux-hwmon, linux-doc, linux-arm-kernel, linux-samsung-soc, linux-iio, Mark Rutland, Jean Delvare, Jonathan Corbet, Russell King, Kukjin Kim, Krzysztof Kozlowski, Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler, Bartlomiej Zolnierkiewicz, Marek Szyprowski On Tue, Oct 17, 2017 at 03:36:31PM -0500, Rob Herring wrote: > On Thu, Oct 12, 2017 at 02:36:04PM +0200, Maciej Purski wrote: > > Add optional max expected current property which allows calibrating > > the ina sensor in order to achieve requested measure scale. Document > > the changes in Documentation/hwmon/ina2xx. > > > > Signed-off-by: Maciej Purski <m.purski@samsung.com> > > --- > > Documentation/devicetree/bindings/hwmon/ina2xx.txt | 4 +++- > > Documentation/hwmon/ina2xx | 3 +++ > > 2 files changed, 6 insertions(+), 1 deletion(-) > > > > diff --git a/Documentation/devicetree/bindings/hwmon/ina2xx.txt b/Documentation/devicetree/bindings/hwmon/ina2xx.txt > > index 02af0d9..49ef0be 100644 > > --- a/Documentation/devicetree/bindings/hwmon/ina2xx.txt > > +++ b/Documentation/devicetree/bindings/hwmon/ina2xx.txt > > @@ -14,11 +14,13 @@ Optional properties: > > > > - shunt-resistor > > Shunt resistor value in micro-Ohm > > - > > +- ti-max-expected-current-microamp > > + Max expected current value in mA > > ti,max-... > > The property name is a bit long. Does "expected" add anything? Is there > a max unexpected current? > I am not too happy with it either. To me it suggests that there _can_ be an unexpected current (why specify a max _expected_ current otherwise ?), and that unexpected current won't be measurable and thus not reported because it is ... well, unexpected. Guenter > > Example: > > > > ina220@44 { > > compatible = "ti,ina220"; > > reg = <0x44>; > > shunt-resistor = <1000>; > > + ti-max-expected-current-microamp = <3000>; > > }; > > diff --git a/Documentation/hwmon/ina2xx b/Documentation/hwmon/ina2xx > > index cfd31d9..30620e8 100644 > > --- a/Documentation/hwmon/ina2xx > > +++ b/Documentation/hwmon/ina2xx > > @@ -55,6 +55,9 @@ The shunt value in micro-ohms can be set via platform data or device tree at > > compile-time or via the shunt_resistor attribute in sysfs at run-time. Please > > refer to the Documentation/devicetree/bindings/i2c/ina2xx.txt for bindings > > if the device tree is used. > > +The max expected current value in miliamp can be set via platform data > > +or device tree at compile-time or via currX_max attribute in sysfs > > +at run-time. > > > > Additionally ina226 supports update_interval attribute as described in > > Documentation/hwmon/sysfs-interface. Internally the interval is the sum of > > -- > > 2.7.4 > > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 3/4] dt-bindings: hwmon: Add ti-max-expected-current-microamp property to ina2xx 2017-10-17 20:58 ` Guenter Roeck @ 2017-10-18 8:12 ` Jonathan Cameron 0 siblings, 0 replies; 12+ messages in thread From: Jonathan Cameron @ 2017-10-18 8:12 UTC (permalink / raw) To: Guenter Roeck Cc: Rob Herring, Maciej Purski, devicetree, linux-hwmon, linux-doc, linux-arm-kernel, linux-samsung-soc, linux-iio, Mark Rutland, Jean Delvare, Jonathan Corbet, Russell King, Kukjin Kim, Krzysztof Kozlowski, Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler, Bartlomiej Zolnierkiewicz, Marek Szyprowski On Tue, 17 Oct 2017 13:58:21 -0700 Guenter Roeck <linux@roeck-us.net> wrote: > On Tue, Oct 17, 2017 at 03:36:31PM -0500, Rob Herring wrote: > > On Thu, Oct 12, 2017 at 02:36:04PM +0200, Maciej Purski wrote: > > > Add optional max expected current property which allows calibrating > > > the ina sensor in order to achieve requested measure scale. Document > > > the changes in Documentation/hwmon/ina2xx. > > > > > > Signed-off-by: Maciej Purski <m.purski@samsung.com> > > > --- > > > Documentation/devicetree/bindings/hwmon/ina2xx.txt | 4 +++- > > > Documentation/hwmon/ina2xx | 3 +++ > > > 2 files changed, 6 insertions(+), 1 deletion(-) > > > > > > diff --git a/Documentation/devicetree/bindings/hwmon/ina2xx.txt b/Documentation/devicetree/bindings/hwmon/ina2xx.txt > > > index 02af0d9..49ef0be 100644 > > > --- a/Documentation/devicetree/bindings/hwmon/ina2xx.txt > > > +++ b/Documentation/devicetree/bindings/hwmon/ina2xx.txt > > > @@ -14,11 +14,13 @@ Optional properties: > > > > > > - shunt-resistor > > > Shunt resistor value in micro-Ohm > > > - > > > +- ti-max-expected-current-microamp > > > + Max expected current value in mA > > > > ti,max-... > > > > The property name is a bit long. Does "expected" add anything? Is there > > a max unexpected current? > > > I am not too happy with it either. To me it suggests that there _can_ be > an unexpected current (why specify a max _expected_ current otherwise ?), > and that unexpected current won't be measurable and thus not reported > because it is ... well, unexpected. After calibration I 'think' this corresponds to the maximum current that the device can measure (it's applying scaling inside to make full use of available range of the register - there are some arguments that there is an optimum value after which we could do better in software). I guess the issue here is that this that we might need to separate the maximum current the device is capable of measuring from what it is currently configured to measure. No idea how to describe that :) Jonathan > > Guenter > > > > Example: > > > > > > ina220@44 { > > > compatible = "ti,ina220"; > > > reg = <0x44>; > > > shunt-resistor = <1000>; > > > + ti-max-expected-current-microamp = <3000>; > > > }; > > > diff --git a/Documentation/hwmon/ina2xx b/Documentation/hwmon/ina2xx > > > index cfd31d9..30620e8 100644 > > > --- a/Documentation/hwmon/ina2xx > > > +++ b/Documentation/hwmon/ina2xx > > > @@ -55,6 +55,9 @@ The shunt value in micro-ohms can be set via platform data or device tree at > > > compile-time or via the shunt_resistor attribute in sysfs at run-time. Please > > > refer to the Documentation/devicetree/bindings/i2c/ina2xx.txt for bindings > > > if the device tree is used. > > > +The max expected current value in miliamp can be set via platform data > > > +or device tree at compile-time or via currX_max attribute in sysfs > > > +at run-time. > > > > > > Additionally ina226 supports update_interval attribute as described in > > > Documentation/hwmon/sysfs-interface. Internally the interval is the sum of > > > -- > > > 2.7.4 > > > > -- > To unsubscribe from this list: send the line "unsubscribe linux-iio" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 12+ messages in thread
[parent not found: <CGME20171012123642eucas1p2878b47147404d6699eb92f9316f7c1b5@eucas1p2.samsung.com>]
[parent not found: <1507811765-31005-1-git-send-email-m.purski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>]
* [PATCH v2 4/4] ARM: dts: Add ti-max-expected-current-microamp properties for ina231 in Odroid XU3 [not found] ` <1507811765-31005-1-git-send-email-m.purski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> @ 2017-10-12 12:36 ` Maciej Purski 0 siblings, 0 replies; 12+ messages in thread From: Maciej Purski @ 2017-10-12 12:36 UTC (permalink / raw) To: devicetree-u79uwXL29TY76Z2rM5mHXA, linux-hwmon-u79uwXL29TY76Z2rM5mHXA, linux-doc-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA, linux-iio-u79uwXL29TY76Z2rM5mHXA Cc: Rob Herring, Mark Rutland, Guenter Roeck, Jean Delvare, Jonathan Corbet, Russell King, Kukjin Kim, Krzysztof Kozlowski, Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler, Bartlomiej Zolnierkiewicz, Marek Szyprowski, Maciej Purski Set max expected current to values required by the documentation, in order to achieve desired precision. Signed-off-by: Maciej Purski <m.purski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> --- arch/arm/boot/dts/exynos5422-odroidxu3.dts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/boot/dts/exynos5422-odroidxu3.dts b/arch/arm/boot/dts/exynos5422-odroidxu3.dts index 9ed6564..bbad001 100644 --- a/arch/arm/boot/dts/exynos5422-odroidxu3.dts +++ b/arch/arm/boot/dts/exynos5422-odroidxu3.dts @@ -28,6 +28,7 @@ compatible = "ti,ina231"; reg = <0x40>; shunt-resistor = <10000>; + ti-max-expected-current-microamp = <9000>; }; /* memory: VDD_MEM */ @@ -35,6 +36,7 @@ compatible = "ti,ina231"; reg = <0x41>; shunt-resistor = <10000>; + ti-max-expected-current-microamp = <3000>; }; /* GPU: VDD_G3D */ @@ -42,6 +44,7 @@ compatible = "ti,ina231"; reg = <0x44>; shunt-resistor = <10000>; + ti-max-expected-current-microamp = <5000>; }; /* A7 cluster: VDD_KFC */ @@ -49,6 +52,7 @@ compatible = "ti,ina231"; reg = <0x45>; shunt-resistor = <10000>; + ti-max-expected-current-microamp = <2000>; }; }; -- 2.7.4 ^ permalink raw reply related [flat|nested] 12+ messages in thread
end of thread, other threads:[~2017-10-18 8:12 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <CGME20171012123623eucas1p18dd41d52069240a3172c0bcec8f63553@eucas1p1.samsung.com> 2017-10-12 12:36 ` [PATCH v2 0/4] Make max expected current configurable for ina2xx drivers Maciej Purski [not found] ` <CGME20171012123632eucas1p1638754631a455ec6ff5f9770f6c33a95@eucas1p1.samsung.com> 2017-10-12 12:36 ` [PATCH v2 1/4] iio: adc: ina2xx: Make max expected current configurable Maciej Purski [not found] ` <CGME20171012123633eucas1p2b76006dfc295beab89de68cbfe8839ad@eucas1p2.samsung.com> 2017-10-12 12:36 ` [PATCH v2 2/4] hwmon: (ina2xx) " Maciej Purski [not found] ` <CGME20171012123635eucas1p1ff9a982db9d541cd0475d44d114ff92a@eucas1p1.samsung.com> 2017-10-12 12:36 ` [PATCH v2 3/4] dt-bindings: hwmon: Add ti-max-expected-current-microamp property to ina2xx Maciej Purski 2017-10-12 12:39 ` Krzysztof Kozlowski [not found] ` <CAJKOXPc1B1uqravtmHrh4eUK5JiQRiZLeoveSMk5qVyF-mK7Kw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2017-10-12 13:00 ` Maciej Purski 2017-10-12 13:55 ` Guenter Roeck [not found] ` <79da3a8b-e885-8a02-cbba-dfd1834450db-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org> 2017-10-12 14:13 ` Maciej Purski 2017-10-17 20:36 ` Rob Herring 2017-10-17 20:58 ` Guenter Roeck 2017-10-18 8:12 ` Jonathan Cameron [not found] ` <CGME20171012123642eucas1p2878b47147404d6699eb92f9316f7c1b5@eucas1p2.samsung.com> [not found] ` <1507811765-31005-1-git-send-email-m.purski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> 2017-10-12 12:36 ` [PATCH v2 4/4] ARM: dts: Add ti-max-expected-current-microamp properties for ina231 in Odroid XU3 Maciej Purski
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).