clk: qcom: gdsc: Prepare common clk probe to register gdscs
authorRajendra Nayak <rnayak@codeaurora.org>
Thu, 6 Aug 2015 10:37:43 +0000 (16:07 +0530)
committerStephen Boyd <sboyd@codeaurora.org>
Wed, 16 Sep 2015 22:22:37 +0000 (15:22 -0700)
The common clk probe registers a clk provider and a reset controller.
Update it to register a genpd provider using the gdsc data provided
by each platform.

Signed-off-by: Rajendra Nayak <rnayak@codeaurora.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
drivers/clk/qcom/common.c
drivers/clk/qcom/common.h

index 2dedceefd21d84464f4733bdfa36fda1f3489a2b..dc51a63c9625278c2c359a142e9ec972a86011c1 100644 (file)
@@ -22,6 +22,7 @@
 #include "clk-rcg.h"
 #include "clk-regmap.h"
 #include "reset.h"
+#include "gdsc.h"
 
 struct qcom_cc {
        struct qcom_reset_controller reset;
@@ -121,8 +122,19 @@ int qcom_cc_really_probe(struct platform_device *pdev,
 
        ret = reset_controller_register(&reset->rcdev);
        if (ret)
-               of_clk_del_provider(dev->of_node);
+               goto err_reset;
 
+       if (desc->gdscs && desc->num_gdscs) {
+               ret = gdsc_register(dev, desc->gdscs, desc->num_gdscs, regmap);
+               if (ret)
+                       goto err_pd;
+       }
+
+       return 0;
+err_pd:
+       reset_controller_unregister(&reset->rcdev);
+err_reset:
+       of_clk_del_provider(dev->of_node);
        return ret;
 }
 EXPORT_SYMBOL_GPL(qcom_cc_really_probe);
@@ -141,6 +153,7 @@ EXPORT_SYMBOL_GPL(qcom_cc_probe);
 
 void qcom_cc_remove(struct platform_device *pdev)
 {
+       gdsc_unregister(&pdev->dev);
        of_clk_del_provider(pdev->dev.of_node);
        reset_controller_unregister(platform_get_drvdata(pdev));
 }
index 7a0e737130630228ef2b27ed4874b5709d0ea682..2892b71fbd713966f9de128ccf3e9ae863a3ddfa 100644 (file)
@@ -28,6 +28,8 @@ struct qcom_cc_desc {
        size_t num_clks;
        const struct qcom_reset_map *resets;
        size_t num_resets;
+       struct gdsc **gdscs;
+       size_t num_gdscs;
 };
 
 extern const struct freq_tbl *qcom_find_freq(const struct freq_tbl *f,