linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Droid 4 charging
@ 2021-02-06 13:14 Pavel Machek
  2021-02-15  4:35 ` Tony Lindgren
  0 siblings, 1 reply; 5+ messages in thread
From: Pavel Machek @ 2021-02-06 13:14 UTC (permalink / raw)
  To: kernel list, linux-arm-kernel, linux-omap, tony, sre, nekit1000,
	mpartap, merlijn, martin_rysavy, phone-devel, maemo-leste

[-- Attachment #1: Type: text/plain, Size: 714 bytes --]

Hi!

(I'm using Leste 5.10 kernel here).

When battery is full, green light is off and 0.00A being drawn from
USB.

But that means that phone is now powered from battery, discharging
it... And soon charging starts again. (Pretty much immediately, for me)

That's bad ... right? It wears the battery out.

If I turn off charging with echo 0 > input_current_limit, 0.2 to 0.4A
is drawn from USB, and battery is not discharged:

root@devuan-droid4:/sys/class/power_supply/usb# echo 0 >  input_current_limit
root@devuan-droid4:/sys/class/power_supply/usb# cat current_now
0

Is that a better way to handle full battery?

Best regards,
								Pavel
-- 
http://www.livejournal.com/~pavelmachek

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Droid 4 charging
  2021-02-06 13:14 Droid 4 charging Pavel Machek
@ 2021-02-15  4:35 ` Tony Lindgren
  2021-02-19 21:57   ` Pavel Machek
  0 siblings, 1 reply; 5+ messages in thread
From: Tony Lindgren @ 2021-02-15  4:35 UTC (permalink / raw)
  To: Pavel Machek
  Cc: kernel list, linux-arm-kernel, linux-omap, sre, nekit1000,
	mpartap, merlijn, martin_rysavy, phone-devel, maemo-leste,
	Carl Philipp Klemm

Hi,

* Pavel Machek <pavel@ucw.cz> [210206 13:14]:
> Hi!
> 
> (I'm using Leste 5.10 kernel here).
> 
> When battery is full, green light is off and 0.00A being drawn from
> USB.
> 
> But that means that phone is now powered from battery, discharging
> it... And soon charging starts again. (Pretty much immediately, for me)
> 
> That's bad ... right? It wears the battery out.

Well maintenance charging at 4.2V sure is better for the battery than
what android is doing charging it at 4.31V contantly..

> If I turn off charging with echo 0 > input_current_limit, 0.2 to 0.4A
> is drawn from USB, and battery is not discharged:
> 
> root@devuan-droid4:/sys/class/power_supply/usb# echo 0 >  input_current_limit
> root@devuan-droid4:/sys/class/power_supply/usb# cat current_now
> 0

Hmm so have you measured that setting the current limit to 0 actually
draws something from the USB?

I recall clearing the ichrgr bits stops the vbus draw completely, but
I could be wrong.

> Is that a better way to handle full battery?

We could experiment with switching over to usb power when the battery is
full. Looking at the docs for mc1378 it might be possible that setting
CPCAP_REG_CRM_FET_OVRD and clearing CPCAP_REG_CRM_FET_CTRL after the
battery is full disables charging but still keep drawing power from
the usb. I'd assume the current limit still needs to be nonzero there
too? Totally untested..

And switching back to battery power on usb disconnect will potentially
only give us very little time based on the different line length for
vbus and ground pins compared to data pins on the usb connector.. And
uvos had some concerns about the battery capacity putting it back online,
so adding him to Cc also.

Maybe just clearing ichrgr does all this already though and is enough.
It should be measured on the vbus line.

And then we still need to restart the charger at some point, but that
could happen based on much longer timeouts that what we currently have.

Regards,

Tony

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Droid 4 charging
  2021-02-15  4:35 ` Tony Lindgren
@ 2021-02-19 21:57   ` Pavel Machek
  2021-02-21 20:56     ` Sebastian Reichel
  2021-02-22  7:56     ` Tony Lindgren
  0 siblings, 2 replies; 5+ messages in thread
From: Pavel Machek @ 2021-02-19 21:57 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: kernel list, linux-arm-kernel, linux-omap, sre, nekit1000,
	mpartap, merlijn, martin_rysavy, phone-devel, maemo-leste,
	Carl Philipp Klemm

[-- Attachment #1: Type: text/plain, Size: 2705 bytes --]

Hi!

> > (I'm using Leste 5.10 kernel here).
> > 
> > When battery is full, green light is off and 0.00A being drawn from
> > USB.
> > 
> > But that means that phone is now powered from battery, discharging
> > it... And soon charging starts again. (Pretty much immediately, for me)
> > 
> > That's bad ... right? It wears the battery out.
> 
> Well maintenance charging at 4.2V sure is better for the battery than
> what android is doing charging it at 4.31V contantly..

Well, 4.2 is better than 4.3, but I'm not sure about the rest.

> > If I turn off charging with echo 0 > input_current_limit, 0.2 to 0.4A
> > is drawn from USB, and battery is not discharged:
> > 
> > root@devuan-droid4:/sys/class/power_supply/usb# echo 0 >  input_current_limit
> > root@devuan-droid4:/sys/class/power_supply/usb# cat current_now
> > 0
> 
> Hmm so have you measured that setting the current limit to 0 actually
> draws something from the USB?

Yes, it does, if I do the echo when charge is done. (I have small USB
passthrough with volt and amp meters). It has been behaving weirdly in
other cases.p

> I recall clearing the ichrgr bits stops the vbus draw completely, but
> I could be wrong.
> 
> > Is that a better way to handle full battery?
> 
> We could experiment with switching over to usb power when the battery is
> full. Looking at the docs for mc1378 it might be possible that setting
> CPCAP_REG_CRM_FET_OVRD and clearing CPCAP_REG_CRM_FET_CTRL after the
> battery is full disables charging but still keep drawing power from
> the usb. I'd assume the current limit still needs to be nonzero there
> too? Totally untested..

I may be able to test patches...

> And switching back to battery power on usb disconnect will potentially
> only give us very little time based on the different line length for
> vbus and ground pins compared to data pins on the usb connector.. And
> uvos had some concerns about the battery capacity putting it back online,
> so adding him to Cc also.

You mean, we'd have to take interrupt and switch registers in order to
switch back to battery power, and system would crash if we did not
make it in time?

> Maybe just clearing ichrgr does all this already though and is enough.
> It should be measured on the vbus line.

It works for me... measuring current at the usb connector.

> And then we still need to restart the charger at some point, but that
> could happen based on much longer timeouts that what we currently have.

Li-ion batteries are very slow to self-discharge. This could timeout
could be week... or maybe a year.

Best regards,
								Pavel
-- 
http://www.livejournal.com/~pavelmachek

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Droid 4 charging
  2021-02-19 21:57   ` Pavel Machek
