mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-20 14:13:16 +00:00
20ea6adbf1
Build system: x86_64 Build-tested: bcm2708, bcm2709, bcm2710, bcm2711 Run-tested: bcm2708/RPiB+, bcm2709/RPi3B, bcm2710/RPi3B, bcm2711/RPi4B Signed-off-by: Marty Jones <mj8263788@gmail.com> Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
35 lines
1.2 KiB
Diff
35 lines
1.2 KiB
Diff
From a8bb5f5ddbef4ac5b0e256c7c3bde4ac5636f429 Mon Sep 17 00:00:00 2001
|
|
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
|
|
Date: Wed, 8 Sep 2021 14:21:38 +0100
|
|
Subject: [PATCH] drm/panel/raspberrypi-touchscreen: Handle I2C errors.
|
|
|
|
rpi_touchscreen_i2c_read returns any errors from i2c_transfer,
|
|
or the 8 bit received value.
|
|
Check for error values before trying to process the data as
|
|
valid.
|
|
|
|
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
|
|
---
|
|
drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c | 5 +++--
|
|
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
|
|
--- a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
|
|
+++ b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
|
|
@@ -296,13 +296,14 @@ static int rpi_touchscreen_noop(struct d
|
|
static int rpi_touchscreen_prepare(struct drm_panel *panel)
|
|
{
|
|
struct rpi_touchscreen *ts = panel_to_ts(panel);
|
|
- int i;
|
|
+ int i, data;
|
|
|
|
rpi_touchscreen_i2c_write(ts, REG_POWERON, 1);
|
|
usleep_range(20000, 25000);
|
|
/* Wait for nPWRDWN to go low to indicate poweron is done. */
|
|
for (i = 0; i < 100; i++) {
|
|
- if (rpi_touchscreen_i2c_read(ts, REG_PORTB) & 1)
|
|
+ data = rpi_touchscreen_i2c_read(ts, REG_PORTB);
|
|
+ if (data >= 0 && (data & 1))
|
|
break;
|
|
}
|
|
|