Skip to content

Commit

Permalink
WIP: Wake from S3 using any key
Browse files Browse the repository at this point in the history
  • Loading branch information
crawfxrd committed Feb 21, 2020
1 parent 5b2cbef commit 8ec71a3
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/board/system76/darp5/kbscan.c
Expand Up @@ -5,6 +5,7 @@
#include <board/kbscan.h>
#include <board/keymap.h>
#include <board/pmc.h>
#include <board/power.h>
#include <common/debug.h>

bool kbscan_enabled = false;
Expand All @@ -29,6 +30,13 @@ void kbscan_init(void) {
#define DEBOUNCE_DELAY 20

bool kbscan_press(uint16_t key, bool pressed, uint8_t * layer) {
if (pressed &&
(power_state == POWER_STATE_S3 || power_state == POWER_STATE_DS3)) {
gpio_set(&SWI_N, false);
delay_ticks(10); //TODO: find correct delay
gpio_set(&SWI_N, true);
}

switch (key & KT_MASK) {
case (KT_NORMAL):
if (kbscan_enabled) {
Expand Down
8 changes: 8 additions & 0 deletions src/board/system76/galp3-c/kbscan.c
Expand Up @@ -6,6 +6,7 @@
#include <board/kbscan.h>
#include <board/keymap.h>
#include <board/pmc.h>
#include <board/power.h>
#include <common/debug.h>

bool kbscan_enabled = false;
Expand All @@ -30,6 +31,13 @@ void kbscan_init(void) {
#define DEBOUNCE_DELAY 20

bool kbscan_press(uint16_t key, bool pressed, uint8_t * layer) {
if (pressed &&
(power_state == POWER_STATE_S3 || power_state == POWER_STATE_DS3)) {
gpio_set(&SWI_N, false);
delay_ticks(10); //TODO: find correct delay
gpio_set(&SWI_N, true);
}

switch (key & KT_MASK) {
case (KT_NORMAL):
if (kbscan_enabled) {
Expand Down
8 changes: 8 additions & 0 deletions src/board/system76/lemp9/kbscan.c
Expand Up @@ -6,6 +6,7 @@
#include <board/kbscan.h>
#include <board/keymap.h>
#include <board/pmc.h>
#include <board/power.h>
#include <common/debug.h>

bool kbscan_enabled = false;
Expand All @@ -30,6 +31,13 @@ void kbscan_init(void) {
#define DEBOUNCE_DELAY 20

bool kbscan_press(uint16_t key, bool pressed, uint8_t * layer) {
if (pressed &&
(power_state == POWER_STATE_S3 || power_state == POWER_STATE_DS3)) {
gpio_set(&SWI_N, false);
delay_ticks(10); //TODO: find correct delay
gpio_set(&SWI_N, true);
}

switch (key & KT_MASK) {
case (KT_NORMAL):
if (kbscan_enabled) {
Expand Down

0 comments on commit 8ec71a3

Please sign in to comment.