Skip to content

Commit afe2bb5

Browse files
Evan GreenLee Jones
authored andcommitted
mfd: cros_ec: Add host_sleep_event_v1 command
Introduce the command and response structures for the second revision of the host sleep event. These structures are part of a new EC change that enables detection of failure to enter S0ix. The EC waits a kernel-specified timeout (or a default amount of time) for the S0_SLP pin to change, and wakes the system if that change does not occur in time. Signed-off-by: Evan Green <[email protected]> Reviewed-by: Rajat Jain <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Acked-by: Enric Balletbo i Serra <[email protected]> Signed-off-by: Lee Jones <[email protected]>
1 parent 49a65e3 commit afe2bb5

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

include/linux/mfd/cros_ec_commands.h

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2731,6 +2731,63 @@ struct ec_params_host_sleep_event {
27312731
uint8_t sleep_event;
27322732
} __packed;
27332733

2734+
/*
2735+
* Use a default timeout value (CONFIG_SLEEP_TIMEOUT_MS) for detecting sleep
2736+
* transition failures
2737+
*/
2738+
#define EC_HOST_SLEEP_TIMEOUT_DEFAULT 0
2739+
2740+
/* Disable timeout detection for this sleep transition */
2741+
#define EC_HOST_SLEEP_TIMEOUT_INFINITE 0xFFFF
2742+
2743+
struct ec_params_host_sleep_event_v1 {
2744+
/* The type of sleep being entered or exited. */
2745+
uint8_t sleep_event;
2746+
2747+
/* Padding */
2748+
uint8_t reserved;
2749+
union {
2750+
/* Parameters that apply for suspend messages. */
2751+
struct {
2752+
/*
2753+
* The timeout in milliseconds between when this message
2754+
* is received and when the EC will declare sleep
2755+
* transition failure if the sleep signal is not
2756+
* asserted.
2757+
*/
2758+
uint16_t sleep_timeout_ms;
2759+
} suspend_params;
2760+
2761+
/* No parameters for non-suspend messages. */
2762+
};
2763+
} __packed;
2764+
2765+
/* A timeout occurred when this bit is set */
2766+
#define EC_HOST_RESUME_SLEEP_TIMEOUT 0x80000000
2767+
2768+
/*
2769+
* The mask defining which bits correspond to the number of sleep transitions,
2770+
* as well as the maximum number of suspend line transitions that will be
2771+
* reported back to the host.
2772+
*/
2773+
#define EC_HOST_RESUME_SLEEP_TRANSITIONS_MASK 0x7FFFFFFF
2774+
2775+
struct ec_response_host_sleep_event_v1 {
2776+
union {
2777+
/* Response fields that apply for resume messages. */
2778+
struct {
2779+
/*
2780+
* The number of sleep power signal transitions that
2781+
* occurred since the suspend message. The high bit
2782+
* indicates a timeout occurred.
2783+
*/
2784+
uint32_t sleep_transitions;
2785+
} resume_response;
2786+
2787+
/* No response fields for non-resume messages. */
2788+
};
2789+
} __packed;
2790+
27342791
/*****************************************************************************/
27352792
/* Smart battery pass-through */
27362793

0 commit comments

Comments
 (0)