Linux USB
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@nxp.com>
To: Xu Yang <xu.yang_2@nxp.com>
Cc: gregkh@linuxfoundation.org, tglx@linutronix.de, mingo@kernel.org,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	imx@lists.linux.dev, jun.li@nxp.com
Subject: Re: [PATCH v2] usb: gadget: zero: add function wakeup support
Date: Tue, 16 Sep 2025 11:46:06 -0400	[thread overview]
Message-ID: <aMmGPmBdRi7ACxBm@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20250916020544.1301866-1-xu.yang_2@nxp.com>

On Tue, Sep 16, 2025 at 10:05:44AM +0800, Xu Yang wrote:
> When the device working at enhanced superspeed, it needs to send function
> remote wakeup signal to the host instead of device remote wakeup. Add
> function wakeup support for the purpose.
>
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>

Reviewed-by: Frank Li <Frank.Li@nxp.com>
>
> ---
> Changes in v2:
>  - fix alignment
> ---
>  drivers/usb/gadget/legacy/zero.c | 27 ++++++++++++++++++---------
>  1 file changed, 18 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/usb/gadget/legacy/zero.c b/drivers/usb/gadget/legacy/zero.c
> index a05785bdeb30..08a21bd0c2ba 100644
> --- a/drivers/usb/gadget/legacy/zero.c
> +++ b/drivers/usb/gadget/legacy/zero.c
> @@ -147,6 +147,12 @@ static struct usb_gadget_strings *dev_strings[] = {
>  	NULL,
>  };
>
> +static struct usb_function *func_lb;
> +static struct usb_function_instance *func_inst_lb;
> +
> +static struct usb_function *func_ss;
> +static struct usb_function_instance *func_inst_ss;
> +
>  /*-------------------------------------------------------------------------*/
>
>  static struct timer_list	autoresume_timer;
> @@ -156,6 +162,7 @@ static void zero_autoresume(struct timer_list *unused)
>  {
>  	struct usb_composite_dev	*cdev = autoresume_cdev;
>  	struct usb_gadget		*g = cdev->gadget;
> +	int				status;
>
>  	/* unconfigured devices can't issue wakeups */
>  	if (!cdev->config)
> @@ -165,10 +172,18 @@ static void zero_autoresume(struct timer_list *unused)
>  	 * more significant than just a timer firing; likely
>  	 * because of some direct user request.
>  	 */
> -	if (g->speed != USB_SPEED_UNKNOWN) {
> -		int status = usb_gadget_wakeup(g);
> -		INFO(cdev, "%s --> %d\n", __func__, status);
> +	if (g->speed == USB_SPEED_UNKNOWN)
> +		return;
> +
> +	if (g->speed >= USB_SPEED_SUPER) {
> +		if (loopdefault)
> +			status = usb_func_wakeup(func_lb);
> +		else
> +			status = usb_func_wakeup(func_ss);
> +	} else {
> +		status = usb_gadget_wakeup(g);
>  	}
> +	INFO(cdev, "%s --> %d\n", __func__, status);
>  }
>
>  static void zero_suspend(struct usb_composite_dev *cdev)
> @@ -206,9 +221,6 @@ static struct usb_configuration loopback_driver = {
>  	/* .iConfiguration = DYNAMIC */
>  };
>
> -static struct usb_function *func_ss;
> -static struct usb_function_instance *func_inst_ss;
> -
>  static int ss_config_setup(struct usb_configuration *c,
>  		const struct usb_ctrlrequest *ctrl)
>  {
> @@ -248,9 +260,6 @@ module_param_named(isoc_maxburst, gzero_options.isoc_maxburst, uint,
>  		S_IRUGO|S_IWUSR);
>  MODULE_PARM_DESC(isoc_maxburst, "0 - 15 (ss only)");
>
> -static struct usb_function *func_lb;
> -static struct usb_function_instance *func_inst_lb;
> -
>  module_param_named(qlen, gzero_options.qlen, uint, S_IRUGO|S_IWUSR);
>  MODULE_PARM_DESC(qlen, "depth of loopback queue");
>
> --
> 2.34.1
>

      reply	other threads:[~2025-09-16 15:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-16  2:05 [PATCH v2] usb: gadget: zero: add function wakeup support Xu Yang
2025-09-16 15:46 ` Frank Li [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=aMmGPmBdRi7ACxBm@lizhi-Precision-Tower-5810 \
    --to=frank.li@nxp.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=imx@lists.linux.dev \
    --cc=jun.li@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=xu.yang_2@nxp.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