video: tegra: dc: Fix the EMC bandwidth clear.
Kevin Huang [Fri, 9 Mar 2012 10:05:56 +0000 (02:05 -0800)]
Bug 951626

Change-Id: Ia7c7474aa0f066cba8bd1519a98e302c4b3992e0
Signed-off-by: Kevin Huang <kevinh@nvidia.com>
Reviewed-on: http://git-master/r/89076
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Varun Colbert <vcolbert@nvidia.com>
Tested-by: Varun Colbert <vcolbert@nvidia.com>

drivers/video/tegra/dc/dc.c

index 1a4a6cd..080438b 100644 (file)
@@ -980,7 +980,7 @@ unsigned long tegra_dc_get_bandwidth(struct tegra_dc_win *windows[], int n)
 /* to save power, call when display memory clients would be idle */
 static void tegra_dc_clear_bandwidth(struct tegra_dc *dc)
 {
-       if (dc->emc_clk_rate)
+       if (tegra_is_clk_enabled(dc->emc_clk))
                clk_disable(dc->emc_clk);
        dc->emc_clk_rate = 0;
 }
@@ -990,7 +990,8 @@ static void tegra_dc_program_bandwidth(struct tegra_dc *dc)
        unsigned i;
 
        if (dc->emc_clk_rate != dc->new_emc_clk_rate) {
-               if (!dc->emc_clk_rate) /* going from 0 to non-zero */
+               /* going from 0 to non-zero */
+               if (!dc->emc_clk_rate && !tegra_is_clk_enabled(dc->emc_clk))
                        clk_enable(dc->emc_clk);
                dc->emc_clk_rate = dc->new_emc_clk_rate;
                clk_set_rate(dc->emc_clk, dc->emc_clk_rate);