mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-08 16:41:55 +00:00
poppy: host command for configuring power button
Specifically, we are using a bit to disable the
SMI pulse on x86 systems so that we can use the
power button for menu selection.
BUG=chrome-os-partner:61275
BRANCH=None
TEST=Try running with depthcharge sending the host command
during detachable FW menus and making sure power
button select doesn't turn off device on reef.
Change-Id: I4a68cf514d514a4abe98beb99e7934d6fb0f44bd
Signed-off-by: Shelley Chen <shchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/427413
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
This commit is contained in:
@@ -112,6 +112,11 @@ static const char * const state_names[] = {
|
||||
*/
|
||||
static uint64_t tnext_state;
|
||||
|
||||
/*
|
||||
* Determines whether to execute initial SMI pulse (t0 stage)
|
||||
*/
|
||||
static int smi_enabled = 1;
|
||||
|
||||
static void set_pwrbtn_to_pch(int high, int init)
|
||||
{
|
||||
/*
|
||||
@@ -265,12 +270,18 @@ static void state_machine(uint64_t tnow)
|
||||
chipset_exit_hard_off();
|
||||
tnext_state = tnow + PWRBTN_INITIAL_US;
|
||||
pwrbtn_state = PWRBTN_STATE_WAS_OFF;
|
||||
set_pwrbtn_to_pch(0, 0);
|
||||
} else {
|
||||
/* Chipset is on, so send the chipset a pulse */
|
||||
tnext_state = tnow + PWRBTN_DELAY_T0;
|
||||
pwrbtn_state = PWRBTN_STATE_T0;
|
||||
if (smi_enabled) {
|
||||
/* Chipset is on, so send the chipset a pulse */
|
||||
tnext_state = tnow + PWRBTN_DELAY_T0;
|
||||
pwrbtn_state = PWRBTN_STATE_T0;
|
||||
set_pwrbtn_to_pch(0, 0);
|
||||
} else {
|
||||
tnext_state = tnow + PWRBTN_DELAY_T1;
|
||||
pwrbtn_state = PWRBTN_STATE_T1;
|
||||
}
|
||||
}
|
||||
set_pwrbtn_to_pch(0, 0);
|
||||
break;
|
||||
case PWRBTN_STATE_T0:
|
||||
tnext_state = tnow + PWRBTN_DELAY_T1;
|
||||
@@ -460,3 +471,17 @@ static void powerbtn_x86_charge(void)
|
||||
task_wake(TASK_ID_POWERBTN);
|
||||
}
|
||||
DECLARE_HOOK(HOOK_CHARGE_STATE_CHANGE, powerbtn_x86_charge, HOOK_PRIO_DEFAULT);
|
||||
|
||||
/**
|
||||
* Handle configuring the power button behavior through a host command
|
||||
*/
|
||||
static int hc_config_powerbtn_x86(struct host_cmd_handler_args *args)
|
||||
{
|
||||
const struct ec_params_config_power_button *p = args->params;
|
||||
|
||||
smi_enabled = p->flags & (1 << EC_POWER_BUTTON_ENABLE_SMI_PULSE);
|
||||
|
||||
return EC_SUCCESS;
|
||||
}
|
||||
DECLARE_HOST_COMMAND(EC_CMD_CONFIG_POWER_BUTTON, hc_config_powerbtn_x86,
|
||||
EC_VER_MASK(0));
|
||||
|
||||
@@ -2253,6 +2253,20 @@ struct __ec_align1 ec_params_force_lid_open {
|
||||
uint8_t enabled;
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Configure the behavior of the power button */
|
||||
#define EC_CMD_CONFIG_POWER_BUTTON 0x002D
|
||||
|
||||
enum ec_config_power_button_flags {
|
||||
/* Enable/Disable SMI pulses for x86 devices */
|
||||
EC_POWER_BUTTON_ENABLE_SMI_PULSE = 1 << 0,
|
||||
};
|
||||
|
||||
struct __ec_align1 ec_params_config_power_button {
|
||||
/* See enum ec_config_power_button_flags */
|
||||
uint8_t flags;
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
/* USB charging control commands */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user