@ 2021-02-21 20:56     ` Sebastian Reichel
  2021-02-22  7:56     ` Tony Lindgren
  1 sibling, 0 replies; 5+ messages in thread
From: Sebastian Reichel @ 2021-02-21 20:56 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Tony Lindgren, kernel list, linux-arm-kernel, linux-omap,
	nekit1000, mpartap, merlijn, martin_rysavy, phone-devel,
	maemo-leste, Carl Philipp Klemm

[-- Attachment #1: Type: text/plain, Size: 542 bytes --]

Hi,

On Fri, Feb 19, 2021 at 10:57:53PM +0100, Pavel Machek wrote:
> > And then we still need to restart the charger at some point, but that
> > could happen based on much longer timeouts that what we currently have.
> 
> Li-ion batteries are very slow to self-discharge. This could timeout
> could be week... or maybe a year.

True, as long as the battery is not connected to anything. When connected
to something there are often leak currents. So leak currents must be
measured to figure out a sensible timeout.

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Droid 4 charging
  2021-02-19 21:57   ` Pavel Machek
  2021-02-21 20:56     ` Sebastian Reichel
@ 2021-02-22  7:56     ` Tony Lindgren
  1 sibling, 0 replies; 5+ messages in thread
From: Tony Lindgren @ 2021-02-22  7:56 UTC (permalink / raw)
  To: Pavel Machek
  Cc: kernel list, linux-arm-kernel, linux-omap, sre, nekit1000,
	mpartap, merlijn, martin_rysavy, phone-devel, maemo-leste,
	Carl Philipp Klemm

* Pavel Machek <pavel@ucw.cz> [210219 21:58]:
> > > If I turn off charging with echo 0 > input_current_limit, 0.2 to 0.4A
> > > is drawn from USB, and battery is not discharged:
> > > 
> > > root@devuan-droid4:/sys/class/power_supply/usb# echo 0 >  input_current_limit
> > > root@devuan-droid4:/sys/class/power_supply/usb# cat current_now
> > > 0
> > 
> > Hmm so have you measured that setting the current limit to 0 actually
> > draws something from the USB?
> 
> Yes, it does, if I do the echo when charge is done. (I have small USB
> passthrough with volt and amp meters). It has been behaving weirdly in
> other cases.p

OK great, seems like we can just change the charger timeout then.

> > I recall clearing the ichrgr bits stops the vbus draw completely, but
> > I could be wrong.
> > 
> > > Is that a better way to handle full battery?
> > 
> > We could experiment with switching over to usb power when the battery is
> > full. Looking at the docs for mc1378 it might be possible that setting
> > CPCAP_REG_CRM_FET_OVRD and clearing CPCAP_REG_CRM_FET_CTRL after the
> > battery is full disables charging but still keep drawing power from
> > the usb. I'd assume the current limit still needs to be nonzero there
> > too? Totally untested..
> 
> I may be able to test patches...

Yeah this too might be worth testing on some donor device..

> > And switching back to battery power on usb disconnect will potentially
> > only give us very little time based on the different line length for
> > vbus and ground pins compared to data pins on the usb connector.. And
> > uvos had some concerns about the battery capacity putting it back online,
> > so adding him to Cc also.
>
> You mean, we'd have to take interrupt and switch registers in order to
> switch back to battery power, and system would crash if we did not
> make it in time?

Yes hopefully we don't need to do that. My guess is we should find some
FET_OVRD and FET_CTRL setting we can always keep enabled after charger
negotation. Maybe we already have the right settings based on your tests :)

Regards,

Tony



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-02-22  7:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-06 13:14 Droid 4 charging Pavel Machek
2021-02-15  4:35 ` Tony Lindgren
2021-02-19 21:57   ` Pavel Machek
2021-02-21 20:56     ` Sebastian Reichel
2021-02-22  7:56     ` Tony Lindgren

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).