From 2c3be288918322ba162bbc058f3d751536f8df85 Mon Sep 17 00:00:00 2001 From: longc Date: Thu, 20 Jul 2023 11:55:59 +0800 Subject: [PATCH] tp:fogona 2nd tp bringup[2/4] WHY:tp bringup HOW:add tp driver Change-Id: Ie96309e9508f91aa0c941127d87eb6a3e4372b00 Reviewed-on: https://gerrit.mot.com/2682411 Reviewed-by: Xiangpo Zhao Reviewed-by: Yan Zhang SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Submit-Approved: Jira Key --- .../touchscreen/nova_0flash_mmi/Android.mk | 1 + .../nova_0flash_mmi/nt36xxx_fw_update.c | 2 -- .../nova_0flash_mmi/nt36xxx_mmi_class.c | 4 ++-- .../nova_0flash_mmi/nt36xxx_mp_ctrlram.c | 22 ++++++++++++++++--- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/drivers/input/touchscreen/nova_0flash_mmi/Android.mk b/drivers/input/touchscreen/nova_0flash_mmi/Android.mk index b3ca01349708..9c1db7d9426e 100644 --- a/drivers/input/touchscreen/nova_0flash_mmi/Android.mk +++ b/drivers/input/touchscreen/nova_0flash_mmi/Android.mk @@ -33,6 +33,7 @@ endif ifeq ($(CONFIG_INPUT_NOVA_USES_CHIP_VER_1),true) KERNEL_CFLAGS += CONFIG_INPUT_NOVA_CHIP_VER_1=y + KBUILD_OPTIONS += CONFIG_INPUT_NOVA_CHIP_VER_1=y endif ifeq ($(CONFIG_INPUT_NOVA_ESD_ENABLE),true) diff --git a/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx_fw_update.c b/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx_fw_update.c index 52e97bbb46f7..e0e5b6eab98d 100644 --- a/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx_fw_update.c +++ b/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx_fw_update.c @@ -630,7 +630,6 @@ return: static int32_t nvt_write_firmware(const u8 *fwdata, size_t fwsize) { uint32_t list = 0; - char *name; uint32_t BIN_addr, SRAM_addr, size; int32_t ret = 0; @@ -641,7 +640,6 @@ static int32_t nvt_write_firmware(const u8 *fwdata, size_t fwsize) SRAM_addr = bin_map[list].SRAM_addr; size = bin_map[list].size; BIN_addr = bin_map[list].BIN_addr; - name = bin_map[list].name; // NVT_LOG("[%d][%s] SRAM (0x%08X), SIZE (0x%08X), BIN (0x%08X)\n", // list, name, SRAM_addr, size, BIN_addr); diff --git a/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx_mmi_class.c b/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx_mmi_class.c index f11b96e3d14b..174ea289b0bf 100644 --- a/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx_mmi_class.c +++ b/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx_mmi_class.c @@ -448,10 +448,10 @@ static int nvt_mmi_methods_get_config_id(struct device *dev, void *cdata) static int nvt_mmi_methods_get_bus_type(struct device *dev, void *idata) { struct nvt_ts_data *ts_data; - struct input_dev *input_dev; + GET_TS_DATA(dev); - input_dev = ts_data->input_dev; + TO_INT(idata) = ts->input_dev->id.bustype == BUS_SPI ? TOUCHSCREEN_MMI_BUS_TYPE_SPI : TOUCHSCREEN_MMI_BUS_TYPE_I2C; return 0; diff --git a/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx_mp_ctrlram.c b/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx_mp_ctrlram.c index 7420ffd3ac64..af4ab5107108 100644 --- a/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx_mp_ctrlram.c +++ b/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx_mp_ctrlram.c @@ -359,9 +359,11 @@ static int32_t nvt_save_rawdata_to_csv(int32_t *rawdata, uint8_t x_ch, uint8_t y int32_t iArrayIndex = 0; struct file *fp = NULL; char *fbufp = NULL; +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0) mm_segment_t org_fs; +#endif int32_t write_ret = 0; - uint32_t output_len = 0; + uint32_t output_len= 0; loff_t pos = 0; #if TOUCH_KEY_NUM > 0 int32_t k = 0; @@ -394,13 +396,21 @@ static int32_t nvt_save_rawdata_to_csv(int32_t *rawdata, uint8_t x_ch, uint8_t y printk("\n"); sprintf(fbufp + y_ch * x_ch * 7 + y_ch * 2 + Key_Channel * 7, "\r\n"); #endif /* #if TOUCH_KEY_NUM > 0 */ - +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0) + if (offset == 0) + fp = filp_open(file_path, O_RDWR | O_CREAT | O_TRUNC, 0666); + else + fp = filp_open(file_path, O_RDWR | O_CREAT, 0666); +#else org_fs = get_fs(); set_fs(KERNEL_DS); fp = filp_open(file_path, O_RDWR | O_CREAT, 0644); +#endif if (fp == NULL || IS_ERR(fp)) { NVT_ERR("open %s failed\n", file_path); +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0) set_fs(org_fs); +#endif if (fbufp) { kfree(fbufp); fbufp = NULL; @@ -418,10 +428,15 @@ static int32_t nvt_save_rawdata_to_csv(int32_t *rawdata, uint8_t x_ch, uint8_t y write_ret = vfs_write(fp, (char __user *)fbufp, output_len, &pos); #elif (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)) write_ret = kernel_write(fp, (char __user *)fbufp, output_len, &pos); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0) + write_ret = kernel_write(fp, (char __user *)fbufp, output_len, &pos); #endif + if (write_ret <= 0) { NVT_ERR("write %s failed\n", file_path); +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0) set_fs(org_fs); +#endif if (fp) { filp_close(fp, NULL); fp = NULL; @@ -432,8 +447,9 @@ static int32_t nvt_save_rawdata_to_csv(int32_t *rawdata, uint8_t x_ch, uint8_t y } return -1; } - +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0) set_fs(org_fs); +#endif if (fp) { filp_close(fp, NULL); fp = NULL;