tn3399_openwrt/target/linux/bcm27xx/patches-5.15/950-0587-regulator-rpi-panel-attiny-Don-t-read-the-LCD-power-.patch
Álvaro Fernández Rojas 20ea6adbf1 bcm27xx: add support for linux v5.15
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>
2022-05-17 15:11:22 +02:00

47 lines
1.4 KiB
Diff

From 76035ed0bd7fcc2c0af5a038139b50231b95fa37 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Mon, 29 Nov 2021 18:31:37 +0000
Subject: [PATCH] regulator/rpi-panel-attiny: Don't read the LCD power
status
The I2C to the Atmel is very fussy, and locks up easily on
Pi0-3 particularly on reads.
The LCD power status is controlled solely by this driver, so
rather than reading it back from the Atmel, use the cached
status last set.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/regulator/rpi-panel-attiny-regulator.c | 18 +-----------------
1 file changed, 1 insertion(+), 17 deletions(-)
--- a/drivers/regulator/rpi-panel-attiny-regulator.c
+++ b/drivers/regulator/rpi-panel-attiny-regulator.c
@@ -144,24 +144,8 @@ static int attiny_lcd_power_disable(stru
static int attiny_lcd_power_is_enabled(struct regulator_dev *rdev)
{
struct attiny_lcd *state = rdev_get_drvdata(rdev);
- unsigned int data;
- int ret, i;
- mutex_lock(&state->lock);
-
- for (i = 0; i < 10; i++) {
- ret = regmap_read(rdev->regmap, REG_PORTC, &data);
- if (!ret)
- break;
- usleep_range(10000, 12000);
- }
-
- mutex_unlock(&state->lock);
-
- if (ret < 0)
- return ret;
-
- return data & PC_RST_BRIDGE_N;
+ return state->port_states[REG_PORTC - REG_PORTA] & PC_RST_BRIDGE_N;
}
static const struct regulator_init_data attiny_regulator_default = {