Skip to content

Commit 8c94b0a

Browse files
Josh-TsaiJohnAZoidberg
authored andcommitted
fwk: store the ac_boot status in the EC ROM
In the standalone mode, bbram will be cleared if the user removes the adapter, so the system can not pwoer on via ac attach. This change stores the ac_boot status in the EC ROM, even if the mainboard no power , EC still can get the correct status BRANCH=fwk-main BUG=https://app.clickup.com/t/86eqmw497 TEST=Enable stanalone operation and power on AC attach, the system can power on via AC attached without battery TEST=Disable stanalone operation and power on AC attach, the system can power on via AC attached without battery TEST=Disable stanalone operation and power on AC attach, the system can power on via AC attached with battery Signed-off-by: Josh Tsai <[email protected]> (cherry picked from commit ba94517fd560adfdf02ae6b4bd9ef80e34c1be67)
1 parent 0f72063 commit 8c94b0a

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

zephyr/program/framework/marigold/src/power_button_x86.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,16 @@ static void set_initial_pwrbtn_state(void)
231231
CPRINTS("PB init power on");
232232
} else if (ac_boot_status() &&
233233
(gpio_pin_get_dt(GPIO_DT_FROM_NODELABEL(gpio_hw_acav_in)) == 1)) {
234+
235+
/**
236+
* Only the developer will trigger the reset pin or soft flags.
237+
* We don't want the system to power automatically if we reset
238+
* the EC during development.
239+
*/
240+
if (!!(reset_flags & EC_RESET_FLAG_SOFT) ||
241+
!!(reset_flags & EC_RESET_FLAG_RESET_PIN))
242+
return;
243+
234244
/* BIOS setup AC attach power on */
235245
pwrbtn_state = PWRBTN_STATE_INIT_ON;
236246
CPRINTS("PB init AC attach on");

zephyr/program/framework/src/board_function.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ int ac_boot_status(void)
7474

7575
void bios_function_detect(void)
7676
{
77-
system_set_bbram(SYSTEM_BBRAM_IDX_BIOS_FUNCTION, ac_boot_status());
77+
flash_storage_update(FLASH_FLAGS_ACPOWERON, ac_boot_status());
7878

7979
flash_storage_update(FLASH_FLAGS_STANDALONE, get_standalone_mode() ? 1 : 0);
8080
#ifdef CONFIG_BOARD_LOTUS
@@ -234,9 +234,9 @@ void chassis_interrupt_handler(enum gpio_signal signal)
234234

235235
static void bios_function_init(void)
236236
{
237-
if (!ac_boot_status())
238-
*host_get_memmap(EC_CUSTOMIZED_MEMMAP_BIOS_SETUP_FUNC) =
239-
bios_function_status(TYPE_BBRAM, SYSTEM_BBRAM_IDX_BIOS_FUNCTION, 0);
237+
/* restore the bios setup menu setting */
238+
*host_get_memmap(EC_CUSTOMIZED_MEMMAP_BIOS_SETUP_FUNC) =
239+
flash_storage_get(FLASH_FLAGS_ACPOWERON);
240240

241241
if (flash_storage_get(FLASH_FLAGS_STANDALONE))
242242
set_standalone_mode(1);

0 commit comments

Comments
 (0)