From patchwork Mon Apr 8 10:42:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Vesa X-Patchwork-Id: 10889265 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F263E139A for ; Mon, 8 Apr 2019 10:42:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D377628644 for ; Mon, 8 Apr 2019 10:42:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C597128650; Mon, 8 Apr 2019 10:42:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 49AB428644 for ; Mon, 8 Apr 2019 10:42:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=8pfg2QQzs0Mw/MNYm7eiO1mXH3ILs/WFslPLA3rQ5Pc=; b=Dc4dUBUg1lTz/q vRDkXzkDxpjSGOJdftldvm4wcLLC8OrcIOx8annpg8UADi5gY13G9O6g4fIuPVoCY2PfFnfYat7in VUomd/B3e9bSBk8CBJL6ZPg1/GmYSHf4l6n0MylwnsB+g/8v67HycK4wj3mVKePilpOL00jwm4mPN PvrGBXbWCCvLo42Lyv01Z7I7IaHJ9ORxq5XRUl/tl29WaxVyeZQOU4Js7mPQDbrELvWIoyk0MIw/O vlNt5IPE1H7zVtjNghazkrCiH1kJ+YLFxn1dhpNbl48aSW7ZUaNRyj4FiXUrftH/vW+HqfOrsYDXx sf0x6Y/tjNFX2o33u+Ug==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hDRji-0005ch-Bw; Mon, 08 Apr 2019 10:42:46 +0000 Received: from mail-ve1eur01on061d.outbound.protection.outlook.com ([2a01:111:f400:fe1f::61d] helo=EUR01-VE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hDRjb-0005Y2-6L for linux-arm-kernel@lists.infradead.org; Mon, 08 Apr 2019 10:42:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7tU04SyzZFDQN+TQLE7gx8BUaxeQLfDd6/zsAd/cGEk=; b=LqajDwjzhLLijpYETltkBZZp/ww77kiifB6oV1wF3nI2OiwIfMxLzU1uXmkawSp22D6VLdtUrVbXG9pXnll0/m0UsEPk2rnalGSP2iuF/cnfVAuX3jqSTuZZnb60ajfcGd3GaJwE+JNmaV1lhm+0Y4Gykwrwp5iYt2bKM3t0bwU= Received: from AM0PR04MB5779.eurprd04.prod.outlook.com (20.178.202.151) by AM0PR04MB4977.eurprd04.prod.outlook.com (20.177.40.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1771.21; Mon, 8 Apr 2019 10:42:34 +0000 Received: from AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::880d:a6d1:c29c:8560]) by AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::880d:a6d1:c29c:8560%3]) with mapi id 15.20.1771.016; Mon, 8 Apr 2019 10:42:34 +0000 From: Abel Vesa To: Aisheng Dong , Fabio Estevam , Shawn Guo , Stefan Agner , Linus Walleij , Sascha Hauer Subject: [PATCH v2] pinctrl: pinctrl-imx8mq: Add suspend/resume ops Thread-Topic: [PATCH v2] pinctrl: pinctrl-imx8mq: Add suspend/resume ops Thread-Index: AQHU7ffGuIssFgd2ckqu0X9l+Jf5ew== Date: Mon, 8 Apr 2019 10:42:34 +0000 Message-ID: <1554720120-6617-1-git-send-email-abel.vesa@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR0501CA0027.eurprd05.prod.outlook.com (2603:10a6:800:60::13) To AM0PR04MB5779.eurprd04.prod.outlook.com (2603:10a6:208:131::23) x-originating-ip: [212.146.100.6] authentication-results: spf=none (sender IP is ) smtp.mailfrom=abel.vesa@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.7.4 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e6cb5eff-9bfd-4264-a2a1-08d6bc0ee8ee x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600139)(711020)(4605104)(4618075)(2017052603328)(7193020); SRVR:AM0PR04MB4977; x-ms-traffictypediagnostic: AM0PR04MB4977: x-microsoft-antispam-prvs: x-forefront-prvs: 0001227049 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(136003)(366004)(346002)(376002)(39860400002)(189003)(199004)(86362001)(305945005)(7736002)(6512007)(25786009)(478600001)(4326008)(14454004)(6116002)(53936002)(3846002)(68736007)(6486002)(6436002)(2906002)(15650500001)(71200400001)(71190400001)(2616005)(486006)(110136005)(316002)(97736004)(54906003)(52116002)(8936002)(81156014)(102836004)(26005)(386003)(186003)(5660300002)(6506007)(50226002)(81166006)(8676002)(256004)(14444005)(36756003)(105586002)(66066001)(106356001)(44832011)(476003)(99286004); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR04MB4977; H:AM0PR04MB5779.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: hR5L4P/3wBcDkSMbfpKXnUu42LyHGsR7GbVGhKc6kS90/GXuioBRWtvruUBsBP5N+aAw8lnEnHmwC6It9yR9XTlrVoZE0L8smjardJ/IK22sDDL+0C8CRGSBTPiZf9F2pyVjjg3niR2Y8vAEpbG9hj7R0jei61SbOd1aTcPTZ/Weooltaonp4BW9/Tdar8Z2K9+NDcv3TpTguHeuClMfC5/nU+kLaiUywwbv5Ee6SF+/orW2VcT21FPYLVd5RXbQuElG938f/DnEuXNHarvbPjIX+OS0dgzEXbyHyD8xDnTrFjClk4AJKVCFeNBciT6BHi9dWyoP6HQZQ92aZMs/kTklXvBNBlm5gwJg8ZlXe9NwAe10V8Zjb6WNLQQ27IszAF0EjIfzh9AJk4fIDodxyl8X+6wcoXhvldcF5LfbmZY= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e6cb5eff-9bfd-4264-a2a1-08d6bc0ee8ee X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Apr 2019 10:42:34.5903 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB4977 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190408_034239_492601_5208BB89 X-CRM114-Status: GOOD ( 12.58 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Abel Vesa , Linux Kernel Mailing List , "linux-gpio@vger.kernel.org" , dl-linux-imx , Robin Gong , "linux-arm-kernel@lists.infradead.org" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP To support pinctl hog restore after LPSR resume back, add the generic suspend/resume in pinctrl-imx along with the generic pm opsto be used by platform specific drivers. Then make use of the newly added ops in i.MX8MQ platform specific driver. Signed-off-by: Robin Gong Signed-off-by: Abel Vesa --- Changes since v1: - Replaced the imx8mq specific ops with generic ones. drivers/pinctrl/freescale/pinctrl-imx.c | 25 +++++++++++++++++++++++++ drivers/pinctrl/freescale/pinctrl-imx.h | 4 ++++ drivers/pinctrl/freescale/pinctrl-imx8mq.c | 1 + 3 files changed, 30 insertions(+) diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c index 188001b..ee120ee 100644 --- a/drivers/pinctrl/freescale/pinctrl-imx.c +++ b/drivers/pinctrl/freescale/pinctrl-imx.c @@ -887,3 +887,28 @@ int imx_pinctrl_probe(struct platform_device *pdev, return ret; } + +int imx_pinctrl_suspend(struct device *dev) +{ + struct imx_pinctrl *ipctl = dev_get_drvdata(dev); + + if (!ipctl) + return -EINVAL; + + return pinctrl_force_sleep(ipctl->pctl); +} + +int imx_pinctrl_resume(struct device *dev) +{ + struct imx_pinctrl *ipctl = dev_get_drvdata(dev); + + if (!ipctl) + return -EINVAL; + + return pinctrl_force_default(ipctl->pctl); +} + +const struct dev_pm_ops imx_pinctrl_pm_ops = { + SET_LATE_SYSTEM_SLEEP_PM_OPS(imx_pinctrl_suspend, + imx_pinctrl_resume) +}; diff --git a/drivers/pinctrl/freescale/pinctrl-imx.h b/drivers/pinctrl/freescale/pinctrl-imx.h index 98a4889..ae78314 100644 --- a/drivers/pinctrl/freescale/pinctrl-imx.h +++ b/drivers/pinctrl/freescale/pinctrl-imx.h @@ -17,6 +17,7 @@ struct platform_device; extern struct pinmux_ops imx_pmx_ops; +extern const struct dev_pm_ops imx_pinctrl_pm_ops; /** * struct imx_pin_mmio - MMIO pin configurations @@ -136,6 +137,9 @@ struct imx_pinctrl { int imx_pinctrl_probe(struct platform_device *pdev, const struct imx_pinctrl_soc_info *info); +int imx_pinctrl_suspend(struct device *dev); +int imx_pinctrl_resume(struct device *dev); + #ifdef CONFIG_PINCTRL_IMX_SCU #define BM_PAD_CTL_GP_ENABLE BIT(30) #define BM_PAD_CTL_IFMUX_ENABLE BIT(31) diff --git a/drivers/pinctrl/freescale/pinctrl-imx8mq.c b/drivers/pinctrl/freescale/pinctrl-imx8mq.c index 8d39af5..50aa1c0 100644 --- a/drivers/pinctrl/freescale/pinctrl-imx8mq.c +++ b/drivers/pinctrl/freescale/pinctrl-imx8mq.c @@ -339,6 +339,7 @@ static struct platform_driver imx8mq_pinctrl_driver = { .driver = { .name = "imx8mq-pinctrl", .of_match_table = of_match_ptr(imx8mq_pinctrl_of_match), + .pm = &imx_pinctrl_pm_ops, .suppress_bind_attrs = true, }, .probe = imx8mq_pinctrl_probe,