From 440ca970d533acc959b12f71ac01d81607bcd023 Mon Sep 17 00:00:00 2001 From: litong Date: Mon, 28 Sep 2020 16:49:55 +0800 Subject: [PATCH] Continue to probe touch even if no matching panel is found TP: 1.Continue to probe touchscreen driver even if no matching panel is found to ensure the basic functions of the touchscreen. 2.There is no member "id" in drm_panel_notifier at present, so set id to 0 to ensure touch driver can receive notifications from panel. Change-Id: I2f8c946304be4511bc7ef3422937bfe8ea927a98 Reviewed-on: https://gerrit.mot.com/1745970 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Jichao Zou Submit-Approved: Jira Key --- .../touchscreen_mmi/touchscreen_mmi_class.c | 6 ++++-- .../touchscreen_mmi/touchscreen_mmi_notif.c | 17 +++++++++++------ include/linux/touchscreen_mmi.h | 3 ++- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_class.c b/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_class.c index 74318d9ef4f7..45e69751e498 100644 --- a/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_class.c +++ b/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_class.c @@ -599,8 +599,10 @@ int ts_mmi_dev_register(struct device *parent, #ifdef CONFIG_DRM_PANEL_NOTIFICATIONS ret = ts_mmi_check_drm_panel(DEV_TS->of_node); - if (ret < 0) - goto PANEL_PARSE_DT_FAILED; + if (ret < 0) { + dev_err(DEV_TS, "%s: check drm panel failed. %d\n", __func__, ret); + touch_cdev->panel_status = -1; + } #endif ret = ts_mmi_parse_dt(touch_cdev, DEV_TS->of_node); diff --git a/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_notif.c b/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_notif.c index 2f144fabcd31..523d5abc8993 100644 --- a/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_notif.c +++ b/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_notif.c @@ -452,10 +452,12 @@ int ts_mmi_notifiers_register(struct ts_mmi_dev *touch_cdev) */ touch_cdev->pm_mode = TS_MMI_PM_ACTIVE; - touch_cdev->panel_nb.notifier_call = ts_mmi_panel_cb; - ret = register_panel_notifier(&touch_cdev->panel_nb); - if (ret) - goto PANEL_NOTIF_REGISTER_FAILED; + if (!touch_cdev->panel_status) { + touch_cdev->panel_nb.notifier_call = ts_mmi_panel_cb; + ret = register_panel_notifier(&touch_cdev->panel_nb); + if (ret) + goto PANEL_NOTIF_REGISTER_FAILED; + } if (touch_cdev->pdata.update_refresh_rate) { touch_cdev->freq_nb.notifier_call = ts_mmi_refresh_rate_cb; @@ -475,7 +477,8 @@ int ts_mmi_notifiers_register(struct ts_mmi_dev *touch_cdev) return 0; FREQ_NOTIF_REGISTER_FAILED: - unregister_panel_notifier(&touch_cdev->panel_nb); + if (!touch_cdev->panel_status) + unregister_panel_notifier(&touch_cdev->panel_nb); PANEL_NOTIF_REGISTER_FAILED: cancel_delayed_work(&touch_cdev->work); PS_NOTIF_REGISTER_FAILED: @@ -500,7 +503,9 @@ void ts_mmi_notifiers_unregister(struct ts_mmi_dev *touch_cdev) if (touch_cdev->pdata.usb_detection) power_supply_unreg_notifier(&touch_cdev->ps_notif); - unregister_panel_notifier(&touch_cdev->panel_nb); + if (!touch_cdev->panel_status) + unregister_panel_notifier(&touch_cdev->panel_nb); + cancel_delayed_work(&touch_cdev->work); kfifo_free(&touch_cdev->cmd_pipe); dev_info(DEV_MMI, "%s:notifiers_unregister finish", __func__); diff --git a/include/linux/touchscreen_mmi.h b/include/linux/touchscreen_mmi.h index ec469e4cb01a..97ef6710e997 100644 --- a/include/linux/touchscreen_mmi.h +++ b/include/linux/touchscreen_mmi.h @@ -69,7 +69,7 @@ struct drm_panel_notifier *evdata = evd; \ dev_dbg(DEV_MMI, "%s: invalid evdata\n", __func__); \ return 0; \ } \ - idx = *(int *)evd; \ + idx = 0;\ blank = (int *)evdata->data; \ dev_dbg(DEV_MMI, "%s: drm notification: event = %lu, blank = %d\n", \ __func__, event, *blank); \ @@ -362,6 +362,7 @@ struct ts_mmi_dev { struct device *class_dev; dev_t class_dev_no; int forcereflash; + int panel_status; struct ts_mmi_dev_pdata pdata; struct notifier_block panel_nb; struct mutex extif_mutex;