a6f0c1961cac3bf9a10c6787376caef25b56f629
[openwrt/staging/xback.git] /
1 From 480c8e9f48f8a96c457eb3dc0079a73598fb7477 Mon Sep 17 00:00:00 2001
2 From: Nick Hollinghurst <nick.hollinghurst@raspberrypi.org>
3 Date: Wed, 1 Dec 2021 19:43:08 +0000
4 Subject: [PATCH] drm/panel/raspberrypi-touchscreen: Insert more delays.
5
6 This avoids failures in cases where the panel is enabled
7 or re-probed very soon after being disabled or probed.
8 These can occur because the Atmel device can mis-behave
9 over I2C for a few ms after any write to the POWERON register.
10 ---
11 drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c | 8 ++++++++
12 1 file changed, 8 insertions(+)
13
14 --- a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
15 +++ b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
16 @@ -299,6 +299,13 @@ static int rpi_touchscreen_prepare(struc
17 struct rpi_touchscreen *ts = panel_to_ts(panel);
18 int i, data;
19
20 + /*
21 + * Power up the Toshiba bridge. The Atmel device can misbehave
22 + * over I2C for a few ms after writes to REG_POWERON (including the
23 + * write in rpi_touchscreen_disable()), so sleep before and after.
24 + * Also to ensure that the bridge has been off for at least 100ms.
25 + */
26 + msleep(100);
27 rpi_touchscreen_i2c_write(ts, REG_POWERON, 1);
28 usleep_range(20000, 25000);
29 /* Wait for nPWRDWN to go low to indicate poweron is done. */
30 @@ -431,6 +438,7 @@ static int rpi_touchscreen_probe(struct
31
32 /* Turn off at boot, so we can cleanly sequence powering on. */
33 rpi_touchscreen_i2c_write(ts, REG_POWERON, 0);
34 + usleep_range(20000, 25000);
35
36 /* Look up the DSI host. It needs to probe before we do. */
37 endpoint = of_graph_get_next_endpoint(dev->of_node, NULL);