From: Josh Wu <josh.wu@atmel.com>
To: Alexandre Belloni <alexandre.belloni@free-electrons.com>,
Jonathan Cameron <jic23@kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <linux-iio@vger.kernel.org>,
Maxime Ripard <maxime.ripard@free-electrons.com>,
Ludovic Desroches <ludovic.desroches@atmel.com>
Subject: Re: [PATCH] iio: adc: at91_adc: correct default shtim value
Date: Wed, 5 Mar 2014 19:04:58 +0800 [thread overview]
Message-ID: <531704DA.5000200@atmel.com> (raw)
In-Reply-To: <1393870024-20704-1-git-send-email-alexandre.belloni@free-electrons.com>
Hi, Alexandre
On 3/4/2014 2:07 AM, Alexandre Belloni wrote:
> When sample_hold_time is zero (this is the case when DT is not used or if
> atmel,adc-sample-hold-time is omitted), then the calculated shtim is large.
>
> Make that 0, which is the default for that register and the ADC will then use a
> sane value of 2/ADCCLK or 1/ADCCLK depending on the version.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Thanks for the fix and
Acked-by: Josh Wu<josh.wu@atmel.com>
Best Regards,
Josh Wu
> ---
> drivers/iio/adc/at91_adc.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
> index 5b1aa027c034..0b103f905607 100644
> --- a/drivers/iio/adc/at91_adc.c
> +++ b/drivers/iio/adc/at91_adc.c
> @@ -1004,8 +1004,11 @@ static int at91_adc_probe(struct platform_device *pdev)
> * the best converted final value between two channels selection
> * The formula thus is : Sample and Hold Time = (shtim + 1) / ADCClock
> */
> - shtim = round_up((st->sample_hold_time * adc_clk_khz /
> - 1000) - 1, 1);
> + if (st->sample_hold_time > 0)
> + shtim = round_up((st->sample_hold_time * adc_clk_khz / 1000)
> + - 1, 1);
> + else
> + shtim = 0;
>
> reg = AT91_ADC_PRESCAL_(prsc) & st->registers->mr_prescal_mask;
> reg |= AT91_ADC_STARTUP_(ticks) & st->registers->mr_startup_mask;
next prev parent reply other threads:[~2014-03-05 11:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-03 18:07 [PATCH] iio: adc: at91_adc: correct default shtim value Alexandre Belloni
2014-03-05 11:04 ` Josh Wu [this message]
2014-03-15 16:34 ` Jonathan Cameron
2014-03-15 21:21 ` Alexandre Belloni
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=531704DA.5000200@atmel.com \
--to=josh.wu@atmel.com \
--cc=alexandre.belloni@free-electrons.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ludovic.desroches@atmel.com \
--cc=maxime.ripard@free-electrons.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;
as well as URLs for NNTP newsgroup(s).