diff mbox series

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

Message ID 20201110181550.23853-4-andrej.valek@siemens.com (mailing list archive)
State New, archived
Headers show
Series None | expand

Commit Message

Valek, Andrej Nov. 10, 2020, 6:15 p.m. UTC
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 <andrej.valek@siemens.com>
---
 drivers/input/touchscreen/atmel_mxt_ts.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

Comments

Dmitry Torokhov Nov. 23, 2020, 6:56 a.m. UTC | #1
Hi Andrej,

On Tue, Nov 10, 2020 at 07:15:49PM +0100, Andrej Valek wrote:
> 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.

Automatically updating firmware and config on driver probe was a
mistake, and I am planning on removing the code altogether and expect
userspace to determine if flashing is needed and request it explicitly,
so this option is not really needed.

Thanks.
diff mbox series

Patch

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;