Skip to content

Commit 750fd0a

Browse files
lotus: Pull SLEEP# low when lid is closed (#876)
Signed-off-by: Daniel Schaefer <[email protected]>
1 parent e299057 commit 750fd0a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

zephyr/program/lotus/lotus/src/input_module.c

+19
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <zephyr/init.h>
88
#include "gpio/gpio_int.h"
99
#include "board_host_command.h"
10+
#include "chipset.h"
1011
#include "console.h"
1112
#include "extpower.h"
1213
#include "gpio.h"
@@ -20,6 +21,7 @@
2021

2122
#include "board_adc.h"
2223
#include "flash_storage.h"
24+
#include "lid_switch.h"
2325

2426
LOG_MODULE_REGISTER(inputmodule, LOG_LEVEL_INF);
2527

@@ -128,6 +130,23 @@ bool input_deck_is_fully_populated(void)
128130
return true;
129131
}
130132

133+
/* Make sure the inputdeck is sleeping when lid is closed */
134+
static void inputdeck_lid_change(void)
135+
{
136+
/* If suspend or off we don't want to turn on input module LEDs even if the lid is open */
137+
if (!chipset_in_state(CHIPSET_STATE_ON))
138+
return;
139+
140+
if (lid_is_open()) {
141+
gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(gpio_sleep_l), 1);
142+
} else {
143+
gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(gpio_sleep_l), 0);
144+
}
145+
146+
}
147+
DECLARE_HOOK(HOOK_LID_CHANGE, inputdeck_lid_change, HOOK_PRIO_DEFAULT);
148+
149+
131150
static void poll_c_deck(void)
132151
{
133152
static int turning_on_count;

0 commit comments

Comments
 (0)