Skip to content

Commit 90907b5

Browse files
LeilaCY-LinJohnAZoidberg
authored andcommitted
fwk: 16-inch: set power slide mode default as balance mode
Workaround: system driver will not update memory map EC_MEMMAP_POWER_SLIDE after hibernate.But after EC hibernate the memory map will be clean to 0. EC will not know which power slider mode is. So set the initial thermal table to balance mode as default. BRANCH=fwk-tulip-29169 BUG=https://app.clickup.com/t/86euftxk9 TEST=Turn system to hibernate in DC mode and wait for 2 minutes. TEST=Press power button to power on and wait system ready. TEST=cmd cpupower to check the PMF table in balance mode. Signed-off-by: LeilaCY-Lin <LeilaCY_Lin@compal.com>
1 parent 88727e6 commit 90907b5

2 files changed

Lines changed: 23 additions & 13 deletions

File tree

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

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
2929
#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
3030

31-
static int battery_current_limit_mA;
31+
static int battery_current_limit_mA = -5490;
3232
static int thermal_stt_table;
3333
static int safety_stt;
3434
static uint8_t events;
@@ -489,8 +489,8 @@ void update_soc_power_limit(bool force_update, bool force_no_adapter)
489489

490490
if (func_ctl & 0x1) {
491491
mode = best_performance_power_plan(battery_percent, active_mpower, with_dc, mode);
492-
update_thermal_power_limit(battery_percent, active_mpower, with_dc, mode,
493-
gpu_vendor);
492+
update_thermal_power_limit(battery_percent, active_mpower, with_dc,
493+
mode, gpu_vendor);
494494
}
495495

496496
if (func_ctl & 0x4) {
@@ -501,7 +501,25 @@ void update_soc_power_limit(bool force_update, bool force_no_adapter)
501501
d_notify = update_d_notify(active_mpower, gpu_vendor, old_safety_level);
502502
}
503503

504-
if (((mode != 0) && (old_stt_table != thermal_stt_table) && (thermal_stt_table != 0))
504+
/*
505+
* AMD confirmed PMF driver architecture underwent significant changes from
506+
* Strix platform, The PHX PMF driver calls PMF8 during D0 Entry, but the PMF
507+
* drivers after STX do not. This might be the difference between the two.
508+
* This is by design, and there are currently no plans for change. We add a
509+
* workaround to ensure the EC updates the PMF and STT tables (default set
510+
* the balance mode).
511+
*/
512+
if (mode == 0) {
513+
if (active_mpower > 0) {
514+
update_thermal_power_limit(battery_percent, active_mpower, with_dc,
515+
EC_AC_BALANCED, gpu_vendor);
516+
} else {
517+
update_thermal_power_limit(battery_percent, active_mpower, with_dc,
518+
EC_DC_BALANCED, gpu_vendor);
519+
}
520+
}
521+
522+
if (((old_stt_table != thermal_stt_table) && (thermal_stt_table != 0))
505523
|| (old_d_notify != d_notify)) {
506524
*host_get_memmap(EC_MEMMAP_STT_TABLE_NUMBER) = thermal_stt_table;
507525
old_stt_table = thermal_stt_table;
@@ -575,15 +593,6 @@ void update_soc_power_limit(bool force_update, bool force_no_adapter)
575593
}
576594
}
577595

578-
static void initial_soc_power_limit(void)
579-
{
580-
battery_current_limit_mA = -5490;
581-
582-
/* initial thermal table to battery balance as default */
583-
update_thermal_value(UMA_PMF_TABLE, 0, 1, EC_DC_BALANCED);
584-
}
585-
DECLARE_HOOK(HOOK_INIT, initial_soc_power_limit, HOOK_PRIO_INIT_I2C);
586-
587596
bool safety_force_typec_1_5A(void)
588597
{
589598
return force_typec_1_5a_flag;

zephyr/program/framework/src/board_host_command.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ static void sci_enable(void)
7272
gpu_typec_detect();
7373

7474
set_nv_gpu_throttle(THROTTLE_OFF, 60);
75+
host_set_single_event(EC_HOST_EVENT_STT_UPDATE);
7576
#endif
7677
} else
7778
hook_call_deferred(&sci_enable_data, 250 * MSEC);

0 commit comments

Comments
 (0)