diff options
author | Rocky Hao <rocky.hao@rock-chips.com> | 2018-03-28 17:46:31 +0800 |
---|---|---|
committer | Tao Huang <huangtao@rock-chips.com> | 2018-03-28 18:55:38 +0800 |
commit | ac19e13a577875916064476592c82a9065b28f0e (patch) | |
tree | 6ac20b9a34c9c0800c8abf0c61d5f6238082cfcb /drivers/thermal/rockchip_thermal.c | |
parent | 77eafe1393cefdde5384da3256818453379452ef (diff) |
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>
Diffstat (limited to 'drivers/thermal/rockchip_thermal.c')
-rw-r--r-- | drivers/thermal/rockchip_thermal.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c index 951572f8b1a0..d21c92963761 100644 --- a/drivers/thermal/rockchip_thermal.c +++ b/drivers/thermal/rockchip_thermal.c @@ -1413,6 +1413,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 platform_device *pdev = to_platform_device(dev); @@ -1485,6 +1500,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); |