public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: Prashanth K <prashanth.k@oss.qualcomm.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	Kees Bakker <kees@ijzerbout.nl>,
	William McVicker <willmcvicker@google.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"stable@kernel.org" <stable@kernel.org>
Subject: Re: [PATCH v1 2/3] usb: gadget: Use get_status callback to set remote wakeup capability
Date: Tue, 8 Apr 2025 01:18:26 +0000	[thread overview]
Message-ID: <20250408011758.qfdflgrrmahwmfqi@synopsys.com> (raw)
In-Reply-To: <20250403110805.865311-3-prashanth.k@oss.qualcomm.com>

On Thu, Apr 03, 2025, Prashanth K wrote:
> Currently when the host sends GET_STATUS request for an interface,
> we use get_status callbacks to set/clear remote wakeup capability
> of that interface. And if get_status callback isn't present for
> that interface, then we assume its remote wakeup capability based
> on bmAttributes.
> 
> Now consider a scenario, where we have a USB configuration with
> multiple interfaces (say ECM + ADB), here ECM is remote wakeup
> capable and as of now ADB isn't. And bmAttributes will indicate
> the device as wakeup capable. With the current implementation,
> when host sends GET_STATUS request for both interfaces, we will
> set FUNC_RW_CAP for both. This results in USB3 CV Chapter 9.15
> (Function Remote Wakeup Test) failures as host expects remote
> wakeup from both interfaces.
> 
> The above scenario is just an example, and the failure can be
> observed if we use configuration with any interface except ECM.
> Hence avoid configuring remote wakeup capability from composite
> driver based on bmAttributes, instead use get_status callbacks
> and let the function drivers decide this.
> 
> Cc: stable@kernel.org
> Fixes: 481c225c4802 ("usb: gadget: Handle function suspend feature selector")
> Signed-off-by: Prashanth K <prashanth.k@oss.qualcomm.com>
> ---
>  drivers/usb/gadget/composite.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
> index 869ad99afb48..5c6da360e95b 100644
> --- a/drivers/usb/gadget/composite.c
> +++ b/drivers/usb/gadget/composite.c
> @@ -2010,16 +2010,12 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
>  			break;
>  
>  		if (f->get_status) {
> -			status = f->get_status(f);
> +			/* if D5 is not set, then device is not wakeup capable */
> +			if (f->config->bmAttributes & USB_CONFIG_ATT_WAKEUP)

We should allow function to execute get_status regardless of
USB_CONFIG_ATT_WAKEUP. There are other status beside wakeup.

> +				status = f->get_status(f);
> +
>  			if (status < 0)
>  				break;
> -		} else {
> -			/* Set D0 and D1 bits based on func wakeup capability */
> -			if (f->config->bmAttributes & USB_CONFIG_ATT_WAKEUP) {
> -				status |= USB_INTRF_STAT_FUNC_RW_CAP;


So right now we're not able to configure the function to enable RW
capable? Perhaps we need to update the composite configfs for this?

BR,
Thinh

> -				if (f->func_wakeup_armed)
> -					status |= USB_INTRF_STAT_FUNC_RW;
> -			}
>  		}
>  
>  		put_unaligned_le16(status & 0x0000ffff, req->buf);
> -- 
> 2.25.1
> 

  reply	other threads:[~2025-04-08  1:19 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-03 11:08 [PATCH v1 0/3] Fixes for USB3 CV Chapter 9.15 tests Prashanth K
2025-04-03 11:08 ` [PATCH v1 1/3] usb: gadget: f_ecm: Add get_status callback Prashanth K
2025-04-08  1:08   ` Thinh Nguyen
2025-04-08  5:05     ` Prashanth K
2025-04-09  0:56       ` Thinh Nguyen
2025-04-03 11:08 ` [PATCH v1 2/3] usb: gadget: Use get_status callback to set remote wakeup capability Prashanth K
2025-04-08  1:18   ` Thinh Nguyen [this message]
2025-04-08  5:06     ` Prashanth K
2025-04-09  0:55       ` Thinh Nguyen
2025-04-09  4:22         ` Prashanth K
2025-04-09 22:05           ` Thinh Nguyen
2025-04-09 22:12             ` Thinh Nguyen
2025-04-10  6:08               ` Prashanth K
2025-04-11  1:00                 ` Thinh Nguyen
2025-04-03 11:08 ` [PATCH v1 3/3] usb: dwc3: gadget: Make gadget_wakeup asynchronous Prashanth K
2025-04-07 23:38   ` Thinh Nguyen
2025-04-08  5:34     ` Prashanth K
2025-04-09  0:43       ` Thinh Nguyen
2025-04-09  4:15         ` Prashanth K
2025-04-09 21:51           ` Thinh Nguyen
2025-04-10  5:48             ` Prashanth K

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=20250408011758.qfdflgrrmahwmfqi@synopsys.com \
    --to=thinh.nguyen@synopsys.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kees@ijzerbout.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=prashanth.k@oss.qualcomm.com \
    --cc=stable@kernel.org \
    --cc=willmcvicker@google.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