15 #include <linux/module.h>
19 #include <linux/time.h>
20 #include <linux/watchdog.h>
21 #include <linux/types.h>
22 #include <linux/kernel.h>
28 #define DA9052_DEF_TIMEOUT 4
29 #define DA9052_TWDMIN 256
41 } da9052_wdt_maps[] = {
54 static void da9052_wdt_release_resources(
struct kref *
r)
76 dev_err(da9052->
dev,
"Failed to disable watchdog bit, %d\n",
88 for (i = 0; i <
ARRAY_SIZE(da9052_wdt_maps); i++)
89 if (da9052_wdt_maps[i].
time == timeout)
100 "Failed to update timescale bit, %d\n", ret);
115 kref_get(&driver_data->
kref);
122 kref_put(&driver_data->
kref, da9052_wdt_release_resources);
127 return da9052_wdt_set_timeout(wdt_dev, wdt_dev->
timeout);
132 return da9052_wdt_set_timeout(wdt_dev, 0);
138 struct da9052 *da9052 = driver_data->
da9052;
146 msec = (jnow - driver_data->
jpast) * 1000/
HZ;
168 .identity =
"DA9052 Watchdog",
173 .start = da9052_wdt_start,
174 .stop = da9052_wdt_stop,
175 .ping = da9052_wdt_ping,
176 .set_timeout = da9052_wdt_set_timeout,
177 .ref = da9052_wdt_ref,
178 .unref = da9052_wdt_unref,
192 dev_err(da9052->
dev,
"Unable to alloacate watchdog device\n");
196 driver_data->
da9052 = da9052;
198 da9052_wdt = &driver_data->
wdt;
201 da9052_wdt->
info = &da9052_wdt_info;
202 da9052_wdt->
ops = &da9052_wdt_ops;
203 watchdog_set_drvdata(da9052_wdt, driver_data);
205 kref_init(&driver_data->
kref);
210 dev_err(&pdev->
dev,
"Failed to disable watchdog bits, %d\n",
217 dev_err(da9052->
dev,
"watchdog_register_device() failed: %d\n",
232 kref_put(&driver_data->
kref, da9052_wdt_release_resources);
238 .probe = da9052_wdt_probe,
241 .name =
"da9052-watchdog",