Re: [PATCH V7 4/5] iio: adc: Add support for QCOM PMIC5 Gen3 ADC

From: Jishnu Prakash
Date: Wed Sep 17 2025 - 15:48:02 EST


Hi Jonathan,

On 8/30/2025 11:12 PM, Jonathan Cameron wrote:
> On Tue, 26 Aug 2025 14:06:56 +0530
> Jishnu Prakash <jishnu.prakash@xxxxxxxxxxxxxxxx> wrote:
>
>> The ADC architecture on PMIC5 Gen3 is similar to that on PMIC5 Gen2,
>> with all SW communication to ADC going through PMK8550 which
>> communicates with other PMICs through PBS.
>>
>> One major difference is that the register interface used here is that
>> of an SDAM (Shared Direct Access Memory) peripheral present on PMK8550.
>> There may be more than one SDAM used for ADC5 Gen3 and each has eight
>> channels, which may be used for either immediate reads (same functionality
>> as previous PMIC5 and PMIC5 Gen2 ADC peripherals) or recurring measurements
>> (same as ADC_TM functionality).
>>
>> By convention, we reserve the first channel of the first SDAM for all
>> immediate reads and use the remaining channels across all SDAMs for
>> ADC_TM monitoring functionality.
>>
>> Add support for PMIC5 Gen3 ADC driver for immediate read functionality.
>> ADC_TM is implemented as an auxiliary thermal driver under this ADC
>> driver.
>>
>> Signed-off-by: Jishnu Prakash <jishnu.prakash@xxxxxxxxxxxxxxxx>
>
> Hi Jishnu,
>
> A few additional comments from a fresh read through.
>
> Thanks,
>
> Jonathan
>

....

>> +
>> +static int adc5_gen3_get_fw_channel_data(struct adc5_chip *adc,
>> + struct adc5_channel_prop *prop,
>> + struct fwnode_handle *fwnode)
>> +{
>> + const char *name = fwnode_get_name(fwnode);
>> + const struct adc5_data *data = adc->data;
>> + u32 chan, value, varr[2], sid = 0;
>
> Why initialize sid?

I think this is not needed, I'll remove it.
I'll also address all your other comments in the next patch series.

Thanks,
Jishnu

>
>> + struct device *dev = adc->dev;
>> + const char *channel_name;
>> + int ret;
>> +
>> + ret = fwnode_property_read_u32(fwnode, "reg", &chan);
>> + if (ret < 0)
>> + return dev_err_probe(dev, ret, "invalid channel number %s\n",
>> + name);
>> +
>> + /*
>> + * Value read from "reg" is virtual channel number
>> + * virtual channel number = sid << 8 | channel number
>> + */
>> + sid = FIELD_GET(ADC5_GEN3_VIRTUAL_SID_MASK, chan);
>> + chan = FIELD_GET(ADC5_GEN3_CHANNEL_MASK, chan);
>
>> + return 0;
>> +}
>