coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
chromeos.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <bootmode.h>
4 #include <boot/coreboot_tables.h>
5 #include <gpio.h>
6 #include <security/tpm/tis.h>
7 
8 #include "gpio.h"
9 
11 {
20  if (CONFIG(CHERRY_USE_RT1019))
22  else if (CONFIG(CHERRY_USE_RT1011))
24 
25 }
26 
27 void fill_lb_gpios(struct lb_gpios *gpios)
28 {
29  struct lb_gpio chromeos_gpios[] = {
30  {GPIO_EC_AP_INT.id, ACTIVE_LOW, -1, "EC interrupt"},
31  {GPIO_SD_CD.id, ACTIVE_LOW, -1, "SD card detect"},
32  {GPIO_EC_IN_RW.id, ACTIVE_LOW, -1, "EC in RW"},
33  /*
34  * The GPIO_GSC_AP_INT itself is active low, but the payloads will
35  * create the IRQ using its eint driver, which is active high.
36  */
37  {GPIO_GSC_AP_INT.id, ACTIVE_HIGH, -1, "TPM interrupt"},
38  };
39 
40  struct lb_gpio rt1019_gpios[] = {
41  {GPIO_BEEP_ON.id, ACTIVE_HIGH, -1, "beep enable"},
42  {GPIO_EN_SPK.id, ACTIVE_HIGH, -1, "speaker enable"},
43  };
44 
45  struct lb_gpio rt1011_gpios[] = {
46  {GPIO_RST_RT1011.id, ACTIVE_HIGH, -1, "rt1011 reset"},
47  {GPIO_EN_SPK.id, ACTIVE_HIGH, -1, "speaker enable"},
48  };
49 
50  struct lb_gpio spk_gpios[] = {
51  {GPIO_EN_SPK.id, ACTIVE_HIGH, -1, "speaker enable"},
52  };
53 
54  lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
55 
56  if (CONFIG(CHERRY_USE_RT1019))
57  lb_add_gpios(gpios, rt1019_gpios, ARRAY_SIZE(rt1019_gpios));
58  else if (CONFIG(CHERRY_USE_RT1011))
59  lb_add_gpios(gpios, rt1011_gpios, ARRAY_SIZE(rt1011_gpios));
60  else if (CONFIG(CHERRY_USE_MAX98390))
61  lb_add_gpios(gpios, spk_gpios, ARRAY_SIZE(spk_gpios));
62 }
63 
65 {
67 }
68 
70 {
71  /* EC is trusted if not in RW. This is active low. */
72  return !!gpio_get(GPIO_EC_IN_RW);
73 }
void fill_lb_gpios(struct lb_gpios *gpios)
Definition: chromeos.c:9
#define ARRAY_SIZE(a)
Definition: helpers.h:12
@ CONFIG
Definition: dsi_common.h:201
int get_ec_is_trusted(void)
Definition: chromeos.c:25
int tis_plat_irq_status(void)
Definition: chromeos.c:39
void setup_chromeos_gpios(void)
Definition: chromeos.c:10
#define ACTIVE_HIGH
Definition: chromeos.c:18
#define ACTIVE_LOW
Definition: chromeos.c:17
#define GPIO_WP
Definition: chromeos.c:11
void lb_add_gpios(struct lb_gpios *gpios, const struct lb_gpio *gpio_table, size_t count)
int gpio_get(gpio_t gpio)
Definition: gpio.c:166
void gpio_input(gpio_t gpio)
Definition: gpio.c:189
void gpio_output(gpio_t gpio, int value)
Definition: gpio.c:194
void gpio_input_pullup(gpio_t gpio)
Definition: gpio.c:184
#define GPIO_SD_CD
Definition: gpio.h:14
#define GPIO_XHCI_DONE
Definition: gpio.h:20
#define GPIO_RESET
Definition: gpio.h:16
#define GPIO_EC_AP_INT
Definition: gpio.h:10
#define GPIO_BEEP_ON
Definition: gpio.h:11
#define GPIO_GSC_AP_INT
Definition: gpio.h:14
#define GPIO_RST_RT1011
Definition: gpio.h:15
#define GPIO_EN_SPK
Definition: gpio.h:16
int gpio_eint_poll(gpio_t gpio)
Definition: gpio.c:126