-/* $OpenBSD: acpi.c,v 1.414 2022/08/10 16:58:16 patrick Exp $ */
+/* $OpenBSD: acpi.c,v 1.415 2022/09/03 18:05:10 kettenis Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
}
printf("\n");
+#ifdef SUSPEND
+ if (wakeup_dev_ct > 0)
+ device_register_wakeup(&sc->sc_dev);
+#endif
+
/*
* ACPI is enabled now -- attach timer
*/
-/* $OpenBSD: axppmic.c,v 1.15 2022/07/16 11:26:13 kettenis Exp $ */
+/* $OpenBSD: axppmic.c,v 1.16 2022/09/03 18:05:10 kettenis Exp $ */
/*
* Copyright (c) 2017 Mark Kettenis <kettenis@openbsd.org>
*
powerdownfn = axp209_powerdown;
}
#endif
+
+#ifdef SUSPEND
+ /* AXP803 can wake us up. */
+ if (strcmp(name, "x-powers,axp803") == 0)
+ device_register_wakeup(&sc->sc_dev);
+#endif
}
void
-/* $OpenBSD: subr_suspend.c,v 1.11 2022/08/14 01:58:28 jsg Exp $ */
+/* $OpenBSD: subr_suspend.c,v 1.12 2022/09/03 18:05:10 kettenis Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
#include "softraid.h"
#include "wsdisplay.h"
+/* Number of (active) wakeup devices in the system. */
+u_int wakeup_devices;
+
+void
+device_register_wakeup(struct device *dev)
+{
+ wakeup_devices++;
+}
+
int
sleep_state(void *v, int sleepmode)
{
rndbuf = NULL;
rndbuflen = 0;
+ if (sleepmode == SLEEP_SUSPEND && wakeup_devices == 0)
+ return EOPNOTSUPP;
+
if (sleep_showstate(v, sleepmode))
return EOPNOTSUPP;
#if NWSDISPLAY > 0
-/* $OpenBSD: device.h,v 1.63 2022/04/07 09:37:32 tb Exp $ */
+/* $OpenBSD: device.h,v 1.64 2022/09/03 18:05:10 kettenis Exp $ */
/* $NetBSD: device.h,v 1.15 1996/04/09 20:55:24 cgd Exp $ */
/*
struct device *getdisk(char *str, int len, int defpart, dev_t *devp);
struct device *parsedisk(char *str, int len, int defpart, dev_t *devp);
void device_register(struct device *, void *);
+void device_register_wakeup(struct device *);
int loadfirmware(const char *name, u_char **bufp, size_t *buflen);
#define FIRMWARE_MAX 5*1024*1024