Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1449771 > unrolled thread
| Started by | Guenter Roeck <linux@roeck-us.net> |
|---|---|
| First post | 2016-07-25 21:40 +0200 |
| Last post | 2016-07-26 08:50 +0200 |
| Articles | 5 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH] iio: adc: rockchip_saradc: Explicitly disable ADC on probe Guenter Roeck <linux@roeck-us.net> - 2016-07-25 21:40 +0200
Re: [PATCH] iio: adc: rockchip_saradc: Explicitly disable ADC on probe Heiko Stübner <heiko@sntech.de> - 2016-07-25 21:50 +0200
Re: [PATCH] iio: adc: rockchip_saradc: Explicitly disable ADC on probe Caesar Wang <wxt@rock-chips.com> - 2016-07-26 05:00 +0200
Re: [PATCH] iio: adc: rockchip_saradc: Explicitly disable ADC on probe Guenter Roeck <linux@roeck-us.net> - 2016-07-26 05:30 +0200
Re: [PATCH] iio: adc: rockchip_saradc: Explicitly disable ADC on probe Caesar Wang <wxt@rock-chips.com> - 2016-07-26 08:50 +0200
| From | Guenter Roeck <linux@roeck-us.net> |
|---|---|
| Date | 2016-07-25 21:40 +0200 |
| Subject | [PATCH] iio: adc: rockchip_saradc: Explicitly disable ADC on probe |
| Message-ID | <rYTTj-60-3@gated-at.bofh.it> |
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);
+
platform_set_drvdata(pdev, indio_dev);
indio_dev->name = dev_name(&pdev->dev);
--
2.5.0
[toc] | [next] | [standalone]
| From | Heiko Stübner <heiko@sntech.de> |
|---|---|
| Date | 2016-07-25 21:50 +0200 |
| Message-ID | <rYU30-ak-17@gated-at.bofh.it> |
| In reply to | #1449771 |
Am Montag, 25. Juli 2016, 12:39:00 schrieb Guenter Roeck:
> 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>
in my tests I hadn't notices that issue before, but that is likely because the
bootloaders I had didn't enable the saradc. Anyway, that looks definitly sane,
so
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
[toc] | [prev] | [next] | [standalone]
| From | Caesar Wang <wxt@rock-chips.com> |
|---|---|
| Date | 2016-07-26 05:00 +0200 |
| Subject | Re: [PATCH] iio: adc: rockchip_saradc: Explicitly disable ADC on probe |
| Message-ID | <rZ0L7-4KQ-3@gated-at.bofh.it> |
| In reply to | #1449771 |
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();
...
}
-
Caesar
> +
> platform_set_drvdata(pdev, indio_dev);
>
> indio_dev->name = dev_name(&pdev->dev);
--
caesar wang | software engineer | wxt@rock-chip.com
[toc] | [prev] | [next] | [standalone]
| From | Guenter Roeck <linux@roeck-us.net> |
|---|---|
| Date | 2016-07-26 05:30 +0200 |
| Subject | Re: [PATCH] iio: adc: rockchip_saradc: Explicitly disable ADC on probe |
| Message-ID | <rZ1e9-59Z-1@gated-at.bofh.it> |
| In reply to | #1450332 |
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
>
> -
> Caesar
>
>> +
>> platform_set_drvdata(pdev, indio_dev);
>> indio_dev->name = dev_name(&pdev->dev);
>
>
[toc] | [prev] | [next] | [standalone]
| From | Caesar Wang <wxt@rock-chips.com> |
|---|---|
| Date | 2016-07-26 08:50 +0200 |
| Subject | Re: [PATCH] iio: adc: rockchip_saradc: Explicitly disable ADC on probe |
| Message-ID | <rZ4lH-744-7@gated-at.bofh.it> |
| In reply to | #1450349 |
On 2016年07月26日 11: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.
>
I posted it on https://patchwork.kernel.org/patch/9247661/
> Guenter
>
>>
>> -
>> Caesar
>>
>>> +
>>> platform_set_drvdata(pdev, indio_dev);
>>> indio_dev->name = dev_name(&pdev->dev);
>>
>>
>
>
> _______________________________________________
> Linux-rockchip mailing list
> Linux-rockchip@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-rockchip
--
caesar wang | software engineer | wxt@rock-chip.com
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web