Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1381360 > unrolled thread

Re: [PATCH v7 1/4] gadget: Introduce the usb charger framework

Started byFelipe Balbi <balbi@kernel.org>
First post2016-04-18 10:20 +0200
Last post2016-04-18 12:40 +0200
Articles 12 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v7 1/4] gadget: Introduce the usb charger framework Felipe Balbi <balbi@kernel.org> - 2016-04-18 10:20 +0200
    Re: [PATCH v7 1/4] gadget: Introduce the usb charger framework Pavel Machek <pavel@ucw.cz> - 2016-04-18 12:30 +0200
      Re: [PATCH v7 1/4] gadget: Introduce the usb charger framework Pavel Machek <pavel@ucw.cz> - 2016-04-18 12:40 +0200
        Re: [PATCH v7 1/4] gadget: Introduce the usb charger framework Felipe Balbi <balbi@kernel.org> - 2016-04-18 13:00 +0200
          Re: [PATCH v7 1/4] gadget: Introduce the usb charger framework Pavel Machek <pavel@ucw.cz> - 2016-04-18 13:20 +0200
            Re: [PATCH v7 1/4] gadget: Introduce the usb charger framework Felipe Balbi <balbi@kernel.org> - 2016-04-18 13:50 +0200
              Re: [PATCH v7 1/4] gadget: Introduce the usb charger framework Pavel Machek <pavel@ucw.cz> - 2016-04-18 15:00 +0200
                Re: [PATCH v7 1/4] gadget: Introduce the usb charger framework Felipe Balbi <balbi@kernel.org> - 2016-04-18 15:40 +0200
        Re: [PATCH v7 1/4] gadget: Introduce the usb charger framework Felipe Balbi <balbi@kernel.org> - 2016-04-18 13:00 +0200
        Re: [PATCH v7 1/4] gadget: Introduce the usb charger framework Pavel Machek <pavel@ucw.cz> - 2016-04-18 13:30 +0200
        RE: [PATCH v7 1/4] gadget: Introduce the usb charger framework David Laight <David.Laight@ACULAB.COM> - 2016-04-18 13:30 +0200
      Re: [PATCH v7 1/4] gadget: Introduce the usb charger framework Felipe Balbi <balbi@kernel.org> - 2016-04-18 12:40 +0200

#1381360 — Re: [PATCH v7 1/4] gadget: Introduce the usb charger framework

FromFelipe Balbi <balbi@kernel.org>
Date2016-04-18 10:20 +0200
SubjectRe: [PATCH v7 1/4] gadget: Introduce the usb charger framework
Message-ID<rpczx-2aB-21@gated-at.bofh.it>

[Multipart message — attachments visible in raw view] — view raw

Hi,

Pavel Machek <pavel@ucw.cz> writes:
>> >>> +#define DEFAULT_SDP_CUR_LIMIT        (500 - DEFAULT_CUR_PROTECT)
>> >>
>> >> According to the spec we should always be talking about unit loads (1
>> >> unit load is 100mA for HS/FS/LS and 150mA for SS). Also, this will not
>> >> work for SS capable ports and SS gadgets (we have quite a few of them,
>> >> actually). You're missing the opportunity of charging at 900mA.
>> >
>> > I follow the DCP/SDP/CDP/ACA type's default current limitation and
>> > user can set them what they want.
>> 
>> no, the user CANNOT set it to what they want. If you get enumerated
>> @100mA and the user just decides to set it to 2000mA, s/he could even
>> melt the USB connector. The kernel _must_ prevent such cases.
>
> root should be allowed to do that.

root should not be allowed to put user at risk. The usb connector is a
path to earth ground in most (all?) desktop computers. Allowing root to
put that connector in a situation where it could melt the connector and
short mains should never be allowed.

> Very often, you want to charge using 1.8A from an old desktop PC.

if that old desktop's port is not a charging port, you shouldn't be
allowed to do that. Not ever.

> N900 will simply not charge from .5A.

it used to with original maemo userspace/kernel.

>> 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.
>
> Actually, less is not stupid. Charging li-ion battery from li-ion battery might
> be stupid. Imagine I'm on train, with device like N900 (50% battery) and power bank
> (3Ah). I'm actively using the device. If I let it charge at full current, I'll waste
> energy. If I limit current to approximately the power consumption, it will run the
> powerbank empty, first, then empty the internal battery, maximizing total time I
> can use the device.

