From: Samuel Kayode <samuel.kayode@savoirfairelinux.com>
To: Sean Nyekjaer <sean@geanix.com>
Cc: Lee Jones <lee@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Sebastian Reichel <sre@kernel.org>, Frank Li <Frank.li@nxp.com>,
imx@lists.linux.dev, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
linux-pm@vger.kernel.org, Abel Vesa <abelvesa@kernel.org>,
Abel Vesa <abelvesa@linux.com>, Robin Gong <b38343@freescale.com>,
Robin Gong <yibin.gong@nxp.com>,
Enric Balletbo i Serra <eballetbo@gmail.com>
Subject: Re: [PATCH v8 5/6] power: supply: pf1550: add battery charger support
Date: Fri, 11 Jul 2025 12:27:35 -0400 [thread overview]
Message-ID: <aHE7d3gDITZMWEcH@fedora> (raw)
In-Reply-To: <e2veigexln4ma5meguxqh6jh2r2fhj2d47pv4exjzwrhlazn7d@raknfsiucqls>
On Fri, Jul 11, 2025 at 09:02:18AM +0000, Sean Nyekjaer wrote:
> > +#define PF1550_DEFAULT_THERMAL_TEMP 75
>
> Default is 95
>
Will make changes.
> > +
> > +static int pf1550_set_thermal_regulation_temp(struct pf1550_charger *chg,
> > + unsigned int cells)
> > +{
> > + unsigned int data;
> > +
> > + switch (cells) {
> > + case 60:
> > + data = 0x0;
> > + break;
> > + case 75:
> > + data = 0x1;
> > + break;
> > + case 90:
> > + data = 0x2;
> > + break;
> > + case 105:
> > + data = 0x3;
> > + break;
>
> From the datasheet 80, 95, 110 and 125c is supported
>
Yeah, the temp values should be as you mentioned. I'll be replacing the current
temperature range.
> > + default:
> > + return dev_err_probe(chg->dev, -EINVAL,
> > + "Wrong value for thermal temperature\n");
> > + }
> > +
> > + data <<= PF1550_CHARG_REG_THM_REG_CNFG_REGTEMP_SHIFT;
> > +
> > + dev_dbg(chg->dev, "Thermal regulation loop temperature: %u (0x%x)\n",
> > + cells, data);
> > +
> > + return regmap_update_bits(chg->pf1550->regmap,
> > + PF1550_CHARG_REG_THM_REG_CNFG,
> > + PF1550_CHARG_REG_THM_REG_CNFG_REGTEMP_MASK,
> > + data);
> > +}
> > +
> > +/*
> > + * Sets charger registers to proper and safe default values.
> > + */
> > +static int pf1550_reg_init(struct pf1550_charger *chg)
> > +{
> > + struct device *dev = chg->dev;
> > + unsigned int data;
> > + int ret;
> > +
> > + /* Unmask charger interrupt, mask DPMI and reserved bit */
> > + ret = regmap_write(chg->pf1550->regmap, PF1550_CHARG_REG_CHG_INT_MASK,
> > + PF1550_CHG_INT_MASK);
> > + if (ret)
> > + return dev_err_probe(dev, ret,
> > + "Error unmask charger interrupt\n");
> > +
> > + ret = regmap_read(chg->pf1550->regmap, PF1550_CHARG_REG_VBUS_SNS,
> > + &data);
> > + if (ret)
> > + return dev_err_probe(dev, ret, "Read charg vbus_sns error\n");
>
> data is unused here :/
>
Yeah, that should be dropped.
> > +
> > + ret = pf1550_set_constant_volt(chg, chg->constant_volt);
> > + if (ret)
> > + return ret;
> > +
> > + ret = pf1550_set_min_system_volt(chg, chg->min_system_volt);
> > + if (ret)
> > + return ret;
> > +
> > + ret = pf1550_set_thermal_regulation_temp(chg,
> > + chg->thermal_regulation_temp);
> > + if (ret)
> > + return ret;
> > +
> > + /* Turn on charger */
> > + ret = regmap_write(chg->pf1550->regmap, PF1550_CHARG_REG_CHG_OPER,
> > + PF1550_CHG_TURNON);
> > + if (ret)
> > + return dev_err_probe(dev, ret, "Error turn on charger\n");
>
> There are 3 modes for the charger operation:
> 0: charger = off, linear = off
> 1: charger = off, linear = on
> 2: charger = on, linear = on
>
> The driver is hardcoded to use no. 2.
>
> We are using the mode 1, and setting it to 2 causes my system to boot loop.
>
> I don't know how we should select mode, maybe it could be an option from
> the devicetree or use power_supply_get_battery_info() to look for a
> battery and the only select between 1 or 2, but 0 would also be a valid
> option.
>
I like the latter solution of using the power_supply_get_battery_info. I think
selecting between only 1 or 2 should be fine.
Thanks,
Sam
next prev parent reply other threads:[~2025-07-11 16:27 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-07 21:37 [PATCH v8 0/6] add support for pf1550 PMIC MFD-based drivers Samuel Kayode via B4 Relay
2025-07-07 21:37 ` [PATCH v8 1/6] dt-bindings: mfd: add pf1550 Samuel Kayode via B4 Relay
2025-07-07 21:37 ` [PATCH v8 2/6] mfd: pf1550: add core driver Samuel Kayode via B4 Relay
2025-07-08 18:46 ` Christophe JAILLET
2025-07-10 14:08 ` Samuel Kayode
2025-07-10 14:54 ` Sean Nyekjaer
2025-07-10 17:11 ` Samuel Kayode
2025-07-07 21:37 ` [PATCH v8 3/6] regulator: pf1550: add support for regulator Samuel Kayode via B4 Relay
2025-07-10 14:49 ` Sean Nyekjaer
2025-07-10 17:01 ` Samuel Kayode
2025-07-10 17:11 ` Sean Nyekjaer
2025-07-10 17:29 ` Samuel Kayode
2025-07-11 10:04 ` Sean Nyekjaer
2025-07-07 21:37 ` [PATCH v8 4/6] input: pf1550: add onkey support Samuel Kayode via B4 Relay
2025-07-11 10:29 ` Sean Nyekjaer
2025-07-07 21:37 ` [PATCH v8 5/6] power: supply: pf1550: add battery charger support Samuel Kayode via B4 Relay
2025-07-11 9:02 ` Sean Nyekjaer
2025-07-11 16:27 ` Samuel Kayode [this message]
2025-07-07 21:37 ` [PATCH v8 6/6] MAINTAINERS: add an entry for pf1550 mfd driver Samuel Kayode via B4 Relay
2025-07-10 17:06 ` Samuel Kayode
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=aHE7d3gDITZMWEcH@fedora \
--to=samuel.kayode@savoirfairelinux.com \
--cc=Frank.li@nxp.com \
--cc=abelvesa@kernel.org \
--cc=abelvesa@linux.com \
--cc=b38343@freescale.com \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=eballetbo@gmail.com \
--cc=imx@lists.linux.dev \
--cc=krzk+dt@kernel.org \
--cc=lee@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sean@geanix.com \
--cc=sre@kernel.org \
--cc=yibin.gong@nxp.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).