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 <chenlj2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2374602
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Yan Zhang <zhangy26@motorola.com>
Reviewed-by: liujian <liujian24@lenovo.com>
Reviewed-by: Tao Sun <suntao2@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
chenlj2 2022-08-30 16:03:10 +08:00 • committed by Lijun Chen
commit f11d4657be
2 changed files with 86 additions and 58 deletions

View file

@ -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

View file

@ -59,10 +59,22 @@
#include <linux/pm_wakeup.h>
#include "etxxx_fp.h"
#include <linux/input.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)
#if defined(CONFIG_PANEL_NOTIFICATIONS)
#include <linux/panel_notifier.h>
#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 <drm/drm_panel.h>
#else
#include <linux/msm_drm_notify.h>
#include <linux/fb.h>
#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