Re: [PATCH 3/7] thermal: qcom: qcom-spmi-adc-tm5-gen3: Add support for QCOM PMIC5 Gen4 ADC
Jishnu Prakash <[email protected]>
| Newsgroups | org.kernel.vger.linux-iio,org.kernel.vger.linux-arm-msm,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pm |
|---|---|
| Message-ID | <[email protected]> |
Hi Jonathan, On 8/3/2026 5:47 AM, Jonathan Cameron wrote: > On Fri, 31 Jul 2026 23:36:16 +0530 > Jishnu Prakash <[email protected]> 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. Add a reverse scaling function >> for Gen4 ADC thermistor channels. >> >> 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. >> >> Co-developed-by: Anjelique Melendez <[email protected]> >> Signed-off-by: Anjelique Melendez <[email protected]> >> Signed-off-by: Jishnu Prakash <[email protected]> > Hi Jishnu, Anjelique > > Code looks fine, but I just wanted to check. What happens if > for some reason the patch before ends up in a tree and this one doesn't > Do we read the wrong temperatures given 'bus' isn't specified? > Actually from what I see, patches 2 and 3 need to go in together, else there would be a compilation error in one driver. This is because patch 2 replaces two macros, which are used in both the IIO and thermal drivers: ADC5_GEN3_SID_MASK -> ADC5_GEN4_SID_MASK ADC5_GEN3_V_CHAN -> ADC5_GEN4_V_CHAN It looks like I missed checking for bisectability, sorry about that. To avoid this, I'll add the new macros in patch 2 and remove the old ones in a separate new patch after patch 3. To answer your question once bisectability is fixed: The changes in this TM file affect the flow in the .set_trips() call, which is used for setting high/low temperature thresholds. The .get_temp() is not affected, as it directly calls into the main ADC driver using the exported function adc5_gen3_get_scaled_reading(). For the specific situation you mentioned - temperature reading for Gen4 channels using get_temp() would work correctly with patch 2 in place, but setting high/low thresholds would go wrong for all Gen4 channels as the conversion formula is different. Bus index not being specified would also cause errors for configuring channels on bus numbers other than 0. Thanks, Jishnu > Jonathan >