[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180322164330.24809-1-sebastian.reichel@collabora.co.uk>
Date: Thu, 22 Mar 2018 17:43:30 +0100
From: Sebastian Reichel <sebastian.reichel@...labora.co.uk>
To: Sebastian Reichel <sre@...nel.org>, Nick Dyer <nick@...anahar.org>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
linux-input@...r.kernel.org
Cc: Henrik Rydberg <rydberg@...math.org>, linux-kernel@...r.kernel.org,
kernel@...labora.com, Nandor Han <nandor.han@...com>,
Sebastian Reichel <sebastian.reichel@...labora.co.uk>
Subject: [PATCHv1] Input: atmel_mxt_ts - fix the firmware update
From: Nandor Han <nandor.han@...com>
The automatic update mechanism will trigger an update if the
info block CRCs are different between maxtouch configuration
file (maxtouch.cfg) and chip.
The driver compared the CRCs without retrieving the chip CRC,
resulting always in a failure and firmware flashing action
triggered. The patch will fix this issue by retrieving the
chip info block CRC before the check.
Suggested-by: Todd Weyenberg <Todd.Weyenberg@....ge.com>
Signed-off-by: Nandor Han <nandor.han@...com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@...labora.co.uk>
---
drivers/input/touchscreen/atmel_mxt_ts.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index 7659bc48f1db..ab936e6b0286 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -1728,6 +1728,25 @@ static int mxt_get_object_table(struct mxt_data *data)
return error;
}
+static int mxt_get_info_block_crc(struct mxt_data *data)
+{
+ size_t table_size;
+ int error;
+ u8 info_block_crc[MXT_INFO_CHECKSUM_SIZE];
+
+ table_size = data->info.object_num * sizeof(struct mxt_object);
+
+ /* Read the info block CRC */
+ error = __mxt_read_reg(data->client, MXT_OBJECT_START + table_size,
+ sizeof(info_block_crc), info_block_crc);
+ if (!error) {
+ data->info_crc = info_block_crc[0] | (info_block_crc[1] << 8) |
+ (info_block_crc[2] << 16);
+ }
+
+ return error;
+}
+
static int mxt_read_t9_resolution(struct mxt_data *data)
{
struct i2c_client *client = data->client;
@@ -2077,6 +2096,14 @@ static int mxt_initialize(struct mxt_data *data)
return error;
}
+ /* Get info block CRC */
+ error = mxt_get_info_block_crc(data);
+ if (error) {
+ dev_err(&client->dev, "Error %d reading info block CRC\n",
+ error);
+ return error;
+ }
+
error = mxt_acquire_irq(data);
if (error)
goto err_free_object_table;
--
2.16.2
Powered by blists - more mailing lists