diff --git a/drivers/input/touchscreen/sec_mmi/sec_ts.c b/drivers/input/touchscreen/sec_mmi/sec_ts.c index 75d03e157a4b..fb0393bacf4b 100644 --- a/drivers/input/touchscreen/sec_mmi/sec_ts.c +++ b/drivers/input/touchscreen/sec_mmi/sec_ts.c @@ -2671,6 +2671,11 @@ static int __init sec_ts_init(void) return -ENODEV; } #endif + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) + if (!ts_mmi_is_panel_match("mmi,panel_name", "lsi")) + return false; +#endif pr_err("%s\n", __func__); return i2c_add_driver(&sec_ts_driver); diff --git a/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_class.c b/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_class.c index f9d94fb4a417..0ee075a3cfea 100644 --- a/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_class.c +++ b/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_class.c @@ -787,6 +787,30 @@ void ts_mmi_dev_unregister(struct device *parent) } EXPORT_SYMBOL(ts_mmi_dev_unregister); +bool ts_mmi_is_panel_match(const char *panel_node, char *touch_ic_name) +{ + struct device_node *of_chosen; + const char *panel_name; + + of_chosen = of_find_node_by_path("/chosen"); + if (of_chosen == NULL) + of_chosen = of_find_node_by_path("/chosen@0"); + + if (of_chosen == NULL) + return false; + + if (of_property_read_string(of_chosen, panel_node, &panel_name)) { + pr_err("%s: Failed to get %s", __func__, panel_node); + return false; + } + + if (strstr(panel_name, touch_ic_name)) + return true; + + return false; +} +EXPORT_SYMBOL(ts_mmi_is_panel_match); + static int __init touchscreens_init(void) { int error = 0; diff --git a/include/linux/touchscreen_mmi.h b/include/linux/touchscreen_mmi.h index 81de35269ef7..e016376c597f 100644 --- a/include/linux/touchscreen_mmi.h +++ b/include/linux/touchscreen_mmi.h @@ -468,6 +468,7 @@ extern int ts_mmi_gesture_suspend(struct ts_mmi_dev *touch_cdev); #ifdef CONFIG_DRM_PANEL_NOTIFICATIONS int ts_mmi_check_drm_panel(struct device_node *of_node); #endif +extern bool ts_mmi_is_panel_match(const char *panel_node, char *touch_ic_name); /*sensor*/ extern bool ts_mmi_is_sensor_enable(void);