Skip to content

iio: adc: mt6359: fix scale divisor, request bits, and MT6358 VBAT ratio

Ilia Snezhkov b4-sent linux-arm-kernel linux-iio linux-mediatek lkml 2 versions In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 3 repliesIn review
  2. v13 patches 2 repliesSuperseded

Changes in v2 from the cover letter

- Move the AI coding assistant note below the --- separator in all three patches (per Jonathan Cameron's feedback on v1). No code changes.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3iio: adc: mt6359: divide scale by ADC resolutiondrivers/iio/adc/mt6359-auxadc.c+3 -21 reply
2/3iio: adc: mt6359: fix MT6357 ISENSE/VCDT and MT6358 VCDT request bitsdrivers/iio/adc/mt6359-auxadc.c+3 -31 reply
3/3iio: adc: mt6359: fix MT6358 VBAT impedance resistance ratiodrivers/iio/adc/mt6359-auxadc.c+1 -11 reply

Reviews trailers per patch

1 of 3 patches has a Reviewed-by or Acked-by.

PatchRoman Vivchar
1/3
2/3T-b R-b
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/3] iio: adc: mt6359: fix scale divisor, request bits, and MT6358 VBAT ratio

This short series fixes three bugs in drivers/iio/adc/mt6359-auxadc.c introduced in commit 3587914bf61d ("iio: adc: Add support for MediaTek MT6357/8/9 Auxiliary ADC"):

1. IIO_CHAN_INFO_SCALE omits dividing by (1 << chan->scan_type.realbits), causing processed readings and sysfs scales to be 4096x or 32768x too large. Use IIO_VAL_FRACTIONAL with shifted denominator when denominator > 1, and IIO_VAL_FRACTIONAL_LOG2 otherwise (avoiding division by zero on unpopulated descriptors such as MT6357 VDCXO).
2. MT6357 ISENSE/VCDT and MT6358 VCDT use PMIC_AUXADC_RQST0 bit 0 (BATADC) instead of their hardware request bits (1 and 2).
3. MT6358 VBAT impedance uses r_ratio 7/2 (MT6359) instead of 3/1 (MT6358/MT6366, matching MT6358 BATADC).

Changes in v2:
- Move the AI coding assistant note below the --- separator in all three patches (per Jonathan Cameron's feedback on v1). No code changes.

Found and drafted with an AI coding assistant.

Ilia Snezhkov (3):
iio: adc: mt6359: divide scale by ADC resolution
iio: adc: mt6359: fix MT6357 ISENSE/VCDT and MT6358 VCDT request bits
iio: adc: mt6359: fix MT6358 VBAT impedance resistance ratio

 drivers/iio/adc/mt6359-auxadc.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
Signature · 1 line
2.54.0 (Apple Git-157)