/ src / mainboard / google / nyan_blaze / chromeos.c
chromeos.c
 1  /* SPDX-License-Identifier: GPL-2.0-only */
 2  
 3  #include <boot/coreboot_tables.h>
 4  #include <bootmode.h>
 5  #include <gpio.h>
 6  
 7  void fill_lb_gpios(struct lb_gpios *gpios)
 8  {
 9  	struct lb_gpio chromeos_gpios[] = {
10  		{GPIO(R4), ACTIVE_HIGH, -1, "lid"},
11  		{GPIO(Q0), ACTIVE_LOW, -1, "power"},
12  		{GPIO(U4), ACTIVE_HIGH, -1, "EC in RW"},
13  		{GPIO(I5), ACTIVE_LOW, -1, "reset"},
14  	};
15  	lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
16  }
17  
18  int get_write_protect_state(void)
19  {
20  	return !gpio_get(GPIO(R1));
21  }
22  
23  int get_ec_is_trusted(void)
24  {
25  	/* EC is trusted if not in RW. */
26  	return !gpio_get(GPIO(U4));
27  }