summaryrefslogtreecommitdiff
path: root/driver/ioexpander/it8801.h
diff options
context:
space:
mode:
authorVijay Hiremath <vijay.p.hiremath@intel.com>2021-08-05 16:45:54 -0700
committerCommit Bot <commit-bot@chromium.org>2021-09-10 19:07:11 +0000
commitd398a53a858d6f946e6a35cd06736033bce19094 (patch)
tree1a72fd20c6818b774a10dc8619290c1e9392509b /driver/ioexpander/it8801.h
parent431323a240bd98bf97012126d136dc2106febbf3 (diff)
downloadchrome-ec-d398a53a858d6f946e6a35cd06736033bce19094.tar.gz
IOEX: it8801: Enable GPIO based interrupts
Added code to enable GPIO based interrupts on it8801 I/O Expander. BUG=b:197659347 BRANCH=none TEST=Tested on ADL-RVP able to get ISR triggered Change-Id: I7f5f460f48fc21e51bb93bede5a05da89b7dc807 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3076469 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Dino Li <Dino.Li@ite.com.tw> Commit-Queue: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'driver/ioexpander/it8801.h')
-rw-r--r--driver/ioexpander/it8801.h20
1 files changed, 11 insertions, 9 deletions
diff --git a/driver/ioexpander/it8801.h b/driver/ioexpander/it8801.h
index ec38bba6af..5cb713c42b 100644
--- a/driver/ioexpander/it8801.h
+++ b/driver/ioexpander/it8801.h
@@ -36,13 +36,20 @@
#define IT8801_REG_MASK_GPIOPUE BIT(0)
#define IT8801_REG_GPIO23SOV BIT(3)
#define IT8801_REG_MASK_SELKSO2 0x02
+#define IT8801_REG_GISR 0xF9
+#define IT8801_REG_MASK_GISR_GKSIIS BIT(6)
+#define IT8801_REG_MASK_GISR_GGPIOG2IS BIT(2)
+#define IT8801_REG_MASK_GISR_GGPIOG1IS BIT(1)
+#define IT8801_REG_MASK_GISR_GGPIOG0IS BIT(0)
+#define IT8801_REG_MASK_GISR_GGPIOGXIS (IT8801_REG_MASK_GISR_GGPIOG2IS | \
+ IT8801_REG_MASK_GISR_GGPIOG1IS | IT8801_REG_MASK_GISR_GGPIOG0IS)
#define IT8801_REG_LBVIDR 0xFE
#define IT8801_REG_HBVIDR 0xFF
#define IT8801_KSO_COUNT 18
/* General Purpose I/O Port (GPIO) */
#define IT8801_SUPPORT_GPIO_FLAGS (GPIO_OPEN_DRAIN | GPIO_INPUT | \
- GPIO_OUTPUT | GPIO_LOW | GPIO_HIGH)
+ GPIO_OUTPUT | GPIO_LOW | GPIO_HIGH | GPIO_INT_ANY)
#define IT8801_REG_MASK_GPIOAFS_FUNC1 (0x00 << 7)
@@ -70,14 +77,9 @@ extern const struct ioexpander_drv it8801_ioexpander_drv;
#define IT8801_GPIOAFS_SHIFT 6 /* bit 6~7 */
#define IT8801_GPIODIR BIT(5) /* direction, output=1 */
-
-#define IT8801_GPIOIOT_SHIFT 3 /* bit 3~4 */
-#define IT8801_GPIOIOT_MASK 0x3
-#define IT8801_GPIOIOT_INT_LEVEL 0
-#define IT8801_GPIOIOT_INT_RISING 1
-#define IT8801_GPIOIOT_INT_FALLING 2
-#define IT8801_GPIOIOT_INT_EDGE 3 /* = RISING + FALLING */
-#define IT8801_GPIOIOT_OPEN_DRAIN 2
+/* input pin */
+#define IT8801_GPIOIOT_INT_RISING BIT(3)
+#define IT8801_GPIOIOT_INT_FALLING BIT(4)
#define IT8801_GPIODIR BIT(5)
#define IT8801_GPIOIOT BIT(4)