Debian Codegraph @

src/mainboard/google/asurada/chromeos.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #include <bootmode.h>
4 #include <boot/coreboot_tables.h>
5 #include <drivers/tpm/cr50.h>
6 #include <gpio.h>
7
8 #include "gpio.h"
9
10 void setup_chromeos_gpios(void)
11 {
12 gpio_input(GPIO_WP);
13 gpio_input_pullup(GPIO_EC_AP_INT);
14 gpio_input_pullup(GPIO_EC_IN_RW);
15 gpio_input_pullup(GPIO_H1_AP_INT);
16 gpio_input_pullup(GPIO_SD_CD);
17 gpio_output(GPIO_RESET, 0);
18 gpio_output(GPIO_EN_SPK_AMP, 0);
19 gpio_output(GPIO_XHCI_DONE, 0);
20 }
21
22 void fill_lb_gpios(struct lb_gpios *gpios)
23 {
24 struct lb_gpio chromeos_gpios[] = {
25 {GPIO_EC_IN_RW.id, ACTIVE_LOW, -1, "EC in RW"},
26 {GPIO_EC_AP_INT.id, ACTIVE_LOW, -1, "EC interrupt"},
27 {GPIO_H1_AP_INT.id, ACTIVE_HIGH, -1, "TPM interrupt"},
28 {GPIO_SD_CD.id, ACTIVE_HIGH, -1, "SD card detect"},
29 {GPIO_EN_SPK_AMP.id, ACTIVE_HIGH, -1, "speaker enable"},
30 };
31 lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
32 }
33
34 int get_write_protect_state(void)
35 {
36 return !gpio_get(GPIO_WP);
37 }
38
39 int cr50_plat_irq_status(void)
40 {
41 return gpio_eint_poll(GPIO_H1_AP_INT);
42 }
43
44 int get_ec_is_trusted(void)
45 {
46 /* EC is trusted if not in RW. This is active low. */
47 return !!gpio_get(GPIO_EC_IN_RW);
48 }