Commit Graph

15 Commits

Author SHA1 Message Date
Fabio Baltieri c0e6629b7b input: npcx_kbd: setup the interrupt to falling edge only
The driver works on active low signals only, change the interrupt
configuration to trigger on falling edges only.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-12-20 18:07:43 +00:00
Fabio Baltieri 0442fe3bbf 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: Fabio Baltieri <fabiobaltieri@google.com>
2023-12-19 10:57:38 +00:00
Fabio Baltieri c161253287 drivers: input: fix few types
Fix few wrong types in various input drivers.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-12-06 09:25:49 +00:00
Fabio Baltieri adcb2f580c input: gpio_kbd_matrix: define a type for the row data
Add a typedef for the row type rather than using uint8_t directly, this
allow supporting bigger matrix as an option by using a different type.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-11-22 09:52:39 +01:00
Fabio Baltieri 958cd4ff53 input: kbd_matrix,npcx: drop explicit LOG_LEVEL define
Use the LOG_MODULE_REGISTER argument instead.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-11-17 08:25:27 +00:00
Fabio Baltieri a089fa241f input: npcx: drop the input_ prefix from the internal functions
Drop the input_ prefix fromthe internal functions. Trying to unify the
input drivers to use the same style for function naming, this makes it a
bit more compact and makes it easier to distinguish the common keyboard
structures and functions from the driver ones.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-11-16 09:30:34 +01:00
Fabio Baltieri be5cb7af7c input: kbd_matrix: move the header to the project wide include directory
Move the input_kbd_matrix.h header out of drivers/ and into include/,
this allows external drivers to use it and doxygen to pick it up.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-11-15 11:41:25 +01:00
Fabio Baltieri 0c00b6e0ab input: kbd_matrix: make the api field a pointer
The API field of input_kbd_matrix_common_config should have been a
pointer from the start, clang-16 caught this with a compiler warning.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-11-15 11:41:25 +01:00
Fabio Baltieri 9439c816e9 input: split npcx generic keyboard code into input_kbd_matrix.c
Move all the generic code from the Nuvoton NPCX keyboard scanning driver
into input_kbd_matrix.c. While doing that convert few configs into
devicetree properties and tweak few other things to enable the generic
code to support multiple instances.

This is limited to 8 rows for now, and that's fine for all the current
in-tree drivers, the limit could be removed down the road but this
should be fine for now, added few generic build checks to make sure a
driver does not go over the limit, as well and some more implementation
specific checks.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-11-13 09:45:28 +01:00
Fabio Baltieri d3d484c473 input: add some initial keyboard matrix library stubs
We currently have three keyboard scanning drivers in the code base
(npcx, it8xxx2 and mchp_xec, last two yet to be converted to input).
These have been largely copy pasted from each other and share a lot of
the same structure and code.

This PR lays a foundation to start decoupling feature from those drivers
into a common code base, and it is heavily inspired by the current
regulator common data/config one.

Feature wise this only moves the thread struct, stack and initialization
to the common code and declares the thread callback as the only API, but
the intent is to move as much code as possible in there an only abstract
device specific callbacks in the api structures.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-10-31 09:00:27 +01:00
Benedikt Schmidt a03f1010b8 drivers: fix thread function signatures
Fix thread function signatures to avoid stack corruption on thread exit.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-10-30 12:24:34 +01:00
Nicolas Pitre 531aa5786d drivers: move to timepoint API
Remove sys_clock_timeout_end_calc() usage.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2023-07-25 09:12:26 +02:00
Fabio Baltieri 72617437d0 input: npcx_kbd: set the thread name
Set a thread name for the npcx keyboard scan task so it can easily be
identified in the stack dump shell command.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-05-18 09:32:33 +02:00
Fabio Baltieri d48d4a53e7 input: npcx_kbd: various coding style fixes
Various coding style fixes, typos, and others on the NPCX keyboard scan
driver. No functional changes.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-05-18 09:32:33 +02:00
Fabio Baltieri e4780ef02d input: convert the Nuvoton npcx keyboard scan driver to input
Convert the NPCX keyboard scan driver to the input subsystem and add the
input to kscan compatibility driver to maintain functionality with the
current API.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-05-18 09:32:33 +02:00