summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTai Kuo <taikuo@google.com>2020-08-19 21:20:30 +0800
committerTai Kuo <taikuo@google.com>2020-08-20 06:27:49 +0000
commit729c12b8b0724e68bb6c22dc2f0d097ce0b2d167 (patch)
treea8c0964b1bf0f98e4aeb73724455ffa4193571c5
parent1a242f4fc939c64e12980adf19876ce27846e810 (diff)
downloadfts_touch-729c12b8b0724e68bb6c22dc2f0d097ce0b2d167.tar.gz
touch: fts: check panel before register drm notifier
If panel_map is not provided, the panel info becomes null and fails to register the DRM notifier and abort the reset of sense init process. This makes touch malfunction. Check the panel info existence before using it so the DRM will not be registered and touch chip is still sense on. Bug: 161773774 Test: Ok to update firmware. Test: Touch always active if panel_map is not given. Signed-off-by: Tai Kuo <taikuo@google.com> Change-Id: If4f1c339167492e53bc5e51052c65dc372c349a5
-rw-r--r--fts.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/fts.c b/fts.c
index 3a3e78d..9a6a488 100644
--- a/fts.c
+++ b/fts.c
@@ -4798,10 +4798,12 @@ static int fts_init_sensing(struct fts_ts_info *info)
int error = 0;
#ifdef CONFIG_DRM
- error |= drm_panel_notifier_register(info->board->panel,
- &info->notifier); /* register the
- * suspend/resume
- * function */
+ if (info->board->panel) {
+ /* register the suspend/resume function */
+ error |= drm_panel_notifier_register(info->board->panel,
+ &info->notifier);
+ } else
+ pr_info("%s: Skip DRM notifier registration\n", __func__);
#endif
error |= fts_interrupt_install(info); /* register event handler */
error |= fts_mode_handler(info, 0); /* enable the features and
@@ -6053,7 +6055,9 @@ ProbeErrorExit_7:
destroy_workqueue(info->touchsim.wq);
#ifdef CONFIG_DRM
- drm_panel_notifier_unregister(info->board->panel, &info->notifier);
+ if (info->board->panel)
+ drm_panel_notifier_unregister(info->board->panel,
+ &info->notifier);
#endif
#if IS_ENABLED(CONFIG_TOUCHSCREEN_HEATMAP)
@@ -6132,7 +6136,9 @@ static int fts_remove(struct spi_device *client)
pm_qos_remove_request(&info->pm_qos_req);
#ifdef CONFIG_DRM
- drm_panel_notifier_unregister(info->board->panel, &info->notifier);
+ if (info->board->panel)
+ drm_panel_notifier_unregister(info->board->panel,
+ &info->notifier);
#endif
/* unregister the device */