diff --git a/root/target/linux/bcm27xx/patches-5.15/950-0494-regulator-rpi-panel-Serialise-operations.patch b/root/target/linux/bcm27xx/patches-5.15/950-0494-regulator-rpi-panel-Serialise-operations.patch deleted file mode 100644 index e1997cc6..00000000 --- a/root/target/linux/bcm27xx/patches-5.15/950-0494-regulator-rpi-panel-Serialise-operations.patch +++ /dev/null @@ -1,255 +0,0 @@ -From be5a71a469dde4a8ab5a2021bdc3620daa640c00 Mon Sep 17 00:00:00 2001 -From: Dave Stevenson -Date: Wed, 8 Sep 2021 15:02:05 +0100 -Subject: [PATCH 494/828] regulator: rpi-panel: Serialise operations. - -The driver was using the regmap lock to serialise the -individual accesses, but we really need to protect the -timings of enabling the regulators, including any communication -with the Atmel. - -Use a mutex within the driver to control overall accesses to -the Atmel, instead of the regmap lock. - -Signed-off-by: Dave Stevenson ---- - .../regulator/rpi-panel-attiny-regulator.c | 91 ++++++++++++++++--- - 1 file changed, 80 insertions(+), 11 deletions(-) - ---- a/drivers/regulator/rpi-panel-attiny-regulator.c -+++ b/drivers/regulator/rpi-panel-attiny-regulator.c -@@ -27,18 +27,28 @@ - #define REG_POWERON 0x85 - #define REG_PWM 0x86 - -+struct attiny_lcd { -+ /* lock to serialise overall accesses to the Atmel */ -+ struct mutex lock; -+ struct regmap *regmap; -+}; -+ - static const struct regmap_config attiny_regmap_config = { - .reg_bits = 8, - .val_bits = 8, -+ .disable_locking = 1, - .max_register = REG_PWM, - .cache_type = REGCACHE_NONE, - }; - - static int attiny_lcd_power_enable(struct regulator_dev *rdev) - { -+ struct mutex *lock = rdev_get_drvdata(rdev); - unsigned int data; - int ret, i; - -+ mutex_lock(lock); -+ - regmap_write(rdev->regmap, REG_POWERON, 1); - msleep(80); - -@@ -63,33 +73,49 @@ static int attiny_lcd_power_enable(struc - */ - regmap_write(rdev->regmap, REG_PORTA, BIT(2)); - -+ mutex_unlock(lock); -+ - return 0; - } - - static int attiny_lcd_power_disable(struct regulator_dev *rdev) - { -+ struct mutex *lock = rdev_get_drvdata(rdev); -+ -+ mutex_lock(lock); -+ - regmap_write(rdev->regmap, REG_PWM, 0); - regmap_write(rdev->regmap, REG_POWERON, 0); - msleep(30); -+ -+ mutex_unlock(lock); -+ - return 0; - } - - static int attiny_lcd_power_is_enabled(struct regulator_dev *rdev) - { -+ struct mutex *lock = rdev_get_drvdata(rdev); - unsigned int data; - int ret, i; - -+ mutex_lock(lock); -+ - for (i = 0; i < 10; i++) { - ret = regmap_read(rdev->regmap, REG_POWERON, &data); - if (!ret) - break; - usleep_range(10000, 12000); - } -- if (ret < 0) -+ if (ret < 0) { -+ mutex_unlock(lock); - return ret; -+ } - -- if (!(data & BIT(0))) -+ if (!(data & BIT(0))) { -+ mutex_unlock(lock); - return 0; -+ } - - for (i = 0; i < 10; i++) { - ret = regmap_read(rdev->regmap, REG_PORTB, &data); -@@ -98,6 +124,8 @@ static int attiny_lcd_power_is_enabled(s - usleep_range(10000, 12000); - } - -+ mutex_unlock(lock); -+ - if (ret < 0) - return ret; - -@@ -125,10 +153,13 @@ static const struct regulator_desc attin - - static int attiny_update_status(struct backlight_device *bl) - { -- struct regmap *regmap = bl_get_data(bl); -+ struct attiny_lcd *state = bl_get_data(bl); -+ struct regmap *regmap = state->regmap; - int brightness = bl->props.brightness; - int ret, i; - -+ mutex_lock(&state->lock); -+ - if (bl->props.power != FB_BLANK_UNBLANK || - bl->props.fb_blank != FB_BLANK_UNBLANK) - brightness = 0; -@@ -139,20 +170,27 @@ static int attiny_update_status(struct b - break; - } - -+ mutex_unlock(&state->lock); -+ - return ret; - } - - static int attiny_get_brightness(struct backlight_device *bl) - { -- struct regmap *regmap = bl_get_data(bl); -+ struct attiny_lcd *state = bl_get_data(bl); -+ struct regmap *regmap = state->regmap; - int ret, brightness, i; - -+ mutex_lock(&state->lock); -+ - for (i = 0; i < 10; i++) { - ret = regmap_read(regmap, REG_PWM, &brightness); - if (!ret) - break; - } - -+ mutex_unlock(&state->lock); -+ - if (ret) - return ret; - -@@ -174,22 +212,30 @@ static int attiny_i2c_probe(struct i2c_c - struct regulator_config config = { }; - struct backlight_device *bl; - struct regulator_dev *rdev; -+ struct attiny_lcd *state; - struct regmap *regmap; - unsigned int data; - int ret; - -+ state = devm_kzalloc(&i2c->dev, sizeof(*state), GFP_KERNEL); -+ if (!state) -+ return -ENOMEM; -+ -+ mutex_init(&state->lock); -+ i2c_set_clientdata(i2c, state); -+ - regmap = devm_regmap_init_i2c(i2c, &attiny_regmap_config); - if (IS_ERR(regmap)) { - ret = PTR_ERR(regmap); - dev_err(&i2c->dev, "Failed to allocate register map: %d\n", - ret); -- return ret; -+ goto error; - } - - ret = regmap_read(regmap, REG_ID, &data); - if (ret < 0) { - dev_err(&i2c->dev, "Failed to read REG_ID reg: %d\n", ret); -- return ret; -+ goto error; - } - - switch (data) { -@@ -198,7 +244,8 @@ static int attiny_i2c_probe(struct i2c_c - break; - default: - dev_err(&i2c->dev, "Unknown Atmel firmware revision: 0x%02x\n", data); -- return -ENODEV; -+ ret = -ENODEV; -+ goto error; - } - - regmap_write(regmap, REG_POWERON, 0); -@@ -208,24 +255,45 @@ static int attiny_i2c_probe(struct i2c_c - config.regmap = regmap; - config.of_node = i2c->dev.of_node; - config.init_data = &attiny_regulator_default; -+ config.driver_data = &state->lock; - - rdev = devm_regulator_register(&i2c->dev, &attiny_regulator, &config); - if (IS_ERR(rdev)) { - dev_err(&i2c->dev, "Failed to register ATTINY regulator\n"); -- return PTR_ERR(rdev); -+ ret = PTR_ERR(rdev); -+ goto error; - } - - props.type = BACKLIGHT_RAW; - props.max_brightness = 0xff; -+ -+ state->regmap = regmap; -+ - bl = devm_backlight_device_register(&i2c->dev, dev_name(&i2c->dev), -- &i2c->dev, regmap, &attiny_bl, -+ &i2c->dev, state, &attiny_bl, - &props); -- if (IS_ERR(bl)) -- return PTR_ERR(bl); -+ if (IS_ERR(bl)) { -+ ret = PTR_ERR(bl); -+ goto error; -+ } - - bl->props.brightness = 0xff; - - return 0; -+ -+error: -+ mutex_destroy(&state->lock); -+ -+ return ret; -+} -+ -+static int attiny_i2c_remove(struct i2c_client *client) -+{ -+ struct attiny_lcd *state = i2c_get_clientdata(client); -+ -+ mutex_destroy(&state->lock); -+ -+ return 0; - } - - static const struct of_device_id attiny_dt_ids[] = { -@@ -240,6 +308,7 @@ static struct i2c_driver attiny_regulato - .of_match_table = of_match_ptr(attiny_dt_ids), - }, - .probe = attiny_i2c_probe, -+ .remove = attiny_i2c_remove, - }; - - module_i2c_driver(attiny_regulator_driver); diff --git a/root/target/linux/bcm27xx/patches-5.15/950-0495-regulator-rpi-panel-Ensure-the-backlight-is-off-duri.patch b/root/target/linux/bcm27xx/patches-5.15/950-0495-regulator-rpi-panel-Ensure-the-backlight-is-off-duri.patch deleted file mode 100644 index df4c46c9..00000000 --- a/root/target/linux/bcm27xx/patches-5.15/950-0495-regulator-rpi-panel-Ensure-the-backlight-is-off-duri.patch +++ /dev/null @@ -1,24 +0,0 @@ -From d7f777c36dd261a19dcf91443d169ba24aba70ab Mon Sep 17 00:00:00 2001 -From: Dave Stevenson -Date: Wed, 8 Sep 2021 15:41:18 +0100 -Subject: [PATCH 495/828] regulator: rpi-panel: Ensure the backlight is off - during probe. - -The initial state of the Atmel is not defined, so ensure the -backlight PWM is set to 0 by default. - -Signed-off-by: Dave Stevenson ---- - drivers/regulator/rpi-panel-attiny-regulator.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/regulator/rpi-panel-attiny-regulator.c -+++ b/drivers/regulator/rpi-panel-attiny-regulator.c -@@ -250,6 +250,7 @@ static int attiny_i2c_probe(struct i2c_c - - regmap_write(regmap, REG_POWERON, 0); - msleep(30); -+ regmap_write(regmap, REG_PWM, 0); - - config.dev = &i2c->dev; - config.regmap = regmap; diff --git a/root/target/linux/bcm27xx/patches-5.15/950-0496-regulator-rpi-panel-Convert-to-drive-lines-directly.patch b/root/target/linux/bcm27xx/patches-5.15/950-0496-regulator-rpi-panel-Convert-to-drive-lines-directly.patch deleted file mode 100644 index 8a008a11..00000000 --- a/root/target/linux/bcm27xx/patches-5.15/950-0496-regulator-rpi-panel-Convert-to-drive-lines-directly.patch +++ /dev/null @@ -1,199 +0,0 @@ -From 20159b9cec78d0a4adf53c56b0d8aba44f22218b Mon Sep 17 00:00:00 2001 -From: Dave Stevenson -Date: Thu, 9 Sep 2021 18:24:57 +0100 -Subject: [PATCH 496/828] regulator: rpi-panel: Convert to drive lines directly - -The Atmel was doing a load of automatic sequencing of -control lines, however it was combining the touch controller's -reset with the bridge/panel control. - -Change to control the control signals directly rather than -through the automatic POWERON control. - -Signed-off-by: Dave Stevenson ---- - .../regulator/rpi-panel-attiny-regulator.c | 111 ++++++++++-------- - 1 file changed, 60 insertions(+), 51 deletions(-) - ---- a/drivers/regulator/rpi-panel-attiny-regulator.c -+++ b/drivers/regulator/rpi-panel-attiny-regulator.c -@@ -21,11 +21,28 @@ - /* I2C registers of the Atmel microcontroller. */ - #define REG_ID 0x80 - #define REG_PORTA 0x81 --#define REG_PORTA_HF BIT(2) --#define REG_PORTA_VF BIT(3) - #define REG_PORTB 0x82 -+#define REG_PORTC 0x83 - #define REG_POWERON 0x85 - #define REG_PWM 0x86 -+#define REG_ADDR_L 0x8c -+#define REG_ADDR_H 0x8d -+#define REG_WRITE_DATA_H 0x90 -+#define REG_WRITE_DATA_L 0x91 -+ -+#define PA_LCD_DITHB BIT(0) -+#define PA_LCD_MODE BIT(1) -+#define PA_LCD_LR BIT(2) -+#define PA_LCD_UD BIT(3) -+ -+#define PB_BRIDGE_PWRDNX_N BIT(0) -+#define PB_LCD_VCC_N BIT(1) -+#define PB_LCD_MAIN BIT(7) -+ -+#define PC_LED_EN BIT(0) -+#define PC_RST_TP_N BIT(1) -+#define PC_RST_LCD_N BIT(2) -+#define PC_RST_BRIDGE_N BIT(3) - - struct attiny_lcd { - /* lock to serialise overall accesses to the Atmel */ -@@ -37,99 +54,91 @@ static const struct regmap_config attiny - .reg_bits = 8, - .val_bits = 8, - .disable_locking = 1, -- .max_register = REG_PWM, -+ .max_register = REG_WRITE_DATA_L, - .cache_type = REGCACHE_NONE, - }; - - static int attiny_lcd_power_enable(struct regulator_dev *rdev) - { -- struct mutex *lock = rdev_get_drvdata(rdev); -- unsigned int data; -- int ret, i; -+ struct attiny_lcd *state = rdev_get_drvdata(rdev); - -- mutex_lock(lock); -- -- regmap_write(rdev->regmap, REG_POWERON, 1); -- msleep(80); -+ mutex_lock(&state->lock); - -- /* Wait for nPWRDWN to go low to indicate poweron is done. */ -- for (i = 0; i < 20; i++) { -- ret = regmap_read(rdev->regmap, REG_PORTB, &data); -- if (!ret) { -- if (data & BIT(0)) -- break; -- } -- usleep_range(10000, 12000); -- } -- usleep_range(10000, 12000); -- -- if (ret) -- pr_err("%s: regmap_read_poll_timeout failed %d\n", __func__, ret); -+ /* Ensure bridge, and tp stay in reset */ -+ regmap_write(rdev->regmap, REG_PORTC, 0); -+ usleep_range(5000, 10000); - - /* Default to the same orientation as the closed source - * firmware used for the panel. Runtime rotation - * configuration will be supported using VC4's plane - * orientation bits. - */ -- regmap_write(rdev->regmap, REG_PORTA, BIT(2)); -+ regmap_write(rdev->regmap, REG_PORTA, PA_LCD_LR); -+ usleep_range(5000, 10000); -+ regmap_write(rdev->regmap, REG_PORTB, PB_LCD_MAIN); -+ usleep_range(5000, 10000); -+ /* Bring controllers out of reset */ -+ regmap_write(rdev->regmap, REG_PORTC, -+ PC_LED_EN | PC_RST_BRIDGE_N | PC_RST_LCD_N | PC_RST_TP_N); -+ -+ msleep(80); -+ -+ regmap_write(rdev->regmap, REG_ADDR_H, 0x04); -+ usleep_range(5000, 8000); -+ regmap_write(rdev->regmap, REG_ADDR_L, 0x7c); -+ usleep_range(5000, 8000); -+ regmap_write(rdev->regmap, REG_WRITE_DATA_H, 0x00); -+ usleep_range(5000, 8000); -+ regmap_write(rdev->regmap, REG_WRITE_DATA_L, 0x00); - -- mutex_unlock(lock); -+ msleep(100); -+ -+ mutex_unlock(&state->lock); - - return 0; - } - - static int attiny_lcd_power_disable(struct regulator_dev *rdev) - { -- struct mutex *lock = rdev_get_drvdata(rdev); -+ struct attiny_lcd *state = rdev_get_drvdata(rdev); - -- mutex_lock(lock); -+ mutex_lock(&state->lock); - - regmap_write(rdev->regmap, REG_PWM, 0); -- regmap_write(rdev->regmap, REG_POWERON, 0); -+ usleep_range(5000, 10000); -+ regmap_write(rdev->regmap, REG_PORTA, 0); -+ usleep_range(5000, 10000); -+ regmap_write(rdev->regmap, REG_PORTB, PB_LCD_VCC_N); -+ usleep_range(5000, 10000); -+ regmap_write(rdev->regmap, REG_PORTC, 0); - msleep(30); - -- mutex_unlock(lock); -+ mutex_unlock(&state->lock); - - return 0; - } - - static int attiny_lcd_power_is_enabled(struct regulator_dev *rdev) - { -- struct mutex *lock = rdev_get_drvdata(rdev); -+ struct attiny_lcd *state = rdev_get_drvdata(rdev); - unsigned int data; - int ret, i; - -- mutex_lock(lock); -- -- for (i = 0; i < 10; i++) { -- ret = regmap_read(rdev->regmap, REG_POWERON, &data); -- if (!ret) -- break; -- usleep_range(10000, 12000); -- } -- if (ret < 0) { -- mutex_unlock(lock); -- return ret; -- } -- -- if (!(data & BIT(0))) { -- mutex_unlock(lock); -- return 0; -- } -+ mutex_lock(&state->lock); - - for (i = 0; i < 10; i++) { -- ret = regmap_read(rdev->regmap, REG_PORTB, &data); -+ ret = regmap_read(rdev->regmap, REG_PORTC, &data); - if (!ret) - break; - usleep_range(10000, 12000); - } - -- mutex_unlock(lock); -+ mutex_unlock(&state->lock); - - if (ret < 0) - return ret; - -- return data & BIT(0); -+ return data & PC_RST_BRIDGE_N; - } - - static const struct regulator_init_data attiny_regulator_default = { -@@ -256,7 +265,7 @@ static int attiny_i2c_probe(struct i2c_c - config.regmap = regmap; - config.of_node = i2c->dev.of_node; - config.init_data = &attiny_regulator_default; -- config.driver_data = &state->lock; -+ config.driver_data = state; - - rdev = devm_regulator_register(&i2c->dev, &attiny_regulator, &config); - if (IS_ERR(rdev)) { diff --git a/root/target/linux/bcm27xx/patches-5.15/950-0497-regulator-rpi-panel-Add-GPIO-control-for-panel-and-t.patch b/root/target/linux/bcm27xx/patches-5.15/950-0497-regulator-rpi-panel-Add-GPIO-control-for-panel-and-t.patch deleted file mode 100644 index 70fbd1b9..00000000 --- a/root/target/linux/bcm27xx/patches-5.15/950-0497-regulator-rpi-panel-Add-GPIO-control-for-panel-and-t.patch +++ /dev/null @@ -1,202 +0,0 @@ -From 23fcd3931e30b36101580b17100ea3bb915a5108 Mon Sep 17 00:00:00 2001 -From: Dave Stevenson -Date: Fri, 10 Sep 2021 13:50:28 +0100 -Subject: [PATCH 497/828] regulator: rpi-panel: Add GPIO control for panel and - touch resets - -We need independent control of the resets for the panel&bridge, -vs the touch controller. - -Expose the reset lines that are on the Atmel's port C via the GPIO -API so that they can be controlled appropriately. - -Signed-off-by: Dave Stevenson ---- - .../regulator/rpi-panel-attiny-regulator.c | 115 +++++++++++++++--- - 1 file changed, 97 insertions(+), 18 deletions(-) - ---- a/drivers/regulator/rpi-panel-attiny-regulator.c -+++ b/drivers/regulator/rpi-panel-attiny-regulator.c -@@ -8,6 +8,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -44,10 +45,30 @@ - #define PC_RST_LCD_N BIT(2) - #define PC_RST_BRIDGE_N BIT(3) - -+enum gpio_signals { -+ RST_BRIDGE_N, /* TC358762 bridge reset */ -+ RST_TP_N, /* Touch controller reset */ -+ NUM_GPIO -+}; -+ -+struct gpio_signal_mappings { -+ unsigned int reg; -+ unsigned int mask; -+}; -+ -+static const struct gpio_signal_mappings mappings[NUM_GPIO] = { -+ [RST_BRIDGE_N] = { REG_PORTC, PC_RST_BRIDGE_N | PC_RST_LCD_N }, -+ [RST_TP_N] = { REG_PORTC, PC_RST_TP_N }, -+}; -+ - struct attiny_lcd { - /* lock to serialise overall accesses to the Atmel */ - struct mutex lock; - struct regmap *regmap; -+ bool gpio_states[NUM_GPIO]; -+ u8 port_states[3]; -+ -+ struct gpio_chip gc; - }; - - static const struct regmap_config attiny_regmap_config = { -@@ -58,6 +79,17 @@ static const struct regmap_config attiny - .cache_type = REGCACHE_NONE, - }; - -+static int attiny_set_port_state(struct attiny_lcd *state, int reg, u8 val) -+{ -+ state->port_states[reg - REG_PORTA] = val; -+ return regmap_write(state->regmap, reg, val); -+}; -+ -+static u8 attiny_get_port_state(struct attiny_lcd *state, int reg) -+{ -+ return state->port_states[reg - REG_PORTA]; -+}; -+ - static int attiny_lcd_power_enable(struct regulator_dev *rdev) - { - struct attiny_lcd *state = rdev_get_drvdata(rdev); -@@ -65,7 +97,7 @@ static int attiny_lcd_power_enable(struc - mutex_lock(&state->lock); - - /* Ensure bridge, and tp stay in reset */ -- regmap_write(rdev->regmap, REG_PORTC, 0); -+ attiny_set_port_state(state, REG_PORTC, 0); - usleep_range(5000, 10000); - - /* Default to the same orientation as the closed source -@@ -73,26 +105,16 @@ static int attiny_lcd_power_enable(struc - * configuration will be supported using VC4's plane - * orientation bits. - */ -- regmap_write(rdev->regmap, REG_PORTA, PA_LCD_LR); -+ attiny_set_port_state(state, REG_PORTA, PA_LCD_LR); - usleep_range(5000, 10000); -- regmap_write(rdev->regmap, REG_PORTB, PB_LCD_MAIN); -+ /* Main regulator on, and power to the panel (LCD_VCC_N) */ -+ attiny_set_port_state(state, REG_PORTB, PB_LCD_MAIN); - usleep_range(5000, 10000); - /* Bring controllers out of reset */ -- regmap_write(rdev->regmap, REG_PORTC, -- PC_LED_EN | PC_RST_BRIDGE_N | PC_RST_LCD_N | PC_RST_TP_N); -+ attiny_set_port_state(state, REG_PORTC, PC_LED_EN); - - msleep(80); - -- regmap_write(rdev->regmap, REG_ADDR_H, 0x04); -- usleep_range(5000, 8000); -- regmap_write(rdev->regmap, REG_ADDR_L, 0x7c); -- usleep_range(5000, 8000); -- regmap_write(rdev->regmap, REG_WRITE_DATA_H, 0x00); -- usleep_range(5000, 8000); -- regmap_write(rdev->regmap, REG_WRITE_DATA_L, 0x00); -- -- msleep(100); -- - mutex_unlock(&state->lock); - - return 0; -@@ -106,11 +128,12 @@ static int attiny_lcd_power_disable(stru - - regmap_write(rdev->regmap, REG_PWM, 0); - usleep_range(5000, 10000); -- regmap_write(rdev->regmap, REG_PORTA, 0); -+ -+ attiny_set_port_state(state, REG_PORTA, 0); - usleep_range(5000, 10000); -- regmap_write(rdev->regmap, REG_PORTB, PB_LCD_VCC_N); -+ attiny_set_port_state(state, REG_PORTB, PB_LCD_VCC_N); - usleep_range(5000, 10000); -- regmap_write(rdev->regmap, REG_PORTC, 0); -+ attiny_set_port_state(state, REG_PORTC, 0); - msleep(30); - - mutex_unlock(&state->lock); -@@ -211,6 +234,45 @@ static const struct backlight_ops attiny - .get_brightness = attiny_get_brightness, - }; - -+static int attiny_gpio_get_direction(struct gpio_chip *gc, unsigned int off) -+{ -+ return GPIO_LINE_DIRECTION_OUT; -+} -+ -+static void attiny_gpio_set(struct gpio_chip *gc, unsigned int off, int val) -+{ -+ struct attiny_lcd *state = gpiochip_get_data(gc); -+ u8 last_val; -+ -+ if (off >= NUM_GPIO) -+ return; -+ -+ mutex_lock(&state->lock); -+ -+ last_val = attiny_get_port_state(state, mappings[off].reg); -+ if (val) -+ last_val |= mappings[off].mask; -+ else -+ last_val &= ~mappings[off].mask; -+ -+ attiny_set_port_state(state, mappings[off].reg, last_val); -+ -+ if (off == RST_BRIDGE_N && val) { -+ usleep_range(5000, 8000); -+ regmap_write(state->regmap, REG_ADDR_H, 0x04); -+ usleep_range(5000, 8000); -+ regmap_write(state->regmap, REG_ADDR_L, 0x7c); -+ usleep_range(5000, 8000); -+ regmap_write(state->regmap, REG_WRITE_DATA_H, 0x00); -+ usleep_range(5000, 8000); -+ regmap_write(state->regmap, REG_WRITE_DATA_L, 0x00); -+ -+ msleep(100); -+ } -+ -+ mutex_unlock(&state->lock); -+} -+ - /* - * I2C driver interface functions - */ -@@ -289,6 +351,23 @@ static int attiny_i2c_probe(struct i2c_c - - bl->props.brightness = 0xff; - -+ state->gc.parent = &i2c->dev; -+ state->gc.label = i2c->name; -+ state->gc.owner = THIS_MODULE; -+ state->gc.of_node = i2c->dev.of_node; -+ state->gc.base = -1; -+ state->gc.ngpio = NUM_GPIO; -+ -+ state->gc.set = attiny_gpio_set; -+ state->gc.get_direction = attiny_gpio_get_direction; -+ state->gc.can_sleep = true; -+ -+ ret = devm_gpiochip_add_data(&i2c->dev, &state->gc, state); -+ if (ret) { -+ dev_err(&i2c->dev, "Failed to create gpiochip: %d\n", ret); -+ goto error; -+ } -+ - return 0; - - error: diff --git a/root/target/linux/bcm27xx/patches-5.15/950-0528-regulator-rpi-panel-Remove-get_brightness-hook.patch b/root/target/linux/bcm27xx/patches-5.15/950-0528-regulator-rpi-panel-Remove-get_brightness-hook.patch deleted file mode 100644 index c98de12a..00000000 --- a/root/target/linux/bcm27xx/patches-5.15/950-0528-regulator-rpi-panel-Remove-get_brightness-hook.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 2c4e54dfbf229430d74d4a22f5c63c1004db6755 Mon Sep 17 00:00:00 2001 -From: Dave Stevenson -Date: Tue, 21 Sep 2021 15:32:50 +0100 -Subject: [PATCH 528/828] regulator: rpi-panel: Remove get_brightness hook - -The driver was implementing a get_brightness function that -tried to read back the PWM setting of the display to report -as the current brightness. -The controller on the display does not support that, therefore -we end up reporting a brightness of 0, and that confuses -systemd's backlight service. - -Remove the hook so that the framework returns the current -brightness automatically. - -Signed-off-by: Dave Stevenson ---- - .../regulator/rpi-panel-attiny-regulator.c | 23 ------------------- - 1 file changed, 23 deletions(-) - ---- a/drivers/regulator/rpi-panel-attiny-regulator.c -+++ b/drivers/regulator/rpi-panel-attiny-regulator.c -@@ -207,31 +207,8 @@ static int attiny_update_status(struct b - return ret; - } - --static int attiny_get_brightness(struct backlight_device *bl) --{ -- struct attiny_lcd *state = bl_get_data(bl); -- struct regmap *regmap = state->regmap; -- int ret, brightness, i; -- -- mutex_lock(&state->lock); -- -- for (i = 0; i < 10; i++) { -- ret = regmap_read(regmap, REG_PWM, &brightness); -- if (!ret) -- break; -- } -- -- mutex_unlock(&state->lock); -- -- if (ret) -- return ret; -- -- return brightness; --} -- - static const struct backlight_ops attiny_bl = { - .update_status = attiny_update_status, -- .get_brightness = attiny_get_brightness, - }; - - static int attiny_gpio_get_direction(struct gpio_chip *gc, unsigned int off) diff --git a/root/target/linux/bcm27xx/patches-5.15/950-0602-regulator-rpi-panel-attiny-Don-t-read-the-LCD-power-.patch b/root/target/linux/bcm27xx/patches-5.15/950-0602-regulator-rpi-panel-attiny-Don-t-read-the-LCD-power-.patch deleted file mode 100644 index 703550b6..00000000 --- a/root/target/linux/bcm27xx/patches-5.15/950-0602-regulator-rpi-panel-attiny-Don-t-read-the-LCD-power-.patch +++ /dev/null @@ -1,46 +0,0 @@ -From d7041aca489e0ad3e13e5556e46fb33327edf19e Mon Sep 17 00:00:00 2001 -From: Dave Stevenson -Date: Mon, 29 Nov 2021 18:31:37 +0000 -Subject: [PATCH 602/828] 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 ---- - 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 = {