Lines Matching +full:use +full:- +full:sw +full:- +full:pm

1 // SPDX-License-Identifier: GPL-2.0+
26 #define DA9062_TWDSCALE_MAX (ARRAY_SIZE(wdt_timeout) - 1)
29 #define DA9062_WDG_DEFAULT_TIMEOUT wdt_timeout[DA9062_TWDSCALE_MAX-1]
42 regmap_read(wdt->hw->regmap, DA9062AA_CONTROL_D, &val); in da9062_wdt_read_timeout()
61 return regmap_update_bits(wdt->hw->regmap, DA9062AA_CONTROL_F, in da9062_reset_watchdog_timer()
69 struct da9062 *chip = wdt->hw; in da9062_wdt_update_timeout_register()
71 regmap_update_bits(chip->regmap, in da9062_wdt_update_timeout_register()
78 return regmap_update_bits(chip->regmap, in da9062_wdt_update_timeout_register()
90 selector = da9062_wdt_timeout_to_sel(wdt->wdtdev.timeout); in da9062_wdt_start()
93 dev_err(wdt->hw->dev, "Watchdog failed to start (err = %d)\n", in da9062_wdt_start()
104 ret = regmap_update_bits(wdt->hw->regmap, in da9062_wdt_stop()
109 dev_err(wdt->hw->dev, "Watchdog failed to stop (err = %d)\n", in da9062_wdt_stop()
129 dev_err(wdt->hw->dev, "Failed to ping the watchdog (err = %d)\n", in da9062_wdt_ping()
145 dev_err(wdt->hw->dev, "Failed to set watchdog timeout (err = %d)\n", in da9062_wdt_set_timeout()
148 wdd->timeout = wdt_timeout[selector]; in da9062_wdt_set_timeout()
157 struct i2c_client *client = to_i2c_client(wdt->hw->dev); in da9062_wdt_restart()
160 /* Don't use regmap because it is not atomic safe */ in da9062_wdt_restart()
164 dev_alert(wdt->hw->dev, "Failed to shutdown (err = %d)\n", in da9062_wdt_restart()
188 { .compatible = "dlg,da9062-watchdog", },
196 struct device *dev = &pdev->dev; in da9062_wdt_probe()
201 chip = dev_get_drvdata(dev->parent); in da9062_wdt_probe()
203 return -EINVAL; in da9062_wdt_probe()
207 return -ENOMEM; in da9062_wdt_probe()
209 wdt->use_sw_pm = device_property_present(dev, "dlg,use-sw-pm"); in da9062_wdt_probe()
211 wdt->hw = chip; in da9062_wdt_probe()
213 wdt->wdtdev.info = &da9062_watchdog_info; in da9062_wdt_probe()
214 wdt->wdtdev.ops = &da9062_watchdog_ops; in da9062_wdt_probe()
215 wdt->wdtdev.min_timeout = DA9062_WDT_MIN_TIMEOUT; in da9062_wdt_probe()
216 wdt->wdtdev.max_timeout = DA9062_WDT_MAX_TIMEOUT; in da9062_wdt_probe()
217 wdt->wdtdev.min_hw_heartbeat_ms = DA9062_RESET_PROTECTION_MS; in da9062_wdt_probe()
218 wdt->wdtdev.timeout = DA9062_WDG_DEFAULT_TIMEOUT; in da9062_wdt_probe()
219 wdt->wdtdev.status = WATCHDOG_NOWAYOUT_INIT_STATUS; in da9062_wdt_probe()
220 wdt->wdtdev.parent = dev; in da9062_wdt_probe()
222 watchdog_set_restart_priority(&wdt->wdtdev, 128); in da9062_wdt_probe()
224 watchdog_set_drvdata(&wdt->wdtdev, wdt); in da9062_wdt_probe()
225 dev_set_drvdata(dev, &wdt->wdtdev); in da9062_wdt_probe()
229 wdt->wdtdev.timeout = timeout; in da9062_wdt_probe()
232 watchdog_init_timeout(&wdt->wdtdev, 0, dev); in da9062_wdt_probe()
235 da9062_wdt_set_timeout(&wdt->wdtdev, wdt->wdtdev.timeout); in da9062_wdt_probe()
236 set_bit(WDOG_HW_RUNNING, &wdt->wdtdev.status); in da9062_wdt_probe()
239 return devm_watchdog_register_device(dev, &wdt->wdtdev); in da9062_wdt_probe()
247 if (!wdt->use_sw_pm) in da9062_wdt_suspend()
261 if (!wdt->use_sw_pm) in da9062_wdt_resume()
276 .name = "da9062-watchdog",
277 .pm = &da9062_wdt_pm_ops,
286 MODULE_ALIAS("platform:da9062-watchdog");