public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Prashanth K <prashanth.k@oss.qualcomm.com>
To: 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>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Prashanth K <prashanth.k@oss.qualcomm.com>,
	stable@kernel.org
Subject: [PATCH v1 1/3] usb: gadget: f_ecm: Add get_status callback
Date: Thu,  3 Apr 2025 16:38:03 +0530	[thread overview]
Message-ID: <20250403110805.865311-2-prashanth.k@oss.qualcomm.com> (raw)
In-Reply-To: <20250403110805.865311-1-prashanth.k@oss.qualcomm.com>

When host sends GET_STATUS to ECM interface, handle the request
from the function driver. Since the interface is wakeup capable,
set the corresponding bit, and set RW bit if the function is
already armed for wakeup by the host.

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/function/f_ecm.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/usb/gadget/function/f_ecm.c b/drivers/usb/gadget/function/f_ecm.c
index 80841de845b0..027226325039 100644
--- a/drivers/usb/gadget/function/f_ecm.c
+++ b/drivers/usb/gadget/function/f_ecm.c
@@ -892,6 +892,12 @@ static void ecm_resume(struct usb_function *f)
 	gether_resume(&ecm->port);
 }
 
+static int ecm_get_status(struct usb_function *f)
+{
+	return (f->func_wakeup_armed ? USB_INTRF_STAT_FUNC_RW : 0) |
+		USB_INTRF_STAT_FUNC_RW_CAP;
+}
+
 static void ecm_free(struct usb_function *f)
 {
 	struct f_ecm *ecm;
@@ -960,6 +966,7 @@ static struct usb_function *ecm_alloc(struct usb_function_instance *fi)
 	ecm->port.func.disable = ecm_disable;
 	ecm->port.func.free_func = ecm_free;
 	ecm->port.func.suspend = ecm_suspend;
+	ecm->port.func.get_status = ecm_get_status;
 	ecm->port.func.resume = ecm_resume;
 
 	return &ecm->port.func;
-- 
2.25.1


  reply	other threads:[~2025-04-03 11:08 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 ` Prashanth K [this message]
2025-04-08  1:08   ` [PATCH v1 1/3] usb: gadget: f_ecm: Add get_status callback 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
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=20250403110805.865311-2-prashanth.k@oss.qualcomm.com \
    --to=prashanth.k@oss.qualcomm.com \
    --cc=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=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