summaryrefslogtreecommitdiff
path: root/baseboard/brya/baseboard.c
blob: e65a3845786d2d57b00c0c7366f3690cfd40e01e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/* Copyright 2021 The ChromiumOS Authors
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include "chipset.h"
#include "common.h"
#include "compile_time_macros.h"
#include "gpio_signal.h"
#include "keyboard_scan.h"
#include "tablet_mode.h"

/* Wake up pins */
const enum gpio_signal hibernate_wake_pins[] = {
	GPIO_ACOK_OD,
	GPIO_GSC_EC_PWR_BTN_ODL,
	GPIO_LID_OPEN,
};
const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);

/* This callback disables keyboard when convertibles are fully open */
__override void lid_angle_peripheral_enable(int enable)
{
	/*
	 * If the lid is in tablet position via other sensors,
	 * ignore the lid angle, which might be faulty then
	 * disable keyboard.
	 */
#ifdef CONFIG_TABLET_MODE
	if (tablet_get_mode())
		enable = 0;
#endif

	if (enable) {
		keyboard_scan_enable(1, KB_SCAN_DISABLE_LID_ANGLE);
	} else {
		/*
		 * When the chipset is on, the EC keeps the keyboard enabled and
		 * Ensure that the chipset is off before disabling the keyboard.
		 * the AP decides whether to ignore input devices or not.
		 */
		if (!chipset_in_state(CHIPSET_STATE_ON))
			keyboard_scan_enable(0, KB_SCAN_DISABLE_LID_ANGLE);
	}
}