Skip to content

Commit 3e1c01d

Browse files
6by9broonie
authored andcommitted
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 <[email protected]> Signed-off-by: Marek Vasut <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent a4eb71f commit 3e1c01d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

drivers/regulator/rpi-panel-v2-regulator.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,19 @@ static int rpi_panel_v2_i2c_probe(struct i2c_client *i2c)
8989
if (ret)
9090
return dev_err_probe(&i2c->dev, ret, "Failed to create gpiochip\n");
9191

92+
i2c_set_clientdata(i2c, regmap);
93+
9294
return devm_pwmchip_add(&i2c->dev, pc);
9395
}
9496

97+
static void rpi_panel_v2_i2c_shutdown(struct i2c_client *client)
98+
{
99+
struct regmap *regmap = i2c_get_clientdata(client);
100+
101+
regmap_write(regmap, REG_PWM, 0);
102+
regmap_write(regmap, REG_POWERON, 0);
103+
}
104+
95105
static const struct of_device_id rpi_panel_v2_dt_ids[] = {
96106
{ .compatible = "raspberrypi,touchscreen-panel-regulator-v2" },
97107
{ },
@@ -105,6 +115,7 @@ static struct i2c_driver rpi_panel_v2_regulator_driver = {
105115
.of_match_table = rpi_panel_v2_dt_ids,
106116
},
107117
.probe = rpi_panel_v2_i2c_probe,
118+
.shutdown = rpi_panel_v2_i2c_shutdown,
108119
};
109120

110121
module_i2c_driver(rpi_panel_v2_regulator_driver);

0 commit comments

Comments
 (0)