From a02f1a28cf74e9593e5b2e1c18fe0cbe6cc59e42 Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Thu, 25 Apr 2024 17:13:05 +0100 Subject: [PATCH 1072/1085] regulator/rpi-panel: Power off display on shutdown Adds a shutdown function to turn off the backlight, bridge, and touch controller on shutdown. Signed-off-by: Dave Stevenson --- drivers/regulator/rpi-panel-attiny-regulator.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/drivers/regulator/rpi-panel-attiny-regulator.c +++ b/drivers/regulator/rpi-panel-attiny-regulator.c @@ -370,6 +370,14 @@ static void attiny_i2c_remove(struct i2c mutex_destroy(&state->lock); } +static void attiny_i2c_shutdown(struct i2c_client *client) +{ + struct attiny_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 attiny_dt_ids[] = { { .compatible = "raspberrypi,7inch-touchscreen-panel-regulator" }, {}, @@ -384,6 +392,7 @@ static struct i2c_driver attiny_regulato }, .probe = attiny_i2c_probe, .remove = attiny_i2c_remove, + .shutdown = attiny_i2c_shutdown, }; module_i2c_driver(attiny_regulator_driver);