ITE drivers/kscan: support tests/driver/kscan/kscan_api

Add kscan0 to support tests/driver/kscan/kscan_api.

When running the tests code on it8xxx2_evb, it shows fatal
error: IRQ is enabled. We find that once polling_task() is
created and executed, the KSI interrupt will be enabled and
before we call irq_connect_dynamic(), so we switch both
function sequence.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
This commit is contained in:
Ruibin Chang 2022-01-12 18:06:22 +08:00 committed by Anas Nashif
parent 8d9735824a
commit 336d0f67b3
2 changed files with 5 additions and 4 deletions

View file

@ -30,6 +30,7 @@
aliases {
led0 = &led0;
kscan0 = &kscan0;
};
leds {

View file

@ -492,6 +492,10 @@ static int kscan_it8xxx2_init(const struct device *dev)
/* Enable keyboard scan loop */
atomic_set(&data->enable_scan, 1);
irq_connect_dynamic(DT_INST_IRQN(0), 0,
(void (*)(const void *))keyboard_raw_interrupt,
(const void *)dev, 0);
/* Create keyboard scan task */
k_thread_create(&data->thread, data->thread_stack,
TASK_STACK_SIZE,
@ -499,10 +503,6 @@ static int kscan_it8xxx2_init(const struct device *dev)
(void *)dev, NULL, NULL,
K_PRIO_COOP(4), 0, K_NO_WAIT);
irq_connect_dynamic(DT_INST_IRQN(0), 0,
(void (*)(const void *))keyboard_raw_interrupt,
(const void *)dev, 0);
return 0;
}