All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: adc: at91_adc: allow to use full range of startup time
@ 2015-06-17 16:21 ` Nicolas Ferre
  0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Ferre @ 2015-06-17 16:21 UTC (permalink / raw)
  To: Alexandre Belloni, Maxime Ripard, Ludovic Desroches, jic23,
	linux-arm-kernel
  Cc: Josh Wu, leupold, linux-kernel, Nicolas Ferre

From: Jan Leupold <leupold@rsi-elektrotechnik.de>

The DT-Property "atmel,adc-startup-time" is stored in an u8 for a microsecond
value. When trying to increase the value of STARTUP in Register AT91_ADC_MR
some higher values can't be reached.

Change the type in function parameter and private structure field from u8 to
u32.

Signed-off-by: Jan Leupold <leupold@rsi-elektrotechnik.de>
[nicolas.ferre@atmel.com: change commit message, increase u16 to u32 for startup time]
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 drivers/iio/adc/at91_adc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index 8a0eb4a04fb5..7b40925dd4ff 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -182,7 +182,7 @@ struct at91_adc_caps {
 	u8	ts_pen_detect_sensitivity;
 
 	/* startup time calculate function */
-	u32 (*calc_startup_ticks)(u8 startup_time, u32 adc_clk_khz);
+	u32 (*calc_startup_ticks)(u32 startup_time, u32 adc_clk_khz);
 
 	u8	num_channels;
 	struct at91_adc_reg_desc registers;
@@ -201,7 +201,7 @@ struct at91_adc_state {
 	u8			num_channels;
 	void __iomem		*reg_base;
 	struct at91_adc_reg_desc *registers;
-	u8			startup_time;
+	u32			startup_time;
 	u8			sample_hold_time;
 	bool			sleep_mode;
 	struct iio_trigger	**trig;
@@ -779,7 +779,7 @@ ret:
 	return ret;
 }
 
-static u32 calc_startup_ticks_9260(u8 startup_time, u32 adc_clk_khz)
+static u32 calc_startup_ticks_9260(u32 startup_time, u32 adc_clk_khz)
 {
 	/*
 	 * Number of ticks needed to cover the startup time of the ADC
@@ -790,7 +790,7 @@ static u32 calc_startup_ticks_9260(u8 startup_time, u32 adc_clk_khz)
 	return round_up((startup_time * adc_clk_khz / 1000) - 1, 8) / 8;
 }
 
-static u32 calc_startup_ticks_9x5(u8 startup_time, u32 adc_clk_khz)
+static u32 calc_startup_ticks_9x5(u32 startup_time, u32 adc_clk_khz)
 {
 	/*
 	 * For sama5d3x and at91sam9x5, the formula changes to:
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] iio: adc: at91_adc: allow to use full range of startup time
@ 2015-06-17 16:21 ` Nicolas Ferre
  0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Ferre @ 2015-06-17 16:21 UTC (permalink / raw)
  To: linux-arm-kernel

From: Jan Leupold <leupold@rsi-elektrotechnik.de>

The DT-Property "atmel,adc-startup-time" is stored in an u8 for a microsecond
value. When trying to increase the value of STARTUP in Register AT91_ADC_MR
some higher values can't be reached.

Change the type in function parameter and private structure field from u8 to
u32.

