kscan: sdl: Convert driver over to devicetree

Move kscan SDL driver to be based on devicetree.  This is similar to
how the display SDL driver works.

Signed-off-by: Kumar Gala <galak@kernel.org>
This commit is contained in:
Kumar Gala 2022-08-11 14:38:52 -05:00 committed by Kumar Gala
commit 01c4e02240
5 changed files with 18 additions and 11 deletions

View file

@ -50,10 +50,6 @@ config UART_CONSOLE
endif # CONSOLE endif # CONSOLE
config KSCAN_SDL
default y
depends on KSCAN
config FLASH_SIMULATOR config FLASH_SIMULATOR
default y default y
depends on FLASH depends on FLASH

View file

@ -30,6 +30,7 @@
i2c-0 = &i2c0; i2c-0 = &i2c0;
spi-0 = &spi0; spi-0 = &spi0;
led0 = &led0; led0 = &led0;
kscan0 = &sdl_kscan;
}; };
leds { leds {
@ -181,6 +182,10 @@
width = <320>; width = <320>;
}; };
sdl_kscan: sdl_kscan {
compatible = "zephyr,sdl-kscan";
};
can_loopback0: can_loopback0 { can_loopback0: can_loopback0 {
status = "disabled"; status = "disabled";
compatible = "zephyr,can-loopback"; compatible = "zephyr,can-loopback";

View file

@ -3,12 +3,8 @@
config KSCAN_SDL config KSCAN_SDL
bool "SDL event filter for touch panel emulation" bool "SDL event filter for touch panel emulation"
default y
depends on DT_HAS_ZEPHYR_SDL_KSCAN_ENABLED
depends on HAS_SDL depends on HAS_SDL
help help
Enable driver for the SDL mouse event filter. Enable driver for the SDL mouse event filter.
config SDL_POINTER_KSCAN_DEV_NAME
string "SDL kscan device name"
depends on KSCAN_SDL
default LV_Z_POINTER_KSCAN_DEV_NAME if LVGL
default "SDL_KSCAN"

View file

@ -4,6 +4,8 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
#define DT_DRV_COMPAT zephyr_sdl_kscan
#include <zephyr/drivers/kscan.h> #include <zephyr/drivers/kscan.h>
#include <zephyr/logging/log.h> #include <zephyr/logging/log.h>
@ -106,7 +108,7 @@ static const struct kscan_driver_api sdl_driver_api = {
static struct sdl_data sdl_data; static struct sdl_data sdl_data;
DEVICE_DEFINE(sdl, CONFIG_SDL_POINTER_KSCAN_DEV_NAME, sdl_init, DEVICE_DT_INST_DEFINE(0, sdl_init,
NULL, &sdl_data, NULL, NULL, &sdl_data, NULL,
POST_KERNEL, CONFIG_KSCAN_INIT_PRIORITY, POST_KERNEL, CONFIG_KSCAN_INIT_PRIORITY,
&sdl_driver_api); &sdl_driver_api);

View file

@ -0,0 +1,8 @@
# Copyright (c) 2022 Kumar Gala <galak@kernel.org>
# SPDX-License-Identifier: Apache-2.0
description: SDL based emulated keyboard matrix devices
compatible: "zephyr,sdl-kscan"
include: kscan.yaml