video: tegra: dsi: Fix dsi clk ref count balancing
Vineel Kumar Reddy Kovvuri [Wed, 28 Aug 2013 10:24:19 +0000 (15:24 +0530)]
Balance enable and disable clk ref counts

Change-Id: I582e2a16d4c9a8000b810fde0ab68aa64b71d1de
Signed-off-by: Vineel Kumar Reddy Kovvuri <vineelkumarr@nvidia.com>
Reviewed-on: http://git-master/r/267252
Reviewed-by: Animesh Kishore <ankishore@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>

drivers/video/tegra/dc/dsi.c

index 6db2011..b124808 100644 (file)
@@ -488,18 +488,22 @@ static inline void tegra_dc_dsi_debug_create(struct tegra_dc_dsi_data *dsi)
 static inline void tegra_dsi_clk_enable(struct tegra_dc_dsi_data *dsi)
 {
        int i = 0;
-       for (i = 0; i < dsi->max_instances; i++) {
-               clk_prepare_enable(dsi->dsi_clk[i]);
-               udelay(800);
+       if (!tegra_is_clk_enabled(dsi->dsi_clk[0])) {
+               for (i = 0; i < dsi->max_instances; i++) {
+                       clk_prepare_enable(dsi->dsi_clk[i]);
+                       udelay(800);
+               }
        }
 }
 
 static inline void tegra_dsi_clk_disable(struct tegra_dc_dsi_data *dsi)
 {
        int i = 0;
-       for (i = 0; i < dsi->max_instances; i++) {
-               clk_disable_unprepare(dsi->dsi_clk[i]);
-               udelay(800);
+       if (tegra_is_clk_enabled(dsi->dsi_clk[0])) {
+               for (i = 0; i < dsi->max_instances; i++) {
+                       clk_disable_unprepare(dsi->dsi_clk[i]);
+                       udelay(800);
+               }
        }
 }