Commit 0442fe3b authored by Fabio Baltieri's avatar Fabio Baltieri Committed by Fabio Baltieri
Browse files

input: npcx_kbd: clear pending interrupts before reenabling detection



The driver right now re-enters polling mode a couple times after the
matrix has been detected as stable as the key interrupt is still pending
and fires again once detection is reenabled.

Clear pending WUI interrupts before reenabling key press detection to
avoid that.

Signed-off-by: default avatarFabio Baltieri <fabiobaltieri@google.com>
parent 0223fe89
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -57,8 +57,13 @@ static void npcx_kbd_ksi_isr(const struct device *dev, struct npcx_wui *wui)
static void npcx_kbd_set_detect_mode(const struct device *dev, bool enabled)
{
	const struct npcx_kbd_config *const config = dev->config;
	const struct input_kbd_matrix_common_config *common = &config->common;

	if (enabled) {
		for (int i = 0; i < common->row_size; i++) {
			npcx_miwu_irq_get_and_clear_pending(&config->wui_maps[i]);
		}

		irq_enable(config->irq);
	} else {
		irq_disable(config->irq);