Skip to content

Commit

Permalink
Input: raydium_i2c_ts - include hardware version in firmware name
Browse files Browse the repository at this point in the history
Add hardware version to the firmware file name to handle scenarios where
single system image supports variety of devices.

Signed-off-by: Jeffrey Lin <jeffrey.lin@rad-ic.com>
Patchwork-Id: 10127677
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
  • Loading branch information
Jeffrey Lin authored and Dmitry Torokhov committed Jan 5, 2018
1 parent b8af0b5 commit 92a3743
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions drivers/input/touchscreen/raydium_i2c_ts.c
Original file line number Diff line number Diff line change
Expand Up @@ -752,13 +752,20 @@ static int raydium_i2c_fw_update(struct raydium_data *ts)
{
struct i2c_client *client = ts->client;
const struct firmware *fw = NULL;
const char *fw_file = "raydium.fw";
char *fw_file;
int error;

fw_file = kasprintf(GFP_KERNEL, "raydium_%#04x.fw",
le32_to_cpu(ts->info.hw_ver));
if (!fw_file)
return -ENOMEM;

dev_dbg(&client->dev, "firmware name: %s\n", fw_file);

error = request_firmware(&fw, fw_file, &client->dev);
if (error) {
dev_err(&client->dev, "Unable to open firmware %s\n", fw_file);
return error;
goto out_free_fw_file;
}

disable_irq(client->irq);
Expand Down Expand Up @@ -787,6 +794,9 @@ static int raydium_i2c_fw_update(struct raydium_data *ts)

release_firmware(fw);

out_free_fw_file:
kfree(fw_file);

return error;
}

Expand Down

0 comments on commit 92a3743

Please sign in to comment.