summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBilly Tsai <billy_tsai@aspeedtech.com>2026-03-20 08:46:37 +0300
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2026-03-21 18:49:16 +0300
commit66ab53c286989634acaa2c4a5703c0f647cb9aa3 (patch)
tree0536d905e720c42aeeeb9c246b4a72263d5cb449
parent9ee1c3be164de16bab382197202ddef8ae020433 (diff)
downloadlinux-66ab53c286989634acaa2c4a5703c0f647cb9aa3.tar.xz
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>
-rw-r--r--drivers/iio/adc/aspeed_adc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/iio/adc/aspeed_adc.c b/drivers/iio/adc/aspeed_adc.c
index 3ff24474f394..a1a6296d3003 100644
--- a/drivers/iio/adc/aspeed_adc.c
+++ b/drivers/iio/adc/aspeed_adc.c
@@ -259,7 +259,7 @@ static int aspeed_adc_compensation(struct iio_dev *indio_dev)
* After enable compensating sensing mode need to wait some time for ADC stable
* Experiment result is 1ms.
*/
- mdelay(1);
+ fsleep(1000);
for (index = 0; index < 16; index++) {
/*
@@ -314,10 +314,10 @@ static int aspeed_adc_read_raw(struct iio_dev *indio_dev,
ASPEED_ADC_BAT_SENSING_ENABLE,
data->base + ASPEED_REG_ENGINE_CONTROL);
/*
- * After enable battery sensing mode need to wait some time for adc stable
+ * After enable battery sensing mode need to wait some time for ADC stable
* Experiment result is 1ms.
*/
- mdelay(1);
+ fsleep(1000);
*val = readw(data->base + chan->address);
*val = (*val * data->battery_mode_gain.mult) /
data->battery_mode_gain.div;