Commit c68013f3 authored by Stefan Brüns's avatar Stefan Brüns Committed by Greg Kroah-Hartman

iio: adc: ina2xx: Remove unneeded dummy read to clear CNVR flag

Although the datasheet states the CNVR flag is cleared by reading the
BUS_VOLTAGE register, it is actually cleared by reading any of the
voltage/current/power registers.

The behaviour has been confirmed by TI support:
http://e2e.ti.com/support/amplifiers/current-shunt-monitors/f/931/p/647053/2378282Signed-off-by: default avatarStefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d456d61f
...@@ -705,7 +705,6 @@ static int ina2xx_work_buffer(struct iio_dev *indio_dev) ...@@ -705,7 +705,6 @@ static int ina2xx_work_buffer(struct iio_dev *indio_dev)
int bit, ret, i = 0; int bit, ret, i = 0;
s64 time_a, time_b; s64 time_a, time_b;
unsigned int alert; unsigned int alert;
int cnvr_need_clear = 0;
time_a = iio_get_time_ns(indio_dev); time_a = iio_get_time_ns(indio_dev);
...@@ -730,7 +729,6 @@ static int ina2xx_work_buffer(struct iio_dev *indio_dev) ...@@ -730,7 +729,6 @@ static int ina2xx_work_buffer(struct iio_dev *indio_dev)
ret = regmap_read(chip->regmap, ret = regmap_read(chip->regmap,
INA2XX_BUS_VOLTAGE, &alert); INA2XX_BUS_VOLTAGE, &alert);
alert &= INA219_CNVR; alert &= INA219_CNVR;
cnvr_need_clear = alert;
} }
if (ret < 0) if (ret < 0)
...@@ -752,18 +750,6 @@ static int ina2xx_work_buffer(struct iio_dev *indio_dev) ...@@ -752,18 +750,6 @@ static int ina2xx_work_buffer(struct iio_dev *indio_dev)
return ret; return ret;
data[i++] = val; data[i++] = val;
if (INA2XX_SHUNT_VOLTAGE + bit == INA2XX_POWER)
cnvr_need_clear = 0;
}
/* Dummy read on INA219 power register to clear CNVR flag */
if (cnvr_need_clear && chip->config->chip_id == ina219) {
unsigned int val;
ret = regmap_read(chip->regmap, INA2XX_POWER, &val);
if (ret < 0)
return ret;
} }
time_b = iio_get_time_ns(indio_dev); time_b = iio_get_time_ns(indio_dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment