Skip to content

Commit 68743c5

Browse files
Wolfram Sangdtor
authored andcommitted
Input: edt-ft5x06 - use per-client debugfs directory
The I2C core now provides a debugfs entry for each client. Let this driver use it instead of the custom directory in debugfs root. Further improvements by this change: support of multiple instances. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20250318091904.22468-1-wsa+renesas@sang-engineering.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent 6a71a66 commit 68743c5

2 files changed

Lines changed: 27 additions & 14 deletions

File tree

Documentation/input/devices/edt-ft5x06.rst

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,25 @@ The driver allows configuration of the touch screen via a set of sysfs files:
2929

3030

3131
For debugging purposes the driver provides a few files in the debug
32-
filesystem (if available in the kernel). In /sys/kernel/debug/edt_ft5x06
33-
you'll find the following files:
32+
filesystem (if available in the kernel). They are located in:
33+
34+
/sys/kernel/debug/i2c/<i2c-bus>/<i2c-device>/
35+
36+
If you don't know the bus and device numbers, you can look them up with this
37+
command:
38+
39+
$ ls -l /sys/bus/i2c/drivers/edt_ft5x06
40+
41+
The dereference of the symlink will contain the needed information. You will
42+
need the last two elements of its path:
43+
44+
0-0038 -> ../../../../devices/platform/soc/fcfee800.i2c/i2c-0/0-0038
45+
46+
So in this case, the location for the debug files is:
47+
48+
/sys/kernel/debug/i2c/i2c-0/0-0038/
49+
50+
There, you'll find the following files:
3451

3552
num_x, num_y:
3653
(readonly) contains the number of sensor fields in X- and

drivers/input/touchscreen/edt-ft5x06.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ struct edt_ft5x06_ts_data {
120120
struct regmap *regmap;
121121

122122
#if defined(CONFIG_DEBUG_FS)
123-
struct dentry *debug_dir;
124123
u8 *raw_buffer;
125124
size_t raw_bufsize;
126125
#endif
@@ -815,23 +814,21 @@ static const struct file_operations debugfs_raw_data_fops = {
815814
.read = edt_ft5x06_debugfs_raw_data_read,
816815
};
817816

818-
static void edt_ft5x06_ts_prepare_debugfs(struct edt_ft5x06_ts_data *tsdata,
819-
const char *debugfs_name)
817+
static void edt_ft5x06_ts_prepare_debugfs(struct edt_ft5x06_ts_data *tsdata)
820818
{
821-
tsdata->debug_dir = debugfs_create_dir(debugfs_name, NULL);
819+
struct dentry *debug_dir = tsdata->client->debugfs;
822820

823-
debugfs_create_u16("num_x", S_IRUSR, tsdata->debug_dir, &tsdata->num_x);
824-
debugfs_create_u16("num_y", S_IRUSR, tsdata->debug_dir, &tsdata->num_y);
821+
debugfs_create_u16("num_x", S_IRUSR, debug_dir, &tsdata->num_x);
822+
debugfs_create_u16("num_y", S_IRUSR, debug_dir, &tsdata->num_y);
825823

826824
debugfs_create_file("mode", S_IRUSR | S_IWUSR,
827-
tsdata->debug_dir, tsdata, &debugfs_mode_fops);
825+
debug_dir, tsdata, &debugfs_mode_fops);
828826
debugfs_create_file("raw_data", S_IRUSR,
829-
tsdata->debug_dir, tsdata, &debugfs_raw_data_fops);
827+
debug_dir, tsdata, &debugfs_raw_data_fops);
830828
}
831829

832830
static void edt_ft5x06_ts_teardown_debugfs(struct edt_ft5x06_ts_data *tsdata)
833831
{
834-
debugfs_remove_recursive(tsdata->debug_dir);
835832
kfree(tsdata->raw_buffer);
836833
}
837834

@@ -842,8 +839,7 @@ static int edt_ft5x06_factory_mode(struct edt_ft5x06_ts_data *tsdata)
842839
return -ENOSYS;
843840
}
844841

845-
static void edt_ft5x06_ts_prepare_debugfs(struct edt_ft5x06_ts_data *tsdata,
846-
const char *debugfs_name)
842+
static void edt_ft5x06_ts_prepare_debugfs(struct edt_ft5x06_ts_data *tsdata)
847843
{
848844
}
849845

@@ -1349,7 +1345,7 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client)
13491345
if (error)
13501346
return error;
13511347

1352-
edt_ft5x06_ts_prepare_debugfs(tsdata, dev_driver_string(&client->dev));
1348+
edt_ft5x06_ts_prepare_debugfs(tsdata);
13531349

13541350
dev_dbg(&client->dev,
13551351
"EDT FT5x06 initialized: IRQ %d, WAKE pin %d, Reset pin %d.\n",

0 commit comments

Comments
 (0)