iio: adc: at91_adc: allow to use full range of startup time

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>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
Jan Leupold 2015-06-17 18:21:36 +02:00 committed by Jonathan Cameron
parent adfa969850
commit 2ab5f39bc7
1 changed files with 4 additions and 4 deletions

View File

@ -182,7 +182,7 @@ struct at91_adc_caps {
u8 ts_pen_detect_sensitivity; u8 ts_pen_detect_sensitivity;
/* startup time calculate function */ /* 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; u8 num_channels;
struct at91_adc_reg_desc registers; struct at91_adc_reg_desc registers;
@ -201,7 +201,7 @@ struct at91_adc_state {
u8 num_channels; u8 num_channels;
void __iomem *reg_base; void __iomem *reg_base;
struct at91_adc_reg_desc *registers; struct at91_adc_reg_desc *registers;
u8 startup_time; u32 startup_time;
u8 sample_hold_time; u8 sample_hold_time;
bool sleep_mode; bool sleep_mode;
struct iio_trigger **trig; struct iio_trigger **trig;
@ -779,7 +779,7 @@ static int at91_adc_of_get_resolution(struct at91_adc_state *st,
return 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 * 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; 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: * For sama5d3x and at91sam9x5, the formula changes to: