From 4d3607d338a3ec2fd7dca3ac2fa8b3806b8570f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= Date: Mon, 22 Jun 2020 17:17:09 +0200 Subject: [PATCH 082/389] input: touchscreen: goodix: Add config debugfs file Signed-off-by: Ondrej Jirman Signed-off-by: The-going <48602507+The-going@users.noreply.github.com> --- drivers/input/touchscreen/goodix.c | 17 +++++++++++++++++ drivers/input/touchscreen/goodix.h | 1 + 2 files changed, 18 insertions(+) diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c index 166d36b26..26a500936 100644 --- a/drivers/input/touchscreen/goodix.c +++ b/drivers/input/touchscreen/goodix.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include "goodix.h" @@ -907,6 +908,16 @@ static int goodix_get_gpio_config(struct goodix_ts_data *ts) return 0; } +static int ts_config_bin_show(struct seq_file *s, void *data) +{ + struct goodix_ts_data *ts = s->private; + + seq_write(s, ts->config, ts->chip->config_len); + + return 0; +} +DEFINE_SHOW_ATTRIBUTE(ts_config_bin); + /** * goodix_read_config - Read the embedded configuration of the panel * @@ -940,6 +951,10 @@ static void goodix_read_config(struct goodix_ts_data *ts) } ts->chip->calc_config_checksum(ts); + + ts->debug_root = debugfs_create_dir("goodix", NULL); + debugfs_create_file("config.bin", 0444, ts->debug_root, ts, + &ts_config_bin_fops); } /** @@ -1262,6 +1277,8 @@ static int goodix_ts_remove(struct i2c_client *client) if (ts->load_cfg_from_disk) wait_for_completion(&ts->firmware_loading_complete); + debugfs_remove(ts->debug_root); + return 0; } diff --git a/drivers/input/touchscreen/goodix.h b/drivers/input/touchscreen/goodix.h index 1a1571ad2..b6c96a369 100644 --- a/drivers/input/touchscreen/goodix.h +++ b/drivers/input/touchscreen/goodix.h @@ -63,6 +63,7 @@ struct goodix_ts_data { unsigned int contact_size; u8 config[GOODIX_CONFIG_MAX_LENGTH]; unsigned short keymap[GOODIX_MAX_KEYS]; + struct dentry *debug_root; }; int goodix_i2c_read(struct i2c_client *client, u16 reg, u8 *buf, int len); -- 2.35.3