From f11d4657be5d87e6da7b4aa96dbd418a32b4b3d6 Mon Sep 17 00:00:00 2001 From: chenlj2 Date: Tue, 30 Aug 2022 16:03:10 +0800 Subject: [PATCH] DLKM/bix:update ets_bix driver optimise Makefile to solve build issue &remove things produced by build complete panel notification to solve build issue Change-Id: Ia9f3dd04d76a66515f24fb5edbea75910669778e Signed-off-by: chenlj2 Reviewed-on: https://gerrit.mot.com/2374602 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Yan Zhang Reviewed-by: liujian Reviewed-by: Tao Sun Submit-Approved: Jira Key --- drivers/input/misc/ets_bix_mmi/Makefile | 14 ++- drivers/input/misc/ets_bix_mmi/etxxx_fp.c | 130 +++++++++++++--------- 2 files changed, 86 insertions(+), 58 deletions(-) diff --git a/drivers/input/misc/ets_bix_mmi/Makefile b/drivers/input/misc/ets_bix_mmi/Makefile index 4191dea22679..bfbdc14740ef 100644 --- a/drivers/input/misc/ets_bix_mmi/Makefile +++ b/drivers/input/misc/ets_bix_mmi/Makefile @@ -1,10 +1,14 @@ -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 diff --git a/drivers/input/misc/ets_bix_mmi/etxxx_fp.c b/drivers/input/misc/ets_bix_mmi/etxxx_fp.c index b3f52acaf474..ae7963cb53ee 100755 --- a/drivers/input/misc/ets_bix_mmi/etxxx_fp.c +++ b/drivers/input/misc/ets_bix_mmi/etxxx_fp.c @@ -59,10 +59,22 @@ #include #include "etxxx_fp.h" #include -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) +#if defined(CONFIG_PANEL_NOTIFICATIONS) +#include +#define FP_NOTIFY_ON PANEL_EVENT_DISPLAY_ON +#define FP_NOTIFY_OFF PANEL_EVENT_DISPLAY_OFF +#define FP_NOTIFY_EVENT_BLANK PANEL_EVENT_DISPLAY_OFF //MSM_DRM_EVENT_BLANK +#define ets_fb_register_client(client) panel_register_notifier(client); +#define ets_fb_unregister_client(client) panel_unregister_notifier(client); +#elif defined(CONFIG_DRM_PANEL_NOTIFICATIONS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) #include #else -#include +#include +#define FP_NOTIFY_ON FB_BLANK_UNBLANK +#define FP_NOTIFY_OFF FB_BLANK_POWERDOWN +#define FP_NOTIFY_EVENT_BLANK FB_EVENT_BLANK +#define ets_fb_register_client(client) fb_register_client(client); +#define ets_fb_unregister_client(client) fb_unregister_client(client) #endif @@ -1020,7 +1032,7 @@ int egisfp_check_ioctl_permission(struct egisfp_dev_t *egis_dev, unsigned int cm return -EACCES; } } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) +#if defined(CONFIG_DRM_PANEL_NOTIFICATIONS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) static int drm_check_dt(struct egisfp_dev_t *egis_dev) { int i = 0; @@ -1046,13 +1058,42 @@ static int drm_check_dt(struct egisfp_dev_t *egis_dev) ERROR_PRINT(" %s : can not find drm_panel ", __func__); return -ENODEV; } +#endif + +// Register FB notifier +++ static int egisfp_fb_callback(struct notifier_block *nb, unsigned long val, void *data) { struct egisfp_dev_t *egis_dev = NULL; + char *envp[2]; + int ret = 0; +#if defined(CONFIG_PANEL_NOTIFICATIONS) + INFO_PRINT(" %s : got notify value = %d \n", __func__, (int)val); + egis_dev = container_of(nb, struct egisfp_dev_t, notifier); + egis_dev->screen_onoff = 1; + switch(val) { + case PANEL_EVENT_DISPLAY_ON: + egis_dev->screen_onoff = 1; + envp[0] = "PANEL=1"; + break; + case PANEL_EVENT_DISPLAY_OFF: + egis_dev->screen_onoff = 0; + envp[0] = "PANEL=0"; + break; + case PANEL_EVENT_PRE_DISPLAY_OFF: + break; + case PANEL_EVENT_PRE_DISPLAY_ON: + break; + default: + break; + } + if(val == FP_NOTIFY_ON ||val == FP_NOTIFY_OFF){ + envp[1] = NULL; + ret = kobject_uevent_env(&egis_dev->dd->dev.kobj, KOBJ_CHANGE, envp); + INFO_PRINT(" %s : screen_onoff = %d val=%lu ret=%d\n", __func__, egis_dev->screen_onoff, val,ret); + } +#elif defined(CONFIG_DRM_PANEL_NOTIFICATIONS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) struct drm_panel_notifier *evdata = data; unsigned int blank; - char *envp[2]; - int ret; INFO_PRINT(" %s : got notify value = %d \n", __func__, (int)val); if (val != DRM_PANEL_EARLY_EVENT_BLANK) { @@ -1076,56 +1117,40 @@ static int egisfp_fb_callback(struct notifier_block *nb, unsigned long val, void default: break; } - screenonoff_flag = 1; - waitq_type |= POLLIN | POLLHUP; - wake_up_interruptible(&interrupt_waitq); - INFO_PRINT(" %s : screen_onoff = %d waitq_type =%d \n", __func__, egis_dev->screen_onoff,waitq_type); + INFO_PRINT(" %s : screen_onoff = %d \n", __func__, egis_dev->screen_onoff); envp[1] = NULL; ret = kobject_uevent_env(&egis_dev->dd->dev.kobj, KOBJ_CHANGE, envp); - return NOTIFY_OK; -} #else -static int egisfp_fb_callback(struct notifier_block *nb, unsigned long val, void *data) -{ - struct egisfp_dev_t *egis_dev = NULL; - struct msm_drm_notifier *evdata = data; + struct fb_event *evdata = data; unsigned int blank; - char *envp[2]; - int ret; + + if (val != FP_NOTIFY_EVENT_BLANK) + return 0; + INFO_PRINT(" %s : got notify value = %d \n", __func__, (int)val); - if (val != MSM_DRM_EARLY_EVENT_BLANK) - { - return 0; - } egis_dev = container_of(nb, struct egisfp_dev_t, notifier); - if (!evdata || !evdata->data || !egis_dev) - { - ERROR_PRINT(" %s : some parameters is null \n", __func__); - return 0; + if (evdata && evdata->data && val == FB_EVENT_BLANK && egis_dev) { + blank = *(int *)(evdata->data); + INFO_PRINT(" %s : blank value = %d \n", __func__, (int)blank); + switch (blank) { + case FP_NOTIFY_OFF: + egis_dev->screen_onoff = 0; + envp[0] = "PANEL=0"; + break; + case FP_NOTIFY_ON: + egis_dev->screen_onoff = 1; + envp[0] = "PANEL=1"; + break; + default: + break; + } + INFO_PRINT(" %s : screen_onoff = %d \n", __func__, egis_dev->screen_onoff); + envp[1] = NULL; + ret = kobject_uevent_env(&egis_dev->dd->dev.kobj, KOBJ_CHANGE, envp); } - blank = *(int *)(evdata->data); - switch (blank) - { - case MSM_DRM_BLANK_UNBLANK: - egis_dev->screen_onoff = 1; - envp[0] = "PANEL=1"; - break; - case MSM_DRM_BLANK_POWERDOWN: - egis_dev->screen_onoff = 0; - envp[0] = "PANEL=0"; - break; - default: - break; - } - screenonoff_flag = 1; - waitq_type |= POLLIN | POLLHUP; - wake_up_interruptible(&interrupt_waitq); - INFO_PRINT(" %s : screen_onoff = %d waitq_type =%d \n", __func__, egis_dev->screen_onoff,waitq_type); - envp[1] = NULL; - ret = kobject_uevent_env(&egis_dev->dd->dev.kobj, KOBJ_CHANGE, envp); +#endif return NOTIFY_OK; } -#endif static struct notifier_block egisfp_noti_block = { .notifier_call = egisfp_fb_callback, @@ -1227,14 +1252,14 @@ int egisfp_remove(struct platform_device *pdev) } if (egis_dev->call_back_registered) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) +#if defined(CONFIG_DRM_PANEL_NOTIFICATIONS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) if (egis_dev->active_panel) { drm_panel_notifier_unregister(egis_dev->active_panel, &egis_dev->notifier); egis_dev->active_panel = NULL; } #else - msm_drm_unregister_client(&egis_dev->notifier); + ets_fb_unregister_client(&egis_dev->notifier); #endif } del_timer_sync(&egis_dev->fps_ints.timer); @@ -1311,7 +1336,7 @@ int egisfp_probe(struct platform_device *pdev) egis_dev->screen_onoff = 1; // dafault set screen on egis_dev->call_back_registered = 0; egis_dev->fps_ints.irq_mode = -1; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) +#if defined(CONFIG_DRM_PANEL_NOTIFICATIONS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) egis_dev->active_panel = NULL; drm_check_dt(egis_dev); #endif @@ -1371,7 +1396,7 @@ int egisfp_probe(struct platform_device *pdev) #endif egis_dev->notifier = egisfp_noti_block; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) +#if defined(CONFIG_DRM_PANEL_NOTIFICATIONS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) if (egis_dev->active_panel) { DEBUG_PRINT(" %s : register drm_panel_notifier \n", __func__); status = drm_panel_notifier_register(egis_dev->active_panel, &egis_dev->notifier); @@ -1381,10 +1406,9 @@ int egisfp_probe(struct platform_device *pdev) egis_dev->call_back_registered = 1; } #else - DEBUG_PRINT(" %s : register msm_drm_register_client \n", __func__); - status = msm_drm_register_client(&egis_dev->notifier); + status = ets_fb_register_client(&egis_dev->notifier); if (status) - ERROR_PRINT(" %s : drm_panel_notifier_register fail: %d ", __func__, status); + ERROR_PRINT(" %s : ets_fb_register_client fail: %d ", __func__, status); else egis_dev->call_back_registered = 1; #endif