From patchwork Wed Oct 29 11:51:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Zhong X-Patchwork-Id: 404529 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 8B314140085 for ; Wed, 29 Oct 2014 22:54:53 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932875AbaJ2Lwu (ORCPT ); Wed, 29 Oct 2014 07:52:50 -0400 Received: from mail-pd0-f193.google.com ([209.85.192.193]:36686 "EHLO mail-pd0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932512AbaJ2Lws (ORCPT ); Wed, 29 Oct 2014 07:52:48 -0400 Received: by mail-pd0-f193.google.com with SMTP id fp1so1634263pdb.4 for ; Wed, 29 Oct 2014 04:52:47 -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=bY5n7iSda9IDJZyFAr+EmPmhioO/RZ8kkQ6vSS4dfN8=; b=PQshdCI24KUxXTlPdsa06yxhdwecb2QgK0nyT1Zbr154k4UYcwLAC/58VivA/e+pTl Xoc0LH9xu3GXtjdVJowWXL5d6uh9m6V2Poymf3D6Ob8E13i6b5JndOsJWZKPU66W86PH K9W9TYKkfEdDd6UIp+0Qi0P2TnY5d0t4oyoXTYQOrp0mNlUYy+tIwK/NfZBzC3Vz12kV uEtoz+qF31elo76nHjd5nrQbwqtv0jC7Odv17gQiGjk6IUXC3hnmFTcD45phZnafuIgk +qzc1HvAgijlYDJNd0J9nzvVKbzoOkXLEdqCKITTNNTSAN/F/2QRrrh8Sn1OsuM2XKAy 85RQ== X-Received: by 10.68.234.103 with SMTP id ud7mr10058903pbc.46.1414583567919; Wed, 29 Oct 2014 04:52:47 -0700 (PDT) Received: from localhost.localdomain ([104.166.103.139]) by mx.google.com with ESMTPSA id tc8sm3441987pab.19.2014.10.29.04.52.42 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 29 Oct 2014 04:52:46 -0700 (PDT) From: Chris Zhong To: heiko@sntech.de, dianders@chromium.org Cc: mturquette@linaro.org, Ian Campbell , Russell King , Rob Herring , Pawel Moll , Mark Rutland , Linus Walleij , khilman@kernel.org, linux-rockchip@lists.infradead.org, Chris Zhong , linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 1/7] pinctrl: rockchip: add suspend/resume functions Date: Wed, 29 Oct 2014 19:51:59 +0800 Message-Id: <1414583525-17395-2-git-send-email-zyw@rock-chips.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1414583525-17395-1-git-send-email-zyw@rock-chips.com> References: <1414583525-17395-1-git-send-email-zyw@rock-chips.com> Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org 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 v6: None 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, }, };