Re: [RFC] power: add optional OTG transceiver and voltageregulator support to pda_power

From: Anton Vorontsov
Date: Sun Jan 25 2009 - 19:14:19 EST


On Sun, Jan 18, 2009 at 05:40:27PM +0100, Philipp Zabel wrote:
> This patch allows machines to use an OTG transceiver driver instead of
> supplying a custom is_usb_online callback to check USB power.
> Also, in the case that the OTG transceiver handles charger control when
> connected to USB, a regulator named "ac_draw" can be supplied instead of
> the custom set_charge callback to control the charger when connected to AC.
>
> The check for (transceiver->state == OTG_STATE_B_PERIPHERAL) in
> otg_is_usb_online is probably too simple, I'm just using this with a peripheral
> only device and gpio_vbus + bq24022. I'm not sure which other OTG states
> can supply power.
>
> Signed-off-by: Philipp Zabel <philipp.zabel@xxxxxxxxx>
> ---

I'm not USB OTG expert, but from the power supply point of view the
patch looks OK. If there are no objections, I'll queue it for 2.6.30.

Thanks Philipp. ;-)

[...]
> +#ifdef CONFIG_USB_OTG_UTILS
> + transceiver = otg_get_transceiver();
> + if (transceiver && !pdata->is_usb_online) {
> + pdata->is_usb_online = otg_is_usb_online;
> + }
> +#endif

On a general note, I'd prefer linux/usb/otg.h provide stubs for
!USB_OTG_UTILS case.. I.e.

#ifdef CONFIG_USB_OTG_UTILS
extern struct otg_transceiver *otg_get_transceiver(void);
extern void otg_put_transceiver(struct otg_transceiver *);
#else
static inline struct otg_transceiver *otg_get_transceiver(void)
{ return NULL; }
static inline void otg_put_transceiver(struct otg_transceiver *) {}
#endif

That way we could avoid #ifdefs in drivers.

--
Anton Vorontsov
email: cbouatmailru@xxxxxxxxx
irc://irc.freenode.net/bd2
--
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/