Lines Matching +full:wdt +full:- +full:enable +full:- +full:once
1 // SPDX-License-Identifier: GPL-2.0-only
14 #define DRIVER_NAME "rn5t618-wdt"
23 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
50 struct rn5t618_wdt *wdt = watchdog_get_drvdata(wdt_dev); in rn5t618_wdt_set_timeout() local
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()
72 struct rn5t618_wdt *wdt = watchdog_get_drvdata(wdt_dev); in rn5t618_wdt_start() local
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()
101 struct rn5t618_wdt *wdt = watchdog_get_drvdata(wdt_dev); in rn5t618_wdt_stop() local
103 return regmap_update_bits(wdt->rn5t618->regmap, RN5T618_WATCHDOG, in rn5t618_wdt_stop()
109 struct rn5t618_wdt *wdt = watchdog_get_drvdata(wdt_dev); in rn5t618_wdt_ping() local
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()
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()
145 struct rn5t618_wdt *wdt; in rn5t618_wdt_probe() local
150 wdt = devm_kzalloc(dev, sizeof(struct rn5t618_wdt), GFP_KERNEL); in rn5t618_wdt_probe()
151 if (!wdt) 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()
179 platform_set_drvdata(pdev, wdt); in rn5t618_wdt_probe()
181 return devm_watchdog_register_device(dev, &wdt->wdt_dev); in rn5t618_wdt_probe()
193 MODULE_ALIAS("platform:rn5t618-wdt");