]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
tty: serial: imx: Allow UART to be a source for wakeup
authorFabio Estevam <festevam@gmail.com>
Tue, 13 Dec 2011 20:50:50 +0000 (18:50 -0200)
committerLothar Waßmann <LW@KARO-electronics.de>
Fri, 24 May 2013 06:33:39 +0000 (08:33 +0200)
Allow UART to be a source for wakeup from low power mode.

Tested on a mx6sabrelite (where ttymxc1 is the console) by doing:

echo enabled >  /sys/devices/platform/imx-uart.1/tty/ttymxc1/power/wakeup

echo mem > /sys/power/state

and then pressing a key in the console will wakeup the sytem.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
drivers/tty/serial/imx.c

index f31fa1e16ca7c3400dfedfc715c46b8ffbc51785..65cc4dd3f4d294b68375e8ec6fe865c0ac1b6458 100644 (file)
@@ -626,10 +626,10 @@ static irqreturn_t imx_int(int irq, void *dev_id)
 
        if (sts & USR1_RTSD)
                imx_rtsint(irq, dev_id);
-#ifdef CONFIG_PM
+
        if (sts & USR1_AWAKE)
                writel(USR1_AWAKE, sport->port.membase + USR1);
-#endif
+
        return IRQ_HANDLED;
 }
 
@@ -1057,9 +1057,7 @@ static int imx_startup(struct uart_port *port)
        }
 
        tty = sport->port.state->port.tty;
-#ifdef CONFIG_PM
-       device_set_wakeup_enable(tty->dev, 1);
-#endif
+
        return 0;
 
 error_out3:
@@ -1556,17 +1554,11 @@ static int serial_imx_suspend(struct platform_device *dev, pm_message_t state)
        struct imx_port *sport = platform_get_drvdata(dev);
        unsigned int val;
 
-       if (device_may_wakeup(&dev->dev)) {
-               enable_irq_wake(sport->rxirq);
-#ifdef CONFIG_PM
-               if (sport->port.line == 0) {
-                       /* enable awake for MX6 */
-                       val = readl(sport->port.membase + UCR3);
-                       val |= UCR3_AWAKEN;
-                       writel(val, sport->port.membase + UCR3);
-               }
-#endif
-       }
+       /* Enable i.MX UART wakeup */
+       val = readl(sport->port.membase + UCR3);
+       val |= UCR3_AWAKEN;
+       writel(val, sport->port.membase + UCR3);
+
        if (sport)
                uart_suspend_port(&imx_reg, &sport->port);
 
@@ -1581,17 +1573,12 @@ static int serial_imx_resume(struct platform_device *dev)
        if (sport)
                uart_resume_port(&imx_reg, &sport->port);
 
-       if (device_may_wakeup(&dev->dev)) {
-#ifdef CONFIG_PM
-               if (sport->port.line == 0) {
-                       val = readl(sport->port.membase + UCR3);
-                       val &= ~UCR3_AWAKEN;
-                       writel(val, sport->port.membase + UCR3);
-               }
-#endif
-               disable_irq_wake(sport->rxirq);
-       }
-       return 0;
+       /* Disable i.MX UART wakeup */
+       val = readl(sport->port.membase + UCR3);
+       val &= ~UCR3_AWAKEN;
+       writel(val, sport->port.membase + UCR3);
+
+return 0;
 }
 
 static int serial_imx_probe(struct platform_device *pdev)
@@ -1670,9 +1657,6 @@ static int serial_imx_probe(struct platform_device *pdev)
                goto deinit;
        platform_set_drvdata(pdev, &sport->port);
 
-#ifdef CONFIG_PM
-       device_init_wakeup(&pdev->dev, 1);
-#endif
        return 0;
 deinit:
        if (pdata && pdata->exit)