1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <boot/coreboot_tables.h>
4 #include <drivers/tpm/cr50.h>
10 void setup_chromeos_gpios(void)
12 gpio_input(GPIO_EC_AP_INT_ODL
);
13 gpio_input(GPIO_GSC_AP_INT_ODL
);
14 gpio_input(GPIO_SD_CD_AP_ODL
);
15 gpio_output(GPIO_AP_EC_WARM_RST_REQ
, 0);
16 gpio_output(GPIO_AP_FP_FW_UP_STRAP
, 0);
17 gpio_output(GPIO_BEEP_ON_OD
, 0);
18 gpio_output(GPIO_EN_PWR_FP
, 0);
19 gpio_output(GPIO_EN_SPKR
, 0);
20 gpio_output(GPIO_FP_RST_1V8_S3_L
, 0);
21 gpio_output(GPIO_XHCI_INIT_DONE
, 0);
24 void fill_lb_gpios(struct lb_gpios
*gpios
)
26 struct lb_gpio chromeos_gpios
[] = {
27 { GPIO_XHCI_INIT_DONE
.id
, ACTIVE_HIGH
, -1, "XHCI init done" },
28 { GPIO_EC_AP_INT_ODL
.id
, ACTIVE_LOW
, -1, "EC interrupt" },
29 { GPIO_GSC_AP_INT_ODL
.id
, ACTIVE_HIGH
, -1, "TPM interrupt" },
31 lb_add_gpios(gpios
, chromeos_gpios
, ARRAY_SIZE(chromeos_gpios
));
33 if (CONFIG(RAURU_SDCARD_INIT
)) {
34 struct lb_gpio sd_card_gpios
[] = {
35 { GPIO_SD_CD_AP_ODL
.id
, ACTIVE_LOW
, -1, "SD card detect" },
37 lb_add_gpios(gpios
, sd_card_gpios
, ARRAY_SIZE(sd_card_gpios
));
40 struct lb_gpio nau8318_gpios
[] = {
41 {GPIO_EN_SPKR
.id
, ACTIVE_HIGH
, -1, "speaker enable"},
42 {GPIO_BEEP_ON_OD
.id
, ACTIVE_HIGH
, -1, "beep enable"},
45 struct lb_gpio smartamp_gpios
[] = {
46 {GPIO_EN_SPKR
.id
, ACTIVE_LOW
, -1, "speaker reset"},
49 struct lb_gpio alc5645_gpios
[] = {
50 {GPIO_EN_SPKR
.id
, ACTIVE_HIGH
, -1, "speaker enable"},
53 if (fw_config_probe(FW_CONFIG(AUDIO_AMP
, AMP_TAS2563
)))
54 lb_add_gpios(gpios
, smartamp_gpios
, ARRAY_SIZE(smartamp_gpios
));
55 else if (fw_config_probe(FW_CONFIG(AUDIO_AMP
, AMP_ALC5645
)))
56 lb_add_gpios(gpios
, alc5645_gpios
, ARRAY_SIZE(alc5645_gpios
));
58 lb_add_gpios(gpios
, nau8318_gpios
, ARRAY_SIZE(nau8318_gpios
));
60 struct lb_gpio edp_pwm_backlight_gpios
[] = {
61 {GPIO_BL_PWM_1V8
.id
, ACTIVE_HIGH
, -1, "PWM control"},
62 {GPIO_AP_EDP_BKLTEN
.id
, ACTIVE_HIGH
, -1, "backlight enable"},
64 lb_add_gpios(gpios
, edp_pwm_backlight_gpios
, ARRAY_SIZE(edp_pwm_backlight_gpios
));
67 int cr50_plat_irq_status(void)
69 return gpio_eint_poll(GPIO_GSC_AP_INT_ODL
);