From patchwork Thu May 14 15:42:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 6407161 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 28CAA9F318 for ; Thu, 14 May 2015 15:51:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3ED9A2038E for ; Thu, 14 May 2015 15:51:56 +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 4CBF820382 for ; Thu, 14 May 2015 15:51:55 +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 1YsvN5-0001Qb-Az; Thu, 14 May 2015 15:48:27 +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 1YsvII-0005Bq-By for linux-arm-kernel@lists.infradead.org; Thu, 14 May 2015 15:43:32 +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 D0BE95F8; Thu, 14 May 2015 08:42:32 -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 9E0EB3F21B; Thu, 14 May 2015 08:43:09 -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 v2 4/5] clk: scpi: add support for cpufreq virtual device Date: Thu, 14 May 2015 16:42:34 +0100 Message-Id: <1431618155-3132-5-git-send-email-sudeep.holla@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1431618155-3132-1-git-send-email-sudeep.holla@arm.com> References: <1431618155-3132-1-git-send-email-sudeep.holla@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150514_084330_544869_0B076B3A X-CRM114-Status: GOOD ( 11.32 ) X-Spam-Score: -5.0 (-----) Cc: "Jon Medhurst \(Tixy\)" , Lorenzo Pieralisi , Mike Turquette , Stephen Boyd , Liviu Dudau , Sudeep Holla 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 --- 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 208f68d14214..092b4231b1de 100644 --- a/drivers/clk/clk-scpi.c +++ b/drivers/clk/clk-scpi.c @@ -37,6 +37,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) @@ -247,6 +248,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; @@ -270,6 +276,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; }