blob: 12aabe6c9000bce0b3c20d9f0caed99df86703b1 [file] [log] [blame]
Angel Pons08b52802020-04-05 13:22:20 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Hannah Williams5e83e8b2018-02-09 18:35:17 -08002
Kyösti Mälkkibe7692a2021-11-03 17:54:14 +02003#include <bootmode.h>
Hannah Williams5e83e8b2018-02-09 18:35:17 -08004#include <boot/coreboot_tables.h>
5#include <ec/google/chromeec/ec.h>
6#include <gpio.h>
Kyösti Mälkki9a3bde02021-11-06 16:13:15 +02007#include <types.h>
Hannah Williams5e83e8b2018-02-09 18:35:17 -08008#include <variant/gpio.h>
9
10void fill_lb_gpios(struct lb_gpios *gpios)
11{
12 struct lb_gpio chromeos_gpios[] = {
Hannah Williams5e83e8b2018-02-09 18:35:17 -080013 {-1, ACTIVE_HIGH, get_lid_switch(), "lid"},
14 {-1, ACTIVE_HIGH, 0, "power"},
15 {-1, ACTIVE_HIGH, gfx_get_init_done(), "oprom"},
Furquan Shaikhfaad9682018-06-19 08:40:19 -070016 {GPIO_EC_IN_RW, ACTIVE_HIGH, gpio_get(GPIO_EC_IN_RW),
17 "EC in RW"},
Hannah Williams5e83e8b2018-02-09 18:35:17 -080018 };
19 lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
20}
21
22int get_write_protect_state(void)
23{
24 return gpio_get(GPIO_PCH_WP);
25}
26
Hsuan-ting Chen642508a2021-10-27 10:59:41 +000027int get_ec_is_trusted(void)
28{
29 /* EC is trusted if not in RW. */
30 return !gpio_get(GPIO_EC_IN_RW);
31}