* [PATCH] Adding Reset resume support for CDC-EEM driver.
@ 2015-12-21 12:08 Vikas Bansal
2015-12-21 15:56 ` Alan Stern
0 siblings, 1 reply; 3+ messages in thread
From: Vikas Bansal @ 2015-12-21 12:08 UTC (permalink / raw)
To: oneukum, netdev, linux-usb, linux-kernel; +Cc: sumit.batra, Vikas Bansal
Pre-Condition
At the time of reset resume of a USB device, both self and bus powered devices might go to a low power state or power off state depending on the acceptable suspend time power of the system.
In case the device experiences a power glitch or completely powers off during suspend-resume, the device will lose its internal state and hence it'll again need a set interface from class driver on reset resume operation.
Issue
So far our experiments were based on a USB gadget working on cdc_eem protocol.
We have seen that device is unable to continue the packet transfer on bulk endpoints after the reset resume operation.
Solution
We have added a .reset_resume function for cdc_eem protocol which sends a set interface command on the Control endpoint. And calls the existing usbnet_resume thereafter
Signed-off-by: Vikas Bansal <vikas.bansal@samsung.com>
Signed-off-by: Sumit Batra <sumit.batra@samsung.com>
diff --git a/drivers/net/usb/cdc_eem.c b/drivers/net/usb/cdc_eem.c
index f7180f8..1f6f7ea 100644
--- a/drivers/net/usb/cdc_eem.c
+++ b/drivers/net/usb/cdc_eem.c
@@ -342,6 +342,19 @@ next:
return 1;
}
+static int cdc_eem_resume(struct usb_interface *intf)
+{
+ int ret = 0;
+ struct usbnet *dev = usb_get_intfdata(intf);
+
+ ret = usbnet_get_endpoints(dev, intf);
+ if(ret < 0)
+ goto err;
+ ret = usbnet_resume(intf);
+err:
+ return ret;
+}
+
static const struct driver_info eem_info = {
.description = "CDC EEM Device",
.flags = FLAG_ETHER | FLAG_POINTTOPOINT,
@@ -371,6 +384,7 @@ static struct usb_driver eem_driver = {
.disconnect = usbnet_disconnect,
.suspend = usbnet_suspend,
.resume = usbnet_resume,
+ .reset_resume = cdc_eem_resume,
.disable_hub_initiated_lpm = 1,
};
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Adding Reset resume support for CDC-EEM driver.
2015-12-21 12:08 [PATCH] Adding Reset resume support for CDC-EEM driver Vikas Bansal
@ 2015-12-21 15:56 ` Alan Stern
0 siblings, 0 replies; 3+ messages in thread
From: Alan Stern @ 2015-12-21 15:56 UTC (permalink / raw)
To: Vikas Bansal; +Cc: oneukum, netdev, linux-usb, linux-kernel, sumit.batra
On Mon, 21 Dec 2015, Vikas Bansal wrote:
> Pre-Condition
> At the time of reset resume of a USB device, both self and bus powered devices might go to a low power state or power off state depending on the acceptable suspend time power of the system.
> In case the device experiences a power glitch or completely powers off during suspend-resume, the device will lose its internal state and hence it'll again need a set interface from class driver on reset resume operation.
>
> Issue
> So far our experiments were based on a USB gadget working on cdc_eem protocol.
> We have seen that device is unable to continue the packet transfer on bulk endpoints after the reset resume operation.
>
> Solution
> We have added a .reset_resume function for cdc_eem protocol which sends a set interface command on the Control endpoint. And calls the existing usbnet_resume thereafter
You know, the USB core already issues a Set-Interface request on the
control endpoint whenever a reset-resume occurs (unless the interface
was using altsetting 0 beforehand). Issuing another Set-Interface
shouldn't make any difference.
Alan Stern
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] Adding Reset resume support for CDC-EEM driver.
@ 2015-12-21 13:04 Vikas Bansal
0 siblings, 0 replies; 3+ messages in thread
From: Vikas Bansal @ 2015-12-21 13:04 UTC (permalink / raw)
To: oneukum, netdev, linux-usb, linux-kernel; +Cc: sumit.batra, Vikas Bansal
Pre-Condition
At the time of reset resume of a USB device, both self and bus powered
devices might go to a low power state or power off state depending on
the acceptable suspend time power of the system.
In case the device experiences a power glitch or completely powers off
during suspend-resume, the device will lose its internal state and
hence it'll again need a set interface from class driver on reset resume
operation.
Issue
So far our experiments were based on a USB gadget working on cdc_eem
protocol.
We have seen that device is unable to continue the packet transfer on
bulk endpoints after the reset resume operation.
Solution
We have added a .reset_resume function for cdc_eem protocol which sends a
set interface command on the Control endpoint. And calls the existing
usbnet_resume thereafter
Signed-off-by: Vikas Bansal <vikas.bansal@samsung.com>
Signed-off-by: Sumit Batra <sumit.batra@samsung.com>
diff --git a/drivers/net/usb/cdc_eem.c b/drivers/net/usb/cdc_eem.c
index f7180f8..1f6f7ea 100644
--- a/drivers/net/usb/cdc_eem.c
+++ b/drivers/net/usb/cdc_eem.c
@@ -342,6 +342,19 @@ next:
return 1;
}
+static int cdc_eem_resume(struct usb_interface *intf)
+{
+ int ret = 0;
+ struct usbnet *dev = usb_get_intfdata(intf);
+
+ ret = usbnet_get_endpoints(dev, intf);
+ if (ret < 0)
+ goto err;
+ ret = usbnet_resume(intf);
+err:
+ return ret;
+}
+
static const struct driver_info eem_info = {
.description = "CDC EEM Device",
.flags = FLAG_ETHER | FLAG_POINTTOPOINT,
@@ -371,6 +384,7 @@ static struct usb_driver eem_driver = {
.disconnect = usbnet_disconnect,
.suspend = usbnet_suspend,
.resume = usbnet_resume,
+ .reset_resume = cdc_eem_resume,
.disable_hub_initiated_lpm = 1,
};
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-12-21 15:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-21 12:08 [PATCH] Adding Reset resume support for CDC-EEM driver Vikas Bansal
2015-12-21 15:56 ` Alan Stern
2015-12-21 13:04 Vikas Bansal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).