Hi Rudolf,
> I wanted to create a watchdog driver for I2C W83792D chip and I realized
> that there is no clean way how to connect the existing I2C device driver
> with the watchdog ops. As the consequence of this I created new watchdog
> device class.
>
> This class supports all common infrastructure such as char device handling,
> sysfs exports and even the infrastructure for too fast watchdogs
> (the self ping feature). The class is based on the RTC class which
> is fairly similar in some aspects.
>
> The char device of watchdog class is compatible with existing watchdog API,
> so no need to change the user applications. There is just one exception
> and this is temperature handling. I belive it should be implemented not
> via IOCTL but using the HWMON class. (100% compatibility can be restored
> with the ioctl class op)
>
> I have defined this class ops so far:
>
> struct watchdog_class_ops {
> int (*enable)(struct device *);
> int (*disable)(struct device *);
> int (*ping)(struct device *);
> int (*set_timeout)(struct device *, int sec);
> int (*notify_reboot)(struct notifier_block *this, unsigned long code,
> void *unused);
I was doing some stuff for the ICH6 & ICH7 I/O chipsets first and was then
planning to resume working on my generic watchdog code again. (It used to be
stored in a bitkeeper tree, but I didn't convert it to a git tree yet).
I'll make sure that the code get's stored in the linux-2.6-watchdog-experimental
git tree in the coming days.
But basically this is what we need for watchdog devices:
---------------------------------------------------------------------------
struct watchdog_ops;
struct watchdog_device;
struct watchdog_ops {
/* mandatory routines */
int (*start)(struct watchdog_device *); /* operation = start watchdog */
int (*stop)(struct watchdog_device *); /* operation = stop watchdog */
int (*keepalive)(struct watchdog_device *); /* operation = send keepalive ping */
/* optional routines */
int (*set_heartbeat)(struct watchdog_device *,int); /* operation = set watchdog's heartbeat */
int (*get_status)(struct watchdog_device *,int *); /* operation = get the watchdog's status */
int (*get_temperature)(struct watchdog_device *, int *); /* operation = get the temperature in °F */
int (*get_timervalue)(struct watchdog_device *, int *); /* operation = get the current timer value */
int (*sys_restart)(struct watchdog_device *); /* operation = force a system_restart for rebooting */
};
struct watchdog_device {
unsigned char name[32]; /* The watchdog's 'identity' */
unsigned long options; /* The supported capabilities/options */
unsigned long firmware; /* The watchdog's Firmware version */
int heartbeat; /* The watchdog's heartbeat */
int nowayout; /* The nowayout setting for this watchdog */
int bootstatus; /* The watchdog's bootstatus */
int temppanic; /* wether or not to panic on temperature trip's */
struct watchdog_ops *watchdog_ops; /* link to watchdog_ops */
/* watchdog status state machine */
enum { WATCHDOG_UNINITIALIZED=0,
WATCHDOG_INITIALIZED,
WATCHDOG_STARTED,
WATCHDOG_STOPPED,
WATCHDOG_UNREGISTERED,
} watchdog_state;
struct semaphore sem; /* locks this structure */
/* From here on everything is device dependent */
void *private;
};
/* drivers/watchdog/watchdog.c */
extern struct watchdog_device *alloc_watchdogdev(void);
extern int free_watchdogdev(struct watchdog_device *dev);
extern int register_watchdogdevice(struct watchdog_device *dev);
extern int unregister_watchdogdevice(struct watchdog_device *dev);
---------------------------------------------------------------------------
you don't need an operation for the notify_reboot. This is only necessary to
make sure that you either stop the watchdog or force it to reboot (because
the hardware isn't capable of rebooting itself. See the cobalt server)).
The notify reboot is not a watchdog operation, it's for making sure that when
you shutdown/reboot everything runs smoothly.
Greetings,
Wim.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]