Re: [PATCH 1/2] power: supply: qcom_battmgr: fix the battery current sign on Kaanapali
From: Konrad Dybcio
Date: Fri Oct 16 2026 - 09:50:44 EST
On 10/16/26 2:48 PM, Joonhoe Kim wrote:
> The Kaanapali battery firmware reports the battery current with
> discharge positive: on a Lenovo Legion Tab Y700 Gen 5 current_now reads
> -9.1 A while charging and +0.57 A on battery. The power_supply ABI has
> charging positive, and upower reports such a charging battery as
> discharging.
>
> Other firmware behind the same callback uses the ABI sign [1], so
> negate the value only for qcom,kaanapali-pmic-glink.
>
> Fixes: 16a7c32e586e ("power: supply: qcom_battmgr: Add support for Glymur and Kaanapali")
> Link: https://lore.kernel.org/all/20260829054546.86210-1-jan.brummer@xxxxxxxxx/ [1]
> Signed-off-by: Joonhoe Kim <26rote@xxxxxxxxx>
> ---
> I could only check this on one device, not on MTP or QRD firmware.
> Anjelique, could you confirm the sign there?
>
> Both patches apply before or after my two battmgr patches still under
> review (USB_ADAP_TYPE v2 and the USB input current limit).
+Jingyi could you please check if this applies to QRD/MTP?
Konrad
>
> drivers/power/supply/qcom_battmgr.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/power/supply/qcom_battmgr.c b/drivers/power/supply/qcom_battmgr.c
> index a7237ba09be1..0d55458b2881 100644
> --- a/drivers/power/supply/qcom_battmgr.c
> +++ b/drivers/power/supply/qcom_battmgr.c
> @@ -313,6 +313,7 @@ struct qcom_battmgr {
> struct pmic_glink_client *client;
>
> enum qcom_battmgr_variant variant;
> + bool current_inverted;
>
> struct power_supply *ac_psy;
> struct power_supply *bat_psy;
> @@ -1435,6 +1436,8 @@ static void qcom_battmgr_sm8350_callback(struct qcom_battmgr *battmgr,
> break;
> case BATT_CURR_NOW:
> battmgr->status.current_now = le32_to_cpu(resp->intval.value);
> + if (battmgr->current_inverted)
> + battmgr->status.current_now = -battmgr->status.current_now;
> break;
> case BATT_TEMP:
> val = le32_to_cpu(resp->intval.value);
> @@ -1659,6 +1662,9 @@ static int qcom_battmgr_probe(struct auxiliary_device *adev,
> else
> battmgr->variant = QCOM_BATTMGR_SM8350;
>
> + battmgr->current_inverted = device_is_compatible(dev->parent,
> + "qcom,kaanapali-pmic-glink");
> +
> ret = qcom_battmgr_charge_control_thresholds_init(battmgr);
> if (ret < 0)
> return dev_err_probe(dev, ret,
>
> base-commit: b810335a0699d1810683796b0e3ffe8827ddfe6c