1 From fd373fba7abfec9f8fed6e5e439d4df61811bd32 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Thu, 16 May 2024 18:26:36 +0100
4 Subject: [PATCH 1091/1135] regulator: rpi_panel_v2: Add remove and shutdown
7 Add shutdown and remove hooks so that the panel gets powered
10 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
12 drivers/regulator/rpi-panel-v2-regulator.c | 18 ++++++++++++++++++
13 1 file changed, 18 insertions(+)
15 --- a/drivers/regulator/rpi-panel-v2-regulator.c
16 +++ b/drivers/regulator/rpi-panel-v2-regulator.c
17 @@ -104,6 +104,7 @@ static int rpi_panel_v2_i2c_probe(struct
20 mutex_init(&state->lock);
21 + i2c_set_clientdata(i2c, state);
23 regmap = devm_regmap_init_i2c(i2c, &rpi_panel_regmap_config);
25 @@ -168,6 +169,21 @@ error:
29 +static void rpi_panel_v2_i2c_remove(struct i2c_client *client)
31 + struct rpi_panel_v2_lcd *state = i2c_get_clientdata(client);
33 + mutex_destroy(&state->lock);
36 +static void rpi_panel_v2_i2c_shutdown(struct i2c_client *client)
38 + struct rpi_panel_v2_lcd *state = i2c_get_clientdata(client);
40 + regmap_write(state->regmap, REG_PWM, 0);
41 + regmap_write(state->regmap, REG_POWERON, 0);
44 static const struct of_device_id rpi_panel_v2_dt_ids[] = {
45 { .compatible = "raspberrypi,v2-touchscreen-panel-regulator" },
47 @@ -180,6 +196,8 @@ static struct i2c_driver rpi_panel_v2_re
48 .of_match_table = of_match_ptr(rpi_panel_v2_dt_ids),
50 .probe = rpi_panel_v2_i2c_probe,
51 + .remove = rpi_panel_v2_i2c_remove,
52 + .shutdown = rpi_panel_v2_i2c_shutdown,
55 module_i2c_driver(rpi_panel_v2_regulator_driver);