From f5c1a1c3e49d56504c0927f9a64174dd097edd99 Mon Sep 17 00:00:00 2001 From: Satya Rama Aditya Pinapala Date: Thu, 19 Mar 2020 17:56:39 -0700 Subject: [PATCH] drivers: input: touchscreen: defer probe if panel not found In many cases display panel information may not be available when the touch driver is being probed. This change defers the probe if the panel is not found to ensure that the correct touch driver is probed. Change-Id: I12d1dd3678a85baa468b332d61be4ba9ce81db43 Signed-off-by: Satya Rama Aditya Pinapala --- drivers/input/touchscreen/atmel_mxt_ts.c | 8 ++++++-- .../input/touchscreen/focaltech_touch/focaltech_core.c | 8 ++++++-- drivers/input/touchscreen/st/fts.c | 8 ++++++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 8a35fc705f67..9f08da6ad679 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -3428,7 +3428,7 @@ static int mxt_check_dt(struct device_node *np) return 0; } - return -ENODEV; + return PTR_ERR(panel); } #endif @@ -3528,7 +3528,11 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) #ifdef CONFIG_OF #ifdef CONFIG_DRM - if (mxt_check_dt(dt)) { + error = mxt_check_dt(dt); + if (error == -EPROBE_DEFER) + return error; + + if (error) { if (!(mxt_check_dedicated_touch(dt, "compatible", "qcom,i2c-touch-active"))) return -EPROBE_DEFER; diff --git a/drivers/input/touchscreen/focaltech_touch/focaltech_core.c b/drivers/input/touchscreen/focaltech_touch/focaltech_core.c index e7d6a0fb0405..edc000748342 100644 --- a/drivers/input/touchscreen/focaltech_touch/focaltech_core.c +++ b/drivers/input/touchscreen/focaltech_touch/focaltech_core.c @@ -1704,7 +1704,7 @@ static int fts_ts_check_dt(struct device_node *np) } } - return -ENODEV; + return PTR_ERR(panel); } static int fts_ts_check_default_tp(struct device_node *dt, const char *prop) @@ -1764,7 +1764,11 @@ static int fts_ts_probe(struct i2c_client *client, const struct i2c_device_id *i return -ENODEV; } - if (fts_ts_check_dt(dp)) { + ret = fts_ts_check_dt(dp); + if (ret == -EPROBE_DEFER) + return ret; + + if (ret) { if (!fts_ts_check_default_tp(dp, "qcom,i2c-touch-active")) ret = -EPROBE_DEFER; else diff --git a/drivers/input/touchscreen/st/fts.c b/drivers/input/touchscreen/st/fts.c index 8cf227fc9769..46efbcaad9db 100644 --- a/drivers/input/touchscreen/st/fts.c +++ b/drivers/input/touchscreen/st/fts.c @@ -4512,7 +4512,7 @@ static int check_dt(struct device_node *np) } } - return -ENODEV; + return PTR_ERR(panel); } static int check_default_tp(struct device_node *dt, const char *prop) @@ -4939,7 +4939,11 @@ static int fts_probe(struct i2c_client *client, const struct i2c_device_id *idp) int error = 0; struct device_node *dp = client->dev.of_node; - if (check_dt(dp)) { + error = check_dt(dp); + if (error == -EPROBE_DEFER) + return error; + + if (error) { if (!check_default_tp(dp, "qcom,i2c-touch-active")) error = -EPROBE_DEFER; else