public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Anton Vorontsov <cbouatmailru@gmail.com>
To: Philipp Zabel <philipp.zabel@gmail.com>
Cc: linux-kernel@vger.kernel.org, Anton Vorontsov <cbou@mail.ru>,
	David Brownell <dbrownell@users.sourceforge.net>
Subject: Re: [RFC] power: add optional OTG transceiver and voltage regulator support to pda_power
Date: Mon, 26 Jan 2009 03:13:54 +0300	[thread overview]
Message-ID: <20090126001354.GA18543@zarina> (raw)
In-Reply-To: <1232296827-16471-1-git-send-email-philipp.zabel@gmail.com>

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@gmail.com>
> ---

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@gmail.com
irc://irc.freenode.net/bd2

      reply	other threads:[~2009-01-26  0:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-18 16:40 [RFC] power: add optional OTG transceiver and voltage regulator support to pda_power Philipp Zabel
2009-01-26  0:13 ` Anton Vorontsov [this message]

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=20090126001354.GA18543@zarina \
    --to=cbouatmailru@gmail.com \
    --cc=cbou@mail.ru \
    --cc=dbrownell@users.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=philipp.zabel@gmail.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