From 1b358a8e1b7c4f52415a9e33df1d13889be47ab3 Mon Sep 17 00:00:00 2001 From: Vijayavardhan Vennapusa Date: Wed, 21 Jun 2017 12:40:13 +0530 Subject: [PATCH] USB: phy-msm-qusb: Enable autoresume only when device is connected Currently driver is enabling autoresume feature even if no device is connected which is not required. Hence enable auto resume only when any HS/FS/LS devices are connected during bus suspend. Change-Id: I8150a571e11ccc128298fe75acef21ffe9b08a9a Signed-off-by: Vijayavardhan Vennapusa --- drivers/usb/phy/phy-msm-qusb.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/usb/phy/phy-msm-qusb.c b/drivers/usb/phy/phy-msm-qusb.c index 6a2529ec1511..bd2722e8fc48 100644 --- a/drivers/usb/phy/phy-msm-qusb.c +++ b/drivers/usb/phy/phy-msm-qusb.c @@ -730,13 +730,15 @@ static int qusb_phy_set_suspend(struct usb_phy *phy, int suspend) writel_relaxed(intr_mask, qphy->base + QUSB2PHY_PORT_INTR_CTRL); - /* enable phy auto-resume */ - writel_relaxed(0x0C, + if (linestate & (LINESTATE_DP | LINESTATE_DM)) { + /* enable phy auto-resume */ + writel_relaxed(0x0C, qphy->base + QUSB2PHY_PORT_TEST_CTRL); - /* flush the previous write before next write */ - wmb(); - writel_relaxed(0x04, - qphy->base + QUSB2PHY_PORT_TEST_CTRL); + /* flush the previous write before next write */ + wmb(); + writel_relaxed(0x04, + qphy->base + QUSB2PHY_PORT_TEST_CTRL); + } dev_dbg(phy->dev, "%s: intr_mask = %x\n",