From patchwork Tue Jan 17 12:44:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 9520743 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 815CE6020A for ; Tue, 17 Jan 2017 12:46:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6832628545 for ; Tue, 17 Jan 2017 12:46:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5CA3928544; Tue, 17 Jan 2017 12:46:31 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 9859228544 for ; Tue, 17 Jan 2017 12:46:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751272AbdAQMq2 (ORCPT ); Tue, 17 Jan 2017 07:46:28 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:10134 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750984AbdAQMqG (ORCPT ); Tue, 17 Jan 2017 07:46:06 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OJX0045CCR48M70@mailout1.w1.samsung.com>; Tue, 17 Jan 2017 12:45:04 +0000 (GMT) Received: from eusmges3.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170117124503eucas1p27fa1e3703f16a2f55326c805bb3fc1d2~aj8UboRT70769107691eucas1p2i; Tue, 17 Jan 2017 12:45:03 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3.samsung.com (EUCPMTA) with SMTP id 2C.F7.09557.FC11E785; Tue, 17 Jan 2017 12:45:03 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170117124503eucas1p1f63d709d794c82dcea8082dbb9c0fb3f~aj8T0xUGi2982729827eucas1p1Z; Tue, 17 Jan 2017 12:45:03 +0000 (GMT) X-AuditID: cbfec7f2-f790f6d000002555-d9-587e11cf1cbc Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 8B.A5.06687.8021E785; Tue, 17 Jan 2017 12:46:00 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OJX00GNRCQPHB20@eusync2.samsung.com>; Tue, 17 Jan 2017 12:45:03 +0000 (GMT) From: Marek Szyprowski To: linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Sylwester Nawrocki , Krzysztof Kozlowski , Linus Walleij , Tomasz Figa , Bartlomiej Zolnierkiewicz Subject: [PATCH v2 13/13] pinctrl: samsung: Replace syscore ops with standard platform device pm_ops Date: Tue, 17 Jan 2017 13:44:44 +0100 Message-id: <1484657084-26227-14-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1484657084-26227-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzWRUUhTYRTH++7ddq/DxXVK+zCVNggscSrt4aISCT3cAqGXaPaSl7zpyK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VCg1x07VQUshLzE21 VYrQ9Q0JUlIoS8wpBfKMDNCAg3OAe7CSvl2CW8aLVweZCk5oVLRPP8jawPhYsYuRk0NCwETi ysat7BC2mMSFe+vZQGwhgSWMEu9vRHQxcgHZTUwSR44uYAZJsAkYSnS97WIDSYgINDNKNCzp BXOYBSYwScz81MAEUiUskCaxe1Mn2FgWAVWJH8/PgXXzCnhKPG+6zgSxTk7i5LHJrCA2J1D8 x8/1TBCrPSTO39/HOoGRdwEjwypGkdTS4tz03GJDveLE3OLSvHS95PzcTYzAoN927OfmHYyX NgYfYhTgYFTi4XW4XRMhxJpYVlyZe4hRgoNZSYR3rkBdhBBvSmJlVWpRfnxRaU5q8SFGU6Cj JjJLiSbnAyMyryTe0MTQ3NLQyNjCwtzISEmct+TDlXAhgfTEktTs1NSC1CKYPiYOTqkGxmgp uejdOivNrzkek/jcm2m/8vC3ZemBLn+zb2Y++Mg1/2mj6Lve9bdZ+RbKdnw6svrWf6WSS/rf L8WV320U6mHsW+q5nidN2GJayPy/H95anBdLZnR27N3l8KvpYGbB3qj45+utHJLSNh7TuShp VSlrvyJfNWyOzoFXPWtT/dk7V/at8/4WqcRSnJFoqMVcVJwIAAlASbKQAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170117124503eucas1p1f63d709d794c82dcea8082dbb9c0fb3f X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?UTF-8?B?TWFyZWsgU3p5cHJvd3NraRtTUlBPTC1LZXJuZWwgKFRQKRs=?= =?UTF-8?B?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?UTF-8?B?TWFyZWsgU3p5cHJvd3NraRtTUlBPTC1LZXJuZWwgKFRQKRtT?= =?UTF-8?B?YW1zdW5nIEVsZWN0cm9uaWNzG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTI=?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170117124503eucas1p1f63d709d794c82dcea8082dbb9c0fb3f X-RootMTR: 20170117124503eucas1p1f63d709d794c82dcea8082dbb9c0fb3f References: <1484657084-26227-1-git-send-email-m.szyprowski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Once the dependency on PMU driver (for pad retention control) has been removed, there is no reason to use syscore_ops based suspend/resume. This patch replaces it with standard platform device pm_ops based solution. Signed-off-by: Marek Szyprowski Reviewed-by: Krzysztof Kozlowski --- drivers/pinctrl/samsung/pinctrl-samsung.c | 72 ++++++------------------------- 1 file changed, 14 insertions(+), 58 deletions(-) diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c index 021abd7221f8..d79eadad6c5f 100644 --- a/drivers/pinctrl/samsung/pinctrl-samsung.c +++ b/drivers/pinctrl/samsung/pinctrl-samsung.c @@ -29,7 +29,6 @@ #include #include #include -#include #include "../core.h" #include "pinctrl-samsung.h" @@ -49,9 +48,6 @@ { "samsung,pin-val", PINCFG_TYPE_DAT }, }; -/* Global list of devices (struct samsung_pinctrl_drv_data) */ -static LIST_HEAD(drvdata_list); - static unsigned int pin_base; static int samsung_get_group_count(struct pinctrl_dev *pctldev) @@ -1084,22 +1080,18 @@ static int samsung_pinctrl_probe(struct platform_device *pdev) platform_set_drvdata(pdev, drvdata); - /* Add to the global list */ - list_add_tail(&drvdata->node, &drvdata_list); - return 0; } #ifdef CONFIG_PM - /** - * samsung_pinctrl_suspend_dev - save pinctrl state for suspend for a device + * samsung_pinctrl_suspend - save pinctrl state for suspend * * Save data for all banks handled by this device. */ -static void samsung_pinctrl_suspend_dev( - struct samsung_pinctrl_drv_data *drvdata) +static int samsung_pinctrl_suspend(struct device *dev) { + struct samsung_pinctrl_drv_data *drvdata = dev_get_drvdata(dev); int i; for (i = 0; i < drvdata->nr_banks; i++) { @@ -1135,18 +1127,21 @@ static void samsung_pinctrl_suspend_dev( drvdata->suspend(drvdata); if (drvdata->retention_ctrl && drvdata->retention_ctrl->enable) drvdata->retention_ctrl->enable(drvdata); + + return 0; } /** - * samsung_pinctrl_resume_dev - restore pinctrl state from suspend for a device + * samsung_pinctrl_resume - restore pinctrl state from suspend * * Restore one of the banks that was saved during suspend. * * We don't bother doing anything complicated to avoid glitching lines since * we're called before pad retention is turned off. */ -static void samsung_pinctrl_resume_dev(struct samsung_pinctrl_drv_data *drvdata) +static int samsung_pinctrl_resume(struct device *dev) { + struct samsung_pinctrl_drv_data *drvdata = dev_get_drvdata(dev); int i; if (drvdata->resume) @@ -1185,48 +1180,11 @@ static void samsung_pinctrl_resume_dev(struct samsung_pinctrl_drv_data *drvdata) if (drvdata->retention_ctrl && drvdata->retention_ctrl->disable) drvdata->retention_ctrl->disable(drvdata); -} - -/** - * samsung_pinctrl_suspend - save pinctrl state for suspend - * - * Save data for all banks across all devices. - */ -static int samsung_pinctrl_suspend(void) -{ - struct samsung_pinctrl_drv_data *drvdata; - - list_for_each_entry(drvdata, &drvdata_list, node) { - samsung_pinctrl_suspend_dev(drvdata); - } return 0; } - -/** - * samsung_pinctrl_resume - restore pinctrl state for suspend - * - * Restore data for all banks across all devices. - */ -static void samsung_pinctrl_resume(void) -{ - struct samsung_pinctrl_drv_data *drvdata; - - list_for_each_entry_reverse(drvdata, &drvdata_list, node) { - samsung_pinctrl_resume_dev(drvdata); - } -} - -#else -#define samsung_pinctrl_suspend NULL -#define samsung_pinctrl_resume NULL #endif -static struct syscore_ops samsung_pinctrl_syscore_ops = { - .suspend = samsung_pinctrl_suspend, - .resume = samsung_pinctrl_resume, -}; - static const struct of_device_id samsung_pinctrl_dt_match[] = { #ifdef CONFIG_PINCTRL_EXYNOS { .compatible = "samsung,exynos3250-pinctrl", @@ -1268,25 +1226,23 @@ static void samsung_pinctrl_resume(void) }; MODULE_DEVICE_TABLE(of, samsung_pinctrl_dt_match); +static const struct dev_pm_ops samsung_pinctrl_pm_ops = { + SET_LATE_SYSTEM_SLEEP_PM_OPS(samsung_pinctrl_suspend, + samsung_pinctrl_resume) +}; + static struct platform_driver samsung_pinctrl_driver = { .probe = samsung_pinctrl_probe, .driver = { .name = "samsung-pinctrl", .of_match_table = samsung_pinctrl_dt_match, .suppress_bind_attrs = true, + .pm = &samsung_pinctrl_pm_ops, }, }; static int __init samsung_pinctrl_drv_register(void) { - /* - * Register syscore ops for save/restore of registers across suspend. - * It's important to ensure that this driver is running at an earlier - * initcall level than any arch-specific init calls that install syscore - * ops that turn off pad retention (like exynos_pm_resume). - */ - register_syscore_ops(&samsung_pinctrl_syscore_ops); - return platform_driver_register(&samsung_pinctrl_driver); } postcore_initcall(samsung_pinctrl_drv_register);