Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jan Leupold and committed by
Jonathan Cameron
815983e9 09f4dcc9

+4 -4
+4 -4
drivers/iio/adc/at91_adc.c
··· 182 182 u8 ts_pen_detect_sensitivity; 183 183 184 184 /* startup time calculate function */ 185 - u32 (*calc_startup_ticks)(u8 startup_time, u32 adc_clk_khz); 185 + u32 (*calc_startup_ticks)(u32 startup_time, u32 adc_clk_khz); 186 186 187 187 u8 num_channels; 188 188 struct at91_adc_reg_desc registers; ··· 201 201 u8 num_channels; 202 202 void __iomem *reg_base; 203 203 struct at91_adc_reg_desc *registers; 204 - u8 startup_time; 204 + u32 startup_time; 205 205 u8 sample_hold_time; 206 206 bool sleep_mode; 207 207 struct iio_trigger **trig; ··· 779 779 return ret; 780 780 } 781 781 782 - static u32 calc_startup_ticks_9260(u8 startup_time, u32 adc_clk_khz) 782 + static u32 calc_startup_ticks_9260(u32 startup_time, u32 adc_clk_khz) 783 783 { 784 784 /* 785 785 * Number of ticks needed to cover the startup time of the ADC ··· 790 790 return round_up((startup_time * adc_clk_khz / 1000) - 1, 8) / 8; 791 791 } 792 792 793 - static u32 calc_startup_ticks_9x5(u8 startup_time, u32 adc_clk_khz) 793 + static u32 calc_startup_ticks_9x5(u32 startup_time, u32 adc_clk_khz) 794 794 { 795 795 /* 796 796 * For sama5d3x and at91sam9x5, the formula changes to: