Commit b19fc9ec authored by Daniel Kurtz's avatar Daniel Kurtz Committed by Henrik Rydberg

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: default avatarDaniel Kurtz <djkurtz@chromium.org>
Signed-off-by: default avatarHenrik Rydberg <rydberg@euromail.se>
parent e0e0269f
...@@ -882,6 +882,26 @@ static void mxt_calc_resolution(struct mxt_data *data) ...@@ -882,6 +882,26 @@ static void mxt_calc_resolution(struct mxt_data *data)
} }
} }
/* Firmware Version is returned as Major.Minor.Build */
static ssize_t mxt_fw_version_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct mxt_data *data = dev_get_drvdata(dev);
struct mxt_info *info = &data->info;
return scnprintf(buf, PAGE_SIZE, "%u.%u.%02X\n",
info->version >> 4, info->version & 0xf, info->build);
}
/* Hardware Version is returned as FamilyID.VariantID */
static ssize_t mxt_hw_version_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct mxt_data *data = dev_get_drvdata(dev);
struct mxt_info *info = &data->info;
return scnprintf(buf, PAGE_SIZE, "%u.%u\n",
info->family_id, info->variant_id);
}
static ssize_t mxt_show_instance(char *buf, int count, static ssize_t mxt_show_instance(char *buf, int count,
struct mxt_object *object, int instance, struct mxt_object *object, int instance,
const u8 *val) const u8 *val)
...@@ -1047,10 +1067,14 @@ static ssize_t mxt_update_fw_store(struct device *dev, ...@@ -1047,10 +1067,14 @@ static ssize_t mxt_update_fw_store(struct device *dev,
return count; return count;
} }
static DEVICE_ATTR(fw_version, S_IRUGO, mxt_fw_version_show, NULL);
static DEVICE_ATTR(hw_version, S_IRUGO, mxt_hw_version_show, NULL);
static DEVICE_ATTR(object, S_IRUGO, mxt_object_show, NULL); static DEVICE_ATTR(object, S_IRUGO, mxt_object_show, NULL);
static DEVICE_ATTR(update_fw, S_IWUSR, NULL, mxt_update_fw_store); static DEVICE_ATTR(update_fw, S_IWUSR, NULL, mxt_update_fw_store);
static struct attribute *mxt_attrs[] = { static struct attribute *mxt_attrs[] = {
&dev_attr_fw_version.attr,
&dev_attr_hw_version.attr,
&dev_attr_object.attr, &dev_attr_object.attr,
&dev_attr_update_fw.attr, &dev_attr_update_fw.attr,
NULL NULL
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment