aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Dietrich <marvin24@gmx.de>2024-04-06 14:31:21 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-04-11 13:59:19 +0200
commit395e9164bf721aff9bbbf8d6ac4f6c988d25980c (patch)
tree72670a6839d53c8fcd66bc139d745997b97cd202
parent41288dfaf1b8231bc21fd6966e7296b087e75969 (diff)
downloadstaging-395e9164bf721aff9bbbf8d6ac4f6c988d25980c.tar.gz
staging: nvec: make touchpad init synchronous
Currently, we are constantly sending commands to the EC without waiting for them to be executed. For the touchpad initialization this only worked because we were waiting 200 µs between each submitted command byte, so the EC had enough time to execute. In the furture we like to avoid this delay, so we need to wait for each command to be executed first. Do this by switching from asynchronous to synchronous command transmission. Signed-off-by: Marc Dietrich <marvin24@gmx.de> Link: https://lore.kernel.org/r/20240406123123.37148-4-marvin24@gmx.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/nvec/nvec_ps2.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/drivers/staging/nvec/nvec_ps2.c b/drivers/staging/nvec/nvec_ps2.c
index cb6d71b8dc83d2..f34016c4a26b6e 100644
--- a/drivers/staging/nvec/nvec_ps2.c
+++ b/drivers/staging/nvec/nvec_ps2.c
@@ -60,16 +60,6 @@ static void ps2_stopstreaming(struct serio *ser_dev)
nvec_write_async(ps2_dev.nvec, buf, sizeof(buf));
}
-static int ps2_sendcommand(struct serio *ser_dev, unsigned char cmd)
-{
- unsigned char buf[] = { NVEC_PS2, SEND_COMMAND, ENABLE_MOUSE, 1 };
-
- buf[2] = cmd & 0xff;
-
- dev_dbg(&ser_dev->dev, "Sending ps2 cmd %02x\n", cmd);
- return nvec_write_async(ps2_dev.nvec, buf, sizeof(buf));
-}
-
static int nvec_ps2_notifier(struct notifier_block *nb,
unsigned long event_type, void *data)
{
@@ -98,6 +88,27 @@ static int nvec_ps2_notifier(struct notifier_block *nb,
return NOTIFY_DONE;
}
+static int ps2_sendcommand(struct serio *ser_dev, unsigned char cmd)
+{
+ unsigned char buf[] = { NVEC_PS2, SEND_COMMAND, ENABLE_MOUSE, 1 };
+ struct nvec_msg *msg;
+ int ret;
+
+ buf[2] = cmd & 0xff;
+
+ dev_dbg(&ser_dev->dev, "Sending ps2 cmd %02x\n", cmd);
+
+ ret = nvec_write_sync(ps2_dev.nvec, buf, sizeof(buf), &msg);
+ if (ret < 0)
+ return ret;
+
+ nvec_ps2_notifier(NULL, NVEC_PS2, msg->data);
+
+ nvec_msg_free(ps2_dev.nvec, msg);
+
+ return 0;
+}
+
static int nvec_mouse_probe(struct platform_device *pdev)
{
struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent);