Re: [PATCH v7 1/4] gadget: Introduce the usb charger framework
From: Pavel Machek
Date: Mon Apr 18 2016 - 06:33:58 EST
Hi!
> >> > a) you are connected to a dedicated charger
> >> >
> >> > In this case, you can get up to 2000mA depending on the charger.
> >> >
> >> > If $this charger can give you or not 2000mA is not detectable,
> >> > so what do charging ICs do ? They slowly increase the attached
> >> > load accross VBUS/GND and measure VBUS value. When IC notices
> >> > VBUS dropping bit, step back to previous load.
> >> >
> >> > This means you will always charger with maximum rating of DCP.
> >> >
> >> > Why would user change this ? More is unsafe, less is just
> >> > stupid.
> >
> > Less is not neccessarily stupid. First, it is useful for debugging, second, you
> > don't know how much this charger can give you. You measured you can get 1.8A,
> > but the note on the charger says 1.5A. You may want to go with 1.5A.
> >
> > Also, there are several incompatible standards for detecting
> > "dedicated charger". IIRC iPhone has different one from iPad. So it is
> > quite important to be able to control this manually.
>
> manually ??? Hell no! Charger IC should be able to do this no
> problem. I would be surprised if there's any charger IC out there which
> blindly connects a 1.8A load from the start. What these ICs do is that
> they slowly increment the load and check voltage level. They'll continue
> to do that up to the maximum you listed (1.8A, let's say). As soon as
> voltage drops a bit, charger IC knows that it use previous load.
As I explained, if the note on the wall charger says 1.5A, you want to
do 1.5A, not 1.8A. You can measure voltage on the charger, but you
don't know its temperature.
> >> > d) you are connected to a standard port and get enumerated with your
> >> > 100mA configuration.
> >> >
> >> > you *know* 100mA is okay. So you connect a 100mA load and get it
> >> > over with.
> >> >
> >> > This means you will always charger with maximum rating for this
> >> > SDP.
> >> >
> >> > Why would user change this ? More is unsafe, less is just
> >> > stupid.
> >
> > I've needed to override 100mA default many times. Maybe it is unsafe,
> > but it is useful.
>
> still unsafe. If you really wanna do that, you're welcome to removing
> safety margins from your own kernel, but we're definitely not going to
> ship this to millions of users.
Not more unsafe than loading wall chargers with "lets see how much we
can get out of it" algorithm. Plus actually required to charge your
machines in useful way. So it is important that common API
exists. Whether it gets enalbed at production is different question.
Unfortunately, there's more than one standard for detecting charger,
so manual control will probably be required.
> > (And with USB 5V connected directly to pretty beefy PC power supply...
> > it is sometimes safer than it looks).
>
> you're not considering the thermal dissipation on the USB connector
> itself. Many of them might not use good metals because they assume the
> maximum power dissipated is 500mA * 5V = 2.5W. If you try to draw more,
> you could, literally, melt the connector.
If you are dissipating 2.5W at the connector, you are doing something
very wrong. You should not be short-circuiting your USB... even when
the ports are usually designed to survive that.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html