Re: [PATCH v2 7/7] usb: chipidea: imx: add internal vbus regulator control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 19, 2012 at 05:33:05PM +0800, Peter Chen wrote:
> - For host, the vbus should always be on.
> - For otg, the vbus is off defaultly, the vbus needs to be
> turned on/off when usb role switches.
> 
> Signed-off-by: Peter Chen <peter.chen@xxxxxxxxxxxxx>
> ---
>  drivers/usb/chipidea/ci.h          |    2 +
>  drivers/usb/chipidea/ci13xxx_imx.c |   67 ++++++++++++++++++++++++++----------
>  2 files changed, 51 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
> index c704aa7..0da1545 100644
> --- a/drivers/usb/chipidea/ci.h
> +++ b/drivers/usb/chipidea/ci.h
> @@ -170,6 +170,8 @@ struct ci13xxx {
>  #define B_SESS_VALID	1
>  	unsigned long events;
>  	struct usb_otg			otg;
> +	/* used to control internal vbus regulator */
> +	struct regulator *reg_vbus;
>  };
>  
>  static inline struct ci_role_driver *ci_role(struct ci13xxx *ci)
> diff --git a/drivers/usb/chipidea/ci13xxx_imx.c b/drivers/usb/chipidea/ci13xxx_imx.c
> index 86671a3..8901c1a 100644
> --- a/drivers/usb/chipidea/ci13xxx_imx.c
> +++ b/drivers/usb/chipidea/ci13xxx_imx.c
> @@ -88,14 +88,34 @@ EXPORT_SYMBOL_GPL(usbmisc_get_init_data);
>  static struct ci13xxx_platform_data ci13xxx_imx_platdata __devinitdata  = {
>  	.name			= "ci13xxx_imx",
>  	.flags			= CI13XXX_REQUIRE_TRANSCEIVER |
> -				  CI13XXX_DISABLE_STREAMING,
> +				  CI13XXX_DISABLE_STREAMING |
> +				  CI13XXX_REGS_SHARED,
>  	.capoffset		= DEF_CAPOFFSET,
>  };
>  
> +static int ci13xxx_otg_set_vbus(struct usb_otg *otg, bool enabled)
> +{
> +
> +	struct ci13xxx	*ci = container_of(otg, struct ci13xxx, otg);
> +	struct regulator *reg_vbus = ci->reg_vbus;
> +
> +	WARN_ON(!reg_vbus);
> +
> +	if (reg_vbus) {
> +		if (enabled)
> +			regulator_enable(reg_vbus);
> +		else
> +			regulator_disable(reg_vbus);

regulator_en|disable can fail, right?

>  
> +	ci = platform_get_drvdata(plat_ci);
> +	/*
> +	 * Internal vbus on/off polics

You probably mean 'policy'

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux