From: Jongpil Jung <jongpil19.jung@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> To check current touchscreen config, we need to read information and config checksum. With patch, we can check checksum in user space via sysfs easily. Change-Id: I0328945cec10f142bd5670bfd7a3133de3f473db --- drivers/input/touchscreen/atmel_mxt_ts.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 4fe2059fa3c1..cabe746607fc 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -2692,6 +2692,13 @@ static ssize_t mxt_calibrate_store(struct device *dev, return ret ?: count; } +static ssize_t mxt_config_csum_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 mxt_fw_version_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -2712,6 +2719,13 @@ static ssize_t mxt_hw_version_show(struct device *dev, info->family_id, info->variant_id); } +static ssize_t mxt_info_csum_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->info_crc); +} + static ssize_t mxt_show_instance(char *buf, int count, struct mxt_object *object, int instance, const u8 *val) @@ -2940,15 +2954,19 @@ static ssize_t mxt_update_fw_store(struct device *dev, } static DEVICE_ATTR(calibrate, S_IWUSR, NULL, mxt_calibrate_store); +static DEVICE_ATTR(config_csum, S_IRUGO, mxt_config_csum_show, NULL); 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(info_csum, S_IRUGO, mxt_info_csum_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 struct attribute *mxt_attrs[] = { &dev_attr_calibrate.attr, + &dev_attr_config_csum.attr, &dev_attr_fw_version.attr, &dev_attr_hw_version.attr, + &dev_attr_info_csum.attr, &dev_attr_object.attr, &dev_attr_update_fw.attr, NULL -- 2.17.1