From 3bae2782e9471fdd95e6b8f858005fa48c97ca25 Mon Sep 17 00:00:00 2001 From: Xiaojun Lv Date: Fri, 2 Sep 2022 13:22:25 +0800 Subject: [PATCH] input: genevn: optimize ili7807s driver for kernel 5.10 input: (1)optimize ili7807s driver for kernek 5.10 Change-Id: If3c0b9644f5df5dc5c3c6c8a5469249c97becf53 Reviewed-on: https://gerrit.mot.com/2376968 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Yeqing Wang Reviewed-by: Jun Weng Reviewed-by: Jing Hu Reviewed-by: Huosheng Liao Submit-Approved: Jira Key --- .../input/touchscreen/ili9882_mmi/Makefile | 18 ++- .../touchscreen/ili9882_mmi/ili9882_mp.c | 13 ++- .../touchscreen/ili9882_mmi/ili9882_node.c | 106 +++++++++++++++++- .../touchscreen/ili9882_mmi/ili9882_qcom.c | 4 +- 4 files changed, 132 insertions(+), 9 deletions(-) diff --git a/drivers/input/touchscreen/ili9882_mmi/Makefile b/drivers/input/touchscreen/ili9882_mmi/Makefile index 4191dea22679..490308fa312c 100644 --- a/drivers/input/touchscreen/ili9882_mmi/Makefile +++ b/drivers/input/touchscreen/ili9882_mmi/Makefile @@ -1,10 +1,18 @@ -KERNEL_SRC ?= /lib/modules/$(shell uname -r)/build +all: modules -all: - $(MAKE) -C $(KERNEL_SRC) M=$(shell pwd) modules $(KBUILD_OPTIONS) +modules: + $(MAKE) -C $(KERNEL_SRC) M=$(M) modules $(KBUILD_OPTIONS) modules_install: - $(MAKE) INSTALL_MOD_STRIP=1 -C $(KERNEL_SRC) M=$(shell pwd) modules_install + $(MAKE) INSTALL_MOD_STRIP=1 -C $(KERNEL_SRC) M=$(M) modules_install + +%: + $(MAKE) -C $(KERNEL_SRC) M=$(M) $@ $(KBUILD_OPTIONS) clean: - $(MAKE) -C $(KERNEL_SRC) M=$(PWD) clean + rm -f *.o *.ko *.mod.c *.mod.o *~ .*.cmd Module.symvers + rm -rf .tmp_versions + +KBUILD_EXTRA_SYMBOLS += $(M)/../../../mmi_info/$(GKI_OBJ_MODULE_DIR)/Module.symvers +KBUILD_EXTRA_SYMBOLS += $(M)/../touchscreen_mmi/$(GKI_OBJ_MODULE_DIR)/Module.symvers + diff --git a/drivers/input/touchscreen/ili9882_mmi/ili9882_mp.c b/drivers/input/touchscreen/ili9882_mmi/ili9882_mp.c index ffe803b6d941..bfdb6d8bd302 100755 --- a/drivers/input/touchscreen/ili9882_mmi/ili9882_mp.c +++ b/drivers/input/touchscreen/ili9882_mmi/ili9882_mp.c @@ -1040,9 +1040,11 @@ static void run_tx_rx_delta_test(int index) static char *get_date_time_str(void) { + static char time_data_buf[128] = { 0 }; + +#if LINUX_VERSION_CODE <= KERNEL_VERSION(4, 14, 0) struct timespec now_time; struct rtc_time rtc_now_time; - static char time_data_buf[128] = { 0 }; getnstimeofday(&now_time); rtc_time_to_tm(now_time.tv_sec, &rtc_now_time); @@ -1050,6 +1052,15 @@ static char *get_date_time_str(void) (rtc_now_time.tm_year + 1900), rtc_now_time.tm_mon + 1, rtc_now_time.tm_mday, rtc_now_time.tm_hour, rtc_now_time.tm_min, rtc_now_time.tm_sec); +#else + struct tm tm; + time64_to_tm(ktime_get_real_seconds(), 0, &tm); + + snprintf(time_data_buf, sizeof(time_data_buf), "%04d%02d%02d-%02d%02d%02d", + (int)(tm.tm_year + 1900), tm.tm_mon + 1, + tm.tm_mday, tm.tm_hour, tm.tm_min, + tm.tm_sec); +#endif return time_data_buf; } diff --git a/drivers/input/touchscreen/ili9882_mmi/ili9882_node.c b/drivers/input/touchscreen/ili9882_mmi/ili9882_node.c index c74fd303542d..6e557a826164 100755 --- a/drivers/input/touchscreen/ili9882_mmi/ili9882_node.c +++ b/drivers/input/touchscreen/ili9882_mmi/ili9882_node.c @@ -2329,37 +2329,90 @@ out: static struct proc_dir_entry *proc_dir_ilitek; +#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 6, 0) +typedef struct { + char *name; + struct proc_dir_entry *node; + struct proc_ops *fops; + bool isCreated; +} proc_node; +#else typedef struct { char *name; struct proc_dir_entry *node; struct file_operations *fops; bool isCreated; } proc_node; - +#endif +#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 6, 0) +static struct proc_ops proc_mp_lcm_on_test_fops = { + .proc_read = ilitek_node_mp_lcm_on_test_read, +}; +#else static struct file_operations proc_mp_lcm_on_test_fops = { .read = ilitek_node_mp_lcm_on_test_read, }; +#endif +#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 6, 0) +static struct proc_ops proc_mp_lcm_off_test_fops = { + .proc_read = ilitek_node_mp_lcm_off_test_read, +}; +#else static struct file_operations proc_mp_lcm_off_test_fops = { .read = ilitek_node_mp_lcm_off_test_read, }; +#endif +#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 6, 0) +static struct proc_ops proc_ver_info_fops = { + .proc_read = ilitek_node_ver_info_read, +}; +#else static struct file_operations proc_ver_info_fops = { .read = ilitek_node_ver_info_read, }; +#endif +#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 6, 0) +static struct proc_ops proc_change_list_fops = { + .proc_read = ilitek_node_change_list_read, +}; +#else static struct file_operations proc_change_list_fops = { .read = ilitek_node_change_list_read, }; +#endif +#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 6, 0) +static struct proc_ops proc_debug_message_fops = { + .proc_read = ilitek_proc_debug_message_read, +}; +#else static struct file_operations proc_debug_message_fops = { .read = ilitek_proc_debug_message_read, }; +#endif +#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 6, 0) +static struct proc_ops proc_debug_message_switch_fops = { + .proc_read = ilitek_proc_debug_switch_read, +}; +#else static struct file_operations proc_debug_message_switch_fops = { .read = ilitek_proc_debug_switch_read, }; +#endif +#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 6, 0) +static struct proc_ops proc_ioctl_fops = { + .proc_ioctl = ilitek_node_ioctl, +#ifdef CONFIG_COMPAT + .proc_compat_ioctl = ilitek_node_compat_ioctl, +#endif + .proc_write = ilitek_node_ioctl_write, +}; +#else static struct file_operations proc_ioctl_fops = { .unlocked_ioctl = ilitek_node_ioctl, #ifdef CONFIG_COMPAT @@ -2367,40 +2420,91 @@ static struct file_operations proc_ioctl_fops = { #endif .write = ilitek_node_ioctl_write, }; +#endif +#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 6, 0) +static struct proc_ops proc_fw_upgrade_fops = { + .proc_read = ilitek_node_fw_upgrade_read, +}; +#else static struct file_operations proc_fw_upgrade_fops = { .read = ilitek_node_fw_upgrade_read, }; +#endif +#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 6, 0) +static struct proc_ops proc_fw_process_fops = { + .proc_read = ilitek_proc_fw_process_read, +}; +#else static struct file_operations proc_fw_process_fops = { .read = ilitek_proc_fw_process_read, }; +#endif +#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 6, 0) +static struct proc_ops proc_get_delta_data_fops = { + .proc_read = ilitek_proc_get_delta_data_read, +}; +#else static struct file_operations proc_get_delta_data_fops = { .read = ilitek_proc_get_delta_data_read, }; +#endif +#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 6, 0) +static struct proc_ops proc_get_raw_data_fops = { + .proc_read = ilitek_proc_fw_get_raw_data_read, +}; +#else static struct file_operations proc_get_raw_data_fops = { .read = ilitek_proc_fw_get_raw_data_read, }; +#endif +#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 6, 0) +static struct proc_ops proc_rw_tp_reg_fops = { + .proc_read = ilitek_proc_rw_tp_reg_read, + .proc_write = ilitek_proc_rw_tp_reg_write, +}; +#else static struct file_operations proc_rw_tp_reg_fops = { .read = ilitek_proc_rw_tp_reg_read, .write = ilitek_proc_rw_tp_reg_write, }; +#endif +#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 6, 0) +static struct proc_ops proc_fw_pc_counter_fops = { + .proc_read = ilitek_proc_fw_pc_counter_read, +}; +#else static struct file_operations proc_fw_pc_counter_fops = { .read = ilitek_proc_fw_pc_counter_read, }; +#endif +#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 6, 0) +static struct proc_ops proc_get_debug_mode_data_fops = { + .proc_read = ilitek_proc_get_debug_mode_data_read, + .proc_write = ilitek_proc_get_debug_mode_data_write, +}; +#else static struct file_operations proc_get_debug_mode_data_fops = { .read = ilitek_proc_get_debug_mode_data_read, .write = ilitek_proc_get_debug_mode_data_write, }; +#endif +#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 6, 0) +static struct proc_ops proc_debug_level_fops = { + .proc_read = ilitek_proc_debug_level_read, +}; +#else static struct file_operations proc_debug_level_fops = { .read = ilitek_proc_debug_level_read, }; +#endif proc_node iliproc[] = { {"ioctl", NULL, &proc_ioctl_fops, false}, diff --git a/drivers/input/touchscreen/ili9882_mmi/ili9882_qcom.c b/drivers/input/touchscreen/ili9882_mmi/ili9882_qcom.c index 7b95787dfab0..3c9f17434ee6 100755 --- a/drivers/input/touchscreen/ili9882_mmi/ili9882_qcom.c +++ b/drivers/input/touchscreen/ili9882_mmi/ili9882_qcom.c @@ -441,7 +441,7 @@ int ili_sysfs_remove_device(struct device *dev) { } #else -#ifdef CONFIG_DRM +#if (defined(CONFIG_DRM) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))) static int ilitek_plat_notifier_fb(struct notifier_block *self, unsigned long event, void *data) { int *blank; @@ -718,8 +718,8 @@ int ili_sensor_remove(struct ilitek_ts_data *data) static void ilitek_plat_sleep_init(void) { ILI_INFO("Init notifier_fb struct\n"); +#if (defined(CONFIG_DRM) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))) ilits->notifier_fb.notifier_call = ilitek_plat_notifier_fb; -#if defined(CONFIG_DRM) { int ret = 0; extern struct drm_panel *ili_active_panel;