why would you waste energy ? What the charger chip would do is charge
battery to maximum then just to maintenance charge from that point
on. Where is energy being wasted other than normal heat dissipation ?

-- 
balbi

[toc] | [next] | [standalone]


#1381462

FromPavel Machek <pavel@ucw.cz>
Date2016-04-18 12:30 +0200
Message-ID<rpeBk-3TK-11@gated-at.bofh.it>
In reply to#1381360
Hi!

> >> >>> +#define DEFAULT_SDP_CUR_LIMIT        (500 - DEFAULT_CUR_PROTECT)
> >> >>
> >> >> According to the spec we should always be talking about unit loads (1
> >> >> unit load is 100mA for HS/FS/LS and 150mA for SS). Also, this will not
> >> >> work for SS capable ports and SS gadgets (we have quite a few of them,
> >> >> actually). You're missing the opportunity of charging at 900mA.
> >> >
> >> > I follow the DCP/SDP/CDP/ACA type's default current limitation and
> >> > user can set them what they want.
> >> 
> >> no, the user CANNOT set it to what they want. If you get enumerated
> >> @100mA and the user just decides to set it to 2000mA, s/he could even
> >> melt the USB connector. The kernel _must_ prevent such cases.
> >
> > root should be allowed to do that.
> 
> root should not be allowed to put user at risk. The usb connector is a
> path to earth ground in most (all?) desktop computers. Allowing root to
> put that connector in a situation where it could melt the connector and
> short mains should never be allowed.

Be sure that hardware people put reasonable precautions...

> > Very often, you want to charge using 1.8A from an old desktop PC.
> 
> if that old desktop's port is not a charging port, you shouldn't be
> allowed to do that. Not ever.

Yes, Felipe just decided that I should not be able to charge my N900
in useful way.

> > N900 will simply not charge from .5A.
> 
> it used to with original maemo userspace/kernel.

Yeah, at about 10% per night.

> >> 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.
> >
> > Actually, less is not stupid. Charging li-ion battery from li-ion battery might
> > be stupid. Imagine I'm on train, with device like N900 (50% battery) and power bank
> > (3Ah). I'm actively using the device. If I let it charge at full current, I'll waste
> > energy. If I limit current to approximately the power consumption, it will run the
> > powerbank empty, first, then empty the internal battery, maximizing total time I
> > can use the device.
> 
> why would you waste energy ? What the charger chip would do is charge
> battery to maximum then just to maintenance charge from that point
> on. Where is energy being wasted other than normal heat dissipation ?

Physics 101, of course wasted energy goes to heat. Lets not waste
energy by charging li-ion from li-ion when it is not required.

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

[toc] | [prev] | [next] | [standalone]


#1381465

FromPavel Machek <pavel@ucw.cz>
Date2016-04-18 12:40 +0200
Message-ID<rpeL0-3XZ-1@gated-at.bofh.it>
In reply to#1381462
On Mon 2016-04-18 13:30:54, Felipe Balbi wrote:
> 
> Hi,
> 
> Pavel Machek <pavel@ucw.cz> writes:
> >> > Very often, you want to charge using 1.8A from an old desktop PC.
> >> 
> >> if that old desktop's port is not a charging port, you shouldn't be
> >> allowed to do that. Not ever.
> >
> > Yes, Felipe just decided that I should not be able to charge my N900
> > in useful way.
> 
> you can do whatever you want with *your* kernel binary, but we're not
> gonna ship something potentially dangerous. If that PC port is telling
> you it can only allow 100mA, you should *not* be allowed to overcome
> that limitation from the device side, sorry.

Yes, and if your cpu tells you it can only run on 2GHz, you should not
be able to run it on 2.1GHz. And you should not be able to use
non-VESA VGA modes, because you could overheat coils in the monitor.

You are shipping something potentially dangerous already, because you
know, USB-A-to-micro-B cables with D+/D- connected to simulate charger
are actually very common. The world did not end, yet, so it is clearly
not as bad as you make it be.

