Lines Matching +full:watchdog +full:- +full:enable
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Watchdog driver for Ricoh RN5T618 PMIC
12 #include <linux/watchdog.h>
14 #define DRIVER_NAME "rn5t618-wdt"
20 MODULE_PARM_DESC(timeout, "Initial watchdog timeout in seconds");
23 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
33 * watchdog expiration times. If the watchdog is not accessed before
59 return -EINVAL; in rn5t618_wdt_set_timeout()
61 ret = regmap_update_bits(wdt->rn5t618->regmap, RN5T618_WATCHDOG, in rn5t618_wdt_set_timeout()
65 wdt_dev->timeout = rn5t618_wdt_map[i].time; in rn5t618_wdt_set_timeout()
75 ret = rn5t618_wdt_set_timeout(wdt_dev, wdt_dev->timeout); in rn5t618_wdt_start()
79 /* enable repower-on */ in rn5t618_wdt_start()
80 ret = regmap_update_bits(wdt->rn5t618->regmap, RN5T618_REPCNT, in rn5t618_wdt_start()
86 /* enable watchdog */ in rn5t618_wdt_start()
87 ret = regmap_update_bits(wdt->rn5t618->regmap, RN5T618_WATCHDOG, in rn5t618_wdt_start()
93 /* enable watchdog interrupt */ in rn5t618_wdt_start()
94 return regmap_update_bits(wdt->rn5t618->regmap, RN5T618_PWRIREN, in rn5t618_wdt_start()
103 return regmap_update_bits(wdt->rn5t618->regmap, RN5T618_WATCHDOG, in rn5t618_wdt_stop()
113 /* The counter is restarted after a R/W access to watchdog register */ in rn5t618_wdt_ping()
114 ret = regmap_read(wdt->rn5t618->regmap, RN5T618_WATCHDOG, &val); in rn5t618_wdt_ping()
118 ret = regmap_write(wdt->rn5t618->regmap, RN5T618_WATCHDOG, val); in rn5t618_wdt_ping()
122 /* Clear pending watchdog interrupt */ in rn5t618_wdt_ping()
123 return regmap_update_bits(wdt->rn5t618->regmap, RN5T618_PWRIRQ, in rn5t618_wdt_ping()
143 struct device *dev = &pdev->dev; in rn5t618_wdt_probe()
144 struct rn5t618 *rn5t618 = dev_get_drvdata(dev->parent); in rn5t618_wdt_probe()
152 return -ENOMEM; in rn5t618_wdt_probe()
155 max_timeout = rn5t618_wdt_map[ARRAY_SIZE(rn5t618_wdt_map) - 1].time; in rn5t618_wdt_probe()
157 wdt->rn5t618 = rn5t618; in rn5t618_wdt_probe()
158 wdt->wdt_dev.info = &rn5t618_wdt_info; in rn5t618_wdt_probe()
159 wdt->wdt_dev.ops = &rn5t618_wdt_ops; in rn5t618_wdt_probe()
160 wdt->wdt_dev.min_timeout = min_timeout; in rn5t618_wdt_probe()
161 wdt->wdt_dev.max_timeout = max_timeout; in rn5t618_wdt_probe()
162 wdt->wdt_dev.timeout = max_timeout; in rn5t618_wdt_probe()
163 wdt->wdt_dev.parent = dev; in rn5t618_wdt_probe()
165 /* Read out previous power-off factor */ in rn5t618_wdt_probe()
166 ret = regmap_read(wdt->rn5t618->regmap, RN5T618_POFFHIS, &val); in rn5t618_wdt_probe()
171 wdt->wdt_dev.bootstatus = WDIOF_POWERUNDER; in rn5t618_wdt_probe()
173 wdt->wdt_dev.bootstatus = WDIOF_CARDRESET; in rn5t618_wdt_probe()
175 watchdog_set_drvdata(&wdt->wdt_dev, wdt); in rn5t618_wdt_probe()
176 watchdog_init_timeout(&wdt->wdt_dev, timeout, dev); in rn5t618_wdt_probe()
177 watchdog_set_nowayout(&wdt->wdt_dev, nowayout); in rn5t618_wdt_probe()
181 return devm_watchdog_register_device(dev, &wdt->wdt_dev); in rn5t618_wdt_probe()
193 MODULE_ALIAS("platform:rn5t618-wdt");
195 MODULE_DESCRIPTION("RN5T618 watchdog driver");