Re: [PATCH 1/3] power: supply: qcom_battmgr: set mAh unit for SM8350 and SM8550
From: Sebastian Reichel
Date: Wed Dec 02 2026 - 00:46:03 EST
Hi,
On Thu, Nov 19, 2026 at 12:16:50AM +0100, Alexandru Andrieș via B4 Relay wrote:
> From: Alexandru Andrieș <alex.andries.aa@xxxxxxxxx>
>
> 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@xxxxxxxxxxxxxxx
> Signed-off-by: Alexandru Andrieș <alex.andries.aa@xxxxxxxxx>
> ---
> 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:
signature.asc
Description: PGP signature