Lines Matching refs:watchdog
155 static struct watchdog_data watchdog = { variable
156 .lock = __MUTEX_INITIALIZER(watchdog.lock),
229 mutex_lock(&watchdog.lock); in watchdog_set_timeout()
231 watchdog.timeout = timeout; in watchdog_set_timeout()
233 watchdog.timer_val = DIV_ROUND_UP(timeout, 60); in watchdog_set_timeout()
234 watchdog.minutes_mode = true; in watchdog_set_timeout()
236 watchdog.timer_val = timeout; in watchdog_set_timeout()
237 watchdog.minutes_mode = false; in watchdog_set_timeout()
240 mutex_unlock(&watchdog.lock); in watchdog_set_timeout()
250 if (watchdog.type == f71868) { in watchdog_set_pulse_width()
256 mutex_lock(&watchdog.lock); in watchdog_set_pulse_width()
259 watchdog.pulse_val = 0; in watchdog_set_pulse_width()
261 watchdog.pulse_val = 1; in watchdog_set_pulse_width()
263 watchdog.pulse_val = 2; in watchdog_set_pulse_width()
265 watchdog.pulse_val = 3; in watchdog_set_pulse_width()
272 watchdog.pulse_mode = pw; in watchdog_set_pulse_width()
275 mutex_unlock(&watchdog.lock); in watchdog_set_pulse_width()
283 mutex_lock(&watchdog.lock); in watchdog_keepalive()
284 err = superio_enter(watchdog.sioaddr); in watchdog_keepalive()
287 superio_select(watchdog.sioaddr, SIO_F71808FG_LD_WDT); in watchdog_keepalive()
289 if (watchdog.minutes_mode) in watchdog_keepalive()
291 superio_set_bit(watchdog.sioaddr, F71808FG_REG_WDT_CONF, in watchdog_keepalive()
295 superio_clear_bit(watchdog.sioaddr, F71808FG_REG_WDT_CONF, in watchdog_keepalive()
299 superio_outb(watchdog.sioaddr, F71808FG_REG_WD_TIME, in watchdog_keepalive()
300 watchdog.timer_val); in watchdog_keepalive()
302 superio_exit(watchdog.sioaddr); in watchdog_keepalive()
305 mutex_unlock(&watchdog.lock); in watchdog_keepalive()
319 mutex_lock(&watchdog.lock); in watchdog_start()
320 err = superio_enter(watchdog.sioaddr); in watchdog_start()
323 superio_select(watchdog.sioaddr, SIO_F71808FG_LD_WDT); in watchdog_start()
326 switch (watchdog.type) { in watchdog_start()
329 superio_clear_bit(watchdog.sioaddr, SIO_REG_MFUNCT2, 3); in watchdog_start()
330 superio_clear_bit(watchdog.sioaddr, SIO_REG_MFUNCT3, 3); in watchdog_start()
336 superio_clear_bit(watchdog.sioaddr, SIO_REG_ROM_ADDR_SEL, 6); in watchdog_start()
337 superio_set_bit(watchdog.sioaddr, SIO_REG_MFUNCT3, 4); in watchdog_start()
339 superio_set_bit(watchdog.sioaddr, SIO_REG_MFUNCT1, 1); in watchdog_start()
346 superio_clear_bit(watchdog.sioaddr, SIO_REG_MFUNCT1, 4); in watchdog_start()
351 superio_set_bit(watchdog.sioaddr, SIO_REG_MFUNCT1, 1); in watchdog_start()
356 superio_outb(watchdog.sioaddr, SIO_REG_MFUNCT3, in watchdog_start()
357 superio_inb(watchdog.sioaddr, SIO_REG_MFUNCT3) & 0xcf); in watchdog_start()
362 superio_clear_bit(watchdog.sioaddr, SIO_REG_CLOCK_SEL, 3); in watchdog_start()
364 superio_outb(watchdog.sioaddr, SIO_REG_TSI_LEVEL_SEL, 0x5f & in watchdog_start()
365 superio_inb(watchdog.sioaddr, SIO_REG_TSI_LEVEL_SEL)); in watchdog_start()
370 superio_clear_bit(watchdog.sioaddr, SIO_REG_MFUNCT3, 5); in watchdog_start()
380 tmp = superio_inb(watchdog.sioaddr, SIO_F81866_REG_PORT_SEL); in watchdog_start()
383 superio_outb(watchdog.sioaddr, SIO_F81866_REG_PORT_SEL, tmp); in watchdog_start()
385 superio_clear_bit(watchdog.sioaddr, SIO_F81866_REG_GPIO1, 5); in watchdog_start()
397 superio_select(watchdog.sioaddr, SIO_F71808FG_LD_WDT); in watchdog_start()
398 superio_set_bit(watchdog.sioaddr, SIO_REG_ENABLE, 0); in watchdog_start()
400 if (watchdog.type == f81865 || watchdog.type == f81866) in watchdog_start()
401 superio_set_bit(watchdog.sioaddr, F81865_REG_WDO_CONF, in watchdog_start()
404 superio_set_bit(watchdog.sioaddr, F71808FG_REG_WDO_CONF, in watchdog_start()
407 superio_set_bit(watchdog.sioaddr, F71808FG_REG_WDT_CONF, in watchdog_start()
410 if (watchdog.pulse_mode) { in watchdog_start()
412 u8 wdt_conf = superio_inb(watchdog.sioaddr, in watchdog_start()
416 wdt_conf = (wdt_conf & 0xfc) | (watchdog.pulse_val & 0x03); in watchdog_start()
420 superio_outb(watchdog.sioaddr, F71808FG_REG_WDT_CONF, in watchdog_start()
424 superio_clear_bit(watchdog.sioaddr, F71808FG_REG_WDT_CONF, in watchdog_start()
429 superio_exit(watchdog.sioaddr); in watchdog_start()
431 mutex_unlock(&watchdog.lock); in watchdog_start()
440 mutex_lock(&watchdog.lock); in watchdog_stop()
441 err = superio_enter(watchdog.sioaddr); in watchdog_stop()
444 superio_select(watchdog.sioaddr, SIO_F71808FG_LD_WDT); in watchdog_stop()
446 superio_clear_bit(watchdog.sioaddr, F71808FG_REG_WDT_CONF, in watchdog_stop()
449 superio_exit(watchdog.sioaddr); in watchdog_stop()
452 mutex_unlock(&watchdog.lock); in watchdog_stop()
461 mutex_lock(&watchdog.lock); in watchdog_get_status()
462 status = (watchdog.caused_reboot) ? WDIOF_CARDRESET : 0; in watchdog_get_status()
463 mutex_unlock(&watchdog.lock); in watchdog_get_status()
476 mutex_lock(&watchdog.lock); in watchdog_is_running()
477 if (superio_enter(watchdog.sioaddr)) in watchdog_is_running()
479 superio_select(watchdog.sioaddr, SIO_F71808FG_LD_WDT); in watchdog_is_running()
481 is_running = (superio_inb(watchdog.sioaddr, SIO_REG_ENABLE) & BIT(0)) in watchdog_is_running()
482 && (superio_inb(watchdog.sioaddr, F71808FG_REG_WDT_CONF) in watchdog_is_running()
485 superio_exit(watchdog.sioaddr); in watchdog_is_running()
488 mutex_unlock(&watchdog.lock); in watchdog_is_running()
499 if (test_and_set_bit(0, &watchdog.opened)) in watchdog_open()
504 clear_bit(0, &watchdog.opened); in watchdog_open()
511 watchdog.expect_close = 0; in watchdog_open()
517 clear_bit(0, &watchdog.opened); in watchdog_release()
519 if (!watchdog.expect_close) { in watchdog_release()
558 mutex_lock(&watchdog.lock); in watchdog_write()
559 watchdog.expect_close = expect_close; in watchdog_write()
560 mutex_unlock(&watchdog.lock); in watchdog_write()
594 return copy_to_user(uarg.ident, &watchdog.ident, in watchdog_ioctl()
595 sizeof(watchdog.ident)) ? -EFAULT : 0; in watchdog_ioctl()
632 return put_user(watchdog.timeout, uarg.i); in watchdog_ioctl()
675 watchdog.sioaddr = sioaddr; in watchdog_init()
676 watchdog.ident.options = WDIOF_MAGICCLOSE in watchdog_init()
680 snprintf(watchdog.ident.identity, in watchdog_init()
681 sizeof(watchdog.ident.identity), "%s watchdog", in watchdog_init()
682 f71808e_names[watchdog.type]); in watchdog_init()
687 superio_select(watchdog.sioaddr, SIO_F71808FG_LD_WDT); in watchdog_init()
690 watchdog.caused_reboot = wdt_conf & BIT(F71808FG_FLAG_WDTMOUT_STS); in watchdog_init()
733 mutex_lock(&watchdog.lock); in watchdog_init()
737 superio_select(watchdog.sioaddr, SIO_F71808FG_LD_WDT); in watchdog_init()
754 mutex_unlock(&watchdog.lock); in watchdog_init()
766 mutex_unlock(&watchdog.lock); in watchdog_init()
792 watchdog.type = f71808fg; in f71808e_find()
795 watchdog.type = f71862fg; in f71808e_find()
798 watchdog.type = f71868; in f71808e_find()
802 watchdog.type = f71869; in f71808e_find()
805 watchdog.type = f71882fg; in f71808e_find()
808 watchdog.type = f71889fg; in f71808e_find()
815 watchdog.type = f81803; in f71808e_find()
818 watchdog.type = f81865; in f71808e_find()
821 watchdog.type = f81866; in f71808e_find()
831 f71808e_names[watchdog.type], in f71808e_find()