[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190220122001.5713-4-jonas@norrbonn.se>
Date: Wed, 20 Feb 2019 13:20:01 +0100
From: Jonas Bonn <jonas@...rbonn.se>
To: linux-kernel@...r.kernel.org, linux-usb@...r.kernel.org
Cc: Jonas Bonn <jonas@...rbonn.se>,
Cristian Birsan <cristian.birsan@...rochip.com>,
Felipe Balbi <balbi@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Nicolas Ferre <nicolas.ferre@...rochip.com>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Ludovic Desroches <ludovic.desroches@...rochip.com>,
linux-arm-kernel@...ts.infradead.org
Subject: [PATCH 3/3] usb: gadget: atmel: tie wake lock to running clock
If the USB device is connected to a host, the CPU cannot be suspended or
else the USB device appears to be disconnected from the host's point of
view. Only after a "USB suspend" state has been entered (as set by the
host) or the host is disconnected can the system safely be suspended: in
both these states, the clock is stopped. As such, this patch associates
a "wake lock" with the running clock of the UDC to keep the system awake
as long as the host maintains the USB connection active.
Signed-off-by: Jonas Bonn <jonas@...rbonn.se>
CC: Cristian Birsan <cristian.birsan@...rochip.com>
CC: Felipe Balbi <balbi@...nel.org>
CC: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
CC: Nicolas Ferre <nicolas.ferre@...rochip.com>
CC: Alexandre Belloni <alexandre.belloni@...tlin.com>
CC: Ludovic Desroches <ludovic.desroches@...rochip.com>
CC: linux-arm-kernel@...ts.infradead.org
CC: linux-usb@...r.kernel.org
---
drivers/usb/gadget/udc/atmel_usba_udc.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
index 740cb9308a86..864d03c3c9db 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -1859,6 +1859,8 @@ static int start_clock(struct usba_udc *udc)
if (udc->clocked)
return 0;
+ pm_stay_awake(&udc->pdev->dev);
+
ret = clk_prepare_enable(udc->pclk);
if (ret)
return ret;
@@ -1881,6 +1883,8 @@ static void stop_clock(struct usba_udc *udc)
clk_disable_unprepare(udc->pclk);
udc->clocked = false;
+
+ pm_relax(&udc->pdev->dev);
}
static int usba_start(struct usba_udc *udc)
--
2.19.1
Powered by blists - more mailing lists