linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@kernel.org>
To: Pavel Machek <pavel@ucw.cz>
Cc: Baolin Wang <baolin.wang@linaro.org>,
	Greg KH <gregkh@linuxfoundation.org>,
	Sebastian Reichel <sre@kernel.org>,
	Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Peter Chen <peter.chen@freescale.com>,
	Alan Stern <stern@rowland.harvard.edu>,
	r.baldyga@samsung.com,
	Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
	Lee Jones <lee.jones@linaro.org>, Mark Brown <broonie@kernel.org>,
	Charles Keepax <ckeepax@opensource.wolfsonmicro.com>,
	patches@opensource.wolfsonmicro.com,
	Linux PM list <linux-pm@vger.kernel.org>,
	USB <linux-usb@vger.kernel.org>,
	device-mainlining@lists.linuxfoundation.org,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v7 1/4] gadget: Introduce the usb charger framework
Date: Mon, 18 Apr 2016 13:45:08 +0300	[thread overview]
Message-ID: <871t63gpqj.fsf@intel.com> (raw)
In-Reply-To: <20160418103350.GB27936@amd>

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


Hi,

Pavel Machek <pavel@ucw.cz> writes:
>> >> > 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.

phone can't read what it says in the wall charger, nor can it know that
it's connected charger ABC and not charger XYZ. Think of the user
experience. You can't expect users to tell you "okay phone, the charger
reads that maximum is 1.5A, so please don't go over that."

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

it actually _is_ more unsafe. You could burn mother boards with that. If
host tells you it only has 100mA power budget left, why are you trying
to get more ?

> machines in useful way. So it is important that common API
> exists. Whether it gets enalbed at production is different question.

as I said, if you wanna do some unsafe manual method, be my guest; but
I'm not convinced that every user of the linux kernel wants that in
their pockets.

> Unfortunately, there's more than one standard for detecting charger,
> so manual control will probably be required.

n900 never had manual control of anything. It was just using information
given by the battery IC, charger IC and twl4030 madc.

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

yes. You shouldn't. You also shouldn't go over that limit. If you have a
500mA total power budget, we should not let anybody try to draw more
because we have no control over what's on the side of the wire.

-- 
balbi

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

  reply	other threads:[~2016-04-18 10:47 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-16 11:46 [PATCH v7 0/4] Introduce usb charger framework to deal with the usb gadget power negotation Baolin Wang
2016-03-16 11:46 ` [PATCH v7 1/4] gadget: Introduce the usb charger framework Baolin Wang
2016-03-16 12:09   ` Oliver Neukum
2016-03-17  1:58     ` Baolin Wang
2016-03-30 10:09   ` Felipe Balbi
2016-03-30 17:44     ` Mark Brown
2016-03-31  6:21       ` Felipe Balbi
2016-03-31  6:28     ` Baolin Wang
2016-03-31  6:42       ` Felipe Balbi
2016-03-22 11:30         ` Pavel Machek
2016-04-18  8:12           ` Felipe Balbi
2016-04-18 10:23             ` Pavel Machek
2016-04-18 10:30               ` Felipe Balbi
2016-04-18 10:39                 ` Pavel Machek
2016-04-18 10:49                   ` Felipe Balbi
2016-04-18 10:55                     ` Felipe Balbi
2016-04-18 11:13                       ` Pavel Machek
2016-04-18 11:42                         ` Felipe Balbi
2016-04-18 12:58                           ` Pavel Machek
2016-04-18 13:34                             ` Felipe Balbi
2016-04-18 10:59                   ` David Laight
2016-04-18 11:23                     ` Pavel Machek
2016-03-31  8:03         ` Baolin Wang
2016-03-22 11:29           ` Pavel Machek
2016-04-18  8:18             ` Felipe Balbi
2016-04-18 10:33               ` Pavel Machek
2016-04-18 10:45                 ` Felipe Balbi [this message]
2016-04-18 11:03                   ` Pavel Machek
2016-04-18 11:51                     ` Felipe Balbi
2016-04-18 13:16                       ` Pavel Machek
2016-04-18 13:30                         ` Felipe Balbi
2016-03-31  8:18           ` Felipe Balbi
2016-03-31  8:35             ` Baolin Wang
2016-03-31 10:06               ` Felipe Balbi
2016-03-31 11:12                 ` Baolin Wang
2016-03-31 17:06         ` Mark Brown
2016-04-01  5:43           ` Felipe Balbi
2016-04-01 14:16             ` Mark Brown
2016-04-04 10:47               ` Felipe Balbi
2016-04-04 16:04                 ` Mark Brown
2016-04-04 18:44                   ` Greg KH
2016-03-16 11:46 ` [PATCH v7 2/4] gadget: Support for " Baolin Wang
2016-03-16 12:50   ` kbuild test robot
2016-03-16 20:19   ` kbuild test robot
2016-03-16 11:46 ` [PATCH v7 3/4] gadget: Integrate with the usb gadget supporting for usb charger Baolin Wang
2016-03-16 11:46 ` [PATCH v7 4/4] power: wm831x_power: Support USB charger current limit management Baolin Wang
2016-03-16 11:48 ` [PATCH v7 0/4] Introduce usb charger framework to deal with the usb gadget power negotation Felipe Balbi
2016-03-16 11:56   ` Baolin Wang
  -- strict thread matches above, loose matches on Subject: below --
2016-01-04  3:04 Baolin Wang
2016-01-04  3:04 ` [PATCH v7 1/4] gadget: Introduce the usb charger framework Baolin Wang
2015-12-08  8:36 [PATCH v7 0/4] Introduce usb charger framework to deal with the usb gadget power negotation Baolin Wang
2015-12-08  8:36 ` [PATCH v7 1/4] gadget: Introduce the usb charger framework Baolin Wang

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=871t63gpqj.fsf@intel.com \
    --to=balbi@kernel.org \
    --cc=baolin.wang@linaro.org \
    --cc=broonie@kernel.org \
    --cc=ckeepax@opensource.wolfsonmicro.com \
    --cc=dbaryshkov@gmail.com \
    --cc=device-mainlining@lists.linuxfoundation.org \
    --cc=dwmw2@infradead.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=patches@opensource.wolfsonmicro.com \
    --cc=pavel@ucw.cz \
    --cc=peter.chen@freescale.com \
    --cc=r.baldyga@samsung.com \
    --cc=sre@kernel.org \
    --cc=stern@rowland.harvard.edu \
    --cc=yoshihiro.shimoda.uh@renesas.com \
    /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).