From: sashiko-bot@kernel.org
To: "Rakesh Kota" <rakesh.kota@oss.qualcomm.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH 2/2] power: supply: qcom_battmgr: Add support batteryless boards as MAINS
Date: Mon, 18 May 2026 15:10:12 +0000 [thread overview]
Message-ID: <20260518151013.0F8E6C2BCB8@smtp.kernel.org> (raw)
In-Reply-To: <20260518-add_dc_in_support-v1-2-31fbaa329879@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The new MAINS power supply exposes BATTERY properties (STATUS, PRESENT) instead of ONLINE, breaking userspace expectations.
- [Medium] The `qcom,batteryless` property is silently ignored on `SC8280XP` and `X1E80100` variants.
--
commit fd3fd36bafd15a4f0b8a90d2f6b2f13ff0fc3a3d
Author: Rakesh Kota <rakesh.kota@oss.qualcomm.com>
power: supply: qcom_battmgr: Add support batteryless boards as MAINS
This commit adds support for the qcom,batteryless device tree property to
register the power supply as a MAINS type instead of a BATTERY. This is
intended to prevent userspace from triggering battery power-saving sequences
on boards powered directly by adapters.
> diff --git a/drivers/power/supply/qcom_battmgr.c b/drivers/power/supply/qcom_battmgr.c
> index 490137a23d00e..35d266375d8c4 100644
> --- a/drivers/power/supply/qcom_battmgr.c
> +++ b/drivers/power/supply/qcom_battmgr.c
[ ... ]
> @@ -930,6 +931,47 @@ static const struct power_supply_desc sm8550_bat_psy_desc = {
> .property_is_writeable = qcom_battmgr_bat_is_writeable,
> };
>
> +static int qcom_battmgr_dcin_get_property(struct power_supply *psy,
> + enum power_supply_property psp,
> + union power_supply_propval *val)
> +{
> + struct qcom_battmgr *battmgr = power_supply_get_drvdata(psy);
> + int ret;
> +
> + if (!battmgr->service_up)
> + return -EAGAIN;
> +
> + ret = qcom_battmgr_bat_sm8350_update(battmgr, psp);
> + if (ret < 0)
> + return ret;
> +
> + switch (psp) {
> + case POWER_SUPPLY_PROP_STATUS:
> + val->intval = battmgr->status.status;
> + break;
> + case POWER_SUPPLY_PROP_PRESENT:
> + val->intval = battmgr->info.present;
> + break;
> + default:
> + return -EINVAL;
> + }
> +
> + return 0;
> +}
> +
> +static const enum power_supply_property dcin_props[] = {
> + POWER_SUPPLY_PROP_STATUS,
> + POWER_SUPPLY_PROP_PRESENT,
> +};
> +
> +static const struct power_supply_desc dcin_psy_desc = {
> + .name = "qcom-battmgr-dcin",
> + .type = POWER_SUPPLY_TYPE_MAINS,
> + .properties = dcin_props,
> + .num_properties = ARRAY_SIZE(dcin_props),
> + .get_property = qcom_battmgr_dcin_get_property,
> +};
Since dcin_psy_desc is registered as POWER_SUPPLY_TYPE_MAINS, should it
expose POWER_SUPPLY_PROP_ONLINE instead of POWER_SUPPLY_PROP_STATUS and
POWER_SUPPLY_PROP_PRESENT?
Userspace power managers typically expect MAINS power supplies to report their
active state via the ONLINE property.
If the firmware returns PRESENT=0 on a batteryless board, won't userspace
fail to recognize the AC adapter as an active power source and still trigger
power-saving or shutdown sequences?
[ ... ]
> @@ -1690,7 +1733,9 @@ 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 {
> - if (battmgr->variant == QCOM_BATTMGR_SM8550)
> + if (battmgr->batteryless)
> + psy_desc = &dcin_psy_desc;
> + else if (battmgr->variant == QCOM_BATTMGR_SM8550)
> psy_desc = &sm8550_bat_psy_desc;
> else
> psy_desc = &sm8350_bat_psy_desc;
Does this bypass the qcom,batteryless property on SC8280XP and X1E80100
variants?
Looking at qcom_battmgr_probe(), the check for battmgr->batteryless is only
placed inside the else block which executes for SM8350 and SM8550:
drivers/power/supply/qcom_battmgr.c:qcom_battmgr_probe() {
...
if (battmgr->variant == QCOM_BATTMGR_SC8280XP ||
battmgr->variant == QCOM_BATTMGR_X1E80100) {
if (battmgr->variant == QCOM_BATTMGR_X1E80100)
psy_desc = &x1e80100_bat_psy_desc;
else
psy_desc = &sc8280xp_bat_psy_desc;
battmgr->bat_psy = devm_power_supply_register(dev, psy_desc, &psy_cfg);
...
} else {
if (battmgr->batteryless)
psy_desc = &dcin_psy_desc;
...
}
If a board uses the SC8280XP or X1E80100 variant, won't it bypass this check
and unconditionally register the standard battery power supply?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260518-add_dc_in_support-v1-0-31fbaa329879@oss.qualcomm.com?part=2
next prev parent reply other threads:[~2026-05-18 15:10 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-18 13:49 [PATCH 0/2] qcom_battmgr: Add batteryless DC-adapter MAINS support Rakesh Kota
2026-05-18 13:49 ` [PATCH 1/2] dt-bindings: soc: qcom: pmic-glink: Document batteryless property Rakesh Kota
2026-05-18 13:59 ` sashiko-bot
2026-05-19 7:09 ` Rakesh Kota
2026-05-18 15:27 ` Krzysztof Kozlowski
2026-05-19 8:25 ` Rakesh Kota
2026-05-19 10:35 ` Krzysztof Kozlowski
2026-05-19 10:47 ` Konrad Dybcio
2026-05-19 10:49 ` Krzysztof Kozlowski
2026-05-18 13:49 ` [PATCH 2/2] power: supply: qcom_battmgr: Add support batteryless boards as MAINS Rakesh Kota
2026-05-18 15:10 ` sashiko-bot [this message]
2026-05-19 6:55 ` Rakesh Kota
2026-05-18 14:36 ` [PATCH 0/2] qcom_battmgr: Add batteryless DC-adapter MAINS support Konrad Dybcio
2026-05-19 6:59 ` Rakesh Kota
2026-05-19 10:58 ` Konrad Dybcio
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=20260518151013.0F8E6C2BCB8@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=rakesh.kota@oss.qualcomm.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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