From patchwork Wed Aug 9 10:35:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 109702 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp675755qge; Wed, 9 Aug 2017 03:35:21 -0700 (PDT) X-Received: by 10.99.108.132 with SMTP id h126mr7260720pgc.198.1502274921703; Wed, 09 Aug 2017 03:35:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502274921; cv=none; d=google.com; s=arc-20160816; b=uIvXZCEhVBpoo1xESK+QKMCybxtgnZM/eeiLy9nMQbKYxwq9cc61b6BUSg0wXuZ7dw aupi1wv7Kzgf55/A8hQp53cicpJjjnrkFsHPmB1wYaJ2scqQzD7nmja2VSHprUgyk7LU APVayaqZD4Ae156+WOykIpdHf5HKMjGj3+O06ojC83cXYUtwbjqUWjXRtLBfaRKnrne/ qeGjgWNuV3G16ZCpQhRYHuSvlOuL/s5W9gLCRormSnn2rDdheqIRG/u5LmtM9YDBO7lO YkNmtbXeNfLrRmj/nEvKGB7ExPnqpy8SVDK8XzP8K/oOcjNldv4ZEFbFpZSQ9Hk91RgT rhAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:message-id:date :subject:cc:to:from:arc-authentication-results; bh=6JNDlRKODPQKi1Nrh5JidWDI7vkD6aNLdM3QCXtMtPU=; b=bWQgr7nob1jfV+nLTQO6jD6r2hfVicZ+CAK6wdRfzvLbhBvDmUN+ca0LpunrbVI7uL ZcXhBd6nD3IzzWQJVOoomQz4BqNsU2CN3OMaT2R4bVvG8aW4nnWyX3ASweNkxOmIH7/q 5w110A4mUOq0bH6hC7GxdwIyZ9phsbOHIBdnlPzyosvBtsrpUtAa9S2FCnSos4EDBeZK 1QjhazlpGtUN8XvzcHiy/fVcDIwNJ88ed4X/NUCPv2B+8fHFe6KmHKHJYab1Y33F5qxR DUQAcpIwzwXgDGN5wzbzdvzEl07IsypEQSBk0wtJczAzJateWrK9nbYHSjbKWy3gwfQU dnzA== ARC-Authentication-Results: i=1; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s16si2577877plk.305.2017.08.09.03.35.20; Wed, 09 Aug 2017 03:35:21 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752074AbdHIKfT (ORCPT + 12 others); Wed, 9 Aug 2017 06:35:19 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:48734 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751948AbdHIKfQ (ORCPT ); Wed, 9 Aug 2017 06:35:16 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20170809103514euoutp02d8e76b5a27988fb3b7cf503189adf890~ZJxM1Qf2e1705417054euoutp02a; Wed, 9 Aug 2017 10:35:14 +0000 (GMT) Received: from eusmges3.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170809103513eucas1p1c644b712e67acb0abd10a01080c3b73a~ZJxMIMH330526405264eucas1p1i; Wed, 9 Aug 2017 10:35:13 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3.samsung.com (EUCPMTA) with SMTP id 0C.66.12867.165EA895; Wed, 9 Aug 2017 11:35:13 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170809103512eucas1p2e12493a126ee10419f84ae9890e3450b~ZJxLOdfy_2989429894eucas1p22; Wed, 9 Aug 2017 10:35:12 +0000 (GMT) X-AuditID: cbfec7f2-f793b6d000003243-3e-598ae561afc3 Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 7B.75.20118.065EA895; Wed, 9 Aug 2017 11:35:12 +0100 (BST) 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 <0OUE00IH6YQKHB00@eusync2.samsung.com>; Wed, 09 Aug 2017 11:35:12 +0100 (BST) 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 v8 0/5] Add runtime PM support for clocks (on Exynos SoC example) Date: Wed, 09 Aug 2017 12:35:02 +0200 Message-id: <1502274907-11931-1-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrPIsWRmVeSWpSXmKPExsWy7djP87qJT7siDV69Y7fYOGM9q8X1L89Z LSbdn8Bicf78BnaLTY+vsVp87LnHavG59wijxYzz+5gs1h65y25x8ZSrxeE37awWP850s1gc XxvuwOvx/kYru8flvl4mj02rOtk87lzbw+axeUm9R9+WVYwenzfJBbBHcdmkpOZklqUW6dsl cGXs+D+dqWC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6xKRKCJUeJJ3zR2EIdZoI1Z4n/HV7AqYYFgiSmznjOD2CwCqhJNu6+wgNi8 Ah4Sm9rPM0Hsk5M4eWwy6wRG7gWMDKsYRVJLi3PTc4uN9IoTc4tL89L1kvNzNzECw3zbsZ9b djB2vQs+xCjAwajEw3tjT2ekEGtiWXFl7iFGCQ5mJRFeMWCUCPGmJFZWpRblxxeV5qQWH2I0 BVo+kVlKNDkfGIN5JfGGJobmloZGxhYW5kZGSuK86pebIoUE0hNLUrNTUwtSi2D6mDg4pRoY Pev17J1Urzy5zr/CbJu26vuo+U/dXB1K8l/YFjBHx6QX3H65M3OK9Yo96SvUdwSukHLlPH6A LTTyfUrD2prsT9sP+AWZShofSH54V69t26flRyR6PnLzWLIqfsvP3vDYqcPx9utPl2M3Rf0q 3BuYbtDpG27l1s55g0f5/plljZrvQta6xlopsRRnJBpqMRcVJwIALJOLbokCAAA= X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170809103512eucas1p2e12493a126ee10419f84ae9890e3450b X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 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-CMS-RootMailID: 20170809103512eucas1p2e12493a126ee10419f84ae9890e3450b X-RootMTR: 20170809103512eucas1p2e12493a126ee10419f84ae9890e3450b 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 was an issue for IOMMU drivers, but IOMMU deferred probe support has been finally merged to v4.13-rc1. Patches are based on v4.13-rc4. Stephen: this patchset finally got a review from Ulf (from PM point of view). Is also touches only the Exynos5433 and Exynos Audio Subsystem drivers, which both have separate DT nodes for each clock controllers and each clock controller is entirely only in the one power domain, so everything is clean from the current DT bindings perspective. Would it be okay to merge it? Best regards Marek Szyprowski Samsung R&D Institute Poland Changelog: v8: - fixed minor issues pointed by Krzysztof Kozlowski and added his 'Reviewed-by' tags - added 'Reviewed-by' and 'Tested-by' tags from Chanwoo Choi - moved trivial changes in Exynos AudioSS driver to separate patch - added pm_runtime_get_noresume/pm_runtime_put_sync calls also to exynos-audss driver (like it is already done for exynos5433 clocks driver) - still waiting for any comments from clk maintainers v7: https://www.spinics.net/lists/arm-kernel/msg598408.html - rebased onto v4.13-rc3 - still waiting for any comments from clk maintainers v6: https://patches.linaro.org/cover/95713/ - addressed comments from Ulf Hanson and added his 'Reviewed-by' tags - simplified exynos 5433 clock driver code a bit - fixes issues pointed by kbuild test robot v5: https://www.spinics.net/lists/linux-samsung-soc/msg57718.html - 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 (5): clk: Add support for runtime PM clk: samsung: Add support for runtime PM clk: samsung: exynos5433: Add support for runtime PM clk: samsung: exynos-audss: Use local variable for controller's device clk: samsung: exynos-audss: Add support for runtime PM .../devicetree/bindings/clock/clk-exynos-audss.txt | 6 + .../devicetree/bindings/clock/exynos5433-clock.txt | 16 + drivers/clk/clk.c | 129 ++++++- drivers/clk/samsung/clk-exynos-audss.c | 76 ++-- drivers/clk/samsung/clk-exynos5433.c | 409 ++++++++++++++++----- drivers/clk/samsung/clk-pll.c | 2 +- drivers/clk/samsung/clk.c | 12 +- drivers/clk/samsung/clk.h | 7 + 8 files changed, 521 insertions(+), 136 deletions(-) -- 1.9.1