From bfda841cba9ee7a49e5bf3092881493e1f666c6f Mon Sep 17 00:00:00 2001 From: litong20 Date: Fri, 25 Jun 2021 14:13:35 +0800 Subject: [PATCH] Bringup stmicro_mmi touch module in kernel-5.10 1. warning: ftsFrame.c: comparison of array 'data' equal to a null pointer is always false. 2. error: fts_proc.c: incompatible pointer types passing 'const struct file_operations *' to paramet proc_create(DRIVER_TEST_FILE_NODE, 0777, fts_dir, &fts_driver_test_ops); 3. use timespec64 instead of timespec type. Change-Id: I46604d6c23b0b69238638f162f390a76ef08eeb6 Reviewed-on: https://gerrit.mot.com/1990708 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Jun Weng Reviewed-by: Jianqi Yang Submit-Approved: Jira Key --- .../input/touchscreen/stmicro_mmi/Android.mk | 12 ++++++++---- drivers/input/touchscreen/stmicro_mmi/Kbuild | 4 ++++ drivers/input/touchscreen/stmicro_mmi/Makefile | 17 ++++++++++++----- .../touchscreen/stmicro_mmi/fts_lib/ftsFrame.c | 6 ------ .../touchscreen/stmicro_mmi/fts_lib/ftsTime.c | 4 ++-- .../touchscreen/stmicro_mmi/fts_lib/ftsTime.h | 4 ++-- .../input/touchscreen/stmicro_mmi/fts_proc.c | 10 ++++++++++ 7 files changed, 38 insertions(+), 19 deletions(-) diff --git a/drivers/input/touchscreen/stmicro_mmi/Android.mk b/drivers/input/touchscreen/stmicro_mmi/Android.mk index 056043e781c8..dc83cba172eb 100644 --- a/drivers/input/touchscreen/stmicro_mmi/Android.mk +++ b/drivers/input/touchscreen/stmicro_mmi/Android.mk @@ -2,13 +2,17 @@ DLKM_DIR := motorola/kernel/modules LOCAL_PATH := $(call my-dir) ifeq ($(DRM_PANEL_NOTIFICATIONS),true) - KERNEL_CFLAGS += CONFIG_DRM_PANEL_NOTIFICATIONS=y + KBUILD_OPTIONS += CONFIG_DRM_PANEL_NOTIFICATIONS=y +endif + +ifeq ($(DRM_PANEL_EVENT_NOTIFICATIONS),true) + KBUILD_OPTIONS += CONFIG_DRM_PANEL_EVENT_NOTIFICATIONS=y endif ifeq ($(ST_LIMIT_USE_SUPPLIER),true) - KERNEL_CFLAGS += CONFIG_ST_LIMIT_USE_SUPPLIER=y + KBUILD_OPTIONS += CONFIG_ST_LIMIT_USE_SUPPLIER=y ifeq ($(TOUCHCLASS_MMI_MULTIWAY_UPDATE_FW),true) - KERNEL_CFLAGS += CONFIG_TOUCHCLASS_MMI_MULTIWAY_UPDATE_FW=y + KBUILD_OPTIONS += CONFIG_TOUCHCLASS_MMI_MULTIWAY_UPDATE_FW=y endif endif @@ -18,7 +22,7 @@ LOCAL_MODULE_TAGS := optional LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT) LOCAL_ADDITIONAL_DEPENDENCIES += $(KERNEL_MODULES_OUT)/mmi_info.ko ifneq ($(findstring touchscreen_mmi.ko,$(BOARD_VENDOR_KERNEL_MODULES)),) - KERNEL_CFLAGS += CONFIG_INPUT_TOUCHSCREEN_MMI=y + KBUILD_OPTIONS += CONFIG_INPUT_TOUCHSCREEN_MMI=y LOCAL_ADDITIONAL_DEPENDENCIES += $(KERNEL_MODULES_OUT)/touchscreen_mmi.ko endif KBUILD_OPTIONS_GKI += GKI_OBJ_MODULE_DIR=gki diff --git a/drivers/input/touchscreen/stmicro_mmi/Kbuild b/drivers/input/touchscreen/stmicro_mmi/Kbuild index a26639224b94..409745f6c512 100644 --- a/drivers/input/touchscreen/stmicro_mmi/Kbuild +++ b/drivers/input/touchscreen/stmicro_mmi/Kbuild @@ -20,6 +20,10 @@ ifneq ($(filter m y,$(CONFIG_DRM_PANEL_NOTIFICATIONS)),) EXTRA_CFLAGS += -DCONFIG_DRM_PANEL_NOTIFICATIONS endif +ifneq ($(filter m y, $(CONFIG_DRM_PANEL_EVENT_NOTIFICATIONS)),) + EXTRA_CFLAGS += -DCONFIG_DRM_PANEL_EVENT_NOTIFICATIONS +endif + ifneq ($(filter m y,$(CONFIG_ST_LIMIT_USE_SUPPLIER)),) EXTRA_CFLAGS += -DCONFIG_ST_LIMIT_USE_SUPPLIER endif diff --git a/drivers/input/touchscreen/stmicro_mmi/Makefile b/drivers/input/touchscreen/stmicro_mmi/Makefile index 34b09dd815a7..527323a74e8b 100644 --- a/drivers/input/touchscreen/stmicro_mmi/Makefile +++ b/drivers/input/touchscreen/stmicro_mmi/Makefile @@ -1,10 +1,17 @@ -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 \ No newline at end of file + rm -f *.o *.ko *.mod.c *.mod.o *~ .*.cmd Module.symvers + rm -rf .tmp_versions + +KBUILD_EXTRA_SYMBOLS += $(M)/../touchscreen_mmi/$(GKI_OBJ_MODULE_DIR)/Module.symvers +KBUILD_EXTRA_SYMBOLS += $(M)/../../../mmi_info/$(GKI_OBJ_MODULE_DIR)/Module.symvers diff --git a/drivers/input/touchscreen/stmicro_mmi/fts_lib/ftsFrame.c b/drivers/input/touchscreen/stmicro_mmi/fts_lib/ftsFrame.c index 537fb1ef7c3a..30cb00215e48 100644 --- a/drivers/input/touchscreen/stmicro_mmi/fts_lib/ftsFrame.c +++ b/drivers/input/touchscreen/stmicro_mmi/fts_lib/ftsFrame.c @@ -57,12 +57,6 @@ int getChannelsLength(void) int ret; u8 data[2]; - if (data == NULL) { - logError(1, "%s getChannelsLength: ERROR %08X\n", tag, - ERROR_ALLOC); - return ERROR_ALLOC; - } - ret = readConfig(ADDR_CONFIG_SENSE_LEN, data, 2); if (ret < OK) { logError(1, "%s getChannelsLength: ERROR %08X\n", tag, ret); diff --git a/drivers/input/touchscreen/stmicro_mmi/fts_lib/ftsTime.c b/drivers/input/touchscreen/stmicro_mmi/fts_lib/ftsTime.c index 2e20227d485b..13637ac1e050 100644 --- a/drivers/input/touchscreen/stmicro_mmi/fts_lib/ftsTime.c +++ b/drivers/input/touchscreen/stmicro_mmi/fts_lib/ftsTime.c @@ -39,7 +39,7 @@ */ void startStopWatch(StopWatch *w) { - ktime_get_ts(&w->start); + ktime_get_ts64(&w->start); } /** @@ -48,7 +48,7 @@ void startStopWatch(StopWatch *w) */ void stopStopWatch(StopWatch *w) { - ktime_get_ts(&w->end); + ktime_get_ts64(&w->end); } /** diff --git a/drivers/input/touchscreen/stmicro_mmi/fts_lib/ftsTime.h b/drivers/input/touchscreen/stmicro_mmi/fts_lib/ftsTime.h index 743dd1da468f..855aa6b114d4 100644 --- a/drivers/input/touchscreen/stmicro_mmi/fts_lib/ftsTime.h +++ b/drivers/input/touchscreen/stmicro_mmi/fts_lib/ftsTime.h @@ -60,8 +60,8 @@ * Struct used to measure the time elapsed between a starting and ending point. */ typedef struct { - struct timespec start; /* /< store the starting time */ - struct timespec end; /* /< store the finishing time */ + struct timespec64 start; /* /< store the starting time */ + struct timespec64 end; /* /< store the finishing time */ } StopWatch; diff --git a/drivers/input/touchscreen/stmicro_mmi/fts_proc.c b/drivers/input/touchscreen/stmicro_mmi/fts_proc.c index 4ea9876d37b5..ec60e7ebe1eb 100644 --- a/drivers/input/touchscreen/stmicro_mmi/fts_proc.c +++ b/drivers/input/touchscreen/stmicro_mmi/fts_proc.c @@ -3033,6 +3033,15 @@ ERROR: * file_operations struct which define the functions for the canonical *operation on a device file node (open. read, write etc.) */ +#if KERNEL_VERSION(5, 10, 0) <= LINUX_VERSION_CODE +static const struct proc_ops fts_driver_test_ops = { + .proc_open = fts_open, + .proc_read = seq_read, + .proc_write = fts_driver_test_write, + .proc_lseek = seq_lseek, + .proc_release = seq_release +}; +#else static const struct file_operations fts_driver_test_ops = { .open = fts_open, .read = seq_read, @@ -3040,6 +3049,7 @@ static const struct file_operations fts_driver_test_ops = { .llseek = seq_lseek, .release = seq_release }; +#endif /*****************************************************************************/