From patchwork Wed May 27 09:53:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 6488711 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 680A39F1CC for ; Wed, 27 May 2015 09:57:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 83B3F2064C for ; Wed, 27 May 2015 09:57:25 +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 A663F20647 for ; Wed, 27 May 2015 09:57:24 +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 1YxY33-0003jg-3b; Wed, 27 May 2015 09:54:53 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YxY2G-0003Oy-6X for linux-arm-kernel@lists.infradead.org; Wed, 27 May 2015 09:54:06 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6D7C53AD; Wed, 27 May 2015 02:53:35 -0700 (PDT) Received: from e103737-lin.cambridge.arm.com (e103737-lin.cambridge.arm.com [10.1.207.150]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 2F9373F251; Wed, 27 May 2015 02:53:42 -0700 (PDT) From: Sudeep Holla To: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 4/5] clk: scpi: add support for cpufreq virtual device Date: Wed, 27 May 2015 10:53:17 +0100 Message-Id: <1432720398-5701-5-git-send-email-sudeep.holla@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1432720398-5701-1-git-send-email-sudeep.holla@arm.com> References: <1432720398-5701-1-git-send-email-sudeep.holla@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150527_025404_385308_CDB176A2 X-CRM114-Status: GOOD ( 11.36 ) X-Spam-Score: -5.0 (-----) Cc: "Jon Medhurst \(Tixy\)" , Lorenzo Pieralisi , Mike Turquette , Arnd Bergmann , Kevin Hilman , Stephen Boyd , Liviu Dudau , Sudeep Holla , Olof Johansson 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 The clocks for the CPUs are provided by SCP and are managed by this clock driver. So the cpufreq device needs to be added only after the clock get registered and removed when this driver is unloaded. This patch manages the cpufreq virtual device based on the clock availability. Signed-off-by: Sudeep Holla Cc: Mike Turquette Cc: Stephen Boyd Cc: Liviu Dudau Cc: Lorenzo Pieralisi Cc: Jon Medhurst (Tixy) Cc: linux-clk@vger.kernel.org Acked-by: Stephen Boyd --- drivers/clk/clk-scpi.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/clk/clk-scpi.c b/drivers/clk/clk-scpi.c index 55bfa708a5b4..04068072f8d1 100644 --- a/drivers/clk/clk-scpi.c +++ b/drivers/clk/clk-scpi.c @@ -36,6 +36,7 @@ struct scpi_clk { #define to_scpi_clk(clk) container_of(clk, struct scpi_clk, hw) static struct scpi_ops *scpi_ops; +static struct platform_device *cpufreq_dev; static unsigned long scpi_clk_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) @@ -241,6 +242,11 @@ static int scpi_clocks_remove(struct platform_device *pdev) struct device *dev = &pdev->dev; struct device_node *child, *np = dev->of_node; + if (cpufreq_dev) { + platform_device_unregister(cpufreq_dev); + cpufreq_dev = NULL; + } + for_each_available_child_of_node(np, child) of_clk_del_provider(np); scpi_ops = NULL; @@ -264,6 +270,12 @@ static int scpi_clocks_probe(struct platform_device *pdev) return ret; } } + /* Add the virtual cpufreq device */ + cpufreq_dev = platform_device_register_simple("scpi-cpufreq", + -1, NULL, 0); + if (!cpufreq_dev) + pr_warn("unable to register cpufreq device"); + return 0; }