Message ID | 20150224043353.4243.7374.stgit@notabene.brown (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
On Tue 2015-02-24 15:33:53, NeilBrown wrote: > If it cannot, we will stop pulling more current when voltage drops. Can you justify it a bit more? I mean... maybe there's a fuse in the charger? Or maybe it will supply the current but overheat in the process? (USB_MAX_CURRENT is 500mA or 1.7A?) Thanks, Pavel > Signed-off-by: NeilBrown <neilb@suse.de> > @@ -691,8 +691,10 @@ static void twl4030_bci_usb_work(struct work_struct *data) > struct twl4030_bci *bci = container_of(data, struct twl4030_bci, work); > > switch (bci->event) { > - case USB_EVENT_VBUS: > case USB_EVENT_CHARGER: > + bci->usb_cur = USB_MAX_CURRENT; > + /* FALL THROUGH */ > + case USB_EVENT_VBUS: > case USB_EVENT_ENUMERATED: > twl4030_charger_enable_usb(bci, true); > break;
On Mon, 2 Mar 2015 22:29:39 +0100 Pavel Machek <pavel@ucw.cz> wrote: > On Tue 2015-02-24 15:33:53, NeilBrown wrote: > > If it cannot, we will stop pulling more current when voltage drops. > > Can you justify it a bit more? > > I mean... maybe there's a fuse in the charger? Or maybe it will supply > the current but overheat in the process? (USB_MAX_CURRENT is 500mA or > 1.7A?) USB_MAX_CURRENT is 1.7A - the most the twl4030 will manage. The relevant specs say that a charger can deliver from 0.5A to 5.0A at between 4.75 and 5.25 volts. They don't, as far as I can tell, describe how a gadget can determine where in those ranges the charger is actually happy. My understanding of electronics suggests that if you start to pull too much current, the voltage will start to drop. It is that voltage drop across internal resistance which causes over-heating. So if voltage is above 4.75 volts, it seems reasonable to assume that the charger is happy. The code currently (see previous patch) ramps up the current until the voltage drops below 4.75, or until the maximum is reached. If the voltage drops, it backs off. The current should only be too high for 100ms. Hopefully not too long. I'm very open if anyone can suggest a more safe way to make full use of a charger without risking excess current draw, but I cannot find one. Maybe I should measure the unloaded voltage, and not let it drop more than 0.25V below that? I'm also very open to someone finding out how to get the twl4030 to detect a "D+ and D- shorted" charger. I think it is supposed to be able to do this, but I haven't managed to make it work yet. Thanks, NeilBrown
diff --git a/drivers/power/twl4030_charger.c b/drivers/power/twl4030_charger.c index 7ad6b4b531d7..89e2c121dd22 100644 --- a/drivers/power/twl4030_charger.c +++ b/drivers/power/twl4030_charger.c @@ -691,8 +691,10 @@ static void twl4030_bci_usb_work(struct work_struct *data) struct twl4030_bci *bci = container_of(data, struct twl4030_bci, work); switch (bci->event) { - case USB_EVENT_VBUS: case USB_EVENT_CHARGER: + bci->usb_cur = USB_MAX_CURRENT; + /* FALL THROUGH */ + case USB_EVENT_VBUS: case USB_EVENT_ENUMERATED: twl4030_charger_enable_usb(bci, true); break;
If it cannot, we will stop pulling more current when voltage drops. Signed-off-by: NeilBrown <neilb@suse.de> --- drivers/power/twl4030_charger.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html