[PATCH] regulator: rpi-panel-v2: Add shutdown hook

Marek Vasut posted 1 patch 3 months, 3 weeks ago
drivers/regulator/rpi-panel-v2-regulator.c | 11 +++++++++++
1 file changed, 11 insertions(+)
[PATCH] regulator: rpi-panel-v2: Add shutdown hook
Posted by Marek Vasut 3 months, 3 weeks ago
From: Dave Stevenson <dave.stevenson@raspberrypi.com>

Add shutdown hook so that the panel gets powered off with the system.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
---
Cc: Dave Stevenson <dave.stevenson@raspberrypi.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: linux-kernel@vger.kernel.org
---
 drivers/regulator/rpi-panel-v2-regulator.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/regulator/rpi-panel-v2-regulator.c b/drivers/regulator/rpi-panel-v2-regulator.c
index c506fd699d57..30b78aa75ee3 100644
--- a/drivers/regulator/rpi-panel-v2-regulator.c
+++ b/drivers/regulator/rpi-panel-v2-regulator.c
@@ -89,9 +89,19 @@ static int rpi_panel_v2_i2c_probe(struct i2c_client *i2c)
 	if (ret)
 		return dev_err_probe(&i2c->dev, ret, "Failed to create gpiochip\n");
 
+	i2c_set_clientdata(i2c, regmap);
+
 	return devm_pwmchip_add(&i2c->dev, pc);
 }
 
+static void rpi_panel_v2_i2c_shutdown(struct i2c_client *client)
+{
+	struct regmap *regmap = i2c_get_clientdata(client);
+
+	regmap_write(regmap, REG_PWM, 0);
+	regmap_write(regmap, REG_POWERON, 0);
+}
+
 static const struct of_device_id rpi_panel_v2_dt_ids[] = {
 	{ .compatible = "raspberrypi,touchscreen-panel-regulator-v2" },
 	{ },
@@ -105,6 +115,7 @@ static struct i2c_driver rpi_panel_v2_regulator_driver = {
 		.of_match_table = rpi_panel_v2_dt_ids,
 	},
 	.probe = rpi_panel_v2_i2c_probe,
+	.shutdown = rpi_panel_v2_i2c_shutdown,
 };
 
 module_i2c_driver(rpi_panel_v2_regulator_driver);
-- 
2.47.2
Re: [PATCH] regulator: rpi-panel-v2: Add shutdown hook
Posted by Mark Brown 3 months, 3 weeks ago
On Mon, 16 Jun 2025 17:40:07 +0200, Marek Vasut wrote:
> Add shutdown hook so that the panel gets powered off with the system.
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/1] regulator: rpi-panel-v2: Add shutdown hook
      commit: 3e1c01d06e1f52f78fe00ef26a9cf80dbb0a3115

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark