DLKM: Nairobi NT36672c touch bringup

- Add BOARD_USES_PANEL_NOTIFICATIONS for enable panel
notifications feature to fit for new display notifier callchain.

Change-Id: I16c7fef774d0b76d4a4d23ad39673f85bfff582b
Signed-off-by: wengjun1 <wengjun1@motorola.com>
Reviewed-on: https://gerrit.mot.com/1481808
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Hujun Liao <liaohj@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
wengjun1 2020-01-10 13:40:23 +08:00 • committed by Jun Weng
commit 2f9acaba4b
4 changed files with 69 additions and 0 deletions

View file

@ -11,6 +11,10 @@ ifneq ($(BOARD_USES_DOUBLE_TAP),)
KERNEL_CFLAGS += CONFIG_INPUT_NOVA_0FLASH_MMI_ENABLE_DOUBLE_TAP=y
endif
ifneq ($(BOARD_USES_PANEL_NOTIFICATIONS),)
KERNEL_CFLAGS += CONFIG_INPUT_NOVA_PANEL_NOTIFICATIONS=y
endif
include $(CLEAR_VARS)
LOCAL_MODULE := nova_0flash_mmi.ko
LOCAL_MODULE_TAGS := optional

View file

@ -9,6 +9,9 @@ endif
ifneq ($(filter m y,$(CONFIG_INPUT_NOVA_0FLASH_MMI_ENABLE_DOUBLE_TAP)),)
EXTRA_CFLAGS += -DNVT_SENSOR_EN
endif
ifneq ($(filter m y,$(CONFIG_INPUT_NOVA_PANEL_NOTIFICATIONS)),)
EXTRA_CFLAGS += -DNVT_CONFIG_PANEL_NOTIFICATIONS
endif
nova_0flash_mmi-objs += nt36xxx.o
nova_0flash_mmi-objs += nt36xxx_ext_proc.o

View file

@ -41,6 +41,13 @@
#include <linux/jiffies.h>
#endif /* #if NVT_TOUCH_ESD_PROTECT */
#ifdef NVT_CONFIG_PANEL_NOTIFICATIONS
#define register_panel_notifier panel_register_notifier
#define unregister_panel_notifier panel_unregister_notifier
#else
#define register_panel_notifier(...) rc
#define unregister_panel_notifier(...) rc
#endif
#ifdef NVT_SENSOR_EN
#ifdef CONFIG_HAS_WAKELOCK
@ -107,6 +114,10 @@ static void nvt_ts_early_suspend(struct early_suspend *h);
static void nvt_ts_late_resume(struct early_suspend *h);
#endif
#ifdef NVT_CONFIG_PANEL_NOTIFICATIONS
static int nvt_panel_notifier_callback(struct notifier_block *self, unsigned long event, void *data);
#endif
uint32_t ENG_RST_ADDR = 0x7FFF80;
uint32_t SWRST_N8_ADDR = 0; //read from dtsi
uint32_t SPI_RD_FAST_ADDR = 0; //read from dtsi
@ -2090,6 +2101,16 @@ static int32_t nvt_ts_probe(struct spi_device *client)
goto err_register_fb_notif_failed;
}
#endif
#ifdef NVT_CONFIG_PANEL_NOTIFICATIONS
ts->panel_notif.notifier_call = nvt_panel_notifier_callback;
ret = register_panel_notifier(&ts->panel_notif);
if(ret) {
NVT_ERR("register panel_notifier failed. ret=%d\n", ret);
goto err_register_fb_notif_failed;
}
#endif
#elif defined(CONFIG_HAS_EARLYSUSPEND)
ts->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 1;
ts->early_suspend.suspend = nvt_ts_early_suspend;
@ -2218,6 +2239,11 @@ static int32_t nvt_ts_remove(struct spi_device *client)
unregister_early_suspend(&ts->early_suspend);
#endif
#ifdef NVT_CONFIG_PANEL_NOTIFICATIONS
if (unregister_panel_notifier(&ts->panel_notif))
NVT_ERR("Error occurred while unregistering panel_notifier.\n");
#endif
#if NVT_TOUCH_MP
nvt_mp_proc_deinit();
#endif
@ -2296,6 +2322,11 @@ static void nvt_ts_shutdown(struct spi_device *client)
unregister_early_suspend(&ts->early_suspend);
#endif
#ifdef NVT_CONFIG_PANEL_NOTIFICATIONS
if (unregister_panel_notifier(&ts->panel_notif))
NVT_ERR("Error occurred while unregistering panel_notifier.\n");
#endif
#if NVT_TOUCH_MP
nvt_mp_proc_deinit();
#endif
@ -2507,6 +2538,30 @@ static int32_t nvt_ts_resume(struct device *dev)
return 0;
}
#ifdef NVT_CONFIG_PANEL_NOTIFICATIONS
static int nvt_panel_notifier_callback(struct notifier_block *self, unsigned long event, void *data)
{
struct nvt_ts_data *ts =
container_of(self, struct nvt_ts_data, panel_notif);
switch (event) {
case PANEL_EVENT_PRE_DISPLAY_OFF:
NVT_LOG("event=%lu\n", event);
nvt_ts_suspend(&ts->client->dev);
break;
case PANEL_EVENT_PRE_DISPLAY_ON:
NVT_LOG("event=%lu\n", event);
nvt_ts_resume(&ts->client->dev);
break;
default: /* use DEV_TS here to avoid unused variable */
NVT_LOG("%s: function not implemented event %lu\n", __func__, event);
break;
}
return 0;
}
#endif
#if defined(CONFIG_FB)
#ifdef _MSM_DRM_NOTIFY_H_

View file

@ -27,6 +27,10 @@
#include <linux/sensors.h>
#endif
#ifdef NVT_CONFIG_PANEL_NOTIFICATIONS
#include <linux/panel_notifier.h>
#endif
#ifdef CONFIG_HAS_EARLYSUSPEND
#include <linux/earlysuspend.h>
#endif
@ -150,6 +154,9 @@ struct nvt_ts_data {
#endif
#elif defined(CONFIG_HAS_EARLYSUSPEND)
struct early_suspend early_suspend;
#endif
#ifdef NVT_CONFIG_PANEL_NOTIFICATIONS
struct notifier_block panel_notif;
#endif
uint8_t fw_ver;
uint8_t x_num;