From 34054942047728627c9f5aad92e85669c4bb34e8 Mon Sep 17 00:00:00 2001 From: hrdl <7808331-hrdl@users.noreply.gitlab.com> Date: Sun, 12 Jun 2022 15:47:20 +0000 Subject: [PATCH] Rudimentary attempt to keep PMIC usable after suspend --- drivers/regulator/tps65185-regulator.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/regulator/tps65185-regulator.c b/drivers/regulator/tps65185-regulator.c index d7730ff98c13..59327f41c8e2 100644 --- a/drivers/regulator/tps65185-regulator.c +++ b/drivers/regulator/tps65185-regulator.c @@ -664,6 +664,24 @@ static int tps65185_probe(struct i2c_client *client) return 0; } +static int __maybe_unused tps65185_resume(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + + struct tps65185 *tps; + int ret; + + tps = i2c_get_clientdata(client); + + ret = tps65185_set_config(dev, tps); + if (ret) + return dev_err_probe(dev, ret, "Failed to set config at resume\n"); + + return 0; +} + +static SIMPLE_DEV_PM_OPS(tps65185_pm, NULL, tps65185_resume); + static const struct of_device_id tps65185_of_match[] = { { .compatible = "ti,tps65185" }, {} @@ -674,6 +692,7 @@ static struct i2c_driver tps65185_driver = { .probe_new = tps65185_probe, .driver = { .name = "tps65185", + .pm = &tps65185_pm, .of_match_table = tps65185_of_match, }, }; -- 2.36.1