int cpu_temp;
bool logout;
bool b_suspend;
+ struct mutex suspend_lock;
void __iomem *regs;
{
struct rockchip_thermal_data *thermal = rockchip_thermal_get_data();
long out_temp;
+ int temp;
+
+ mutex_lock(&thermal->suspend_lock);
+ if(thermal->b_suspend) {
+ temp = INVALID_TEMP;
+ mutex_unlock(&thermal->suspend_lock);
+ return temp;
+ }
if (thermal->chip->mode == TSADC_AUTO_MODE)
{
thermal->chip->get_temp(chn, thermal->regs, &out_temp);
- return (int)out_temp/1000;
+ temp = (int)out_temp/1000;
}
- else
- {
- if(thermal->b_suspend)
- return INVALID_TEMP;
- else
- return rockchip_thermal_user_mode_get_temp(thermal, chn, voltage);
+ else {
+ temp = rockchip_thermal_user_mode_get_temp(thermal, chn, voltage);
}
+ mutex_unlock(&thermal->suspend_lock);
+
+ return temp;
}
EXPORT_SYMBOL(rockchip_tsadc_get_temp);
}
}
+ mutex_init(&thermal->suspend_lock);
s_thermal = thermal;
platform_set_drvdata(pdev, thermal);
struct rockchip_thermal_data *thermal = platform_get_drvdata(pdev);
int i;
+ mutex_lock(&thermal->suspend_lock);
thermal->b_suspend = true;
if (thermal->chip->mode == TSADC_AUTO_MODE)
{
}
clk_disable(thermal->pclk);
clk_disable(thermal->clk);
+ mutex_unlock(&thermal->suspend_lock);
return 0;
}
int i;
int error;
+ mutex_lock(&thermal->suspend_lock);
error = clk_enable(thermal->clk);
- if (error)
+ if (error) {
+ mutex_unlock(&thermal->suspend_lock);
return error;
+ }
error = clk_enable(thermal->pclk);
- if (error)
+ if (error) {
+ mutex_unlock(&thermal->suspend_lock);
return error;
+ }
rockchip_thermal_reset_controller(thermal->reset);
if (thermal->chip->mode == TSADC_AUTO_MODE)
}
thermal->b_suspend = false;
+ mutex_unlock(&thermal->suspend_lock);
+
return 0;
}