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: 52419 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by patches.linaro.org (Postfix) with ESMTPS id 8EFDA22B12 for ; Fri, 14 Aug 2015 10:24:59 +0000 (UTC) Received: by lbbpd10 with SMTP id pd10sf1816057lbb.3 for ; Fri, 14 Aug 2015 03:24:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=xjcSgZ8h4lFFvNAqfEcGVPUpMCLjvrHUz1+A53X7pjo=; b=Vo/bL+5SLHADsZ+fIursQ4ryF4bEuZ2aRZztrMQGEeItkAW4od+7E4Xa8d0zPZ9SI/ A+BmOsPUoI3wxxz6TSt7LpP++z01Y0y7CxPXEaBw6e4cxdodV9WNADPRfOyEf0KBUJ1M NB35xsgoHFJLxqd5dwwBJCIUVRKVlx//VQigrkvvyG63p8VOBjHBrmnW1ufCQkcv48G0 3S8JAX8IyYBeEcYE4r0VP/Q/C55cCht7qPH+0ak4n7vEcjbqCO85mKS+a6PTU2lObTiQ iDfzNmiL94FUsa6++SkZr2BA9XdEFoOelO5dwGbnR7wLtCsqkv/DPDvHyJWbHrDFNAGs 10rA== X-Gm-Message-State: ALoCoQn8mTAM2fnheoDijNM5AuJTVzJKQqzlM9xKsqpj5xoGKMNEeGlwNtLSVm11fHd+GqVEuqX6 X-Received: by 10.152.182.226 with SMTP id eh2mr12686426lac.0.1439547898582; Fri, 14 Aug 2015 03:24:58 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.207.8 with SMTP id ls8ls367538lac.71.gmail; Fri, 14 Aug 2015 03:24:58 -0700 (PDT) X-Received: by 10.112.87.69 with SMTP id v5mr24997578lbz.12.1439547898435; Fri, 14 Aug 2015 03:24:58 -0700 (PDT) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id pk1si5665698lac.126.2015.08.14.03.24.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Aug 2015 03:24:58 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by lagz9 with SMTP id z9so41254272lag.3 for ; Fri, 14 Aug 2015 03:24:58 -0700 (PDT) X-Received: by 10.153.7.66 with SMTP id da2mr42227026lad.117.1439547898233; Fri, 14 Aug 2015 03:24:58 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.7.198 with SMTP id l6csp1509176lba; Fri, 14 Aug 2015 03:24:57 -0700 (PDT) X-Received: by 10.70.34.69 with SMTP id x5mr86926771pdi.28.1439547897217; Fri, 14 Aug 2015 03:24:57 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fn1si5807165pab.132.2015.08.14.03.24.56; Fri, 14 Aug 2015 03:24:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754131AbbHNKYz (ORCPT + 13 others); 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-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: list List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: zhaoyang.huang@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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