From patchwork Fri Jul 25 18:31:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 4625151 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 310249F36A for ; Fri, 25 Jul 2014 17:48:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 423D220136 for ; Fri, 25 Jul 2014 17:48:46 +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 47F7220123 for ; Fri, 25 Jul 2014 17:48:45 +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 1XAja3-0007fY-Ae; Fri, 25 Jul 2014 17:46:55 +0000 Received: from comal.ext.ti.com ([198.47.26.152]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XAjZz-0007Vo-FR for linux-arm-kernel@lists.infradead.org; Fri, 25 Jul 2014 17:46:52 +0000 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id s6PHkLF1009770; Fri, 25 Jul 2014 12:46:21 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s6PHkLFS011074; Fri, 25 Jul 2014 12:46:21 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.174.1; Fri, 25 Jul 2014 12:46:21 -0500 Received: from localhost (dlep60.itg.ti.com [157.170.170.21]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s6PHkKmL009922; Fri, 25 Jul 2014 12:46:20 -0500 From: Grygorii Strashko To: , "Rafael J. Wysocki" , , Geert Uytterhoeven , Subject: [RFC PATCH 2/3] PM / clock_ops: allow to specify custom pm_clk_notifier callback Date: Fri, 25 Jul 2014 21:31:35 +0300 Message-ID: <1406313096-29761-3-git-send-email-grygorii.strashko@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1406313096-29761-1-git-send-email-grygorii.strashko@ti.com> References: <1406313096-29761-1-git-send-email-grygorii.strashko@ti.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140725_104651_601150_375069A0 X-CRM114-Status: UNSURE ( 8.01 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -5.0 (-----) Cc: ulf.hansson@linaro.org, Grygorii Strashko , linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org, grant.likely@secretlab.ca, ben.dooks@codethink.co.uk, laurent.pinchart@ideasonboard.com, linux-arm-kernel@lists.infradead.org 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 The CLK PM domain assumes that platform code should always provide list of Connection IDs of the clock (con_id) in pm_clk_notifier_block structure. Then CLK PM domain uses these con_ids to setup list of clocks per device. Such approach is inconvenient when devices can have different number of clocks. For example, if maximum number of clocks used by device is 4 the pm_clk_notifier_block structure will look like: static struct pm_clk_notifier_block platform_domain_notifier = { .pm_domain = &keystone_pm_domain, .con_ids = { "fck", "opt1", "opt2", "opt3", NULL }, }; More over, clocks in DT have to be named using only con_ids: clocks = <&paclk13>, <&clkcpgmac>, <&chipclk12>; clock-names = "fck", "opt1", "opt2"; This patch allow to specify custom pm_clk_notifier callback from platform code and in such way makes CLK PM domain initialization more flexible. For example, Keystone 2 will provide custom callback to fill list of clocks for Device with all clocks assigned to this Device in DT. Signed-off-by: Grygorii Strashko --- drivers/base/power/clock_ops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c index 2d5c9c1..c103598 100644 --- a/drivers/base/power/clock_ops.c +++ b/drivers/base/power/clock_ops.c @@ -520,6 +520,7 @@ void pm_clk_add_notifier(struct bus_type *bus, if (!bus || !clknb) return; - clknb->nb.notifier_call = pm_clk_notify; + if (!clknb->nb.notifier_call) + clknb->nb.notifier_call = pm_clk_notify; bus_register_notifier(bus, &clknb->nb); }