Re: [PATCH v2 3/7] iio: adc: qcom-spmi-adc5-gen3: Add support for QCOM PMIC5 Gen4 ADC

From: Jonathan Cameron

Date: Sun Nov 29 2026 - 14:14:26 EST


On Sun, 29 Nov 2026 19:42:14 +0530
Jishnu Prakash <jishnu.prakash@xxxxxxxxxxxxxxxx> wrote:

> Hi Andy,
>
> On 11/20/2026 3:44 PM, Andy Shevchenko wrote:
> > On Fri, Nov 20, 2026 at 02:49:43PM +0530, Jishnu Prakash wrote:
> >> PMIC5 Gen4 ADC is similar to PMIC5 Gen3 ADC, with several changes made
> >> for improved performance, mostly at the hardware level.
> >>
> >> One significant software change is that ratiometric conversion resolution
> >> has been increased from 14 bits to 16 bits, so the maximum value of
> >> these measurements needs to be updated for Gen4. Add a new scaling
> >> function for thermistor channels which use this type of conversion.
> >>
> >> It is possible that the master PMIC has ADC of one generation and it needs
> >> to communicate with another PMIC with ADC of a different generation. For
> >> example, on SM8750, PMK8550 is the master PMIC with Gen3 ADC and it
> >> communicates with PMIH0108, which has Gen4 ADC. Add a new DT property
> >> "qcom,adc5-gen4" to distinguish Gen4 channels under a Gen3 master, to
> >> ensure that their conversions are handled correctly.
> >>
> >> In the latest PMIC arbiter version (v8), there can be up to 4 buses
> >> under the PMIC arbiter and 32 PMICs under each bus. In order to
> >> support communication between ADC on the master PMIC and ADCs on any
> >> of the other PMICs, a field of width 2 bits is added for bus index
> >> and the bits for SID are extended from 4 to 5 bits, in the SID
> >> register. Add support for this.
> >
> > ...
> >
> >> - /* Write SID */
> >> - buf[0] = FIELD_PREP(ADC5_GEN3_SID_MASK, prop->sid);
> >> + /* Write SID and bus_id*/
> >
> > Missed space.
> >
> >> + buf[0] = FIELD_PREP(ADC5_GEN4_BUS_INDEX_MASK, prop->bus_index) |
> >> + FIELD_PREP(ADC5_GEN4_SID_MASK, prop->sid);
> >
> > ...
> >
> >> -static const struct adc5_data adc5_gen3_data_pmic = {
> >> - .full_scale_code_volt = 0x70e4,
> >> - .adc_chans = adc5_gen3_chans_pmic,
> >> - .info = &adc5_gen3_info,
> >> - .decimation = (unsigned int [ADC5_DECIMATION_SAMPLES_MAX])
> >> - { 85, 340, 1360 },
> >> - .hw_settle_1 = (unsigned int [VADC_HW_SETTLE_SAMPLES_MAX])
> >> - { 15, 100, 200, 300,
> >> - 400, 500, 600, 700,
> >> - 1000, 2000, 4000, 8000,
> >> - 16000, 32000, 64000, 128000 },
> >> -};
> >
> > Seems like this is existing piece and you moved it up. Please, split that part
> > to a separate prerequisite patch.
>
> I think I moved it upwards because it was referenced in adc5_gen3_get_fw_channel_data(),
> which came before this point, but that was not really needed, as I could use a
> forward declaration instead. I'll move it back here and keep a forward declaration
> for it in the next patch version.

Moving it is better, but simple code moves can be separate patches so that
reviewers can immediately see that you are just moving code. Otherwise
they are looking closely to spot what changed!


>