History

mfd: cros_ec: Add Hibernate API

Add support for controlling hibernation of the Embedded Controller.

Gwendal Grignou committed 7 years ago

Commit b92be991 parent fd537281 file · +70 −2Browse files

Unified · Split

include/linux/mfd/cros_ec_commands.h+70−2
@@ -4045,6 +4045,40 @@ struct ec_params_dedicated_charger_limit { · 4044 unmodified lines
4045 uint16_t voltage_lim; /* in mV */4045 uint16_t voltage_lim; /* in mV */
4046} __ec_align2;4046} __ec_align2;
4047 4047
4048/*****************************************************************************/
4049/* Hibernate/Deep Sleep Commands */
4050
4051/* Set the delay before going into hibernation. */
4052#define EC_CMD_HIBERNATION_DELAY 0x00A8
4053
4054struct ec_params_hibernation_delay {
4055 /*
4056 * Seconds to wait in G3 before hibernate. Pass in 0 to read the
4057 * current settings without changing them.
4058 */
4059 uint32_t seconds;
4060} __ec_align4;
4061
4062struct ec_response_hibernation_delay {
4063 /*
4064 * The current time in seconds in which the system has been in the G3
4065 * state. This value is reset if the EC transitions out of G3.
4066 */
4067 uint32_t time_g3;
4068
4069 /*
4070 * The current time remaining in seconds until the EC should hibernate.
4071 * This value is also reset if the EC transitions out of G3.
4072 */
4073 uint32_t time_remaining;
4074
4075 /*
4076 * The current time in seconds that the EC should wait in G3 before
4077 * hibernating.
4078 */
4079 uint32_t hibernate_delay;
4080} __ec_align4;
4081
4048/* Inform the EC when entering a sleep state */4082/* Inform the EC when entering a sleep state */
4049#define EC_CMD_HOST_SLEEP_EVENT 0x00A94083#define EC_CMD_HOST_SLEEP_EVENT 0x00A9
4050 4084
@@ -4052,7 +4086,9 @@ enum host_sleep_event { · 1 unmodified line
4052 HOST_SLEEP_EVENT_S3_SUSPEND = 1,4086 HOST_SLEEP_EVENT_S3_SUSPEND = 1,
4053 HOST_SLEEP_EVENT_S3_RESUME = 2,4087 HOST_SLEEP_EVENT_S3_RESUME = 2,
4054 HOST_SLEEP_EVENT_S0IX_SUSPEND = 3,4088 HOST_SLEEP_EVENT_S0IX_SUSPEND = 3,
4055 HOST_SLEEP_EVENT_S0IX_RESUME = 44089 HOST_SLEEP_EVENT_S0IX_RESUME = 4,
4090 /* S3 suspend with additional enabled wake sources */
4091 HOST_SLEEP_EVENT_S3_WAKEABLE_SUSPEND = 5,
4056};4092};
4057 4093
4058struct ec_params_host_sleep_event {4094struct ec_params_host_sleep_event {
@@ -4116,6 +4152,36 @@ struct ec_response_host_sleep_event_v1 { · 57 unmodified lines
4116 };4152 };
4117} __ec_align4;4153} __ec_align4;
4118 4154
4155/*****************************************************************************/
4156/* Device events */
4157#define EC_CMD_DEVICE_EVENT 0x00AA
4158
4159enum ec_device_event {
4160 EC_DEVICE_EVENT_TRACKPAD,
4161 EC_DEVICE_EVENT_DSP,
4162 EC_DEVICE_EVENT_WIFI,
4163};
4164
4165enum ec_device_event_param {
4166 /* Get and clear pending device events */
4167 EC_DEVICE_EVENT_PARAM_GET_CURRENT_EVENTS,
4168 /* Get device event mask */
4169 EC_DEVICE_EVENT_PARAM_GET_ENABLED_EVENTS,
4170 /* Set device event mask */
4171 EC_DEVICE_EVENT_PARAM_SET_ENABLED_EVENTS,
4172};
4173
4174#define EC_DEVICE_EVENT_MASK(event_code) BIT(event_code % 32)
4175
4176struct ec_params_device_event {
4177 uint32_t event_mask;
4178 uint8_t param;
4179} __ec_align_size1;
4180
4181struct ec_response_device_event {
4182 uint32_t event_mask;
4183} __ec_align4;
4184
4119/*****************************************************************************/4185/*****************************************************************************/
4120/* Smart battery pass-through */4186/* Smart battery pass-through */
4121 4187
@@ -4361,12 +4427,14 @@ enum ec_reboot_cmd { · 239 unmodified lines
4361 /* (command 3 was jump to RW-B) */4427 /* (command 3 was jump to RW-B) */
4362 EC_REBOOT_COLD = 4, /* Cold-reboot */4428 EC_REBOOT_COLD = 4, /* Cold-reboot */
4363 EC_REBOOT_DISABLE_JUMP = 5, /* Disable jump until next reboot */4429 EC_REBOOT_DISABLE_JUMP = 5, /* Disable jump until next reboot */
4364 EC_REBOOT_HIBERNATE = 6 /* Hibernate EC */4430 EC_REBOOT_HIBERNATE = 6, /* Hibernate EC */
4431 EC_REBOOT_HIBERNATE_CLEAR_AP_OFF = 7, /* and clears AP_OFF flag */
4365};4432};
4366 4433
4367/* Flags for ec_params_reboot_ec.reboot_flags */4434/* Flags for ec_params_reboot_ec.reboot_flags */
4368#define EC_REBOOT_FLAG_RESERVED0 BIT(0) /* Was recovery request */4435#define EC_REBOOT_FLAG_RESERVED0 BIT(0) /* Was recovery request */
4369#define EC_REBOOT_FLAG_ON_AP_SHUTDOWN BIT(1) /* Reboot after AP shutdown */4436#define EC_REBOOT_FLAG_ON_AP_SHUTDOWN BIT(1) /* Reboot after AP shutdown */
4437#define EC_REBOOT_FLAG_SWITCH_RW_SLOT BIT(2) /* Switch RW slot */
4370 4438
4371struct ec_params_reboot_ec {4439struct ec_params_reboot_ec {
4372 uint8_t cmd; /* enum ec_reboot_cmd */4440 uint8_t cmd; /* enum ec_reboot_cmd */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t