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

Configure Feed

Select the types of activity you want to include in your feed.

iio: adc: aspeed: Replace mdelay() with fsleep() for ADC stabilization delay

The ADC stabilization delays in compensation mode and battery sensing
mode do not require atomic context. Using mdelay() here results in
unnecessary busy waiting.

Replace mdelay(1) with fsleep(1000) to allow the scheduler to run other
tasks while waiting for the ADC to stabilize.

Also fix a minor typo in the comment ("adc" -> "ADC").

Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Billy Tsai and committed by
Jonathan Cameron
66ab53c2 9ee1c3be

+3 -3
+3 -3
drivers/iio/adc/aspeed_adc.c
··· 259 259 * After enable compensating sensing mode need to wait some time for ADC stable 260 260 * Experiment result is 1ms. 261 261 */ 262 - mdelay(1); 262 + fsleep(1000); 263 263 264 264 for (index = 0; index < 16; index++) { 265 265 /* ··· 314 314 ASPEED_ADC_BAT_SENSING_ENABLE, 315 315 data->base + ASPEED_REG_ENGINE_CONTROL); 316 316 /* 317 - * After enable battery sensing mode need to wait some time for adc stable 317 + * After enable battery sensing mode need to wait some time for ADC stable 318 318 * Experiment result is 1ms. 319 319 */ 320 - mdelay(1); 320 + fsleep(1000); 321 321 *val = readw(data->base + chan->address); 322 322 *val = (*val * data->battery_mode_gain.mult) / 323 323 data->battery_mode_gain.div;