From patchwork Mon Oct 27 13:47:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Zhong X-Patchwork-Id: 5160761 Return-Path: X-Original-To: patchwork-linux-rockchip@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9D9549F318 for ; Mon, 27 Oct 2014 13:48:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 106912024F for ; Mon, 27 Oct 2014 13:48:31 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 26E6D2024D for ; Mon, 27 Oct 2014 13:48:30 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xiker-0004h6-PP; Mon, 27 Oct 2014 13:48:29 +0000 Received: from mail-ig0-f194.google.com ([209.85.213.194]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xikep-0004cK-7K for linux-rockchip@lists.infradead.org; Mon, 27 Oct 2014 13:48:27 +0000 Received: by mail-ig0-f194.google.com with SMTP id r2so914183igi.1 for ; Mon, 27 Oct 2014 06:48:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=SSREqQcOu0yZ3VT1IcqnSJP8JZXjJs0j5Jgi9L5I3WQ=; b=HZS6YEYqRqD/aJtQ1toujYqN5LwCFhOjtm7aqOvvWRv2C++Ad6CSwc6KnvjHZPRWSq +OGG+gskQObeNzhOlEYjL5Sj46fUxmOqTyBi225EDI3t9DcQlaG4+XdfbgRWxUKpE+2C iLcHFmluPbRlWuYTN/rl9X9hzaNU60Bag0APmt26cYxeO3qb28KujzNmG0VuH7kXCX/u yxY6tV51aOPtKVFytNoz7keT2h+wuiF+UvtWkqkDWCVX5NcdBndGamMoFBoBlmi/CrEk IKtBmI4mMyYyZSvOowU55P1G/SI17YpwNmQ/O5BFsUFzhT4YPdj0kuR0PploW7L0X7M0 RyVg== X-Received: by 10.68.235.103 with SMTP id ul7mr24468718pbc.63.1414417685442; Mon, 27 Oct 2014 06:48:05 -0700 (PDT) Received: from localhost.localdomain ([58.22.7.114]) by mx.google.com with ESMTPSA id cc2sm9971830pbd.62.2014.10.27.06.47.58 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 27 Oct 2014 06:48:04 -0700 (PDT) From: Chris Zhong To: heiko@sntech.de, dianders@chromium.org Subject: [PATCH v5 1/6] pinctrl: rockchip: add suspend/resume functions Date: Mon, 27 Oct 2014 21:47:25 +0800 Message-Id: <1414417650-19402-2-git-send-email-zyw@rock-chips.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1414417650-19402-1-git-send-email-zyw@rock-chips.com> References: <1414417650-19402-1-git-send-email-zyw@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141027_064827_392582_63F9F37B X-CRM114-Status: UNSURE ( 9.72 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.5 (/) Cc: Mark Rutland , Russell King , Pawel Moll , Ian Campbell , Linus Walleij , khilman@kernel.org, linux-rockchip@lists.infradead.org, Rob Herring , Chris Zhong , mturquette@linaro.org X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 support suspend/resume of pinctrl, it allows handling sleep mode for hogged pins in pinctrl Signed-off-by: Chris Zhong Tested-by: Doug Anderson Reviewed-by: Doug Anderson Tested-by: Heiko Stuebner Reviewed-by: Heiko Stuebner --- Changes in v5: - reset-author - use "__maybe_unused" annotation Changes in v4: - use SIMPLE_DEV_PM_OPS for suspend/resume struct Changes in v3: None Changes in v2: None drivers/pinctrl/pinctrl-rockchip.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c index 016f457..172ad1d 100644 --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c @@ -1770,6 +1770,23 @@ static struct rockchip_pin_ctrl *rockchip_pinctrl_get_soc_data( return ctrl; } +static int __maybe_unused rockchip_pinctrl_suspend(struct device *dev) +{ + struct rockchip_pinctrl *info = dev_get_drvdata(dev); + + return pinctrl_force_sleep(info->pctl_dev); +} + +static int __maybe_unused rockchip_pinctrl_resume(struct device *dev) +{ + struct rockchip_pinctrl *info = dev_get_drvdata(dev); + + return pinctrl_force_default(info->pctl_dev); +} + +static SIMPLE_DEV_PM_OPS(rockchip_pinctrl_dev_pm_ops, rockchip_pinctrl_suspend, + rockchip_pinctrl_resume); + static int rockchip_pinctrl_probe(struct platform_device *pdev) { struct rockchip_pinctrl *info; @@ -1983,6 +2000,7 @@ static struct platform_driver rockchip_pinctrl_driver = { .driver = { .name = "rockchip-pinctrl", .owner = THIS_MODULE, + .pm = &rockchip_pinctrl_dev_pm_ops, .of_match_table = rockchip_pinctrl_dt_match, }, };