summaryrefslogtreecommitdiff
path: root/board/samus_pd
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2014-08-20 18:07:33 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-08-27 01:29:58 +0000
commit1933fb8ff70ec725cbb4d960de5cc23d682acb78 (patch)
tree3c23f0f3e85194bdb5b156b4da911d799e6bf85b /board/samus_pd
parente913bc15b8a631757b362da09fc1385a7f509def (diff)
downloadchrome-ec-1933fb8ff70ec725cbb4d960de5cc23d682acb78.tar.gz
samus: add ability for PD MCU to send host event to AP
Add host event for PD up to AP. The PD toggles a gpio line to EC causing an interrupt on EC. The EC then sends host command down to PD MCU to get its status. There is a new status bit for PD host event, so when EC see's the PD host event status bit, it sends a PD host event to the AP. There is currently only one host event for PD to AP. BUG=chrome-os-partner:31361 BRANCH=none TEST=added PD console command pdevent, which initiates the host event. when sent, verified on EC that it sets the correct host event bit using hostevent console command Change-Id: If1a59a3232e2f9a49f272c6dee5319254d87b9a9 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/213371 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'board/samus_pd')
-rw-r--r--board/samus_pd/usb_pd_policy.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/board/samus_pd/usb_pd_policy.c b/board/samus_pd/usb_pd_policy.c
index 867a020dd6..7b56d12435 100644
--- a/board/samus_pd/usb_pd_policy.c
+++ b/board/samus_pd/usb_pd_policy.c
@@ -3,6 +3,7 @@
* found in the LICENSE file.
*/
+#include "atomic.h"
#include "common.h"
#include "console.h"
#include "gpio.h"
@@ -194,6 +195,18 @@ DECLARE_CONSOLE_COMMAND(ecint, command_ec_int,
"Toggle EC interrupt line",
NULL);
+static int command_pd_host_event(int argc, char **argv)
+{
+ atomic_or(&(pd_status.status), PD_STATUS_HOST_EVENT);
+ pd_send_ec_int();
+
+ return EC_SUCCESS;
+}
+DECLARE_CONSOLE_COMMAND(pdevent, command_pd_host_event,
+ "",
+ "Send PD host event",
+ NULL);
+
/****************************************************************************/
/* Host commands */
static int ec_status_host_cmd(struct host_cmd_handler_args *args)
@@ -205,6 +218,9 @@ static int ec_status_host_cmd(struct host_cmd_handler_args *args)
*r = pd_status;
+ /* Clear host event */
+ atomic_clear(&(pd_status.status), PD_STATUS_HOST_EVENT);
+
args->response_size = sizeof(*r);
return EC_RES_SUCCESS;