Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1463138

Re: [PATCH] iio: adc: rockchip_saradc: Explicitly disable ADC on probe

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Guenter Roeck <linux@roeck-us.net>
Newsgroups linux.kernel
Subject Re: [PATCH] iio: adc: rockchip_saradc: Explicitly disable ADC on probe
Date Mon, 15 Aug 2016 22:00:01 +0200
Message-ID <s6wdb-1rf-1@gated-at.bofh.it> (permalink)
References <rYTTj-60-3@gated-at.bofh.it> <rZ0L7-4KQ-3@gated-at.bofh.it> <rZ1e9-59Z-1@gated-at.bofh.it> <s6uuJ-vA-17@gated-at.bofh.it>
X-Original-To Jonathan Cameron <jic23@kernel.org>
Dkim-Signature v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=roeck-us.net; s=default; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=sYHGqOEtqlDo0a7purX7PLwdq1jyQStNrNiB5Z1Sxww=; b=Hd3mLzvq4vwpSh00LXg/qD5eaR dlovynOTSOkW9Fa4ENJ95O3/XpDZeHh2DzLt1GBIEyBe9AP9HRT8ASblc1TKJnQkrftPJLWf0jLUv OVe8Nuxr90xfDF+uR89oHR3MRFZkMIhY5jHxhOXtqSivAp4gyhO0YlQLoyw2wYiWfWuVOyQUEbG0s mfw7no5kLCRXgyJM0awMszwTWXn/YUBOC0/p/0UxqKwbbybEGVyhndmkyeT2SlyjTxXlVnrKf7IiG xkWU88HZiEPCk3O9B0GgJmmEhIuI02gtOe2QvMNFKnj3YOQrwpxViXP26aoJcpJggOEX6VtzImdxW LQEEPvEQ==;
MIME-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Disposition inline
Content-Transfer-Encoding 8bit
User-Agent Mutt/1.5.23 (2014-03-12)
X-Authenticated_Sender guenter@roeck-us.net
X-Outgoing-Spam-Status No, score=-1.0
X-Antiabuse This header was added to track abuse, please include it with any abuse report
X-Antiabuse Primary Hostname - bh-25.webhostbox.net
X-Antiabuse Original Domain - vger.kernel.org
X-Antiabuse Originator/Caller UID/GID - [47 12] / [47 12]
X-Antiabuse Sender Address Domain - roeck-us.net
X-Get-Message-Sender-Via bh-25.webhostbox.net: authenticated_id: guenter@roeck-us.net
X-Authenticated-Sender bh-25.webhostbox.net: guenter@roeck-us.net
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 73
Organization linux.* mail to news gateway
X-Original-Cc Caesar Wang <wxt@rock-chips.com>, Heiko Stuebner <heiko@sntech.de>, linux-iio@vger.kernel.org, dianders@chromium.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org
X-Original-Date Mon, 15 Aug 2016 12:52:29 -0700
X-Original-Message-ID <20160815195229.GB4400@roeck-us.net>
X-Original-References <1469475540-26855-1-git-send-email-linux@roeck-us.net> <5796D036.1060101@rock-chips.com> <5796D792.4080407@roeck-us.net> <8ebf4c53-21e2-0220-1756-beb57af32304@kernel.org>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1463138

Show key headers only | View raw


Hi Jonathan,

On Mon, Aug 15, 2016 at 07:04:31PM +0100, Jonathan Cameron wrote:
> On 26/07/16 04:22, Guenter Roeck wrote:
> > On 07/25/2016 07:51 PM, Caesar Wang wrote:
> >> Hi Guenter,
> >>
> >> Thanks for fixing it.
> >>
> >> On 2016年07月26日 03:39, Guenter Roeck wrote:
> >>> If the ADC is read for the first time, the caller gets a timeout error,
> >>> and the kernel log shows
> >>>
> >>> read channel() error: -110
> >>>
> >>> The ADC may be enabled on boot, and needs to be explicitly disabled
> >>> for a read sequence to work (otherwise there is no completion interrupt).
> >>> Disaple it explicitly in the probe function.
> >>>
> >>> Fixes: 44d6f2ef94f9 ("iio: adc: add driver for Rockchip saradc")
> >>> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> >>> ---
> >>>   drivers/iio/adc/rockchip_saradc.c | 3 +++
> >>>   1 file changed, 3 insertions(+)
> >>>
> >>> diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c
> >>> index f9ad6c2d6821..6aa3271d86b5 100644
> >>> --- a/drivers/iio/adc/rockchip_saradc.c
> >>> +++ b/drivers/iio/adc/rockchip_saradc.c
> >>> @@ -280,6 +280,9 @@ static int rockchip_saradc_probe(struct platform_device *pdev)
> >>>           goto err_pclk;
> >>>       }
> >>> +    /* Make sure ADC is disabled */
> >>> +    writel_relaxed(0, info->regs + SARADC_CTRL);
> >>
> >> I think we should reset the saradc controller.
> >> Since make sure the reset value is 0 and loader-->kernel may even cause harm, as my experience on tsadc. (drivers/thermal/rockchip_thermal.c)
> >>
> >>
> >> e.g.:
> >> /**
> >> * Reset SARADC Controller, reset all saradc registers.
> >> */
> >> static void rockchip_saradc_reset_controller(struct reset_control *reset)
> >> {
> >> reset_control_assert(reset);
> >> usleep_range(10, 20);
> >> reset_control_deassert(reset);
> >> }
> >>
> >> ..probe()
> >> {
> >> ...
> >> rockchip_saradc_reset_controller();
> >> ...
> >> }
> >>
> > 
> > Ok, I'll give it a try.
> > 
> > Guenter
> Could you confirm if this patch is superseded by that
> change or not?

Yes, that is correct. The version using the reset has been applied to
chromeos-4.4 [1] with commit 86aeb7c3f ("FROMLIST: iio: adc: rockchip_saradc:
reset saradc controller before programming it").

Thanks,
Guenter

---
[1] https://chromium.googlesource.com/chromiumos/third_party/kernel

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Re: [PATCH] iio: adc: rockchip_saradc: Explicitly disable ADC on  probe Jonathan Cameron <jic23@kernel.org> - 2016-08-15 20:10 +0200
  Re: [PATCH] iio: adc: rockchip_saradc: Explicitly disable ADC on  probe Guenter Roeck <linux@roeck-us.net> - 2016-08-15 22:00 +0200

csiph-web