From: Irina Tirdea <irina.tirdea@intel.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Bastien Nocera <hadess@hadess.net>,
Aleksei Mamlin <mamlinav@gmail.com>,
Arnd Bergmann <arnd@arndb.de>,
linux-input@vger.kernel.org
Cc: Mark Rutland <mark.rutland@arm.com>,
Octavian Purdila <octavian.purdila@intel.com>,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
Irina Tirdea <irina.tirdea@intel.com>
Subject: [PATCH v8 7/9] Input: goodix - add sysfs interface to dump config
Date: Thu, 8 Oct 2015 17:23:49 +0300 [thread overview]
Message-ID: <1444314231-19206-8-git-send-email-irina.tirdea@intel.com> (raw)
In-Reply-To: <1444314231-19206-1-git-send-email-irina.tirdea@intel.com>
Goodix devices have a configuration information register area that
specify various parameters for the device. The configuration information
has a specific format described in the Goodix datasheet. It includes X/Y
resolution, maximum supported touch points, interrupt flags, various
sesitivity factors and settings for advanced features (like gesture
recognition).
Export a sysfs interface that would allow reading the configuration
information. The default device configuration can be used as a starting
point for creating a valid configuration firmware used by the device at
init time to update its configuration.
This sysfs interface will be exported only if the gpio pins are properly
initialized from ACPI/DT.
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
---
drivers/input/touchscreen/goodix.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c
index a271df9..01a2634 100644
--- a/drivers/input/touchscreen/goodix.c
+++ b/drivers/input/touchscreen/goodix.c
@@ -508,12 +508,35 @@ static ssize_t goodix_esd_timeout_store(struct device *dev,
return count;
}
+static ssize_t goodix_dump_config_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct goodix_ts_data *ts = dev_get_drvdata(dev);
+ u8 config[GOODIX_CONFIG_MAX_LENGTH];
+ int error, count = 0, i;
+
+ error = goodix_i2c_read(ts->client, GOODIX_REG_CONFIG_DATA,
+ config, ts->cfg_len);
+ if (error) {
+ dev_warn(&ts->client->dev,
+ "Error reading config (%d)\n", error);
+ return error;
+ }
+
+ for (i = 0; i < ts->cfg_len; i++)
+ count += scnprintf(buf + count, PAGE_SIZE - count, "%02x ",
+ config[i]);
+ return count;
+}
+
/* ESD timeout in ms. Default disabled (0). Recommended 2000 ms. */
static DEVICE_ATTR(esd_timeout, S_IRUGO | S_IWUSR, goodix_esd_timeout_show,
goodix_esd_timeout_store);
+static DEVICE_ATTR(dump_config, S_IRUGO, goodix_dump_config_show, NULL);
static struct attribute *goodix_attrs[] = {
&dev_attr_esd_timeout.attr,
+ &dev_attr_dump_config.attr,
NULL
};
--
1.9.1
next prev parent reply other threads:[~2015-10-08 14:23 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-08 14:23 [PATCH v8 0/9] Goodix touchscreen enhancements Irina Tirdea
2015-10-08 14:23 ` [PATCH v8 1/9] Input: goodix - use actual config length for each device type Irina Tirdea
2015-10-08 14:23 ` [PATCH v8 2/9] Input: goodix - reset device at init Irina Tirdea
2015-10-09 14:22 ` Bastien Nocera
2015-10-10 23:35 ` kbuild test robot
2015-10-08 14:23 ` [PATCH v8 4/9] Input: goodix - add power management support Irina Tirdea
2015-10-08 14:23 ` [PATCH v8 5/9] Input: goodix - use goodix_i2c_write_u8 instead of i2c_master_send Irina Tirdea
2015-10-08 14:23 ` [PATCH v8 6/9] Input: goodix - add support for ESD Irina Tirdea
2015-10-08 14:23 ` Irina Tirdea [this message]
2015-10-08 14:23 ` [PATCH v8 8/9] Input: goodix - add runtime power management support Irina Tirdea
2015-10-08 14:23 ` [PATCH v8 9/9] Input: goodix - sort includes using inverse Xmas tree order Irina Tirdea
2015-10-08 14:32 ` [PATCH v8 0/9] Goodix touchscreen enhancements Arnd Bergmann
2015-10-09 11:02 ` Tirdea, Irina
2015-10-09 11:54 ` Arnd Bergmann
2015-10-09 14:27 ` Bastien Nocera
[not found] ` <1444314231-19206-1-git-send-email-irina.tirdea-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-10-08 14:23 ` [PATCH v8 3/9] Input: goodix - write configuration data to device Irina Tirdea
2015-10-09 16:10 ` [PATCH v8 0/9] Goodix touchscreen enhancements Aleksei Mamlin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1444314231-19206-8-git-send-email-irina.tirdea@intel.com \
--to=irina.tirdea@intel.com \
--cc=arnd@arndb.de \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=hadess@hadess.net \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mamlinav@gmail.com \
--cc=mark.rutland@arm.com \
--cc=octavian.purdila@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).