From patchwork Fri Aug 14 10:24:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhaoyang Huang X-Patchwork-Id: 7013901 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0B4C49F344 for ; Fri, 14 Aug 2015 10:24:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2D29B20747 for ; Fri, 14 Aug 2015 10:24:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3E97B2073E for ; Fri, 14 Aug 2015 10:24:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754131AbbHNKYz (ORCPT ); Fri, 14 Aug 2015 06:24:55 -0400 Received: from mail-pd0-f175.google.com ([209.85.192.175]:35455 "EHLO mail-pd0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752133AbbHNKYz (ORCPT ); Fri, 14 Aug 2015 06:24:55 -0400 Received: by pdrg1 with SMTP id g1so29998837pdr.2 for ; Fri, 14 Aug 2015 03:24:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=PiQjWAd7NIH9aZ8O9ljSu8F5hXg8DmdSCO9vVOtovOc=; b=dNYPLF1CB0QtOSbU2oa0uD08SofocLV2zc3mAb+oEL6AcPLZxT+r2pnfs6+aW4bHdS g2hPZCwZF5a7nVKsVZdtOdRWw41i7PL5qZ4+q28QkAfb20yaTBHQ00PZywo/TGCJVM89 1WVxHQK8sXHC0/Ic5DHp/Z5ZhS++FX1QoRpo0eA3/6aXlAZo0Hgmn8hjL6yBjwMyAmQq 4vyC7USCRL7Dd90LgashudffUTNRFOvXRfHDEDqikw2EoktYkhsvPoJN5i6ZSBKD/4OG L6jB4rTHkTvfhUJJZcuDifWrKpI0udPw+OCmyos+XXBswwcVBjCzINhkW88/DMlMmVV4 6j9Q== X-Gm-Message-State: ALoCoQl7tJhc54o+dzrpxQaoOljEXCzWNc3HiWsID8ak9ZV6B08XAs6872OabHaaluAZK2TKypJi X-Received: by 10.70.36.138 with SMTP id q10mr44135446pdj.32.1439547894558; Fri, 14 Aug 2015 03:24:54 -0700 (PDT) Received: from zyhuangubtpc.spreadtrum.com ([175.111.195.49]) by smtp.gmail.com with ESMTPSA id em1sm5522717pbd.42.2015.08.14.03.24.53 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 14 Aug 2015 03:24:54 -0700 (PDT) From: Zhaoyang Huang To: linux-pm@vger.kernel.org Cc: amit.kucheria@linaro.org Subject: [PATCH] modify pl011 driver to work as wakeup source Date: Fri, 14 Aug 2015 18:24:46 +0800 Message-Id: <1439547886-5093-1-git-send-email-zhaoyang.huang@linaro.org> X-Mailer: git-send-email 1.7.9.5 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP add IRQF_NO_SUSPEND flag when requiring irq line and call the pm_system_wakeup when RX interrupt happens Signed-off-by: Zhaoyang Huang --- drivers/tty/serial/amba-pl011.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index 50cf5b1..6285819 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -59,6 +59,7 @@ #include #include #include +#include #define UART_NR 14 @@ -127,6 +128,7 @@ static struct vendor_data vendor_st = { .get_fifosize = get_fifosize_st, }; +static int is_suspended = 0; /* Deals with DMA transactions */ struct pl011_sgbuf { @@ -1376,6 +1378,10 @@ static irqreturn_t pl011_int(int irq, void *dev_id) pl011_dma_rx_irq(uap); else pl011_rx_chars(uap); + + if(is_suspended) + pm_system_wakeup(); + } if (status & (UART011_DSRMIS|UART011_DCDMIS| UART011_CTSMIS|UART011_RIMIS)) @@ -1585,7 +1591,7 @@ static int pl011_allocate_irq(struct uart_amba_port *uap) { writew(uap->im, uap->port.membase + UART011_IMSC); - return request_irq(uap->port.irq, pl011_int, 0, "uart-pl011", uap); + return request_irq(uap->port.irq, pl011_int, IRQF_NO_SUSPEND, "uart-pl011", uap); } /* @@ -2403,21 +2409,33 @@ static int pl011_remove(struct amba_device *dev) static int pl011_suspend(struct device *dev) { struct uart_amba_port *uap = dev_get_drvdata(dev); + int ret = 0; if (!uap) return -EINVAL; - return uart_suspend_port(&amba_reg, &uap->port); + ret =uart_suspend_port(&amba_reg, &uap->port); + + if(!ret) + is_suspended = 1; + + return ret; } static int pl011_resume(struct device *dev) { struct uart_amba_port *uap = dev_get_drvdata(dev); + int ret = 0; if (!uap) return -EINVAL; - return uart_resume_port(&amba_reg, &uap->port); + ret = uart_resume_port(&amba_reg, &uap->port); + + if(!ret) + is_suspended = 0; + + return ret; } #endif