Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e223f01a authored by Wim Van Sebroeck's avatar Wim Van Sebroeck
Browse files

[WATCHDOG] w83697hf/hg WDT driver - autodetect patch



Change the autodetect code so that it is more generic.

Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
parent 3fdee8db
Loading
Loading
Loading
Loading
+17 −15
Original line number Original line Diff line number Diff line
@@ -369,33 +369,35 @@ w83697hf_check_wdt(void)
	return -EIO;
	return -EIO;
}
}


static int w83697hf_ioports[] = { 0x2e, 0x4e, 0x00 };

static int __init
static int __init
wdt_init(void)
wdt_init(void)
{
{
	int ret, autodetect;
	int ret, i, found = 0;


	spin_lock_init(&io_lock);
	spin_lock_init(&io_lock);


	printk (KERN_INFO PFX "WDT driver for W83697HF/HG initializing\n");
	printk (KERN_INFO PFX "WDT driver for W83697HF/HG initializing\n");


	autodetect = wdt_io == 0;
	if (wdt_io == 0) {
	if (autodetect)
		/* we will autodetect the W83697HF/HG watchdog */
		wdt_io = 0x2e;
		for (i = 0; ((!found) && (w83697hf_ioports[i] != 0)); i++) {

			wdt_io = w83697hf_ioports[i];
			if (!w83697hf_check_wdt())
			if (!w83697hf_check_wdt())
		goto found;
				found++;

		}
	if (autodetect) {
	} else {
		wdt_io = 0x4e;
		if (!w83697hf_check_wdt())
		if (!w83697hf_check_wdt())
			goto found;
			found++;
	}
	}


	if (!found) {
		printk (KERN_ERR PFX "No W83697HF/HG could be found\n");
		printk (KERN_ERR PFX "No W83697HF/HG could be found\n");
		ret = -EIO;
		ret = -EIO;
		goto out;
		goto out;
	}


found:
	w83697hf_init();
	w83697hf_init();
	wdt_disable();	/* Disable watchdog until first use */
	wdt_disable();	/* Disable watchdog until first use */