mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 11:26:02 +09:00
thermal: rockchip: add shutdown callback function
Tsadc has a tshut pin which is designed to reset the pmic or soc, when the temperature inside soc is too high. we should switch off the tshut function and change the pin to gpio function in reboot process, eg, software reset. If not, the tsadc module will WRONGLY pull high the tshut pin during its reset process and then WRONGLY reset the pmic or soc, which incurred a hardware reset. The hardware reset will reset everything inside soc, even includes the power on reason flag, which is set by software before reboot process. we also change over-temperature protection mode to cru mode, since the tshut pin have be changed to gpio function. Change-Id: Iac3dacf55a4b5536fccd2eb05a6a9e6923a082c0 Signed-off-by: Rocky Hao <rocky.hao@rock-chips.com> Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
This commit is contained in:
@@ -1474,6 +1474,21 @@ static int rockchip_thermal_remove(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void rockchip_thermal_shutdown(struct platform_device *pdev)
|
||||
{
|
||||
struct rockchip_thermal_data *thermal = platform_get_drvdata(pdev);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < thermal->chip->chn_num; i++) {
|
||||
int id = thermal->sensors[i].id;
|
||||
|
||||
if (thermal->tshut_mode != TSHUT_MODE_CRU)
|
||||
thermal->chip->set_tshut_mode(id, thermal->regs,
|
||||
TSHUT_MODE_CRU);
|
||||
}
|
||||
pinctrl_pm_select_sleep_state(&pdev->dev);
|
||||
}
|
||||
|
||||
static int __maybe_unused rockchip_thermal_suspend(struct device *dev)
|
||||
{
|
||||
struct rockchip_thermal_data *thermal = dev_get_drvdata(dev);
|
||||
@@ -1548,6 +1563,7 @@ static struct platform_driver rockchip_thermal_driver = {
|
||||
},
|
||||
.probe = rockchip_thermal_probe,
|
||||
.remove = rockchip_thermal_remove,
|
||||
.shutdown = rockchip_thermal_shutdown,
|
||||
};
|
||||
|
||||
module_platform_driver(rockchip_thermal_driver);
|
||||
|
||||
Reference in New Issue
Block a user