ARM: tegra: clock: Set EMC and SCLK rates suspend floors
Alex Frid [Fri, 9 Mar 2012 23:07:00 +0000 (15:07 -0800)]
- On suspend entry set EMC rate floor high enough to select PLLM as
  EMC clock source, since PLLM is always turned off in suspend.
- On suspend entry set SCLK (AVP) rate floor to speed-up system bus
  during save/restore procedures.

Bug 939942
Bug 938649

Reviewed-on: http://git-master/r/89234
(cherry picked from commit ccfdaef143f9017d682af017e11a25c3e5bcf3a7)

Change-Id: I4e1d66521f1f3453502c471999a52637c3d489aa
Signed-off-by: Alex Frid <afrid@nvidia.com>
Signed-off-by: Tom Cherry <tcherry@nvidia.com>
Reviewed-on: http://git-master/r/94124
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

arch/arm/mach-tegra/tegra3_actmon.c

index 43130f9..5df6ed1 100644 (file)
@@ -85,6 +85,10 @@ static u8 actmon_sampling_period;
 
 static unsigned long actmon_clk_freq;
 
+/* Maximum frequency EMC is running at when sourced from PLLP. This is
+ * really a short-cut, but it is true for all Tegra3  platforms
+ */
+#define EMC_PLLP_FREQ_MAX                      204000
 
 /* Units:
  * - frequency in kHz
@@ -102,6 +106,7 @@ struct actmon_dev {
        unsigned long   max_freq;
        unsigned long   target_freq;
        unsigned long   cur_freq;
+       unsigned long   suspend_freq;
 
        unsigned long   avg_actv_freq;
        unsigned long   avg_band_freq;
@@ -404,6 +409,9 @@ static void actmon_dev_suspend(struct actmon_dev *dev)
                actmon_wmb();
        }
        spin_unlock_irqrestore(&dev->lock, flags);
+
+       if (dev->suspend_freq)
+               clk_set_rate(dev->clk, dev->suspend_freq * 1000);
 }
 
 static void actmon_dev_resume(struct actmon_dev *dev)
@@ -486,6 +494,9 @@ static struct actmon_dev actmon_dev_emc = {
        .dev_id = "tegra_actmon",
        .con_id = "emc",
 
+       /* EMC suspend floor to guarantee suspend entry on PLLM */
+       .suspend_freq           = EMC_PLLP_FREQ_MAX + 2000,
+
        .boost_freq_step        = 16000,
        .boost_up_coef          = 200,
        .boost_down_coef        = 50,
@@ -515,6 +526,9 @@ static struct actmon_dev actmon_dev_avp = {
        .dev_id = "tegra_actmon",
        .con_id = "avp",
 
+       /* AVP/SCLK suspend activity floor */
+       .suspend_freq           = 40000,
+
        .boost_freq_step        = 8000,
        .boost_up_coef          = 200,
        .boost_down_coef        = 50,