From patchwork Fri Dec 14 20:21:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 13609 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 05C7723E02 for ; Fri, 14 Dec 2012 20:21:31 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 8EC2FA18075 for ; Fri, 14 Dec 2012 20:21:30 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id c10so6553052ieb.11 for ; Fri, 14 Dec 2012 12:21:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:received-spf :from:to:cc:subject:date:message-id:x-mailer:mime-version :content-type:x-gm-message-state; bh=aObBo3si0dba1d17SIbN9b0i3rLCw3ODj1HxZLsd6IQ=; b=Vauh6XqxLNz6BDJtjzW4Mr9lYx3yfnnPoQT6nd5W9i+/kSeZrS8JlawcyeoX8Jjpmy V2qfK+L7rxfuhoqN8XAZttJKRZ5ghOrmysbocLhn0LUQV5iewDiwuJQxF2Ci4mLl63QV Qc+xpbWhhP5Vcat1z0JMfIVajQxAnmSLvj0cZtykulL2bDZuxfTlKDW1Kwrs5Ctquc0a qPhSrREUpMY5rcSVZpttBbEu7aPTbWxNUduJeLEM5FOGNua3IMvmPGs+40Hw+CuHErXI IzLDwjjfMBrc9Ik18bgj4/U1/Es4w0clxM+h+0Jmz1gk6c0EdVd/IRMMMS6SG9m4SACB cMxA== X-Received: by 10.50.40.137 with SMTP id x9mr3386373igk.1.1355516490015; Fri, 14 Dec 2012 12:21:30 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp94358igt; Fri, 14 Dec 2012 12:21:29 -0800 (PST) Received: by 10.14.218.69 with SMTP id j45mr17753825eep.35.1355516488481; Fri, 14 Dec 2012 12:21:28 -0800 (PST) Received: from eu1sys200aog119.obsmtp.com (eu1sys200aog119.obsmtp.com [207.126.144.147]) by mx.google.com with SMTP id s8si14562448eeo.127.2012.12.14.12.21.19 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 14 Dec 2012 12:21:28 -0800 (PST) Received-SPF: neutral (google.com: 207.126.144.147 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.147; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.147 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) smtp.mail=linus.walleij@stericsson.com Received: from beta.dmz-ap.st.com ([138.198.100.35]) (using TLSv1) by eu1sys200aob119.postini.com ([207.126.147.11]) with SMTP ID DSNKUMuKPyT61a7JgkBLo06kd+PvTiRbzeD3@postini.com; Fri, 14 Dec 2012 20:21:27 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id CA6BEF1; Fri, 14 Dec 2012 20:13:04 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 7F73611C8; Fri, 14 Dec 2012 20:21:16 +0000 (GMT) Received: from exdcvycastm022.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm022", Issuer "exdcvycastm022" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id 23D35A8074; Fri, 14 Dec 2012 21:21:08 +0100 (CET) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.30) with Microsoft SMTP Server (TLS) id 8.3.83.0; Fri, 14 Dec 2012 21:21:14 +0100 From: Linus Walleij To: , Cc: Stephen Warren , Anmar Oueja , Julien Delacou , Linus Walleij Subject: [PATCH 2/2 v2] pinctrl/nomadik: adopt pinctrl sleep mode management Date: Fri, 14 Dec 2012 21:21:12 +0100 Message-ID: <1355516472-24759-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.11.3 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQnV6eG8kJZVLoJxzPOz3kHlWA7ixgWtsh4oAygy+aGDQMEXxR60jxR2dy/r1/0NDn5yrUUz From: Julien Delacou This fix makes pinctrl-nomadik able to handle suspend/resume events and change hogged pins states accordingly. Signed-off-by: Julien Delacou Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Use the new interface from the local "core.h" file --- drivers/pinctrl/pinctrl-nomadik.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/pinctrl/pinctrl-nomadik.c b/drivers/pinctrl/pinctrl-nomadik.c index 0ceef59..1ecb3ea 100644 --- a/drivers/pinctrl/pinctrl-nomadik.c +++ b/drivers/pinctrl/pinctrl-nomadik.c @@ -35,6 +35,7 @@ #include #include #include "pinctrl-nomadik.h" +#include "core.h" /* * The GPIO module in the Nomadik family of Systems-on-Chip is an @@ -2096,6 +2097,28 @@ static const struct of_device_id nmk_pinctrl_match[] = { {}, }; +static int nmk_pinctrl_suspend(struct platform_device *pdev, pm_message_t state) +{ + struct nmk_pinctrl *npct; + + npct = platform_get_drvdata(pdev); + if (!npct) + return -EINVAL; + + return pinctrl_force_sleep(npct->pctl); +} + +static int nmk_pinctrl_resume(struct platform_device *pdev) +{ + struct nmk_pinctrl *npct; + + npct = platform_get_drvdata(pdev); + if (!npct) + return -EINVAL; + + return pinctrl_force_default(npct->pctl); +} + static int __devinit nmk_pinctrl_probe(struct platform_device *pdev) { const struct platform_device_id *platid = platform_get_device_id(pdev); @@ -2204,6 +2227,10 @@ static struct platform_driver nmk_pinctrl_driver = { }, .probe = nmk_pinctrl_probe, .id_table = nmk_pinctrl_id, +#ifdef CONFIG_PM + .suspend = nmk_pinctrl_suspend, + .resume = nmk_pinctrl_resume, +#endif }; static int __init nmk_gpio_init(void)