diff options
author | Stefan Wahren <wahrenst@gmx.net> | 2024-12-02 12:58:32 +0100 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2024-12-14 08:00:44 -0800 |
commit | c26eef895794b31be8a2714b8a1b5d0b8b605bc4 (patch) | |
tree | 70dc0f9573ee65175621629e3e801e92bb546323 | |
parent | 4d2ffc42f78c429b7d42a635351a654c6f0b01b5 (diff) |
hwmon: (raspberrypi) Add PM suspend/resume support
Add suspend/resume handler in order to stop firmware polling
during s2idle. This was just waking-up the system without a real
benefit.
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r-- | drivers/hwmon/raspberrypi-hwmon.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/hwmon/raspberrypi-hwmon.c b/drivers/hwmon/raspberrypi-hwmon.c index 10ef1e1f9458..a2938881ccd2 100644 --- a/drivers/hwmon/raspberrypi-hwmon.c +++ b/drivers/hwmon/raspberrypi-hwmon.c @@ -128,10 +128,32 @@ static int rpi_hwmon_probe(struct platform_device *pdev) return 0; } +static int rpi_hwmon_suspend(struct device *dev) +{ + struct rpi_hwmon_data *data = dev_get_drvdata(dev); + + cancel_delayed_work_sync(&data->get_values_poll_work); + + return 0; +} + +static int rpi_hwmon_resume(struct device *dev) +{ + struct rpi_hwmon_data *data = dev_get_drvdata(dev); + + get_values_poll(&data->get_values_poll_work.work); + + return 0; +} + +static DEFINE_SIMPLE_DEV_PM_OPS(rpi_hwmon_pm_ops, rpi_hwmon_suspend, + rpi_hwmon_resume); + static struct platform_driver rpi_hwmon_driver = { .probe = rpi_hwmon_probe, .driver = { .name = "raspberrypi-hwmon", + .pm = pm_ptr(&rpi_hwmon_pm_ops), }, }; module_platform_driver(rpi_hwmon_driver); |