diff mbox series

[4/8] Input: atmel_mxt_ts - add interface to read ts sensor matrix info.

Message ID 20190828095349.30607-4-jongpuls@gmail.com (mailing list archive)
State New, archived
Headers show
Series [1/8] Input: atmel_mxt_ts - eanble calibration via sysfs | expand

Commit Message

Jongpil Jung Aug. 28, 2019, 9:53 a.m. UTC
From: Jongpil Jung <jongpil19.jung@samsung.corp-partner.google.com>

To get more hardware information, make interface to read sensor matrix
size.

Change-Id: I41a72b4c4031f2041479f183b59162da3281beda
---
 drivers/input/touchscreen/atmel_mxt_ts.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff mbox series

Patch

diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index cb3a608f60bf..f5eb81ff2fd3 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -2743,6 +2743,16 @@  static ssize_t mxt_info_csum_show(struct device *dev,
 	return scnprintf(buf, PAGE_SIZE, "%06x\n", data->info_crc);
 }
 
+/* Matrix Size is <MatrixSizeX> <MatrixSizeY> */
+static ssize_t mxt_matrix_size_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->matrix_xsize, info->matrix_ysize);
+}
+
 static ssize_t mxt_show_instance(char *buf, int count,
 				 struct mxt_object *object, int instance,
 				 const u8 *val)
@@ -2976,6 +2986,7 @@  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(matrix_size, S_IRUGO, mxt_matrix_size_show, NULL);
 static DEVICE_ATTR(object, S_IRUGO, mxt_object_show, NULL);
 static DEVICE_ATTR(update_fw, S_IWUSR, NULL, mxt_update_fw_store);
 
@@ -2986,6 +2997,7 @@  static struct attribute *mxt_attrs[] = {
 	&dev_attr_fw_version.attr,
 	&dev_attr_hw_version.attr,
 	&dev_attr_info_csum.attr,
+	&dev_attr_matrix_size.attr,
 	&dev_attr_object.attr,
 	&dev_attr_update_fw.attr,
 	NULL