@@ -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
@@ -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)
{
@@ -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);
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(+) -- 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/