diff options
-rw-r--r-- | drivers/soc/rockchip/rockchip_opp_select.c | 18 | ||||
-rw-r--r-- | include/soc/rockchip/rockchip_opp_select.h | 8 |
2 files changed, 26 insertions, 0 deletions
diff --git a/drivers/soc/rockchip/rockchip_opp_select.c b/drivers/soc/rockchip/rockchip_opp_select.c index 6f7a051fdb86..4dc9aa83bb72 100644 --- a/drivers/soc/rockchip/rockchip_opp_select.c +++ b/drivers/soc/rockchip/rockchip_opp_select.c @@ -906,6 +906,20 @@ static void rockchip_high_temp_adjust(struct thermal_opp_info *info, info->is_high_temp = is_high; } +int rockchip_cpu_suspend_low_temp_adjust(struct thermal_opp_info *info) +{ + if (!info || !info->is_low_temp_enabled) + return 0; + + if (info->is_high_temp) + rockchip_high_temp_adjust(info, false); + if (!info->is_low_temp) + rockchip_low_temp_adjust(info, true); + + return 0; +} +EXPORT_SYMBOL(rockchip_cpu_suspend_low_temp_adjust); + static int rockchip_thermal_zone_notifier_call(struct notifier_block *nb, unsigned long value, void *data) { @@ -925,6 +939,8 @@ static int rockchip_thermal_zone_notifier_call(struct notifier_block *nb, } if (temperature > info->high_temp) { + if (info->is_low_temp) + rockchip_low_temp_adjust(info, false); if (!info->is_high_temp) rockchip_high_temp_adjust(info, true); } else if (temperature < (info->high_temp - info->temp_hysteresis)) { @@ -1090,6 +1106,8 @@ rockchip_register_thermal_notifier(struct device *dev, !info->low_limit && !info->high_limit) goto info_free; + if (info->low_temp_table || info->low_temp_min_volt) + info->is_low_temp_enabled = true; srcu_notifier_chain_register(&tz->thermal_notifier_list, &info->thermal_nb); thermal_zone_device_update(tz); diff --git a/include/soc/rockchip/rockchip_opp_select.h b/include/soc/rockchip/rockchip_opp_select.h index 1324feebbf39..ed4495355d94 100644 --- a/include/soc/rockchip/rockchip_opp_select.h +++ b/include/soc/rockchip/rockchip_opp_select.h @@ -44,6 +44,7 @@ struct thermal_opp_info { int high_temp_max_volt; bool is_low_temp; bool is_high_temp; + bool is_low_temp_enabled; }; #ifdef CONFIG_ROCKCHIP_OPP @@ -74,6 +75,7 @@ rockchip_register_thermal_notifier(struct device *dev, void rockchip_unregister_thermal_notifier(struct thermal_opp_info *info); int rockchip_cpu_low_temp_adjust(struct thermal_opp_info *info, bool is_low); +int rockchip_cpu_suspend_low_temp_adjust(struct thermal_opp_info *info); int rockchip_cpu_high_temp_adjust(struct thermal_opp_info *info, bool is_high); int rockchip_dev_low_temp_adjust(struct thermal_opp_info *info, @@ -156,6 +158,12 @@ static inline int rockchip_cpu_low_temp_adjust(struct thermal_opp_info *info, return -ENOTSUPP; } +static inline int +rockchip_cpu_suspend_low_temp_adjust(struct thermal_opp_info *info) +{ + return -ENOTSUPP; +} + static inline int rockchip_cpu_high_temp_adjust(struct thermal_opp_info *info, bool is_high) { |