linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Machek <pavel-+ZI9xUNit7I@public.gmane.org>
To: NeilBrown <neilb-l3A5Bk7waGM@public.gmane.org>
Cc: NeilBrown <neil-+NVA1uvv1dVBDLzU/O5InQ@public.gmane.org>,
	Sebastian Reichel <sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	GTA04 owners
	<gta04-owner-xXXSsgcRVICgSpxsJD1C4w@public.gmane.org>,
	inux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Subject: Re: [PATCH 13/14] twl4030_charger: Increase current carefully while watching voltage.
Date: Sat, 4 Apr 2015 09:48:32 +0200	[thread overview]
Message-ID: <20150404074832.GB31064@amd> (raw)
In-Reply-To: <20150330082637.4bf4832d-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>

Hi!

> > > The USB Battery Charging spec (BC1.2) suggests a dedicated
> > > charging port can deliver from 0.5 to 5.0A at between 4.75 and 5.25
> > > volts.
> > > 
> > > To choose the "correct" current voltage setting requires a trial
> > > and error approach: try to draw current and see if the voltage drops
> > > too low.
> > > 
> > > Even with a configured Standard Downstream Port, it may not be possible
> > > to reliably pull 500mA - depending on cable quality and source
> > > quality I have reports of charging failure due to the voltage dropping
> > > too low.
> > > 
> > > To address both these concerns, this patch introduce incremental
> > > current setting.
> > > The current pull from VBUS is increased in steps of 20mA every 100ms
> > > until the target is reached or until the measure voltage drops below
> > > 4.75V.  If the voltage does go too low, the target current is reduced
> > > by 20mA and kept there.
> > 
> > Still nervous. If it is possible to overheat the charger, without
> > tripping internal fuse, then you'll do it.
> 
> If it is possible to overheat the charger without tripping an internal fuse,
> then sure the charger is mis-designed - is it not?
> 
> Can you suggest an algorithm for determining how much current can safely be
> pulled from a charger that would *not* make you nervous?

Not nervous? No.

Less nervous?

Run detection as you do, but then round down to "known reasonable"
max charging currents?

If you detected 1.1A charger, you are probably overloading 1A
charger. So idea would be to round down to 0.5A, 1A, 1.7A.


> > Idle device. Code will find that it can charge using 1A, backs up to
> > 0.9A. User starts hotspot. Now device will draw 1.4A, overloading the
> > charger and not charging at all...?
> 
> The current being measured and controlled is the current flowing in from the
> USB VBUS, not flowing out to the battery.
> So I the code choose 0.9A, that is all that will be drawn.
> 
> This is a possible issue similar to this though.
> If the device is idle and the battery is fully charged, then it won't draw
> much current from USB even if we allow it too.
> So the algorithm might decide it is OK to draw 1.7A because at that time the
> device cannot use more than 200mA, and that doesn't cause the voltage to drop.
> 
> Then later when user enabled wifi-hotspot, the current needed might go up
> above what the charger can provide.
> 
> Maybe I should only increase the limit while the actual current is also
> increasing.  Maybe also revisit the setting when the battery starts charging.

Yes, that sounds better.
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

  parent reply	other threads:[~2015-04-04  7:48 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-22 23:20 [PATCH 00/14] Enhance twl4030_charger functionality. - V2 NeilBrown
2015-03-22 23:20 ` [PATCH 01/14] twl4030_charger: use devm_request_threaded_irq NeilBrown
2015-07-24 14:34   ` Sebastian Reichel
2015-03-22 23:20 ` [PATCH 04/14] twl4030_charger: trust phy to determine when USB power is available NeilBrown
2015-03-22 23:20 ` [PATCH 03/14] twl4030_charger: use runtime_pm to keep usb phy active while charging NeilBrown
2015-03-22 23:20 ` [PATCH 02/14] twl4030_charger: use devres for power_supply_register and kzalloc NeilBrown
2015-03-23 21:25   ` Pavel Machek
     [not found]   ` <20150322232028.23789.38570.stgit-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
2015-07-24 14:35     ` Sebastian Reichel
2015-03-22 23:20 ` [PATCH 05/14] twl4030_charger: split uA calculation into a function NeilBrown
2015-03-22 23:20 ` [PATCH 07/14] twl4030_charger: distinguish between USB current and 'AC' current NeilBrown
2015-03-22 23:20 ` [PATCH 13/14] twl4030_charger: Increase current carefully while watching voltage NeilBrown
2015-03-23 21:25   ` Pavel Machek
2015-03-29 21:26     ` NeilBrown
     [not found]       ` <20150330082637.4bf4832d-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
2015-04-04  7:48         ` Pavel Machek [this message]
2015-03-22 23:20 ` [PATCH 12/14] twl4030_charger: add ac/mode to match usb/mode NeilBrown
2015-03-22 23:20 ` [PATCH 10/14] twl4030_charger: enable manual enable/disable of usb charging NeilBrown
2015-03-22 23:20 ` [PATCH 14/14] twl4030_charger: assume a 'charger' can supply maximum current NeilBrown
2015-03-22 23:20 ` [PATCH 06/14] twl4030_charger: allow fine control of charger current NeilBrown
2015-03-22 23:20 ` [PATCH 09/14] twl4030_charger: only draw USB current as negotiated with host NeilBrown
2015-03-22 23:20 ` [PATCH 08/14] twl4030_charger: allow max_current to be managed via sysfs NeilBrown
     [not found]   ` <20150322232029.23789.13768.stgit-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
2015-03-23 12:14     ` [Gta04-owner] " jake42
2015-07-29 22:10       ` NeilBrown
     [not found] ` <20150322231635.23789.70149.stgit-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
2015-03-22 23:20   ` [PATCH 11/14] twl4030_charger: add software controlled linear charging mode NeilBrown
2015-07-24 14:44   ` [PATCH 00/14] Enhance twl4030_charger functionality. - V2 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=20150404074832.GB31064@amd \
    --to=pavel-+zi9xunit7i@public.gmane.org \
    --cc=gta04-owner-xXXSsgcRVICgSpxsJD1C4w@public.gmane.org \
    --cc=inux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=neil-+NVA1uvv1dVBDLzU/O5InQ@public.gmane.org \
    --cc=neilb-l3A5Bk7waGM@public.gmane.org \
    --cc=sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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;
as well as URLs for NNTP newsgroup(s).