From: Krzysztof Kozlowski <krzk@kernel.org>
To: Stanislav Zaikin <zstaseg@gmail.com>
Cc: Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Sebastian Reichel <sre@kernel.org>,
linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org
Subject: Re: [PATCH v2 2/3] power: supply: qcom_battmgr: add Xiaomi taoyao support
Date: Wed, 19 Aug 2026 10:46:46 +0200 [thread overview]
Message-ID: <021027bd-fb6e-4dca-bf16-80f6a67e8cb8@kernel.org> (raw)
In-Reply-To: <590e7881-de96-4de4-bb50-1e91439b92ef@gmail.com>
On 19/08/2026 10:37, Stanislav Zaikin wrote:
> On 8/19/26 9:11 AM, Krzysztof Kozlowski wrote:
>> On Tue, Aug 18, 2026 at 05:10:38PM +0200, user.email wrote:
>>> From: Stanislav Zaikin <zstaseg@gmail.com>
>>>
>>> The Xiaomi taoyao firmware defines an additional BATT_CONSTANT_CURRENT
>>> property (ID 12) between BATT_CHG_CTRL_LIM_MAX and BATT_TEMP, shifting
>>> all higher battery property IDs by one.
>>>
>>> Signed-off-by: Stanislav Zaikin <zstaseg@gmail.com>
>>> ---
>>> drivers/power/supply/qcom_battmgr.c | 86 +++++++++++++++++++++++++++--
>>> 1 file changed, 82 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/power/supply/qcom_battmgr.c b/drivers/power/supply/qcom_battmgr.c
>>> index 490137a23d00..390d7c75e36f 100644
>>> --- a/drivers/power/supply/qcom_battmgr.c
>>> +++ b/drivers/power/supply/qcom_battmgr.c
>>> @@ -24,6 +24,7 @@ enum qcom_battmgr_variant {
>>> QCOM_BATTMGR_SM8350,
>>> QCOM_BATTMGR_SM8550,
>>> QCOM_BATTMGR_X1E80100,
>>> + QCOM_BATTMGR_TAOYAO,
>>
>> T < X, do not introduce entries in random order
>
> Hello Krzysztof,
> Thank you for the review.
>
> Will fix in v3.
>
>>> @@ -1381,6 +1453,11 @@ static void qcom_battmgr_sm8350_callback(struct qcom_battmgr *battmgr,
>>> switch (opcode) {
>>> case BATTMGR_BAT_PROPERTY_GET:
>>> property = le32_to_cpu(resp->intval.property);
>>> +
>>> + if (battmgr->variant == QCOM_BATTMGR_TAOYAO &&
>>> + property < ARRAY_SIZE(taoyao_to_canonical))
>>> + property = taoyao_to_canonical[property];
>>
>> So device is or is not compatible with sm7325? Above code suggests that
>> it is not. How does it work when bound by sm7325 compatible?
>
> The device is sm7325-based and when bound to sm7325-pmic-glink it falls
> back to QCOM_BATTMGR_SM8350 property map. However, due to shifted
> property IDs baked into taoyao's firmware the parsing of roughly the 2nd
> half of properties is broken.
>
> And any userspace process that reads the battery properties via sysfs
> suffers from 1s timeouts and it basically hangs my DE.
So basically it is not compatible with sm7325-pmic-glink and it should
be expressed/fixed. I wonder though how was the DTS even tested in this
matter.
>
> Since this is an RFC: do you think this approach is better than what I
> described in cover letter? (manually shifting property IDs)
Every patch is RFC... or are you saying this is a RFC in a meaning it is
not ready for review?
>
>>> @@ -1617,6 +1694,7 @@ static const struct of_device_id qcom_battmgr_of_variants[] = {
>>> { .compatible = "qcom,sc8280xp-pmic-glink", .data = (void *)QCOM_BATTMGR_SC8280XP },
>>> { .compatible = "qcom,sm8550-pmic-glink", .data = (void *)QCOM_BATTMGR_SM8550 },
>>> { .compatible = "qcom,x1e80100-pmic-glink", .data = (void *)QCOM_BATTMGR_X1E80100 },
>>> + { .compatible = "xiaomi,taoyao-pmic-glink", .data = (void *)QCOM_BATTMGR_TAOYAO },
>>
>> And here as well wrong order
>
> Will fix in v3.
>
> --
> Best regards,
> Stanislav
>
Best regards,
Krzysztof
next prev parent reply other threads:[~2026-08-19 8:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-18 15:10 [RFC PATCH v2 0/3] Add Xiaomi 12 Lite 5G (taoyao) battery support user.email
2026-08-18 15:10 ` [PATCH v2 1/3] dt-bindings: soc: qcom: add xiaomi,taoyao-pmic-glink compatible user.email
2026-08-18 15:10 ` [PATCH v2 2/3] power: supply: qcom_battmgr: add Xiaomi taoyao support user.email
2026-08-18 15:24 ` sashiko-bot
2026-08-19 7:11 ` Krzysztof Kozlowski
2026-08-19 8:37 ` Stanislav Zaikin
2026-08-19 8:46 ` Konrad Dybcio
2026-08-19 8:46 ` Krzysztof Kozlowski [this message]
2026-08-18 15:10 ` [PATCH v2 3/3] arm64: dts: qcom: sm7325-xiaomi-taoyao: switch to device-specific pmic-glink compatible user.email
2026-08-19 7:13 ` 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=021027bd-fb6e-4dca-bf16-80f6a67e8cb8@kernel.org \
--to=krzk@kernel.org \
--cc=andersson@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sre@kernel.org \
--cc=zstaseg@gmail.com \
/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.