Rex-BC Chen | db8442b | 2022-07-01 17:37:37 +0800 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | #include <bootmode.h> |
| 4 | #include <boot/coreboot_tables.h> |
Rex-BC Chen | d9e568a | 2022-07-25 19:36:56 +0800 | [diff] [blame] | 5 | #include <gpio.h> |
| 6 | #include <security/tpm/tis.h> |
| 7 | |
| 8 | #include "gpio.h" |
Bo-Chen Chen | f57155b | 2022-12-07 19:09:57 +0800 | [diff] [blame] | 9 | #include "panel.h" |
Rex-BC Chen | db8442b | 2022-07-01 17:37:37 +0800 | [diff] [blame] | 10 | |
Rex-BC Chen | f9009dd | 2022-07-28 16:38:53 +0800 | [diff] [blame] | 11 | void setup_chromeos_gpios(void) |
| 12 | { |
| 13 | /* Set up open-drain pins */ |
| 14 | gpio_input(GPIO_EC_AP_INT_ODL); |
| 15 | gpio_input(GPIO_GSC_AP_INT_ODL); |
| 16 | gpio_input(GPIO_AP_WP_ODL); |
| 17 | |
| 18 | /* Set up GPOs */ |
| 19 | gpio_output(GPIO_AP_EC_WARM_RST_REQ, 0); |
| 20 | gpio_output(GPIO_EN_SPKR, 0); |
| 21 | gpio_output(GPIO_XHCI_INIT_DONE, 0); |
| 22 | } |
| 23 | |
Rex-BC Chen | db8442b | 2022-07-01 17:37:37 +0800 | [diff] [blame] | 24 | void fill_lb_gpios(struct lb_gpios *gpios) |
| 25 | { |
Rex-BC Chen | f9009dd | 2022-07-28 16:38:53 +0800 | [diff] [blame] | 26 | struct lb_gpio chromeos_gpios[] = { |
| 27 | {GPIO_EC_AP_INT_ODL.id, ACTIVE_LOW, -1, "EC interrupt"}, |
| 28 | {GPIO_GSC_AP_INT_ODL.id, ACTIVE_HIGH, -1, "TPM interrupt"}, |
| 29 | {GPIO_EN_SPKR.id, ACTIVE_HIGH, -1, "speaker enable"}, |
| 30 | }; |
| 31 | lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios)); |
Bo-Chen Chen | f57155b | 2022-12-07 19:09:57 +0800 | [diff] [blame] | 32 | |
| 33 | fill_lp_backlight_gpios(gpios); |
Liju-Clr Chen | aa9bb44 | 2022-12-20 15:52:50 +0800 | [diff] [blame^] | 34 | |
| 35 | if (CONFIG(SDCARD_INIT)) { |
| 36 | struct lb_gpio sd_card_gpios[] = { |
| 37 | {GPIO_SD_CD_ODL.id, ACTIVE_LOW, -1, "SD card detect"}, |
| 38 | }; |
| 39 | lb_add_gpios(gpios, sd_card_gpios, ARRAY_SIZE(sd_card_gpios)); |
| 40 | } |
Rex-BC Chen | db8442b | 2022-07-01 17:37:37 +0800 | [diff] [blame] | 41 | } |
Rex-BC Chen | d9e568a | 2022-07-25 19:36:56 +0800 | [diff] [blame] | 42 | |
| 43 | int tis_plat_irq_status(void) |
| 44 | { |
| 45 | return gpio_eint_poll(GPIO_GSC_AP_INT_ODL); |
| 46 | } |