diff --git a/drivers/input/touchscreen/focaltech_0flash_v2_mmi/Android.mk b/drivers/input/touchscreen/focaltech_0flash_v2_mmi/Android.mk index 02fcf6483c74..d56731ee1a71 100644 --- a/drivers/input/touchscreen/focaltech_0flash_v2_mmi/Android.mk +++ b/drivers/input/touchscreen/focaltech_0flash_v2_mmi/Android.mk @@ -11,6 +11,10 @@ ifneq ($(BOARD_USES_DOUBLE_TAP),) KERNEL_CFLAGS += CONFIG_INPUT_FOCALTECH_0FLASH_MMI_ENABLE_DOUBLE_TAP=y endif +ifneq ($(MOTO_PANEL_CHECK_TOUCH_STATE),) + KERNEL_CFLAGS += CONFIG_INPUT_FOCALTECH_0FLASH_MMI_NOTIFY_TOUCH_STATE=y +endif + ifneq ($(FOCALTECH_ESDCHECK_ENABLE),) KERNEL_CFLAGS += CONFIG_INPUT_FOCALTECH_ESD_EN=y endif @@ -28,4 +32,8 @@ LOCAL_MODULE := focaltech_0flash_v2_mmi.ko LOCAL_MODULE_TAGS := optional LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT) +ifneq ($(BOARD_USES_DOUBLE_TAP),) +LOCAL_ADDITIONAL_DEPENDENCIES += $(KERNEL_MODULES_OUT)/sensors_class.ko +endif + include $(DLKM_DIR)/AndroidKernelModule.mk diff --git a/drivers/input/touchscreen/focaltech_0flash_v2_mmi/Kbuild b/drivers/input/touchscreen/focaltech_0flash_v2_mmi/Kbuild index cfe44d361c09..f31fdf6df54f 100644 --- a/drivers/input/touchscreen/focaltech_0flash_v2_mmi/Kbuild +++ b/drivers/input/touchscreen/focaltech_0flash_v2_mmi/Kbuild @@ -1,8 +1,8 @@ # add -Wall to try to catch everything we can. EXTRA_CFLAGS += -Wall -EXTRA_CFLAGS += -I$(TOP)/motorola/kernel/modules/include \ - -I$(TOP)/motorola/kernel/modules/drivers/input/touchscreen/focaltech_0flash_v2_mmi \ - -I$(TOP)/motorola/kernel/modules/drivers/input/touchscreen/focaltech_0flash_v2_mmi/include +EXTRA_CFLAGS += -I$(ANDROID_BUILD_TOP)/motorola/kernel/modules/include \ + -I$(ANDROID_BUILD_TOP)/motorola/kernel/modules/drivers/input/touchscreen/focaltech_0flash_v2_mmi \ + -I$(ANDROID_BUILD_TOP)/motorola/kernel/modules/drivers/input/touchscreen/focaltech_0flash_v2_mmi/include obj-m := focaltech_0flash_v2_mmi.o focaltech_0flash_v2_mmi-objs += focaltech_core.o @@ -16,6 +16,11 @@ focaltech_0flash_v2_mmi-objs += focaltech_spi.o ifneq ($(filter m y,$(CONFIG_INPUT_FOCALTECH_0FLASH_MMI_ENABLE_DOUBLE_TAP)),) EXTRA_CFLAGS += -DFOCALTECH_SENSOR_EN + KBUILD_EXTRA_SYMBOLS += $(CURDIR)/$(KBUILD_EXTMOD)/../../../sensors/$(GKI_OBJ_MODULE_DIR)/Module.symvers +endif + +ifneq ($(filter m y,$(CONFIG_INPUT_FOCALTECH_0FLASH_MMI_NOTIFY_TOUCH_STATE)),) + EXTRA_CFLAGS += -DFTS_SET_TOUCH_STATE endif ifneq ($(filter m y,$(CONFIG_INPUT_FOCALTECH_ESD_EN)),) @@ -30,3 +35,7 @@ ifneq ($(filter m y,$(CONFIG_INPUT_FOCALTECH_DEBUG_EN)),) EXTRA_CFLAGS += -DFOCALTECH_DEBUG_EN endif +ifneq ($(filter ft8057,$(CONFIG_INPUT_FOCALTECH_0FLASH_MMI_IC_NAME)),) +EXTRA_CFLAGS += -DCONFIG_INPUT_FOCALTECH_0FLASH_MMI_IC_NAME_FT8057 +endif + diff --git a/drivers/input/touchscreen/focaltech_0flash_v2_mmi/focaltech_common.h b/drivers/input/touchscreen/focaltech_0flash_v2_mmi/focaltech_common.h index 0cdf37aa333e..855e3e29387f 100644 --- a/drivers/input/touchscreen/focaltech_0flash_v2_mmi/focaltech_common.h +++ b/drivers/input/touchscreen/focaltech_0flash_v2_mmi/focaltech_common.h @@ -59,6 +59,9 @@ #if defined(CONFIG_INPUT_FOCALTECH_0FLASH_MMI_IC_NAME_FT8726) #define FTS_CHIP_TYPE_MAPPING {{0x1C, 0x87, 0x20, 0x87, 0x20, 0x87, 0xA0, 0x00, 0x00}} #define FTS_CHIP_ID_MAPPING {{0x1C, {0x8726, 0x872A, 0x872B}}} +#elif defined(CONFIG_INPUT_FOCALTECH_0FLASH_MMI_IC_NAME_FT8057) +#define FTS_CHIP_TYPE_MAPPING {{0x28, 0x80, 0x57, 0x80, 0x57, 0x80, 0xA7, 0x00, 0x00}} +#define FTS_CHIP_ID_MAPPING {{0x1C, {0x8726, 0x872A, 0x872B}}} #else #define FTS_CHIP_TYPE_MAPPING {{0x1C, 0x87, 0x20, 0x87, 0x20, 0x87, 0xA0, 0x00, 0x00}} #define FTS_CHIP_ID_MAPPING {{0x1C, {0x8726, 0x872A, 0x872B}}} diff --git a/drivers/input/touchscreen/focaltech_0flash_v2_mmi/focaltech_config.h b/drivers/input/touchscreen/focaltech_0flash_v2_mmi/focaltech_config.h index af93102ae1f2..b10920cafc61 100644 --- a/drivers/input/touchscreen/focaltech_0flash_v2_mmi/focaltech_config.h +++ b/drivers/input/touchscreen/focaltech_0flash_v2_mmi/focaltech_config.h @@ -70,6 +70,8 @@ #define _FT7250AB 0x7250B824 #define _FT7130 0x71300825 #define _FT8205 0x82050826 +#define _FT8057 0x80570828 + @@ -185,6 +187,9 @@ #if defined(CONFIG_INPUT_FOCALTECH_0FLASH_MMI_IC_NAME_FT8726) #define FTS_CHIP_TYPE _FT8726 #define FTS_CHIP_NAME "ft8726" +#elif defined(CONFIG_INPUT_FOCALTECH_0FLASH_MMI_IC_NAME_FT8057) +#define FTS_CHIP_TYPE _FT8057 +#define FTS_CHIP_NAME "ft8057" #else #define FTS_CHIP_TYPE _FT8726 #define FTS_CHIP_NAME "ft8726" diff --git a/drivers/input/touchscreen/focaltech_0flash_v2_mmi/focaltech_core.c b/drivers/input/touchscreen/focaltech_0flash_v2_mmi/focaltech_core.c index a3102541683b..3c2b17967b92 100644 --- a/drivers/input/touchscreen/focaltech_0flash_v2_mmi/focaltech_core.c +++ b/drivers/input/touchscreen/focaltech_0flash_v2_mmi/focaltech_core.c @@ -2442,6 +2442,9 @@ static void __exit fts_ts_exit(void) module_init(fts_ts_init); module_exit(fts_ts_exit); +#if KERNEL_VERSION(5, 4, 0) <= LINUX_VERSION_CODE +MODULE_IMPORT_NS(VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver); +#endif MODULE_AUTHOR("FocalTech Driver Team"); MODULE_DESCRIPTION("FocalTech Touchscreen Driver"); MODULE_LICENSE("GPL v2"); diff --git a/drivers/input/touchscreen/focaltech_0flash_v2_mmi/focaltech_core.h b/drivers/input/touchscreen/focaltech_0flash_v2_mmi/focaltech_core.h index 6d0703d95214..7acaed121cf2 100644 --- a/drivers/input/touchscreen/focaltech_0flash_v2_mmi/focaltech_core.h +++ b/drivers/input/touchscreen/focaltech_0flash_v2_mmi/focaltech_core.h @@ -285,6 +285,18 @@ struct fts_ts_data { #endif }; +#ifdef FTS_SET_TOUCH_STATE +enum touch_panel_id { + TOUCH_PANEL_IDX_PRIMARY = 0, + TOUCH_PANEL_MAX_IDX, +}; + +enum touch_state { + TOUCH_DEEP_SLEEP_STATE = 0, + TOUCH_LOW_POWER_STATE, +}; +#endif + enum _FTS_BUS_TYPE { BUS_TYPE_NONE, BUS_TYPE_I2C, @@ -356,6 +368,11 @@ void fts_esdcheck_suspend(struct fts_ts_data *ts_data); void fts_esdcheck_resume(struct fts_ts_data *ts_data); #endif +#ifdef FTS_SET_TOUCH_STATE +int touch_set_state(int state, int panel_idx); +int check_touch_state(int *state, int panel_idx); +#endif + /* Host test */ /* Point Report Check*/ diff --git a/drivers/input/touchscreen/focaltech_0flash_v2_mmi/focaltech_flash.c b/drivers/input/touchscreen/focaltech_0flash_v2_mmi/focaltech_flash.c index 711e6b4da115..d1bb667d93e0 100644 --- a/drivers/input/touchscreen/focaltech_0flash_v2_mmi/focaltech_flash.c +++ b/drivers/input/touchscreen/focaltech_0flash_v2_mmi/focaltech_flash.c @@ -85,6 +85,7 @@ struct upgrade_setting_nf upgrade_setting_list[] = { {0xF0, 0xC6, 0, (84 * 1024), (128 * 1024), 0xA5, 0x01, 8, 0, 2, 0, 1, 0}, {0x56, 0x62, 0, (128 * 1024), (128 * 1024), 0xA5, 0x01, 8, 0, 4, 0, 0, 5}, {0x82, 0x05, 0, (120 * 1024), (128 * 1024), 0xA5, 0x01, 8, 0, 2, 0, 0, 0}, + {0x80, 0x57, 0, (84 * 1024), (128 * 1024), 0xA5, 0x01, 8, 0, 2, 0, 1, 0}, }; struct fts_upgrade *fwupgrade; @@ -767,7 +768,11 @@ static int fts_read_file_default(char *file_name, u8 **file_buf) old_fs = get_fs(); set_fs(KERNEL_DS); pos = 0; - ret = vfs_read(filp, *file_buf, file_len , &pos); +#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)) + ret = vfs_read(filp, *file_buf, file_len, &pos); +#else + ret = kernel_read(filp, *file_buf, file_len , &pos); +#endif if (ret < 0) FTS_ERROR("read file fail"); FTS_INFO("file len:%d read len:%d pos:%d", (u32)file_len, ret, (u32)pos);