static int __init mpcore_wdt_init(void) { if (mpcore_wdt_set_heartbeat(mpcore_margin)) { mpcore_wdt_set_heartbeat(TIMER_MARGIN); printk(KERN_INFO "mpcore_margin value must be 0 < mpcore_margin < 65536, using %d\n", TIMER_MARGIN); } printk(banner, mpcore_noboot, mpcore_margin, nowayout); return platform_driver_register(&mpcore_wdt_driver); }
static int __init mpcore_wdt_init(void) { /* * Check that the margin value is within it's range; * if not reset to the default */ if (mpcore_wdt_set_heartbeat(mpcore_margin)) { mpcore_wdt_set_heartbeat(TIMER_MARGIN); printk(KERN_INFO "mpcore_margin value must be 0<mpcore_margin<65536, using %d\n", TIMER_MARGIN); } printk(banner, mpcore_noboot, mpcore_margin, nowayout); return platform_driver_register(&mpcore_wdt_driver); }
int mpcore_wk_wdt_config(int reserved, int reserved2, int timeout_val) { //mpcore_wdt_print("enter:type:%d, mode:%d, val:%d\n", type, mode, timeout_val); // printk("mpcore_wk_wdt_config: val=%d\n", timeout_val); mpcore_wdt_set_heartbeat(timeout_val); return 0; }
static int mtk_wk_wdt_config(enum ext_wdt_mode mode, int timeout_val) { mtk_wdt_mode_config(TRUE, TRUE, TRUE, FALSE, TRUE); mtk_wdt_set_time_out_value(timeout_val); #ifdef CONFIG_LOCAL_WDT mpcore_wk_wdt_config(0,mode,timeout_val); mpcore_wdt_set_heartbeat(timeout_val - 5);//local 25s time out #endif return 0; }
static int mpcore_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { struct mpcore_wdt *wdt = file->private_data; int ret; union { struct watchdog_info ident; int i; } uarg; if (_IOC_DIR(cmd) && _IOC_SIZE(cmd) > sizeof(uarg)) return -ENOIOCTLCMD; if (_IOC_DIR(cmd) & _IOC_WRITE) { ret = copy_from_user(&uarg, (void __user *)arg, _IOC_SIZE(cmd)); if (ret) return -EFAULT; } switch (cmd) { case WDIOC_GETSUPPORT: uarg.ident = ident; ret = 0; break; case WDIOC_SETOPTIONS: ret = -EINVAL; if (uarg.i & WDIOS_DISABLECARD) { mpcore_wdt_stop(wdt); ret = 0; } if (uarg.i & WDIOS_ENABLECARD) { mpcore_wdt_start(wdt); ret = 0; } break; case WDIOC_GETSTATUS: case WDIOC_GETBOOTSTATUS: uarg.i = 0; ret = 0; break; case WDIOC_KEEPALIVE: mpcore_wdt_keepalive(wdt); ret = 0; break; case WDIOC_SETTIMEOUT: ret = mpcore_wdt_set_heartbeat(uarg.i); if (ret) break; mpcore_wdt_keepalive(wdt); /* Fall */ case WDIOC_GETTIMEOUT: uarg.i = mpcore_margin; ret = 0; break; default: return -ENOIOCTLCMD; } if (ret == 0 && _IOC_DIR(cmd) & _IOC_READ) { ret = copy_to_user((void __user *)arg, &uarg, _IOC_SIZE(cmd)); if (ret) ret = -EFAULT; } return ret; }