From patchwork Sat Aug 15 04:37:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Valentin X-Patchwork-Id: 7020331 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6362AC05AD for ; Sat, 15 Aug 2015 04:38:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7DB8E20622 for ; Sat, 15 Aug 2015 04:38:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 83A502063A for ; Sat, 15 Aug 2015 04:38:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751155AbbHOEiH (ORCPT ); Sat, 15 Aug 2015 00:38:07 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:35413 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751059AbbHOEh5 (ORCPT ); Sat, 15 Aug 2015 00:37:57 -0400 Received: by pacgr6 with SMTP id gr6so72038113pac.2; Fri, 14 Aug 2015 21:37:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IVMZtJBdww3/WHxXcr+++nWNI+dGrvMDITX7f45u9cI=; b=vruKTiWmK/vQC1nKRXXnwKdNzsKyEa7GMLQrkqDBpnZ4/egPEV1YUrpZMJgPhxzB0w JDUS1c1AQ7TxifFtKNk/3urQO8cVHYkNaKu5AliDKxkQ1ADIBvwwUaPusvwwy2XGcnNz pcmvzh8p1HijKGI0bInFn46d8zkl4XEN3a3xeSX2OrUtF8fvJ/lFKumFsY9bE/ZOF/qc icR6DGDYdtTfTkQgNtxtSgiPEjd5p25+dGrFPWbdxn6/FEA1lsLM6ZODflLpOx1YONq0 GSazlYToQIPAp8KGvcKPb1J6HUhzr037X5mMO5fvVUKBWYzreeBT5K/1H7gISKxnWScy Jw2A== X-Received: by 10.69.1.7 with SMTP id bc7mr96171890pbd.154.1439613476835; Fri, 14 Aug 2015 21:37:56 -0700 (PDT) Received: from localhost ([2601:647:4200:88bc::b05e]) by smtp.gmail.com with ESMTPSA id ev2sm7656155pbb.37.2015.08.14.21.37.55 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 14 Aug 2015 21:37:56 -0700 (PDT) From: Eduardo Valentin To: Greg Kroah-Hartman , Jiri Slaby , Fabio Estevam Cc: Sascha Hauer , Linux PM , linux-serial@vger.kernel.org, LKML , Eduardo Valentin Subject: [PATCHv4 1/4] serial: imx: add a flag to indicate we are in the suspend path Date: Fri, 14 Aug 2015 21:37:45 -0700 Message-Id: <1439613468-22366-2-git-send-email-edubezval@gmail.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1439613468-22366-1-git-send-email-edubezval@gmail.com> References: <1439613468-22366-1-git-send-email-edubezval@gmail.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_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 This is a simple flag that gets set across prepare and complete callbacks in the suspend path. We the flag we may avoid runtime pm idling at the same time. Cc: Fabio Estevam Cc: Greg Kroah-Hartman Cc: Jiri Slaby Cc: linux-serial@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin --- drivers/tty/serial/imx.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index fe3d41c..50abb60 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -218,6 +218,8 @@ struct imx_port { wait_queue_head_t dma_wait; unsigned int saved_reg[10]; bool context_saved; + + bool is_suspending; }; struct imx_port_ucrs { @@ -2026,6 +2028,22 @@ static void serial_imx_enable_wakeup(struct imx_port *sport, bool on) writel(val, sport->port.membase + UCR1); } +static int serial_imx_prepare(struct device *dev) +{ + struct imx_port *sport = dev_get_drvdata(dev); + + sport->is_suspending = true; + + return 0; +} + +static void serial_imx_complete(struct device *dev) +{ + struct imx_port *sport = dev_get_drvdata(dev); + + sport->is_suspending = false; +} + static int imx_serial_port_suspend_noirq(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); @@ -2091,6 +2109,8 @@ static const struct dev_pm_ops imx_serial_port_pm_ops = { .resume_noirq = imx_serial_port_resume_noirq, .suspend = imx_serial_port_suspend, .resume = imx_serial_port_resume, + .prepare = serial_imx_prepare, + .complete = serial_imx_complete, }; static struct platform_driver serial_imx_driver = {