Lines Matching full:w
131 static int bd70528_wdt_set_locked(struct wdtbd70528 *w, int enable) in bd70528_wdt_set_locked() argument
133 return bd70528_wdt_set(w->mfd, enable, NULL); in bd70528_wdt_set_locked()
136 static int bd70528_wdt_change(struct wdtbd70528 *w, int enable) in bd70528_wdt_change() argument
140 bd70528_wdt_lock(w->mfd); in bd70528_wdt_change()
141 ret = bd70528_wdt_set_locked(w, enable); in bd70528_wdt_change()
142 bd70528_wdt_unlock(w->mfd); in bd70528_wdt_change()
149 struct wdtbd70528 *w = watchdog_get_drvdata(wdt); in bd70528_wdt_start() local
151 dev_dbg(w->dev, "WDT ping...\n"); in bd70528_wdt_start()
152 return bd70528_wdt_change(w, 1); in bd70528_wdt_start()
157 struct wdtbd70528 *w = watchdog_get_drvdata(wdt); in bd70528_wdt_stop() local
159 dev_dbg(w->dev, "WDT stopping...\n"); in bd70528_wdt_stop()
160 return bd70528_wdt_change(w, 0); in bd70528_wdt_stop()
170 struct wdtbd70528 *w = watchdog_get_drvdata(wdt); in bd70528_wdt_set_timeout() local
180 bd70528_wdt_lock(w->mfd); in bd70528_wdt_set_timeout()
182 ret = bd70528_wdt_set_locked(w, 0); in bd70528_wdt_set_timeout()
186 ret = regmap_update_bits(w->regmap, BD70528_REG_WDT_HOUR, in bd70528_wdt_set_timeout()
189 dev_err(w->dev, "Failed to set WDT hours\n"); in bd70528_wdt_set_timeout()
192 ret = regmap_update_bits(w->regmap, BD70528_REG_WDT_MINUTE, in bd70528_wdt_set_timeout()
195 dev_err(w->dev, "Failed to set WDT minutes\n"); in bd70528_wdt_set_timeout()
198 ret = regmap_update_bits(w->regmap, BD70528_REG_WDT_SEC, in bd70528_wdt_set_timeout()
201 dev_err(w->dev, "Failed to set WDT seconds\n"); in bd70528_wdt_set_timeout()
203 dev_dbg(w->dev, "WDT tmo set to %u\n", timeout); in bd70528_wdt_set_timeout()
206 ret = bd70528_wdt_set_locked(w, 1); in bd70528_wdt_set_timeout()
208 bd70528_wdt_unlock(w->mfd); in bd70528_wdt_set_timeout()
227 struct wdtbd70528 *w; in bd70528_wdt_probe() local
236 w = devm_kzalloc(&pdev->dev, sizeof(*w), GFP_KERNEL); in bd70528_wdt_probe()
237 if (!w) in bd70528_wdt_probe()
240 w->regmap = bd70528->regmap; in bd70528_wdt_probe()
241 w->mfd = bd70528; in bd70528_wdt_probe()
242 w->dev = &pdev->dev; in bd70528_wdt_probe()
244 w->wdt.info = &bd70528_wdt_info; in bd70528_wdt_probe()
245 w->wdt.ops = &bd70528_wdt_ops; in bd70528_wdt_probe()
246 w->wdt.min_hw_heartbeat_ms = WDT_MIN_MS; in bd70528_wdt_probe()
247 w->wdt.max_hw_heartbeat_ms = WDT_MAX_MS; in bd70528_wdt_probe()
248 w->wdt.parent = pdev->dev.parent; in bd70528_wdt_probe()
249 w->wdt.timeout = DEFAULT_TIMEOUT; in bd70528_wdt_probe()
250 watchdog_set_drvdata(&w->wdt, w); in bd70528_wdt_probe()
251 watchdog_init_timeout(&w->wdt, 0, pdev->dev.parent); in bd70528_wdt_probe()
253 ret = bd70528_wdt_set_timeout(&w->wdt, w->wdt.timeout); in bd70528_wdt_probe()
259 bd70528_wdt_lock(w->mfd); in bd70528_wdt_probe()
260 ret = regmap_read(w->regmap, BD70528_REG_WDT_CTRL, ®); in bd70528_wdt_probe()
261 bd70528_wdt_unlock(w->mfd); in bd70528_wdt_probe()
269 set_bit(WDOG_HW_RUNNING, &w->wdt.status); in bd70528_wdt_probe()
272 ret = devm_watchdog_register_device(&pdev->dev, &w->wdt); in bd70528_wdt_probe()