All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: "Vaittinen, Matti" <Matti.Vaittinen@fi.rohmeurope.com>
Cc: Sebastian Reichel <sre@kernel.org>,
	Marcus Cooper <codekipper@gmail.com>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>
Subject: Re: [PATCH 1/2] power: supply: ab8500: Respect charge_restart_voltage_uv
Date: Thu, 5 May 2022 22:17:09 +0200	[thread overview]
Message-ID: <CACRpkdYCWYgUAUJVVKy0jU4yF=d95e0Ead=coeMaA=uD3WV35Q@mail.gmail.com> (raw)
In-Reply-To: <a1ad97a5-4048-1f8e-272b-6d1e99bd20cf@fi.rohmeurope.com>

Hi Matti,

sorry for slow replies!

On Tue, Apr 19, 2022 at 10:51 AM Vaittinen, Matti
<Matti.Vaittinen@fi.rohmeurope.com> wrote:

> Hi again Linus,
>
> For some reason I am always slightly terrified when charging is
> controlled by the software ;)

That is a normal reaction... The AB8500 has a few hardware safeguards
to make sure it is somewhat safe. Such as multiple thermal sensors
and over-voltage protection. But it also has a pretty elaborate state
machine.

> On 4/15/22 23:36, Linus Walleij wrote:

> > +     /* Some batteries tell us at which voltage we should restart charging */
>
> Is utilizing this limit something that has already existed for these
> batteries?

Yes, look for example at the Kyle battery, Samsung SDI EB425161LA:
https://github.com/linusw/u8500/blob/Samsung-SGH-I407-Kyle/arch/arm/mach-ux500/board-kyle-bm.c
line 312 called "recharge_vol" is set to 4.3 V
Then in the charging algorithm:
https://github.com/linusw/u8500/blob/Samsung-SGH-I407-Kyle/drivers/power/ab8500_chargalg.c
line 2229 you can see how it is used the same way.

> I am just slightly worrying if this can cause problems at low
> temperatures? I am by no means an expert on this area (as I've told
> earlier :]) so I may be completely off here. Anyways, I think I've seen
> voltage curves for batteries at different temparetures - and AFAIR, the
> voltage of a battery with near 100% SOC at -20  Ccan be close to the
> voltage of a nearly depleted battery at +40 C.

Probably true, because the batteries have operational conditions for
low/high temperatures which change the behaviour of the charging,
so that is how they choose to deal with this.

> Hence I am just asking if this is not causing my phone to keep charging
> even when the battery is full. I mean, when I am at next autumn spending
> the night in a tent at Enontekiö Finland - and forget to disconnect my
> phone from charger before the campfire fades away? :]

The battery in my example EB425161LA is defined in
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/power/supply/samsung-sdi-battery.c
lines 677-719, there you find .temp_alert_min = 0, and if you look in
the charging algorithm:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/power/supply/ab8500_chargalg.c
below that temperature the charging algorithm will switch to a lower recharging
current by going into the state TEMP_UNDEROVER where this
recharging voltage does not apply, instead a much lower voltage
alert_low_temp_charge_voltage_uv = 4000000 will apply, 4.0V
instead of 4.3V.

Further you see that temp_min = -30, so if the temperature goes
below -30 degrees, the algorithm will shut down charging altogether.

Yours,
Linus Walleij

  reply	other threads:[~2022-05-05 20:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-15 20:36 [PATCH 1/2] power: supply: ab8500: Respect charge_restart_voltage_uv Linus Walleij
2022-04-15 20:36 ` [PATCH 2/2] power: supply: ab8500: Exit maintenance if too low voltage Linus Walleij
2022-04-19  9:26   ` Matti Vaittinen
2022-04-19  9:44     ` Matti Vaittinen
2022-05-05 20:22     ` Linus Walleij
2022-04-19  8:50 ` [PATCH 1/2] power: supply: ab8500: Respect charge_restart_voltage_uv Vaittinen, Matti
2022-05-05 20:17   ` Linus Walleij [this message]
2022-05-06  5:38     ` Vaittinen, Matti
2022-05-09 10:33       ` Linus Walleij
2022-05-09 13:27         ` Vaittinen, Matti
2022-05-20 21:36 ` Linus Walleij
2022-06-09 20:12   ` Sebastian Reichel

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='CACRpkdYCWYgUAUJVVKy0jU4yF=d95e0Ead=coeMaA=uD3WV35Q@mail.gmail.com' \
    --to=linus.walleij@linaro.org \
    --cc=Matti.Vaittinen@fi.rohmeurope.com \
    --cc=codekipper@gmail.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=sre@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 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.