Skip to content

Commit 03829d6

Browse files
LeoCX-Tsaiquinchou77
authored andcommitted
Revert "fwk: lotus: adjust power limit based on the GPU power state"
This reverts commit 56524ea.
1 parent baa1d3b commit 03829d6

File tree

3 files changed

+42
-52
lines changed

3 files changed

+42
-52
lines changed

zephyr/program/framework/include/lotus/gpu.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212

1313
bool gpu_power_enable(void);
1414

15-
bool gpu_is_working(void);
16-
1715
bool gpu_module_fault(void);
1816

1917
void gpu_fan_control(int enable);

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

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -46,83 +46,83 @@ static void update_os_power_slider(int mode, bool with_dc, int active_mpower)
4646
switch (mode) {
4747
case EC_DC_BEST_PERFORMANCE:
4848
power_limit[FUNCTION_SLIDER].mwatt[TYPE_SPL] =
49-
(gpu_is_working() ? 60000 : 40000);
49+
(gpu_present() ? 60000 : 40000);
5050
power_limit[FUNCTION_SLIDER].mwatt[TYPE_SPPT] =
51-
(gpu_is_working() ? 60000 : 48000);
51+
(gpu_present() ? 60000 : 48000);
5252
power_limit[FUNCTION_SLIDER].mwatt[TYPE_FPPT] =
53-
(gpu_is_working() ? 60000 : 58000);
53+
(gpu_present() ? 60000 : 58000);
5454
power_limit[FUNCTION_SLIDER].mwatt[TYPE_APU_ONLY_SPPT] =
55-
(gpu_is_working() ? 30000 : 0);
56-
slider_stt_table = (gpu_is_working() ? 21 : 23);
55+
(gpu_present() ? 30000 : 0);
56+
slider_stt_table = (gpu_present() ? 21 : 23);
5757
CPRINTS("DC BEST PERFORMANCE");
5858
break;
5959
case EC_DC_BALANCED:
6060
power_limit[FUNCTION_SLIDER].mwatt[TYPE_SPL] =
61-
(gpu_is_working() ? 50000 : 30000);
61+
(gpu_present() ? 50000 : 30000);
6262
power_limit[FUNCTION_SLIDER].mwatt[TYPE_SPPT] =
63-
(gpu_is_working() ? 50000 : 36000);
63+
(gpu_present() ? 50000 : 36000);
6464
power_limit[FUNCTION_SLIDER].mwatt[TYPE_FPPT] =
65-
(gpu_is_working() ? 50000 : 44000);
65+
(gpu_present() ? 50000 : 44000);
6666
power_limit[FUNCTION_SLIDER].mwatt[TYPE_APU_ONLY_SPPT] =
67-
(gpu_is_working() ? 20000 : 0);
68-
slider_stt_table = (gpu_is_working() ? 22 : 24);
67+
(gpu_present() ? 20000 : 0);
68+
slider_stt_table = (gpu_present() ? 22 : 24);
6969
CPRINTS("DC BALANCED");
7070
break;
7171
case EC_DC_BEST_EFFICIENCY:
7272
power_limit[FUNCTION_SLIDER].mwatt[TYPE_SPL] =
73-
(gpu_is_working() ? 50000 : 20000);
73+
(gpu_present() ? 50000 : 20000);
7474
power_limit[FUNCTION_SLIDER].mwatt[TYPE_SPPT] =
75-
(gpu_is_working() ? 50000 : 24000);
75+
(gpu_present() ? 50000 : 24000);
7676
power_limit[FUNCTION_SLIDER].mwatt[TYPE_FPPT] =
77-
(gpu_is_working() ? 50000 : 29000);
77+
(gpu_present() ? 50000 : 29000);
7878
power_limit[FUNCTION_SLIDER].mwatt[TYPE_APU_ONLY_SPPT] =
79-
(gpu_is_working() ? 20000 : 0);
80-
slider_stt_table = (gpu_is_working() ? 22 : 25);
79+
(gpu_present() ? 20000 : 0);
80+
slider_stt_table = (gpu_present() ? 22 : 25);
8181
CPRINTS("DC BEST EFFICIENCY");
8282
break;
8383
case EC_DC_BATTERY_SAVER:
8484
power_limit[FUNCTION_SLIDER].mwatt[TYPE_SPL] = 20000;
8585
power_limit[FUNCTION_SLIDER].mwatt[TYPE_SPPT] = 20000;
8686
power_limit[FUNCTION_SLIDER].mwatt[TYPE_FPPT] = 20000;
8787
power_limit[FUNCTION_SLIDER].mwatt[TYPE_APU_ONLY_SPPT] =
88-
(gpu_is_working() ? 20000 : 0);
89-
slider_stt_table = (gpu_is_working() ? 7 : 14);
88+
(gpu_present() ? 20000 : 0);
89+
slider_stt_table = (gpu_present() ? 7 : 14);
9090
CPRINTS("DC BATTERY SAVER");
9191
break;
9292
case EC_AC_BEST_PERFORMANCE:
9393
power_limit[FUNCTION_SLIDER].mwatt[TYPE_SPL] =
94-
(gpu_is_working() ? 145000 : 45000);
94+
(gpu_present() ? 145000 : 45000);
9595
power_limit[FUNCTION_SLIDER].mwatt[TYPE_SPPT] =
96-
(gpu_is_working() ? 145000 : 54000);
96+
(gpu_present() ? 145000 : 54000);
9797
power_limit[FUNCTION_SLIDER].mwatt[TYPE_FPPT] =
98-
(gpu_is_working() ? 145000 : 65000);
98+
(gpu_present() ? 145000 : 65000);
9999
power_limit[FUNCTION_SLIDER].mwatt[TYPE_APU_ONLY_SPPT] =
100-
(gpu_is_working() ? 54000 : 0);
101-
slider_stt_table = (gpu_is_working() ? 1 : 8);
100+
(gpu_present() ? 54000 : 0);
101+
slider_stt_table = (gpu_present() ? 1 : 8);
102102
CPRINTS("AC BEST PERFORMANCE");
103103
break;
104104
case EC_AC_BALANCED:
105105
power_limit[FUNCTION_SLIDER].mwatt[TYPE_SPL] =
106-
(gpu_is_working() ? 120000 : 40000);
106+
(gpu_present() ? 120000 : 40000);
107107
power_limit[FUNCTION_SLIDER].mwatt[TYPE_SPPT] =
108-
(gpu_is_working() ? 120000 : 48000);
108+
(gpu_present() ? 120000 : 48000);
109109
power_limit[FUNCTION_SLIDER].mwatt[TYPE_FPPT] =
110-
(gpu_is_working() ? 120000 : 58000);
110+
(gpu_present() ? 120000 : 58000);
111111
power_limit[FUNCTION_SLIDER].mwatt[TYPE_APU_ONLY_SPPT] =
112-
(gpu_is_working() ? 50000 : 0);
113-
slider_stt_table = (gpu_is_working() ? 32 : 9);
112+
(gpu_present() ? 50000 : 0);
113+
slider_stt_table = (gpu_present() ? 32 : 9);
114114
CPRINTS("AC BALANCED");
115115
break;
116116
case EC_AC_BEST_EFFICIENCY:
117117
power_limit[FUNCTION_SLIDER].mwatt[TYPE_SPL] =
118-
(gpu_is_working() ? 85000 : 30000);
118+
(gpu_present() ? 85000 : 30000);
119119
power_limit[FUNCTION_SLIDER].mwatt[TYPE_SPPT] =
120-
(gpu_is_working() ? 85000 : 36000);
120+
(gpu_present() ? 85000 : 36000);
121121
power_limit[FUNCTION_SLIDER].mwatt[TYPE_FPPT] =
122-
(gpu_is_working() ? 85000 : 44000);
122+
(gpu_present() ? 85000 : 44000);
123123
power_limit[FUNCTION_SLIDER].mwatt[TYPE_APU_ONLY_SPPT] =
124-
(gpu_is_working() ? 40000 : 0);
125-
slider_stt_table = (gpu_is_working() ? 3 : 10);
124+
(gpu_present() ? 40000 : 0);
125+
slider_stt_table = (gpu_present() ? 3 : 10);
126126
CPRINTS("AC BEST EFFICIENCY");
127127
break;
128128
default:
@@ -135,7 +135,7 @@ static void update_os_power_slider(int mode, bool with_dc, int active_mpower)
135135
static void update_thermal_power_limit(int battery_percent, int active_mpower,
136136
bool with_dc, int mode)
137137
{
138-
if (gpu_is_working()) {
138+
if (gpu_present()) {
139139
if ((active_mpower >= 240000) && with_dc) {
140140
/* limited by update_os_power_slider */
141141
power_limit[FUNCTION_THERMAL_PMF].mwatt[TYPE_SPL] =
@@ -363,7 +363,7 @@ static void update_adapter_power_limit(int battery_percent, int active_mpower,
363363
{
364364
static int new_index;
365365

366-
if (gpu_is_working()) {
366+
if (gpu_present()) {
367367
if (with_dc) {
368368
if (active_mpower >= 240000) {
369369
new_index =
@@ -773,7 +773,7 @@ static void tune_PLs(int delta)
773773
= MAX(power_limit[FUNCTION_SAFETY].mwatt[TYPE_FPPT] + delta, 20000);
774774
power_limit[FUNCTION_SAFETY].mwatt[TYPE_P3T]
775775
= MAX(power_limit[FUNCTION_SAFETY].mwatt[TYPE_P3T] + delta, 20000);
776-
if (gpu_is_working())
776+
if (gpu_present())
777777
power_limit[FUNCTION_SAFETY].mwatt[TYPE_APU_ONLY_SPPT]
778778
= MAX(power_limit[FUNCTION_SAFETY].mwatt[TYPE_APU_ONLY_SPPT]
779779
+ delta, 20000);
@@ -818,7 +818,7 @@ static void update_safety_power_limit(int active_mpower)
818818
= power_limit[FUNCTION_SLIDER].mwatt[TYPE_FPPT];
819819
power_limit[FUNCTION_SAFETY].mwatt[TYPE_P3T]
820820
= power_limit[FUNCTION_POWER].mwatt[TYPE_P3T];
821-
if (gpu_is_working())
821+
if (gpu_present())
822822
power_limit[FUNCTION_SAFETY].mwatt[TYPE_APU_ONLY_SPPT]
823823
= power_limit[FUNCTION_SLIDER].mwatt[TYPE_APU_ONLY_SPPT];
824824
else
@@ -840,7 +840,7 @@ static void update_safety_power_limit(int active_mpower)
840840
break;
841841
case LEVEL_TUNE_PLS:
842842
/* tuning CPU and GPU PLs */
843-
if (gpu_is_working()) {
843+
if (gpu_present()) {
844844
delta = 10000;
845845
if (level_increase) {
846846
tune_PLs((-1) * delta);
@@ -886,7 +886,7 @@ static void update_safety_power_limit(int active_mpower)
886886
break;
887887
case LEVEL_DISABLE_GPU:
888888
/* disable GPU and tune CPU PLs */
889-
if (gpu_is_working()) {
889+
if (gpu_present()) {
890890
if (level_increase) {
891891
tune_PLs(-10000);
892892
if (power_limit[FUNCTION_SAFETY].mwatt[TYPE_SPL] <= 20000)
@@ -910,12 +910,12 @@ static void update_safety_power_limit(int active_mpower)
910910
/* prochot */
911911
if (level_increase) {
912912
throttle_ap(THROTTLE_ON, THROTTLE_HARD, THROTTLE_SRC_BAT_DISCHG_CURRENT);
913-
thermal_stt_table = (gpu_is_working() ? 7 : 14);
913+
thermal_stt_table = (gpu_present() ? 7 : 14);
914914
safety_stt = 1;
915915
safety_level++;
916916
} else {
917917
throttle_ap(THROTTLE_OFF, THROTTLE_HARD, THROTTLE_SRC_BAT_DISCHG_CURRENT);
918-
thermal_stt_table = (gpu_is_working() ? 7 : 14);
918+
thermal_stt_table = (gpu_present() ? 7 : 14);
919919
safety_stt = 1;
920920
safety_level--;
921921
}
@@ -941,7 +941,7 @@ static void update_safety_power_limit(int active_mpower)
941941
}
942942
break;
943943
case LEVEL_COUNT:
944-
thermal_stt_table = (gpu_is_working() ? 7 : 14);
944+
thermal_stt_table = (gpu_present() ? 7 : 14);
945945
if (!level_increase)
946946
safety_level--;
947947
break;
@@ -1096,7 +1096,7 @@ void update_soc_power_limit(bool force_update, bool force_no_adapter)
10961096
}
10971097

10981098
/* when trigger thermal warm, reduce TYPE_APU_ONLY_SPPT to 45W */
1099-
if (gpu_is_working()) {
1099+
if (gpu_present()) {
11001100
if (thermal_warn_trigger())
11011101
power_limit[FUNCTION_THERMAL].mwatt[TYPE_APU_ONLY_SPPT] = 45000;
11021102
else

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,6 @@ bool gpu_power_enable(void)
4646
return gpio_pin_get_dt(GPIO_DT_FROM_NODELABEL(gpio_dgpu_pwr_en));
4747
}
4848

49-
bool gpu_is_working(void)
50-
{
51-
if (gpu_present() && gpu_power_enable())
52-
return true;
53-
54-
return false;
55-
}
56-
5749
bool gpu_module_fault(void)
5850
{
5951
return module_fault;

0 commit comments

Comments
 (0)