From patchwork Wed Jan 4 09:38:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gao Pan X-Patchwork-Id: 9496371 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EC2BE606DD for ; Wed, 4 Jan 2017 09:56:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1B0427D8D for ; Wed, 4 Jan 2017 09:56:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC92327DF9; Wed, 4 Jan 2017 09:56:54 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B32727DCD for ; Wed, 4 Jan 2017 09:56:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965922AbdADJ4w (ORCPT ); Wed, 4 Jan 2017 04:56:52 -0500 Received: from mail-he1eur01on0048.outbound.protection.outlook.com ([104.47.0.48]:24271 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S935064AbdADJ4s (ORCPT ); Wed, 4 Jan 2017 04:56:48 -0500 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; bh=W1szbFFl+6a2jTVxx0EEszfH9MIbES3pgD/DKq8VGOk=; b=isur1pl0S5n3+RBVzp5vXhBBset30SkgDg0LhPnMbBK2zX9gmEzRrX5pThoYr1N0o7LZXrhqgM6P0fvYV9wewtvjzQMiRerH/d4t2nFpbKPjiDuolbVE2jSw2sAntqmkVKrgJfomVCf1txrNXci83NaRwZk9YrY3Ybw4rgMSJ18= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=pandy.gao@nxp.com; Received: from b54642-OptiPlex-3020.ap.freescale.net (199.59.231.64) by HE1PR0401MB2282.eurprd04.prod.outlook.com (10.168.32.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.817.10; Wed, 4 Jan 2017 09:40:04 +0000 From: Gao Pan To: CC: , Subject: [Patch V1 2/2] spi: fsl-lpspi: add VLLS mode support Date: Wed, 4 Jan 2017 17:38:17 +0800 Message-ID: <1483522697-6691-2-git-send-email-pandy.gao@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1483522697-6691-1-git-send-email-pandy.gao@nxp.com> References: <1483522697-6691-1-git-send-email-pandy.gao@nxp.com> MIME-Version: 1.0 X-Originating-IP: [199.59.231.64] X-ClientProxiedBy: HK2PR04CA0082.apcprd04.prod.outlook.com (10.170.154.154) To HE1PR0401MB2282.eurprd04.prod.outlook.com (10.168.32.137) X-MS-Office365-Filtering-Correlation-Id: 36283a0e-16e8-478b-5c13-08d43485aa6b X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:HE1PR0401MB2282; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0401MB2282; 3:8CL1GGSlUEoD5mnKZHTycJdvOXgJb4rsvoy9ojfXc009ps1m9L1PsK60tTgfFGafM5us6Na2zAAq9CS73BQPBlh5ffso3lAZpDF7UfnYJhiF6YtCR2dxWew9HRLlaa4/l3bjjyAz4gVnKrtekd38eI9al+9DMj15TjKaD7ed56TVYUl/61aImHmGHqmCt1uYJatLZJGjOlwyFlYanjNmA4S1Edr2QVeFpPsKb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+w34bOQ29ZTnKEwbo2GM2dxSw4B/45UurjpIhF/wqmTPB6PC22zG3ad8v0CDzS9cRjlbS7nVEN1FIS61fBxvzX6eSHvfl3j5Vss62npbPNwoXhzZKhySd6FgH0dj4a8WR2Fn4vLzVi1TJ6M8Qla5dSsU8DEEdkDJ+bSwk/blhNZZ76n9LW3/6YNIktHUnTgnkMe2PCYperOLxz0WTTIbJk6vnyzfuuGcsb76KSapGU50Di0df0PP0aAxkML7CCL/293QNDNvzhhTo3K5g78948e X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026)(6041248)(20161123564025)(20161123562025)(20161123555025)(20161123560025)(6072148)(6047074); SRVR:HE1PR0401MB2282; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0401MB2282; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0401MB2282; 4:IoWipB1APgM5m43bmaEdjSVcowdLI+EVsKz76z7DHZV+k7+LrXaFy8GtZa+9HKWeTIdd+cjDA5dyx6h1VuPOVJfuaDqE1zEsf/YMhVG7Tkc+SqUO3jU4XvS2U8qdM9UwqI8MO65now5FGzquPa+8eS57QIZE7OMgJfdTtLApurbPpdTEJFlelTpq7lUVlqh+we0+VEkv7WnCugXlpeF5dIwrtSA/Vu2NNf2lqZ8+CInswsvj3h8Dut4p6TsmyRM3N0N13gPvWGtHCK1OEgCson/UhxM56P2lcbg/dK+aJFA6vOE4kT3zv9MHV0S9zaw4wVxVnf4SAvMILzSdcf+F0C79X5jpJmGnHJjjZCSdEESpPktc/NXc/rsGDqMrL2E5G/I6dBwhDAUrviFgWgpeOl7IgTAlyvcXXb8DsMoqyDq5aCIGREoX/i8ML+JHv1TmKnf0J0YT0fjVtB7CPBMYthhBUHqAlcMkwGSvxw+vhoM2zYEUOqUIsTU/S57rDRSZvsBIog+2u/zPpFo5UeDPVypSG1baYbBZrldF1dzkapwMSCodZVfVCkQITjcAmNiA0qmJKHYyR4vroFMEJGSI0A9OIXLZe3Ocm/s0x/PxhngUYoi+mxXbhZ+ugiJmbe0l/r4G3fIYFjeykqzwK5tREnTrYiE+p/KCqKhBnMGVelc= X-Forefront-PRVS: 0177904E6B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(39860400002)(39840400002)(39450400003)(39850400002)(39410400002)(189002)(199003)(7736002)(2906002)(6116002)(8676002)(5660300001)(81166006)(50226002)(42186005)(3846002)(50466002)(48376002)(305945005)(189998001)(97736004)(47776003)(4326007)(86362001)(54906002)(66066001)(81156014)(5003940100001)(106356001)(2351001)(38730400001)(33646002)(36756003)(6666003)(92566002)(25786008)(105586002)(76176999)(6486002)(6916009)(50986999)(2950100002)(110136003)(6506006)(101416001)(68736007)(6512006)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0401MB2282; H:b54642-OptiPlex-3020.ap.freescale.net; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR0401MB2282; 23:2YNpNx7WMrFtd/8Xsfxbmv7Z6+CP28XD0wBUwV4?= =?us-ascii?Q?pIOz8Bz/SlGXdysxmi9APVPs760eEt7Fv12IcNRNMO3tpeht/r0iuXFRp8nK?= =?us-ascii?Q?jbHRRszjetpinUrmQ3qpYoGuCzqs15XWdRGHzZ0Pd4bgannNJl44lmCcmO0U?= =?us-ascii?Q?mjuf7jcNw20PB5mQFA7d6aAlQyIhotDR9L0fHYHdzH3sdiyQx1g1wIoO+9Ez?= =?us-ascii?Q?J3wfg7hb4WjLs5S9IPgqiQy/fV4tCXV48iVQu62Hmq3N+dKr5BiUd7pBpsYg?= =?us-ascii?Q?m8eCMcSIA4uH/ijpUbXeN2NWy0EPJAIHnHQEGs5mG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xapHF2fnXr4XrYsC6X58TiDHMfohNflnpXap6pDS?= =?us-ascii?Q?YTVfZKE1ORk8S7spxVIY=3D?= X-Microsoft-Exchange-Diagnostics: 1; HE1PR0401MB2282; 6:7IBXe18/3+M/9ecoF5CvHH927sjGsGEFMxwsoF5A3H4dEVJ4lZt6Uo9+GpjPcW8lpCvmrtB4TwvoBZBMm5qL373UAs/TQg7Eii3H8f38EVibb+0KZUlBHkxQdeBZFaf6o5K+xs28FzXxWE8aBi15ubnhY+acsS5gjZBw9RlEz1PbWwHBnLrgPl8whoXwqreNqZKNFoTpOzKyP3pBSdU++o7fbyzKodxAxB1WUIg5DJqOTREYPVM/BfYH0IYA4sOZyJToX5ewdc8UYEVQffO4tXyZCzDhLPXzeeUok2bPLLwW60+cNyFw9og1d0OuwRohw0hF/YKP364ll/SZG7VF+WNbqKN6OV3K8mar/MbkN/Nv7RNABzdu84jOPEzIp1On8OLX4fdDqKg+z1fDsc/6Zm4ZamRpq8zcwTDQ4gVlJOANO0B9T467ZScrL+6+2qM1Rnaf9T2EzDBiYLH0ijc4xg==; 5:RmOfz1MJEuGSBpbCRMvYVLDN2tV8h7/bv/xBoiAl1UpDmHvrEEWqdEZ8hXanIfVHY4yI3iOW47tkuAag9uXbnpmxCRJkXU11Am3oX/07yfXHZ4wfiw+GHQeoCcAsuxCd1kT0pfI1+TFeCOSgSDo2rHPXHD3PK119fHnsl8QSbOo=; 24:+buC0y0cH0f5vNEISlwK7h+D5uqTLO5jym0Ke6Z3Jb8Dtw+nn3Nd1i7ysyuf6vcMhB5Tns0jMcW8GbfU3nn1jikixtGsVM+a1hl3yyA4Kq4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR0401MB2282; 7:3wLuxSSrKqKHqIOS8l8XwA4uz9QVAbIQtQkPRPEpxhrgf0IGufchXoq467z34aXNGBwaK5A04LVBd/GLzusogBvH6cLrXUHI3cSta7hT/u8wma4nanRRx7H3ZpEFleofCTk3leGUhDo3uOrfRGYVq+61gdAchkX+FoXNGZdwXPF//x34X/wAUbEkUJku0p6N7mJzOJN+Qx2X0Amqb8vEyQBdLzi2b83yoikCqXI0Nv6uoj6J0sguBca30XwxaoOsIjIOigYHZ7aJW+8bbwHZ65enzUwrJspqzip7fGeCIoItdTR6EpCuPb3aPQZ1ZebBMqgLZ4Ta0BckbS3asmcQBDU9cZtINLhw2Je/tRs85ow/BzKKkwKFm302rdQ+QOlrlJgXkKD+U4vzsZ+0P18rcxSvO7evvLggbA8Vzof7t9nDIyYhJNo+c8WhwhRVS0TkocwpY8+Df03yhE8/t4QihQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2017 09:40:04.0613 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0401MB2282 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When system enters VLLS mode, module power is turned off. As a result, all registers are reset to HW default value. After exiting VLLS mode, registers are still in default mode. As a result, the pinctrl settings are incorrect, which will affect the module function. The patch recovers the pinctrl setting when exit VLLS mode. Signed-off-by: Gao Pan --- drivers/spi/spi-fsl-lpspi.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c index 8ec8f55..8557728 100644 --- a/drivers/spi/spi-fsl-lpspi.c +++ b/drivers/spi/spi-fsl-lpspi.c @@ -510,10 +510,32 @@ static int fsl_lpspi_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_PM_SLEEP +static int fsl_lpspi_suspend(struct device *dev) +{ + pinctrl_pm_select_sleep_state(dev); + + return 0; +} + +static int fsl_lpspi_resume(struct device *dev) +{ + pinctrl_pm_select_default_state(dev); + + return 0; +} + +static SIMPLE_DEV_PM_OPS(imx_lpspi_pm, fsl_lpspi_suspend, fsl_lpspi_resume); +#define IMX_LPSPI_PM (&imx_lpspi_pm) +#else +#define IMX_LPSPI_PM NULL +#endif + static struct platform_driver fsl_lpspi_driver = { .driver = { .name = DRIVER_NAME, .of_match_table = fsl_lpspi_dt_ids, + .pm = IMX_LPSPI_PM, }, .probe = fsl_lpspi_probe, .remove = fsl_lpspi_remove,