Lines Matching +full:drv +full:- +full:2
1 // SPDX-License-Identifier: GPL-2.0+
42 static unsigned int a21_wdt_get_bootstatus(struct a21_wdt_drv *drv) in a21_wdt_get_bootstatus() argument
46 reset |= gpiod_get_value(drv->gpios[GPIO_WD_RST0]) ? (1 << 0) : 0; in a21_wdt_get_bootstatus()
47 reset |= gpiod_get_value(drv->gpios[GPIO_WD_RST1]) ? (1 << 1) : 0; in a21_wdt_get_bootstatus()
48 reset |= gpiod_get_value(drv->gpios[GPIO_WD_RST2]) ? (1 << 2) : 0; in a21_wdt_get_bootstatus()
55 struct a21_wdt_drv *drv = watchdog_get_drvdata(wdt); in a21_wdt_start() local
57 gpiod_set_value(drv->gpios[GPIO_WD_ENAB], 1); in a21_wdt_start()
64 struct a21_wdt_drv *drv = watchdog_get_drvdata(wdt); in a21_wdt_stop() local
66 gpiod_set_value(drv->gpios[GPIO_WD_ENAB], 0); in a21_wdt_stop()
73 struct a21_wdt_drv *drv = watchdog_get_drvdata(wdt); in a21_wdt_ping() local
75 gpiod_set_value(drv->gpios[GPIO_WD_TRIG], 0); in a21_wdt_ping()
77 gpiod_set_value(drv->gpios[GPIO_WD_TRIG], 1); in a21_wdt_ping()
85 struct a21_wdt_drv *drv = watchdog_get_drvdata(wdt); in a21_wdt_set_timeout() local
88 dev_err(wdt->parent, "Only 1 and 30 allowed as timeout\n"); in a21_wdt_set_timeout()
89 return -EINVAL; in a21_wdt_set_timeout()
92 if (timeout == 30 && wdt->timeout == 1) { in a21_wdt_set_timeout()
93 dev_err(wdt->parent, in a21_wdt_set_timeout()
95 return -EINVAL; in a21_wdt_set_timeout()
99 gpiod_set_value(drv->gpios[GPIO_WD_FAST], 1); in a21_wdt_set_timeout()
101 gpiod_set_value(drv->gpios[GPIO_WD_FAST], 0); in a21_wdt_set_timeout()
103 wdt->timeout = timeout; in a21_wdt_set_timeout()
130 struct device *dev = &pdev->dev; in a21_wdt_probe()
131 struct a21_wdt_drv *drv; in a21_wdt_probe() local
137 drv = devm_kzalloc(dev, sizeof(struct a21_wdt_drv), GFP_KERNEL); in a21_wdt_probe()
138 if (!drv) in a21_wdt_probe()
139 return -ENOMEM; in a21_wdt_probe()
145 return -ENODEV; in a21_wdt_probe()
156 drv->gpios[i] = devm_gpiod_get_index(dev, NULL, i, gflags); in a21_wdt_probe()
157 if (IS_ERR(drv->gpios[i])) in a21_wdt_probe()
158 return PTR_ERR(drv->gpios[i]); in a21_wdt_probe()
160 gpiod_set_consumer_name(drv->gpios[i], "MEN A21 Watchdog"); in a21_wdt_probe()
169 val = gpiod_get_value(drv->gpios[i]); in a21_wdt_probe()
170 gpiod_direction_output(drv->gpios[i], val); in a21_wdt_probe()
176 watchdog_set_drvdata(&a21_wdt, drv); in a21_wdt_probe()
179 reset = a21_wdt_get_bootstatus(drv); in a21_wdt_probe()
180 if (reset == 2) in a21_wdt_probe()
189 drv->wdt = a21_wdt; in a21_wdt_probe()
190 dev_set_drvdata(dev, drv); in a21_wdt_probe()
203 struct a21_wdt_drv *drv = dev_get_drvdata(&pdev->dev); in a21_wdt_shutdown() local
205 gpiod_set_value(drv->gpios[GPIO_WD_ENAB], 0); in a21_wdt_shutdown()
209 { .compatible = "men,a021-wdt" },
218 .name = "a21-watchdog",
228 MODULE_ALIAS("platform:a21-watchdog");