Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge git://www.linux-watchdog.org/linux-watchdog

Pull small watchdog update from Wim Van Sebroeck:
- fix the argument of watchdog_active() in imx2_wdt
- Add power management support to the imx2_wdt watchdog.

* git://www.linux-watchdog.org/linux-watchdog:
watchdog: imx2_wdt: Fix the argument of watchdog_active()
watchdog: imx2_wdt: Add power management support.

+47
+47
drivers/watchdog/imx2_wdt.c
··· 326 326 } 327 327 } 328 328 329 + #ifdef CONFIG_PM_SLEEP 330 + /* Disable watchdog if it is active during suspend */ 331 + static int imx2_wdt_suspend(struct device *dev) 332 + { 333 + struct watchdog_device *wdog = dev_get_drvdata(dev); 334 + struct imx2_wdt_device *wdev = watchdog_get_drvdata(wdog); 335 + 336 + imx2_wdt_set_timeout(wdog, IMX2_WDT_MAX_TIME); 337 + imx2_wdt_ping(wdog); 338 + 339 + /* Watchdog has been stopped but IP block is still running */ 340 + if (!watchdog_active(wdog) && imx2_wdt_is_running(wdev)) 341 + del_timer_sync(&wdev->timer); 342 + 343 + clk_disable_unprepare(wdev->clk); 344 + 345 + return 0; 346 + } 347 + 348 + /* Enable watchdog and configure it if necessary */ 349 + static int imx2_wdt_resume(struct device *dev) 350 + { 351 + struct watchdog_device *wdog = dev_get_drvdata(dev); 352 + struct imx2_wdt_device *wdev = watchdog_get_drvdata(wdog); 353 + 354 + clk_prepare_enable(wdev->clk); 355 + 356 + if (watchdog_active(wdog) && !imx2_wdt_is_running(wdev)) { 357 + /* Resumes from deep sleep we need restart 358 + * the watchdog again. 359 + */ 360 + imx2_wdt_setup(wdog); 361 + imx2_wdt_set_timeout(wdog, wdog->timeout); 362 + imx2_wdt_ping(wdog); 363 + } else if (imx2_wdt_is_running(wdev)) { 364 + imx2_wdt_ping(wdog); 365 + mod_timer(&wdev->timer, jiffies + wdog->timeout * HZ / 2); 366 + } 367 + 368 + return 0; 369 + } 370 + #endif 371 + 372 + static SIMPLE_DEV_PM_OPS(imx2_wdt_pm_ops, imx2_wdt_suspend, 373 + imx2_wdt_resume); 374 + 329 375 static const struct of_device_id imx2_wdt_dt_ids[] = { 330 376 { .compatible = "fsl,imx21-wdt", }, 331 377 { /* sentinel */ } ··· 383 337 .shutdown = imx2_wdt_shutdown, 384 338 .driver = { 385 339 .name = DRIVER_NAME, 340 + .pm = &imx2_wdt_pm_ops, 386 341 .of_match_table = imx2_wdt_dt_ids, 387 342 }, 388 343 };