arm: tegra: fan: clear next fan state before suspend
authorJean Huang <jeanh@nvidia.com>
Tue, 23 Apr 2013 19:28:59 +0000 (12:28 -0700)
committerSimone Willett <swillett@nvidia.com>
Fri, 26 Apr 2013 00:47:07 +0000 (17:47 -0700)
Original design was to restore fan to the state before suspend,
but fan-thermal detection should work itself to decide fan state after resume.

Bug 1273984

Change-Id: Ieac7688ed2ccf3dca3427c61e3d51a209cda79a3
Signed-off-by: Jean Huang <jeanh@nvidia.com>
Reviewed-on: http://git-master/r/222157
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Anshul Jain (SW) <anshulj@nvidia.com>
drivers/misc/therm_fan_est.c
drivers/thermal/pwm_fan.c

index 15d6352a915e7aa9605bf80ab061de7cd3f7c717..b64af6ceefe72b8bea5a7952f2b17f0e4b1efe88 100644 (file)
@@ -95,9 +95,9 @@ static void therm_fan_est_work_func(struct work_struct *work)
        }
 
        if (est->current_trip_index != (trip_index - 1)) {
-               est->current_trip_index = trip_index - 1;
-               if (!((trip_index - 1) % 2))
+               if (!((trip_index - 1) % 2) || (!est->current_trip_index))
                        thermal_zone_device_update(est->thz);
+               est->current_trip_index = trip_index - 1;
        }
 
        est->ntemp++;
@@ -406,6 +406,7 @@ static int therm_fan_est_suspend(struct platform_device *pdev,
        if (!est)
                return -EINVAL;
 
+       est->current_trip_index = 0;
        cancel_delayed_work(&est->therm_fan_est_work);
 
        return 0;
index df736557b62761f859e61a18ccf2e3a69606560c..ef1e69906985388b67432b1fab696ac497cbfafd 100644 (file)
@@ -777,6 +777,7 @@ static int pwm_fan_suspend(struct platform_device *pdev, pm_message_t state)
        cancel_delayed_work(&fan_data->fan_ramp_work);
        /*Turn the fan off*/
        fan_data->fan_cur_pwm = 0;
+       fan_data->next_target_pwm = 0;
        set_pwm_duty_cycle(0, fan_data);
 
        /*Stop thermal control*/
@@ -795,10 +796,7 @@ static int pwm_fan_resume(struct platform_device *pdev)
 
        /*Start thermal control*/
        fan_data->fan_temp_control_flag = 1;
-       if (fan_data->next_target_pwm != fan_data->fan_cur_pwm)
-               queue_delayed_work(fan_data->workqueue,
-                                       &fan_data->fan_ramp_work,
-                                       msecs_to_jiffies(fan_data->step_time));
+
        mutex_unlock(&fan_data->fan_state_lock);
        return 0;
 }