From patchwork Wed Aug 8 16:09:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonard Crestez X-Patchwork-Id: 10563439 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 D147D14C0 for ; Sat, 11 Aug 2018 12:06:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ADD7F2A2B8 for ; Sat, 11 Aug 2018 12:06:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A1A3F2A529; Sat, 11 Aug 2018 12:06:49 +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=BAD_ENC_HEADER,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 589442A2B8 for ; Sat, 11 Aug 2018 12:06:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BA2D26E1D0; Sat, 11 Aug 2018 12:05:15 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40047.outbound.protection.outlook.com [40.107.4.47]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4A85889E08 for ; Wed, 8 Aug 2018 16:09:36 +0000 (UTC) Received: from localhost.localdomain (95.76.156.53) by VI1PR04MB4301.eurprd04.prod.outlook.com (2603:10a6:803:3f::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Wed, 8 Aug 2018 16:09:33 +0000 From: Leonard Crestez To: Stefan Agner , Marek Vasut , Shawn Guo Subject: [PATCH v4 4/5] drm/mxsfb: Add PM_SLEEP support Date: Wed, 8 Aug 2018 19:09:01 +0300 Message-Id: <3559b9b99a8a48042ee468034e5f1d538ffbd081.1533743954.git.leonard.crestez@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [95.76.156.53] X-ClientProxiedBy: DB6PR02CA0004.eurprd02.prod.outlook.com (2603:10a6:6:15::17) To VI1PR04MB4301.eurprd04.prod.outlook.com (2603:10a6:803:3f::28) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b84b282f-d218-4bf0-f1ad-08d5fd495533 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR04MB4301; X-Microsoft-Exchange-Diagnostics: 1; VI1PR04MB4301; 3:jX6pmXQTFslrxamkqUQx3DaCijsu2h1PMDq4l+d4+9hw1/gnKzEEu1JhTwTEx1GPXF0urNBMJlY4dZmBsoWxCm5orLVxWJtTy3JTnrgD6R/vaxFmaFQ/tEjwDh54j2STq9oNVIslLOfjt4+3pvgGN0SkX8QODldWBss0mkgElc3QsnGMQbQaayqQJWnvZKP/NSZNqJH2fNP/vI41D9CyybjNnbVGQdkTmvWIgDgoFTkyk9ZdyDJydIKfKA29oRbX; 25:Sw1jVzwYqpbUfKG/RsHArpoalnb8VvgsYiJktyvSfYkSrVehkgsckghe9x3V6fpuKqayl56UiF+5Hjg8HWyC3nLmPzBsqqrq+ROgq6hwD4VMZ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2vkYd8UkJQAgHYMXIaaFFjqsAbRWfwoSFjLXf5trglUKG9rsp7knNTOkyO/oRWETY4qeD83HiHPISelJmIHfdxW9gzpoxdQZYP7/HVhUB1jOknFcYiT9uvnPY0BmOp1D1jAiKD/RfRJgMiiof+B+ZB4qfKCxY/XyKgy9dj36TeuwdCEMCZuPo6eDgZw+jUbj/6F8oPl46XHa42gYJQgM/GUOQdK45EodulBKnNmPRvGHpHIyzMftz/xnLfsW14KW64M1q0cU6t4hd6MFpMcYyFYbbDoScjTv9gF/DCq+tRgE/uHpXmaTr X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231311)(944501410)(52105095)(10201501046)(93006095)(93001095)(3002001)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(20161123564045)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:VI1PR04MB4301; BCL:0; PCL:0; RULEID:; SRVR:VI1PR04MB4301; X-Forefront-PRVS: 07584EDBCD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(979002)(6069001)(39850400004)(376002)(396003)(346002)(366004)(136003)(199004)(189003)(66066001)(7736002)(76176011)(47776003)(6512007)(81166006)(68736007)(81156014)(25786009)(8676002)(6666003)(110136005)(54906003)(36756003)(14444005)(305945005)(106356001)(105586002)(53936002)(50466002)(6486002)(97736004)(48376002)(86362001)(4326008)(575784001)(3846002)(5660300001)(26005)(486006)(16526019)(186003)(316002)(2906002)(16586007)(6116002)(6506007)(44832011)(478600001)(8936002)(956004)(11346002)(2616005)(50226002)(386003)(446003)(476003)(51416003)(52116002)(118296001)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR04MB4301; H:localhost.localdomain; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR04MB4301; 23:gXc/v81EvW1lWIVbVkKoy7/ohBVA+eVilb4GLycYT?= nmtRTKwN2PADGxiMG0WrSclDq4V0x0XNyl8qEANlFIpR0aNvPZX4Ke6hRvW8RFEpwMgzuTa/uP7RgoMC58vy0nYNDGhtaaiiMS9LusAK23vyz0SuMzKg0YmKWIIPQkyJmfWYEZdH8gsQ3mHg0te6EjQXcBYKODhQaUVxLTG2oXxn05lNqdcZvXNn8OQ7F5j9praP5zWn3VVJw02DFRhRzRENRH2lJ6gcadlWQJxyGIg8Huj0vXSNFimcZz5OQF12N/vPv5Cg7LOUfJDio2h1+C6FJGtMpn5VueTeWmjZUfBlJm/tcho7CIA5vlExl5YZBc9Jel/PUXflazjUFMJchU1lViNkVi70LSHhyVj113282IkNghPt6FPmA6ep2gxpKL5WRMZA4RxEcs8/yh6xr/J7jC4qlTeCHZ1X5tvjsC3Mzs0P0qFY9g30xHIcOLaly9oGRvC6aAGqpKsYgIbHDHn2BsgIduccpo5+bkeia1d0uCGOHGwzKIyMzWwxzH7qrrhLTsG5R+35jdxx7mDtWDs55x6bc3abIwdPlcYoCcQhusb8U4DZFHQZub8WSQUxSeWWtKFu11ATFhaLlzzpNCJoiSCKazwsEJoBMrO4cVKmt/wVU6VKyKtFDYN8Mr3sRB4DE743NvOBEtY/V/kwFOvVcCqg0qHQrOcmO4JEHVSKjcKOqGq8u34CSpY0kBJjzaWF7Qyzxw2RwnF/S5NWgv9eUUXBolePLQuYnxbssAk0Mhk7NUwFD//cs4QonmJCo9dmBMJlStOEmvHXx6Y9jx0m7fktyy6aa8dDSa+OXrSeisQgE1MiaFCROMfPbar8a7bCQiy8PSoRvYROFBU/m8j6QEWKU9+njp+zsGG19s7k53tvi02xbSUMyZYNQYK8k3f2fyjhY6CXBJRuemcrn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5wHfWio/aYRNi9qmTULs2qmH3vG8bxaRwlQ7VTv/x5phekm6g5ugrLZSUCp/ihcjBXO1OCBM4pFkqkhB6D+TJIDqa06cgEbgn5VlrEtpp/mnhW0ezDpeuYVStlTYpkRkDSN5oxdAhIiS73irej/UYHePT8oqIke9KgIuVxMd464uvM9b/CH8I0wJC28UvMbygNDTk+Dnl4+y/+YXLQliut51YedIt3KcD6HXqpCp399cdkbzf2KQow4yBqQxgZeStMVBZYqVTA==; 5:AxLlDEpyEmihhayK/kxK26TUGGlf4bsIu4YZbUEyqnH9EwQVu+9CRfvQTD6l+p5VO5BASH+h2KIVreGauJdEByHbrTk55zlTMV7rnfdxUmAxfrYn/B3huECBf4cY/EjLToAtiaucd9w3FkRdrTxNzqCAVUILanluTMXJgzoz034=; 7:gPM+XmeYtGtat6WYqmgqf426tiNTY1tOLHGlZuKEhtVuirVTghb2aQJ8qM1tXJv2q0tmuGa56TxLK0dTAEr6rmfcv1joj9ovmcMaxnFeuMMAG+OOpLl9oTEsF4b/zCzyfhNmsi+3CCPieM25ROi10rs/d3NmgAcTcAOJ8kZ6YP8161D9hY5oODTtvuECISx/WUcBFwzUU8kLau/9UrGmfbXbtWqM/jk7VFSY64q3N1q/BZc8Zb8HeBX5q+w98jZ+ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2018 16:09:33.3731 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b84b282f-d218-4bf0-f1ad-08d5fd495533 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4301 X-Mailman-Approved-At: Sat, 11 Aug 2018 12:05:13 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dong Aisheng , kernel@pengutronix.de, Anson Huang , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Fabio Estevam , linux-imx@nxp.com, Robert Chiras Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Since power to the lcdif block can be lost on suspend implement PM_SLEEP_OPS using drm_mode_config_helper_suspend/resume to save/restore the current mode. Signed-off-by: Leonard Crestez Reviewed-by: Stefan Agner --- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c index 68d79f5dc0d3..d797dfd40d98 100644 --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c @@ -416,17 +416,38 @@ static int mxsfb_remove(struct platform_device *pdev) drm_dev_unref(drm); return 0; } +#ifdef CONFIG_PM_SLEEP +static int mxsfb_suspend(struct device *dev) +{ + struct drm_device *drm = dev_get_drvdata(dev); + + return drm_mode_config_helper_suspend(drm); +} + +static int mxsfb_resume(struct device *dev) +{ + struct drm_device *drm = dev_get_drvdata(dev); + + return drm_mode_config_helper_resume(drm); +} +#endif + +static const struct dev_pm_ops mxsfb_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(mxsfb_suspend, mxsfb_resume) +}; + static struct platform_driver mxsfb_platform_driver = { .probe = mxsfb_probe, .remove = mxsfb_remove, .id_table = mxsfb_devtype, .driver = { .name = "mxsfb", .of_match_table = mxsfb_dt_ids, + .pm = &mxsfb_pm_ops, }, }; module_platform_driver(mxsfb_platform_driver);