From 60f1afce76063ba156f23dae944bee5790ffe01a Mon Sep 17 00:00:00 2001 From: xizx Date: Thu, 23 Sep 2021 14:26:25 +0800 Subject: [PATCH] touchscreen: dynamic check the stmicro device status Kernel should not allow two drivers to assign same irq resource, or else it will cause unknown irq storm issue. For stmicro fts touch driver, the i2c device driver will always match device tree node and request irq resource even fts touch doesn't exist at all. When the kernel always loads another touch driver, such as goodix driver, they will compete the irq responsing and cause lots of cpu hang issue. Dynamically check the sensor device status according dts config to avoid the uncessary register driver. Change-Id: I23b694e17f84e1e612f706dce9b2d3f6cf587c11 Signed-off-by: xizx Reviewed-on: https://gerrit.mot.com/2074098 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: litong Reviewed-by: Jichao Zou Submit-Approved: Jira Key --- drivers/input/touchscreen/stmicro_mmi/fts.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/stmicro_mmi/fts.c b/drivers/input/touchscreen/stmicro_mmi/fts.c index adb2ccc61782..de8409ef2c52 100644 --- a/drivers/input/touchscreen/stmicro_mmi/fts.c +++ b/drivers/input/touchscreen/stmicro_mmi/fts.c @@ -4547,7 +4547,11 @@ static struct spi_driver fts_spi_driver = { static int __init fts_driver_init(void) { #ifdef I2C_INTERFACE - return i2c_add_driver(&fts_i2c_driver); + struct device_node *node; + node = mmi_check_dynamic_device_node("st_fts"); + if (!node || mmi_device_is_available(node)) + return i2c_add_driver(&fts_i2c_driver); + return -ENODEV; #else return spi_register_driver(&fts_spi_driver); #endif