Add AP hang detection

BUG=chrome-os-partner:24558
BRANCH=none
TEST=see procedure in bug

Change-Id: I42614a1da5f24c93b6267d81339ff9d721bf0d8f
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/180080
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
This commit is contained in:
Randall Spangler
2013-12-09 16:05:28 -08:00
committed by chrome-internal-fetch
parent 54b5c71f0d
commit 616e70998d
9 changed files with 379 additions and 0 deletions

20
include/ap_hang_detect.h Normal file
View File

@@ -0,0 +1,20 @@
/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/* Power button API for Chrome EC */
#ifndef __CROS_EC_AP_HANG_DETECT_H
#define __CROS_EC_AP_HANG_DETECT_H
#include "common.h"
/**
* If the hang detect timers were started and can be stopped by any host
* command, stop them. This is intended to be called by the the host command
* module.
*/
void hang_detect_stop_on_host_command(void);
#endif /* __CROS_EC_AP_HANG_DETECT_H */

View File

@@ -52,6 +52,9 @@
#undef CONFIG_ALS
#undef CONFIG_ALS_ISL29035
/* Support AP hang detection host command and state machine */
#undef CONFIG_AP_HANG_DETECT
/*
* Support controlling the display backlight based on the state of the lid
* switch. The EC will disable the backlight when the lid is closed.

View File

@@ -249,6 +249,11 @@ enum host_event_code {
/* Suggest that the AP resume normal speed */
EC_HOST_EVENT_THROTTLE_STOP = 19,
/* Hang detect logic detected a hang and host event timeout expired */
EC_HOST_EVENT_HANG_DETECT = 20,
/* Hang detect logic detected a hang and warm rebooted the AP */
EC_HOST_EVENT_HANG_REBOOT = 21,
/*
* The high bit of the event mask is not used as a host event code. If
* it reads back as set, then the entire event mask should be
@@ -1707,6 +1712,60 @@ struct ec_response_i2c_passthru {
uint8_t data[]; /* Data read by messages concatenated here */
} __packed;
/*****************************************************************************/
/* Power button hang detect */
#define EC_CMD_HANG_DETECT 0x9f
/* Reasons to start hang detection timer */
/* Power button pressed */
#define EC_HANG_START_ON_POWER_PRESS (1 << 0)
/* Lid closed */
#define EC_HANG_START_ON_LID_CLOSE (1 << 1)
/* Lid opened */
#define EC_HANG_START_ON_LID_OPEN (1 << 2)
/* Start of AP S3->S0 transition (booting or resuming from suspend) */
#define EC_HANG_START_ON_RESUME (1 << 3)
/* Reasons to cancel hang detection */
/* Power button released */
#define EC_HANG_STOP_ON_POWER_RELEASE (1 << 8)
/* Any host command from AP received */
#define EC_HANG_STOP_ON_HOST_COMMAND (1 << 9)
/* Stop on end of AP S0->S3 transition (suspending or shutting down) */
#define EC_HANG_STOP_ON_SUSPEND (1 << 10)
/*
* 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 (1 << 30)
/*
* 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 (1 << 31)
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;
/* Timeout in msec before generating warm reboot, if enabled */
uint16_t warm_reboot_timeout_msec;
} __packed;
/*****************************************************************************/
/* Debug commands for battery charging */