lede/target/linux/bcm27xx/patches-6.12/950-0458-regulator-rpi_panel_v2-Add-remove-and-shutdown-hooks.patch
=?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= d81c03f05e bcm27xx: add 6.12 patches from RPi repo
These patches were generated from:
https://github.com/raspberrypi/linux/commits/rpi-6.12.y
With the following command:
git format-patch -N v6.12.27..HEAD
(HEAD -> 8d3206ee456a5ecdf9ddbfd8e5e231e4f0cd716e)

Exceptions:
- (def)configs patches
- github workflows patches
- applied & reverted patches
- readme patches
- wireless patches

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2025-06-20 17:01:06 +08:00

55 lines
1.6 KiB
Diff

From 0f5b5aa667918b5257a266d071ec64eaa95b72ed Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Thu, 16 May 2024 18:26:36 +0100
Subject: [PATCH] regulator: rpi_panel_v2: Add remove and shutdown hooks
Add shutdown and remove hooks so that the panel gets powered
off with the system.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/regulator/rpi-panel-v2-regulator.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
--- a/drivers/regulator/rpi-panel-v2-regulator.c
+++ b/drivers/regulator/rpi-panel-v2-regulator.c
@@ -104,6 +104,7 @@ static int rpi_panel_v2_i2c_probe(struct
return -ENOMEM;
mutex_init(&state->lock);
+ i2c_set_clientdata(i2c, state);
regmap = devm_regmap_init_i2c(i2c, &rpi_panel_regmap_config);
if (IS_ERR(regmap)) {
@@ -168,6 +169,21 @@ error:
return ret;
}
+static void rpi_panel_v2_i2c_remove(struct i2c_client *client)
+{
+ struct rpi_panel_v2_lcd *state = i2c_get_clientdata(client);
+
+ mutex_destroy(&state->lock);
+}
+
+static void rpi_panel_v2_i2c_shutdown(struct i2c_client *client)
+{
+ struct rpi_panel_v2_lcd *state = i2c_get_clientdata(client);
+
+ regmap_write(state->regmap, REG_PWM, 0);
+ regmap_write(state->regmap, REG_POWERON, 0);
+}
+
static const struct of_device_id rpi_panel_v2_dt_ids[] = {
{ .compatible = "raspberrypi,v2-touchscreen-panel-regulator" },
{},
@@ -180,6 +196,8 @@ static struct i2c_driver rpi_panel_v2_re
.of_match_table = of_match_ptr(rpi_panel_v2_dt_ids),
},
.probe = rpi_panel_v2_i2c_probe,
+ .remove = rpi_panel_v2_i2c_remove,
+ .shutdown = rpi_panel_v2_i2c_shutdown,
};
module_i2c_driver(rpi_panel_v2_regulator_driver);