All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Xu Yang <xu.yang_2@nxp.com>
Cc: 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] usb: gadget: zero: add function wakeup support
Date: Mon, 15 Sep 2025 13:36:07 +0200	[thread overview]
Message-ID: <2025091545-effort-trolling-e7cb@gregkh> (raw)
In-Reply-To: <20250915090230.1280460-1-xu.yang_2@nxp.com>

On Mon, Sep 15, 2025 at 05:02:30PM +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>
> ---
>  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..fe286b597f9f 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);

Is this INFO() call still needed?  Shouldn't that be removed?

thanks,

greg k-h

  reply	other threads:[~2025-09-15 11:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-15  9:02 [PATCH] usb: gadget: zero: add function wakeup support Xu Yang
2025-09-15 11:36 ` Greg KH [this message]
2025-09-15 14:28   ` Xu Yang
2025-09-15 14:05 ` Alan Stern
2025-09-15 14:40   ` Xu Yang

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=2025091545-effort-trolling-e7cb@gregkh \
    --to=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 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.