> >> >> 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.
> >> >
> >> > Actually, less is not stupid. Charging li-ion battery from li-ion battery might
> >> > be stupid. Imagine I'm on train, with device like N900 (50% battery) and power bank
> >> > (3Ah). I'm actively using the device. If I let it charge at full current, I'll waste
> >> > energy. If I limit current to approximately the power consumption, it will run the
> >> > powerbank empty, first, then empty the internal battery, maximizing total time I
> >> > can use the device.
> >> 
> >> why would you waste energy ? What the charger chip would do is charge
> >> battery to maximum then just to maintenance charge from that point
> >> on. Where is energy being wasted other than normal heat dissipation ?
> >
> > Physics 101, of course wasted energy goes to heat. Lets not waste
> > energy by charging li-ion from li-ion when it is not required.
> 
> your cellphone has no means to know that it's connected to a Li-Ion
> battery. We don't have visibility on what we're connected to, just how
> much it can source.

But cellphone user knows what he connected his charger to, and that's
why it is useful to be able to lower the current. Even when you said
"less is just stupid" I demonstrated it is not, at least in case when
your power source is a battery.
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[toc] | [prev] | [next] | [standalone]


#1381505

FromFelipe Balbi <balbi@kernel.org>
Date2016-04-18 13:00 +0200
Message-ID<rpf4m-46M-3@gated-at.bofh.it>
In reply to#1381465

[Multipart message — attachments visible in raw view] — view raw

Hi,

Felipe Balbi <balbi@kernel.org> writes:
>> But cellphone user knows what he connected his charger to, and that's
>> why it is useful to be able to lower the current. Even when you said
>> "less is just stupid" I demonstrated it is not, at least in case when

and btw, you haven't demonstrated anything. You merely stated that it
isn't without references or numbers, or any source of trustworthy
information. I'm not really into 'believing'.

-- 
balbi

[toc] | [prev] | [next] | [standalone]


#1381572

FromPavel Machek <pavel@ucw.cz>
Date2016-04-18 13:20 +0200
Message-ID<rpfnI-4BZ-9@gated-at.bofh.it>
In reply to#1381505
On Mon 2016-04-18 13:55:17, Felipe Balbi wrote:
> 
> Hi,
> 
> Felipe Balbi <balbi@kernel.org> writes:
> >> But cellphone user knows what he connected his charger to, and that's
> >> why it is useful to be able to lower the current. Even when you said
> >> "less is just stupid" I demonstrated it is not, at least in case when
> 
> and btw, you haven't demonstrated anything. You merely stated that it
> isn't without references or numbers, or any source of trustworthy
> information. I'm not really into 'believing'.

You are not really into reading, either, it seems. Or into the
electronics. Or into physics.

You seem to understand that charging li-ion from li-ion produces too
much heat. (And yes, it does, DC-DC convertors are not 100%
effective). Converting energy into heat is not a good idea.

If you need numbers or references to understand basic physics, you'll
need to google it yourself, I'm afraid. 

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

[toc] | [prev] | [next] | [standalone]


#1381627

FromFelipe Balbi <balbi@kernel.org>
Date2016-04-18 13:50 +0200
Message-ID<rpfQL-4Ut-27@gated-at.bofh.it>
In reply to#1381572

[Multipart message — attachments visible in raw view] — view raw

Hi,

Pavel Machek <pavel@ucw.cz> writes:
> On Mon 2016-04-18 13:55:17, Felipe Balbi wrote:
>> 
>> Hi,
>> 
>> Felipe Balbi <balbi@kernel.org> writes:
>> >> But cellphone user knows what he connected his charger to, and that's
>> >> why it is useful to be able to lower the current. Even when you said
>> >> "less is just stupid" I demonstrated it is not, at least in case when
>> 
>> and btw, you haven't demonstrated anything. You merely stated that it
>> isn't without references or numbers, or any source of trustworthy
>> information. I'm not really into 'believing'.
>
> You are not really into reading, either, it seems. Or into the
> electronics. Or into physics.
>
> You seem to understand that charging li-ion from li-ion produces too
> much heat. (And yes, it does, DC-DC convertors are not 100%
> effective). Converting energy into heat is not a good idea.
>
> If you need numbers or references to understand basic physics, you'll
> need to google it yourself, I'm afraid. 

still doesn't change the fact that you haven't demonstrated anything. If
you can't be helpful and/or constructive, you may also go away and use
whatever unsafe setup you want to use.

-- 
balbi

[toc] | [prev] | [next] | [standalone]


#1381670

FromPavel Machek <pavel@ucw.cz>
Date2016-04-18 15:00 +0200
Message-ID<rpgWu-5Nh-7@gated-at.bofh.it>
In reply to#1381627
On Mon 2016-04-18 14:42:58, Felipe Balbi wrote:
> 
> Hi,
> 
> Pavel Machek <pavel@ucw.cz> writes:
> > On Mon 2016-04-18 13:55:17, Felipe Balbi wrote:
> >> 
> >> Hi,
> >> 
> >> Felipe Balbi <balbi@kernel.org> writes:
> >> >> But cellphone user knows what he connected his charger to, and that's
> >> >> why it is useful to be able to lower the current. Even when you said
> >> >> "less is just stupid" I demonstrated it is not, at least in case when
> >> 
> >> and btw, you haven't demonstrated anything. You merely stated that it
> >> isn't without references or numbers, or any source of trustworthy
> >> information. I'm not really into 'believing'.
> >
> > You are not really into reading, either, it seems. Or into the
> > electronics. Or into physics.
> >
> > You seem to understand that charging li-ion from li-ion produces too
> > much heat. (And yes, it does, DC-DC convertors are not 100%
> > effective). Converting energy into heat is not a good idea.
> >
> > If you need numbers or references to understand basic physics, you'll
> > need to google it yourself, I'm afraid. 
> 
> still doesn't change the fact that you haven't demonstrated anything. If
> you can't be helpful and/or constructive, you may also go away and use
> whatever unsafe setup you want to use.

So you still claim that it is "stupid" to charge at anything lower
than maximum allowed current?

Even after I described the example with device running off power bank
on a train? Would you explain your reasoning?
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[toc] | [prev] | [next] | [standalone]


#1381708

FromFelipe Balbi <balbi@kernel.org>
Date2016-04-18 15:40 +0200
Message-ID<rphzd-6pz-33@gated-at.bofh.it>
In reply to#1381670

[Multipart message — attachments visible in raw view] — view raw

Hi,

Pavel Machek <pavel@ucw.cz> writes:
>> Pavel Machek <pavel@ucw.cz> writes:
>> > On Mon 2016-04-18 13:55:17, Felipe Balbi wrote:
>> >> 
>> >> Hi,
>> >> 
>> >> Felipe Balbi <balbi@kernel.org> writes:
>> >> >> But cellphone user knows what he connected his charger to, and that's
>> >> >> why it is useful to be able to lower the current. Even when you said
>> >> >> "less is just stupid" I demonstrated it is not, at least in case when
>> >> 
>> >> and btw, you haven't demonstrated anything. You merely stated that it
>> >> isn't without references or numbers, or any source of trustworthy
>> >> information. I'm not really into 'believing'.
>> >
>> > You are not really into reading, either, it seems. Or into the
>> > electronics. Or into physics.
>> >
>> > You seem to understand that charging li-ion from li-ion produces too
>> > much heat. (And yes, it does, DC-DC convertors are not 100%
>> > effective). Converting energy into heat is not a good idea.
>> >
>> > If you need numbers or references to understand basic physics, you'll
>> > need to google it yourself, I'm afraid. 
>> 
>> still doesn't change the fact that you haven't demonstrated anything. If
>> you can't be helpful and/or constructive, you may also go away and use
>> whatever unsafe setup you want to use.
>
> So you still claim that it is "stupid" to charge at anything lower
> than maximum allowed current?
>
> Even after I described the example with device running off power bank
> on a train? Would you explain your reasoning?

you still haven't produced evidence of your claim. Claiming without
evidence has virtually no meaning. Anyway, I'll just google a bit later
seen as if you're just unwilling to produce evidence of your claims.

-- 
balbi

[toc] | [prev] | [next] | [standalone]


#1381513

FromFelipe Balbi <balbi@kernel.org>
Date2016-04-18 13:00 +0200
Message-ID<rpf4m-46M-5@gated-at.bofh.it>
In reply to#1381465

[Multipart message — attachments visible in raw view] — view raw

Hi,

Pavel Machek <pavel@ucw.cz> writes:
> On Mon 2016-04-18 13:30:54, Felipe Balbi wrote:
>> 
>> Hi,
>> 
>> Pavel Machek <pavel@ucw.cz> writes:
>> >> > Very often, you want to charge using 1.8A from an old desktop PC.
>> >> 
>> >> if that old desktop's port is not a charging port, you shouldn't be
>> >> allowed to do that. Not ever.
>> >
>> > Yes, Felipe just decided that I should not be able to charge my N900
>> > in useful way.
>> 
>> you can do whatever you want with *your* kernel binary, but we're not
>> gonna ship something potentially dangerous. If that PC port is telling
>> you it can only allow 100mA, you should *not* be allowed to overcome
>> that limitation from the device side, sorry.
>
> Yes, and if your cpu tells you it can only run on 2GHz, you should not
> be able to run it on 2.1GHz. And you should not be able to use
> non-VESA VGA modes, because you could overheat coils in the monitor.

heh, yada-yada-yada.

> You are shipping something potentially dangerous already, because you
> know, USB-A-to-micro-B cables with D+/D- connected to simulate charger
> are actually very common. The world did not end, yet, so it is clearly
> not as bad as you make it be.

That's not even a supported cable assembly. If you break your HW, that's
your own fault for not using proper cables. There's nothing the kernel
can do about that anyway.

If you're willing to by a "special" cable just to overcome safety limits
set by the various USB specifications, go head. But don't ask me to
support you when things go wrong.

>> >> >> 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.
>> >> >
>> >> > Actually, less is not stupid. Charging li-ion battery from li-ion battery might
>> >> > be stupid. Imagine I'm on train, with device like N900 (50% battery) and power bank
>> >> > (3Ah). I'm actively using the device. If I let it charge at full current, I'll waste
>> >> > energy. If I limit current to approximately the power consumption, it will run the
>> >> > powerbank empty, first, then empty the internal battery, maximizing total time I
>> >> > can use the device.
>> >> 
>> >> why would you waste energy ? What the charger chip would do is charge
>> >> battery to maximum then just to maintenance charge from that point
>> >> on. Where is energy being wasted other than normal heat dissipation ?
>> >
>> > Physics 101, of course wasted energy goes to heat. Lets not waste
>> > energy by charging li-ion from li-ion when it is not required.
>> 
>> your cellphone has no means to know that it's connected to a Li-Ion
>> battery. We don't have visibility on what we're connected to, just how
>> much it can source.
>
> But cellphone user knows what he connected his charger to, and that's
> why it is useful to be able to lower the current. Even when you said
> "less is just stupid" I demonstrated it is not, at least in case when
> your power source is a battery.

okay, so let's do this. How much more "time" do you get by doing this ?
Without numbers showing that it's considerably better, we can't do
anything.

-- 
balbi

[toc] | [prev] | [next] | [standalone]


#1381594

FromPavel Machek <pavel@ucw.cz>
Date2016-04-18 13:30 +0200
Message-ID<rpfxn-4Gt-1@gated-at.bofh.it>
In reply to#1381465
Hi!

On Mon 2016-04-18 10:59:23, David Laight wrote:
> From: Pavel Machek
> > Sent: 18 April 2016 11:40
> ...
> > > >> > Actually, less is not stupid. Charging li-ion battery from li-ion battery might
> > > >> > be stupid. Imagine I'm on train, with device like N900 (50% battery) and power bank
> > > >> > (3Ah). I'm actively using the device. If I let it charge at full current, I'll waste
> > > >> > energy. If I limit current to approximately the power consumption, it will run the
> > > >> > powerbank empty, first, then empty the internal battery, maximizing total time I
> > > >> > can use the device.
> > > >>
> > > >> why would you waste energy ? What the charger chip would do is charge
> > > >> battery to maximum then just to maintenance charge from that point
> > > >> on. Where is energy being wasted other than normal heat dissipation ?
> > > >
> > > > Physics 101, of course wasted energy goes to heat. Lets not waste
> > > > energy by charging li-ion from li-ion when it is not required.
> > >
> > > your cellphone has no means to know that it's connected to a Li-Ion
> > > battery. We don't have visibility on what we're connected to, just how
> > > much it can source.
> > 
> > But cellphone user knows what he connected his charger to, and that's
> > why it is useful to be able to lower the current. Even when you said
> > "less is just stupid" I demonstrated it is not, at least in case when
> > your power source is a battery.
> 
> It reality you may want the phone/tablet to be configurable to take power
> from USB, but disable the li-ion charging circuit.
> That will maximise the time you get when running from an external battery.
> I connect my tablet to the 1A output (which discharges the internal battery
> slowly) rather than the 2A one (which will charge it with some
> cables).

