Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Wolfram Sang and committed by
Dmitry Torokhov
68743c50 6a71a667

+27 -14
+19 -2
Documentation/input/devices/edt-ft5x06.rst
··· 29 29 30 30 31 31 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: 34 51 35 52 num_x, num_y: 36 53 (readonly) contains the number of sensor fields in X- and
+8 -12
drivers/input/touchscreen/edt-ft5x06.c
··· 120 120 struct regmap *regmap; 121 121 122 122 #if defined(CONFIG_DEBUG_FS) 123 - struct dentry *debug_dir; 124 123 u8 *raw_buffer; 125 124 size_t raw_bufsize; 126 125 #endif ··· 814 815 .read = edt_ft5x06_debugfs_raw_data_read, 815 816 }; 816 817 817 - static void edt_ft5x06_ts_prepare_debugfs(struct edt_ft5x06_ts_data *tsdata, 818 - const char *debugfs_name) 818 + static void edt_ft5x06_ts_prepare_debugfs(struct edt_ft5x06_ts_data *tsdata) 819 819 { 820 - tsdata->debug_dir = debugfs_create_dir(debugfs_name, NULL); 820 + struct dentry *debug_dir = tsdata->client->debugfs; 821 821 822 - debugfs_create_u16("num_x", S_IRUSR, tsdata->debug_dir, &tsdata->num_x); 823 - debugfs_create_u16("num_y", S_IRUSR, tsdata->debug_dir, &tsdata->num_y); 822 + debugfs_create_u16("num_x", S_IRUSR, debug_dir, &tsdata->num_x); 823 + debugfs_create_u16("num_y", S_IRUSR, debug_dir, &tsdata->num_y); 824 824 825 825 debugfs_create_file("mode", S_IRUSR | S_IWUSR, 826 - tsdata->debug_dir, tsdata, &debugfs_mode_fops); 826 + debug_dir, tsdata, &debugfs_mode_fops); 827 827 debugfs_create_file("raw_data", S_IRUSR, 828 - tsdata->debug_dir, tsdata, &debugfs_raw_data_fops); 828 + debug_dir, tsdata, &debugfs_raw_data_fops); 829 829 } 830 830 831 831 static void edt_ft5x06_ts_teardown_debugfs(struct edt_ft5x06_ts_data *tsdata) 832 832 { 833 - debugfs_remove_recursive(tsdata->debug_dir); 834 833 kfree(tsdata->raw_buffer); 835 834 } 836 835 ··· 839 842 return -ENOSYS; 840 843 } 841 844 842 - static void edt_ft5x06_ts_prepare_debugfs(struct edt_ft5x06_ts_data *tsdata, 843 - const char *debugfs_name) 845 + static void edt_ft5x06_ts_prepare_debugfs(struct edt_ft5x06_ts_data *tsdata) 844 846 { 845 847 } 846 848 ··· 1345 1349 if (error) 1346 1350 return error; 1347 1351 1348 - edt_ft5x06_ts_prepare_debugfs(tsdata, dev_driver_string(&client->dev)); 1352 + edt_ft5x06_ts_prepare_debugfs(tsdata); 1349 1353 1350 1354 dev_dbg(&client->dev, 1351 1355 "EDT FT5x06 initialized: IRQ %d, WAKE pin %d, Reset pin %d.\n",