From: karl tsou <[email protected]>
Add config checksum attribute to sysfs
Signed-off-by: karl tsou <[email protected]>
Signed-off-by: Nick Dyer <[email protected]>
(cherry picked from ndyer/linux/for-upstream commit 03477477ddbe5dcad42853ab3f84166a8f807acf)
[gdavis: Forward port and fix conflicts.]
Signed-off-by: George G. Davis <[email protected]>
[jiada: Add commit description
Rename mxt_config_crc_show to config_crc_show
Replace DEVICE_ATTR with DEVICE_ATTR_RO]
Signed-off-by: Jiada Wang <[email protected]>
---
drivers/input/touchscreen/atmel_mxt_ts.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index affd2bf32969..780850343089 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -3124,6 +3124,15 @@ static int mxt_configure_objects(struct mxt_data *data,
return error;
}
+/* Configuration crc check sum is returned as hex xxxxxx */
+static ssize_t config_crc_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct mxt_data *data = dev_get_drvdata(dev);
+
+ return scnprintf(buf, PAGE_SIZE, "%06x\n", data->config_crc);
+}
+
/* Firmware Version is returned as Major.Minor.Build */
static ssize_t fw_version_show(struct device *dev,
struct device_attribute *attr, char *buf)
@@ -3477,12 +3486,14 @@ static DEVICE_ATTR_RO(fw_version);
static DEVICE_ATTR_RO(hw_version);
static DEVICE_ATTR(object, S_IRUGO, mxt_object_show, NULL);
static DEVICE_ATTR_WO(update_cfg);
+static DEVICE_ATTR_RO(config_crc);
static struct attribute *mxt_attrs[] = {
&dev_attr_fw_version.attr,
&dev_attr_hw_version.attr,
&dev_attr_object.attr,
&dev_attr_update_cfg.attr,
+ &dev_attr_config_crc.attr,
NULL
};
--
2.17.1