Yes, being able to power device from external without charging the
battery is useful, too.

But I'd still like to control individual currents, too. If I have
power bank and two devices, I may want to select which one charges
faster.

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

[toc] | [prev] | [next] | [standalone]


#1381596

FromDavid Laight <David.Laight@ACULAB.COM>
Date2016-04-18 13:30 +0200
Message-ID<rpfxn-4Gt-3@gated-at.bofh.it>
In reply to#1381465
From: Pavel Machek
> Sent: 18 April 2016 11:40
...
> > >> > Actually, less is not stupid. Charging li-ion battery from li-ion battery might
> > >> > be stupid. Imagine I'm on train, with device like N900 (50% battery) and power bank
> > >> > (3Ah). I'm actively using the device. If I let it charge at full current, I'll waste
> > >> > energy. If I limit current to approximately the power consumption, it will run the
> > >> > powerbank empty, first, then empty the internal battery, maximizing total time I
> > >> > can use the device.
> > >>
> > >> why would you waste energy ? What the charger chip would do is charge
> > >> battery to maximum then just to maintenance charge from that point
> > >> on. Where is energy being wasted other than normal heat dissipation ?
> > >
> > > Physics 101, of course wasted energy goes to heat. Lets not waste
> > > energy by charging li-ion from li-ion when it is not required.
> >
> > your cellphone has no means to know that it's connected to a Li-Ion
> > battery. We don't have visibility on what we're connected to, just how
> > much it can source.
> 
> But cellphone user knows what he connected his charger to, and that's
> why it is useful to be able to lower the current. Even when you said
> "less is just stupid" I demonstrated it is not, at least in case when
> your power source is a battery.

It reality you may want the phone/tablet to be configurable to take power
from USB, but disable the li-ion charging circuit.
That will maximise the time you get when running from an external battery.
I connect my tablet to the 1A output (which discharges the internal battery
slowly) rather than the 2A one (which will charge it with some cables).

Getting 2A from a USB charger seems to be very device/cable/charger dependant.
We've two Samsung chargers that look similar, but have completely different
characteristics. Both claim 2A at 5v (one says 5.3v), one claims 1.5A at
something like 12v as well - not sure we should be using that one for
'random' devices.

	David

[toc] | [prev] | [next] | [standalone]


#1381468

FromFelipe Balbi <balbi@kernel.org>
Date2016-04-18 12:40 +0200
Message-ID<rpeL0-3XZ-3@gated-at.bofh.it>
In reply to#1381462

[Multipart message — attachments visible in raw view] — view raw

Hi,

Pavel Machek <pavel@ucw.cz> writes:
>> > Very often, you want to charge using 1.8A from an old desktop PC.
>> 
>> if that old desktop's port is not a charging port, you shouldn't be
>> allowed to do that. Not ever.
>
> Yes, Felipe just decided that I should not be able to charge my N900
> in useful way.

you can do whatever you want with *your* kernel binary, but we're not
gonna ship something potentially dangerous. If that PC port is telling
you it can only allow 100mA, you should *not* be allowed to overcome
that limitation from the device side, sorry.

>> >> 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.
>> >
>> > Actually, less is not stupid. Charging li-ion battery from li-ion battery might
>> > be stupid. Imagine I'm on train, with device like N900 (50% battery) and power bank
>> > (3Ah). I'm actively using the device. If I let it charge at full current, I'll waste
>> > energy. If I limit current to approximately the power consumption, it will run the
>> > powerbank empty, first, then empty the internal battery, maximizing total time I
>> > can use the device.
>> 
>> why would you waste energy ? What the charger chip would do is charge
>> battery to maximum then just to maintenance charge from that point
>> on. Where is energy being wasted other than normal heat dissipation ?
>
> Physics 101, of course wasted energy goes to heat. Lets not waste
> energy by charging li-ion from li-ion when it is not required.

your cellphone has no means to know that it's connected to a Li-Ion
battery. We don't have visibility on what we're connected to, just how
much it can source.

-- 
balbi

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web