lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <531704DA.5000200@atmel.com>
Date:	Wed, 5 Mar 2014 19:04:58 +0800
From:	Josh Wu <josh.wu@...el.com>
To:	Alexandre Belloni <alexandre.belloni@...e-electrons.com>,
	Jonathan Cameron <jic23@...nel.org>
CC:	<linux-kernel@...r.kernel.org>, <linux-iio@...r.kernel.org>,
	Maxime Ripard <maxime.ripard@...e-electrons.com>,
	Ludovic Desroches <ludovic.desroches@...el.com>
Subject: Re: [PATCH] iio: adc: at91_adc: correct default shtim value

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@...e-electrons.com>

Thanks for the fix and

Acked-by: Josh Wu<josh.wu@...el.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;

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