summaryrefslogtreecommitdiff
path: root/sys/arch/loongson/dev/kb3310.c
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2010-09-09 19:06:16 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2010-09-09 19:06:16 +0000
commit5742ac28801a425a116c672d5377efd438766ca5 (patch)
tree2c397d3e9fdb2ae657827c2ea84c9dd6ad3a5551 /sys/arch/loongson/dev/kb3310.c
parenta3bdd2bdc3a07d0c38d435998255f3a82158d38c (diff)
Sync suspend logic with current practice, and try to handle failure
consistently; discussed with pirofti and deraadt.
Diffstat (limited to 'sys/arch/loongson/dev/kb3310.c')
-rw-r--r--sys/arch/loongson/dev/kb3310.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/sys/arch/loongson/dev/kb3310.c b/sys/arch/loongson/dev/kb3310.c
index a91ed859b38..598a1ace9b7 100644
--- a/sys/arch/loongson/dev/kb3310.c
+++ b/sys/arch/loongson/dev/kb3310.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kb3310.c,v 1.14 2010/09/01 13:10:42 pirofti Exp $ */
+/* $OpenBSD: kb3310.c,v 1.15 2010/09/09 19:06:15 miod Exp $ */
/*
* Copyright (c) 2010 Otto Moerbeek <otto@drijf.net>
*
@@ -445,8 +445,10 @@ ykbec_suspend()
struct ykbec_softc *sc = ykbec_sc;
int ctrl;
- /* enable isa irq 1 and 12 (PS/2 input devices) */
- loongson_set_isa_imr((1 << 1) | (1 << 12));
+ /*
+ * Set up wakeup sources: currently only the internal keyboard.
+ */
+ loongson_set_isa_imr(1 << 1);
/* USB */
DPRINTF(("USB\n"));
@@ -467,9 +469,17 @@ ykbec_suspend()
/* CPU */
DPRINTF(("CPU\n"));
ykbec_chip_config = REGVAL(LOONGSON_CHIP_CONFIG0);
+ enableintr();
REGVAL(LOONGSON_CHIP_CONFIG0) = ykbec_chip_config & ~0x7;
(void)REGVAL(LOONGSON_CHIP_CONFIG0);
+ /*
+ * When a resume interrupt fires, we will enter the interrupt
+ * dispatcher, which will do nothing because we are at splhigh,
+ * and execution flow will return here and continue.
+ */
+ (void)disableintr();
+
return 0;
}
@@ -493,6 +503,8 @@ ykbec_resume()
ykbec_write(sc, REG_USB1, USB_FLAG_ON);
ykbec_write(sc, REG_USB2, USB_FLAG_ON);
+ ykbec_refresh(sc);
+
return 0;
}
#endif