diff options
author | Michal Simek <michal.simek@xilinx.com> | 2017-08-07 07:24:23 -0400 |
---|---|---|
committer | Wim Van Sebroeck <wim@iguana.be> | 2017-09-09 14:48:18 -0400 |
commit | 6f671c6b6288fd673e8b8b8acf1070100ba8188a (patch) | |
tree | b37d48df305feb7292348263de27fb46979c1e51 | |
parent | b6bc41645547f4e1a1bd882db7fa2b8596197d88 (diff) |
watchdog: of_xilinx_wdt: Add suspend/resume support
Add suspend/resume support to driver.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
-rw-r--r-- | drivers/watchdog/of_xilinx_wdt.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/drivers/watchdog/of_xilinx_wdt.c b/drivers/watchdog/of_xilinx_wdt.c index 41edeb93a327..1cf286945b7a 100644 --- a/drivers/watchdog/of_xilinx_wdt.c +++ b/drivers/watchdog/of_xilinx_wdt.c | |||
@@ -264,6 +264,43 @@ static int xwdt_remove(struct platform_device *pdev) | |||
264 | return 0; | 264 | return 0; |
265 | } | 265 | } |
266 | 266 | ||
267 | /** | ||
268 | * xwdt_suspend - Suspend the device. | ||
269 | * | ||
270 | * @dev: handle to the device structure. | ||
271 | * Return: 0 always. | ||
272 | */ | ||
273 | static int __maybe_unused xwdt_suspend(struct device *dev) | ||
274 | { | ||
275 | struct platform_device *pdev = to_platform_device(dev); | ||
276 | struct xwdt_device *xdev = platform_get_drvdata(pdev); | ||
277 | |||
278 | if (watchdog_active(&xdev->xilinx_wdt_wdd)) | ||
279 | xilinx_wdt_stop(&xdev->xilinx_wdt_wdd); | ||
280 | |||
281 | return 0; | ||
282 | } | ||
283 | |||
284 | /** | ||
285 | * xwdt_resume - Resume the device. | ||
286 | * | ||
287 | * @dev: handle to the device structure. | ||
288 | * Return: 0 on success, errno otherwise. | ||
289 | */ | ||
290 | static int __maybe_unused xwdt_resume(struct device *dev) | ||
291 | { | ||
292 | struct platform_device *pdev = to_platform_device(dev); | ||
293 | struct xwdt_device *xdev = platform_get_drvdata(pdev); | ||
294 | int ret = 0; | ||
295 | |||
296 | if (watchdog_active(&xdev->xilinx_wdt_wdd)) | ||
297 | ret = xilinx_wdt_start(&xdev->xilinx_wdt_wdd); | ||
298 | |||
299 | return ret; | ||
300 | } | ||
301 | |||
302 | static SIMPLE_DEV_PM_OPS(xwdt_pm_ops, xwdt_suspend, xwdt_resume); | ||
303 | |||
267 | /* Match table for of_platform binding */ | 304 | /* Match table for of_platform binding */ |
268 | static const struct of_device_id xwdt_of_match[] = { | 305 | static const struct of_device_id xwdt_of_match[] = { |
269 | { .compatible = "xlnx,xps-timebase-wdt-1.00.a", }, | 306 | { .compatible = "xlnx,xps-timebase-wdt-1.00.a", }, |
@@ -278,6 +315,7 @@ static struct platform_driver xwdt_driver = { | |||
278 | .driver = { | 315 | .driver = { |
279 | .name = WATCHDOG_NAME, | 316 | .name = WATCHDOG_NAME, |
280 | .of_match_table = xwdt_of_match, | 317 | .of_match_table = xwdt_of_match, |
318 | .pm = &xwdt_pm_ops, | ||
281 | }, | 319 | }, |
282 | }; | 320 | }; |
283 | 321 | ||