Lines Matching +full:wdt +full:- +full:enable +full:- +full:once
1 // SPDX-License-Identifier: GPL-2.0-only
27 * struct max77620_variant - Data specific to a chip variant
34 * @cnfg_glbl2_cfg_bits: configuration bits to enable in CNFG_GLBL2 register
58 /* Set WDT clear in OFF and sleep mode */
68 /* Set WDT clear in sleep mode (there is no WDTOFFC on MAX77714) */
74 struct max77620_wdt *wdt = watchdog_get_drvdata(wdt_dev); in max77620_wdt_start() local
76 return regmap_update_bits(wdt->rmap, wdt->drv_data->reg_cnfg_glbl2, in max77620_wdt_start()
82 struct max77620_wdt *wdt = watchdog_get_drvdata(wdt_dev); in max77620_wdt_stop() local
84 return regmap_update_bits(wdt->rmap, wdt->drv_data->reg_cnfg_glbl2, in max77620_wdt_stop()
90 struct max77620_wdt *wdt = watchdog_get_drvdata(wdt_dev); in max77620_wdt_ping() local
92 return regmap_update_bits(wdt->rmap, wdt->drv_data->reg_cnfg_glbl3, in max77620_wdt_ping()
93 wdt->drv_data->wdtc_mask, 0x1); in max77620_wdt_ping()
99 struct max77620_wdt *wdt = watchdog_get_drvdata(wdt_dev); in max77620_wdt_set_timeout() local
131 ret = regmap_update_bits(wdt->rmap, wdt->drv_data->reg_cnfg_glbl3, in max77620_wdt_set_timeout()
132 wdt->drv_data->wdtc_mask, 0x1); in max77620_wdt_set_timeout()
136 ret = regmap_update_bits(wdt->rmap, wdt->drv_data->reg_cnfg_glbl2, in max77620_wdt_set_timeout()
141 wdt_dev->timeout = wdt_timeout; in max77620_wdt_set_timeout()
147 .identity = "max77620-watchdog",
161 struct device *dev = &pdev->dev; in max77620_wdt_probe()
162 struct max77620_wdt *wdt; in max77620_wdt_probe() local
167 wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); in max77620_wdt_probe()
168 if (!wdt) in max77620_wdt_probe()
169 return -ENOMEM; in max77620_wdt_probe()
171 wdt->dev = dev; in max77620_wdt_probe()
172 wdt->drv_data = (const struct max77620_variant *) id->driver_data; in max77620_wdt_probe()
174 wdt->rmap = dev_get_regmap(dev->parent, NULL); in max77620_wdt_probe()
175 if (!wdt->rmap) { in max77620_wdt_probe()
176 dev_err(wdt->dev, "Failed to get parent regmap\n"); in max77620_wdt_probe()
177 return -ENODEV; in max77620_wdt_probe()
180 wdt_dev = &wdt->wdt_dev; in max77620_wdt_probe()
181 wdt_dev->info = &max77620_wdt_info; in max77620_wdt_probe()
182 wdt_dev->ops = &max77620_wdt_ops; in max77620_wdt_probe()
183 wdt_dev->min_timeout = 2; in max77620_wdt_probe()
184 wdt_dev->max_timeout = 128; in max77620_wdt_probe()
185 wdt_dev->max_hw_heartbeat_ms = 128 * 1000; in max77620_wdt_probe()
187 platform_set_drvdata(pdev, wdt); in max77620_wdt_probe()
189 /* Enable WD_RST_WK - WDT expire results in a restart */ in max77620_wdt_probe()
190 ret = regmap_update_bits(wdt->rmap, wdt->drv_data->reg_onoff_cnfg2, in max77620_wdt_probe()
191 wdt->drv_data->bit_wd_rst_wk, in max77620_wdt_probe()
192 wdt->drv_data->bit_wd_rst_wk); in max77620_wdt_probe()
194 dev_err(wdt->dev, "Failed to set WD_RST_WK: %d\n", ret); in max77620_wdt_probe()
198 /* Set the "auto WDT clear" bits available on the chip */ in max77620_wdt_probe()
199 ret = regmap_update_bits(wdt->rmap, wdt->drv_data->reg_cnfg_glbl2, in max77620_wdt_probe()
200 wdt->drv_data->cnfg_glbl2_cfg_bits, in max77620_wdt_probe()
201 wdt->drv_data->cnfg_glbl2_cfg_bits); in max77620_wdt_probe()
203 dev_err(wdt->dev, "Failed to set WDT OFF mode: %d\n", ret); in max77620_wdt_probe()
207 /* Check if WDT running and if yes then set flags properly */ in max77620_wdt_probe()
208 ret = regmap_read(wdt->rmap, wdt->drv_data->reg_cnfg_glbl2, ®val); in max77620_wdt_probe()
210 dev_err(wdt->dev, "Failed to read WDT CFG register: %d\n", ret); in max77620_wdt_probe()
216 wdt_dev->timeout = 2; in max77620_wdt_probe()
219 wdt_dev->timeout = 16; in max77620_wdt_probe()
222 wdt_dev->timeout = 64; in max77620_wdt_probe()
225 wdt_dev->timeout = 128; in max77620_wdt_probe()
230 set_bit(WDOG_HW_RUNNING, &wdt_dev->status); in max77620_wdt_probe()
233 watchdog_set_drvdata(wdt_dev, wdt); in max77620_wdt_probe()
240 { "max77620-watchdog", (kernel_ulong_t)&max77620_wdt_data },
241 { "max77714-watchdog", (kernel_ulong_t)&max77714_wdt_data },
248 .name = "max77620-watchdog",
259 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started "