From patchwork Wed Jan 25 11:53:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 92442 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp2170954qgi; Wed, 25 Jan 2017 03:53:39 -0800 (PST) X-Received: by 10.84.136.135 with SMTP id 7mr3061421pll.149.1485345219039; Wed, 25 Jan 2017 03:53:39 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a71si23173056pfg.294.2017.01.25.03.53.38; Wed, 25 Jan 2017 03:53:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751560AbdAYLxe (ORCPT + 13 others); Wed, 25 Jan 2017 06:53:34 -0500 Received: from mailout4.w1.samsung.com ([210.118.77.14]:12923 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751405AbdAYLxb (ORCPT ); Wed, 25 Jan 2017 06:53:31 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OKC003DY3P53A10@mailout4.w1.samsung.com>; Wed, 25 Jan 2017 11:53:29 +0000 (GMT) Received: from eusmges5.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170125115328eucas1p22a52d1cfc3e7fd6c84207c400f1fec44~dAZkCc_yw1352413524eucas1p27; Wed, 25 Jan 2017 11:53:28 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges5.samsung.com (EUCPMTA) with SMTP id A3.11.17477.8B198885; Wed, 25 Jan 2017 11:53:28 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170125115327eucas1p172866fa87417f59f1dea60185d6d8b60~dAZjSPVjC2749427494eucas1p1s; Wed, 25 Jan 2017 11:53:27 +0000 (GMT) X-AuditID: cbfec7f5-f79d06d000004445-a7-588891b880a0 Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 77.7F.06687.7F198885; Wed, 25 Jan 2017 11:54:31 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OKC006PE3OZJVA0@eusync4.samsung.com>; Wed, 25 Jan 2017 11:53:27 +0000 (GMT) From: Marek Szyprowski To: linux-clk@vger.kernel.org, linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Marek Szyprowski , Stephen Boyd , Michael Turquette , Ulf Hansson , Sylwester Nawrocki , Chanwoo Choi , Inki Dae , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz Subject: [PATCH v5 0/4] Add runtime PM support for clocks (on Exynos SoC example) Date: Wed, 25 Jan 2017 12:53:10 +0100 Message-id: <1485345194-3196-1-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrPIsWRmVeSWpSXmKPExsWy7djPc7o7JnZEGOz9KW+xccZ6VovrX56z Wky6P4HF4vz5DewWmx5fY7X42HOP1eJz7xFGixnn9zFZrD1yl93i4ilXi8Nv2lktfpzpZrE4 vjbcgdfj/Y1Wdo/Lfb1MHptWdbJ53Lm2h81j85J6j74tqxg9Pm+SC2CP4rJJSc3JLEst0rd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sK99WxdjFwcQgJLGCW+P57CCOE0MUlMe/ab DaSKTcBQouttF1iViEATo8STvmnsIA6zQBuzxP+Or4wgVcICwRLHVxxiBbFZBFQl5u98xway jlfAXWLypiiIdXISJ49NZp3AyL2AkWEVo0hqaXFuem6xoV5xYm5xaV66XnJ+7iZGYJBvO/Zz 8w7GSxuDDzEKcDAq8fBOSGqPEGJNLCuuzD3EKMHBrCTC69DSESHEm5JYWZValB9fVJqTWnyI 0RRo90RmKdHkfGAE5pXEG5oYmlsaGhlbWJgbGSmJ85Z8uBIuJJCeWJKanZpakFoE08fEwSnV wKjAq520onQrf8ipXdNP/Vw0wzCt3cEx7+geMzGnP5cnReZGV/jZF+22yFs44/qyi5NWnEg5 MTPstXXNvAym9J6CGpUjCTefie/y61jmrVF5WVG9qe/UO4W1mq4Jx6apXwyL1ot9OdFsrXnc /WkrJb4e86lb9M728a0NhZwrLt6cYcUZ+Hy5xEklluKMREMt5qLiRAB+mN/ViAIAAA== X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170125115327eucas1p172866fa87417f59f1dea60185d6d8b60 X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1B?= =?utf-8?b?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1BSam?= =?utf-8?q?sung_Electronics=1BSenior_Software_Engineer?= X-Sender-Code: =?utf-8?q?C10=1BEHQ=1BC10CD02CD027392?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170125115327eucas1p172866fa87417f59f1dea60185d6d8b60 X-RootMTR: 20170125115327eucas1p172866fa87417f59f1dea60185d6d8b60 References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Dear All, This patchset adds runtime PM support to common clock framework. This is an attempt to implement support for clock controllers, which belongs to a power domain. This approach works surprisingly well on Exynos 5433 SoC, what allowed us to solve various freeze/crash issues related to power management. The main idea behind this patchset is to keep clock's controller power domain enabled every time when at least one of its clock is enabled or access to its registers is being made. Clock controller driver (clock provider) can supply a struct device pointer, which is the used by clock core for tracking and managing clock's controller runtime pm state. Each clk_prepare() operation will first call pm_runtime_get_sync() on the supplied device, while clk_unprepare() will do pm_runtime_put() at the end. This runtime PM feature has been tested with Exynos4412 (not included in this patchset) and Exynos5433 clocks drivers. Both have some clocks, which belongs to respective power domains and need special handling during power on/off procedures. Till now it wasn't handled at all, what caused various problems. Patches for clocks drivers change the way the clock provider is initialized. Instead of CLK_OF_DECLARE based initialization, a complete platform device driver infrastructure is being used. This is needed to let driver to use runtime PM feature and integrate with generic power domains. The side-effect of this change is a delay in clock provider registeration during system boot, so early initialized drivers might get EPROBEDEFER error when requesting their clocks. This is an issue for IOMMU drivers, so this patchset will be fully functional once the deferred probe for IOMMU will be merged. v7 of the IOMMU deferred probe support has been posted two days ago: https://www.spinics.net/lists/arm-kernel/msg557110.html Patches are based on linux-next from 25th January 2017. This is a part of a larger task, which goal is to add support for power domains on Exynos5433 SoCs / TM2 boards. All patches needed to get it working have been pushed to the following git repo: https://git.linaro.org/people/marek.szyprowski/linux-srpol.git v4.10-next-tm2-pd Best regards Marek Szyprowski Samsung R&D Institute Poland Changelog: v5: - rebased onto next-20170125 kernel release - added two more calls to runtime PM in clock's core: 1. clk_recalc() should ensure active runtime pm state, because it might read registers (in case of dividers) to calculate the rate 2. clk_register() also needs to ensure active runtime pm state to read initial rate and status of the clocks - more fixes in Exynos5433 clocks drivers: 1. PLL in DISP CMU must be enabled for suspend 2. guard clocks registration with pm_runtime_get_sync/pm_runtime_put to avoid turning the power domain on and off many times for no good reason (registering each clock will call pm_runtime_get_sync(), then pm_runtime_put, what in turn might disable power domain) - still waiting for a review... v4: http://www.spinics.net/lists/arm-kernel/msg550747.html - Removed patch for Exynos4412 clocks from the patchset. DT bindings for power domain for ISP sub-controller needs more discussion. It will be handled separately when the runtime PM for clocks feature gets merged. - Added patch with runtime PM support for Exynos AudioSS clock controller driver (needed to enable audio power domain on Exynos5 series). - Fixes in Exynos5433 driver: 1. added missing clock for Audio CMU 2. added support for FSYS CMU 3. improved support for DISP CMU (thanks to Andrzej Hajda for investigating that). - Rebased onto v4.10-rc1 - Waiting for a review... v3: http://www.spinics.net/lists/arm-kernel/msg538122.html - Removed CLK_RUNTIME_PM flag, core now simply checks if runtime pm is enabled for the provided device during clock registration as suggested by Ulf - Simplified code for exynos4412 isp clock driver registration - Resolved some other minor issues pointed by Ulf clk core code - Rebased onto v4.9-rc1 and new version of IOMMU deferred probe patchset v2: https://www.spinics.net/lists/arm-kernel/msg532798.html - Simplified clk_pm_runtime_get/put functions, removed workaround for devices with disabled runtime pm. Such workaround is no longer needed since commit 4d23a5e84806b202d9231929c9507ef7cf7a0185 ("PM / Domains: Allow runtime PM during system PM phases"). - Added CLK_RUNTIME_PM flag to indicate clocks, for which clock core should call runtime pm functions. This solves problem with clocks, for which struct device is already registered, but no runtime pm is enabled. - Extended commit messages according to Ulf suggestions. - Fixed some style issues pointed by Barlomiej. v1: http://www.spinics.net/lists/arm-kernel/msg528128.html - initial version Patch summary: Marek Szyprowski (4): clk: Add support for runtime PM clk: samsung: Add support for runtime PM clk: samsung: exynos5433: Add runtime PM support clk: samsung: exynos-audss: Use runtime PM .../devicetree/bindings/clock/clk-exynos-audss.txt | 6 + .../devicetree/bindings/clock/exynos5433-clock.txt | 16 + drivers/clk/clk.c | 132 ++++++- drivers/clk/samsung/clk-exynos-audss.c | 62 +-- drivers/clk/samsung/clk-exynos5433.c | 422 ++++++++++++++++----- drivers/clk/samsung/clk-pll.c | 2 +- drivers/clk/samsung/clk.c | 12 +- drivers/clk/samsung/clk.h | 7 + 8 files changed, 527 insertions(+), 132 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html