Hi All, Luca thank you for Cc-ing me.
On 10-Oct-25 10:56 PM, David Lechner wrote: > On 10/10/25 6:21 AM, Luca Weiss wrote: >> This is an RFC which implements a potential solution to get battery >> temperature readings working on for example smartphones with Qualcomm >> SoCs. >> > > ... > >> 3. Add temperature-lookup-table as property to simple-battery >> >> Since the NTC is a part of the battery pack, adding a >> temperature-lookup-table property to simple-battery would make sense >> instead of having this lookup table be standalone in the >> generic-adc-thermal node. However being able to re-use the existing code >> in generic-adc-thermal lead me to the current proposal. >> > Did you consider creating a specific compatible string for the battery pack? > Then the battery node could have the io-channels property for the ADC > connected to the temperature sensor. Then a specific battery driver could > handle the conversion as needed rather than filling the devicetree with > conversion tables. That will require a driver update, filling the driver (and thus memory) with conversion tables each time a new battery model (one model phone can have multiple battery revisions) comes out. That seems undesirable. To me these conversion tables are very much something which belongs in DT rather then being hardcoded in the driver. Also contrast this to ACPI where there actually is a mechanism defined for thermal lookup tables and there all these things typically just work when the ACPI tables are written properly. IMHO we want to move more towards this direction where things just work without requiring kernel code changes for every new model. And we already have a mechanism in DT to map an ADC voltage to a temperature in the generic-adc-thermal driver. So all that is left to do really is to come up with a clean way to export the temperature from the generic-adc-thermal driver to the generic-adc-battery driver. > The simple-battery bindings are already far from simple! So I would not > be inclined to add more to it. I think we all agree on this and we also don't want to duplicate the generic-adc-thermal bindings + code implementing that functionality. IMHO not wanting to duplicate the bindings + functionality applies to both: a) directly exporting an IIO temp channel from the ADC driver and b) adding volt -> temp mapping functionality to the simple-battery bindings. So that basically leaves us with coming up with a way for the generic-adc-battery code to consume the temperature coming out of the generic-adc-thermal code and there are 2 ways to do this: 1. Modify the generic-adc-thermal driver to export an IIO channel 2. Modify the thermal-zone core to allow referencing to a thermal-zone with a phandle *and* modify generic-adc-battery to be able to optionally get the temperature from a thermal-zone instead of from an IIO-channel Of these two options 1. clear is the most KISS option. SO I agree with Luca that 1. as implemented in this series is the best way forward. Regards, Hans

