From 5bacf096472d80dc900c3634d0d484d6d9bc3b3d Mon Sep 17 00:00:00 2001 From: LiZidong Date: Thu, 23 Mar 2023 21:55:05 +0800 Subject: [PATCH] Bangkok TP bring up add bangkok focaltech tp driver,add the focaltech driver vdd 3.3v and x16 resolution. Change-Id: Ib253920a10718b34fd934e51a11156fdc8180b03 Signed-off-by: LiZidong Reviewed-on: https://gerrit.mot.com/2551020 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Wei Deng Reviewed-by: Xiangpo Zhao Submit-Approved: Jira Key --- .../touchscreen/focaltech_touch_v3/Android.mk | 12 ++++ .../touchscreen/focaltech_touch_v3/Kbuild | 4 ++ .../focaltech_touch_v3/focaltech_core.c | 58 ++++++++++++++++++- .../focaltech_touch_v3/focaltech_core.h | 4 ++ 4 files changed, 77 insertions(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/focaltech_touch_v3/Android.mk b/drivers/input/touchscreen/focaltech_touch_v3/Android.mk index 3728a9d73252..e1d7103df925 100644 --- a/drivers/input/touchscreen/focaltech_touch_v3/Android.mk +++ b/drivers/input/touchscreen/focaltech_touch_v3/Android.mk @@ -44,6 +44,10 @@ ifeq ($(FTS_SUPPORT_HIGH_RESOLUTION),true) KBUILD_OPTIONS += CONFIG_FTS_SUPPORT_HIGH_RESOLUTION=y endif +ifeq ($(FTS_VDD_GPIO_CONTROL),true) + KBUILD_OPTIONS += CONFIG_FTS_VDD_GPIO_CONTROL=y +endif + ifeq ($(TOUCHSCREEN_LAST_TIME),true) KBUILD_OPTIONS += CONFIG_FTS_LAST_TIME=y endif @@ -67,6 +71,14 @@ ifneq ($(BOARD_USES_PEN_NOTIFIER),) KERNEL_CFLAGS += CONFIG_INPUT_FOCALTECH_V3_MMI_PEN_NOTIFIER=y endif +ifeq ($(FTS_SUPPORT_HIGH_RESOLUTION),true) + KERNEL_CFLAGS += CONFIG_FTS_SUPPORT_HIGH_RESOLUTION=y +endif + +ifeq ($(FTS_VDD_GPIO_CONTROL),true) + KERNEL_CFLAGS += CONFIG_FTS_VDD_GPIO_CONTROL=y +endif + ifneq ($(findstring touchscreen_mmi.ko,$(BOARD_VENDOR_KERNEL_MODULES)),) KERNEL_CFLAGS += CONFIG_INPUT_TOUCHSCREEN_MMI=y endif diff --git a/drivers/input/touchscreen/focaltech_touch_v3/Kbuild b/drivers/input/touchscreen/focaltech_touch_v3/Kbuild index cb44c40c25cf..2ed67ed7ddbe 100644 --- a/drivers/input/touchscreen/focaltech_touch_v3/Kbuild +++ b/drivers/input/touchscreen/focaltech_touch_v3/Kbuild @@ -63,6 +63,10 @@ ifneq ($(filter m y, $(CONFIG_FTS_SUPPORT_HIGH_RESOLUTION)),) EXTRA_CFLAGS += -DCONFIG_FTS_SUPPORT_HIGH_RESOLUTION endif +ifneq ($(filter m y, $(CONFIG_FTS_VDD_GPIO_CONTROL)),) + EXTRA_CFLAGS += -DCONFIG_FTS_VDD_GPIO_CONTROL +endif + ifneq ($(filter m y,$(CONFIG_FTS_LAST_TIME)),) EXTRA_CFLAGS += -DCONFIG_FTS_LAST_TIME endif diff --git a/drivers/input/touchscreen/focaltech_touch_v3/focaltech_core.c b/drivers/input/touchscreen/focaltech_touch_v3/focaltech_core.c index c5d8dd50ca7c..bcfb6915cc20 100644 --- a/drivers/input/touchscreen/focaltech_touch_v3/focaltech_core.c +++ b/drivers/input/touchscreen/focaltech_touch_v3/focaltech_core.c @@ -1477,6 +1477,41 @@ static int fts_pinctrl_select_release(struct fts_ts_data *ts) } #endif /* FTS_PINCTRL_EN */ + +#ifdef CONFIG_FTS_VDD_GPIO_CONTROL +static int fts_vdd_gpio_configure(struct fts_ts_data *data) +{ + int ret = 0; + + FTS_FUNC_ENTER(); + + if (gpio_is_valid(data->pdata->vdd_gpio)) { + printk("FTS feiyu enable 3.3v\n"); + ret = gpio_request(data->pdata->vdd_gpio, "fts_vdd_gpio"); + if (ret) { + FTS_ERROR("[GPIO]vdd_gpio request failed"); + //goto err_3v3_gpio_dir; + } + + ret = gpio_direction_output(data->pdata->vdd_gpio, 1); + if (ret) { + FTS_ERROR("[GPIO]set_direction for reset gpio failed"); + //goto err_3v3_gpio_dir; + } + } + + FTS_FUNC_EXIT(); + return 0; + +/*err_3v3_gpio_dir: + if (gpio_is_valid(data->pdata->reset_gpio)) + gpio_free(data->pdata->reset_gpio); + + return ret;*/ +} +#endif + + int fts_power_source_ctrl(struct fts_ts_data *ts_data, int enable) { int ret = 0; @@ -1503,6 +1538,14 @@ int fts_power_source_ctrl(struct fts_ts_data *ts_data, int enable) FTS_ERROR("enable vcc_i2c regulator failed,ret=%d", ret); } } + + +#ifdef CONFIG_FTS_VDD_GPIO_CONTROL + msleep(5); + fts_vdd_gpio_configure(ts_data); + msleep(3); +#endif + #if FTS_PINCTRL_EN fts_pinctrl_select_normal(ts_data); #endif @@ -1791,6 +1834,14 @@ static int fts_parse_dt(struct device *dev, struct fts_ts_platform_data *pdata) pdata->key_x_coords[2], pdata->key_y_coords[2]); } + +#ifdef CONFIG_FTS_VDD_GPIO_CONTROL + pdata->vdd_gpio = of_get_named_gpio_flags(np, "focaltech,vdd-gpio", + 0, &pdata->vdd_gpio_flags); + if (pdata->vdd_gpio < 0) + FTS_ERROR("Unable to get vdd_gpio"); +#endif + /* reset, irq gpio info */ pdata->reset_gpio = of_get_named_gpio_flags(np, "focaltech,reset-gpio", 0, &pdata->reset_gpio_flags); @@ -1819,8 +1870,13 @@ static int fts_parse_dt(struct device *dev, struct fts_ts_platform_data *pdata) if (pdata->pocket_mode_ctrl) FTS_INFO("Support fts touch pocket mode"); - FTS_INFO("max touch number:%d, irq gpio:%d, reset gpio:%d", +#ifdef CONFIG_FTS_VDD_GPIO_CONTROL + FTS_INFO("max touch number:%d, irq gpio:%d, reset gpio:%d, vdd_gpio:%d", + pdata->max_touch_number, pdata->irq_gpio, pdata->reset_gpio, pdata->vdd_gpio); +#else + FTS_INFO("max touch number:%d, irq gpio:%d, reset gpio:%d,", pdata->max_touch_number, pdata->irq_gpio, pdata->reset_gpio); +#endif FTS_FUNC_EXIT(); return 0; diff --git a/drivers/input/touchscreen/focaltech_touch_v3/focaltech_core.h b/drivers/input/touchscreen/focaltech_touch_v3/focaltech_core.h index 62a67fb64ac4..d714a0eab82e 100644 --- a/drivers/input/touchscreen/focaltech_touch_v3/focaltech_core.h +++ b/drivers/input/touchscreen/focaltech_touch_v3/focaltech_core.h @@ -142,6 +142,10 @@ struct fts_ts_platform_data { u32 irq_gpio_flags; u32 reset_gpio; u32 reset_gpio_flags; +#ifdef CONFIG_FTS_VDD_GPIO_CONTROL + u32 vdd_gpio; + u32 vdd_gpio_flags; +#endif bool have_key; u32 key_number; u32 keys[FTS_MAX_KEYS];