Skip to content

Commit c26eef8

Browse files
lategoodbyegroeck
authored andcommitted
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 <[email protected]> Signed-off-by: Guenter Roeck <[email protected]>
1 parent 4d2ffc4 commit c26eef8

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

drivers/hwmon/raspberrypi-hwmon.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,32 @@ static int rpi_hwmon_probe(struct platform_device *pdev)
128128
return 0;
129129
}
130130

131+
static int rpi_hwmon_suspend(struct device *dev)
132+
{
133+
struct rpi_hwmon_data *data = dev_get_drvdata(dev);
134+
135+
cancel_delayed_work_sync(&data->get_values_poll_work);
136+
137+
return 0;
138+
}
139+
140+
static int rpi_hwmon_resume(struct device *dev)
141+
{
142+
struct rpi_hwmon_data *data = dev_get_drvdata(dev);
143+
144+
get_values_poll(&data->get_values_poll_work.work);
145+
146+
return 0;
147+
}
148+
149+
static DEFINE_SIMPLE_DEV_PM_OPS(rpi_hwmon_pm_ops, rpi_hwmon_suspend,
150+
rpi_hwmon_resume);
151+
131152
static struct platform_driver rpi_hwmon_driver = {
132153
.probe = rpi_hwmon_probe,
133154
.driver = {
134155
.name = "raspberrypi-hwmon",
156+
.pm = pm_ptr(&rpi_hwmon_pm_ops),
135157
},
136158
};
137159
module_platform_driver(rpi_hwmon_driver);

0 commit comments

Comments
 (0)