From: Guenter Roeck <linux@roeck-us.net>
To: Lukasz Majczak <lma@chromium.org>
Cc: Gwendal Grignou <gwendal@chromium.org>,
Tzung-Bi Shih <tzungbi@kernel.org>,
Radoslaw Biernacki <biernacki@google.com>,
Wim Van Sebroeck <wim@linux-watchdog.org>,
Lee Jones <lee@kernel.org>, Benson Leung <bleung@chromium.org>,
Guenter Roeck <groeck@chromium.org>,
Krzysztof Kozlowski <krzk@kernel.org>,
linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org,
chrome-platform@lists.linux.dev
Subject: Re: [PATCH v2 1/3] platform/chrome: Update binary interface for EC-based watchdog
Date: Thu, 18 Jan 2024 15:42:16 -0800 [thread overview]
Message-ID: <75bddec1-bb4a-467f-b37a-4b5e2892db34@roeck-us.net> (raw)
In-Reply-To: <20240118195325.2964918-2-lma@chromium.org>
On Thu, Jan 18, 2024 at 07:53:22PM +0000, Lukasz Majczak wrote:
> 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>
> ---
> .../linux/platform_data/cros_ec_commands.h | 78 +++++++++----------
> 1 file changed, 35 insertions(+), 43 deletions(-)
>
> diff --git a/include/linux/platform_data/cros_ec_commands.h b/include/linux/platform_data/cros_ec_commands.h
> index 7dae17b62a4d..ecc47d5fe239 100644
> --- a/include/linux/platform_data/cros_ec_commands.h
> +++ b/include/linux/platform_data/cros_ec_commands.h
> @@ -3961,60 +3961,52 @@ struct ec_response_i2c_passthru {
> } __ec_align1;
>
> /*****************************************************************************/
> -/* Power button hang detect */
> -
> +/* AP hang detect */
> #define EC_CMD_HANG_DETECT 0x009F
>
> -/* Reasons to start hang detection timer */
> -/* Power button pressed */
> -#define EC_HANG_START_ON_POWER_PRESS BIT(0)
> -
> -/* Lid closed */
> -#define EC_HANG_START_ON_LID_CLOSE BIT(1)
> -
> - /* Lid opened */
> -#define EC_HANG_START_ON_LID_OPEN BIT(2)
> -
> -/* Start of AP S3->S0 transition (booting or resuming from suspend) */
> -#define EC_HANG_START_ON_RESUME BIT(3)
> -
> -/* Reasons to cancel hang detection */
> +#define EC_HANG_DETECT_MIN_TIMEOUT 5
> +#define EC_HANG_DETECT_MAX_TIMEOUT 65535
>
> -/* Power button released */
> -#define EC_HANG_STOP_ON_POWER_RELEASE BIT(8)
> +/* EC hang detect commands */
> +enum ec_hang_detect_cmds {
> + /* Reload AP hang detect timer. */
> + EC_HANG_DETECT_CMD_RELOAD = 0x0,
>
> -/* Any host command from AP received */
> -#define EC_HANG_STOP_ON_HOST_COMMAND BIT(9)
> + /* Stop AP hang detect timer. */
> + EC_HANG_DETECT_CMD_CANCEL = 0x1,
>
> -/* Stop on end of AP S0->S3 transition (suspending or shutting down) */
> -#define EC_HANG_STOP_ON_SUSPEND BIT(10)
> + /* Configure watchdog with given reboot timeout and
> + * cancel currently running AP hang detect timer.
> + */
> + EC_HANG_DETECT_CMD_SET_TIMEOUT = 0x2,
>
> -/*
> - * If this flag is set, all the other fields are ignored, and the hang detect
> - * timer is started. This provides the AP a way to start the hang timer
> - * without reconfiguring any of the other hang detect settings. Note that
> - * you must previously have configured the timeouts.
> - */
> -#define EC_HANG_START_NOW BIT(30)
> + /* Get last hang status - whether the AP boot was clear or not */
> + EC_HANG_DETECT_CMD_GET_STATUS = 0x3,
>
> -/*
> - * If this flag is set, all the other fields are ignored (including
> - * EC_HANG_START_NOW). This provides the AP a way to stop the hang timer
> - * without reconfiguring any of the other hang detect settings.
> - */
> -#define EC_HANG_STOP_NOW BIT(31)
> + /* Clear last hang status. Called when AP is rebooting/shutting down
> + * gracefully.
> + */
> + EC_HANG_DETECT_CMD_CLEAR_STATUS = 0x4
> +};
>
> struct ec_params_hang_detect {
> - /* Flags; see EC_HANG_* */
> - uint32_t flags;
> -
> - /* Timeout in msec before generating host event, if enabled */
> - uint16_t host_event_timeout_msec;
> + uint16_t command; /* enum ec_hang_detect_cmds */
> + /* Timeout in seconds before generating reboot */
> + uint16_t reboot_timeout_sec;
> +} __ec_align2;
>
> - /* Timeout in msec before generating warm reboot, if enabled */
> - uint16_t warm_reboot_timeout_msec;
> -} __ec_align4;
> +/* Status codes that describe whether AP has boot normally or the hang has been
> + * detected and EC has reset AP
> + */
> +enum ec_hang_detect_status {
> + EC_HANG_DETECT_AP_BOOT_NORMAL = 0x0,
> + EC_HANG_DETECT_AP_BOOT_EC_WDT = 0x1,
> + EC_HANG_DETECT_AP_BOOT_COUNT,
> +};
>
> +struct ec_response_hang_detect {
> + uint8_t status; /* enum ec_hang_detect_status */
> +} __ec_align1;
> /*****************************************************************************/
> /* Commands for battery charging */
>
> --
> 2.43.0.429.g432eaa2c6b-goog
>
>
next prev parent reply other threads:[~2024-01-18 23:42 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-18 19:53 [PATCH v2 0/3] Introduce EC-based watchdog Lukasz Majczak
2024-01-18 19:53 ` [PATCH v2 1/3] platform/chrome: Update binary interface for " Lukasz Majczak
2024-01-18 23:42 ` Guenter Roeck [this message]
2024-01-19 3:41 ` Tzung-Bi Shih
2024-01-19 8:34 ` Łukasz Majczak
2024-01-18 19:53 ` [PATCH v2 2/3] watchdog: Add ChromeOS EC-based watchdog driver Lukasz Majczak
2024-01-18 23:44 ` Guenter Roeck
2024-01-19 3:42 ` Tzung-Bi Shih
2024-01-19 3:55 ` Guenter Roeck
2024-01-19 5:28 ` Tzung-Bi Shih
2024-01-18 19:53 ` [PATCH v2 3/3] mfd: cros_ec: Register EC-based watchdog subdevice Lukasz Majczak
2024-01-18 23:44 ` Guenter Roeck
2024-01-19 8:36 ` Łukasz Majczak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=75bddec1-bb4a-467f-b37a-4b5e2892db34@roeck-us.net \
--to=linux@roeck-us.net \
--cc=biernacki@google.com \
--cc=bleung@chromium.org \
--cc=chrome-platform@lists.linux.dev \
--cc=groeck@chromium.org \
--cc=gwendal@chromium.org \
--cc=krzk@kernel.org \
--cc=lee@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=lma@chromium.org \
--cc=tzungbi@kernel.org \
--cc=wim@linux-watchdog.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox