public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Naveen Krishna Chatradhi <ch.naveen@samsung.com>,
	linux-iio@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	dianders@chromium.org, gregkh@linuxfoundation.org,
	naveenkrishna.ch@gmail.com, lars@metafoo.de, cpgs@samsung.com,
	grundler@chromium.org, t.figa@samsung.com
Subject: Re: [PATCH 4/5 v3] iio: exynos_adc: do a soft reset in case of timeout
Date: Wed, 30 Apr 2014 21:47:36 +0100	[thread overview]
Message-ID: <53616168.7010007@kernel.org> (raw)
In-Reply-To: <1398850015-17761-5-git-send-email-ch.naveen@samsung.com>

On 30/04/14 10:26, Naveen Krishna Chatradhi wrote:
> Do a soft reset software if a timeout happens.
> This is applicable only for ADC_V2.
>
> Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
> Reviewed-by: Doug Anderson <dianders@chromium.org>
Applied to the togreg branch of iio.git

Thanks,
> ---
> Changes since v2:
> None
> Changes since v1:
> None
> v0:
> This change is a part of the patch reviewed at https://lkml.org/lkml/2013/11/5/92
>
>   drivers/iio/adc/exynos_adc.c |   50 ++++++++++++++++++++++--------------------
>   1 file changed, 26 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c
> index 939aaf7..eddc58e 100644
> --- a/drivers/iio/adc/exynos_adc.c
> +++ b/drivers/iio/adc/exynos_adc.c
> @@ -112,6 +112,30 @@ static inline unsigned int exynos_adc_get_version(struct platform_device *pdev)
>   	return (unsigned int)match->data;
>   }
>
> +static void exynos_adc_hw_init(struct exynos_adc *info)
> +{
> +	u32 con1, con2;
> +
> +	if (info->version == ADC_V2) {
> +		con1 = ADC_V2_CON1_SOFT_RESET;
> +		writel(con1, ADC_V2_CON1(info->regs));
> +
> +		con2 = ADC_V2_CON2_OSEL | ADC_V2_CON2_ESEL |
> +			ADC_V2_CON2_HIGHF | ADC_V2_CON2_C_TIME(0);
> +		writel(con2, ADC_V2_CON2(info->regs));
> +
> +		/* Enable interrupts */
> +		writel(1, ADC_V2_INT_EN(info->regs));
> +	} else {
> +		/* set default prescaler values and Enable prescaler */
> +		con1 =  ADC_V1_CON_PRSCLV(49) | ADC_V1_CON_PRSCEN;
> +
> +		/* Enable 12-bit ADC resolution */
> +		con1 |= ADC_V1_CON_RES;
> +		writel(con1, ADC_V1_CON(info->regs));
> +	}
> +}
> +
>   static int exynos_read_raw(struct iio_dev *indio_dev,
>   				struct iio_chan_spec const *chan,
>   				int *val,
> @@ -149,6 +173,8 @@ static int exynos_read_raw(struct iio_dev *indio_dev,
>   	timeout = wait_for_completion_timeout
>   			(&info->completion, EXYNOS_ADC_TIMEOUT);
>   	if (timeout == 0) {
> +		dev_warn(&indio_dev->dev, "Conversion timed out! Resetting\n");
> +		exynos_adc_hw_init(info);
>   		ret = -ETIMEDOUT;
>   	} else {
>   		*val = info->value;
> @@ -230,30 +256,6 @@ static int exynos_adc_remove_devices(struct device *dev, void *c)
>   	return 0;
>   }
>
> -static void exynos_adc_hw_init(struct exynos_adc *info)
> -{
> -	u32 con1, con2;
> -
> -	if (info->version == ADC_V2) {
> -		con1 = ADC_V2_CON1_SOFT_RESET;
> -		writel(con1, ADC_V2_CON1(info->regs));
> -
> -		con2 = ADC_V2_CON2_OSEL | ADC_V2_CON2_ESEL |
> -			ADC_V2_CON2_HIGHF | ADC_V2_CON2_C_TIME(0);
> -		writel(con2, ADC_V2_CON2(info->regs));
> -
> -		/* Enable interrupts */
> -		writel(1, ADC_V2_INT_EN(info->regs));
> -	} else {
> -		/* set default prescaler values and Enable prescaler */
> -		con1 =  ADC_V1_CON_PRSCLV(49) | ADC_V1_CON_PRSCEN;
> -
> -		/* Enable 12-bit ADC resolution */
> -		con1 |= ADC_V1_CON_RES;
> -		writel(con1, ADC_V1_CON(info->regs));
> -	}
> -}
> -
>   static int exynos_adc_probe(struct platform_device *pdev)
>   {
>   	struct exynos_adc *info = NULL;
>


  reply	other threads:[~2014-04-30 20:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-30  9:26 [PATCH 0/5 v3] iio: exynos_adc: fix minor nits in the driver Naveen Krishna Chatradhi
2014-04-30  9:26 ` [PATCH 1/5 v3] iio: exynos_adc: use indio_dev->dev structure to handle child nodes Naveen Krishna Chatradhi
2014-04-30 20:43   ` Jonathan Cameron
2014-04-30  9:26 ` [PATCH 2/5 v3] iio: exynos_adc: rearrange clk and regulator enable/disable calls Naveen Krishna Chatradhi
2014-04-30 20:44   ` Jonathan Cameron
2014-04-30  9:26 ` [PATCH 3/5 v3] iio: exynos_adc: reduce timeout and use wait_for_completion_timeout Naveen Krishna Chatradhi
2014-04-30 20:44   ` Jonathan Cameron
2014-04-30  9:26 ` [PATCH 4/5 v3] iio: exynos_adc: do a soft reset in case of timeout Naveen Krishna Chatradhi
2014-04-30 20:47   ` Jonathan Cameron [this message]
2014-04-30  9:26 ` [PATCH 5/5 v3] iio: exynos_adc: do a reinit_completion before the conversion Naveen Krishna Chatradhi
2014-04-30 20:49   ` Jonathan Cameron
2014-04-30 23:23     ` Doug Anderson
2014-05-01  5:48       ` 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=53616168.7010007@kernel.org \
    --to=jic23@kernel.org \
    --cc=ch.naveen@samsung.com \
    --cc=cpgs@samsung.com \
    --cc=dianders@chromium.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=grundler@chromium.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=naveenkrishna.ch@gmail.com \
    --cc=t.figa@samsung.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox