From: Daniel Kurtz <djkurtz@chromium.org>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Joonyoung Shim <jy0922.shim@samsung.com>,
Iiro Valkonen <iiro.valkonen@atmel.com>,
Henrik Rydberg <rydberg@euromail.se>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Benson Leung <bleung@chromium.org>,
Yufeng Shen <miletus@chromium.org>,
Daniel Kurtz <djkurtz@chromium.org>
Subject: [PATCH 05/20] Input: atmel_mxt_ts - dump mxt_read/write_reg
Date: Tue, 13 Mar 2012 20:04:08 +0800 [thread overview]
Message-ID: <1331640263-18935-6-git-send-email-djkurtz@chromium.org> (raw)
In-Reply-To: <1331640263-18935-1-git-send-email-djkurtz@chromium.org>
For verbose on-the-wire debugging.
Prints DUMP_LEN bytes (in hex) per line.
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
---
drivers/input/touchscreen/atmel_mxt_ts.c | 31 ++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index defd4e1..dd3919a 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -397,6 +397,33 @@ static int mxt_fw_write(struct i2c_client *client,
return 0;
}
+#ifdef DEBUG
+#define DUMP_LEN 16
+static void mxt_dump_xfer(struct device *dev, const char *func, u16 reg,
+ u16 len, const u8 *val)
+{
+ /* Rough guess for string size */
+ char str[DUMP_LEN * 3 + 2];
+ int i;
+ size_t n;
+
+ for (i = 0, n = 0; i < len; i++) {
+ n += snprintf(&str[n], sizeof(str) - n, "%02x ", val[i]);
+ if ((i + 1) % DUMP_LEN == 0 || (i + 1) == len) {
+ dev_dbg(dev,
+ "%s(reg: %d len: %d offset: 0x%02x): %s\n",
+ func, reg, len, (i / DUMP_LEN) * DUMP_LEN,
+ str);
+ n = 0;
+ }
+ }
+}
+#undef DUMP_LEN
+#else
+static void mxt_dump_xfer(struct device *dev, const char *func, u16 reg,
+ u16 len, const u8 *val) { }
+#endif
+
static int mxt_read_reg(struct i2c_client *client, u16 reg, u16 len, void *val)
{
struct i2c_msg xfer[2];
@@ -422,6 +449,8 @@ static int mxt_read_reg(struct i2c_client *client, u16 reg, u16 len, void *val)
return -EIO;
}
+ mxt_dump_xfer(&client->dev, __func__, reg, len, val);
+
return 0;
}
@@ -435,6 +464,8 @@ static int mxt_write_reg(struct i2c_client *client, u16 reg, u16 len,
buf[1] = (reg >> 8) & 0xff;
memcpy(&buf[2], val, len);
+ mxt_dump_xfer(&client->dev, __func__, reg, len, val);
+
if (i2c_master_send(client, buf, count) != count) {
dev_err(&client->dev, "%s: i2c write failed\n", __func__);
return -EIO;
--
1.7.7.3
next prev parent reply other threads:[~2012-03-13 12:04 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-13 12:04 [PATCH 00/20] cleanup atmel_mxt_ts Daniel Kurtz
2012-03-13 12:04 ` [PATCH 01/20] Input: atmel_mxt_ts - use CONFIG_PM_SLEEP Daniel Kurtz
2012-03-13 12:04 ` [PATCH 02/20] Input: atmel_mxt_ts - only allow root to update firmware Daniel Kurtz
2012-03-20 14:38 ` Nick Dyer
2012-03-13 12:04 ` [PATCH 03/20] Input: atmel_mxt_ts - verify object size in mxt_write_object Daniel Kurtz
2012-03-14 1:33 ` Joonyoung Shim
2012-03-14 2:13 ` Daniel Kurtz
2012-03-14 2:37 ` Joonyoung Shim
2012-03-13 12:04 ` [PATCH 04/20] Input: atmel_mxt_ts - refactor mxt_read/write_reg to take a length Daniel Kurtz
2012-03-13 12:04 ` Daniel Kurtz [this message]
2012-03-20 14:43 ` [PATCH 05/20] Input: atmel_mxt_ts - dump mxt_read/write_reg Nick Dyer
2012-03-13 12:04 ` [PATCH 06/20] Input: atmel_mxt_ts - allow writing to object sysfs entry Daniel Kurtz
2012-03-19 8:04 ` Henrik Rydberg
2012-03-19 8:26 ` Daniel Kurtz
2012-03-20 14:51 ` Nick Dyer
2012-03-20 23:03 ` Alan Cox
2012-03-20 23:32 ` Nick Dyer
2012-03-13 12:04 ` [PATCH 07/20] Input: atmel_mxt_ts - add backupnv " Daniel Kurtz
2012-03-20 15:01 ` Nick Dyer
2012-03-13 12:04 ` [PATCH 08/20] Input: atmel_mxt_ts - store actual size and instance Daniel Kurtz
2012-03-20 15:05 ` Nick Dyer
2012-03-13 12:04 ` [PATCH 09/20] Input: atmel_mxt_ts - do not read extra (checksum) byte Daniel Kurtz
2012-03-20 15:07 ` Nick Dyer
2012-03-22 10:18 ` Bowens, Alan
2012-03-13 12:04 ` [PATCH 10/20] Input: atmel_mxt_ts - dump each message on just 1 line Daniel Kurtz
2012-03-20 15:08 ` Nick Dyer
2012-03-13 12:04 ` [PATCH 11/20] Input: atmel_mxt_ts - refactor mxt_object_show Daniel Kurtz
2012-03-20 15:11 ` Nick Dyer
2012-03-13 12:04 ` [PATCH 12/20] Input: atmel_mxt_ts - simplify event reporting Daniel Kurtz
2012-03-19 8:26 ` Henrik Rydberg
2012-03-19 9:06 ` Daniel Kurtz
2012-03-20 15:13 ` Nick Dyer
2012-03-13 12:04 ` [PATCH 13/20] Input: atmel_mxt_ts - parse vector field of data packets Daniel Kurtz
2012-03-20 15:23 ` Nick Dyer
2012-03-13 12:04 ` [PATCH 14/20] Input: atmel_mxt_ts - refactor reading object table Daniel Kurtz
2012-03-20 15:19 ` Nick Dyer
2012-03-13 12:04 ` [PATCH 15/20] Input: atmel_mxt_ts - optimize writing of object table entries Daniel Kurtz
2012-03-13 12:04 ` [PATCH 16/20] Input: atmel_mxt_ts - refactor get info Daniel Kurtz
2012-03-20 15:21 ` Nick Dyer
2012-03-13 12:04 ` [PATCH 17/20] Input: atmel_mxt_ts - use cached T9 reportid range in isr Daniel Kurtz
2012-03-20 15:30 ` Nick Dyer
2012-03-13 12:04 ` [PATCH 18/20] Input: atmel_mxt_ts - read num messages, then all messages Daniel Kurtz
2012-03-14 2:32 ` Joonyoung Shim
2012-03-14 3:13 ` Daniel Kurtz
2012-03-20 15:28 ` Nick Dyer
2012-03-13 12:04 ` [PATCH 19/20] Input: atmel_mxt_ts - remove mxt_make_highchg and parse T6 report Daniel Kurtz
2012-03-20 15:38 ` Nick Dyer
2012-03-29 15:20 ` Daniel Kurtz
2012-03-30 7:00 ` Nick Dyer
2012-03-13 12:04 ` [PATCH 20/20] Input: atmel_mxt_ts - send all MT-B slots in one input report Daniel Kurtz
2012-03-20 15:39 ` Nick Dyer
2012-03-14 2:43 ` [PATCH 00/20] cleanup atmel_mxt_ts Joonyoung Shim
2012-03-14 17:00 ` Valkonen, Iiro
2012-03-20 14:33 ` Nick Dyer
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=1331640263-18935-6-git-send-email-djkurtz@chromium.org \
--to=djkurtz@chromium.org \
--cc=bleung@chromium.org \
--cc=dmitry.torokhov@gmail.com \
--cc=iiro.valkonen@atmel.com \
--cc=jy0922.shim@samsung.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miletus@chromium.org \
--cc=rydberg@euromail.se \
/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).