aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/watchdog/pcwd.c
diff options
context:
space:
mode:
authorWim Van Sebroeck <wim@iguana.be>2007-01-09 16:43:49 -0500
committerWim Van Sebroeck <wim@iguana.be>2007-01-09 16:43:49 -0500
commitf3dc07330c3e43a8d365eaa74693e320e6ed79d9 (patch)
tree1106ade1fc48be5ee7d4d0b3792e34fbc8ccc465 /drivers/char/watchdog/pcwd.c
parentf9146f26da9a4336e02e35bf20222dcb2ee62c7f (diff)
[WATCHDOG] pcwd_usb.c - get heartbeat from dip switches
The PCWD cards normally use the heartbeat that is set via the dip-switches of the card. There are only 3 switches, thus 8 combinations that each have a certain heartbeat. The card can however be programmed with a heartbeat from 1 till 65535 seconds. This is what our driver does: it programs the heartbeat on the card. There are however a lot of people that don't know that we set the heartbeat of the watchdog card to the value provided by the heartbeat module parameter. Instead they think that the heartbeat value is the same as set by the dip-switches. This patch changes the driver so that at startup you can take the heartbeat from the dip-switches. You do this by setting the heartbeat module parameter to 0. This patch also makes this the default behaviour. Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/char/watchdog/pcwd.c')
-rw-r--r--drivers/char/watchdog/pcwd.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/drivers/char/watchdog/pcwd.c b/drivers/char/watchdog/pcwd.c
index 8251d8378d2e..aab6621817a0 100644
--- a/drivers/char/watchdog/pcwd.c
+++ b/drivers/char/watchdog/pcwd.c
@@ -70,8 +70,8 @@
70#include <asm/io.h> /* For inb/outb/... */ 70#include <asm/io.h> /* For inb/outb/... */
71 71
72/* Module and version information */ 72/* Module and version information */
73#define WATCHDOG_VERSION "1.17" 73#define WATCHDOG_VERSION "1.18"
74#define WATCHDOG_DATE "12 Feb 2006" 74#define WATCHDOG_DATE "06 Jan 2007"
75#define WATCHDOG_DRIVER_NAME "ISA-PC Watchdog" 75#define WATCHDOG_DRIVER_NAME "ISA-PC Watchdog"
76#define WATCHDOG_NAME "pcwd" 76#define WATCHDOG_NAME "pcwd"
77#define PFX WATCHDOG_NAME ": " 77#define PFX WATCHDOG_NAME ": "
@@ -132,6 +132,18 @@
132#define CMD_ISA_DELAY_TIME_8SECS 0x0C 132#define CMD_ISA_DELAY_TIME_8SECS 0x0C
133#define CMD_ISA_RESET_RELAYS 0x0D 133#define CMD_ISA_RESET_RELAYS 0x0D
134 134
135/* Watchdog's Dip Switch heartbeat values */
136static const int heartbeat_tbl [] = {
137 20, /* OFF-OFF-OFF = 20 Sec */
138 40, /* OFF-OFF-ON = 40 Sec */
139 60, /* OFF-ON-OFF = 1 Min */
140 300, /* OFF-ON-ON = 5 Min */
141 600, /* ON-OFF-OFF = 10 Min */
142 1800, /* ON-OFF-ON = 30 Min */
143 3600, /* ON-ON-OFF = 1 Hour */
144 7200, /* ON-ON-ON = 2 hour */
145};
146
135/* 147/*
136 * We are using an kernel timer to do the pinging of the watchdog 148 * We are using an kernel timer to do the pinging of the watchdog
137 * every ~500ms. We try to set the internal heartbeat of the 149 * every ~500ms. We try to set the internal heartbeat of the
@@ -167,10 +179,10 @@ static int debug = QUIET;
167module_param(debug, int, 0); 179module_param(debug, int, 0);
168MODULE_PARM_DESC(debug, "Debug level: 0=Quiet, 1=Verbose, 2=Debug (default=0)"); 180MODULE_PARM_DESC(debug, "Debug level: 0=Quiet, 1=Verbose, 2=Debug (default=0)");
169 181
170#define WATCHDOG_HEARTBEAT 60 /* 60 sec default heartbeat */ 182#define WATCHDOG_HEARTBEAT 0 /* default heartbeat = delay-time from dip-switches */
171static int heartbeat = WATCHDOG_HEARTBEAT; 183static int heartbeat = WATCHDOG_HEARTBEAT;
172module_param(heartbeat, int, 0); 184module_param(heartbeat, int, 0);
173MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (2<=heartbeat<=7200, default=" __MODULE_STRING(WATCHDOG_HEARTBEAT) ")"); 185MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (2<=heartbeat<=7200 or 0=delay-time from dip-switches, default=" __MODULE_STRING(WATCHDOG_HEARTBEAT) ")");
174 186
175static int nowayout = WATCHDOG_NOWAYOUT; 187static int nowayout = WATCHDOG_NOWAYOUT;
176module_param(nowayout, int, 0); 188module_param(nowayout, int, 0);
@@ -844,6 +856,10 @@ static int __devinit pcwatchdog_init(int base_addr)
844 /* Show info about the card itself */ 856 /* Show info about the card itself */
845 pcwd_show_card_info(); 857 pcwd_show_card_info();
846 858
859 /* If heartbeat = 0 then we use the heartbeat from the dip-switches */
860 if (heartbeat == 0)
861 heartbeat = heartbeat_tbl[(pcwd_get_option_switches() & 0x07)];
862
847 /* Check that the heartbeat value is within it's range ; if not reset to the default */ 863 /* Check that the heartbeat value is within it's range ; if not reset to the default */
848 if (pcwd_set_heartbeat(heartbeat)) { 864 if (pcwd_set_heartbeat(heartbeat)) {
849 pcwd_set_heartbeat(WATCHDOG_HEARTBEAT); 865 pcwd_set_heartbeat(WATCHDOG_HEARTBEAT);