Re: [PATCH 2/2] dt-bindings: iio: adc: document TS voltage in AXP PMICs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



(added linux-pm@ list and maintainers)


Actually, on second though, I think it might be doable to add voltage to temperature conversion to this driver.

I think since the NTC thermistor belongs to the battery, not charger, the thermistor should be described in monitored battery node. So I propose to extend battery node (power/supply/battery.yaml) by adding something like:

thermistor-resistance-temp-table = <25 10000>, <35 6530>, ...;

This driver will then interpolate between points to report temperature.

We can also adjust PMIC voltage thresholds based on this table and "alert-celsius" property already described in battery.yaml.

I think the driver should report raw TS voltage as well, because the TS pin can also be used as general-purpose ADC pin.




22.11.2021 14:35, Samuel Holland пишет:
On 11/22/21 5:17 AM, Evgeny Boger wrote:
22.11.2021 13:49, Maxime Ripard пишет:
On Thu, Nov 18, 2021 at 05:12:33PM +0300, Evgeny Boger wrote:
Most AXPxxx-based reference designs place a 10k NTC thermistor on a
TS pin. axp20x IIO driver now report the voltage of this pin via
additional IIO channel. Add new "ts_v" channel to the channel
description.

Signed-off-by: Evgeny Boger <boger@xxxxxxxxxxxxxx>
Would it make sense to put the resistance in the DT as well or is it
made mandatory by Allwinner?

Maxime
Well, I don't think so. Basically, by default AXP20x injects 80uA
current into the TS pin and measure the voltage. Then, there are
voltage thresholds to stop charging if the battery is too hot or too
cold. The default thresholds were calculated by the manufacturer for
default 10k resistance and 80uA current. Finally, if TS pin is
shorted to GND, the AXP2xx will detect it and won't shut down
charging. Note that AXP2xx doesn't convert the measured voltage to
temperature.
Agreed, since the ADC driver only works with voltages, the resistance is
not relevant to it, so a resistance property does not belong here.

So while it's possible to use AXP2xx with resistance other than 10k,
it will require us to override these protection thresholds.
Moreover, if one want to put the actual resistance in DT, then the
driver would need to calculate these protection thresholds based on
NTC parameters and injection current.
That means we do need a resistance property for the battery charger
driver, because it does need to calculate temperature.

Regardless of the reference design, the resistance is variable in
practice. At least some early v1.0 PinePhones shipped with batteries
containing a 3 kOhm NTC. And the battery is removable, with an
off-the-shelf form factor, so users could install aftermarket batteries
with any NTC resistance.

Right now, people with these batteries are disabling the TS; otherwise
the PMIC refuses to charge them. It would be good to re-enable the TS by
coming up with the proper voltages for the min/max thresholds. And there
are power supply properties we can use to expose the current temperature
and those thresholds to userspace (at least as read-only).

Regards,
Samuel





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux