summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2020-11-25 18:38:21 -0800
committerCommit Bot <commit-bot@chromium.org>2020-12-10 03:16:49 +0000
commit38981368658817aa15152d5c3aa61e56a9541580 (patch)
tree212ac529bfe2eebb996fd5c50a956fd4c5358f18
parentd9b7ea8ff23a744e7a5e0f28fe7ca0e36ef11a9d (diff)
downloadchrome-ec-38981368658817aa15152d5c3aa61e56a9541580.tar.gz
PCHG: Send device event to host
This patch makes PCHG send EC_HOST_EVENT_DEVICE on every state machine cycle. The host is expected to retrieve the device event mask through EC_CMD_DEVICE_EVENT and updates port status if the mask has EC_DEVICE_EVENT_WLC. BUG=b:173235954 BRANCH=Trogdor TEST=Enabled and disabled EC_DEVICE_EVENT_WLC via deviceevent command and verified the sysfs node is updated. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I9dece6bc35599db3d6ae30452fd8e97bbaeab9af Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2579722 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--board/coachz/board.h1
-rw-r--r--common/peripheral_charger.c7
-rw-r--r--include/ec_commands.h1
3 files changed, 9 insertions, 0 deletions
diff --git a/board/coachz/board.h b/board/coachz/board.h
index d94c267f34..76480b892b 100644
--- a/board/coachz/board.h
+++ b/board/coachz/board.h
@@ -17,6 +17,7 @@
#define CONFIG_CMD_GPIO_EXTENDED
#define CONFIG_CMD_POWERINDEBUG
#define CONFIG_I2C_DEBUG
+#define CONFIG_DEVICE_EVENT
/* Internal SPI flash on NPCX7 */
#define CONFIG_FLASH_SIZE (512 * 1024) /* 512KB internal spi flash */
diff --git a/common/peripheral_charger.c b/common/peripheral_charger.c
index 2faa315253..eeb2a4cf80 100644
--- a/common/peripheral_charger.c
+++ b/common/peripheral_charger.c
@@ -5,6 +5,7 @@
#include "atomic.h"
#include "common.h"
+#include "device_event.h"
#include "hooks.h"
#include "host_command.h"
#include "peripheral_charger.h"
@@ -320,6 +321,12 @@ void pchg_task(void *u)
pchg_run(ctx);
} while (queue_count(&ctx->events));
}
+ /*
+ * Send one host event for all ports. Currently PCHG supports
+ * only WLC but in the future other types (e.g. WPC Qi) should
+ * send different device events.
+ */
+ device_set_single_event(EC_DEVICE_EVENT_WLC);
task_wait_event(-1);
}
}
diff --git a/include/ec_commands.h b/include/ec_commands.h
index 7b3e6de6d4..0ff5c4e571 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -4670,6 +4670,7 @@ enum ec_device_event {
EC_DEVICE_EVENT_TRACKPAD,
EC_DEVICE_EVENT_DSP,
EC_DEVICE_EVENT_WIFI,
+ EC_DEVICE_EVENT_WLC,
};
enum ec_device_event_param {