diff options
author | Daniel Kurtz <djkurtz@chromium.org> | 2012-06-28 09:08:16 -0400 |
---|---|---|
committer | Henrik Rydberg <rydberg@euromail.se> | 2012-06-29 09:58:05 -0400 |
commit | b19fc9ec241382c2155bf56f08f02066f2fb4826 (patch) | |
tree | e252da3859cf7612b94e7c7161c277523c0d3608 /drivers/input/touchscreen | |
parent | e0e0269f347ce89251ecf02ec4a209136bda258e (diff) |
Input: atmel_mxt_ts - add sysfs entries to read fw and hw version
Make firmware and hardware version strings available to userspace.
This is useful, for example, to allow a userspace program to implement
a firwmare update policy.
Change-Id: I1eddb4bbf5f3f9ae6947a8528598973ddead18cf
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'drivers/input/touchscreen')
-rw-r--r-- | drivers/input/touchscreen/atmel_mxt_ts.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 7a839d106336..f2c1fbe2556e 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c | |||
@@ -882,6 +882,26 @@ static void mxt_calc_resolution(struct mxt_data *data) | |||
882 | } | 882 | } |
883 | } | 883 | } |
884 | 884 | ||
885 | /* Firmware Version is returned as Major.Minor.Build */ | ||
886 | static ssize_t mxt_fw_version_show(struct device *dev, | ||
887 | struct device_attribute *attr, char *buf) | ||
888 | { | ||
889 | struct mxt_data *data = dev_get_drvdata(dev); | ||
890 | struct mxt_info *info = &data->info; | ||
891 | return scnprintf(buf, PAGE_SIZE, "%u.%u.%02X\n", | ||
892 | info->version >> 4, info->version & 0xf, info->build); | ||
893 | } | ||
894 | |||
895 | /* Hardware Version is returned as FamilyID.VariantID */ | ||
896 | static ssize_t mxt_hw_version_show(struct device *dev, | ||
897 | struct device_attribute *attr, char *buf) | ||
898 | { | ||
899 | struct mxt_data *data = dev_get_drvdata(dev); | ||
900 | struct mxt_info *info = &data->info; | ||
901 | return scnprintf(buf, PAGE_SIZE, "%u.%u\n", | ||
902 | info->family_id, info->variant_id); | ||
903 | } | ||
904 | |||
885 | static ssize_t mxt_show_instance(char *buf, int count, | 905 | static ssize_t mxt_show_instance(char *buf, int count, |
886 | struct mxt_object *object, int instance, | 906 | struct mxt_object *object, int instance, |
887 | const u8 *val) | 907 | const u8 *val) |
@@ -1047,10 +1067,14 @@ static ssize_t mxt_update_fw_store(struct device *dev, | |||
1047 | return count; | 1067 | return count; |
1048 | } | 1068 | } |
1049 | 1069 | ||
1070 | static DEVICE_ATTR(fw_version, S_IRUGO, mxt_fw_version_show, NULL); | ||
1071 | static DEVICE_ATTR(hw_version, S_IRUGO, mxt_hw_version_show, NULL); | ||
1050 | static DEVICE_ATTR(object, S_IRUGO, mxt_object_show, NULL); | 1072 | static DEVICE_ATTR(object, S_IRUGO, mxt_object_show, NULL); |
1051 | static DEVICE_ATTR(update_fw, S_IWUSR, NULL, mxt_update_fw_store); | 1073 | static DEVICE_ATTR(update_fw, S_IWUSR, NULL, mxt_update_fw_store); |
1052 | 1074 | ||
1053 | static struct attribute *mxt_attrs[] = { | 1075 | static struct attribute *mxt_attrs[] = { |
1076 | &dev_attr_fw_version.attr, | ||
1077 | &dev_attr_hw_version.attr, | ||
1054 | &dev_attr_object.attr, | 1078 | &dev_attr_object.attr, |
1055 | &dev_attr_update_fw.attr, | 1079 | &dev_attr_update_fw.attr, |
1056 | NULL | 1080 | NULL |