hwmon: tsensor: fix system hang in 0C.
Linqiang Pu [Wed, 13 Jun 2012 02:09:10 +0000 (10:09 +0800)]
Changed the low temp to 0C since 20C is very easy to trigger thermal
alert under -15C to 15C environment temperature. And the thermal alert
will run into endless alert from tsensor_work_func.

Also revised suspend and resume routine to cancel the work when suspending
and disable/enable irq.

Bug 999175

Signed-off-by: Linqiang Pu <dpu@nvidia.com>
(cherry picked from commit 6a909bfa690991438be298d4933946a92e4929c4)

Change-Id: Icafc6d5f0164204cc0cb7bea64bef2fadadbfbfd
Reviewed-on: http://git-master/r/111550
Reviewed-by: Rohan Somvanshi <rsomvanshi@nvidia.com>
Tested-by: Rohan Somvanshi <rsomvanshi@nvidia.com>

drivers/hwmon/tegra-tsensor.c

index 44caa23..7a8d26b 100644 (file)
@@ -655,7 +655,7 @@ int tsensor_thermal_get_temp_low(struct tegra_tsensor_data *data,
                                        long *milli_temp)
 {
        /* temp to counter below 20C seems to be inaccurate */
-       *milli_temp = 20000;
+       *milli_temp = 0;
        return 0;
 }
 
@@ -2016,6 +2016,8 @@ static int tsensor_suspend(struct platform_device *pdev,
        struct tegra_tsensor_data *data = platform_get_drvdata(pdev);
        unsigned int config0;
 
+       disable_irq(data->irq);
+       cancel_delayed_work_sync(&data->work);
        /* set STOP bit, else OVERFLOW interrupt seen in LP1 */
        config0 = tsensor_readl(data, ((data->instance << 16) | SENSOR_CFG0));
        config0 |= (1 << SENSOR_CFG0_STOP_SHIFT);
@@ -2046,6 +2048,7 @@ static int tsensor_resume(struct platform_device *pdev)
        if (data->is_edp_supported)
                schedule_delayed_work(&data->work, 0);
 
+       enable_irq(data->irq);
        return 0;
 }
 #endif