Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

platform/chrome: Update binary interface for EC-based watchdog

Update structures and defines related to EC_CMD_HANG_DETECT
to allow usage of new EC-based watchdog.

Signed-off-by: Lukasz Majczak <lma@chromium.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Tzung-Bi Shih <tzungbi@kernel.org>
Link: https://lore.kernel.org/r/20240126095721.782782-2-lma@chromium.org
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Lukasz Majczak and committed by
Lee Jones
4d2ff655 6613476e

+35 -43
+35 -43
include/linux/platform_data/cros_ec_commands.h
··· 3961 3961 } __ec_align1; 3962 3962 3963 3963 /*****************************************************************************/ 3964 - /* Power button hang detect */ 3965 - 3964 + /* AP hang detect */ 3966 3965 #define EC_CMD_HANG_DETECT 0x009F 3967 3966 3968 - /* Reasons to start hang detection timer */ 3969 - /* Power button pressed */ 3970 - #define EC_HANG_START_ON_POWER_PRESS BIT(0) 3967 + #define EC_HANG_DETECT_MIN_TIMEOUT 5 3968 + #define EC_HANG_DETECT_MAX_TIMEOUT 65535 3971 3969 3972 - /* Lid closed */ 3973 - #define EC_HANG_START_ON_LID_CLOSE BIT(1) 3970 + /* EC hang detect commands */ 3971 + enum ec_hang_detect_cmds { 3972 + /* Reload AP hang detect timer. */ 3973 + EC_HANG_DETECT_CMD_RELOAD = 0x0, 3974 3974 3975 - /* Lid opened */ 3976 - #define EC_HANG_START_ON_LID_OPEN BIT(2) 3975 + /* Stop AP hang detect timer. */ 3976 + EC_HANG_DETECT_CMD_CANCEL = 0x1, 3977 3977 3978 - /* Start of AP S3->S0 transition (booting or resuming from suspend) */ 3979 - #define EC_HANG_START_ON_RESUME BIT(3) 3978 + /* Configure watchdog with given reboot timeout and 3979 + * cancel currently running AP hang detect timer. 3980 + */ 3981 + EC_HANG_DETECT_CMD_SET_TIMEOUT = 0x2, 3980 3982 3981 - /* Reasons to cancel hang detection */ 3983 + /* Get last hang status - whether the AP boot was clear or not */ 3984 + EC_HANG_DETECT_CMD_GET_STATUS = 0x3, 3982 3985 3983 - /* Power button released */ 3984 - #define EC_HANG_STOP_ON_POWER_RELEASE BIT(8) 3985 - 3986 - /* Any host command from AP received */ 3987 - #define EC_HANG_STOP_ON_HOST_COMMAND BIT(9) 3988 - 3989 - /* Stop on end of AP S0->S3 transition (suspending or shutting down) */ 3990 - #define EC_HANG_STOP_ON_SUSPEND BIT(10) 3991 - 3992 - /* 3993 - * If this flag is set, all the other fields are ignored, and the hang detect 3994 - * timer is started. This provides the AP a way to start the hang timer 3995 - * without reconfiguring any of the other hang detect settings. Note that 3996 - * you must previously have configured the timeouts. 3997 - */ 3998 - #define EC_HANG_START_NOW BIT(30) 3999 - 4000 - /* 4001 - * If this flag is set, all the other fields are ignored (including 4002 - * EC_HANG_START_NOW). This provides the AP a way to stop the hang timer 4003 - * without reconfiguring any of the other hang detect settings. 4004 - */ 4005 - #define EC_HANG_STOP_NOW BIT(31) 3986 + /* Clear last hang status. Called when AP is rebooting/shutting down 3987 + * gracefully. 3988 + */ 3989 + EC_HANG_DETECT_CMD_CLEAR_STATUS = 0x4 3990 + }; 4006 3991 4007 3992 struct ec_params_hang_detect { 4008 - /* Flags; see EC_HANG_* */ 4009 - uint32_t flags; 3993 + uint16_t command; /* enum ec_hang_detect_cmds */ 3994 + /* Timeout in seconds before generating reboot */ 3995 + uint16_t reboot_timeout_sec; 3996 + } __ec_align2; 4010 3997 4011 - /* Timeout in msec before generating host event, if enabled */ 4012 - uint16_t host_event_timeout_msec; 3998 + /* Status codes that describe whether AP has boot normally or the hang has been 3999 + * detected and EC has reset AP 4000 + */ 4001 + enum ec_hang_detect_status { 4002 + EC_HANG_DETECT_AP_BOOT_NORMAL = 0x0, 4003 + EC_HANG_DETECT_AP_BOOT_EC_WDT = 0x1, 4004 + EC_HANG_DETECT_AP_BOOT_COUNT, 4005 + }; 4013 4006 4014 - /* Timeout in msec before generating warm reboot, if enabled */ 4015 - uint16_t warm_reboot_timeout_msec; 4016 - } __ec_align4; 4017 - 4007 + struct ec_response_hang_detect { 4008 + uint8_t status; /* enum ec_hang_detect_status */ 4009 + } __ec_align1; 4018 4010 /*****************************************************************************/ 4019 4011 /* Commands for battery charging */ 4020 4012