[DISCUSSION] USB device remote wakeup is not working for S3 case
From: Du, Changbin
Date: Thu Dec 18 2014 - 07:00:39 EST
When I am checking usb remote wakeup code, I found that usb remote wakeup will not work after system going to S3 sate and I confirmed with my PC.
During enumeration, usb device will be set as wakeup capable by usb_set_device_state if it supports. Whether usb driver send SET_FEATURE(REMOTE_WAKUP) usb request when suspending on S3 depend on do_remote_wakeup flag which is set by choose_wakeup(). It can be simply presented as below.
do_remote_wakeup = device_may_wakeup(&udev->dev);
The return value is always false since usb device is not marked as wakeup enabled(that is no one call device_set_wakeup_enable() for usb device). As a result, usb device will not signal wakeup event to host.
Maybe we should not allow all remote wakeup supported device can wakeup system by default. But for usb keyboard/mouse, I think it is not reasonable to disable it by default.
A simple way to fix this is that replace the device_may_wakeup by device_can_wakeup in choose_wakeup() function, just like on auto suspend case (usb remote wakeup works for rpm). Another way is to make usb device wakeup able by default. But both of them will make all usb devices can wakeup system. Have any better idea?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/