drivers/mipi: Add support for KD_KD110N11_51IE panel
[coreboot2.git] / src / mainboard / google / cherry / chromeos.c
blob7838c5e6802ca247f389c5da51c52bb3ab0f4d4d
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <bootmode.h>
4 #include <boot/coreboot_tables.h>
5 #include <drivers/tpm/cr50.h>
6 #include <gpio.h>
8 #include "gpio.h"
10 void setup_chromeos_gpios(void)
12 gpio_input(GPIO_WP);
13 gpio_input_pullup(GPIO_EC_AP_INT);
14 gpio_input_pullup(GPIO_SD_CD);
15 gpio_input_pullup(GPIO_EC_IN_RW);
16 gpio_input_pullup(GPIO_GSC_AP_INT);
17 gpio_output(GPIO_EN_SPK, 0);
18 gpio_output(GPIO_RESET, 0);
19 gpio_output(GPIO_XHCI_DONE, 0);
20 if (CONFIG(CHERRY_USE_RT1019))
21 gpio_output(GPIO_BEEP_ON, 0);
22 else if (CONFIG(CHERRY_USE_RT1011))
23 gpio_output(GPIO_RST_RT1011, 0);
26 void fill_lb_gpios(struct lb_gpios *gpios)
28 struct lb_gpio chromeos_gpios[] = {
29 {GPIO_EC_AP_INT.id, ACTIVE_LOW, -1, "EC interrupt"},
30 {GPIO_SD_CD.id, ACTIVE_LOW, -1, "SD card detect"},
31 {GPIO_EC_IN_RW.id, ACTIVE_LOW, -1, "EC in RW"},
33 * The GPIO_GSC_AP_INT itself is active low, but the payloads will
34 * create the IRQ using its eint driver, which is active high.
36 {GPIO_GSC_AP_INT.id, ACTIVE_HIGH, -1, "TPM interrupt"},
39 struct lb_gpio rt1019_gpios[] = {
40 {GPIO_BEEP_ON.id, ACTIVE_HIGH, -1, "beep enable"},
41 {GPIO_EN_SPK.id, ACTIVE_HIGH, -1, "speaker enable"},
44 struct lb_gpio rt1011_gpios[] = {
45 {GPIO_RST_RT1011.id, ACTIVE_HIGH, -1, "rt1011 reset"},
46 {GPIO_EN_SPK.id, ACTIVE_HIGH, -1, "speaker enable"},
49 struct lb_gpio spk_gpios[] = {
50 {GPIO_EN_SPK.id, ACTIVE_HIGH, -1, "speaker enable"},
53 lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
55 if (CONFIG(CHERRY_USE_RT1019))
56 lb_add_gpios(gpios, rt1019_gpios, ARRAY_SIZE(rt1019_gpios));
57 else if (CONFIG(CHERRY_USE_RT1011))
58 lb_add_gpios(gpios, rt1011_gpios, ARRAY_SIZE(rt1011_gpios));
59 else if (CONFIG(CHERRY_USE_MAX98390))
60 lb_add_gpios(gpios, spk_gpios, ARRAY_SIZE(spk_gpios));
63 int cr50_plat_irq_status(void)
65 return gpio_eint_poll(GPIO_GSC_AP_INT);
68 int get_ec_is_trusted(void)
70 /* EC is trusted if not in RW. This is active low. */
71 return !!gpio_get(GPIO_EC_IN_RW);