isn't quite helpful when it's used to come back from suspend and then the
second interrupt initiates powerdown. Ignore press, but handle release.
ok kettenis@
-/* $OpenBSD: qcpon.c,v 1.1 2022/11/08 19:44:28 patrick Exp $ */
+/* $OpenBSD: qcpon.c,v 1.2 2022/11/10 16:20:54 patrick Exp $ */
/*
* Copyright (c) 2022 Patrick Wildt <patrick@blueri.se>
*
int8_t sc_sid;
void *sc_pwrkey_ih;
+ int sc_pwrkey_debounce;
struct task sc_powerdown_task;
};
{
struct qcpon_softc *sc = arg;
+ /* Ignore presses, handle releases. */
+ sc->sc_pwrkey_debounce = (sc->sc_pwrkey_debounce + 1) % 2;
+ if (sc->sc_pwrkey_debounce == 1)
+ return 1;
+
task_add(systq, &sc->sc_powerdown_task);
return 1;
}