mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Val Packett <val@packett.cool>
To: "Luca Weiss" <luca.weiss@fairphone.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>
Cc: "Marc Lainez" <marc.lainez@gmail.com>,
	"Barnabás Czémán" <barnabas.czeman@mainlining.org>,
	"Danila Tikhonov" <danila@jiaxyga.com>,
	"Sebastian Reichel" <sre@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Bjorn Andersson" <andersson@kernel.org>,
	"Konrad Dybcio" <konradybcio@kernel.org>,
	"Abel Vesa" <abelvesa@kernel.org>,
	linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org,
	devicetree@vger.kernel.org, phone-devel@vger.kernel.org,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/5] iio: adc: qcom-spmi-adc5: Add ADC5_BAT_THERM_100K_PU
Date: Fri, 13 Nov 2026 07:48:57 -0300	[thread overview]
Message-ID: <1ac861f9-e6d4-4d16-912b-711fffab3063@packett.cool> (raw)
In-Reply-To: <DMU0219YWEL8.35KQSMY192RH4@fairphone.com>


On 11/13/26 7:09 AM, Luca Weiss wrote:
> Hi Val,
>
> On Thu Nov 12, 2026 at 6:07 PM CET, Val Packett wrote:
>> Even though it existed in bindings for the longest time,
>> ADC5_BAT_THERM_100K_PU was never assigned in the driver. Do so.
>>
>> Signed-off-by: Val Packett <val@packett.cool>
>> ---
>>   drivers/iio/adc/qcom-spmi-adc5.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/iio/adc/qcom-spmi-adc5.c b/drivers/iio/adc/qcom-spmi-adc5.c
>> index d57ba8526e0c..c27ff89429f5 100644
>> --- a/drivers/iio/adc/qcom-spmi-adc5.c
>> +++ b/drivers/iio/adc/qcom-spmi-adc5.c
>> @@ -542,6 +542,8 @@ static const struct adc5_channels adc5_chans_pmic[ADC5_MAX_CHANNEL] = {
>>   					SCALE_HW_CALIB_DEFAULT)
>>   	[ADC5_XO_THERM_100K_PU]	= ADC5_CHAN_TEMP("xo_therm", 0,
>>   					SCALE_HW_CALIB_XOTHERM)
>> +	[ADC5_BAT_THERM_100K_PU]	= ADC5_CHAN_TEMP("bat_therm", 0,
>> +					SCALE_HW_CALIB_THERM_100K_PULLUP)
> While this will work fine for some devices, unfortunately this won't
> work for quite some other devices that don't use a 30K, 100K or 400K
> NTC in the battery - or when the NTC beta (B) is differing to the
> hardcoded lookup table.
>
> For example on Fairphone 4 (pm7250b fwiw), the battery has a 10kΩ NTC,
> so using the ADC5_BAT_THERM_30K_PU with the hard-coded lookup tables
> would result in very wrong temperature values. Even ignoring the whole
> NTC beta topic.
>
> You can see my proposed patch series at
> https://lore.kernel.org/linux-arm-msm/20260220-bat-temp-adc-v2-0-fe34ed4ea851@fairphone.com/
>
> Unfortunately it's from February and I haven't spent more time on this
> topic since then, mostly because fuel gauge anyways was downstream, so
> pushing just this upstream wouldn't make much difference.
>
> Now it does, so I should get back to it... Let me know your thoughts!

Looks like your series has had very positive feedback so far, from a 
quick look I haven't even noticed any pending changes really..

It's orthogonal to the qgauge driver itself as the driver just consumes 
an IIO channel which can be whatever's appropriate for the device, but 
that's informative in that I probably should not set a default channel 
and rather leave an explanation in the example in the bindings that it's 
very battery-specific.

> (Fairphone 3 with SDM632/PMI632 would actually be fine-ish as-is because
> the battery has a 100kΩ NTC and the beta probably is close enough to
> what's in adcmap_100k_104ef_104fb_1875_vref)
>
> Regards
> Luca
>
>>   	[ADC5_BAT_ID_100K_PU]	= ADC5_CHAN_TEMP("bat_id", 0,
>>   					SCALE_HW_CALIB_DEFAULT)
>>   	[ADC5_AMUX_THM1_100K_PU] = ADC5_CHAN_TEMP("amux_thm1_100k_pu", 0,


Thanks,
~val


  reply	other threads:[~2026-11-13 10:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12 17:07 [PATCH 0/5] Add driver for Qualcomm QGauge (qcom_qg) fuel gauge Val Packett
2026-11-12 17:07 ` [PATCH 1/5] dt-bindings: power: supply: add Qualcomm QGauge " Val Packett
2026-11-13 11:22   ` Krzysztof Kozlowski
2026-11-12 17:07 ` [PATCH 2/5] power: supply: add Qualcomm QGauge (qcom_qg) fuel gauge driver Val Packett
2026-11-13  6:27   ` Uwe Kleine-König
2026-11-12 17:07 ` [PATCH 3/5] iio: adc: qcom-spmi-adc5: Add ADC5_BAT_THERM_100K_PU Val Packett
2026-11-13  1:02   ` Jonathan Cameron
2026-11-13 10:09   ` Luca Weiss
2026-11-13 10:48     ` Val Packett [this message]
2026-11-12 17:07 ` [PATCH 4/5] arm64: dts: qcom: pmi632: Add missing bat_therm ADC channel Val Packett
2026-11-12 17:07 ` [PATCH 5/5] arm64: dts: qcom: pmi632: Add battery fuel gauge node Val Packett
2026-11-13 11:25   ` Krzysztof Kozlowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1ac861f9-e6d4-4d16-912b-711fffab3063@packett.cool \
    --to=val@packett.cool \
    --cc=abelvesa@kernel.org \
    --cc=andersson@kernel.org \
    --cc=andy@kernel.org \
    --cc=barnabas.czeman@mainlining.org \
    --cc=conor+dt@kernel.org \
    --cc=danila@jiaxyga.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=luca.weiss@fairphone.com \
    --cc=marc.lainez@gmail.com \
    --cc=nuno.sa@analog.com \
    --cc=phone-devel@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sre@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®