[WATCHDOG] pcwd_usb.c - get heartbeat from dip switches

2007-02-13 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f3dc07330c3e43a8d365eaa74693e320e6ed79d9
Commit: f3dc07330c3e43a8d365eaa74693e320e6ed79d9
Parent: f9146f26da9a4336e02e35bf20222dcb2ee62c7f
Author: Wim Van Sebroeck <[EMAIL PROTECTED]>
AuthorDate: Tue Jan 9 22:43:49 2007 +0100
Committer:  Wim Van Sebroeck <[EMAIL PROTECTED]>
CommitDate: Tue Jan 9 22:43:49 2007 +0100

    [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 <[EMAIL PROTECTED]>
---
 drivers/char/watchdog/pcwd.c |   24 
 1 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/drivers/char/watchdog/pcwd.c b/drivers/char/watchdog/pcwd.c
index 8251d83..aab6621 100644
--- a/drivers/char/watchdog/pcwd.c
+++ b/drivers/char/watchdog/pcwd.c
@@ -70,8 +70,8 @@
 #include /* For inb/outb/... */
 
 /* Module and version information */
-#define WATCHDOG_VERSION "1.17"
-#define WATCHDOG_DATE "12 Feb 2006"
+#define WATCHDOG_VERSION "1.18"
+#define WATCHDOG_DATE "06 Jan 2007"
 #define WATCHDOG_DRIVER_NAME "ISA-PC Watchdog"
 #define WATCHDOG_NAME "pcwd"
 #define PFX WATCHDOG_NAME ": "
@@ -132,6 +132,18 @@
 #define CMD_ISA_DELAY_TIME_8SECS   0x0C
 #define CMD_ISA_RESET_RELAYS   0x0D
 
+/* Watchdog's Dip Switch heartbeat values */
+static const int heartbeat_tbl [] = {
+   20, /* OFF-OFF-OFF  = 20 Sec  */
+   40, /* OFF-OFF-ON   = 40 Sec  */
+   60, /* OFF-ON-OFF   =  1 Min  */
+   300,/* OFF-ON-ON=  5 Min  */
+   600,/* ON-OFF-OFF   = 10 Min  */
+   1800,   /* ON-OFF-ON= 30 Min  */
+   3600,   /* ON-ON-OFF=  1 Hour */
+   7200,   /* ON-ON-ON =  2 hour */
+};
+
 /*
  * We are using an kernel timer to do the pinging of the watchdog
  * every ~500ms. We try to set the internal heartbeat of the
@@ -167,10 +179,10 @@ static int debug = QUIET;
 module_param(debug, int, 0);
 MODULE_PARM_DESC(debug, "Debug level: 0=Quiet, 1=Verbose, 2=Debug 
(default=0)");
 
-#define WATCHDOG_HEARTBEAT 60  /* 60 sec default heartbeat */
+#define WATCHDOG_HEARTBEAT 0   /* default heartbeat = delay-time from 
dip-switches */
 static int heartbeat = WATCHDOG_HEARTBEAT;
 module_param(heartbeat, int, 0);
-MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. 
(2<=heartbeat<=7200, default=" __MODULE_STRING(WATCHDOG_HEARTBEAT) ")");
+MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. 
(2<=heartbeat<=7200 or 0=delay-time from dip-switches, default=" 
__MODULE_STRING(WATCHDOG_HEARTBEAT) ")");
 
 static int nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, int, 0);
@@ -844,6 +856,10 @@ static int __devinit pcwatchdog_init(int base_addr)
/* Show info about the card itself */
pcwd_show_card_info();
 
+   /* If heartbeat = 0 then we use the heartbeat from the dip-switches */
+   if (heartbeat == 0)
+   heartbeat = heartbeat_tbl[(pcwd_get_option_switches() & 0x07)];
+
/* Check that the heartbeat value is within it's range ; if not reset 
to the default */
if (pcwd_set_heartbeat(heartbeat)) {
pcwd_set_heartbeat(WATCHDOG_HEARTBEAT);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[WATCHDOG] pcwd_usb.c - get heartbeat from dip switches

2007-02-13 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2ef473de1ee62eb31b6b98885562cdb4389b01dc
Commit: 2ef473de1ee62eb31b6b98885562cdb4389b01dc
Parent: d26d90967de9d51c08d5821e362cb2245f83c1a8
Author: Wim Van Sebroeck <[EMAIL PROTECTED]>
AuthorDate: Mon Jan 8 22:45:30 2007 +0100
Committer:  Wim Van Sebroeck <[EMAIL PROTECTED]>
CommitDate: Mon Jan 8 22:45:30 2007 +0100

    [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 <[EMAIL PROTECTED]>
---
 drivers/char/watchdog/pcwd_usb.c |   26 +-
 1 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/drivers/char/watchdog/pcwd_usb.c b/drivers/char/watchdog/pcwd_usb.c
index e5c2206..1ad1f22 100644
--- a/drivers/char/watchdog/pcwd_usb.c
+++ b/drivers/char/watchdog/pcwd_usb.c
@@ -1,7 +1,7 @@
 /*
  * Berkshire USB-PC Watchdog Card Driver
  *
- * (c) Copyright 2004 Wim Van Sebroeck <[EMAIL PROTECTED]>.
+ * (c) Copyright 2004-2007 Wim Van Sebroeck <[EMAIL PROTECTED]>.
  *
  * Based on source code of the following authors:
  *   Ken Hollis <[EMAIL PROTECTED]>,
@@ -56,8 +56,8 @@
 
 
 /* Module and Version Information */
-#define DRIVER_VERSION "1.01"
-#define DRIVER_DATE "15 Mar 2005"
+#define DRIVER_VERSION "1.02"
+#define DRIVER_DATE "06 Jan 2007"
 #define DRIVER_AUTHOR "Wim Van Sebroeck <[EMAIL PROTECTED]>"
 #define DRIVER_DESC "Berkshire USB-PC Watchdog driver"
 #define DRIVER_LICENSE "GPL"
@@ -74,10 +74,10 @@ MODULE_ALIAS_MISCDEV(TEMP_MINOR);
 module_param(debug, int, 0);
 MODULE_PARM_DESC(debug, "Debug enabled or not");
 
-#define WATCHDOG_HEARTBEAT 2   /* 2 sec default heartbeat */
+#define WATCHDOG_HEARTBEAT 0   /* default heartbeat = delay-time from 
dip-switches */
 static int heartbeat = WATCHDOG_HEARTBEAT;
 module_param(heartbeat, int, 0);
-MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. 
(0http://vger.kernel.org/majordomo-info.html