driver: input: gt911: Support case that no dedicated reset pin
On some boards, there is not dedicated reset pin for GT911, it might be the same pin with display IC, or might be tighted to a high level voltage. This patch makes the rst_gpio can be empty. Signed-off-by: Jason Yu <zejiang.yu@nxp.com>
This commit is contained in:
parent
643c033a7f
commit
d5b1a7d929
|
@ -225,6 +225,7 @@ static int gt911_init(const struct device *dev)
|
|||
return -ENODEV;
|
||||
}
|
||||
|
||||
if (config->rst_gpio.port != NULL) {
|
||||
if (!gpio_is_ready_dt(&config->rst_gpio)) {
|
||||
LOG_ERR("Reset GPIO controller device not ready");
|
||||
return -ENODEV;
|
||||
|
@ -235,6 +236,7 @@ static int gt911_init(const struct device *dev)
|
|||
LOG_ERR("Could not configure reset GPIO pin");
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
if (config->alt_addr == 0x0) {
|
||||
/*
|
||||
|
@ -252,6 +254,7 @@ static int gt911_init(const struct device *dev)
|
|||
}
|
||||
/* Delay at least 10 ms after power on before we configure gt911 */
|
||||
k_sleep(K_MSEC(20));
|
||||
if (config->rst_gpio.port != NULL) {
|
||||
/* reset the device and confgiure the addr mode0 */
|
||||
gpio_pin_set_dt(&config->rst_gpio, 1);
|
||||
/* hold down at least 1us, 1ms here */
|
||||
|
@ -259,6 +262,7 @@ static int gt911_init(const struct device *dev)
|
|||
gpio_pin_set_dt(&config->rst_gpio, 0);
|
||||
/* hold down at least 5ms. This is the point the INT pin must be low. */
|
||||
k_sleep(K_MSEC(5));
|
||||
}
|
||||
/* hold down 50ms to make sure the address available */
|
||||
k_sleep(K_MSEC(50));
|
||||
|
||||
|
@ -359,7 +363,7 @@ static int gt911_init(const struct device *dev)
|
|||
#define GT911_INIT(index) \
|
||||
static const struct gt911_config gt911_config_##index = { \
|
||||
.bus = I2C_DT_SPEC_INST_GET(index), \
|
||||
.rst_gpio = GPIO_DT_SPEC_INST_GET(index, reset_gpios), \
|
||||
.rst_gpio = GPIO_DT_SPEC_INST_GET_OR(index, reset_gpios, {0}), \
|
||||
.int_gpio = GPIO_DT_SPEC_INST_GET(index, irq_gpios), \
|
||||
.alt_addr = DT_INST_PROP_OR(index, alt_addr, 0), \
|
||||
}; \
|
||||
|
|
Loading…
Reference in a new issue