From 0d47794e6c511a896a1b544e222e792d1e1bbfcc Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Wed, 23 May 2018 09:54:32 -0700 Subject: chip/it83xx: Configure IRQTP for KBC when using eSPI SERIIRQ# is by default deasserted level high. However, when using eSPI, SERIRQ# is routed over virtual wire as interrupt event. As per eSPI base spec (doc#327432), all virtual wire interrupt events are deasserted level low. Thus, it is necessary to configure this interrupt as inverted. ITE hardware takes care of routing the SERIRQ# signal appropriately over eSPI/LPC depending upon the selected mode. BUG=b:79897267 BRANCH=None TEST=Verified using evtest that keypresses are properly identified on the OS side. Change-Id: Ie3b92f20fa915ba8f17dcbcb600ebfe5cbfb4d57 Signed-off-by: Dino Li Signed-off-by: Furquan Shaikh Reviewed-on: https://chromium-review.googlesource.com/1069570 Commit-Ready: Furquan Shaikh Tested-by: Furquan Shaikh Reviewed-by: Aaron Durbin Reviewed-by: Jett Rink --- chip/it83xx/ec2i.c | 22 ++++++++++++++++++++++ chip/it83xx/ec2i_chip.h | 3 +++ 2 files changed, 25 insertions(+) diff --git a/chip/it83xx/ec2i.c b/chip/it83xx/ec2i.c index 31ed7b4595..5807b3ed32 100644 --- a/chip/it83xx/ec2i.c +++ b/chip/it83xx/ec2i.c @@ -19,6 +19,28 @@ static const struct ec2i_t pnpcfg_settings[] = { {HOST_INDEX_LDN, LDN_KBC_KEYBOARD}, /* Set IRQ=01h for logical device */ {HOST_INDEX_IRQNUMX, 0x01}, + /* Configure IRQTP for KBC. */ +#ifdef CONFIG_HOSTCMD_ESPI + /* + * Interrupt request type select (IRQTP) for KBC. + * bit 1, 0: IRQ request is buffered and applied to SERIRQ + * 1: IRQ request is inverted before being applied to SERIRQ + * bit 0, 0: Edge triggered mode + * 1: Level triggered mode + * + * SERIRQ# is by default deasserted level high. However, when using + * eSPI, SERIRQ# is routed over virtual wire as interrupt event. As + * per eSPI base spec (doc#327432), all virtual wire interrupt events + * are deasserted level low. Thus, it is necessary to configure this + * interrupt as inverted. ITE hardware takes care of routing the SERIRQ# + * signal appropriately over eSPI / LPC depending upon the selected + * mode. + * + * Additionally, this interrupt is configured as edge-triggered on the + * host side. So, match the trigger mode on the EC side as well. + */ + {HOST_INDEX_IRQTP, 0x02}, +#endif /* Enable logical device */ {HOST_INDEX_LDA, 0x01}, diff --git a/chip/it83xx/ec2i_chip.h b/chip/it83xx/ec2i_chip.h index 8802e3d0b8..9510f75efc 100644 --- a/chip/it83xx/ec2i_chip.h +++ b/chip/it83xx/ec2i_chip.h @@ -16,6 +16,9 @@ enum ec2i_setting { EC2I_SET_KB_LDN, EC2I_SET_KB_IRQ, +#ifdef CONFIG_HOSTCMD_ESPI + EC2I_SET_KB_IRQ_TYPE, +#endif EC2I_SET_KB_ENABLE, EC2I_SET_MOUSE_LDN, EC2I_SET_MOUSE_IRQ, -- cgit v1.2.1