Lines Matching full:w
68 struct wdtbd96801 *w = watchdog_get_drvdata(wdt); in bd96801_wdt_ping() local
70 return regmap_update_bits(w->regmap, BD96801_REG_WD_FEED, in bd96801_wdt_ping()
76 struct wdtbd96801 *w = watchdog_get_drvdata(wdt); in bd96801_wdt_start() local
78 return regmap_update_bits(w->regmap, BD96801_REG_WD_CONF, in bd96801_wdt_start()
84 struct wdtbd96801 *w = watchdog_get_drvdata(wdt); in bd96801_wdt_stop() local
86 return regmap_update_bits(w->regmap, BD96801_REG_WD_CONF, in bd96801_wdt_stop()
166 static int bd96801_set_wdt_mode(struct wdtbd96801 *w, unsigned int hw_margin, in bd96801_set_wdt_mode() argument
170 struct device *dev = w->dev; in bd96801_set_wdt_mode()
211 w->wdt.min_hw_heartbeat_ms = min / 10; in bd96801_set_wdt_mode()
220 w->wdt.max_hw_heartbeat_ms = hw_margin / 10; in bd96801_set_wdt_mode()
226 ret = regmap_update_bits(w->regmap, BD96801_REG_WD_TMO, in bd96801_set_wdt_mode()
231 ret = regmap_update_bits(w->regmap, BD96801_REG_WD_CONF, in bd96801_set_wdt_mode()
237 static int bd96801_set_heartbeat_from_hw(struct wdtbd96801 *w, in bd96801_set_heartbeat_from_hw() argument
249 dev_err(w->dev, "watchdog set to Q&A mode - exiting\n"); in bd96801_set_heartbeat_from_hw()
253 ret = regmap_read(w->regmap, BD96801_REG_WD_TMO, &val); in bd96801_set_heartbeat_from_hw()
261 w->wdt.max_hw_heartbeat_ms = (fast << sel) / USEC_PER_MSEC; in bd96801_set_heartbeat_from_hw()
264 w->wdt.min_hw_heartbeat_ms = fast / USEC_PER_MSEC; in bd96801_set_heartbeat_from_hw()
269 static int init_wdg_hw(struct wdtbd96801 *w) in init_wdg_hw() argument
275 count = device_property_count_u32(w->dev->parent, "rohm,hw-timeout-ms"); in init_wdg_hw()
283 ret = device_property_read_u32_array(w->dev->parent, in init_wdg_hw()
303 ret = bd96801_set_wdt_mode(w, hw_margin_max, hw_margin_min); in init_wdg_hw()
307 ret = device_property_match_string(w->dev->parent, "rohm,wdg-action", in init_wdg_hw()
310 ret = regmap_update_bits(w->regmap, BD96801_REG_WD_CONF, in init_wdg_hw()
316 ret = device_property_match_string(w->dev->parent, "rohm,wdg-action", in init_wdg_hw()
319 ret = regmap_update_bits(w->regmap, BD96801_REG_WD_CONF, in init_wdg_hw()
337 struct wdtbd96801 *w; in bd96801_wdt_probe() local
341 w = devm_kzalloc(&pdev->dev, sizeof(*w), GFP_KERNEL); in bd96801_wdt_probe()
342 if (!w) in bd96801_wdt_probe()
345 w->regmap = dev_get_regmap(pdev->dev.parent, NULL); in bd96801_wdt_probe()
346 w->dev = &pdev->dev; in bd96801_wdt_probe()
348 w->wdt.info = &bd96801_wdt_info; in bd96801_wdt_probe()
349 w->wdt.ops = &bd96801_wdt_ops; in bd96801_wdt_probe()
350 w->wdt.parent = pdev->dev.parent; in bd96801_wdt_probe()
351 w->wdt.timeout = DEFAULT_TIMEOUT; in bd96801_wdt_probe()
352 watchdog_set_drvdata(&w->wdt, w); in bd96801_wdt_probe()
354 ret = regmap_read(w->regmap, BD96801_REG_WD_CONF, &val); in bd96801_wdt_probe()
367 ret = bd96801_set_heartbeat_from_hw(w, val); in bd96801_wdt_probe()
371 set_bit(WDOG_HW_RUNNING, &w->wdt.status); in bd96801_wdt_probe()
374 ret = init_wdg_hw(w); in bd96801_wdt_probe()
379 dev_dbg(w->dev, "heartbeat set to %u - %u\n", in bd96801_wdt_probe()
380 w->wdt.min_hw_heartbeat_ms, w->wdt.max_hw_heartbeat_ms); in bd96801_wdt_probe()
382 watchdog_init_timeout(&w->wdt, 0, pdev->dev.parent); in bd96801_wdt_probe()
383 watchdog_set_nowayout(&w->wdt, nowayout); in bd96801_wdt_probe()
384 watchdog_stop_on_reboot(&w->wdt); in bd96801_wdt_probe()
397 return devm_watchdog_register_device(&pdev->dev, &w->wdt); in bd96801_wdt_probe()