Thread (29 messages) 29 messages, 4 authors, 2020-11-23
STALE2014d
Revisions (4)
  1. v1 [diff vs current]
  2. v1 [diff vs current]
  3. v1 [diff vs current]
  4. v1 current

[PATCH v4 3/4] Input: atmel_mxt_ts - add option to disable firmware loading

From: Andrej Valek <hidden>
Date: 2020-11-10 18:16:38
Also in: linux-devicetree, lkml
Subsystem: atmel maxtouch driver, input (keyboard, mouse, joystick, touchscreen) drivers, the rest · Maintainers: Nick Dyer, Dmitry Torokhov, Linus Torvalds

Firmware file loadind for mXT336U controller takes too much time (~60s).
There is no check that configuration is the same which is already present.
This happens always during boot, which makes touchscreen unusable.

Add there an option to prevent firmware file loading, but keep it enabled
by default.

Signed-off-by: Andrej Valek <redacted>
---
 drivers/input/touchscreen/atmel_mxt_ts.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index 98f17fa3a8926..491d5088d2826 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -311,6 +311,7 @@ struct mxt_data {
 	struct mxt_dbg dbg;
 	struct gpio_desc *reset_gpio;
 	bool use_retrigen_workaround;
+	bool cfg_loading_disabled;
 
 	/* Cached parameters from object table */
 	u16 T5_address;
@@ -2191,9 +2192,15 @@ static int mxt_initialize(struct mxt_data *data)
 	if (error)
 		return error;
 
-	error = request_firmware_nowait(THIS_MODULE, true, MXT_CFG_NAME,
-					&client->dev, GFP_KERNEL, data,
-					mxt_config_cb);
+	/* Load firmware if enabled */
+	if (!data->cfg_loading_disabled) {
+		error = request_firmware_nowait(THIS_MODULE, true, MXT_CFG_NAME,
+						&client->dev, GFP_KERNEL, data,
+						mxt_config_cb);
+	} else {
+		mxt_config_cb(NULL, data);
+	}
+
 	if (error) {
 		dev_err(&client->dev, "Failed to invoke firmware loader: %d\n",
 			error);
@@ -3158,6 +3165,10 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id)
 		msleep(MXT_RESET_INVALID_CHG);
 	}
 
+	/* prevent firmware flashing for each start */
+	data->cfg_loading_disabled = device_property_read_bool(&client->dev,
+						"atmel,do-not-load-fw");
+
 	error = mxt_initialize(data);
 	if (error)
 		return error;
-- 
2.20.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help