linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Georgi Djakov <georgi.djakov@linaro.org>
To: sboyd@codeaurora.org, mturquette@linaro.org
Cc: galak@codeaurora.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org
Subject: [PATCH v1 3/9] clk: qcom: Introduce parent_map tables
Date: Wed, 18 Mar 2015 15:32:09 +0200	[thread overview]
Message-ID: <1426685535-25071-4-git-send-email-georgi.djakov@linaro.org> (raw)
In-Reply-To: <1426685535-25071-1-git-send-email-georgi.djakov@linaro.org>

Define a parent_map struct to describe the relations between
PLL source index and register configuration value.
Add a qcom_find_src_index() function for finding the index of
a clock matching the specific PLL configuration

Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
---
 drivers/clk/qcom/clk-rcg.h |   11 +++++++++++
 drivers/clk/qcom/common.c  |   17 +++++++++++++++++
 drivers/clk/qcom/common.h  |    2 ++
 3 files changed, 30 insertions(+)

diff --git a/drivers/clk/qcom/clk-rcg.h b/drivers/clk/qcom/clk-rcg.h
index d09d06ba278e..6d94d5300e9e 100644
--- a/drivers/clk/qcom/clk-rcg.h
+++ b/drivers/clk/qcom/clk-rcg.h
@@ -26,6 +26,17 @@ struct freq_tbl {
 };
 
 /**
+ * struct parent_map - map table for PLL source select configuration values
+ *
+ * @src: source PLL
+ * @cfg: configuration value
+ */
+struct parent_map {
+	u8 src;
+	u8 cfg;
+};
+
+/**
  * struct mn - M/N:D counter
  * @mnctr_en_bit: bit to enable mn counter
  * @mnctr_reset_bit: bit to assert mn counter reset
diff --git a/drivers/clk/qcom/common.c b/drivers/clk/qcom/common.c
index e20d947db3e5..a946b48f2d82 100644
--- a/drivers/clk/qcom/common.c
+++ b/drivers/clk/qcom/common.c
@@ -43,6 +43,23 @@ struct freq_tbl *qcom_find_freq(const struct freq_tbl *f, unsigned long rate)
 }
 EXPORT_SYMBOL_GPL(qcom_find_freq);
 
+int qcom_find_src_index(const struct parent_map *map, u8 src)
+{
+	int i = 0;
+
+	if (!map)
+		return -EINVAL;
+
+	do {
+		if (src == map->src)
+			return i;
+		i++;
+	} while (map++);
+
+	return -ENOENT;
+}
+EXPORT_SYMBOL_GPL(qcom_find_src_index);
+
 struct regmap *
 qcom_cc_map(struct platform_device *pdev, const struct qcom_cc_desc *desc)
 {
diff --git a/drivers/clk/qcom/common.h b/drivers/clk/qcom/common.h
index f519322acdf3..b3d7e5716f5e 100644
--- a/drivers/clk/qcom/common.h
+++ b/drivers/clk/qcom/common.h
@@ -19,6 +19,7 @@ struct clk_regmap;
 struct qcom_reset_map;
 struct regmap;
 struct freq_tbl;
+struct parent_map;
 
 struct qcom_cc_desc {
 	const struct regmap_config *config;
@@ -30,6 +31,7 @@ struct qcom_cc_desc {
 
 extern const struct freq_tbl *qcom_find_freq(const struct freq_tbl *f,
 					     unsigned long rate);
+extern int qcom_find_src_index(const struct parent_map *map, u8 src);
 
 extern struct regmap *qcom_cc_map(struct platform_device *pdev,
 				  const struct qcom_cc_desc *desc);

  parent reply	other threads:[~2015-03-18 13:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-18 13:32 [PATCH v1 0/9] clk: qcom: Introduce parent_map tables Georgi Djakov
2015-03-18 13:32 ` [PATCH v1 1/9] clk: qcom: Fix clk_get_parent function return value Georgi Djakov
2015-03-18 13:32 ` [PATCH v1 2/9] clk: qcom: Do some error handling in configure_bank() Georgi Djakov
2015-03-18 13:32 ` Georgi Djakov [this message]
2015-03-18 13:32 ` [PATCH v1 4/9] clk: qcom: Make RCGs use the parent_map struct Georgi Djakov
2015-03-18 13:32 ` [PATCH v1 5/9] clk: qcom: Convert apq8084 to parent_map tables Georgi Djakov
2015-03-18 13:32 ` [PATCH v1 6/9] clk: qcom: Convert msm8974 " Georgi Djakov
2015-03-18 13:32 ` [PATCH v1 7/9] clk: qcom: Convert msm8960 " Georgi Djakov
2015-03-18 13:32 ` [PATCH v1 8/9] clk: qcom: Convert ipq806x " Georgi Djakov
2015-03-18 13:32 ` [PATCH v1 9/9] clk: qcom: Convert msm8660 " Georgi Djakov
2015-03-18 19:19 ` [PATCH v1 0/9] clk: qcom: Introduce " 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=1426685535-25071-4-git-send-email-georgi.djakov@linaro.org \
    --to=georgi.djakov@linaro.org \
    --cc=galak@codeaurora.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@linaro.org \
    --cc=sboyd@codeaurora.org \
    /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).