diff --git a/drivers/input/Kconfig.ft5336 b/drivers/input/Kconfig.ft5336 index 4b8eea98e148919..f817616a1d6024c 100644 --- a/drivers/input/Kconfig.ft5336 +++ b/drivers/input/Kconfig.ft5336 @@ -3,14 +3,15 @@ # SPDX-License-Identifier: Apache-2.0 menuconfig INPUT_FT5336 - bool "FT5XX6/FT6XX6 capacitive touch panel driver" + bool "FT3267/FT5XX6/FT6XX6 capacitive touch panel driver" default y depends on DT_HAS_FOCALTECH_FT5336_ENABLED select I2C help Enable driver for multiple Focaltech capacitive touch panel controllers. This driver should support FT5x06, FT5606, FT5x16, - FT6x06, Ft6x36, FT5x06i, FT5336, FT3316, FT5436i, FT5336i and FT5x46. + FT6x06, Ft6x36, FT5x06i, FT5336, FT3316, FT5436i, FT3267, + FT5336i and FT5x46. if INPUT_FT5336 diff --git a/drivers/input/input_ft5336.c b/drivers/input/input_ft5336.c index 6b05b9cf19481ee..6a6a7fdc9a891cb 100644 --- a/drivers/input/input_ft5336.c +++ b/drivers/input/input_ft5336.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 NXP + * Copyright (c) 2020,2023 NXP * Copyright (c) 2020 Mark Olsson * Copyright (c) 2020 Teslabs Engineering S.L. * @@ -39,6 +39,7 @@ LOG_MODULE_REGISTER(ft5336, CONFIG_INPUT_LOG_LEVEL); struct ft5336_config { /** I2C bus. */ struct i2c_dt_spec bus; + struct gpio_dt_spec reset_gpio; #ifdef CONFIG_INPUT_FT5336_INTERRUPT /** Interrupt GPIO information. */ struct gpio_dt_spec int_gpio; @@ -140,6 +141,7 @@ static int ft5336_init(const struct device *dev) { const struct ft5336_config *config = dev->config; struct ft5336_data *data = dev->data; + int r; if (!device_is_ready(config->bus.bus)) { LOG_ERR("I2C controller device not ready"); @@ -150,8 +152,23 @@ static int ft5336_init(const struct device *dev) k_work_init(&data->work, ft5336_work_handler); + if (config->reset_gpio.port != NULL) { + /* Enable reset GPIO, and pull down */ + r = gpio_pin_configure_dt(&config->reset_gpio, GPIO_OUTPUT_INACTIVE); + if (r < 0) { + LOG_ERR("Could not enable reset GPIO"); + return r; + } + /* Delay 5 ms to reset controller */ + k_sleep(K_MSEC(5)); + /* Pull reset pin high to complete reset sequence */ + r = gpio_pin_set_dt(&config->reset_gpio, 1); + if (r < 0) { + return r; + } + } + #ifdef CONFIG_INPUT_FT5336_INTERRUPT - int r; if (!device_is_ready(config->int_gpio.port)) { LOG_ERR("Interrupt GPIO controller device not ready"); @@ -189,6 +206,7 @@ static int ft5336_init(const struct device *dev) #define FT5336_INIT(index) \ static const struct ft5336_config ft5336_config_##index = { \ .bus = I2C_DT_SPEC_INST_GET(index), \ + .reset_gpio = GPIO_DT_SPEC_INST_GET_OR(index, reset_gpios, {0}), \ IF_ENABLED(CONFIG_INPUT_FT5336_INTERRUPT, \ (.int_gpio = GPIO_DT_SPEC_INST_GET(index, int_gpios),)) \ }; \ diff --git a/dts/bindings/input/focaltech,ft5336.yaml b/dts/bindings/input/focaltech,ft5336.yaml index 3898d182152363a..d58ba18df8096bb 100644 --- a/dts/bindings/input/focaltech,ft5336.yaml +++ b/dts/bindings/input/focaltech,ft5336.yaml @@ -1,7 +1,7 @@ -# Copyright (c) 2020 NXP +# Copyright (c) 2020,2023 NXP # SPDX-License-Identifier: Apache-2.0 -description: FT5XX6/FT6XX6 capacitive touch panels +description: FT3267/FT5XX6/FT6XX6 capacitive touch panels compatible: "focaltech,ft5336" @@ -10,3 +10,11 @@ include: i2c-device.yaml properties: int-gpios: type: phandle-array + description: | + Interrupt GPIO. Used by the controller to signal touch data is + available. Active low. + reset-gpios: + type: phandle-array + description: | + Reset GPIO. Used to reset the controller during initialization, and + to wake it from hibernation mode. Active low.