public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Chen <peter.chen@nxp.com>
To: Wesley Cheng <wcheng@codeaurora.org>
Cc: "balbi@kernel.org" <balbi@kernel.org>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"jackp@codeaurora.org" <jackp@codeaurora.org>
Subject: Re: [PATCH 1/3] usb: dwc3: gadget: Introduce a DWC3 VBUS draw callback
Date: Mon, 16 Nov 2020 13:43:25 +0000	[thread overview]
Message-ID: <20201116134255.GD28313@b29397-desktop> (raw)
In-Reply-To: <20201114081247.25063-2-wcheng@codeaurora.org>

On 20-11-14 00:12:45, Wesley Cheng wrote:
> Some devices support charging while in device mode.  In these situations,
> the USB gadget will notify the DWC3 gadget driver to modify the current
> based on the enumeration and device state.  The usb_phy_set_power() API
> will allow external charger entities to adjust the charge current through
> the notifier block.
> 
> Signed-off-by: Wesley Cheng <wcheng@codeaurora.org>
> ---
>  drivers/usb/dwc3/gadget.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index c145da1d8ba5..69122f66978e 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -2387,6 +2387,16 @@ static void dwc3_gadget_set_speed(struct usb_gadget *g,
>  	spin_unlock_irqrestore(&dwc->lock, flags);
>  }
>  
> +static int dwc3_gadget_vbus_draw(struct usb_gadget *g, unsigned int mA)
> +{
> +	struct dwc3		*dwc = gadget_to_dwc(g);
> +
> +	if (dwc->usb2_phy)
> +		return usb_phy_set_power(dwc->usb2_phy, mA);
> +
> +	return 0;
> +}
> +
>  static const struct usb_gadget_ops dwc3_gadget_ops = {
>  	.get_frame		= dwc3_gadget_get_frame,
>  	.wakeup			= dwc3_gadget_wakeup,
> @@ -2396,6 +2406,7 @@ static const struct usb_gadget_ops dwc3_gadget_ops = {
>  	.udc_stop		= dwc3_gadget_stop,
>  	.udc_set_speed		= dwc3_gadget_set_speed,
>  	.get_config_params	= dwc3_gadget_config_params,
> +	.vbus_draw		= dwc3_gadget_vbus_draw,
>  };
>  

Reviewed-by: Peter Chen <peter.chen@nxp.com>

-- 

Thanks,
Peter Chen

  reply	other threads:[~2020-11-16 13:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-14  8:12 [PATCH 0/3] Add vbus draw support to DWC3 Wesley Cheng
2020-11-14  8:12 ` [PATCH 1/3] usb: dwc3: gadget: Introduce a DWC3 VBUS draw callback Wesley Cheng
2020-11-16 13:43   ` Peter Chen [this message]
2020-11-14  8:12 ` [PATCH 2/3] usb: gadget: composite: Split composite reset and disconnect Wesley Cheng
2020-11-16 13:44   ` Peter Chen
2020-11-14  8:12 ` [PATCH 3/3] usb: gadget: configfs: Add a specific configFS reset callback Wesley Cheng
2020-11-16 13:55   ` Peter Chen
  -- strict thread matches above, loose matches on Subject: below --
2020-12-29 23:03 [PATCH 0/3] Add vbus draw support to DWC3 Wesley Cheng
2020-12-29 23:03 ` [PATCH 1/3] usb: dwc3: gadget: Introduce a DWC3 VBUS draw callback Wesley Cheng

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=20201116134255.GD28313@b29397-desktop \
    --to=peter.chen@nxp.com \
    --cc=balbi@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jackp@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=wcheng@codeaurora.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox