From patchwork Wed Sep 16 17:16:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 53757 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by patches.linaro.org (Postfix) with ESMTPS id 9BA4322A0D for ; Wed, 16 Sep 2015 17:19:53 +0000 (UTC) Received: by lbbmp1 with SMTP id mp1sf71679345lbb.2 for ; Wed, 16 Sep 2015 10:19:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=IsY+kgRqv3iG1Lrv7ZErybe3cpAYJHUupi/i275cc0M=; b=P0rXr4QSjnGTIHScJGj6AXwa2Kqi6gE4675rwVpyYMxqAoQOXi+TxuDPs0CyPZQmkL Q/ObGqf7Fx8EwVBSMhm5eXxZK3evKlhVlFJ+qgFfb7etQUNp/8fK4M5UPUeo4Rsb6nwL l3JpbX1xfG9PRg6pZpGaUc9mfc0ldd/7atDAFUtq8pOEi+Mc6gDfQLvc3C5c6jBRjeFz b93YFaUEDkMlrWaGh/+Vyrk4KKQO9shQpqklrgxc2yNg8PpWoqCNXqRrtoFNkkJl9VG/ ZQxKoHrhHcugJh/52cMfoe4/FRc00/HdXvBcgKyaOMQ6XXVBSkckgAvhyEpPX0b2PaRf Ikhw== X-Gm-Message-State: ALoCoQkvOLffb/MXeRh+wtvswFeiPhkIWtuO1jqn7g3CttzOj5Fi3TEdqUzxkWljJOqk03riEhJK X-Received: by 10.180.35.132 with SMTP id h4mr2208207wij.5.1442423992535; Wed, 16 Sep 2015 10:19:52 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.41 with SMTP id g9ls476711laa.65.gmail; Wed, 16 Sep 2015 10:19:52 -0700 (PDT) X-Received: by 10.112.204.67 with SMTP id kw3mr30512310lbc.60.1442423992338; Wed, 16 Sep 2015 10:19:52 -0700 (PDT) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id n5si11895580laf.41.2015.09.16.10.19.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Sep 2015 10:19:52 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by lamp12 with SMTP id p12so132434105lam.0 for ; Wed, 16 Sep 2015 10:19:52 -0700 (PDT) X-Received: by 10.112.168.66 with SMTP id zu2mr30829963lbb.29.1442423992236; Wed, 16 Sep 2015 10:19:52 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp2583641lbq; Wed, 16 Sep 2015 10:19:51 -0700 (PDT) X-Received: by 10.50.103.34 with SMTP id ft2mr14241471igb.62.1442423991177; Wed, 16 Sep 2015 10:19:51 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v5si17058361igh.49.2015.09.16.10.19.50; Wed, 16 Sep 2015 10:19:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754098AbbIPRTj (ORCPT + 29 others); Wed, 16 Sep 2015 13:19:39 -0400 Received: from foss.arm.com ([217.140.101.70]:37706 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753584AbbIPRR3 (ORCPT ); Wed, 16 Sep 2015 13:17:29 -0400 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 E5C995EF; Wed, 16 Sep 2015 10:17:28 -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 87D323F51B; Wed, 16 Sep 2015 10:17:26 -0700 (PDT) From: Sudeep Holla To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, arm@kernel.org Cc: Sudeep Holla , Liviu Dudau , Punit Agrawal , "Jon Medhurst (Tixy)" , Lorenzo Pieralisi , Arnd Bergmann , Olof Johansson , Kevin Hilman , Mike Turquette , Liviu Dudau , linux-clk@vger.kernel.org Subject: [PATCH REPOST v6 4/8] clk: scpi: add support for cpufreq virtual device Date: Wed, 16 Sep 2015 18:16:35 +0100 Message-Id: <1442423799-23892-5-git-send-email-sudeep.holla@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1442423799-23892-1-git-send-email-sudeep.holla@arm.com> References: <1442423799-23892-1-git-send-email-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: sudeep.holla@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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: 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 e8323db300e2..a201781287b3 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) { @@ -263,6 +265,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; @@ -288,6 +295,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; }