summaryrefslogtreecommitdiff
path: root/drivers/input/rmi4/rmi_f34.c
diff options
context:
space:
mode:
authorNick Dyer <nick@shmanahar.org>2017-01-31 15:44:49 -0800
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2017-01-31 15:51:22 -0800
commitce363f0dec73b8ec2209a02a7271a9e67ed61368 (patch)
tree72feb59584d1744b884b013abc8ab9d29e575d5f /drivers/input/rmi4/rmi_f34.c
parent5a89916df2c8d2635b82a457cd4945dd73c1de3c (diff)
Input: synaptics-rmi4 - add sysfs interfaces for hardware IDs
These attributes provide various bits of information which may be enumerated under the RMI4 protocol to user space. This may be useful for displaying the particular version which is in use, or selecting the correct firmware to flash. Signed-off-by: Nick Dyer <nick@shmanahar.org> Tested-by: Chris Healy <cphealy@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/rmi4/rmi_f34.c')
-rw-r--r--drivers/input/rmi4/rmi_f34.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/drivers/input/rmi4/rmi_f34.c b/drivers/input/rmi4/rmi_f34.c
index 902b99007885..425fe140e9df 100644
--- a/drivers/input/rmi4/rmi_f34.c
+++ b/drivers/input/rmi4/rmi_f34.c
@@ -301,6 +301,52 @@ static int rmi_f34_status(struct rmi_function *fn)
return f34->update_status;
}
+static ssize_t rmi_driver_bootloader_id_show(struct device *dev,
+ struct device_attribute *dattr,
+ char *buf)
+{
+ struct rmi_driver_data *data = dev_get_drvdata(dev);
+ struct rmi_function *fn = data->f34_container;
+ struct f34_data *f34;
+
+ if (fn) {
+ f34 = dev_get_drvdata(&fn->dev);
+
+ if (f34->bl_version == 5)
+ return scnprintf(buf, PAGE_SIZE, "%c%c\n",
+ f34->bootloader_id[0],
+ f34->bootloader_id[1]);
+ else
+ return scnprintf(buf, PAGE_SIZE, "V%d.%d\n",
+ f34->bootloader_id[1],
+ f34->bootloader_id[0]);
+ }
+
+ return 0;
+}
+
+static DEVICE_ATTR(bootloader_id, 0444, rmi_driver_bootloader_id_show, NULL);
+
+static ssize_t rmi_driver_configuration_id_show(struct device *dev,
+ struct device_attribute *dattr,
+ char *buf)
+{
+ struct rmi_driver_data *data = dev_get_drvdata(dev);
+ struct rmi_function *fn = data->f34_container;
+ struct f34_data *f34;
+
+ if (fn) {
+ f34 = dev_get_drvdata(&fn->dev);
+
+ return scnprintf(buf, PAGE_SIZE, "%s\n", f34->configuration_id);
+ }
+
+ return 0;
+}
+
+static DEVICE_ATTR(configuration_id, 0444,
+ rmi_driver_configuration_id_show, NULL);
+
static int rmi_firmware_update(struct rmi_driver_data *data,
const struct firmware *fw)
{
@@ -452,6 +498,8 @@ static DEVICE_ATTR(update_fw_status, 0444,
rmi_driver_update_fw_status_show, NULL);
static struct attribute *rmi_firmware_attrs[] = {
+ &dev_attr_bootloader_id.attr,
+ &dev_attr_configuration_id.attr,
&dev_attr_update_fw.attr,
&dev_attr_update_fw_status.attr,
NULL