Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1257542

Re: [PATCH v2 1/2] clk: qcom: common: Add API to register board clocks backwards compatibly

From Stephen Boyd <sboyd@codeaurora.org>
Newsgroups linux.kernel
Subject Re: [PATCH v2 1/2] clk: qcom: common: Add API to register board clocks backwards compatibly
Date 2015-10-28 02:10 +0100
Message-ID <qonpw-4h9-11@gated-at.bofh.it> (permalink)
References <qolxo-315-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 1/2] clk: qcom: common: Add API to register board clocks backwards compatibly Stephen Boyd <sboyd@codeaurora.org> - 2015-10-28 00:10 +0100
  [PATCH v2 2/2] clk: qcom: Move cxo/pxo/xo into dt files Stephen Boyd <sboyd@codeaurora.org> - 2015-10-28 00:10 +0100
  Re: [PATCH v2 1/2] clk: qcom: common: Add API to register board  clocks backwards compatibly Stephen Boyd <sboyd@codeaurora.org> - 2015-10-28 02:10 +0100
    Re: [PATCH v2 1/2] clk: qcom: common: Add API to register board  clocks backwards compatibly Georgi Djakov <georgi.djakov@linaro.org> - 2015-10-28 19:10 +0100
      Re: [PATCH v2 1/2] clk: qcom: common: Add API to register board  clocks backwards compatibly Stephen Boyd <sboyd@codeaurora.org> - 2015-10-28 19:30 +0100

csiph-web