Linux Input Archive on lore.kernel.org
 help / color / Atom feed
From: Marco Felsch <m.felsch@pengutronix.de>
To: robh+dt@kernel.org, andriy.shevchenko@linux.intel.com,
	dmitry.torokhov@gmail.com, bparrot@ti.com,
	andy.shevchenko@gmail.com, simon.budig@kernelconcepts.de,
	hdegoede@redhat.com, fcooper@ti.com, mripard@kernel.org,
	alexandre.belloni@bootlin.com, shawnguo@kernel.org
Cc: devicetree@vger.kernel.org, kernel@pengutronix.de,
	linux-input@vger.kernel.org,
	Philipp Zabel <p.zabel@pengutronix.de>
Subject: [PATCH v2 1/5] Input: edt-ft5x06: work around first register access error
Date: Wed, 27 Nov 2019 13:09:44 +0100
Message-ID: <20191127120948.22251-2-m.felsch@pengutronix.de> (raw)
In-Reply-To: <20191127120948.22251-1-m.felsch@pengutronix.de>

From: Philipp Zabel <p.zabel@pengutronix.de>

The EP0700MLP1 returns bogus data on the first register read access
(reading the threshold parameter from register 0x00):

    edt_ft5x06 2-0038: crc error: 0xfc expected, got 0x40

It ignores writes until then. This patch adds a dummy read after which
the number of sensors and parameter read/writes work correctly.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
 drivers/input/touchscreen/edt-ft5x06.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
index d61731c0037d..b87b1e074f62 100644
--- a/drivers/input/touchscreen/edt-ft5x06.c
+++ b/drivers/input/touchscreen/edt-ft5x06.c
@@ -1050,6 +1050,7 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
 {
 	const struct edt_i2c_chip_data *chip_data;
 	struct edt_ft5x06_ts_data *tsdata;
+	u8 buf[2] = { 0xfc, 0x00 };
 	struct input_dev *input;
 	unsigned long irq_flags;
 	int error;
@@ -1140,6 +1141,12 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
 		return error;
 	}
 
+	/*
+	 * Dummy read access. EP0700MLP1 returns bogus data on the first
+	 * register read access and ignores writes.
+	 */
+	edt_ft5x06_ts_readwrite(tsdata->client, 2, buf, 2, buf);
+
 	edt_ft5x06_ts_set_regs(tsdata);
 	edt_ft5x06_ts_get_defaults(&client->dev, tsdata);
 	edt_ft5x06_ts_get_parameters(tsdata);
-- 
2.20.1


  reply index

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-27 12:09 [PATCH v2 0/5] EDT-FT5x06 improvements Marco Felsch
2019-11-27 12:09 ` Marco Felsch [this message]
2019-12-02 17:58   ` [PATCH v2 1/5] Input: edt-ft5x06: work around first register access error Dmitry Torokhov
2019-12-03  8:15     ` Marco Felsch
2019-11-27 12:09 ` [PATCH v2 2/5] Input: edt-ft5x06 - alphabetical include reorder Marco Felsch
2019-11-27 12:09 ` [PATCH v2 3/5] dt-bindings: Input: edt-ft5x06 - document wakeup-source capability Marco Felsch
2019-12-05 21:15   ` Rob Herring
2019-11-27 12:09 ` [PATCH v2 4/5] Input: edt-ft5x06 - make wakeup-source switchable Marco Felsch
2019-12-02 18:00   ` Dmitry Torokhov
2019-12-10  8:36     ` Marco Felsch
2019-11-27 12:09 ` [PATCH v2 5/5] Input: edt-ft5x06 - improve power management operations Marco Felsch
2019-11-27 12:59   ` Andy Shevchenko
2019-11-27 13:06     ` Marco Felsch
2019-11-27 14:32       ` Andy Shevchenko
2019-11-27 17:25         ` Marco Felsch
2019-11-27 18:06           ` Andy Shevchenko
2019-12-02 18:04   ` Dmitry Torokhov
2019-12-10  8:43     ` Marco Felsch
2019-11-27 17:10 ` [PATCH v2 0/5] EDT-FT5x06 improvements Andy Shevchenko
2019-11-27 17:14 ` Andy Shevchenko
2019-11-27 17:25   ` Marco Felsch

Reply instructions:

You may reply publically 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=20191127120948.22251-2-m.felsch@pengutronix.de \
    --to=m.felsch@pengutronix.de \
    --cc=alexandre.belloni@bootlin.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=bparrot@ti.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=fcooper@ti.com \
    --cc=hdegoede@redhat.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-input@vger.kernel.org \
    --cc=mripard@kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=robh+dt@kernel.org \
    --cc=shawnguo@kernel.org \
    --cc=simon.budig@kernelconcepts.de \
    /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

Linux Input Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-input/0 linux-input/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-input linux-input/ https://lore.kernel.org/linux-input \
		linux-input@vger.kernel.org
	public-inbox-index linux-input

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-input


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git