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: mt6359: Move reference voltage to platform data

In preparation to add support for new PMICs, add a `vref_mv`
member to struct mtk_pmic_auxadc_info and use it in place of
the AUXADC_VOLT_FULL definition.

As a consequence, the definition was also removed.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250703141146.171431-5-angelogioacchino.delregno@collabora.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

AngeloGioacchino Del Regno and committed by
Jonathan Cameron
dbcbed76 f8bb423f

+6 -2
+6 -2
drivers/iio/adc/mt6359-auxadc.c
··· 28 28 #define AUXADC_AVG_TIME_US 10 29 29 #define AUXADC_POLL_DELAY_US 100 30 30 #define AUXADC_TIMEOUT_US 32000 31 - #define AUXADC_VOLT_FULL 1800 32 31 #define IMP_STOP_DELAY_US 150 33 32 #define IMP_POLL_DELAY_US 1000 34 33 ··· 122 123 * @desc: PMIC AUXADC channel data 123 124 * @regs: List of PMIC specific registers 124 125 * @sec_unlock_key: Security unlock key for HK_TOP writes 126 + * @vref_mV: AUXADC Reference Voltage (VREF) in millivolts 125 127 * @imp_adc_num: ADC channel for battery impedance readings 126 128 * @read_imp: Callback to read impedance channels 127 129 */ ··· 133 133 const struct mtk_pmic_auxadc_chan *desc; 134 134 const u16 *regs; 135 135 u16 sec_unlock_key; 136 + u32 vref_mV; 136 137 u8 imp_adc_num; 137 138 int (*read_imp)(struct mt6359_auxadc *adc_dev, 138 139 const struct iio_chan_spec *chan, int *vbat, int *ibat); ··· 417 416 .regs = mt6357_auxadc_regs, 418 417 .imp_adc_num = MT6357_IMP_ADC_NUM, 419 418 .read_imp = mt6358_read_imp, 419 + .vref_mV = 1800, 420 420 }; 421 421 422 422 static const struct mtk_pmic_auxadc_info mt6358_chip_info = { ··· 428 426 .regs = mt6358_auxadc_regs, 429 427 .imp_adc_num = MT6358_IMP_ADC_NUM, 430 428 .read_imp = mt6358_read_imp, 429 + .vref_mV = 1800, 431 430 }; 432 431 433 432 static const struct mtk_pmic_auxadc_info mt6359_chip_info = { ··· 439 436 .regs = mt6359_auxadc_regs, 440 437 .sec_unlock_key = 0x6359, 441 438 .read_imp = mt6359_read_imp, 439 + .vref_mV = 1800, 442 440 }; 443 441 444 442 static void mt6359_auxadc_reset(struct mt6359_auxadc *adc_dev) ··· 509 505 int ret; 510 506 511 507 if (mask == IIO_CHAN_INFO_SCALE) { 512 - *val = desc->r_ratio.numerator * AUXADC_VOLT_FULL; 508 + *val = desc->r_ratio.numerator * cinfo->vref_mV; 513 509 514 510 if (desc->r_ratio.denominator > 1) { 515 511 *val2 = desc->r_ratio.denominator;