Skip to content

Commit 7daba22

Browse files
danieldegrassecarlescufi
authored andcommitted
drivers: kscan: fix GT911 support when not using interrupt
Fix support for GT911 touchscreen driver when not using interrupt. The controller still requires that the INT pin be set to input in order to correctly respond to I2C queries. Also, the GT911 requires that the INT pin is not configured until the RESET pin has been low at least 10 ms after reset, so add an additional delay during initialization to account for this. Signed-off-by: Daniel DeGrasse <[email protected]>
1 parent d8b8566 commit 7daba22

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/kscan/kscan_gt911.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,8 @@ static int gt911_init(const struct device *dev)
242242
LOG_ERR("Could not configure int GPIO pin");
243243
return r;
244244
}
245-
245+
/* Delay at least 10 ms after power on before we configure gt911 */
246+
k_sleep(K_MSEC(20));
246247
/* reset the device and confgiure the addr mode0 */
247248
gpio_pin_set_dt(&config->rst_gpio, 0);
248249
/* hold down at least 1us, 1ms here */
@@ -253,8 +254,6 @@ static int gt911_init(const struct device *dev)
253254
gpio_pin_set_dt(&config->int_gpio, 0);
254255
/* hold down 50ms to make sure the address available */
255256
k_sleep(K_MSEC(50));
256-
257-
#ifdef CONFIG_KSCAN_GT911_INTERRUPT
258257
if (!device_is_ready(config->int_gpio.port)) {
259258
LOG_ERR("Interrupt GPIO controller device not ready");
260259
return -ENODEV;
@@ -266,6 +265,7 @@ static int gt911_init(const struct device *dev)
266265
return r;
267266
}
268267

268+
#ifdef CONFIG_KSCAN_GT911_INTERRUPT
269269
r = gpio_pin_interrupt_configure_dt(&config->int_gpio,
270270
GPIO_INT_EDGE_TO_ACTIVE);
271271
if (r < 0) {

0 commit comments

Comments
 (0)