From 12e78678a8ed5c4e002f4b18733d79d69e41ee39 Mon Sep 17 00:00:00 2001 From: litong20 Date: Fri, 11 Feb 2022 15:00:52 +0800 Subject: [PATCH] Support receiving dual-screen notifiactions. Support receiving dual-screen notifications to support touch ic suspend and resume. Change-Id: I2af3fb7632ca164c85626957f42c0d3dca2af179 Reviewed-on: https://gerrit.mot.com/2188839 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Jichao Zou Reviewed-by: Submit-Approved: Jira Key --- .../touchscreen_mmi/touchscreen_mmi_notif.c | 6 +++--- .../touchscreen_mmi/touchscreen_mmi_panel.c | 17 ++++++++--------- include/linux/touchscreen_mmi.h | 18 ++++++++++++++---- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_notif.c b/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_notif.c index 0f29e5ce77a5..8a115445faea 100644 --- a/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_notif.c +++ b/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_notif.c @@ -166,12 +166,12 @@ static void ts_mmi_panel_cb(enum panel_event_notifier_tag tag, event = notification->notif_type; evdata = notification->notif_data; - dev_dbg(DEV_MMI, "%s: %s Notify_type=%d, early=%d\n", __func__, + dev_dbg(DEV_MMI, "%s: %s Notify_type=%d, early=%d, ctrl_dsi=%d\n", __func__, EVENT_PRE_DISPLAY_OFF ? "EVENT_PRE_DISPLAY_OFF" : (EVENT_DISPLAY_OFF ? "EVENT_DISPLAY_OFF" : (EVENT_PRE_DISPLAY_ON ? "EVENT_PRE_DISPLAY_ON" : (EVENT_DISPLAY_ON ? "EVENT_DISPLAY_ON" : "Unknown"))), - event, (evdata.early_trigger ? 1 : 0)); + event, (evdata.early_trigger ? 1 : 0), touch_cdev->pdata.ctrl_dsi); panel_event = EVENT_PRE_DISPLAY_OFF ? TS_MMI_EVENT_PRE_DISPLAY_OFF : (EVENT_DISPLAY_OFF ? TS_MMI_EVENT_DISPLAY_OFF : @@ -349,7 +349,7 @@ static void ts_mmi_worker_func(struct work_struct *w) case TS_MMI_TASK_INIT: #if defined (CONFIG_DRM_PANEL_NOTIFICATIONS) || defined (CONFIG_DRM_PANEL_EVENT_NOTIFICATIONS) - ret = ts_mmi_check_drm_panel(DEV_TS->of_node); + ret = ts_mmi_check_drm_panel(touch_cdev, DEV_TS->of_node); if (ret < 0) { dev_err(DEV_TS, "%s: check drm panel failed. %d\n", __func__, ret); touch_cdev->panel_status = -1; diff --git a/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_panel.c b/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_panel.c index dab4d0e1efc8..74f514cd623f 100644 --- a/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_panel.c +++ b/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_panel.c @@ -236,9 +236,8 @@ done: } #if defined(CONFIG_DRM_PANEL_NOTIFICATIONS) || defined (CONFIG_DRM_PANEL_EVENT_NOTIFICATIONS) -struct drm_panel *active_panel; -static int ts_mmi_check_dt(struct device_node *np) +static int ts_mmi_check_dt(struct ts_mmi_dev *touch_cdev, struct device_node *np) { int i = 0; @@ -248,7 +247,7 @@ static int ts_mmi_check_dt(struct device_node *np) count = of_count_phandle_with_args(np, "panel", NULL); if (count <= 0) { - pr_err("%s: find drm_panel count(%d) fail", __func__, count); + dev_err(DEV_TS, "%s: find drm_panel count(%d) fail", __func__, count); return -ENODEV; } @@ -257,12 +256,12 @@ static int ts_mmi_check_dt(struct device_node *np) panel = of_drm_find_panel(node); of_node_put(node); if (!IS_ERR(panel)) { - pr_info("%s: find drm_panel successfully", __func__); - active_panel = panel; + dev_info(DEV_TS, "%s: find drm_panel successfully", __func__); + touch_cdev->active_panel = panel; return 0; } } - pr_err("%s: No find drm_panel", __func__); + dev_err(DEV_TS, "%s: No find drm_panel", __func__); return -ENODEV; } @@ -311,13 +310,13 @@ out: return ret; } -int ts_mmi_check_drm_panel(struct device_node *of_node) +int ts_mmi_check_drm_panel(struct ts_mmi_dev* touch_cdev, struct device_node *of_node) { int ret; - ret = ts_mmi_check_dt(of_node); + ret = ts_mmi_check_dt(touch_cdev, of_node); if (ret) { - pr_err( "%s: parse drm-panel fail\n", __func__); + dev_err(DEV_TS, "%s: parse drm-panel fail\n", __func__); if (!ts_mmi_check_default_tp(of_node, "qcom,mmi-touch-active")) ret = -EPROBE_DEFER; else diff --git a/include/linux/touchscreen_mmi.h b/include/linux/touchscreen_mmi.h index ec16ace9616c..f3c0aaf517ac 100644 --- a/include/linux/touchscreen_mmi.h +++ b/include/linux/touchscreen_mmi.h @@ -59,9 +59,16 @@ extern struct drm_panel *active_panel; #define REGISTER_PANEL_NOTIFIER { \ void *cookie = NULL; \ - cookie = panel_event_notifier_register(PANEL_EVENT_NOTIFICATION_PRIMARY, \ - PANEL_EVENT_NOTIFIER_CLIENT_PRIMARY_TOUCH, active_panel, \ - &ts_mmi_panel_cb, touch_cdev); \ + struct ts_mmi_dev_pdata *ppdata = &touch_cdev->pdata; \ + if (!ppdata->ctrl_dsi) { \ + cookie = panel_event_notifier_register(PANEL_EVENT_NOTIFICATION_PRIMARY, \ + PANEL_EVENT_NOTIFIER_CLIENT_PRIMARY_TOUCH, touch_cdev->active_panel, \ + &ts_mmi_panel_cb, touch_cdev); \ + } else { \ + cookie = panel_event_notifier_register(PANEL_EVENT_NOTIFICATION_SECONDARY, \ + PANEL_EVENT_NOTIFIER_CLIENT_SECONDARY_TOUCH, touch_cdev->active_panel, \ + &ts_mmi_panel_cb, touch_cdev); \ + } \ if (!cookie) \ ret = -1; \ else \ @@ -435,6 +442,9 @@ struct ts_mmi_dev { int forcereflash; int panel_status; struct ts_mmi_dev_pdata pdata; +#if defined(CONFIG_DRM_PANEL_NOTIFICATIONS) || defined (CONFIG_DRM_PANEL_EVENT_NOTIFICATIONS) + struct drm_panel *active_panel; +#endif #ifdef CONFIG_DRM_PANEL_EVENT_NOTIFICATIONS void *notifier_cookie; #else @@ -545,7 +555,7 @@ extern int ts_mmi_palm_remove(struct ts_mmi_dev *data); extern int ts_mmi_gesture_suspend(struct ts_mmi_dev *touch_cdev); #endif #if defined (CONFIG_DRM_PANEL_NOTIFICATIONS) || defined (CONFIG_DRM_PANEL_EVENT_NOTIFICATIONS) -int ts_mmi_check_drm_panel(struct device_node *of_node); +int ts_mmi_check_drm_panel(struct ts_mmi_dev* touch_cdev, struct device_node *of_node); #endif extern bool ts_mmi_is_panel_match(const char *panel_node, char *touch_ic_name);