Skip to content

Commit 92a3743

Browse files
Jeffrey Lindtor
authored andcommitted
Input: raydium_i2c_ts - include hardware version in firmware name
Add hardware version to the firmware file name to handle scenarios where single system image supports variety of devices. Signed-off-by: Jeffrey Lin <[email protected]> Patchwork-Id: 10127677 Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent b8af0b5 commit 92a3743

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

drivers/input/touchscreen/raydium_i2c_ts.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -752,13 +752,20 @@ static int raydium_i2c_fw_update(struct raydium_data *ts)
752752
{
753753
struct i2c_client *client = ts->client;
754754
const struct firmware *fw = NULL;
755-
const char *fw_file = "raydium.fw";
755+
char *fw_file;
756756
int error;
757757

758+
fw_file = kasprintf(GFP_KERNEL, "raydium_%#04x.fw",
759+
le32_to_cpu(ts->info.hw_ver));
760+
if (!fw_file)
761+
return -ENOMEM;
762+
763+
dev_dbg(&client->dev, "firmware name: %s\n", fw_file);
764+
758765
error = request_firmware(&fw, fw_file, &client->dev);
759766
if (error) {
760767
dev_err(&client->dev, "Unable to open firmware %s\n", fw_file);
761-
return error;
768+
goto out_free_fw_file;
762769
}
763770

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

788795
release_firmware(fw);
789796

797+
out_free_fw_file:
798+
kfree(fw_file);
799+
790800
return error;
791801
}
792802

0 commit comments

Comments
 (0)