aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/rmi4/rmi_f34.c
diff options
context:
space:
mode:
authorNick Dyer <nick@shmanahar.org>2017-01-31 18:44:49 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2017-01-31 18:51:22 -0500
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)
301 return f34->update_status; 301 return f34->update_status;
302} 302}
303 303
304static ssize_t rmi_driver_bootloader_id_show(struct device *dev,
305 struct device_attribute *dattr,
306 char *buf)
307{
308 struct rmi_driver_data *data = dev_get_drvdata(dev);
309 struct rmi_function *fn = data->f34_container;
310 struct f34_data *f34;
311
312 if (fn) {
313 f34 = dev_get_drvdata(&fn->dev);
314
315 if (f34->bl_version == 5)
316 return scnprintf(buf, PAGE_SIZE, "%c%c\n",
317 f34->bootloader_id[0],
318 f34->bootloader_id[1]);
319 else
320 return scnprintf(buf, PAGE_SIZE, "V%d.%d\n",
321 f34->bootloader_id[1],
322 f34->bootloader_id[0]);
323 }
324
325 return 0;
326}
327
328static DEVICE_ATTR(bootloader_id, 0444, rmi_driver_bootloader_id_show, NULL);
329
330static ssize_t rmi_driver_configuration_id_show(struct device *dev,
331 struct device_attribute *dattr,
332 char *buf)
333{
334 struct rmi_driver_data *data = dev_get_drvdata(dev);
335 struct rmi_function *fn = data->f34_container;
336 struct f34_data *f34;
337
338 if (fn) {
339 f34 = dev_get_drvdata(&fn->dev);
340
341 return scnprintf(buf, PAGE_SIZE, "%s\n", f34->configuration_id);
342 }
343
344 return 0;
345}
346
347static DEVICE_ATTR(configuration_id, 0444,
348 rmi_driver_configuration_id_show, NULL);
349
304static int rmi_firmware_update(struct rmi_driver_data *data, 350static int rmi_firmware_update(struct rmi_driver_data *data,
305 const struct firmware *fw) 351 const struct firmware *fw)
306{ 352{
@@ -452,6 +498,8 @@ static DEVICE_ATTR(update_fw_status, 0444,
452 rmi_driver_update_fw_status_show, NULL); 498 rmi_driver_update_fw_status_show, NULL);
453 499
454static struct attribute *rmi_firmware_attrs[] = { 500static struct attribute *rmi_firmware_attrs[] = {
501 &dev_attr_bootloader_id.attr,
502 &dev_attr_configuration_id.attr,
455 &dev_attr_update_fw.attr, 503 &dev_attr_update_fw.attr,
456 &dev_attr_update_fw_status.attr, 504 &dev_attr_update_fw_status.attr,
457 NULL 505 NULL