public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Danilo Krummrich <danilokrummrich@dk-develop.de>
To: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: linus.walleij@linaro.org,
	Danilo Krummrich <danilokrummrich@dk-develop.de>
Subject: [PATCH 2/3] input: ps2-gpio: remove tx timeout from ps2_gpio_irq_tx()
Date: Fri, 11 Feb 2022 22:22:57 +0100	[thread overview]
Message-ID: <20220211212258.80345-3-danilokrummrich@dk-develop.de> (raw)
In-Reply-To: <20220211212258.80345-1-danilokrummrich@dk-develop.de>

Actually, there's no extra clock pulse to wait for.

The assumption of an extra clock pulse was mistakenly derived from the
fact that by the time this driver was introduced the GPIO controller of
the test machine (bcm2835) generated spurious interrupts.

Since now spurious interrupts are handled properly this can and must be
removed in order to make TX xfers work properly.

While at it, remove duplicate gpiod_direction_input(). The data gpio
must already be configured to act as input when receiving the ACK bit.

This patch is tested with the original hardware (peripherals and board)
the driver was developed on.

Signed-off-by: Danilo Krummrich <danilokrummrich@dk-develop.de>
---
 drivers/input/serio/ps2-gpio.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/input/serio/ps2-gpio.c b/drivers/input/serio/ps2-gpio.c
index 7fef4176bdd1..336928a8a127 100644
--- a/drivers/input/serio/ps2-gpio.c
+++ b/drivers/input/serio/ps2-gpio.c
@@ -37,8 +37,7 @@
 #define PS2_DATA_BIT7		8
 #define PS2_PARITY_BIT		9
 #define PS2_STOP_BIT		10
-#define PS2_TX_TIMEOUT		11
-#define PS2_ACK_BIT		12
+#define PS2_ACK_BIT		11
 
 #define PS2_DEV_RET_ACK		0xfa
 #define PS2_DEV_RET_NACK	0xfe
@@ -323,13 +322,7 @@ static irqreturn_t ps2_gpio_irq_tx(struct ps2_gpio_data *drvdata)
 		/* release data line to generate stop bit */
 		gpiod_direction_input(drvdata->gpio_data);
 		break;
-	case PS2_TX_TIMEOUT:
-		/* Devices generate one extra clock pulse before sending the
-		 * acknowledgment.
-		 */
-		break;
 	case PS2_ACK_BIT:
-		gpiod_direction_input(drvdata->gpio_data);
 		data = gpiod_get_value(drvdata->gpio_data);
 		if (data) {
 			dev_warn(drvdata->dev, "TX: received NACK, retry\n");
-- 
2.34.1


  parent reply	other threads:[~2022-02-11 21:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-11 21:22 input: ps2-gpio: use ktime for IRQ timekeeping Danilo Krummrich
2022-02-11 21:22 ` [PATCH 1/3] " Danilo Krummrich
2022-02-15  6:14   ` Dmitry Torokhov
2022-02-15 12:09     ` Danilo Krummrich
2022-02-11 21:22 ` Danilo Krummrich [this message]
2022-02-11 21:22 ` [PATCH 3/3] input: ps2-gpio: don't send rx data before the stop bit Danilo Krummrich

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=20220211212258.80345-3-danilokrummrich@dk-develop.de \
    --to=danilokrummrich@dk-develop.de \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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