Skip to content

Commit 6547dee

Browse files
laudominikChromeos LUCI
authored andcommitted
drivers: input: use generic touch report in ft5336
Adds the use of generic touch reporting method for ft5336 driver. (cherry picked from commit 40e64f1) Original-Signed-off-by: Dominik Lau <[email protected]> Original-Signed-off-by: Filip Kokosinski <[email protected]> GitOrigin-RevId: 40e64f1 Cr-Build-Id: 8738238973287044049 Cr-Build-Url: https://cr-buildbucket.appspot.com/build/8738238973287044049 Copybot-Job-Name: zephyr-main-copybot-downstream Change-Id: I813c157d5c195ebd9b4fac6090a1751dba36f76c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5827584 Tested-by: ChromeOS Prod (Robot) <[email protected]> Commit-Queue: Ting Shen <[email protected]> Reviewed-by: Ting Shen <[email protected]> Tested-by: Ting Shen <[email protected]>
1 parent fc0d496 commit 6547dee

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

drivers/input/Kconfig.ft5336

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ menuconfig INPUT_FT5336
77
default y
88
depends on DT_HAS_FOCALTECH_FT5336_ENABLED
99
select I2C
10+
select INPUT_TOUCH
1011
help
1112
Enable driver for multiple Focaltech capacitive touch panel
1213
controllers. This driver should support FT5x06, FT5606, FT5x16,

drivers/input/input_ft5336.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
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). */
5253
struct 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+
7983
static 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, \

dts/bindings/input/focaltech,ft5336.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: FT3267/FT5XX6/FT6XX6 capacitive touch panels
55

66
compatible: "focaltech,ft5336"
77

8-
include: i2c-device.yaml
8+
include: [i2c-device.yaml, touchscreen-common.yaml]
99

1010
properties:
1111
int-gpios:

0 commit comments

Comments
 (0)