[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180917052254.12336-1-andreas@kemnade.info>
Date: Mon, 17 Sep 2018 07:22:54 +0200
From: Andreas Kemnade <andreas@...nade.info>
To: kishon@...com, lee.jones@...aro.org, dmitry.torokhov@...il.com,
daniel.thompson@...aro.org, wsa@...-dreams.de,
linux-omap@...r.kernel.org, linux-kernel@...r.kernel.org,
Discussions about the Letux Kernel
<letux-kernel@...nphoenux.org>
Cc: Andreas Kemnade <andreas@...nade.info>
Subject: [PATCH RESEND] phy: phy-twl4030-usb: fix denied runtime access
When runtime is not enabled, pm_runtime_get_sync() returns -EACCESS,
the counter will be incremented but the resume callback not called,
so enumeration and charging will not start properly.
To avoid that happen, wait and try again later.
Practically this happens when the device is woken up from suspend by
plugging in usb.
Signed-off-by: Andreas Kemnade <andreas@...nade.info>
---
drivers/phy/ti/phy-twl4030-usb.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/phy/ti/phy-twl4030-usb.c b/drivers/phy/ti/phy-twl4030-usb.c
index a44680d64f9b..1f3cf4e48383 100644
--- a/drivers/phy/ti/phy-twl4030-usb.c
+++ b/drivers/phy/ti/phy-twl4030-usb.c
@@ -552,6 +552,15 @@ static irqreturn_t twl4030_usb_irq(int irq, void *_twl)
status = twl4030_usb_linkstat(twl);
+ /* we might get here too early when runtime is not ready yet
+ * and we will get an EACCESS later, so try again later
+ */
+ if (!pm_runtime_enabled(twl->dev)) {
+ cancel_delayed_work(&twl->id_workaround_work);
+ schedule_delayed_work(&twl->id_workaround_work, HZ);
+ return IRQ_HANDLED;
+ }
+
mutex_lock(&twl->lock);
if (status >= 0 && status != twl->linkstat) {
status_changed =
--
2.11.0
Powered by blists - more mailing lists