From patchwork Mon Jun 8 10:39:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 6564111 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 881379F1C1 for ; Mon, 8 Jun 2015 10:43:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 98A012053E for ; Mon, 8 Jun 2015 10:43:51 +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 951EC2053A for ; Mon, 8 Jun 2015 10:43:50 +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 1Z1uUl-0005pD-BU; Mon, 08 Jun 2015 10:41:31 +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 1Z1uU6-0005Sl-5v for linux-arm-kernel@lists.infradead.org; Mon, 08 Jun 2015 10:40:52 +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 23546653; Mon, 8 Jun 2015 03:40:36 -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 2D5193F52A; Mon, 8 Jun 2015 03:40:25 -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 v4 4/8] clk: scpi: add support for cpufreq virtual device Date: Mon, 8 Jun 2015 11:39:58 +0100 Message-Id: <1433760002-24120-5-git-send-email-sudeep.holla@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1433760002-24120-1-git-send-email-sudeep.holla@arm.com> References: <1433760002-24120-1-git-send-email-sudeep.holla@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150608_034050_299104_6A4DC27D X-CRM114-Status: GOOD ( 11.76 ) 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 Acked-by: Stephen Boyd Cc: Stephen Boyd Cc: Mike Turquette Cc: Liviu Dudau Cc: Lorenzo Pieralisi Cc: Jon Medhurst (Tixy) Cc: linux-clk@vger.kernel.org --- drivers/clk/clk-scpi.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/clk/clk-scpi.c b/drivers/clk/clk-scpi.c index 707b3430c55f..2e056ac19c54 100644 --- a/drivers/clk/clk-scpi.c +++ b/drivers/clk/clk-scpi.c @@ -34,6 +34,8 @@ struct scpi_clk { #define to_scpi_clk(clk) container_of(clk, struct scpi_clk, hw) +static struct platform_device *cpufreq_dev; + static unsigned long scpi_clk_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) { @@ -238,6 +240,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); return 0; @@ -263,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; }