lkml.org 
[lkml]   [2020]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] usb: host: XHCI: xhci-mtk.c: support mediatek,keep-clock-on
Date
Some platform dose not support turn off clock when system suspending.
We add an option "mediatek,keep-clock-on" for distinquish these platforms.
When "mediatek,keep-clock-on" has been set, xhci-mtk driver will skip
turning clock on and off during system suspend and resume.

Signed-off-by: Macpaul Lin <macpaul.lin@mediatek.com>
---
drivers/usb/host/xhci-mtk.c | 9 +++++++--
drivers/usb/host/xhci-mtk.h | 1 +
2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
index 4311d4c..c6c2804 100644
--- a/drivers/usb/host/xhci-mtk.c
+++ b/drivers/usb/host/xhci-mtk.c
@@ -464,6 +464,9 @@ static int xhci_mtk_probe(struct platform_device *pdev)
of_property_read_u32(node, "mediatek,u3p-dis-msk",
&mtk->u3p_dis_msk);

+ /* keep clock on when suspending on some platform */
+ mtk->keep_clk_on = of_property_read_bool(node, "mediatek,keep-clock-on");
+
ret = usb_wakeup_of_property_parse(mtk, node);
if (ret) {
dev_err(dev, "failed to parse uwk property\n");
@@ -624,7 +627,8 @@ static int __maybe_unused xhci_mtk_suspend(struct device *dev)
del_timer_sync(&xhci->shared_hcd->rh_timer);

xhci_mtk_host_disable(mtk);
- xhci_mtk_clks_disable(mtk);
+ if (!mtk->keep_clk_on)
+ xhci_mtk_clks_disable(mtk);
usb_wakeup_set(mtk, true);
return 0;
}
@@ -636,7 +640,8 @@ static int __maybe_unused xhci_mtk_resume(struct device *dev)
struct xhci_hcd *xhci = hcd_to_xhci(hcd);

usb_wakeup_set(mtk, false);
- xhci_mtk_clks_enable(mtk);
+ if (!mtk->keep_clk_on)
+ xhci_mtk_clks_enable(mtk);
xhci_mtk_host_enable(mtk);

xhci_dbg(xhci, "%s: restart port polling\n", __func__);
diff --git a/drivers/usb/host/xhci-mtk.h b/drivers/usb/host/xhci-mtk.h
index a93cfe8..37639c5 100644
--- a/drivers/usb/host/xhci-mtk.h
+++ b/drivers/usb/host/xhci-mtk.h
@@ -152,6 +152,7 @@ struct xhci_hcd_mtk {
struct regmap *uwk;
u32 uwk_reg_base;
u32 uwk_vers;
+ bool keep_clk_on;
};

static inline struct xhci_hcd_mtk *hcd_to_mtk(struct usb_hcd *hcd)
--
1.7.9.5
\
 
 \ /
  Last update: 2020-11-02 08:30    [W:0.089 / U:6.428 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site