regulator: rpi-panel-v2: Add shutdown hook

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>
Link: https://patch.msgid.link/20250616154018.430004-1-marek.vasut+renesas@mailbox.org
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Dave Stevenson 2025-06-16 17:40:07 +02:00 committed by Mark Brown
parent a4eb71ff98
commit 3e1c01d06e
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
1 changed files with 11 additions and 0 deletions

View File

@ -89,9 +89,19 @@ static int rpi_panel_v2_i2c_probe(struct i2c_client *i2c)
if (ret) if (ret)
return dev_err_probe(&i2c->dev, ret, "Failed to create gpiochip\n"); return dev_err_probe(&i2c->dev, ret, "Failed to create gpiochip\n");
i2c_set_clientdata(i2c, regmap);
return devm_pwmchip_add(&i2c->dev, pc); 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[] = { static const struct of_device_id rpi_panel_v2_dt_ids[] = {
{ .compatible = "raspberrypi,touchscreen-panel-regulator-v2" }, { .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, .of_match_table = rpi_panel_v2_dt_ids,
}, },
.probe = rpi_panel_v2_i2c_probe, .probe = rpi_panel_v2_i2c_probe,
.shutdown = rpi_panel_v2_i2c_shutdown,
}; };
module_i2c_driver(rpi_panel_v2_regulator_driver); module_i2c_driver(rpi_panel_v2_regulator_driver);