Commit b92be99f authored by Gwendal Grignou's avatar Gwendal Grignou Committed by Lee Jones

mfd: cros_ec: Add Hibernate API

Add support for controlling hibernation of the Embedded Controller.
Signed-off-by: default avatarGwendal Grignou <gwendal@chromium.org>
Acked-by: default avatarEnric Balletbo i Serra <enric.balletbo@collabora.com>
Acked-by: default avatarBenson Leung <bleung@chromium.org>
Reviewed-by: default avatarFabien Lahoudere <fabien.lahoudere@collabora.com>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent fd537284
......@@ -4045,6 +4045,40 @@ struct ec_params_dedicated_charger_limit {
uint16_t voltage_lim; /* in mV */
} __ec_align2;
/*****************************************************************************/
/* Hibernate/Deep Sleep Commands */
/* Set the delay before going into hibernation. */
#define EC_CMD_HIBERNATION_DELAY 0x00A8
struct ec_params_hibernation_delay {
/*
* Seconds to wait in G3 before hibernate. Pass in 0 to read the
* current settings without changing them.
*/
uint32_t seconds;
} __ec_align4;
struct ec_response_hibernation_delay {
/*
* The current time in seconds in which the system has been in the G3
* state. This value is reset if the EC transitions out of G3.
*/
uint32_t time_g3;
/*
* The current time remaining in seconds until the EC should hibernate.
* This value is also reset if the EC transitions out of G3.
*/
uint32_t time_remaining;
/*
* The current time in seconds that the EC should wait in G3 before
* hibernating.
*/
uint32_t hibernate_delay;
} __ec_align4;
/* Inform the EC when entering a sleep state */
#define EC_CMD_HOST_SLEEP_EVENT 0x00A9
......@@ -4052,7 +4086,9 @@ enum host_sleep_event {
HOST_SLEEP_EVENT_S3_SUSPEND = 1,
HOST_SLEEP_EVENT_S3_RESUME = 2,
HOST_SLEEP_EVENT_S0IX_SUSPEND = 3,
HOST_SLEEP_EVENT_S0IX_RESUME = 4
HOST_SLEEP_EVENT_S0IX_RESUME = 4,
/* S3 suspend with additional enabled wake sources */
HOST_SLEEP_EVENT_S3_WAKEABLE_SUSPEND = 5,
};
struct ec_params_host_sleep_event {
......@@ -4116,6 +4152,36 @@ struct ec_response_host_sleep_event_v1 {
};
} __ec_align4;
/*****************************************************************************/
/* Device events */
#define EC_CMD_DEVICE_EVENT 0x00AA
enum ec_device_event {
EC_DEVICE_EVENT_TRACKPAD,
EC_DEVICE_EVENT_DSP,
EC_DEVICE_EVENT_WIFI,
};
enum ec_device_event_param {
/* Get and clear pending device events */
EC_DEVICE_EVENT_PARAM_GET_CURRENT_EVENTS,
/* Get device event mask */
EC_DEVICE_EVENT_PARAM_GET_ENABLED_EVENTS,
/* Set device event mask */
EC_DEVICE_EVENT_PARAM_SET_ENABLED_EVENTS,
};
#define EC_DEVICE_EVENT_MASK(event_code) BIT(event_code % 32)
struct ec_params_device_event {
uint32_t event_mask;
uint8_t param;
} __ec_align_size1;
struct ec_response_device_event {
uint32_t event_mask;
} __ec_align4;
/*****************************************************************************/
/* Smart battery pass-through */
......@@ -4361,12 +4427,14 @@ enum ec_reboot_cmd {
/* (command 3 was jump to RW-B) */
EC_REBOOT_COLD = 4, /* Cold-reboot */
EC_REBOOT_DISABLE_JUMP = 5, /* Disable jump until next reboot */
EC_REBOOT_HIBERNATE = 6 /* Hibernate EC */
EC_REBOOT_HIBERNATE = 6, /* Hibernate EC */
EC_REBOOT_HIBERNATE_CLEAR_AP_OFF = 7, /* and clears AP_OFF flag */
};
/* Flags for ec_params_reboot_ec.reboot_flags */
#define EC_REBOOT_FLAG_RESERVED0 BIT(0) /* Was recovery request */
#define EC_REBOOT_FLAG_ON_AP_SHUTDOWN BIT(1) /* Reboot after AP shutdown */
#define EC_REBOOT_FLAG_SWITCH_RW_SLOT BIT(2) /* Switch RW slot */
struct ec_params_reboot_ec {
uint8_t cmd; /* enum ec_reboot_cmd */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment