lkml.org 
[lkml]   [2020]   [Mar]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] Input: edt-ft5x06 - add fw_version debugfs file to read
Date
Add simple fw_version file in debugfs to read the value from 0xa6
which is the firmware version.

Signed-off-by: Martin Kepplinger <martin.kepplinger@puri.sm>
---

Since we got at least 2 different FT firmware version in our controller,
we need to distinguish them.

thanks,
martin


drivers/input/touchscreen/edt-ft5x06.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)

diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
index bc7fb2c005b5..efb09bba739a 100644
--- a/drivers/input/touchscreen/edt-ft5x06.c
+++ b/drivers/input/touchscreen/edt-ft5x06.c
@@ -51,6 +51,8 @@
#define EV_REGISTER_OFFSET_Y 0x45
#define EV_REGISTER_OFFSET_X 0x46

+#define REG_FW_VERSION 0xa6
+
#define NO_REGISTER 0xff

#define WORK_REGISTER_OPMODE 0x3c
@@ -685,6 +687,22 @@ static int edt_ft5x06_debugfs_mode_set(void *data, u64 mode)
DEFINE_SIMPLE_ATTRIBUTE(debugfs_mode_fops, edt_ft5x06_debugfs_mode_get,
edt_ft5x06_debugfs_mode_set, "%llu\n");

+static int edt_ft5x06_debugfs_fw_version_get(void *data, u64 *version)
+{
+ struct edt_ft5x06_ts_data *tsdata = data;
+ struct i2c_client *client = tsdata->client;
+
+ *version = edt_ft5x06_register_read(tsdata, REG_FW_VERSION);
+ if (*version == 0xff || *version == 0x00)
+ dev_dbg(&client->dev, "failed to get firmware version\n");
+
+ return 0;
+};
+
+DEFINE_SIMPLE_ATTRIBUTE(debugfs_fw_version_fops,
+ edt_ft5x06_debugfs_fw_version_get,
+ NULL, "%llu\n");
+
static ssize_t edt_ft5x06_debugfs_raw_data_read(struct file *file,
char __user *buf, size_t count, loff_t *off)
{
@@ -779,6 +797,9 @@ edt_ft5x06_ts_prepare_debugfs(struct edt_ft5x06_ts_data *tsdata,

debugfs_create_file("mode", S_IRUSR | S_IWUSR,
tsdata->debug_dir, tsdata, &debugfs_mode_fops);
+ debugfs_create_file("fw_version", S_IRUSR,
+ tsdata->debug_dir, tsdata,
+ &debugfs_fw_version_fops);
debugfs_create_file("raw_data", S_IRUSR,
tsdata->debug_dir, tsdata, &debugfs_raw_data_fops);
}
--
2.20.1
\
 
 \ /
  Last update: 2020-03-16 15:29    [W:0.046 / U:1.736 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site