All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
To: Joonhoe Kim <26rote@gmail.com>,
	sre@kernel.org, Jingyi Wang <jingyi.wang@oss.qualcomm.com>
Cc: kamal.wadhwa@oss.qualcomm.com,
	anjelique.melendez@oss.qualcomm.com,
	dhruvin.rajpura@oss.qualcomm.com, andersson@kernel.org,
	dmitry.baryshkov@oss.qualcomm.com, linux-arm-msm@vger.kernel.org,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] power: supply: qcom_battmgr: fix the battery current sign on Kaanapali
Date: Fri, 16 Oct 2026 15:34:57 +0200	[thread overview]
Message-ID: <0e5b7d2e-e141-4ce4-a873-b65bd9ef3c4a@oss.qualcomm.com> (raw)
In-Reply-To: <20261016124806.1789-1-26rote@gmail.com>

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@tabos.org/ [1]
> Signed-off-by: Joonhoe Kim <26rote@gmail.com>
> ---
> 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

      parent reply	other threads:[~2026-10-16 13:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-16 12:48 [PATCH 1/2] power: supply: qcom_battmgr: fix the battery current sign on Kaanapali Joonhoe Kim
2026-10-16 12:48 ` [PATCH 2/2] power: supply: qcom_battmgr: expose the charge current limit Joonhoe Kim
2026-10-20  8:55   ` Konrad Dybcio
2026-10-20  9:55   ` Konrad Dybcio
2026-10-20 13:23     ` joonhoekim
2026-10-16 13:34 ` Konrad Dybcio [this message]

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=0e5b7d2e-e141-4ce4-a873-b65bd9ef3c4a@oss.qualcomm.com \
    --to=konrad.dybcio@oss.qualcomm.com \
    --cc=26rote@gmail.com \
    --cc=andersson@kernel.org \
    --cc=anjelique.melendez@oss.qualcomm.com \
    --cc=dhruvin.rajpura@oss.qualcomm.com \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=jingyi.wang@oss.qualcomm.com \
    --cc=kamal.wadhwa@oss.qualcomm.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.