linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: Mike Turquette <mturquette@baylibre.com>
Cc: linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org,
	linux-arm-msm@vger.kernel.org,
	Georgi Djakov <georgi.djakov@linaro.org>
Subject: Re: [PATCH v2 1/2] clk: qcom: common: Add API to register board clocks backwards compatibly
Date: Tue, 27 Oct 2015 18:06:04 -0700	[thread overview]
Message-ID: <20151028010604.GV19782@codeaurora.org> (raw)
In-Reply-To: <1445987100-19492-1-git-send-email-sboyd@codeaurora.org>

On 10/27, Stephen Boyd wrote:
> +
> +int qcom_cc_register_board_clk(struct device *dev, const char *path,
> +			       const char *name, unsigned long rate)
> +{
> +	return _qcom_cc_register_board_clk(dev, path, name, rate,
> +					   !IS_ENABLED(CONFIG_QCOM_RPMCC));

I just realized that we could have this config enabled but the
driver never probes on a certain platform. So we'll need to do
some sort of search to see if the rpmcc node exists and also
check to see if the driver is enabled. I guess we can do that all
here in this function as long as we have a compatible =
"qcom,rpmcc" as a more generic property for the rpm clock
controller node. So if the config is enabled, search the dt tree
for a qcom,rpmcc node. If the rpmcc node is there, the last
argument is false, otherwise it's true.

---8<----
diff --git a/drivers/clk/qcom/common.c b/drivers/clk/qcom/common.c
index 572851b5bc16..215a41ba0135 100644
--- a/drivers/clk/qcom/common.c
+++ b/drivers/clk/qcom/common.c
@@ -17,6 +17,7 @@
 #include <linux/platform_device.h>
 #include <linux/clk-provider.h>
 #include <linux/reset-controller.h>
+#include <linux/of.h>
 
 #include "common.h"
 #include "clk-rcg.h"
@@ -152,7 +153,18 @@ static int _qcom_cc_register_board_clk(struct device *dev, const char *path,
 int qcom_cc_register_board_clk(struct device *dev, const char *path,
 			       const char *name, unsigned long rate)
 {
-	return _qcom_cc_register_board_clk(dev, path, name, rate, true);
+	bool add_factor = true;
+	struct device_node *node;
+
+	/* The RPM clock driver will add the factor clock if present */
+	if (IS_ENABLED(CONFIG_QCOM_RPMCC)) {
+		node = of_find_compatible_node(NULL, NULL, "qcom,rpmcc");
+		if (node)
+			add_factor = false;
+		of_node_put(node);
+	}
+
+	return _qcom_cc_register_board_clk(dev, path, name, rate, add_factor);
 }
 EXPORT_SYMBOL_GPL(qcom_cc_register_board_clk);
 
-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

  parent reply	other threads:[~2015-10-28  1:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-27 23:04 [PATCH v2 1/2] clk: qcom: common: Add API to register board clocks backwards compatibly Stephen Boyd
2015-10-27 23:05 ` [PATCH v2 2/2] clk: qcom: Move cxo/pxo/xo into dt files Stephen Boyd
2015-10-28  1:06 ` Stephen Boyd [this message]
2015-10-28 18:03   ` [PATCH v2 1/2] clk: qcom: common: Add API to register board clocks backwards compatibly Georgi Djakov
2015-10-28 18:24     ` Stephen Boyd

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151028010604.GV19782@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=georgi.djakov@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).