Kernel->watchdog: add ioctl of watchdog control for user space
This commit is contained in:
@ -213,7 +213,7 @@
|
||||
rockchip,timeout = <60>;
|
||||
rockchip,atboot = <1>;
|
||||
rockchip,debug = <0>;
|
||||
status = "disabled";
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
amba {
|
||||
|
||||
@ -625,4 +625,5 @@ CONFIG_LSM_MMAP_MIN_ADDR=4096
|
||||
CONFIG_SECURITY_SELINUX=y
|
||||
CONFIG_CRYPTO_NULL=y
|
||||
CONFIG_CRYPTO_TWOFISH=y
|
||||
CONFIG_WATCHDOG=y
|
||||
# CONFIG_CRYPTO_ANSI_CPRNG is not set
|
||||
|
||||
@ -70,6 +70,8 @@
|
||||
#define RK29_WDT_44728320US 14
|
||||
#define RK29_WDT_89456640US 15
|
||||
|
||||
#define WDIOC_APP_WDT_CTL 100
|
||||
|
||||
/*
|
||||
#define CONFIG_RK29_WATCHDOG_ATBOOT (1)
|
||||
#define CONFIG_RK29_WATCHDOG_DEFAULT_TIME 10 //unit second
|
||||
@ -117,6 +119,7 @@ static struct resource *wdt_irq;
|
||||
static struct clk *wdt_clock;
|
||||
static void __iomem *wdt_base;
|
||||
static char expect_close;
|
||||
static bool app_ctl_wdt_status = false;
|
||||
|
||||
|
||||
/* watchdog control routines */
|
||||
@ -211,7 +214,7 @@ static int rk29_wdt_open(struct inode *inode, struct file *file)
|
||||
expect_close = 0;
|
||||
|
||||
/* start the timer */
|
||||
rk29_wdt_start();
|
||||
//rk29_wdt_start();
|
||||
return nonseekable_open(inode, file);
|
||||
}
|
||||
|
||||
@ -297,6 +300,20 @@ static long rk29_wdt_ioctl(struct file *file, unsigned int cmd,
|
||||
return put_user(tmr_margin, p);
|
||||
case WDIOC_GETTIMEOUT:
|
||||
return put_user(tmr_margin, p);
|
||||
|
||||
case WDIOC_APP_WDT_CTL:
|
||||
if((int*)arg)
|
||||
{
|
||||
app_ctl_wdt_status = true;
|
||||
rk29_wdt_start();
|
||||
}
|
||||
else
|
||||
{
|
||||
app_ctl_wdt_status = false;
|
||||
rk29_wdt_stop();
|
||||
}
|
||||
return 0;
|
||||
|
||||
default:
|
||||
return -ENOTTY;
|
||||
}
|
||||
@ -327,7 +344,11 @@ static struct miscdevice rk29_wdt_miscdev = {
|
||||
static irqreturn_t rk29_wdt_irq_handler(int irqno, void *param)
|
||||
{
|
||||
DBG("RK29_wdt:watchdog timer expired (irq)\n");
|
||||
rk29_wdt_keepalive();
|
||||
//printk("\r\nrk29_wdt_irq_handler\r\n");
|
||||
if(false == app_ctl_wdt_status)
|
||||
{
|
||||
rk29_wdt_keepalive();
|
||||
}
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
@ -409,6 +430,7 @@ static int rk29_wdt_probe(struct platform_device *pdev)
|
||||
WATCHDOG_MINOR, ret);
|
||||
goto err_irq;
|
||||
}
|
||||
#if 0
|
||||
if (tmr_atboot && started == 0) {
|
||||
dev_info(dev, "starting watchdog timer\n");
|
||||
rk29_wdt_start();
|
||||
@ -419,6 +441,7 @@ static int rk29_wdt_probe(struct platform_device *pdev)
|
||||
|
||||
rk29_wdt_stop();
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
err_irq:
|
||||
|
||||
Reference in New Issue
Block a user