lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <0beae4dd-2feb-4891-b7b0-0f63db8f5615@kernel.org>
Date: Sat, 11 Oct 2025 11:52:43 +0200
From: Hans de Goede <hansg@...nel.org>
To: David Lechner <dlechner@...libre.com>,
 Luca Weiss <luca.weiss@...rphone.com>, Jonathan Cameron <jic23@...nel.org>,
 Nuno Sá <nuno.sa@...log.com>,
 Andy Shevchenko <andy@...nel.org>, "Rafael J. Wysocki" <rafael@...nel.org>,
 Daniel Lezcano <daniel.lezcano@...aro.org>, Zhang Rui <rui.zhang@...el.com>,
 Lukasz Luba <lukasz.luba@....com>, Rob Herring <robh@...nel.org>,
 Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley
 <conor+dt@...nel.org>, Laxman Dewangan <ldewangan@...dia.com>,
 Bjorn Andersson <andersson@...nel.org>,
 Konrad Dybcio <konradybcio@...nel.org>, Jens Reidel <adrian@...nlining.org>,
 Casey Connolly <casey.connolly@...aro.org>
Cc: ~postmarketos/upstreaming@...ts.sr.ht, phone-devel@...r.kernel.org,
 linux-arm-msm@...r.kernel.org, linux-iio@...r.kernel.org,
 linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org,
 devicetree@...r.kernel.org
Subject: Re: [PATCH RFC 0/6] Battery temperature ADC plumbing on Qualcomm
 platforms

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



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