soc: rockchip_system_monitor: Add support to change mem volt when low temp

Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Change-Id: I7ce9959bb56617c2fc1111d047af5ec7e88ce60e
This commit is contained in:
Finley Xiao
2022-03-07 10:14:06 +08:00
committed by Tao Huang
parent ebe79f43ab
commit eb910e20ee
2 changed files with 20 additions and 0 deletions

View File

@@ -523,6 +523,8 @@ static int rockchip_init_temp_opp_table(struct monitor_dev_info *info)
info->opp_table[i].rate = opp->rate;
info->opp_table[i].volt = opp->supplies[0].u_volt;
info->opp_table[i].max_volt = opp->supplies[0].u_volt_max;
if (opp_table->regulator_count > 1)
info->opp_table[i].mem_volt = opp->supplies[1].u_volt;
if (opp->supplies[0].u_volt <= info->high_temp_max_volt) {
if (!reach_high_temp_max_volt)
@@ -814,11 +816,27 @@ static int rockchip_adjust_low_temp_opp_volt(struct monitor_dev_info *info,
opp->supplies[0].u_volt =
info->opp_table[i].low_temp_volt;
opp->supplies[0].u_volt_min = opp->supplies[0].u_volt;
if (opp_table->regulator_count > 1) {
opp->supplies[1].u_volt_max =
opp->supplies[0].u_volt_max;
opp->supplies[1].u_volt =
opp->supplies[0].u_volt;
opp->supplies[1].u_volt_min =
opp->supplies[0].u_volt_min;
}
} else {
opp->supplies[0].u_volt_min = info->opp_table[i].volt;
opp->supplies[0].u_volt = opp->supplies[0].u_volt_min;
opp->supplies[0].u_volt_max =
info->opp_table[i].max_volt;
if (opp_table->regulator_count > 1) {
opp->supplies[1].u_volt_min =
info->opp_table[i].mem_volt;
opp->supplies[1].u_volt =
opp->supplies[1].u_volt_min;
opp->supplies[1].u_volt_max =
info->opp_table[i].max_volt;
}
}
i++;
}

View File

@@ -26,12 +26,14 @@ struct temp_freq_table {
* struct temp_opp_table - System monitor device OPP description structure
* @rate: Frequency in hertz
* @volt: Target voltage in microvolt
* @mem_volt: Target voltage for memory in microvolt
* @low_temp_volt: Target voltage when low temperature, in microvolt
* @max_volt: Maximum voltage in microvolt
*/
struct temp_opp_table {
unsigned long rate;
unsigned long volt;
unsigned long mem_volt;
unsigned long low_temp_volt;
unsigned long max_volt;
};