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
40454045 uint16_t voltage_lim; /* in mV */
40464046 } __ec_align2;
40474047
4048+/*****************************************************************************/
4049+/* Hibernate/Deep Sleep Commands */
4050+
4051+/* Set the delay before going into hibernation. */
4052+#define EC_CMD_HIBERNATION_DELAY 0x00A8
4053+
4054+struct 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+
4062+struct 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+
40484082 /* Inform the EC when entering a sleep state */
40494083 #define EC_CMD_HOST_SLEEP_EVENT 0x00A9
40504084
@@ -4052,7 +4086,9 @@ enum host_sleep_event { · 1 unmodified line
40524086 HOST_SLEEP_EVENT_S3_SUSPEND = 1,
40534087 HOST_SLEEP_EVENT_S3_RESUME = 2,
40544088 HOST_SLEEP_EVENT_S0IX_SUSPEND = 3,
4055− HOST_SLEEP_EVENT_S0IX_RESUME = 4
4089+ HOST_SLEEP_EVENT_S0IX_RESUME = 4,
4090+ /* S3 suspend with additional enabled wake sources */
4091+ HOST_SLEEP_EVENT_S3_WAKEABLE_SUSPEND = 5,
40564092 };
40574093
40584094 struct ec_params_host_sleep_event {
@@ -4116,6 +4152,36 @@ struct ec_response_host_sleep_event_v1 { · 57 unmodified lines
41164152 };
41174153 } __ec_align4;
41184154
4155+/*****************************************************************************/
4156+/* Device events */
4157+#define EC_CMD_DEVICE_EVENT 0x00AA
4158+
4159+enum ec_device_event {
4160+ EC_DEVICE_EVENT_TRACKPAD,
4161+ EC_DEVICE_EVENT_DSP,
4162+ EC_DEVICE_EVENT_WIFI,
4163+};
4164+
4165+enum 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+
4176+struct ec_params_device_event {
4177+ uint32_t event_mask;
4178+ uint8_t param;
4179+} __ec_align_size1;
4180+
4181+struct ec_response_device_event {
4182+ uint32_t event_mask;
4183+} __ec_align4;
4184+
41194185 /*****************************************************************************/
41204186 /* Smart battery pass-through */
41214187
@@ -4361,12 +4427,14 @@ enum ec_reboot_cmd { · 239 unmodified lines
43614427 /* (command 3 was jump to RW-B) */
43624428 EC_REBOOT_COLD = 4, /* Cold-reboot */
43634429 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 */
43654432 };
43664433
43674434 /* Flags for ec_params_reboot_ec.reboot_flags */
43684435 #define EC_REBOOT_FLAG_RESERVED0 BIT(0) /* Was recovery request */
43694436 #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 */
43704438
43714439 struct ec_params_reboot_ec {
43724440 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