diff mbox series

input: s6sy761: fix coordinate read bit shift

Message ID 20210305020310.550527-1-caleb@connolly.tech
State Accepted
Commit 30b3f68715595dee7fe4d9bd91a2252c3becdf0a
Headers show
Series input: s6sy761: fix coordinate read bit shift | expand

Commit Message

Caleb Connolly March 5, 2021, 2:03 a.m. UTC
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

The touch coordinates are read by shifting a value left by 3,
this is incorrect and effectively causes the coordinates to
be half of the correct value.

Shift by 4 bits instead to report the correct value.

This matches downstream examples, and has been confirmed on my
device (OnePlus 7 Pro).

Signed-off-by: Caleb Connolly <caleb@connolly.tech>
---
 drivers/input/touchscreen/s6sy761.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/input/touchscreen/s6sy761.c b/drivers/input/touchscreen/s6sy761.c
index b63d7fdf0cd2..85a1f465c097 100644
--- a/drivers/input/touchscreen/s6sy761.c
+++ b/drivers/input/touchscreen/s6sy761.c
@@ -145,8 +145,8 @@  static void s6sy761_report_coordinates(struct s6sy761_data *sdata,
 	u8 major = event[4];
 	u8 minor = event[5];
 	u8 z = event[6] & S6SY761_MASK_Z;
-	u16 x = (event[1] << 3) | ((event[3] & S6SY761_MASK_X) >> 4);
-	u16 y = (event[2] << 3) | (event[3] & S6SY761_MASK_Y);
+	u16 x = (event[1] << 4) | ((event[3] & S6SY761_MASK_X) >> 4);
+	u16 y = (event[2] << 4) | (event[3] & S6SY761_MASK_Y);
 
 	input_mt_slot(sdata->input, tid);