95bbfe15b8bf639952d504ea4d74ef0825b04645
[openwrt/staging/hauke.git] /
1 From 76035ed0bd7fcc2c0af5a038139b50231b95fa37 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Mon, 29 Nov 2021 18:31:37 +0000
4 Subject: [PATCH] regulator/rpi-panel-attiny: Don't read the LCD power
5 status
6
7 The I2C to the Atmel is very fussy, and locks up easily on
8 Pi0-3 particularly on reads.
9
10 The LCD power status is controlled solely by this driver, so
11 rather than reading it back from the Atmel, use the cached
12 status last set.
13
14 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
15 ---
16 drivers/regulator/rpi-panel-attiny-regulator.c | 18 +-----------------
17 1 file changed, 1 insertion(+), 17 deletions(-)
18
19 --- a/drivers/regulator/rpi-panel-attiny-regulator.c
20 +++ b/drivers/regulator/rpi-panel-attiny-regulator.c
21 @@ -144,24 +144,8 @@ static int attiny_lcd_power_disable(stru
22 static int attiny_lcd_power_is_enabled(struct regulator_dev *rdev)
23 {
24 struct attiny_lcd *state = rdev_get_drvdata(rdev);
25 - unsigned int data;
26 - int ret, i;
27
28 - mutex_lock(&state->lock);
29 -
30 - for (i = 0; i < 10; i++) {
31 - ret = regmap_read(rdev->regmap, REG_PORTC, &data);
32 - if (!ret)
33 - break;
34 - usleep_range(10000, 12000);
35 - }
36 -
37 - mutex_unlock(&state->lock);
38 -
39 - if (ret < 0)
40 - return ret;
41 -
42 - return data & PC_RST_BRIDGE_N;
43 + return state->port_states[REG_PORTC - REG_PORTA] & PC_RST_BRIDGE_N;
44 }
45
46 static const struct regulator_init_data attiny_regulator_default = {