Signed-off-by: Jan Leupold <leupold@rsi-elektrotechnik.de>
[nicolas.ferre at atmel.com: change commit message, increase u16 to u32 for startup time]
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 drivers/iio/adc/at91_adc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index 8a0eb4a04fb5..7b40925dd4ff 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -182,7 +182,7 @@ struct at91_adc_caps {
 	u8	ts_pen_detect_sensitivity;
 
 	/* startup time calculate function */
-	u32 (*calc_startup_ticks)(u8 startup_time, u32 adc_clk_khz);
+	u32 (*calc_startup_ticks)(u32 startup_time, u32 adc_clk_khz);
 
 	u8	num_channels;
 	struct at91_adc_reg_desc registers;
@@ -201,7 +201,7 @@ struct at91_adc_state {
 	u8			num_channels;
 	void __iomem		*reg_base;
 	struct at91_adc_reg_desc *registers;
-	u8			startup_time;
+	u32			startup_time;
 	u8			sample_hold_time;
 	bool			sleep_mode;
 	struct iio_trigger	**trig;
@@ -779,7 +779,7 @@ ret:
 	return ret;
 }
 
-static u32 calc_startup_ticks_9260(u8 startup_time, u32 adc_clk_khz)
+static u32 calc_startup_ticks_9260(u32 startup_time, u32 adc_clk_khz)
 {
 	/*
 	 * Number of ticks needed to cover the startup time of the ADC
@@ -790,7 +790,7 @@ static u32 calc_startup_ticks_9260(u8 startup_time, u32 adc_clk_khz)
 	return round_up((startup_time * adc_clk_khz / 1000) - 1, 8) / 8;
 }
 
-static u32 calc_startup_ticks_9x5(u8 startup_time, u32 adc_clk_khz)
+static u32 calc_startup_ticks_9x5(u32 startup_time, u32 adc_clk_khz)
 {
 	/*
 	 * For sama5d3x and at91sam9x5, the formula changes to:
-- 
2.1.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] iio: adc: at91_adc: allow to use full range of startup time
  2015-06-17 16:21 ` Nicolas Ferre
@ 2015-06-18 14:02   ` Alexandre Belloni
  -1 siblings, 0 replies; 6+ messages in thread
From: Alexandre Belloni @ 2015-06-18 14:02 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Maxime Ripard, Ludovic Desroches, jic23, linux-arm-kernel,
	Josh Wu, leupold, linux-kernel

On 17/06/2015 at 18:21:36 +0200, Nicolas Ferre wrote :
> From: Jan Leupold <leupold@rsi-elektrotechnik.de>
> 
> The DT-Property "atmel,adc-startup-time" is stored in an u8 for a microsecond
> value. When trying to increase the value of STARTUP in Register AT91_ADC_MR
> some higher values can't be reached.
> 
> Change the type in function parameter and private structure field from u8 to
> u32.
> 
> Signed-off-by: Jan Leupold <leupold@rsi-elektrotechnik.de>
> [nicolas.ferre@atmel.com: change commit message, increase u16 to u32 for startup time]
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>

> ---
>  drivers/iio/adc/at91_adc.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
> index 8a0eb4a04fb5..7b40925dd4ff 100644
> --- a/drivers/iio/adc/at91_adc.c
> +++ b/drivers/iio/adc/at91_adc.c
> @@ -182,7 +182,7 @@ struct at91_adc_caps {
>  	u8	ts_pen_detect_sensitivity;
>  
>  	/* startup time calculate function */
> -	u32 (*calc_startup_ticks)(u8 startup_time, u32 adc_clk_khz);
> +	u32 (*calc_startup_ticks)(u32 startup_time, u32 adc_clk_khz);
>  
>  	u8	num_channels;
>  	struct at91_adc_reg_desc registers;
> @@ -201,7 +201,7 @@ struct at91_adc_state {
>  	u8			num_channels;
>  	void __iomem		*reg_base;
>  	struct at91_adc_reg_desc *registers;
> -	u8			startup_time;
> +	u32			startup_time;
>  	u8			sample_hold_time;
>  	bool			sleep_mode;
>  	struct iio_trigger	**trig;
> @@ -779,7 +779,7 @@ ret:
>  	return ret;
>  }
>  
> -static u32 calc_startup_ticks_9260(u8 startup_time, u32 adc_clk_khz)
> +static u32 calc_startup_ticks_9260(u32 startup_time, u32 adc_clk_khz)
>  {
>  	/*
>  	 * Number of ticks needed to cover the startup time of the ADC
> @@ -790,7 +790,7 @@ static u32 calc_startup_ticks_9260(u8 startup_time, u32 adc_clk_khz)
>  	return round_up((startup_time * adc_clk_khz / 1000) - 1, 8) / 8;
>  }
>  
> -static u32 calc_startup_ticks_9x5(u8 startup_time, u32 adc_clk_khz)
> +static u32 calc_startup_ticks_9x5(u32 startup_time, u32 adc_clk_khz)
>  {
>  	/*
>  	 * For sama5d3x and at91sam9x5, the formula changes to:
> -- 
> 2.1.3
> 

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] iio: adc: at91_adc: allow to use full range of startup time
@ 2015-06-18 14:02   ` Alexandre Belloni
  0 siblings, 0 replies; 6+ messages in thread
From: Alexandre Belloni @ 2015-06-18 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

On 17/06/2015 at 18:21:36 +0200, Nicolas Ferre wrote :
> From: Jan Leupold <leupold@rsi-elektrotechnik.de>
> 
> The DT-Property "atmel,adc-startup-time" is stored in an u8 for a microsecond
> value. When trying to increase the value of STARTUP in Register AT91_ADC_MR
> some higher values can't be reached.
> 
> Change the type in function parameter and private structure field from u8 to
> u32.
> 
> Signed-off-by: Jan Leupold <leupold@rsi-elektrotechnik.de>
> [nicolas.ferre at atmel.com: change commit message, increase u16 to u32 for startup time]
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>

> ---
>  drivers/iio/adc/at91_adc.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
> index 8a0eb4a04fb5..7b40925dd4ff 100644
> --- a/drivers/iio/adc/at91_adc.c
> +++ b/drivers/iio/adc/at91_adc.c
> @@ -182,7 +182,7 @@ struct at91_adc_caps {
>  	u8	ts_pen_detect_sensitivity;
>  
>  	/* startup time calculate function */
> -	u32 (*calc_startup_ticks)(u8 startup_time, u32 adc_clk_khz);
> +	u32 (*calc_startup_ticks)(u32 startup_time, u32 adc_clk_khz);
>  
>  	u8	num_channels;
>  	struct at91_adc_reg_desc registers;
> @@ -201,7 +201,7 @@ struct at91_adc_state {
>  	u8			num_channels;
>  	void __iomem		*reg_base;
>  	struct at91_adc_reg_desc *registers;
> -	u8			startup_time;
> +	u32			startup_time;
>  	u8			sample_hold_time;
>  	bool			sleep_mode;
>  	struct iio_trigger	**trig;
> @@ -779,7 +779,7 @@ ret:
>  	return ret;
>  }
>  
> -static u32 calc_startup_ticks_9260(u8 startup_time, u32 adc_clk_khz)
> +static u32 calc_startup_ticks_9260(u32 startup_time, u32 adc_clk_khz)
>  {
>  	/*
>  	 * Number of ticks needed to cover the startup time of the ADC
> @@ -790,7 +790,7 @@ static u32 calc_startup_ticks_9260(u8 startup_time, u32 adc_clk_khz)
>  	return round_up((startup_time * adc_clk_khz / 1000) - 1, 8) / 8;
>  }
>  
> -static u32 calc_startup_ticks_9x5(u8 startup_time, u32 adc_clk_khz)
> +static u32 calc_startup_ticks_9x5(u32 startup_time, u32 adc_clk_khz)
>  {
>  	/*
>  	 * For sama5d3x and at91sam9x5, the formula changes to:
> -- 
> 2.1.3
> 

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] iio: adc: at91_adc: allow to use full range of startup time
  2015-06-18 14:02   ` Alexandre Belloni
@ 2015-06-21 13:07     ` Jonathan Cameron
  -1 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2015-06-21 13:07 UTC (permalink / raw)
  To: Alexandre Belloni, Nicolas Ferre
  Cc: Maxime Ripard, Ludovic Desroches, linux-arm-kernel, Josh Wu,
	leupold, linux-kernel

On 18/06/15 15:02, Alexandre Belloni wrote:
> On 17/06/2015 at 18:21:36 +0200, Nicolas Ferre wrote :
>> From: Jan Leupold <leupold@rsi-elektrotechnik.de>
>>
>> The DT-Property "atmel,adc-startup-time" is stored in an u8 for a microsecond
>> value. When trying to increase the value of STARTUP in Register AT91_ADC_MR
>> some higher values can't be reached.
>>
>> Change the type in function parameter and private structure field from u8 to
>> u32.
>>
>> Signed-off-by: Jan Leupold <leupold@rsi-elektrotechnik.de>
>> [nicolas.ferre@atmel.com: change commit message, increase u16 to u32 for startup time]
>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Applied to the fixes-togreg branch of iio.git and marked for stable.
Probably won't now go upstream until post merge window.

Thanks,

Jonathan
> 
>> ---
>>  drivers/iio/adc/at91_adc.c | 8 ++++----
>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
>> index 8a0eb4a04fb5..7b40925dd4ff 100644
>> --- a/drivers/iio/adc/at91_adc.c
>> +++ b/drivers/iio/adc/at91_adc.c
>> @@ -182,7 +182,7 @@ struct at91_adc_caps {
>>  	u8	ts_pen_detect_sensitivity;
>>  
>>  	/* startup time calculate function */
>> -	u32 (*calc_startup_ticks)(u8 startup_time, u32 adc_clk_khz);
>> +	u32 (*calc_startup_ticks)(u32 startup_time, u32 adc_clk_khz);
>>  
>>  	u8	num_channels;
>>  	struct at91_adc_reg_desc registers;
>> @@ -201,7 +201,7 @@ struct at91_adc_state {
>>  	u8			num_channels;
>>  	void __iomem		*reg_base;
>>  	struct at91_adc_reg_desc *registers;
>> -	u8			startup_time;
>> +	u32			startup_time;
>>  	u8			sample_hold_time;
>>  	bool			sleep_mode;
>>  	struct iio_trigger	**trig;
>> @@ -779,7 +779,7 @@ ret:Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
>>  	return ret;
>>  }
>>  
>> -static u32 calc_startup_ticks_9260(u8 startup_time, u32 adc_clk_khz)
>> +static u32 calc_startup_ticks_9260(u32 startup_time, u32 adc_clk_khz)
>>  {
>>  	/*
>>  	 * Number of ticks needed to cover the startup time of the ADC
>> @@ -790,7 +790,7 @@ static u32 calc_startup_ticks_9260(u8 startup_time, u32 adc_clk_khz)
>>  	return round_up((startup_time * adc_clk_khz / 1000) - 1, 8) / 8;
>>  }
>>  
>> -static u32 calc_startup_ticks_9x5(u8 startup_time, u32 adc_clk_khz)
>> +static u32 calc_startup_ticks_9x5(u32 startup_time, u32 adc_clk_khz)
>>  {
>>  	/*
>>  	 * For sama5d3x and at91sam9x5, the formula changes to:
>> -- 
>> 2.1.3
>>
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] iio: adc: at91_adc: allow to use full range of startup time
@ 2015-06-21 13:07     ` Jonathan Cameron
  0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2015-06-21 13:07 UTC (permalink / raw)
  To: linux-arm-kernel

On 18/06/15 15:02, Alexandre Belloni wrote:
> On 17/06/2015 at 18:21:36 +0200, Nicolas Ferre wrote :
>> From: Jan Leupold <leupold@rsi-elektrotechnik.de>
>>
>> The DT-Property "atmel,adc-startup-time" is stored in an u8 for a microsecond
>> value. When trying to increase the value of STARTUP in Register AT91_ADC_MR
>> some higher values can't be reached.
>>
>> Change the type in function parameter and private structure field from u8 to
>> u32.
>>
>> Signed-off-by: Jan Leupold <leupold@rsi-elektrotechnik.de>
>> [nicolas.ferre at atmel.com: change commit message, increase u16 to u32 for startup time]
>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Applied to the fixes-togreg branch of iio.git and marked for stable.
Probably won't now go upstream until post merge window.

Thanks,

Jonathan
> 
>> ---
>>  drivers/iio/adc/at91_adc.c | 8 ++++----
>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
>> index 8a0eb4a04fb5..7b40925dd4ff 100644
>> --- a/drivers/iio/adc/at91_adc.c
>> +++ b/drivers/iio/adc/at91_adc.c
>> @@ -182,7 +182,7 @@ struct at91_adc_caps {
>>  	u8	ts_pen_detect_sensitivity;
>>  
>>  	/* startup time calculate function */
>> -	u32 (*calc_startup_ticks)(u8 startup_time, u32 adc_clk_khz);
>> +	u32 (*calc_startup_ticks)(u32 startup_time, u32 adc_clk_khz);
>>  
>>  	u8	num_channels;
>>  	struct at91_adc_reg_desc registers;
>> @@ -201,7 +201,7 @@ struct at91_adc_state {
>>  	u8			num_channels;
>>  	void __iomem		*reg_base;
>>  	struct at91_adc_reg_desc *registers;
>> -	u8			startup_time;
>> +	u32			startup_time;
>>  	u8			sample_hold_time;
>>  	bool			sleep_mode;
>>  	struct iio_trigger	**trig;
>> @@ -779,7 +779,7 @@ ret:Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
>>  	return ret;
>>  }
>>  
>> -static u32 calc_startup_ticks_9260(u8 startup_time, u32 adc_clk_khz)
>> +static u32 calc_startup_ticks_9260(u32 startup_time, u32 adc_clk_khz)
>>  {
>>  	/*
>>  	 * Number of ticks needed to cover the startup time of the ADC
>> @@ -790,7 +790,7 @@ static u32 calc_startup_ticks_9260(u8 startup_time, u32 adc_clk_khz)
>>  	return round_up((startup_time * adc_clk_khz / 1000) - 1, 8) / 8;
>>  }
>>  
>> -static u32 calc_startup_ticks_9x5(u8 startup_time, u32 adc_clk_khz)
>> +static u32 calc_startup_ticks_9x5(u32 startup_time, u32 adc_clk_khz)
>>  {
>>  	/*
>>  	 * For sama5d3x and at91sam9x5, the formula changes to:
>> -- 
>> 2.1.3
>>
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-06-21 13:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-17 16:21 [PATCH] iio: adc: at91_adc: allow to use full range of startup time Nicolas Ferre
2015-06-17 16:21 ` Nicolas Ferre
2015-06-18 14:02 ` Alexandre Belloni
2015-06-18 14:02   ` Alexandre Belloni
2015-06-21 13:07   ` Jonathan Cameron
2015-06-21 13:07     ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.