From patchwork Mon Feb 9 11:02:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kachhap X-Patchwork-Id: 5800851 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 75864BF440 for ; Mon, 9 Feb 2015 11:04:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9C1B920125 for ; Mon, 9 Feb 2015 11:04:55 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A852720121 for ; Mon, 9 Feb 2015 11:04:54 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YKm6e-0000Sn-7C; Mon, 09 Feb 2015 11:02:20 +0000 Received: from mailout3.samsung.com ([203.254.224.33]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YKm3i-0005hU-KT for linux-arm-kernel@lists.infradead.org; Mon, 09 Feb 2015 10:59:27 +0000 Received: from epcpsbgr1.samsung.com (u141.gpu120.samsung.co.kr [203.254.230.141]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NJI0027F3U683E0@mailout3.samsung.com> for linux-arm-kernel@lists.infradead.org; Mon, 09 Feb 2015 19:58:54 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.123]) by epcpsbgr1.samsung.com (EPCPMTA) with SMTP id BA.68.17016.EE298D45; Mon, 09 Feb 2015 19:58:54 +0900 (KST) X-AuditID: cbfee68d-f79296d000004278-c7-54d892ee9dc7 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id C3.44.09430.EE298D45; Mon, 09 Feb 2015 19:58:54 +0900 (KST) Received: from chromebld-server.sisodomain.com ([107.108.73.106]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NJI00CJM3R5TO30@mmp1.samsung.com>; Mon, 09 Feb 2015 19:58:54 +0900 (KST) From: Amit Daniel Kachhap To: linux-pm@vger.kernel.org Subject: [PATCH RFC v4 1/3] PM / Runtime: Add an API pm_runtime_set_slave Date: Mon, 09 Feb 2015 16:32:04 +0530 Message-id: <1423479726-23140-2-git-send-email-amit.daniel@samsung.com> X-Mailer: git-send-email 2.2.0 In-reply-to: <1423479726-23140-1-git-send-email-amit.daniel@samsung.com> References: <1423479726-23140-1-git-send-email-amit.daniel@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprMIsWRmVeSWpSXmKPExsWyRsSkWvfdpBshBjO3i1s0XA2xmDt7EqNF 74KrbBZfD69gtJg1ZS+TxabH11gtLu+aw2bxufcIo8WM8/uYLNYeuctusWjrF3aLM6cvsVoc ftPOatGxjNFi1a4/jBbH14Y7CHhMPKvrsXPWXXaPxXteMnncubaHzWPzknqPLVfbWTz6tqxi 9Pi8SS6AI4rLJiU1J7MstUjfLoEr49TLO8wFTyQqtn/9ydbA+F6ki5GTQ0LARGJN9zZWCFtM 4sK99WxdjFwcQgJLGSU231nODFN0fOkBVojEIkaJs/MOsUM4E5gkrv9sYQOpYhMwlvi5cz87 iC0iICMx9cp+sA5mgQXMEkcnLWYBSQgLeEqcPLWQCcRmEVCVuPJxHpDNwcEr4C6x+YwsxDY5 iS23HoHN4RTwkJhxug3MFgIq6Ti1gBFkpoTAR3aJ+5sOsEPMEZD4NvkQC8gcCQFZiU0HoK6W lDi44gbLB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EU6KiJzFKiyfnAhJJXEm9obGJuamxqaWJhYmapJM6rZN8WIiSQnliS mp2aWpBaBNPHxMEp1cDofNzBO+9shX6zhF7U/Eczgk+1nl1Z61nPsHrtqe6ovQoxDmfn3+sq +erpf27+XrPJASL5qfrFLyP7srV70runX+PrkdvCcizwr6Hw770M725eFrPv+8SdKifvu+BL AlPuJaXstdG7I+68b3cJWaX8T2fKiY5/H28XvdL4euGps7JmhUmE9FIlluKMREMt5qLiRACK hKQw8AIAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150209_025918_903952_71DA3E05 X-CRM114-Status: GOOD ( 11.19 ) X-Spam-Score: -5.0 (-----) Cc: len.brown@intel.com, ulf.hansson@linaro.org, khilman@linaro.org, geert+renesas@glider.be, pankaj.dubey@samsung.com, rjw@rjwysocki.net, linux-kernel@vger.kernel.org, tomasz.figa@gmail.com, Amit Daniel Kachhap , linux-samsung-soc@vger.kernel.org, thomas.ab@samsung.com, s.nawrocki@samsung.com, kgene.kim@samsung.com, linux-arm-kernel@lists.infradead.org, m.szyprowski@samsung.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This API creates a pm runtime slave type device which does not itself participates in pm runtime but depends on the master devices to power manage them. These devices should have pm runtime callbacks. These devices (like clock) may not implement complete pm_runtime calls such as pm_runtime_get/pm_runtime_put due to subsystems interaction behaviour or any other reason. Signed-off-by: Amit Daniel Kachhap --- drivers/base/power/runtime.c | 18 ++++++++++++++++++ include/linux/pm.h | 1 + include/linux/pm_runtime.h | 2 ++ 3 files changed, 21 insertions(+) diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index 5070c4f..e247f08 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c @@ -1252,6 +1252,24 @@ void pm_runtime_no_callbacks(struct device *dev) EXPORT_SYMBOL_GPL(pm_runtime_no_callbacks); /** + * pm_runtime_set_slave - Set these devices as slave. + * @dev: Device to handle. + * + * Set the power.slave flag, which tells the PM core that this device is + * power-managed by the master device through the runtime callbacks. Since it + * will not manage runtime callbacks on its own, so runtime sysfs attributes is + * removed. + */ +void pm_runtime_set_slave(struct device *dev) +{ + spin_lock_irq(&dev->power.lock); + dev->power.slave = true; + spin_unlock_irq(&dev->power.lock); + if (device_is_registered(dev)) + rpm_sysfs_remove(dev); +} + +/** * pm_runtime_irq_safe - Leave interrupts disabled during callbacks. * @dev: Device to handle * diff --git a/include/linux/pm.h b/include/linux/pm.h index 8b59763..a4090ef 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h @@ -581,6 +581,7 @@ struct dev_pm_info { unsigned int use_autosuspend:1; unsigned int timer_autosuspends:1; unsigned int memalloc_noio:1; + unsigned int slave:1; enum rpm_request request; enum rpm_status runtime_status; int runtime_error; diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h index 30e84d4..0707a4b 100644 --- a/include/linux/pm_runtime.h +++ b/include/linux/pm_runtime.h @@ -47,6 +47,7 @@ extern void __pm_runtime_disable(struct device *dev, bool check_resume); extern void pm_runtime_allow(struct device *dev); extern void pm_runtime_forbid(struct device *dev); extern void pm_runtime_no_callbacks(struct device *dev); +extern void pm_runtime_set_slave(struct device *dev); extern void pm_runtime_irq_safe(struct device *dev); extern void __pm_runtime_use_autosuspend(struct device *dev, bool use); extern void pm_runtime_set_autosuspend_delay(struct device *dev, int delay); @@ -168,6 +169,7 @@ static inline bool pm_runtime_suspended_if_enabled(struct device *dev) { return static inline bool pm_runtime_enabled(struct device *dev) { return false; } static inline void pm_runtime_no_callbacks(struct device *dev) {} +static inline void pm_runtime_set_slave(struct device *dev) {} static inline void pm_runtime_irq_safe(struct device *dev) {} static inline bool pm_runtime_is_irq_safe(struct device *dev) { return false; }