From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753150AbcGZCwJ (ORCPT ); Mon, 25 Jul 2016 22:52:09 -0400 Received: from regular1.263xmail.com ([211.150.99.140]:35930 "EHLO regular1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752630AbcGZCwG (ORCPT ); Mon, 25 Jul 2016 22:52:06 -0400 X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 X-ADDR-CHECKED: 0 X-RL-SENDER: wxt@rock-chips.com X-FST-TO: linux@roeck-us.net X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: wxt@rock-chips.com X-UNIQUE-TAG: <9dad1b954409abb4cba6a21ecb0e6ccb> X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 Message-ID: <5796D036.1060101@rock-chips.com> Date: Tue, 26 Jul 2016 10:51:34 +0800 From: Caesar Wang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: Guenter Roeck , Jonathan Cameron , Heiko Stuebner CC: linux-iio@vger.kernel.org, dianders@chromium.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, Caesar Wang Subject: Re: [PATCH] iio: adc: rockchip_saradc: Explicitly disable ADC on probe References: <1469475540-26855-1-git-send-email-linux@roeck-us.net> In-Reply-To: <1469475540-26855-1-git-send-email-linux@roeck-us.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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(); ... } - Caesar > + > platform_set_drvdata(pdev, indio_dev); > > indio_dev->name = dev_name(&pdev->dev); -- caesar wang | software engineer | wxt@rock-chip.com