diff --git a/drivers/input/misc/focal_fps_mmi/Android.mk b/drivers/input/misc/focal_fps_mmi/Android.mk index 03a42583f166..5a1af6d23e7d 100644 --- a/drivers/input/misc/focal_fps_mmi/Android.mk +++ b/drivers/input/misc/focal_fps_mmi/Android.mk @@ -11,6 +11,10 @@ ifeq ($(FOCAL_SUPPORT_DRM_SCREEN),true) KBUILD_OPTIONS += CONFIG_FOCAL_SUPPORT_DRM_SCREEN=y endif +ifeq ($(FOCAL_FPS_PANEL_NOTIFICATIONS),true) + KERNEL_CFLAGS += CONFIG_FOCAL_PANEL_NOTIFICATIONS=y +endif + include $(CLEAR_VARS) LOCAL_MODULE := focal_fps_mmi.ko LOCAL_MODULE_TAGS := optional diff --git a/drivers/input/misc/focal_fps_mmi/Kbuild b/drivers/input/misc/focal_fps_mmi/Kbuild index 9e94bc64399e..4f9cb1ae2a70 100644 --- a/drivers/input/misc/focal_fps_mmi/Kbuild +++ b/drivers/input/misc/focal_fps_mmi/Kbuild @@ -40,6 +40,10 @@ ifneq ($(filter m y,$(CONFIG_FOCAL_SUPPORT_DRM_SCREEN)),) EXTRA_CFLAGS += -DCONFIG_DRM_PANEL_NOTIFICATIONS endif +ifneq ($(filter m y, $(CONFIG_FOCAL_PANEL_NOTIFICATIONS)),) + EXTRA_CFLAGS += -DCONFIG_PANEL_NOTIFICATIONS +endif + obj-m += focal_fps_mmi.o diff --git a/drivers/input/misc/focal_fps_mmi/ff_ctl.c b/drivers/input/misc/focal_fps_mmi/ff_ctl.c index d5f15a851d07..3abe3e6631ea 100644 --- a/drivers/input/misc/focal_fps_mmi/ff_ctl.c +++ b/drivers/input/misc/focal_fps_mmi/ff_ctl.c @@ -35,9 +35,13 @@ #include #if defined(CONFIG_DRM_PANEL_NOTIFICATIONS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) #include +#else /* CONFIG_DRM_PANEL_NOTIFICATIONS */ +#if defined(CONFIG_PANEL_NOTIFICATIONS) +#include #else #include #endif +#endif #include #if 0 #ifdef CONFIG_PM_WAKELOCKS @@ -348,8 +352,8 @@ static int ff_ctl_fb_notifier_callback(struct notifier_block *nb, unsigned long screen_state[0] = 0; break; case DRM_PANEL_BLANK_POWERDOWN: - uevent_env[0] = "FF_SCREEN_OFF"; - screen_state[0] = 1; + uevent_env[0] = "FF_SCREEN_OFF"; + screen_state[0] = 1; break; default: uevent_env[0] = "FF_SCREEN_??"; @@ -358,6 +362,31 @@ static int ff_ctl_fb_notifier_callback(struct notifier_block *nb, unsigned long uevent_env[1] = NULL; kill_fasync(&g_context->async_queue, SIGIO, POLL_IN); FF_LOGD("chenlj2 leave.%s",uevent_env[0]); +#else /* CONFIG_DRM_PANEL_NOTIFICATIONS */ +#if defined(CONFIG_PANEL_NOTIFICATIONS) + char *uevent_env[2]; + FF_LOGD(" received a panel notification %d \n", (int)action); + switch(action) { + case PANEL_EVENT_DISPLAY_ON: + uevent_env[0] = "FF_SCREEN_ON"; + screen_state[0] = 0; + break; + case PANEL_EVENT_DISPLAY_OFF: + uevent_env[0] = "FF_SCREEN_OFF"; + screen_state[0] = 1; + break; + case PANEL_EVENT_PRE_DISPLAY_OFF: + break; + case PANEL_EVENT_PRE_DISPLAY_ON: + break; + default: + break; + } + if(action == PANEL_EVENT_DISPLAY_ON || action== PANEL_EVENT_DISPLAY_OFF) { + uevent_env[1] = NULL; + kobject_uevent_env(&g_context->miscdev.this_device->kobj, KOBJ_CHANGE, uevent_env); + FF_LOGD("'%s' leave %s.", __func__,uevent_env[0] ); + } #else struct fb_event *event; int blank; @@ -391,6 +420,7 @@ static int ff_ctl_fb_notifier_callback(struct notifier_block *nb, unsigned long kill_fasync(&g_context->async_queue, SIGIO, POLL_IN); FF_LOGV("'%s' leave.", __func__); +#endif #endif return NOTIFY_OK; } @@ -445,8 +475,12 @@ static int ff_ctl_free_driver(void) drm_panel_notifier_unregister(g_context->active_panel, &g_context->fb_notifier); g_context->active_panel = NULL; } +#else /* CONFIG_DRM_PANEL_NOTIFICATIONS */ +#if defined(CONFIG_PANEL_NOTIFICATIONS) + err = panel_unregister_notifier(&g_context->fb_notifier); #else - err = fb_unregister_client(&g_context->fb_notifier); + err = fb_unregister_client(&g_context->fb_notifier); +#endif #endif #ifdef FF_SPI_SET @@ -573,11 +607,15 @@ static int ff_ctl_init_driver(void) if (err) FF_LOGV("drm_panel_notifier_register fail: %d ", err); } +#else /* CONFIG_DRM_PANEL_NOTIFICATIONS */ +#if defined(CONFIG_PANEL_NOTIFICATIONS) + err = panel_register_notifier(&g_context->fb_notifier); + if (err) + FF_LOGE(" %s : panel_register_notifier fail: %d ", __func__, err); #else err = fb_register_client(&g_context->fb_notifier); #endif - - +#endif g_context->b_driver_inited = true; FF_LOGV("'%s' leave.", __func__); return err;