Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-wat…
Browse files Browse the repository at this point in the history
…chdog

* git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog:
  [WATCHDOG] Add support for the WM8350 watchdog
  [WATCHDOG] Add SMSC SCH311x Watchdog Timer.
  [WATCHDOG] ib700wdt - add timeout parameter
  • Loading branch information
Linus Torvalds committed Jan 3, 2009
2 parents 61420f5 + 006948b commit ad6b646
Show file tree
Hide file tree
Showing 5 changed files with 947 additions and 30 deletions.
19 changes: 19 additions & 0 deletions drivers/watchdog/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ config SOFT_WATCHDOG
To compile this driver as a module, choose M here: the
module will be called softdog.

config WM8350_WATCHDOG
tristate "WM8350 watchdog"
depends on MFD_WM8350
help
Support for the watchdog in the WM8350 AudioPlus PMIC. When
the watchdog triggers the system will be reset.

# ALPHA Architecture

# ARM Architecture
Expand Down Expand Up @@ -551,6 +558,18 @@ config CPU5_WDT
To compile this driver as a module, choose M here: the
module will be called cpu5wdt.

config SMSC_SCH311X_WDT
tristate "SMSC SCH311X Watchdog Timer"
depends on X86
---help---
This is the driver for the hardware watchdog timer on the
SMSC SCH3112, SCH3114 and SCH3116 Super IO chipset
(LPC IO with 8042 KBC, Reset Generation, HWM and multiple
serial ports).

To compile this driver as a module, choose M here: the
module will be called sch311x_wdt.

config SMSC37B787_WDT
tristate "Winbond SMsC37B787 Watchdog Timer"
depends on X86
Expand Down
2 changes: 2 additions & 0 deletions drivers/watchdog/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ obj-$(CONFIG_60XX_WDT) += sbc60xxwdt.o
obj-$(CONFIG_SBC8360_WDT) += sbc8360.o
obj-$(CONFIG_SBC7240_WDT) += sbc7240_wdt.o
obj-$(CONFIG_CPU5_WDT) += cpu5wdt.o
obj-$(CONFIG_SMSC_SCH311X_WDT) += sch311x_wdt.o
obj-$(CONFIG_SMSC37B787_WDT) += smsc37b787_wdt.o
obj-$(CONFIG_W83627HF_WDT) += w83627hf_wdt.o
obj-$(CONFIG_W83697HF_WDT) += w83697hf_wdt.o
Expand Down Expand Up @@ -133,4 +134,5 @@ obj-$(CONFIG_WATCHDOG_CP1XXX) += cpwd.o
# XTENSA Architecture

# Architecture Independant
obj-$(CONFIG_WM8350_WATCHDOG) += wm8350_wdt.o
obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o
49 changes: 19 additions & 30 deletions drivers/watchdog/ib700wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,32 +91,16 @@ static char expect_close;
*
*/

static int wd_times[] = {
30, /* 0x0 */
28, /* 0x1 */
26, /* 0x2 */
24, /* 0x3 */
22, /* 0x4 */
20, /* 0x5 */
18, /* 0x6 */
16, /* 0x7 */
14, /* 0x8 */
12, /* 0x9 */
10, /* 0xA */
8, /* 0xB */
6, /* 0xC */
4, /* 0xD */
2, /* 0xE */
0, /* 0xF */
};

#define WDT_STOP 0x441
#define WDT_START 0x443

/* Default timeout */
#define WD_TIMO 0 /* 30 seconds +/- 20%, from table */

static int wd_margin = WD_TIMO;
#define WATCHDOG_TIMEOUT 30 /* 30 seconds +/- 20% */
static int timeout = WATCHDOG_TIMEOUT; /* in seconds */
module_param(timeout, int, 0);
MODULE_PARM_DESC(timeout,
"Watchdog timeout in seconds. 0<= timeout <=30, default="
__MODULE_STRING(WATCHDOG_TIMEOUT) ".");

static int nowayout = WATCHDOG_NOWAYOUT;
module_param(nowayout, int, 0);
Expand All @@ -131,6 +115,8 @@ MODULE_PARM_DESC(nowayout,

static void ibwdt_ping(void)
{
int wd_margin = 15 - ((timeout + 1) / 2);

spin_lock(&ibwdt_lock);

/* Write a watchdog value */
Expand All @@ -148,15 +134,10 @@ static void ibwdt_disable(void)

static int ibwdt_set_heartbeat(int t)
{
int i;

if ((t < 0) || (t > 30))
if (t < 0 || t > 30)
return -EINVAL;

for (i = 0x0F; i > -1; i--)
if (wd_times[i] >= t)
break;
wd_margin = i;
timeout = t;
return 0;
}

Expand Down Expand Up @@ -240,7 +221,7 @@ static long ibwdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
/* Fall */

case WDIOC_GETTIMEOUT:
return put_user(wd_times[wd_margin], p);
return put_user(timeout, p);

default:
return -ENOTTY;
Expand Down Expand Up @@ -317,6 +298,14 @@ static int __devinit ibwdt_probe(struct platform_device *dev)
goto out_nostartreg;
}

/* Check that the heartbeat value is within it's range ;
* if not reset to the default */
if (ibwdt_set_heartbeat(timeout)) {
ibwdt_set_heartbeat(WATCHDOG_TIMEOUT);
printk(KERN_INFO PFX
"timeout value must be 0<=x<=30, using %d\n", timeout);
}

res = misc_register(&ibwdt_miscdev);
if (res) {
printk(KERN_ERR PFX "failed to register misc device\n");
Expand Down
Loading

0 comments on commit ad6b646

Please sign in to comment.