Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *	ALi M7101 PMU Computer Watchdog Timer driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *	Based on w83877f_wdt.c by Scott Jennings <linuxdrivers@oro.net>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *	and the Cobalt kernel WDT timer driver by Tim Hockin
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  *	                                      <thockin@cobaltnet.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  *	(c)2002 Steve Hill <steve@navaho.co.uk>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  *  This WDT driver is different from most other Linux WDT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  *  drivers in that the driver will ping the watchdog by itself,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  *  because this particular WDT has a very short timeout (1.6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  *  seconds) and it would be insane to count on any userspace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  *  daemon always getting scheduled within that time frame.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  *  Additions:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  *   Aug 23, 2004 - Added use_gpio module parameter for use on revision a1d PMUs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  *                  found on very old cobalt hardware.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  *                  -- Mike Waychison <michael.waychison@sun.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #include <linux/moduleparam.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #include <linux/timer.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) #include <linux/miscdevice.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #include <linux/watchdog.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) #include <linux/ioport.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #include <linux/notifier.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #include <linux/reboot.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) #include <linux/fs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) #include <linux/pci.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) #include <linux/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) #include <linux/uaccess.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) #define WDT_ENABLE 0x9C
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) #define WDT_DISABLE 0x8C
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) #define ALI_7101_WDT    0x92
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) #define ALI_7101_GPIO   0x7D
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) #define ALI_7101_GPIO_O 0x7E
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) #define ALI_WDT_ARM     0x01
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50)  * We're going to use a 1 second timeout.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51)  * If we reset the watchdog every ~250ms we should be safe.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) #define WDT_INTERVAL (HZ/4+1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56)  * We must not require too good response from the userspace daemon.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57)  * Here we require the userspace daemon to send us a heartbeat
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58)  * char to /dev/watchdog every 30 seconds.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) #define WATCHDOG_TIMEOUT 30            /* 30 sec default timeout */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) /* in seconds, will be multiplied by HZ to get seconds to wait for a ping */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) static int timeout = WATCHDOG_TIMEOUT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) module_param(timeout, int, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) MODULE_PARM_DESC(timeout,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 		"Watchdog timeout in seconds. (1<=timeout<=3600, default="
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 				__MODULE_STRING(WATCHDOG_TIMEOUT) ")");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) static int use_gpio; /* Use the pic (for a1d revision alim7101) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) module_param(use_gpio, int, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) MODULE_PARM_DESC(use_gpio,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 		"Use the gpio watchdog (required by old cobalt boards).");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) static void wdt_timer_ping(struct timer_list *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) static DEFINE_TIMER(timer, wdt_timer_ping);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) static unsigned long next_heartbeat;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) static unsigned long wdt_is_open;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) static char wdt_expect_close;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) static struct pci_dev *alim7101_pmu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) static bool nowayout = WATCHDOG_NOWAYOUT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) module_param(nowayout, bool, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) MODULE_PARM_DESC(nowayout,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 		"Watchdog cannot be stopped once started (default="
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 				__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88)  *	Whack the dog
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) static void wdt_timer_ping(struct timer_list *unused)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	/* If we got a heartbeat pulse within the WDT_US_INTERVAL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	 * we agree to ping the WDT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	char tmp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	if (time_before(jiffies, next_heartbeat)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 		/* Ping the WDT (this is actually a disarm/arm sequence) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 		pci_read_config_byte(alim7101_pmu, 0x92, &tmp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 		pci_write_config_byte(alim7101_pmu,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 					ALI_7101_WDT, (tmp & ~ALI_WDT_ARM));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 		pci_write_config_byte(alim7101_pmu,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 					ALI_7101_WDT, (tmp | ALI_WDT_ARM));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 		if (use_gpio) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 			pci_read_config_byte(alim7101_pmu,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 					ALI_7101_GPIO_O, &tmp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 			pci_write_config_byte(alim7101_pmu,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 					ALI_7101_GPIO_O, tmp | 0x20);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 			pci_write_config_byte(alim7101_pmu,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 					ALI_7101_GPIO_O, tmp & ~0x20);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 		pr_warn("Heartbeat lost! Will not ping the watchdog\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	/* Re-set the timer interval */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	mod_timer(&timer, jiffies + WDT_INTERVAL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)  * Utility routines
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) static void wdt_change(int writeval)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	char tmp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	pci_read_config_byte(alim7101_pmu, ALI_7101_WDT, &tmp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	if (writeval == WDT_ENABLE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 		pci_write_config_byte(alim7101_pmu,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 					ALI_7101_WDT, (tmp | ALI_WDT_ARM));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 		if (use_gpio) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 			pci_read_config_byte(alim7101_pmu,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 					ALI_7101_GPIO_O, &tmp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 			pci_write_config_byte(alim7101_pmu,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 					ALI_7101_GPIO_O, tmp & ~0x20);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 		pci_write_config_byte(alim7101_pmu,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 					ALI_7101_WDT, (tmp & ~ALI_WDT_ARM));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 		if (use_gpio) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 			pci_read_config_byte(alim7101_pmu,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 					ALI_7101_GPIO_O, &tmp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 			pci_write_config_byte(alim7101_pmu,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 					ALI_7101_GPIO_O, tmp | 0x20);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) static void wdt_startup(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	next_heartbeat = jiffies + (timeout * HZ);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	/* We must enable before we kick off the timer in case the timer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	   occurs as we ping it */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	wdt_change(WDT_ENABLE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	/* Start the timer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	mod_timer(&timer, jiffies + WDT_INTERVAL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	pr_info("Watchdog timer is now enabled\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) static void wdt_turnoff(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	/* Stop the timer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	del_timer_sync(&timer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	wdt_change(WDT_DISABLE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	pr_info("Watchdog timer is now disabled...\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) static void wdt_keepalive(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	/* user land ping */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	next_heartbeat = jiffies + (timeout * HZ);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)  * /dev/watchdog handling
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) static ssize_t fop_write(struct file *file, const char __user *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 						size_t count, loff_t *ppos)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	/* See if we got the magic character 'V' and reload the timer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	if (count) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 		if (!nowayout) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 			size_t ofs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 			/* note: just in case someone wrote the magic character
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 			 * five months ago... */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 			wdt_expect_close = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 			/* now scan */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 			for (ofs = 0; ofs != count; ofs++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 				char c;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 				if (get_user(c, buf + ofs))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 					return -EFAULT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 				if (c == 'V')
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 					wdt_expect_close = 42;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 		/* someone wrote to us, we should restart timer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 		wdt_keepalive();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	return count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) static int fop_open(struct inode *inode, struct file *file)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	/* Just in case we're already talking to someone... */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	if (test_and_set_bit(0, &wdt_is_open))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 		return -EBUSY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	/* Good, fire up the show */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	wdt_startup();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	return stream_open(inode, file);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) static int fop_close(struct inode *inode, struct file *file)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	if (wdt_expect_close == 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 		wdt_turnoff();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 		/* wim: shouldn't there be a: del_timer(&timer); */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 		pr_crit("device file closed unexpectedly. Will not stop the WDT!\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	clear_bit(0, &wdt_is_open);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 	wdt_expect_close = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 	void __user *argp = (void __user *)arg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 	int __user *p = argp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 	static const struct watchdog_info ident = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 		.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 							| WDIOF_MAGICCLOSE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 		.firmware_version = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 		.identity = "ALiM7101",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 	switch (cmd) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 	case WDIOC_GETSUPPORT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 		return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 	case WDIOC_GETSTATUS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 	case WDIOC_GETBOOTSTATUS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 		return put_user(0, p);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 	case WDIOC_SETOPTIONS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 		int new_options, retval = -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 		if (get_user(new_options, p))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 			return -EFAULT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 		if (new_options & WDIOS_DISABLECARD) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 			wdt_turnoff();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 			retval = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 		if (new_options & WDIOS_ENABLECARD) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 			wdt_startup();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 			retval = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 		return retval;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 	case WDIOC_KEEPALIVE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 		wdt_keepalive();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 	case WDIOC_SETTIMEOUT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 		int new_timeout;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 		if (get_user(new_timeout, p))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 			return -EFAULT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 		/* arbitrary upper limit */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 		if (new_timeout < 1 || new_timeout > 3600)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 			return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 		timeout = new_timeout;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 		wdt_keepalive();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 		fallthrough;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 	case WDIOC_GETTIMEOUT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 		return put_user(timeout, p);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 		return -ENOTTY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) static const struct file_operations wdt_fops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 	.owner		=	THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 	.llseek		=	no_llseek,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 	.write		=	fop_write,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 	.open		=	fop_open,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 	.release	=	fop_close,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) 	.unlocked_ioctl	=	fop_ioctl,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 	.compat_ioctl	= 	compat_ptr_ioctl,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) static struct miscdevice wdt_miscdev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) 	.minor	=	WATCHDOG_MINOR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) 	.name	=	"watchdog",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) 	.fops	=	&wdt_fops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) static int wdt_restart_handle(struct notifier_block *this, unsigned long mode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) 			      void *cmd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) 	 * Cobalt devices have no way of rebooting themselves other
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) 	 * than getting the watchdog to pull reset, so we restart the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 	 * watchdog on reboot with no heartbeat.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) 	wdt_change(WDT_ENABLE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) 	/* loop until the watchdog fires */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 	while (true)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 		;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) 	return NOTIFY_DONE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) static struct notifier_block wdt_restart_handler = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) 	.notifier_call = wdt_restart_handle,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) 	.priority = 128,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329)  *	Notifier for system down
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) static int wdt_notify_sys(struct notifier_block *this,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) 					unsigned long code, void *unused)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) 	if (code == SYS_DOWN || code == SYS_HALT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 		wdt_turnoff();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) 	return NOTIFY_DONE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342)  *	The WDT needs to learn about soft shutdowns in order to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343)  *	turn the timebomb registers off.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) static struct notifier_block wdt_notifier = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 	.notifier_call = wdt_notify_sys,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) static void __exit alim7101_wdt_unload(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) 	wdt_turnoff();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 	/* Deregister */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) 	misc_deregister(&wdt_miscdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) 	unregister_reboot_notifier(&wdt_notifier);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) 	unregister_restart_handler(&wdt_restart_handler);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) 	pci_dev_put(alim7101_pmu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) static int __init alim7101_wdt_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) 	int rc = -EBUSY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) 	struct pci_dev *ali1543_south;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) 	char tmp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) 	pr_info("Steve Hill <steve@navaho.co.uk>\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) 	alim7101_pmu = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) 		NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) 	if (!alim7101_pmu) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) 		pr_info("ALi M7101 PMU not present - WDT not set\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) 		return -EBUSY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) 	/* Set the WDT in the PMU to 1 second */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) 	pci_write_config_byte(alim7101_pmu, ALI_7101_WDT, 0x02);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) 	ali1543_south = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) 		NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) 	if (!ali1543_south) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) 		pr_info("ALi 1543 South-Bridge not present - WDT not set\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) 		goto err_out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) 	pci_read_config_byte(ali1543_south, 0x5e, &tmp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) 	pci_dev_put(ali1543_south);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) 	if ((tmp & 0x1e) == 0x00) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) 		if (!use_gpio) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) 			pr_info("Detected old alim7101 revision 'a1d'.  If this is a cobalt board, set the 'use_gpio' module parameter.\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) 			goto err_out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) 		nowayout = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) 	} else if ((tmp & 0x1e) != 0x12 && (tmp & 0x1e) != 0x00) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) 		pr_info("ALi 1543 South-Bridge does not have the correct revision number (???1001?) - WDT not set\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) 		goto err_out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) 	if (timeout < 1 || timeout > 3600) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) 		/* arbitrary upper limit */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) 		timeout = WATCHDOG_TIMEOUT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) 		pr_info("timeout value must be 1 <= x <= 3600, using %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) 			timeout);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) 	rc = register_reboot_notifier(&wdt_notifier);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) 	if (rc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) 		pr_err("cannot register reboot notifier (err=%d)\n", rc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) 		goto err_out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) 	rc = register_restart_handler(&wdt_restart_handler);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) 	if (rc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) 		pr_err("cannot register restart handler (err=%d)\n", rc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) 		goto err_out_reboot;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) 	rc = misc_register(&wdt_miscdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) 	if (rc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) 		pr_err("cannot register miscdev on minor=%d (err=%d)\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) 		       wdt_miscdev.minor, rc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) 		goto err_out_restart;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) 	if (nowayout)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) 		__module_get(THIS_MODULE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) 	pr_info("WDT driver for ALi M7101 initialised. timeout=%d sec (nowayout=%d)\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) 		timeout, nowayout);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) err_out_restart:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) 	unregister_restart_handler(&wdt_restart_handler);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) err_out_reboot:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) 	unregister_reboot_notifier(&wdt_notifier);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) err_out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) 	pci_dev_put(alim7101_pmu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) 	return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) module_init(alim7101_wdt_init);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) module_exit(alim7101_wdt_unload);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) static const struct pci_device_id alim7101_pci_tbl[] __used = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) 	{ PCI_DEVICE(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) 	{ PCI_DEVICE(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) 	{ }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) MODULE_DEVICE_TABLE(pci, alim7101_pci_tbl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) MODULE_AUTHOR("Steve Hill");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) MODULE_DESCRIPTION("ALi M7101 PMU Computer Watchdog Timer driver");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) MODULE_LICENSE("GPL");