diff mbox

[v2,5/5] iio: adc: at91-sama5d2_adc: use max sample rate

Message ID 1507703732-29175-6-git-send-email-eugen.hristev@microchip.com (mailing list archive)
State New, archived
Headers show

Commit Message

Eugen Hristev Oct. 11, 2017, 6:35 a.m. UTC
Change driver settings to use maximum sample rate clock.
This is useful to achieve best possible sampling rate
if we use DMA.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
---
 drivers/iio/adc/at91-sama5d2_adc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jonathan Cameron Oct. 15, 2017, 10:28 a.m. UTC | #1
On Wed, 11 Oct 2017 09:35:32 +0300
Eugen Hristev <eugen.hristev@microchip.com> wrote:

> Change driver settings to use maximum sample rate clock.
> This is useful to achieve best possible sampling rate
> if we use DMA.
> 
> Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>

I would normally expect this to have some bearing on the 
noise levels on the measured signals.  All I can find
is a reference to the track time being 15*a single
clock cycle.  We could change this so that it is appropriate
for the currently samping frequency rather than leaving it
as a fixed value.

Jonathan

> ---
>  drivers/iio/adc/at91-sama5d2_adc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c
> index 7e51ecb..b76f88f 100644
> --- a/drivers/iio/adc/at91-sama5d2_adc.c
> +++ b/drivers/iio/adc/at91-sama5d2_adc.c
> @@ -934,7 +934,7 @@ static void at91_adc_hw_init(struct at91_adc_state *st)
>  	at91_adc_writel(st, AT91_SAMA5D2_MR,
>  			AT91_SAMA5D2_MR_TRANSFER(2) | AT91_SAMA5D2_MR_ANACH);
>  
> -	at91_adc_setup_samp_freq(st, st->soc_info.min_sample_rate);
> +	at91_adc_setup_samp_freq(st, st->soc_info.max_sample_rate);
>  }
>  
>  static ssize_t at91_adc_get_fifo_state(struct device *dev,

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eugen Hristev Oct. 18, 2017, 8:49 a.m. UTC | #2
On 15.10.2017 13:28, Jonathan Cameron wrote:
> On Wed, 11 Oct 2017 09:35:32 +0300
> Eugen Hristev <eugen.hristev@microchip.com> wrote:
> 
>> Change driver settings to use maximum sample rate clock.
>> This is useful to achieve best possible sampling rate
>> if we use DMA.
>>
>> Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
> 
> I would normally expect this to have some bearing on the
> noise levels on the measured signals.  All I can find
> is a reference to the track time being 15*a single
> clock cycle.  We could change this so that it is appropriate
> for the currently samping frequency rather than leaving it
> as a fixed value.

Actually this is the startup (default) value. The sampling frequency
can be changed from sysfs.
I will drop this change to let the ADC work with minimum frequency
at startup and user can change it from sysfs if greater speed is
required (as with the watermark).

Thanks !
Eugen
> 
> Jonathan
> 
>> ---
>>   drivers/iio/adc/at91-sama5d2_adc.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c
>> index 7e51ecb..b76f88f 100644
>> --- a/drivers/iio/adc/at91-sama5d2_adc.c
>> +++ b/drivers/iio/adc/at91-sama5d2_adc.c
>> @@ -934,7 +934,7 @@ static void at91_adc_hw_init(struct at91_adc_state *st)
>>   	at91_adc_writel(st, AT91_SAMA5D2_MR,
>>   			AT91_SAMA5D2_MR_TRANSFER(2) | AT91_SAMA5D2_MR_ANACH);
>>   
>> -	at91_adc_setup_samp_freq(st, st->soc_info.min_sample_rate);
>> +	at91_adc_setup_samp_freq(st, st->soc_info.max_sample_rate);
>>   }
>>   
>>   static ssize_t at91_adc_get_fifo_state(struct device *dev,
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c
index 7e51ecb..b76f88f 100644
--- a/drivers/iio/adc/at91-sama5d2_adc.c
+++ b/drivers/iio/adc/at91-sama5d2_adc.c
@@ -934,7 +934,7 @@  static void at91_adc_hw_init(struct at91_adc_state *st)
 	at91_adc_writel(st, AT91_SAMA5D2_MR,
 			AT91_SAMA5D2_MR_TRANSFER(2) | AT91_SAMA5D2_MR_ANACH);
 
-	at91_adc_setup_samp_freq(st, st->soc_info.min_sample_rate);
+	at91_adc_setup_samp_freq(st, st->soc_info.max_sample_rate);
 }
 
 static ssize_t at91_adc_get_fifo_state(struct device *dev,