All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Stefan Brüns" <stefan.bruens@rwth-aachen.de>
To: <linux-iio@vger.kernel.org>
Cc: "Peter Meerwald-Stadler" <pmeerw@pmeerw.net>,
	"Stefan Brüns" <stefan.bruens@rwth-aachen.de>,
	"Maciej Purski" <m.purski@samsung.com>,
	linux-kernel@vger.kernel.org, "Andrew F . Davis" <afd@ti.com>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"Hartmut Knaack" <knaack.h@gmx.de>
Subject: [PATCH v2 3/7] iio: adc: ina2xx: Remove unneeded dummy read to clear CNVR flag
Date: Thu, 21 Dec 2017 19:31:34 +0100	[thread overview]
Message-ID: <a2462dde-0ef0-4e43-8342-6a7521b6f96f@rwthex-w2-a.rwth-ad.de> (raw)
In-Reply-To: <20171221183138.361-1-stefan.bruens@rwth-aachen.de>

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/2378282

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
---

Changes in v2: None

 drivers/iio/adc/ina2xx-adc.c | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/drivers/iio/adc/ina2xx-adc.c b/drivers/iio/adc/ina2xx-adc.c
index 8c8120406f52..b027d485398b 100644
--- a/drivers/iio/adc/ina2xx-adc.c
+++ b/drivers/iio/adc/ina2xx-adc.c
@@ -705,7 +705,6 @@ static int ina2xx_work_buffer(struct iio_dev *indio_dev)
 	int bit, ret, i = 0;
 	s64 time_a, time_b;
 	unsigned int alert;
-	int cnvr_need_clear = 0;
 
 	time_a = iio_get_time_ns(indio_dev);
 
@@ -730,7 +729,6 @@ static int ina2xx_work_buffer(struct iio_dev *indio_dev)
 				ret = regmap_read(chip->regmap,
 						  INA2XX_BUS_VOLTAGE, &alert);
 				alert &= INA219_CNVR;
-				cnvr_need_clear = alert;
 			}
 
 			if (ret < 0)
@@ -752,18 +750,6 @@ static int ina2xx_work_buffer(struct iio_dev *indio_dev)
 			return ret;
 
 		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);
-- 
2.15.1

  parent reply	other threads:[~2017-12-21 18:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20171221183138.361-1-stefan.bruens@rwth-aachen.de>
2017-12-21 18:31 ` [PATCH v2 1/7] iio: adc: ina2xx: Remove bogus cast for data argument Stefan Brüns
2017-12-29 17:46   ` Jonathan Cameron
2017-12-21 18:31 ` [PATCH v2 2/7] iio: adc: ina2xx: Clarify size requirement for data buffer Stefan Brüns
2017-12-21 18:31 ` Stefan Brüns [this message]
2017-12-21 18:31 ` [PATCH v2 4/7] iio: adc: ina2xx: Do not udelay for several seconds Stefan Brüns
2017-12-21 18:31 ` [PATCH v2 5/7] iio: adc: ina2xx: Use a monotonic clock for delay calculation Stefan Brüns
2017-12-29 17:48   ` Jonathan Cameron
2017-12-31 19:55     ` [PATCH v3 " Stefan Brüns
2018-01-01  1:24     ` [PATCH v4 " Stefan Brüns
2018-01-01  9:30       ` Jonathan Cameron
2017-12-21 18:31 ` [PATCH v2 6/7] iio: adc: ina2xx: Align timestamp with conversion ready flag Stefan Brüns
2017-12-29 17:49   ` Jonathan Cameron
2017-12-21 18:31 ` [PATCH v2 7/7] iio: adc: ina2xx: Actually align the loop with the " Stefan Brüns
2017-12-29 17:52   ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a2462dde-0ef0-4e43-8342-6a7521b6f96f@rwthex-w2-a.rwth-ad.de \
    --to=stefan.bruens@rwth-aachen.de \
    --cc=afd@ti.com \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.purski@samsung.com \
    --cc=pmeerw@pmeerw.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.