All of lore.kernel.org
 help / color / mirror / Atom feed
From: mkl@pengutronix.de (Marc Kleine-Budde)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 10/12] USB: chipidea: add set_vbus_power support
Date: Mon, 16 Jul 2012 14:10:23 +0200	[thread overview]
Message-ID: <500404AF.3070100@pengutronix.de> (raw)
In-Reply-To: <1342076512-19207-11-git-send-email-richard.zhao@freescale.com>

On 07/12/2012 09:01 AM, Richard Zhao wrote:
> set_vbus_power is used to enable or disable vbus power for usb host.
> 
> Signed-off-by: Richard Zhao <richard.zhao@freescale.com>
> ---
>  drivers/usb/chipidea/ci13xxx_imx.c |   39 +++++++++++++++++++++++++-----------
>  drivers/usb/chipidea/host.c        |    8 ++++++++
>  include/linux/usb/chipidea.h       |    2 ++
>  3 files changed, 37 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/usb/chipidea/ci13xxx_imx.c b/drivers/usb/chipidea/ci13xxx_imx.c
> index c94e30f..b3173d8 100644
> --- a/drivers/usb/chipidea/ci13xxx_imx.c
> +++ b/drivers/usb/chipidea/ci13xxx_imx.c
> @@ -26,6 +26,8 @@
>  
>  #define pdev_to_phy(pdev) \
>  	((struct usb_phy *)platform_get_drvdata(pdev))
> +#define ci_to_imx_data(ci) \
> +	((struct ci13xxx_imx_data *)dev_get_drvdata(ci->dev->parent))
>  
>  struct ci13xxx_imx_data {
>  	struct device_node *phy_np;
> @@ -35,12 +37,32 @@ struct ci13xxx_imx_data {
>  	struct regulator *reg_vbus;
>  };
>  
> +static int ci13xxx_imx_vbus(struct ci13xxx *ci, int enable)
> +{
> +	struct ci13xxx_imx_data *data = ci_to_imx_data(ci);
> +	int ret;
> +
> +	if (!data->reg_vbus)
> +		return 0;
> +
> +	if (enable)
> +		ret = regulator_enable(data->reg_vbus);
> +	else
> +		ret = regulator_disable(data->reg_vbus);
> +	if (ret)
> +		dev_err(ci->dev, "ci13xxx_imx_vbus failed, enable:%d err:%d\n",
> +			enable, ret);
> +
> +	return ret;
> +}
> +
>  static struct ci13xxx_platform_data ci13xxx_imx_platdata __devinitdata  = {
>  	.name			= "ci13xxx_imx",
>  	.flags			= CI13XXX_REQUIRE_TRANSCEIVER |
>  				  CI13XXX_PULLUP_ON_VBUS |
>  				  CI13XXX_DISABLE_STREAMING,
>  	.capoffset		= DEF_CAPOFFSET,
> +	.set_vbus_power		= ci13xxx_imx_vbus,
>  };
>  
>  static int __devinit ci13xxx_imx_probe(struct platform_device *pdev)
> @@ -101,18 +123,10 @@ static int __devinit ci13xxx_imx_probe(struct platform_device *pdev)
>  
>  	/* we only support host now, so enable vbus here */

With this patch, the comment becomes wrong.

>  	reg_vbus = devm_regulator_get(&pdev->dev, "vbus");
> -	if (!IS_ERR(reg_vbus)) {
> -		ret = regulator_enable(reg_vbus);
> -		if (ret) {
> -			dev_err(&pdev->dev,
> -				"Failed to enable vbus regulator, err=%d\n",
> -				ret);
> -			goto put_np;
> -		}
> +	if (!IS_ERR(reg_vbus))
>  		data->reg_vbus = reg_vbus;
> -	} else {
> +	else
>  		reg_vbus = NULL;
> -	}
>  

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120716/c2d25a56/attachment.sig>

  reply	other threads:[~2012-07-16 12:10 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-12  7:01 [PATCH 00/12] chipidea/imx: add otg support and some bug fix Richard Zhao
2012-07-12  7:01 ` [PATCH 01/12] USB: chipidea: imx: add pinctrl support Richard Zhao
2012-07-12  7:01 ` [PATCH 02/12] USB: chipidea: delay 2ms before read ID status at probe time Richard Zhao
2012-07-12  7:01 ` [PATCH 03/12] USB: chipidea: move OTGSC_IDIS clearing from ci_role_work to irq handler Richard Zhao
2012-07-12  7:01 ` [PATCH 04/12] USB: chipidea: clear gadget struct at udc_start fail path Richard Zhao
2012-07-12  7:01 ` [PATCH 05/12] USB: chipidea: don't let probe fail if otg controller start one role failed Richard Zhao
2012-07-12  7:01 ` [PATCH 06/12] USB: mxs-phy: add basic otg support Richard Zhao
2012-07-12  7:01 ` [PATCH 07/12] USB: chipidea: add vbus detect for udc Richard Zhao
2012-07-12  7:01 ` [PATCH 08/12] USB: chipidea: convert to use devm_request_irq Richard Zhao
2012-07-12  7:01 ` [PATCH 09/12] USB: chipidea: add -DDEBUG if CONFIG_USB_CHIPIDEA_DEBUG Richard Zhao
2012-07-12  7:01 ` [PATCH 10/12] USB: chipidea: add set_vbus_power support Richard Zhao
2012-07-16 12:10   ` Marc Kleine-Budde [this message]
2012-07-17  1:30     ` Richard Zhao
2012-07-12  7:01 ` [PATCH 11/12] USB: chipidea: re-order irq handling to avoid unhandled irq Richard Zhao
2012-07-12  7:01 ` [PATCH 12/12] USB: chipidea: add imx usbmisc support Richard Zhao
2012-07-12  7:10   ` Richard Zhao
2012-07-13 12:25   ` Michael Grzeschik
2012-07-13 14:02     ` Richard Zhao
2012-07-13 14:14       ` Marc Kleine-Budde
2012-07-16  2:53         ` Richard Zhao
2012-07-16  8:25   ` Sascha Hauer
2012-07-16  8:38     ` Richard Zhao
2012-07-16  8:50       ` Sascha Hauer
2012-07-16 12:24   ` Marek Vasut
2012-07-17  0:40 ` [PATCH 00/12] chipidea/imx: add otg support and some bug fix Greg KH
2012-07-19  2:05   ` Richard Zhao
2012-07-26 10:59     ` Richard Zhao
2012-07-30  9:17       ` Richard Zhao
2012-07-30 16:00         ` Greg KH

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=500404AF.3070100@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.