usb: mtu3: fix failed runtime suspend in host only mode
authorChunfeng Yun <chunfeng.yun@mediatek.com>
Thu, 29 Sep 2022 06:44:59 +0000 (14:44 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 30 Sep 2022 11:55:48 +0000 (13:55 +0200)
When the dr_mode is "host", after the host enter runtime suspend,
the mtu3 can't do it, because the mtu3's device wakeup function is
not enabled, instead it's enabled in gadget init function, to fix
the issue, init wakeup early in mtu3's probe()

Fixes: 6b587394c65c ("usb: mtu3: support suspend/resume for dual-role mode")
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reported-by: Tianping Fang <tianping.fang@mediatek.com>
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Link: https://lore.kernel.org/r/20220929064459.32522-1-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/mtu3/mtu3_core.c
drivers/usb/mtu3/mtu3_plat.c

index 0ca173af87bb643c15202a924b50659730ddfee5..a3a6282893d091aaa90eebd984342ddbc234d324 100644 (file)
@@ -978,8 +978,6 @@ int ssusb_gadget_init(struct ssusb_mtk *ssusb)
                goto irq_err;
        }
 
-       device_init_wakeup(dev, true);
-
        /* power down device IP for power saving by default */
        mtu3_stop(mtu);
 
index 4cb65346789d688e47c93df05a1d3c3cc1e89d4a..d78ae52b4e2615eef0d90f3862598b933c1052d9 100644 (file)
@@ -356,6 +356,8 @@ static int mtu3_probe(struct platform_device *pdev)
        pm_runtime_enable(dev);
        pm_runtime_get_sync(dev);
 
+       device_init_wakeup(dev, true);
+
        ret = ssusb_rscs_init(ssusb);
        if (ret)
                goto comm_init_err;