Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752666AbdLQKJd convert rfc822-to-8bit (ORCPT ); Sun, 17 Dec 2017 05:09:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:54476 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751623AbdLQKJ3 (ORCPT ); Sun, 17 Dec 2017 05:09:29 -0500 DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 58C1C218C5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=jic23@kernel.org Date: Sun, 17 Dec 2017 10:09:22 +0000 From: Jonathan Cameron To: Stefan =?UTF-8?B?QnLDvG5z?= Cc: , Peter Meerwald-Stadler , Maciej Purski , , "Andrew F . Davis" , Lars-Peter Clausen , Hartmut Knaack Subject: Re: [PATCH v1 3/7] iio: adc: ina2xx: Remove unneeded dummy read to clear CNVR flag Message-ID: <20171217100922.388ed7a1@archlinux> In-Reply-To: <2569854.02uJhrbl9B@pebbles> References: <20171208174152.30341-1-stefan.bruens@rwth-aachen.de> <1575331.Q2WhDFQurN@pebbles> <20171212201530.3c64d47e@archlinux> <2569854.02uJhrbl9B@pebbles> X-Mailer: Claws Mail 3.15.1-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2559 Lines: 65 On Wed, 13 Dec 2017 00:48:40 +0100 Stefan Brüns wrote: > On Tuesday, December 12, 2017 9:15:30 PM CET Jonathan Cameron wrote: > > On Sun, 10 Dec 2017 21:53:42 +0100 > > > > Stefan Brüns wrote: > > > On Sunday, December 10, 2017 6:27:33 PM CET Jonathan Cameron wrote: > > > > On Fri, 8 Dec 2017 18:41:48 +0100 > > > > > > > > Stefan Brüns wrote: > > > > > 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/64 > > > > > 7053 > > > > > /2378282 > > > > > > > > > > Signed-off-by: Stefan Brüns > > > > > > > > I haven't checked the code thoroughly so there may well be something > > > > stopping it but have you checked the case where the only channel enabled > > > > is > > > > the timestamp? > > > > > > > > Obviously it makes little sense, but IIRC there is nothing in the core > > > > preventing that happening. > > > > > > The timestamp is completely unrelated to the status register, so I fail to > > > understand your question. Can you please clarify? > > > > If you only have a timestamp, the trigger will still fire (I think) > > but you'll do no reading at all from the device. If configured in this, > > admittedly odd, way you should just get a stream of timestamps with no > > data. > > If there are reads depends on the mode - if running asynchronously, it will > just stream out 64 bits of timestamp each interval. In synchronous mode, the > driver will read the status register (low bits of bus voltage register for > INA219, msk register for INA226), which implicitly clears the CNVR flag. > > > > This only removes a redundant read. > > > > The question is whether it is redundant if we have no non timestamp > > registers enabled. > > According to the documentation, INA219 and 226 had to be treated differently. > As it turned out, both actually behave the same way regarding the CNVR flag, > so we just poll the status register, which for both devices clears the flag. Ah, fine then. I thought we were talking about having to read a channel not just the register we are anyway polling for status. Applied to the togreg branch of iio.git. Thanks, Jonathan > > Regards, > > Stefan > >