summaryrefslogtreecommitdiff
path: root/include/ioexpander.h
diff options
context:
space:
mode:
authorCHLin <CHLIN56@nuvoton.com>2019-08-05 15:02:19 +0800
committerCommit Bot <commit-bot@chromium.org>2019-08-20 18:12:14 +0000
commit5040fdcc897188ad674b0503bf31d5c26f9f76d4 (patch)
tree646e5033fcf570b1a4d3267280ba2ee31813e747 /include/ioexpander.h
parent8aaeb9fd05ab185a7807f3650e491d2c3042637a (diff)
downloadchrome-ec-5040fdcc897188ad674b0503bf31d5c26f9f76d4.tar.gz
IO Expander: add the interrupt support to IOEX framework
This CL creates interfaces which bring the IOEX framework to support interrupt feature. To declare an IOEX IO which supports the interrupt function, file its declaration in gpio.inc with the format: IOEX_INT(name, expin, flags, signal) Note: like GPIO, all IOEX IOs with interrupt handlers must be declared at the top of the IOEX's declaration in the gpio.inc The following two APIs are added to enable/disable each IOEX IO's interrupt function: 1. ioex_enable_interrupt 2. ioex_disable_interrupt BRANCH=none BUG=none TEST=No error for "make buildall" TEST=Apply this and related CLs, manually test each IO pins; make sure each pin's interrupt handler is correctly executed. Change-Id: Icbf54c09120e37b68c647c884cd6aa28d9313167 Signed-off-by: CHLin <CHLIN56@nuvoton.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1734947 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: CH Lin <chlin56@nuvoton.com> Commit-Queue: Edward Hill <ecgh@chromium.org>
Diffstat (limited to 'include/ioexpander.h')
-rw-r--r--include/ioexpander.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/ioexpander.h b/include/ioexpander.h
index 2a31eb6aaa..e8f76d9fbc 100644
--- a/include/ioexpander.h
+++ b/include/ioexpander.h
@@ -27,6 +27,8 @@ struct ioex_info {
/* Signal information from board.c. Must match order from enum ioex_signal. */
extern const struct ioex_info ioex_list[];
+extern void (* const ioex_irq_handlers[])(enum ioex_signal signal);
+extern const int ioex_ih_count;
struct ioexpander_drv {
/* Initialize IO expander chip/driver */
@@ -39,6 +41,8 @@ struct ioexpander_drv {
int (*get_flags_by_mask)(int ioex, int port, int mask, int *flags);
/* Set flags for the IOEX pin */
int (*set_flags_by_mask)(int ioex, int port, int mask, int flags);
+ /* Enable/disable interrupt for the IOEX pin */
+ int (*enable_interrupt)(int ioex, int port, int mask, int enable);
};
struct ioexpander_config_t {
@@ -61,6 +65,22 @@ struct ioexpander_config_t {
extern struct ioexpander_config_t ioex_config[];
/*
+ * Enable the interrupt for the IOEX signal
+ *
+ * @param signal IOEX signal to enable the interrupt
+ * @return EC_SUCCESS if successful, non-zero if error.
+ */
+int ioex_enable_interrupt(enum ioex_signal signal);
+
+/*
+ * Disable the interrupt for the IOEX signal
+ *
+ * @param signal IOEX signal to disable the interrupt
+ * @return EC_SUCCESS if successful, non-zero if error.
+ */
+int ioex_disable_interrupt(enum ioex_signal signal);
+
+/*
* Get flags for the IOEX pin by mask
*
* @param ioex IO expander chip's port number