From c6c98fe6ef503ea23fdb86b8fc043ec7ed170bc5 Mon Sep 17 00:00:00 2001 From: xizx Date: Thu, 23 Sep 2021 14:17:33 +0800 Subject: [PATCH] touchscreen: dynamic check the goodix device status Kernel should not allow two drivers to assign same irq resource, or else it will cause unknown irq storm issue. For goodix touch driver, the i2c device driver will always match device tree node and request irq resource even goodix touch doesn't exist at all. When the kernel always loads another touch driver, such as stmicro fts driver, they will compete the irq responsing and cause lots of cpu hang issue. Dynamically check the goodix sensor device status according dts config to avoid the uncessary register driver. Change-Id: I0c087d2aeaf5ebd04adddb8cbeabae27048fcb92 Signed-off-by: xizx Reviewed-on: https://gerrit.mot.com/2074007 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Jichao Zou Reviewed-by: litong Submit-Approved: Jira Key --- .../input/touchscreen/goodix_berlin_mmi/goodix_brl_i2c.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/goodix_berlin_mmi/goodix_brl_i2c.c b/drivers/input/touchscreen/goodix_berlin_mmi/goodix_brl_i2c.c index 2e3265f2afe0..ca2a5e0360a5 100644 --- a/drivers/input/touchscreen/goodix_berlin_mmi/goodix_brl_i2c.c +++ b/drivers/input/touchscreen/goodix_berlin_mmi/goodix_brl_i2c.c @@ -263,8 +263,13 @@ static struct i2c_driver goodix_i2c_driver = { int goodix_i2c_bus_init(void) { + struct device_node *node; + ts_info("Goodix i2c driver init"); - return i2c_add_driver(&goodix_i2c_driver); + node = mmi_check_dynamic_device_node("goodix_ts_i2c"); + if (!node || mmi_device_is_available(node)) + return i2c_add_driver(&goodix_i2c_driver); + return -ENODEV; } void goodix_i2c_bus_exit(void)