From patchwork Tue Aug 8 13:48:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 109661 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp2974850qge; Tue, 8 Aug 2017 06:50:34 -0700 (PDT) X-Received: by 10.84.224.206 with SMTP id k14mr4754232pln.429.1502200234827; Tue, 08 Aug 2017 06:50:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502200234; cv=none; d=google.com; s=arc-20160816; b=gT6vHexEbl7xYNLkOWEAWo5lwzIyIahPnEdBzfLARshKKcaRDkOlssavMn0tRilrK9 SNr9FyhWllz08ZgbcmAfLgsoPV82SOflOGP0tpln++S9mr7YD5iokaWXZNZxhL60HIF0 g2pFSGiTxqHXfD5NjhRlXTGtxMkOMSXv/+BiPffWKBf9PMMo2vq3UgvUonbsqnCPXz/V SlnpEti5Vlu90ZdJ4VJzA0Iiuqn6sUbTBz7JFio8fklJ0HD44eq/3dLFj5JKkJvxL4fc SAjHEfUiUvFAiKbHJIWMNNReHYAmOaqIgb17/G3MWS8dJcdmqqZu975Tx/Si/4kmIp2L KtHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=xdPYMkMtaSewvzrB0y6L1L44gKdUsJ1mnpYecjdJ9iM=; b=D+FsmXM1MDi/b8/yT/y1jF43McWiDTrHVIg9Zi/hHd4eEchoatVueKkdxtpr4ia5ym XtECVGbhNtiCp6N7JaXHV5E+ac9Qmz/Y70RY8fJMnW02h5bYtIa0Wy+dTJeaHJUa0W0q klaEn1H5SzufIzplbeeU5/UmMCRXelUFyZRXYMBSY+G5GxZTGMOhUIgMueg/rQ9o2uSP s5woeyVyqxL5cAG9Wk6YRJmINHi0SiqURIBzQ5DFr6WZGv3YM2DjFBXD5i7+LVXD3aY4 WJ3eMdGOl31cUgcGhJ+gxfhmQe+cwS2StskhQE2Q5+HyJ4TqthtI7UZbYHyTIQm3DtLo zqnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=xGK7CCxU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y126si836396pgb.152.2017.08.08.06.50.34; Tue, 08 Aug 2017 06:50:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=xGK7CCxU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752241AbdHHNuc (ORCPT + 25 others); Tue, 8 Aug 2017 09:50:32 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:61485 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752062AbdHHNu3 (ORCPT ); Tue, 8 Aug 2017 09:50:29 -0400 Received: from localhost.localdomain (pw126245200194.16.panda-world.ne.jp [126.245.200.194]) (authenticated) by conuserg-09.nifty.com with ESMTP id v78DnDnu010873; Tue, 8 Aug 2017 22:49:17 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com v78DnDnu010873 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1502200157; bh=xdPYMkMtaSewvzrB0y6L1L44gKdUsJ1mnpYecjdJ9iM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xGK7CCxUNdHopNLhO8rs1d8y45UNagLpdo6kU0UiiedvOHg5xn+f2f4P56yBBgrhr a3nN2mjCQk2B9ytMTiqWV+NZ1D1EkahSDYePfuDqekBo9Wz1ZMu33xhNEsK+DaP27L TjO17qA39V+NNPRQ3SlH5YaqI/+dbNk+7QS6snOad5m5VgWMd9DnAB87V72EcQyHsd 794tmmH1gVoa8KbAJCUkzCY7VZzC5LkFLuX9k+uNbzI+8s6tVO+ivotHAbjYshqVPF mmzY0LcvFliUlCg5P+zcY90lt4HBlAgDo5ZgDzDRAGwo/A+yenAYPn55qDQemmPJYx 1FR7/nVqMFtSQ== X-Nifty-SrcIP: [126.245.200.194] From: Masahiro Yamada To: linux-serial@vger.kernel.org Cc: Masami Hiramatsu , Jassi Brar , Masahiro Yamada , Jiri Slaby , linux-kernel@vger.kernel.org, Greg Kroah-Hartman , linux-arm-kernel@lists.infradead.org Subject: [PATCH 3/3] serial: 8250_uniphier: add suspend/resume support Date: Tue, 8 Aug 2017 22:48:43 +0900 Message-Id: <1502200123-2558-4-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502200123-2558-1-git-send-email-yamada.masahiro@socionext.com> References: <1502200123-2558-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add suspend/resume support for UniPhier serial driver. Signed-off-by: Masahiro Yamada --- drivers/tty/serial/8250/8250_uniphier.c | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) -- 2.7.4 diff --git a/drivers/tty/serial/8250/8250_uniphier.c b/drivers/tty/serial/8250/8250_uniphier.c index 97a45b798fcd..8a10b10e27aa 100644 --- a/drivers/tty/serial/8250/8250_uniphier.c +++ b/drivers/tty/serial/8250/8250_uniphier.c @@ -281,6 +281,40 @@ static int uniphier_uart_remove(struct platform_device *pdev) return 0; } +static int __maybe_unused uniphier_uart_suspend(struct device *dev) +{ + struct uniphier8250_priv *priv = dev_get_drvdata(dev); + struct uart_8250_port *up = serial8250_get_port(priv->line); + + serial8250_suspend_port(priv->line); + + if (!uart_console(&up->port) || console_suspend_enabled) + clk_disable_unprepare(priv->clk); + + return 0; +} + +static int __maybe_unused uniphier_uart_resume(struct device *dev) +{ + struct uniphier8250_priv *priv = dev_get_drvdata(dev); + struct uart_8250_port *up = serial8250_get_port(priv->line); + int ret; + + if (!uart_console(&up->port) || console_suspend_enabled) { + ret = clk_prepare_enable(priv->clk); + if (ret) + return ret; + } + + serial8250_resume_port(priv->line); + + return 0; +} + +static const struct dev_pm_ops uniphier_uart_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(uniphier_uart_suspend, uniphier_uart_resume) +}; + static const struct of_device_id uniphier_uart_match[] = { { .compatible = "socionext,uniphier-uart" }, { /* sentinel */ } @@ -293,6 +327,7 @@ static struct platform_driver uniphier_uart_platform_driver = { .driver = { .name = "uniphier-uart", .of_match_table = uniphier_uart_match, + .pm = &uniphier_uart_pm_ops, }, }; module_platform_driver(uniphier_uart_platform_driver);