Skip to content

Commit 029ab87

Browse files
Josh-TsaiTerrails
authored andcommitted
fwk: lotus: update the correct PMF setting with the 240W adapter
The sppt/fppt/p3t value with the 240W adapter should be set to 120W, but we got the 95W. Modify the power slider table and thermal pmf table to match the 240W condition. BRANCH=lotus-zephyr BUG=https://app.clickup.com/t/85ztwdq4x TEST=connect the 240W adapter, the PMF setting matches the table TEST=connect the 180W adapter, the PMF setting matches the table Signed-off-by: Josh-Tsai <[email protected]>
1 parent 706a86c commit 029ab87

File tree

1 file changed

+29
-12
lines changed

1 file changed

+29
-12
lines changed

zephyr/program/framework/lotus/src/cpu_power.c

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,14 @@ static void update_os_power_slider(int mode, bool with_dc, int active_mpower)
103103
break;
104104
case EC_AC_BALANCED:
105105
power_limit[FUNCTION_SLIDER].mwatt[TYPE_SPL] =
106-
(gpu_present() ? 95000 : 40000);
106+
(gpu_present() ? 120000 : 40000);
107107
power_limit[FUNCTION_SLIDER].mwatt[TYPE_SPPT] =
108-
(gpu_present() ? 95000 : 48000);
108+
(gpu_present() ? 120000 : 48000);
109109
power_limit[FUNCTION_SLIDER].mwatt[TYPE_FPPT] =
110-
(gpu_present() ? 95000 : 58000);
110+
(gpu_present() ? 120000 : 58000);
111111
power_limit[FUNCTION_SLIDER].mwatt[TYPE_APU_ONLY_SPPT] =
112112
(gpu_present() ? 50000 : 0);
113-
slider_stt_table = (gpu_present() ? 2 : 9);
113+
slider_stt_table = (gpu_present() ? 32 : 9);
114114
CPRINTS("AC BALANCED");
115115
break;
116116
case EC_AC_BEST_EFFICIENCY:
@@ -136,13 +136,7 @@ static void update_thermal_power_limit(int battery_percent, int active_mpower,
136136
bool with_dc, int mode)
137137
{
138138
if (gpu_present()) {
139-
if ((active_mpower >= 240000) && with_dc && (mode == EC_AC_BALANCED)) {
140-
power_limit[FUNCTION_THERMAL_PMF].mwatt[TYPE_SPL] = 120000;
141-
power_limit[FUNCTION_THERMAL_PMF].mwatt[TYPE_SPPT] = 120000;
142-
power_limit[FUNCTION_THERMAL_PMF].mwatt[TYPE_FPPT] = 120000;
143-
power_limit[FUNCTION_THERMAL_PMF].mwatt[TYPE_APU_ONLY_SPPT] = 50000;
144-
thermal_stt_table = 32;
145-
} else if ((active_mpower >= 180000) && with_dc) {
139+
if ((active_mpower >= 240000) && with_dc) {
146140
/* limited by update_os_power_slider */
147141
power_limit[FUNCTION_THERMAL_PMF].mwatt[TYPE_SPL] =
148142
power_limit[FUNCTION_SLIDER].mwatt[TYPE_SPL];
@@ -153,6 +147,27 @@ static void update_thermal_power_limit(int battery_percent, int active_mpower,
153147
power_limit[FUNCTION_THERMAL_PMF].mwatt[TYPE_APU_ONLY_SPPT] =
154148
power_limit[FUNCTION_SLIDER].mwatt[TYPE_APU_ONLY_SPPT];
155149
thermal_stt_table = slider_stt_table;
150+
} else if (active_mpower >= 180000) {
151+
if (mode == EC_AC_BALANCED) {
152+
/* limited by update_os_power_slider */
153+
power_limit[FUNCTION_THERMAL_PMF].mwatt[TYPE_SPL] = 950000;
154+
power_limit[FUNCTION_THERMAL_PMF].mwatt[TYPE_SPPT] = 950000;
155+
power_limit[FUNCTION_THERMAL_PMF].mwatt[TYPE_FPPT] = 950000;
156+
power_limit[FUNCTION_THERMAL_PMF].mwatt[TYPE_APU_ONLY_SPPT]
157+
= 50000;
158+
thermal_stt_table = 2;
159+
} else {
160+
/* limited by update_os_power_slider */
161+
power_limit[FUNCTION_THERMAL_PMF].mwatt[TYPE_SPL] =
162+
power_limit[FUNCTION_SLIDER].mwatt[TYPE_SPL];
163+
power_limit[FUNCTION_THERMAL_PMF].mwatt[TYPE_SPPT] =
164+
power_limit[FUNCTION_SLIDER].mwatt[TYPE_SPPT];
165+
power_limit[FUNCTION_THERMAL_PMF].mwatt[TYPE_FPPT] =
166+
power_limit[FUNCTION_SLIDER].mwatt[TYPE_FPPT];
167+
power_limit[FUNCTION_THERMAL_PMF].mwatt[TYPE_APU_ONLY_SPPT] =
168+
power_limit[FUNCTION_SLIDER].mwatt[TYPE_APU_ONLY_SPPT];
169+
thermal_stt_table = slider_stt_table;
170+
}
156171
} else if (active_mpower >= 140000) {
157172
if (with_dc) {
158173
if (mode == EC_AC_BEST_PERFORMANCE) {
@@ -1074,13 +1089,15 @@ void update_soc_power_limit(bool force_update, bool force_no_adapter)
10741089
power_limit[FUNCTION_THERMAL].mwatt[TYPE_APU_ONLY_SPPT] = 0;
10751090
}
10761091

1077-
/* choose the lowest one */
10781092
for (int item = TYPE_SPL; item < TYPE_COUNT; item++) {
10791093
/* use slider as default */
10801094
target_func[item] = FUNCTION_SLIDER;
10811095
for (int func = FUNCTION_DEFAULT; func < FUNCTION_COUNT; func++) {
1096+
/* Ignored the zero value */
10821097
if (power_limit[func].mwatt[item] < 1)
10831098
continue;
1099+
1100+
/* choose the lowest one */
10841101
if (power_limit[target_func[item]].mwatt[item]
10851102
> power_limit[func].mwatt[item])
10861103
target_func[item] = func;

0 commit comments

Comments
 (0)