Skip to content

iio: adc: aspeed: Reserve battery sensing channel for on-demand use

Billy Tsai linux-arm-kernel linux-aspeed linux-iio lkml 3 versions – In review

Get series with b4
b4 am [email protected] change-id 20260313-adc-479b0ab09bae

Versions newest first

  1. v3 Latest4 patches 4 repliesIn review
  2. v23 patches 4 repliesSuperseded
  3. v11 patch 2 repliesSuperseded

Changes in v3 from the cover letter

- Simplify channel mask helper as suggested by Andy
- Use FIELD_MODIFY() when updating ADC channel field instead of open-coded OR
- Move unrelated blank line change to the previous patch
- Replace mdelay(1) with fsleep(1000) since the delay is in sleepable context
- Fix comment typo ("adc" -> "ADC")
- Link to v2: https://lore.kernel.org/r/[email protected]

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4iio: adc: Add battery channel definition for ADCdrivers/iio/adc/aspeed_adc.c+4 -20 replies
2/4iio: adc: Enable multiple consecutive channels based on model datadrivers/iio/adc/aspeed_adc.c+21 -10 replies
3/4iio: adc: aspeed: Replace mdelay() with fsleep() for ADC stabilization delaydrivers/iio/adc/aspeed_adc.c+3 -32 replies
4/4iio: adc: aspeed: Reserve battery sensing channel for on-demand usedrivers/iio/adc/aspeed_adc.c+29 -52 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 0/4] iio: adc: aspeed: Reserve battery sensing channel for on-demand use

For controllers with battery sensing capability (AST2600/AST2700), the last channel uses a different circuit design optimized for battery voltage measurement. This channel should not be enabled by default along with other channels to avoid potential interference and power efficiency issues.

Changes made:
- Introduce aspeed_adc_get_active_channels() to return the number of channels that should be enabled by default
- For battery sensing capable controllers, exclude the last channel from the default channel enable mask
- Enable the battery sensing channel only when explicitly accessed via read_raw()
- Replace hardcoded channel numbers with ASPEED_ADC_BATTERY_CHANNEL macro
- Add helper functions for cleaner channel management

This ensures optimal power efficiency for normal ADC operations while maintaining full functionality when battery sensing is needed.

---
Changes in v3:
- Simplify channel mask helper as suggested by Andy
- Use FIELD_MODIFY() when updating ADC channel field instead of open-coded OR
- Move unrelated blank line change to the previous patch
- Replace mdelay(1) with fsleep(1000) since the delay is in sleepable context
- Fix comment typo ("adc" -> "ADC")
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Split the changes into a series of patches for better clarity and review
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Billy Tsai (4):
iio: adc: Add battery channel definition for ADC
iio: adc: Enable multiple consecutive channels based on model data
iio: adc: aspeed: Replace mdelay() with fsleep() for ADC stabilization delay
iio: adc: aspeed: Reserve battery sensing channel for on-demand use

 drivers/iio/adc/aspeed_adc.c | 68 +++++++++++++++++++++++++++++++++++++-------
 1 file changed, 57 insertions(+), 11 deletions(-)

---
base-commit: 6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f
change-id: 20260313-adc-479b0ab09bae

Best regards,

Signature · 1 line
Billy Tsai <[email protected]>