aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCharlie Mooney2015-06-08 18:48:23 -0500
committerDmitry Torokhov2015-06-08 19:12:25 -0500
commit7b9f1830745cb3ad9e0f3774e83900610cedd39c (patch)
treee7fb5b43a30524e2c05261df219da205125cc0fd /drivers/input/mouse/elan_i2c_core.c
parent12018ac3d679d6a3c6c738ac805797fe4dd43912 (diff)
downloadkernel-omap-7b9f1830745cb3ad9e0f3774e83900610cedd39c.tar.gz
kernel-omap-7b9f1830745cb3ad9e0f3774e83900610cedd39c.tar.xz
kernel-omap-7b9f1830745cb3ad9e0f3774e83900610cedd39c.zip
Input: elan_i2c - add product IDs FW names
Previously the elan_i2c touchpad driver would simply request the firmware "/lib/firmware/elan_i2c.bin", which does not work well if there are multiple such devices in the system. Let's append the "product ID" (by using the same function as the sysfs interface for consistency) to the filename. This results in filenames of the form "/lib/firmware/elan_i2c_72.0.bin", allowing you to support multiple elan_i2c touchpads on the same device by simply naming each device's FW with its corresponding product ID. This way when you trigger a fw update the driver will load the correct binary. Signed-off-by: Charlie Mooney <charliemooney@chromium.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/mouse/elan_i2c_core.c')
-rw-r--r--drivers/input/mouse/elan_i2c_core.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c
index b4cfd18cdaca..62641f2adaf7 100644
--- a/drivers/input/mouse/elan_i2c_core.c
+++ b/drivers/input/mouse/elan_i2c_core.c
@@ -4,7 +4,7 @@
4 * Copyright (c) 2013 ELAN Microelectronics Corp. 4 * Copyright (c) 2013 ELAN Microelectronics Corp.
5 * 5 *
6 * Author: 林政維 (Duson Lin) <dusonlin@emc.com.tw> 6 * Author: 林政維 (Duson Lin) <dusonlin@emc.com.tw>
7 * Version: 1.5.8 7 * Version: 1.5.9
8 * 8 *
9 * Based on cyapa driver: 9 * Based on cyapa driver:
10 * copyright (c) 2011-2012 Cypress Semiconductor, Inc. 10 * copyright (c) 2011-2012 Cypress Semiconductor, Inc.
@@ -40,7 +40,7 @@
40#include "elan_i2c.h" 40#include "elan_i2c.h"
41 41
42#define DRIVER_NAME "elan_i2c" 42#define DRIVER_NAME "elan_i2c"
43#define ELAN_DRIVER_VERSION "1.5.8" 43#define ELAN_DRIVER_VERSION "1.5.9"
44#define ETP_MAX_PRESSURE 255 44#define ETP_MAX_PRESSURE 255
45#define ETP_FWIDTH_REDUCE 90 45#define ETP_FWIDTH_REDUCE 90
46#define ETP_FINGER_WIDTH 15 46#define ETP_FINGER_WIDTH 15
@@ -438,7 +438,8 @@ static ssize_t elan_sysfs_read_product_id(struct device *dev,
438 struct i2c_client *client = to_i2c_client(dev); 438 struct i2c_client *client = to_i2c_client(dev);
439 struct elan_tp_data *data = i2c_get_clientdata(client); 439 struct elan_tp_data *data = i2c_get_clientdata(client);
440 440
441 return sprintf(buf, "%d.0\n", data->product_id); 441 return sprintf(buf, ETP_PRODUCT_ID_FORMAT_STRING "\n",
442 data->product_id);
442} 443}
443 444
444static ssize_t elan_sysfs_read_fw_ver(struct device *dev, 445static ssize_t elan_sysfs_read_fw_ver(struct device *dev,
@@ -477,14 +478,23 @@ static ssize_t elan_sysfs_update_fw(struct device *dev,
477{ 478{
478 struct elan_tp_data *data = dev_get_drvdata(dev); 479 struct elan_tp_data *data = dev_get_drvdata(dev);
479 const struct firmware *fw; 480 const struct firmware *fw;
481 char *fw_name;
480 int error; 482 int error;
481 const u8 *fw_signature; 483 const u8 *fw_signature;
482 static const u8 signature[] = {0xAA, 0x55, 0xCC, 0x33, 0xFF, 0xFF}; 484 static const u8 signature[] = {0xAA, 0x55, 0xCC, 0x33, 0xFF, 0xFF};
483 485
484 error = request_firmware(&fw, ETP_FW_NAME, dev); 486 /* Look for a firmware with the product id appended. */
487 fw_name = kasprintf(GFP_KERNEL, ETP_FW_NAME, data->product_id);
488 if (!fw_name) {
489 dev_err(dev, "failed to allocate memory for firmware name\n");
490 return -ENOMEM;
491 }
492
493 dev_info(dev, "requesting fw '%s'\n", fw_name);
494 error = request_firmware(&fw, fw_name, dev);
495 kfree(fw_name);
485 if (error) { 496 if (error) {
486 dev_err(dev, "cannot load firmware %s: %d\n", 497 dev_err(dev, "failed to request firmware: %d\n", error);
487 ETP_FW_NAME, error);
488 return error; 498 return error;
489 } 499 }
490 500