From: Frank Li <Frank.li@oss.nxp.com>
To: raoxu <raoxu@uniontech.com>
Cc: samkay014@gmail.com, sre@kernel.org, imx@lists.linux.dev,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] power: supply: pf1550: enable charging when battery profile exists
Date: Fri, 24 Jul 2026 10:06:29 -0500 [thread overview]
Message-ID: <amN_dZj1p4KWcawu@SMW015318> (raw)
In-Reply-To: <D5A5255CD2B683AC+20260724090341.297438-1-raoxu@uniontech.com>
On Fri, Jul 24, 2026 at 05:03:41PM +0800, raoxu wrote:
> [You don't often get email from raoxu@uniontech.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> From: Xu Rao <raoxu@uniontech.com>
>
> PF1550 starts in charger mode 1, where charging is disabled. The driver
> comment says that mode 2 should be selected for applications using a
> battery, but the condition is inverted: PF1550_CHG_BAT_ON is written only
> when power_supply_get_battery_info() fails.
>
> Consequently, a board with a valid monitored-battery profile is left in
> the default charger-off mode, while a board without battery information
> enables charging with the fallback voltage.
>
> Select mode 2 when battery information is available. Also release the
> battery-info objects after use.
>
> Fixes: 4b6b6433a97d ("power: supply: pf1550: add battery charger support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Xu Rao <raoxu@uniontech.com>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> drivers/power/supply/pf1550-charger.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/power/supply/pf1550-charger.c b/drivers/power/supply/pf1550-charger.c
> index 41036f4cb64a..f698becd662a 100644
> --- a/drivers/power/supply/pf1550-charger.c
> +++ b/drivers/power/supply/pf1550-charger.c
> @@ -514,7 +514,10 @@ static int pf1550_reg_init(struct pf1550_charger *chg)
> * a battery. The other supported mode is mode 2, the charger is turned
> * on to charge a battery when present.
> */
> - if (power_supply_get_battery_info(chg->charger, &info)) {
> + ret = power_supply_get_battery_info(chg->charger, &info);
> + if (!ret) {
> + power_supply_put_battery_info(chg->charger, info);
> +
> ret = regmap_write(chg->pf1550->regmap,
> PF1550_CHARG_REG_CHG_OPER,
> PF1550_CHG_BAT_ON);
> @@ -540,10 +543,12 @@ static void pf1550_dt_parse_dev_info(struct pf1550_charger *chg)
> &chg->thermal_regulation_temp))
> chg->thermal_regulation_temp = PF1550_DEFAULT_THERMAL_TEMP;
>
> - if (power_supply_get_battery_info(chg->charger, &info))
> + if (power_supply_get_battery_info(chg->charger, &info)) {
> chg->constant_volt = PF1550_DEFAULT_CONSTANT_VOLT;
> - else
> + } else {
> chg->constant_volt = info->constant_charge_voltage_max_uv;
> + power_supply_put_battery_info(chg->charger, info);
> + }
> }
>
> static int pf1550_charger_probe(struct platform_device *pdev)
> --
> 2.50.1
>
>
prev parent reply other threads:[~2026-07-24 15:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-24 9:03 [PATCH] power: supply: pf1550: enable charging when battery profile exists raoxu
2026-07-24 9:16 ` sashiko-bot
2026-07-24 15:06 ` Frank Li [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=amN_dZj1p4KWcawu@SMW015318 \
--to=frank.li@oss.nxp.com \
--cc=imx@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=raoxu@uniontech.com \
--cc=samkay014@gmail.com \
--cc=sre@kernel.org \
--cc=stable@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox