From: Dave Stevenson Date: Mon, 16 Jun 2025 15:40:07 +0000 (+0200) Subject: regulator: rpi-panel-v2: Add shutdown hook X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=3e1c01d06e1f52f78fe00ef26a9cf80dbb0a3115;p=users%2Fjedix%2Flinux-maple.git 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 Signed-off-by: Marek Vasut Link: https://patch.msgid.link/20250616154018.430004-1-marek.vasut+renesas@mailbox.org Signed-off-by: Mark Brown --- diff --git a/drivers/regulator/rpi-panel-v2-regulator.c b/drivers/regulator/rpi-panel-v2-regulator.c index c506fd699d572..30b78aa75ee38 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);