55 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
58 #include <linux/module.h>
60 #include <linux/types.h>
61 #include <linux/errno.h>
62 #include <linux/kernel.h>
65 #include <linux/watchdog.h>
74 #define DRV_NAME "acquirewdt"
75 #define WATCHDOG_NAME "Acquire WDT"
77 #define WATCHDOG_HEARTBEAT 0
82 static unsigned long acq_is_open;
83 static char expect_close;
87 static int wdt_stop = 0x43;
92 static int wdt_start = 0x443;
99 "Watchdog cannot be stopped once started (default="
106 static void acq_keepalive(
void)
112 static void acq_stop(
void)
123 size_t count, loff_t *ppos)
134 for (i = 0; i !=
count; i++) {
149 static long acq_ioctl(
struct file *file,
unsigned int cmd,
unsigned long arg)
156 .firmware_version = 1,
194 static int acq_open(
struct inode *
inode,
struct file *file)
207 static int acq_close(
struct inode *inode,
struct file *file)
209 if (expect_close == 42) {
212 pr_crit(
"Unexpected close, not stopping watchdog!\n");
228 .unlocked_ioctl = acq_ioctl,
230 .release = acq_close,
247 if (wdt_stop != wdt_start) {
249 pr_err(
"I/O address 0x%04x already in use\n", wdt_stop);
256 pr_err(
"I/O address 0x%04x already in use\n", wdt_start);
262 pr_err(
"cannot register miscdev on minor=%d (err=%d)\n",
266 pr_info(
"initialized. (nowayout=%d)\n", nowayout);
272 if (wdt_stop != wdt_start)
282 if (wdt_stop != wdt_start)
297 .shutdown = acq_shutdown,
304 static int __init acq_init(
void)
308 pr_info(
"WDT driver for Acquire single board computer initialising\n");
314 acq_platform_device = platform_device_register_simple(
DRV_NAME,
316 if (IS_ERR(acq_platform_device)) {
317 err = PTR_ERR(acq_platform_device);
318 goto unreg_platform_driver;
322 unreg_platform_driver:
327 static void __exit acq_exit(
void)
331 pr_info(
"Watchdog Module Unloaded\n");