[PATCH v4 RESEND 0/4] power: supply: Add Support for RK817 Charger

Chris Morgan macromorgan at hotmail.com
Tue Nov 30 08:10:21 PST 2021


On Tue, Nov 30, 2021 at 03:03:03AM +0100, Nicolas Frattaroli wrote:
> On Donnerstag, 16. September 2021 21:42:04 CET Chris Morgan wrote:
> > From: Chris Morgan <macromorgan at hotmail.com>
> > 
> > This series is to add support for the Rockchip rk817 battery charger
> > which is present in all Rockchip RK817 PMICs. The driver was written
> > as a joint effort by Maya Matuszczyk <maccraft123mc at gmail.com> and
> > myself Chris Morgan <macromorgan at hotmail.com>.
> 
> Hi Chris and Maya,
> 
> Gave this a whirl on my Quartz64 Model A. I noticed that this will
> happily let me discharge past voltage_min_design:
> 
>  $ cat /sys/class/power_supply/rk817-battery/voltage_min_design 
>  3625000
>  $ cat /sys/class/power_supply/rk817-battery/voltage_avg 
>  3381360
> 
> Is this normal? It went all the way to under 3V before the
> board finally locked up.
> 
> Does the minimum voltage not affect some sort of cutout on
> the RK817? Does it even have one? Is it the driver's job to
> do something here or not?

It does not look like I coded that, but I can. The PMIC has a
selectable register (RK817_PMIC_SYS_CFG0 = 0xf1) to automatically shut
down the system at a certain voltage (between 2.7v and 3.4v in
increments of 100mv; bits 6-4), a register to set a low voltage value
(between 2.8v and 3.5v in increments of 100mv; bits 2-0), and a
register to set a low voltage action (either shut down the machine or
trigger an interrupt; bit 3 and then I believe the interrupt is read at
bit 7 of RK817_PMIC_INT_STS0 - 0xf8).

I guess I just assumed userspace would handle it, but that's probably
a bad assumption. What if I set the low voltage value to either 3.5v
or the min design voltage, whichever is less; and then set the low
voltage trigger to shut down the system? This would prevent your
battery from dropping below 3.5v or the min design voltage (whichever
is less, sadly 3.5v is as high as I can go for the minimum) in the
event userspace doesn't take action first? We could also set the
shutdown voltage to be 100mv less than the min design voltage and use
the low voltage interrupt to trigger an action, but I'm not sure what
action would be appropriate (and if userspace isn't listening it would
be moot anyway).

Thank you.

> 
> Regards,
> Nicolas Frattaroli
> 
> 



More information about the Linux-rockchip mailing list