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 <xizx@motorola.com>
Reviewed-on: https://gerrit.mot.com/2074098
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: litong <litong20@motorola.com>
Reviewed-by: Jichao Zou <zoujc@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
xizx 2021-09-23 14:26:25 +08:00 • committed by Zhenxin Xi
commit 60f1afce76

View file

@ -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