The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Sebastian Reichel <sebastian.reichel@collabora.com>
To: alex.andries.aa@gmail.com
Cc: Neil Armstrong <neil.armstrong@linaro.org>,
	 Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>,
	 Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
	linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	 linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH 1/3] power: supply: qcom_battmgr: set mAh unit for SM8350 and SM8550
Date: Wed, 2 Dec 2026 03:45:09 +0100	[thread overview]
Message-ID: <aw-B3ZCYplTAPd1U@venus> (raw)
In-Reply-To: <20261119-upstream-qcom-battmgr-fixes-v1-v1-1-ca83700c08c1@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2473 bytes --]

Hi,

On Thu, Nov 19, 2026 at 12:16:50AM +0100, Alexandru Andrieș via B4 Relay wrote:
> From: Alexandru Andrieș <alex.andries.aa@gmail.com>
> 
> battmgr->unit is only populated by BATTMGR_BAT_INFO on SC8280XP and
> X1E80100, remaining QCOM_BATTMGR_UNIT_mWh (0) on SM8350 and SM8550 where
> firmware reports BATT_CHG_FULL and BATT_CHG_FULL_DESIGN in uAh via
> BATTMGR_BAT_PROPERTY_GET. Consequently, charge_full and
> charge_full_design always return -ENODATA, preventing UPower from
> computing battery energy and health.
> 
> Set battmgr->unit to QCOM_BATTMGR_UNIT_mAh when probing SM8350 and
> SM8550.
> 
> Tested on a Xiaomi MIX 4 (SM8350): charge_full (4256000) and
> charge_full_design (4360000) are now reported. SM8550 shares the same
> property path and was not tested.

I don't really understand your commit message. I *think* you want to
say:

battmgr->unit is only populated by BATTMGR_BAT_INFO on SC8280XP and
X1E80100, remaining platforms default to 0 and thus
QCOM_BATTMGR_UNIT_mWh. Xiaomi MIX 4 (SM8350) returns values in mAh
and thus doesn't work properly (charge_full and charge_full_design
are not reported).

You just change the default to uAh API. While this might work for
your device, it could break other devices using SM8350/SM8550 with
mWh instead (IDK if that exists). I *guess* there might be some FW
interface for SM8350/SM8550 similar to the one doing the unit setup
on SC8280XP. Let's get confirmation from Qcom people how this is
supposed to work for that generation.

Greetings,

-- Sebastian

> Fixes: 29e8142b5623 ("power: supply: Introduce Qualcomm PMIC GLINK power supply")
> Cc: stable@vger.kernel.org
> Signed-off-by: Alexandru Andrieș <alex.andries.aa@gmail.com>
> ---
>  drivers/power/supply/qcom_battmgr.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/power/supply/qcom_battmgr.c b/drivers/power/supply/qcom_battmgr.c
> index 58e238e6fb2a..c07e2db8f242 100644
> --- a/drivers/power/supply/qcom_battmgr.c
> +++ b/drivers/power/supply/qcom_battmgr.c
> @@ -1717,6 +1717,8 @@ static int qcom_battmgr_probe(struct auxiliary_device *adev,
>  			return dev_err_probe(dev, PTR_ERR(battmgr->wls_psy),
>  					     "failed to register wireless charing power supply\n");
>  	} else {
> +		battmgr->unit = QCOM_BATTMGR_UNIT_mAh;
> +
>  		if (battmgr->variant == QCOM_BATTMGR_SM8550)
>  			psy_desc = &sm8550_bat_psy_desc;
>  		else
> 
> -- 
> 2.56.1
> 
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2026-12-02  5:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 23:16 [PATCH 0/3] power: supply: qcom_battmgr: fix SM8350/SM8550 units, acks, and negative temp Alexandru Andrieș via B4 Relay
2026-11-18 23:16 ` [PATCH 1/3] power: supply: qcom_battmgr: set mAh unit for SM8350 and SM8550 Alexandru Andrieș via B4 Relay
2026-12-02  2:45   ` Sebastian Reichel [this message]
2026-11-18 23:16 ` [PATCH 2/3] power: supply: qcom_battmgr: complete ack on callback payload errors Alexandru Andrieș via B4 Relay
2026-11-18 23:16 ` [PATCH 3/3] power: supply: qcom_battmgr: fix negative temperature values Alexandru Andrieș via B4 Relay

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=aw-B3ZCYplTAPd1U@venus \
    --to=sebastian.reichel@collabora.com \
    --cc=alex.andries.aa@gmail.com \
    --cc=andersson@kernel.org \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=konrad.dybcio@oss.qualcomm.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=stable@vger.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