memstick: rtsx_usb_ms: Support runtime power management
authorKai-Heng Feng <kai.heng.feng@canonical.com>
Mon, 5 Nov 2018 08:45:06 +0000 (16:45 +0800)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 17 Dec 2018 07:26:24 +0000 (08:26 +0100)
commit6827ca573c03385439fdfc8b512d556dc7c54fc9
tree6569c07a0954abec2a3b2d2ee77641b4d16e576a
parentba9d5f83735fc00297e39ba5cd9ece1c61eb3995
memstick: rtsx_usb_ms: Support runtime power management

In order to let host's parent device, rtsx_usb, to use USB remote wake
up signaling to do card detection, it needs to be suspended. Hence it's
necessary to add runtime PM support for the memstick host.

To keep memstick host stays suspended when it's not in use, convert the
card detection function from kthread to delayed_work, which can be
scheduled when the host is resumed and can be canceled when the host is
suspended.

Put the device to suspend when there's no card and the power mode is
MEMSTICK_POWER_OFF.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/memstick/host/rtsx_usb_ms.c