Lines Matching +full:controller +full:- +full:data +full:- +full:delay +full:- +full:us
6 * SPDX-License-Identifier: Apache-2.0
52 /** GT911 data. */
82 * Device-specific wrappers around i2c_write_dt and i2c_write_read_dt.
88 const struct gt911_config *config = dev->config; in gt911_i2c_write()
89 struct gt911_data *data = dev->data; in gt911_i2c_write() local
91 return i2c_write(config->bus.bus, buf, num_bytes, data->actual_address); in gt911_i2c_write()
97 const struct gt911_config *config = dev->config; in gt911_i2c_write_read()
98 struct gt911_data *data = dev->data; in gt911_i2c_write_read() local
100 return i2c_write_read(config->bus.bus, data->actual_address, write_buf, num_write, read_buf, in gt911_i2c_write_read()
131 * Note- since we program the max number of touch inputs during init, in gt911_process()
132 * the controller won't report more than the maximum number of touch in gt911_process()
200 struct gt911_data *data = CONTAINER_OF(work, struct gt911_data, work); in gt911_work_handler() local
202 gt911_process(data->dev); in gt911_work_handler()
208 struct gt911_data *data = CONTAINER_OF(cb, struct gt911_data, int_gpio_cb); in gt911_isr_handler() local
210 k_work_submit(&data->work); in gt911_isr_handler()
215 struct gt911_data *data = CONTAINER_OF(timer, struct gt911_data, timer); in gt911_timer_handler() local
217 k_work_submit(&data->work); in gt911_timer_handler()
226 for (i = 0; i < REG_CONFIG_SIZE - 2U; i++) { in gt911_get_firmware_checksum()
236 return ((firmware[REG_CONFIG_VERSION - REG_GT911_CONFIG] != 0U) && in gt911_verify_firmware()
237 (gt911_get_firmware_checksum(firmware) == firmware[REG_CONFIG_SIZE - 2U])); in gt911_verify_firmware()
242 const struct gt911_config *config = dev->config; in gt911_init()
243 struct gt911_data *data = dev->data; in gt911_init() local
245 if (!i2c_is_ready_dt(&config->bus)) { in gt911_init()
246 LOG_ERR("I2C controller device not ready"); in gt911_init()
247 return -ENODEV; in gt911_init()
250 data->dev = dev; in gt911_init()
251 data->actual_address = config->bus.addr; in gt911_init()
253 k_work_init(&data->work, gt911_work_handler); in gt911_init()
257 if (!gpio_is_ready_dt(&config->int_gpio)) { in gt911_init()
258 LOG_ERR("Interrupt GPIO controller device not ready"); in gt911_init()
259 return -ENODEV; in gt911_init()
262 if (config->rst_gpio.port != NULL) { in gt911_init()
263 if (!gpio_is_ready_dt(&config->rst_gpio)) { in gt911_init()
264 LOG_ERR("Reset GPIO controller device not ready"); in gt911_init()
265 return -ENODEV; in gt911_init()
268 r = gpio_pin_configure_dt(&config->rst_gpio, GPIO_OUTPUT_ACTIVE); in gt911_init()
276 * We need to configure the int-pin to 0, in order to enter the in gt911_init()
284 r = gpio_pin_configure_dt(&config->int_gpio, GPIO_OUTPUT_INACTIVE); in gt911_init()
289 /* Delay at least 10 ms after power on before we configure gt911 */ in gt911_init()
291 if (config->rst_gpio.port != NULL) { in gt911_init()
293 gpio_pin_set_dt(&config->rst_gpio, 1); in gt911_init()
294 /* hold down at least 1us, 1ms here */ in gt911_init()
296 gpio_pin_set_dt(&config->rst_gpio, 0); in gt911_init()
303 r = gpio_pin_configure_dt(&config->int_gpio, GPIO_INPUT); in gt911_init()
310 r = gpio_pin_interrupt_configure_dt(&config->int_gpio, GPIO_INT_EDGE_TO_ACTIVE); in gt911_init()
316 gpio_init_callback(&data->int_gpio_cb, gt911_isr_handler, BIT(config->int_gpio.pin)); in gt911_init()
318 k_timer_init(&data->timer, gt911_timer_handler, NULL); in gt911_init()
325 if (config->alt_addr != 0x0) { in gt911_init()
337 data->actual_address = config->alt_addr; in gt911_init()
342 data->actual_address); in gt911_init()
353 return -ENODEV; in gt911_init()
367 return -ENODEV; in gt911_init()
383 r = gpio_add_callback(config->int_gpio.port, &data->int_gpio_cb); in gt911_init()
389 k_timer_start(&data->timer, K_MSEC(CONFIG_INPUT_GT911_PERIOD_MS), in gt911_init()