1111#include <zephyr/drivers/gpio.h>
1212#include <zephyr/drivers/i2c.h>
1313#include <zephyr/input/input.h>
14+ #include <zephyr/input/input_touch.h>
1415#include <zephyr/pm/device.h>
1516#include <zephyr/pm/device_runtime.h>
1617#include <zephyr/sys/util.h>
@@ -50,6 +51,7 @@ LOG_MODULE_REGISTER(ft5336, CONFIG_INPUT_LOG_LEVEL);
5051
5152/** FT5336 configuration (DT). */
5253struct ft5336_config {
54+ struct input_touchscreen_common_config common ;
5355 /** I2C bus. */
5456 struct i2c_dt_spec bus ;
5557 struct gpio_dt_spec reset_gpio ;
@@ -76,6 +78,8 @@ struct ft5336_data {
7678 bool pressed_old ;
7779};
7880
81+ INPUT_TOUCH_STRUCT_CHECK (struct ft5336_config );
82+
7983static int ft5336_process (const struct device * dev )
8084{
8185 const struct ft5336_config * config = dev -> config ;
@@ -126,8 +130,7 @@ static int ft5336_process(const struct device *dev)
126130 }
127131
128132 if (pressed ) {
129- input_report_abs (dev , INPUT_ABS_X , col , false, K_FOREVER );
130- input_report_abs (dev , INPUT_ABS_Y , row , false, K_FOREVER );
133+ input_touchscreen_report_pos (dev , col , row , K_FOREVER );
131134 input_report_key (dev , INPUT_BTN_TOUCH , 1 , true, K_FOREVER );
132135 } else if (data -> pressed_old && !pressed ) {
133136 input_report_key (dev , INPUT_BTN_TOUCH , 0 , true, K_FOREVER );
@@ -293,6 +296,7 @@ static int ft5336_pm_action(const struct device *dev,
293296#define FT5336_INIT (index ) \
294297 PM_DEVICE_DT_INST_DEFINE(n, ft5336_pm_action); \
295298 static const struct ft5336_config ft5336_config_##index = { \
299+ .common = INPUT_TOUCH_DT_INST_COMMON_CONFIG_INIT(index), \
296300 .bus = I2C_DT_SPEC_INST_GET(index), \
297301 .reset_gpio = GPIO_DT_SPEC_INST_GET_OR(index, reset_gpios, {0}), \
298302 IF_ENABLED(CONFIG_INPUT_FT5336_INTERRUPT, \
0 commit comments