Lines Matching +full:poll +full:- +full:timeout +full:- +full:ms

4  * SPDX-License-Identifier: Apache-2.0
47 const struct gpio_kbd_matrix_config *cfg = dev->config; in gpio_kbd_matrix_drive_column()
48 const struct input_kbd_matrix_common_config *common = &cfg->common; in gpio_kbd_matrix_drive_column()
49 struct gpio_kbd_matrix_data *data = dev->data; in gpio_kbd_matrix_drive_column()
55 state = BIT_MASK(common->col_size); in gpio_kbd_matrix_drive_column()
60 if (data->direct_write) { in gpio_kbd_matrix_drive_column()
61 const struct gpio_dt_spec *gpio0 = &cfg->col_gpio[0]; in gpio_kbd_matrix_drive_column()
65 gpio_mask = BIT_MASK(common->col_size) << gpio0->pin; in gpio_kbd_matrix_drive_column()
66 gpio_val = state << gpio0->pin; in gpio_kbd_matrix_drive_column()
68 gpio_port_set_masked(gpio0->port, gpio_mask, gpio_val); in gpio_kbd_matrix_drive_column()
73 for (int i = 0; i < common->col_size; i++) { in gpio_kbd_matrix_drive_column()
74 const struct gpio_dt_spec *gpio = &cfg->col_gpio[i]; in gpio_kbd_matrix_drive_column()
76 if ((data->last_col_state ^ state) & BIT(i)) { in gpio_kbd_matrix_drive_column()
77 if (cfg->col_drive_inactive) { in gpio_kbd_matrix_drive_column()
87 data->last_col_state = state; in gpio_kbd_matrix_drive_column()
92 const struct gpio_kbd_matrix_config *cfg = dev->config; in gpio_kbd_matrix_read_row()
93 const struct input_kbd_matrix_common_config *common = &cfg->common; in gpio_kbd_matrix_read_row()
94 struct gpio_kbd_matrix_data *data = dev->data; in gpio_kbd_matrix_read_row()
97 if (data->direct_read) { in gpio_kbd_matrix_read_row()
98 const struct gpio_dt_spec *gpio0 = &cfg->row_gpio[0]; in gpio_kbd_matrix_read_row()
101 gpio_port_get(gpio0->port, &gpio_val); in gpio_kbd_matrix_read_row()
103 return (gpio_val >> gpio0->pin) & BIT_MASK(common->row_size); in gpio_kbd_matrix_read_row()
106 for (int i = 0; i < common->row_size; i++) { in gpio_kbd_matrix_read_row()
107 const struct gpio_dt_spec *gpio = &cfg->row_gpio[i]; in gpio_kbd_matrix_read_row()
119 const struct gpio_kbd_matrix_config *cfg = dev->config; in gpio_kbd_matrix_idle_poll_handler()
120 const struct input_kbd_matrix_common_config *common = &cfg->common; in gpio_kbd_matrix_idle_poll_handler()
123 k_work_reschedule(cfg->idle_poll_dwork, in gpio_kbd_matrix_idle_poll_handler()
124 K_USEC(common->stable_poll_period_us)); in gpio_kbd_matrix_idle_poll_handler()
133 const struct gpio_kbd_matrix_config *cfg = dev->config; in gpio_kbd_matrix_set_detect_mode()
134 const struct input_kbd_matrix_common_config *common = &cfg->common; in gpio_kbd_matrix_set_detect_mode()
137 if (cfg->idle_poll_dwork != NULL) { in gpio_kbd_matrix_set_detect_mode()
139 k_work_reschedule(cfg->idle_poll_dwork, in gpio_kbd_matrix_set_detect_mode()
140 K_USEC(common->stable_poll_period_us)); in gpio_kbd_matrix_set_detect_mode()
145 if (cfg->gpio_cb == NULL) { in gpio_kbd_matrix_set_detect_mode()
149 for (int i = 0; i < common->row_size; i++) { in gpio_kbd_matrix_set_detect_mode()
150 const struct gpio_dt_spec *gpio = &cfg->row_gpio[i]; in gpio_kbd_matrix_set_detect_mode()
167 if (gpio[i].port != gpio0->port || in gpio_kbd_matrix_is_gpio_coherent()
168 gpio[i].dt_flags != gpio0->dt_flags || in gpio_kbd_matrix_is_gpio_coherent()
169 gpio[i].pin != gpio0->pin + i) { in gpio_kbd_matrix_is_gpio_coherent()
179 const struct gpio_kbd_matrix_config *cfg = dev->config; in gpio_kbd_continuous_scan_mode()
181 if (cfg->gpio_cb == NULL && cfg->idle_poll_dwork == NULL) { in gpio_kbd_continuous_scan_mode()
190 const struct gpio_kbd_matrix_config *cfg = dev->config; in gpio_kbd_matrix_init()
191 const struct input_kbd_matrix_common_config *common = &cfg->common; in gpio_kbd_matrix_init()
192 struct gpio_kbd_matrix_data *data = dev->data; in gpio_kbd_matrix_init()
196 for (i = 0; i < common->col_size; i++) { in gpio_kbd_matrix_init()
197 const struct gpio_dt_spec *gpio = &cfg->col_gpio[i]; in gpio_kbd_matrix_init()
200 LOG_ERR("%s is not ready", gpio->port->name); in gpio_kbd_matrix_init()
201 return -ENODEV; in gpio_kbd_matrix_init()
204 if (cfg->col_drive_inactive) { in gpio_kbd_matrix_init()
215 for (i = 0; i < common->row_size; i++) { in gpio_kbd_matrix_init()
216 const struct gpio_dt_spec *gpio = &cfg->row_gpio[i]; in gpio_kbd_matrix_init()
220 LOG_ERR("%s is not ready", gpio->port->name); in gpio_kbd_matrix_init()
221 return -ENODEV; in gpio_kbd_matrix_init()
230 if (cfg->gpio_cb == NULL) { in gpio_kbd_matrix_init()
233 gpio_cb = &cfg->gpio_cb[i]; in gpio_kbd_matrix_init()
235 gpio_init_callback(gpio_cb, cfg->gpio_cb_handler, in gpio_kbd_matrix_init()
236 BIT(gpio->pin)); in gpio_kbd_matrix_init()
245 if (cfg->idle_poll_dwork != NULL) { in gpio_kbd_matrix_init()
246 k_work_init_delayable(cfg->idle_poll_dwork, in gpio_kbd_matrix_init()
247 cfg->idle_poll_handler); in gpio_kbd_matrix_init()
250 data->direct_read = gpio_kbd_matrix_is_gpio_coherent( in gpio_kbd_matrix_init()
251 cfg->row_gpio, common->row_size); in gpio_kbd_matrix_init()
253 if (cfg->col_drive_inactive) { in gpio_kbd_matrix_init()
254 data->direct_write = gpio_kbd_matrix_is_gpio_coherent( in gpio_kbd_matrix_init()
255 cfg->col_gpio, common->col_size); in gpio_kbd_matrix_init()
259 data->direct_read, data->direct_write); in gpio_kbd_matrix_init()
280 BUILD_ASSERT(DT_INST_PROP_LEN(n, col_gpios) <= 32, "invalid col-size"); \
302 IF_ENABLED(DT_INST_ENUM_HAS_VALUE(n, idle_mode, poll), ( \
311 "poll-timeout-ms must be set to 0 for scan mode to work correctly"); \
324 IF_ENABLED(DT_INST_ENUM_HAS_VALUE(n, idle_mode, poll), ( \