Re: [PATCH] power_supply: Add driver for TWL4030/TPS65950 BCIcharger

From: Felipe Balbi
Date: Thu Dec 10 2009 - 11:51:55 EST


Hi,

On Thu, Dec 10, 2009 at 03:44:11PM +0100, ext Anton Vorontsov wrote:
Yep. The only thing I'm afraid of is that once the driver is in,
then nobody will bother with improving it to do the right thing.
But an imperfect driver is better than none.

I'm currently implementing the notifier part in a generic manner that would handle all transceivers (well, they would have to provide a some implementations for function pointers in struct otg_transceiver).

Then drivers like twl4030-bci and musb_hdrc could register for notifications from the transceiver. I was thinking of notifying the following events:

enum usb_xceiv_events {
USB_EVENT_NONE, /* no events or cable disconnected */
USB_EVENT_VBUS, /* vbus valid event */
USB_EVENT_ID, /* id was grounded */
USB_EVENT_CHARGER, /* usb dedicated charger */
USB_EVENT_ENUMERATED, /* gadget driver enumerated */
};

for the USB_EVENT_ENUMERATED we could also pass the bMaxPower (in mA) field of the struct usb_configuration, then BCI (or bq24xxx for that matter) can configure that as input current for charging.

USB_EVENT_ID is necessary because in most boards (at least the ones I've seen) the charging chip (bq24xxx) also plays the role as charge pump, sourcing vbus on OTG sessions.

USB_EVENT_VBUS and USB_EVENT_CHARGER aren't necessary on all cases, but boards like RX-51 where it has a different transceiver for charger detection, it's necessary to have those two separated.

If you guys have any comments already, please comment :-)

I'll try to finish a prototype by tomorrow and try to send it as RFC.
Will be sure to Cc you Anton.

--
balbi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/