Lines Matching +full:wdt +full:- +full:enable +full:- +full:once
1 // SPDX-License-Identifier: GPL-2.0-or-later
10 #include <linux/mfd/rohm-bd957x.h>
20 "Watchdog cannot be stopped once started (default=\"false\")");
38 gpiod_set_value_cansleep(priv->gpiod_en, 0); in bd9576_wdt_disable()
46 gpiod_set_value_cansleep(priv->gpiod_ping, 1); in bd9576_wdt_ping()
47 gpiod_set_value_cansleep(priv->gpiod_ping, 0); in bd9576_wdt_ping()
56 gpiod_set_value_cansleep(priv->gpiod_en, 1); in bd9576_wdt_start()
65 if (!priv->always_running) in bd9576_wdt_stop()
68 set_bit(WDOG_HW_RUNNING, &wdd->status); in bd9576_wdt_stop()
101 return -EINVAL; in find_closest_fast()
117 return -EINVAL; in find_closest_slow_by_fast()
145 return -EINVAL; in find_closest_slow()
160 struct device *dev = priv->dev; in bd957x_set_wdt_mode()
172 dev_err(dev, "bad WDT window for fast timeout\n"); in bd957x_set_wdt_mode()
178 dev_err(dev, "bad WDT window\n"); in bd957x_set_wdt_mode()
187 dev_err(dev, "bad WDT window\n"); in bd957x_set_wdt_mode()
192 slowng <<= ffs(BD957X_WDG_NG_RATIO_MASK) - 1; in bd957x_set_wdt_mode()
196 ret = regmap_update_bits(priv->regmap, BD957X_REG_WDT_CONF, in bd957x_set_wdt_mode()
204 struct device *dev = &pdev->dev; in bd9576_wdt_probe()
213 return -ENOMEM; in bd9576_wdt_probe()
217 priv->dev = dev; in bd9576_wdt_probe()
218 priv->regmap = dev_get_regmap(dev->parent, NULL); in bd9576_wdt_probe()
219 if (!priv->regmap) { in bd9576_wdt_probe()
221 return -ENODEV; in bd9576_wdt_probe()
224 priv->gpiod_en = devm_fwnode_gpiod_get(dev, dev_fwnode(dev->parent), in bd9576_wdt_probe()
225 "rohm,watchdog-enable", in bd9576_wdt_probe()
227 "watchdog-enable"); in bd9576_wdt_probe()
228 if (IS_ERR(priv->gpiod_en)) in bd9576_wdt_probe()
229 return dev_err_probe(dev, PTR_ERR(priv->gpiod_en), in bd9576_wdt_probe()
230 "getting watchdog-enable GPIO failed\n"); in bd9576_wdt_probe()
232 priv->gpiod_ping = devm_fwnode_gpiod_get(dev, dev_fwnode(dev->parent), in bd9576_wdt_probe()
233 "rohm,watchdog-ping", in bd9576_wdt_probe()
235 "watchdog-ping"); in bd9576_wdt_probe()
236 if (IS_ERR(priv->gpiod_ping)) in bd9576_wdt_probe()
237 return dev_err_probe(dev, PTR_ERR(priv->gpiod_ping), in bd9576_wdt_probe()
238 "getting watchdog-ping GPIO failed\n"); in bd9576_wdt_probe()
240 count = device_property_count_u32(dev->parent, "rohm,hw-timeout-ms"); in bd9576_wdt_probe()
241 if (count < 0 && count != -EINVAL) in bd9576_wdt_probe()
246 return -EINVAL; in bd9576_wdt_probe()
248 ret = device_property_read_u32_array(dev->parent, in bd9576_wdt_probe()
249 "rohm,hw-timeout-ms", in bd9576_wdt_probe()
267 priv->always_running = device_property_read_bool(dev->parent, in bd9576_wdt_probe()
268 "always-running"); in bd9576_wdt_probe()
270 watchdog_set_drvdata(&priv->wdd, priv); in bd9576_wdt_probe()
272 priv->wdd.info = &bd957x_wdt_ident; in bd9576_wdt_probe()
273 priv->wdd.ops = &bd957x_wdt_ops; in bd9576_wdt_probe()
274 priv->wdd.min_hw_heartbeat_ms = hw_margin_min; in bd9576_wdt_probe()
275 priv->wdd.max_hw_heartbeat_ms = hw_margin_max; in bd9576_wdt_probe()
276 priv->wdd.parent = dev; in bd9576_wdt_probe()
277 priv->wdd.timeout = WATCHDOG_TIMEOUT; in bd9576_wdt_probe()
279 watchdog_init_timeout(&priv->wdd, 0, dev); in bd9576_wdt_probe()
280 watchdog_set_nowayout(&priv->wdd, nowayout); in bd9576_wdt_probe()
282 watchdog_stop_on_reboot(&priv->wdd); in bd9576_wdt_probe()
284 if (priv->always_running) in bd9576_wdt_probe()
285 bd9576_wdt_start(&priv->wdd); in bd9576_wdt_probe()
287 return devm_watchdog_register_device(dev, &priv->wdd); in bd9576_wdt_probe()
292 .name = "bd9576-wdt",
302 MODULE_ALIAS("platform:bd9576-wdt");