Hi Greg and Alan,

Do you have any comments for this patch?

I was working on system suspend/resume on T100 tablet. I found once the T100 base station keyboard has been stroked, system will not be able to enter freeze or S3 mode.

I narrowed down this issue as "keyboard generates spurious remote wakeup as soon as usb_enable_remote_wakeup() is called". It happens in below function.

int usb_port_suspend(struct usb_device *udev, pm_message_t msg)

[... skipped several lines ...]

        if (udev->do_remote_wakeup) {
                status = usb_enable_remote_wakeup(udev);
                if (status) {
dev_dbg(&udev->dev, "won't remote wakeup, status %d\n",
                                        status);
                        /* bail if autosuspend is requested */
                        if (PMSG_IS_AUTO(msg))
                                goto err_wakeup;
                }
        }

I have tried below cases:

1. disable usb-auto-suspend
2. turn off remote wakeup through power/wakeup
3. tried various other keyboards with or without external hubs

It turns out that this is a device specific failure. I developed below patch to add a device quirk. Once this quirk is set, usb core will ignore the remote wake up capability.

Is this quirk doable? What's your opinions?

Regards and thanks,
-baolu

On 09/01/2014 09:02 AM, Lu Baolu wrote:
This full-speed USB device generates spurious remote wakeup event
as soon as USB_DEVICE_REMOTE_WAKEUP feature is set. As the result,
Linux can't enter system suspend and S0ix power saving modes once
this keyboard is used.

This patch tries to introduce USB_QUIRK_IGNORE_REMOTE_WAKEUP quirk.
With this quirk set, wakeup capability will be ignored during
device configure.

This patch could be back-ported to kernels as old as 2.6.39.

Signed-off-by: Lu Baolu <baolu...@linux.intel.com>
---
  drivers/usb/core/hub.c     | 6 ++++--
  drivers/usb/core/quirks.c  | 4 ++++
  include/linux/usb/quirks.h | 3 +++
  3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 8a4dcbc..5df1457 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1977,8 +1977,10 @@ void usb_set_device_state(struct usb_device *udev,
                                        || new_state == USB_STATE_SUSPENDED)
                                ;       /* No change to wakeup settings */
                        else if (new_state == USB_STATE_CONFIGURED)
-                               wakeup = udev->actconfig->desc.bmAttributes
-                                        & USB_CONFIG_ATT_WAKEUP;
+                               wakeup = (udev->quirks &
+                                       USB_QUIRK_IGNORE_REMOTE_WAKEUP) ? 0 :
+                                       udev->actconfig->desc.bmAttributes &
+                                       USB_CONFIG_ATT_WAKEUP;
                        else
                                wakeup = 0;
                }
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index bae636e..e7d1e3c 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -159,6 +159,10 @@ static const struct usb_device_id usb_quirk_list[] = {
        /* USB3503 */
        { USB_DEVICE(0x0424, 0x3503), .driver_info = USB_QUIRK_RESET_RESUME },
+ /* ASUS Base Station(T100) */
+       { USB_DEVICE(0x0b05, 0x17e0), .driver_info =
+                       USB_QUIRK_IGNORE_REMOTE_WAKEUP },
+
        { }  /* terminating entry must be last */
  };
diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h
index 55a17b1..0f784c3 100644
--- a/include/linux/usb/quirks.h
+++ b/include/linux/usb/quirks.h
@@ -41,4 +41,7 @@
   */
  #define USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL        0x00000080
+/* device generates spurious wakeup, ignore remote wakeup capability */
+#define USB_QUIRK_IGNORE_REMOTE_WAKEUP 0x00000100
+
  #endif /* __LINUX_USB_QUIRKS_H */

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to