Commit 37dee1ac authored by Charlie Mooney's avatar Charlie Mooney Committed by Dmitry Torokhov

Input: elants_i2c - append hw_version to FW file

Currently the elants_i2c driver simply requests a static filename
/lib/firmware/elants_i2c.bin when it gets firmware updates.  This is a
problem if you have two Elan touchscreens using the same driver.  If both
touchscreens have different firmwares, you would need to move the files
around in your filesystem when you're updating them so that they don't get
updated with the other's FW.  If you have a read-only filesystem then this
is impossible, even.

This patch changes the elants_i2c driver to automatically append the
four-hex-digit hw_version of the device onto the name of the FW file it's
requesting for update.  Since different touchscreens should have a
different hw_version's this means the user needs to append the hw version
of the touchscreen he or she intends to update onto the end of the firmware
filename and then the driver will do the rest.

The firmware filenames it looks for now are of the form:

  elants_i2c_${HW_VERSION}.bin

  eg:

  elants_i2c_2a44.bin
Signed-off-by: default avatarCharlie Mooney <charliemooney@chromium.org>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent f13b2065
...@@ -98,7 +98,6 @@ ...@@ -98,7 +98,6 @@
#define MAX_FW_UPDATE_RETRIES 30 #define MAX_FW_UPDATE_RETRIES 30
#define ELAN_FW_PAGESIZE 132 #define ELAN_FW_PAGESIZE 132
#define ELAN_FW_FILENAME "elants_i2c.bin"
/* calibration timeout definition */ /* calibration timeout definition */
#define ELAN_CALI_TIMEOUT_MSEC 10000 #define ELAN_CALI_TIMEOUT_MSEC 10000
...@@ -697,12 +696,19 @@ static int elants_i2c_fw_update(struct elants_data *ts) ...@@ -697,12 +696,19 @@ static int elants_i2c_fw_update(struct elants_data *ts)
{ {
struct i2c_client *client = ts->client; struct i2c_client *client = ts->client;
const struct firmware *fw; const struct firmware *fw;
char *fw_name;
int error; int error;
error = request_firmware(&fw, ELAN_FW_FILENAME, &client->dev); fw_name = kasprintf(GFP_KERNEL, "elants_i2c_%4x.bin", ts->hw_version);
if (!fw_name)
return -ENOMEM;
dev_info(&client->dev, "requesting fw name = %s\n", fw_name);
error = request_firmware(&fw, fw_name, &client->dev);
kfree(fw_name);
if (error) { if (error) {
dev_err(&client->dev, "failed to request firmware %s: %d\n", dev_err(&client->dev, "failed to request firmware: %d\n",
ELAN_FW_FILENAME, error); error);
return error; return error;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment