Rename kscan direct wired driver polling kscan flag in preparationfor addition of new matrix driver flag that enables polling.

This commit is contained in:
Jason Chestnut 2020-09-24 07:55:32 -04:00
parent 31af9646e6
commit 53425aa3c4
2 changed files with 11 additions and 11 deletions

View file

@ -5,11 +5,11 @@ config ZMK_KSCAN_GPIO_DRIVER
if ZMK_KSCAN_GPIO_DRIVER if ZMK_KSCAN_GPIO_DRIVER
config ZMK_KSCAN_GPIO_POLLING config ZMK_KSCAN_MATRIX_POLLING
bool "Poll for key event triggers instead of using interrupts" bool "Poll for key event triggers instead of using interrupts"
default n default n
config ZMK_KSCAN_GPIO_MATRIX_POLLING config ZMK_KSCAN_DIRECT_POLLING
bool "Poll for key event triggers instead of using interrupts on matrix boards." bool "Poll for key event triggers instead of using interrupts on matrix boards."
default n default n

View file

@ -33,9 +33,9 @@ struct kscan_gpio_config {
}; };
struct kscan_gpio_data { struct kscan_gpio_data {
#if defined(CONFIG_ZMK_KSCAN_GPIO_POLLING) #if defined(ZMK_KSCAN_DIRECT_POLLING)
struct k_timer poll_timer; struct k_timer poll_timer;
#endif /* defined(CONFIG_ZMK_KSCAN_GPIO_POLLING) */ #endif /* defined(ZMK_KSCAN_DIRECT_POLLING) */
kscan_callback_t callback; kscan_callback_t callback;
union work_reference work; union work_reference work;
struct device *dev; struct device *dev;
@ -53,7 +53,7 @@ static const struct kscan_gpio_item_config *kscan_gpio_input_configs(struct devi
return cfg->inputs; return cfg->inputs;
} }
#if !defined(CONFIG_ZMK_KSCAN_GPIO_POLLING) #if !defined(ZMK_KSCAN_DIRECT_POLLING)
struct kscan_gpio_irq_callback { struct kscan_gpio_irq_callback {
union work_reference *work; union work_reference *work;
@ -101,7 +101,7 @@ static void kscan_gpio_irq_callback_handler(struct device *dev, struct gpio_call
} }
} }
#else /* !defined(CONFIG_ZMK_KSCAN_GPIO_POLLING) */ #else /* !defined(ZMK_KSCAN_DIRECT_POLLING) */
static void kscan_gpio_timer_handler(struct k_timer *timer) { static void kscan_gpio_timer_handler(struct k_timer *timer) {
struct kscan_gpio_data *data = CONTAINER_OF(timer, struct kscan_gpio_data, poll_timer); struct kscan_gpio_data *data = CONTAINER_OF(timer, struct kscan_gpio_data, poll_timer);
@ -120,7 +120,7 @@ static int kscan_gpio_direct_disable(struct device *dev) {
return 0; return 0;
} }
#endif /* defined(CONFIG_ZMK_KSCAN_GPIO_POLLING) */ #endif /* defined(ZMK_KSCAN_DIRECT_POLLING) */
static int kscan_gpio_direct_configure(struct device *dev, kscan_callback_t callback) { static int kscan_gpio_direct_configure(struct device *dev, kscan_callback_t callback) {
struct kscan_gpio_data *data = dev->driver_data; struct kscan_gpio_data *data = dev->driver_data;
@ -173,7 +173,7 @@ static const struct kscan_driver_api gpio_driver_api = {
#define INST_INPUT_LEN(n) DT_INST_PROP_LEN(n, input_gpios) #define INST_INPUT_LEN(n) DT_INST_PROP_LEN(n, input_gpios)
#define GPIO_INST_INIT(n) \ #define GPIO_INST_INIT(n) \
COND_CODE_0(CONFIG_ZMK_KSCAN_GPIO_POLLING, \ COND_CODE_0(ZMK_KSCAN_DIRECT_POLLING, \
(static struct kscan_gpio_irq_callback irq_callbacks_##n[INST_INPUT_LEN(n)];), ()) \ (static struct kscan_gpio_irq_callback irq_callbacks_##n[INST_INPUT_LEN(n)];), ()) \
static struct kscan_gpio_data kscan_gpio_data_##n = { \ static struct kscan_gpio_data kscan_gpio_data_##n = { \
.inputs = {[INST_INPUT_LEN(n) - 1] = NULL}}; \ .inputs = {[INST_INPUT_LEN(n) - 1] = NULL}}; \
@ -195,7 +195,7 @@ static const struct kscan_driver_api gpio_driver_api = {
return err; \ return err; \
} \ } \
COND_CODE_0( \ COND_CODE_0( \
CONFIG_ZMK_KSCAN_GPIO_POLLING, \ ZMK_KSCAN_DIRECT_POLLING, \
(irq_callbacks_##n[i].work = &data->work; \ (irq_callbacks_##n[i].work = &data->work; \
irq_callbacks_##n[i].debounce_period = cfg->debounce_period; \ irq_callbacks_##n[i].debounce_period = cfg->debounce_period; \
gpio_init_callback(&irq_callbacks_##n[i].callback, \ gpio_init_callback(&irq_callbacks_##n[i].callback, \
@ -208,7 +208,7 @@ static const struct kscan_driver_api gpio_driver_api = {
()) \ ()) \
} \ } \
data->dev = dev; \ data->dev = dev; \
COND_CODE_1(CONFIG_ZMK_KSCAN_GPIO_POLLING, \ COND_CODE_1(ZMK_KSCAN_DIRECT_POLLING, \
(k_timer_init(&data->poll_timer, kscan_gpio_timer_handler, NULL);), ()) \ (k_timer_init(&data->poll_timer, kscan_gpio_timer_handler, NULL);), ()) \
if (cfg->debounce_period > 0) { \ if (cfg->debounce_period > 0) { \
k_delayed_work_init(&data->work.delayed, kscan_gpio_work_handler); \ k_delayed_work_init(&data->work.delayed, kscan_gpio_work_handler); \