Subrata Banik | efc4009 | 2020-10-05 21:04:22 +0530 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | #include <baseboard/gpio.h> |
| 4 | #include <baseboard/variants.h> |
Kyösti Mälkki | be7692a | 2021-11-03 17:54:14 +0200 | [diff] [blame^] | 5 | #include <bootmode.h> |
Subrata Banik | efc4009 | 2020-10-05 21:04:22 +0530 | [diff] [blame] | 6 | #include <boot/coreboot_tables.h> |
| 7 | #include <gpio.h> |
| 8 | #include <vendorcode/google/chromeos/chromeos.h> |
| 9 | |
| 10 | void fill_lb_gpios(struct lb_gpios *gpios) |
| 11 | { |
| 12 | struct lb_gpio chromeos_gpios[] = { |
| 13 | {-1, ACTIVE_HIGH, get_lid_switch(), "lid"}, |
| 14 | {-1, ACTIVE_HIGH, 0, "power"}, |
| 15 | {-1, ACTIVE_HIGH, gfx_get_init_done(), "oprom"}, |
Anil Kumar | 49ebce6 | 2021-10-04 10:11:54 -0700 | [diff] [blame] | 16 | {GPIO_EC_IN_RW, ACTIVE_HIGH, gpio_get(GPIO_EC_IN_RW), "EC in RW"}, |
Subrata Banik | efc4009 | 2020-10-05 21:04:22 +0530 | [diff] [blame] | 17 | }; |
Anil Kumar | 49ebce6 | 2021-10-04 10:11:54 -0700 | [diff] [blame] | 18 | if (CONFIG(BOARD_INTEL_ADLRVP_P_EXT_EC) || CONFIG(BOARD_INTEL_ADLRVP_M_EXT_EC)) |
| 19 | lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios)); |
| 20 | else |
| 21 | lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios) - 1); |
Subrata Banik | efc4009 | 2020-10-05 21:04:22 +0530 | [diff] [blame] | 22 | } |
| 23 | |
| 24 | #if !CONFIG(EC_GOOGLE_CHROMEEC_SWITCHES) |
| 25 | int get_lid_switch(void) |
| 26 | { |
| 27 | /* Lid always open */ |
| 28 | return 1; |
| 29 | } |
| 30 | |
| 31 | int get_recovery_mode_switch(void) |
| 32 | { |
| 33 | return 0; |
| 34 | } |
| 35 | #endif /*!CONFIG(EC_GOOGLE_CHROMEEC_SWITCHES) */ |
| 36 | |
| 37 | int get_write_protect_state(void) |
| 38 | { |
| 39 | /* No write protect */ |
| 40 | return 0; |
| 41 | } |
| 42 | |
| 43 | void mainboard_chromeos_acpi_generate(void) |
| 44 | { |
| 45 | const struct cros_gpio *gpios; |
| 46 | size_t num; |
| 47 | |
| 48 | gpios = variant_cros_gpios(&num); |
| 49 | chromeos_acpi_gpio_generate(gpios, num); |
| 50 | } |