summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2015-06-04 11:30:34 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-06-05 22:35:05 +0000
commit58719e30730e6420533514dabd27c188e60ae607 (patch)
tree8015dd22c5808e88b648cd52463bf59a34b0a734 /board
parentbdc680d8ed7ea24cdfb1b5498f73a1008c71ad37 (diff)
downloadchrome-ec-58719e30730e6420533514dabd27c188e60ae607.tar.gz
pd: use pdcmd task to handle tcpc interrupt
Use the PDCMD task to handle PD MCU interrupts, and use it to trigger the tcpc_alert(). Note this fixes bug on Glados and Oak that could cause watchdog reset because tcpc_alert() which uses i2c to talk to tcpc was called from hooks task and can delay tickling watchdog. BUG=chrome-os-partner:40920 BRANCH=none TEST=load on glados and plug zinger into both ports many times. make sure we get a stable contract and no watchdog reset. Change-Id: I37625fae2ca0057d2ee8fa1eea6974f2d26d1b91 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/275296 Reviewed-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'board')
-rw-r--r--board/glados/board.c4
-rw-r--r--board/glados_pd/board.c17
-rw-r--r--board/samus/board.h1
3 files changed, 21 insertions, 1 deletions
diff --git a/board/glados/board.c b/board/glados/board.c
index 9f0ce37f88..a1f8e9dd5f 100644
--- a/board/glados/board.c
+++ b/board/glados/board.c
@@ -11,6 +11,7 @@
#include "extpower.h"
#include "gpio.h"
#include "hooks.h"
+#include "host_command.h"
#include "i2c.h"
#include "lid_switch.h"
#include "motion_sense.h"
@@ -33,7 +34,8 @@
/* Exchange status with PD MCU. */
static void pd_mcu_interrupt(enum gpio_signal signal)
{
- hook_call_deferred(tcpc_alert, 0);
+ /* Exchange status with PD MCU to determine interrupt cause */
+ host_command_pd_send_status(0);
}
void vbus0_evt(enum gpio_signal signal)
diff --git a/board/glados_pd/board.c b/board/glados_pd/board.c
index da6fc82525..776e30a29b 100644
--- a/board/glados_pd/board.c
+++ b/board/glados_pd/board.c
@@ -101,3 +101,20 @@ DECLARE_CONSOLE_COMMAND(ecint, command_ec_int,
"",
"Toggle EC interrupt line",
NULL);
+
+static int ec_status_host_cmd(struct host_cmd_handler_args *args)
+{
+ struct ec_response_pd_status *r = args->response;
+
+ /*
+ * TODO: use state here to notify EC of host events, tcpc port
+ * 0 alert and tcpc port 1 alert.
+ */
+ r->status = 0;
+ args->response_size = sizeof(*r);
+
+ return EC_RES_SUCCESS;
+}
+DECLARE_HOST_COMMAND(EC_CMD_PD_EXCHANGE_STATUS, ec_status_host_cmd,
+ EC_VER_MASK(1));
+
diff --git a/board/samus/board.h b/board/samus/board.h
index 8d78c03cef..3c81e403d8 100644
--- a/board/samus/board.h
+++ b/board/samus/board.h
@@ -69,6 +69,7 @@
#define CONFIG_TEMP_SENSOR_TMP006
#define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_PP3300_DSW_GATED_EN
#define CONFIG_UART_HOST 2
+#define CONFIG_USB_PD_MCU_CHG_CTRL
#define CONFIG_USB_PORT_POWER_SMART
#define CONFIG_USB_PORT_POWER_SMART_DEFAULT_MODE USB_CHARGE_MODE_CDP
#define CONFIG_USB_PORT_POWER_SMART_INVERTED