power: bpcm: Re-try setting BPC limit
Alex Frid [Sun, 11 Mar 2012 08:02:33 +0000 (00:02 -0800)]
Check returned value from BPC set limit api, and re-try again
on error. Keep CPU throttled while re-trying.

Signed-off-by: Alex Frid <afrid@nvidia.com>
(cherry picked from commit 8d5e5a36a03587e3e9374ad8cec6958bd3617f0c)

Change-Id: I29b24a92b87cbd41d68473d0c9ef4c8d6add992f
Reviewed-on: http://git-master/r/93732
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Aleksandr Frid <afrid@nvidia.com>
Tested-by: Aleksandr Frid <afrid@nvidia.com>
Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>

arch/arm/mach-tegra/cpu-tegra.c
drivers/power/tegra_bpc_mgmt.c

index f25b63e..bb22150 100644 (file)
@@ -261,13 +261,15 @@ int tegra_system_edp_alarm(bool alarm)
        system_edp_alarm = alarm;
 
        /* Update cpu rate if cpufreq (at least on cpu0) is already started
-          and cancel emergency throttling after edp limit is applied */
+          and cancel emergency throttling after either edp limit is applied
+          or alarm is canceled */
        if (target_cpu_speed[0]) {
                edp_update_limit();
                ret = tegra_cpu_set_speed_cap(NULL);
-               if (!ret && alarm)
-                       tegra_edp_throttle_cpu_now(0);
        }
+       if (!ret || !alarm)
+               tegra_edp_throttle_cpu_now(0);
+
        mutex_unlock(&tegra_cpu_lock);
 
        return ret;
index 0d9ddee..fba0cfe 100644 (file)
 
 static irqreturn_t tegra_bpc_mgmt_bh(int irq, void *data)
 {
+       int ret = -1;
        int gpio_val = 0;
        struct tegra_bpc_mgmt_platform_data *bpc_platform_data;
        bpc_platform_data = (struct tegra_bpc_mgmt_platform_data *)data;
 
-       tegra_system_edp_alarm(true);
        /**
         * Keep on checking whether event has passed or not.
         */
        while (!gpio_val) {
+               if (ret)
+                       ret = tegra_system_edp_alarm(true);
+
                set_current_state(TASK_INTERRUPTIBLE);
                schedule_timeout(msecs_to_jiffies(
                        bpc_platform_data->bpc_mgmt_timeout));