Angel Pons | 60ec365 | 2020-04-03 01:22:13 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Ravi Sarawadi | ebb2d3c | 2019-12-19 23:01:48 -0800 | [diff] [blame] | 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> |
Ravi Sarawadi | ebb2d3c | 2019-12-19 23:01:48 -0800 | [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[] = { |
Ravi Sarawadi | ebb2d3c | 2019-12-19 23:01:48 -0800 | [diff] [blame] | 13 | {-1, ACTIVE_HIGH, get_lid_switch(), "lid"}, |
| 14 | {-1, ACTIVE_HIGH, 0, "power"}, |
| 15 | {-1, ACTIVE_HIGH, gfx_get_init_done(), "oprom"}, |
Shaunak Saha | dbf6f68 | 2020-04-29 13:19:44 -0700 | [diff] [blame] | 16 | {-1, ACTIVE_HIGH, 0, "EC in RW"}, |
Ravi Sarawadi | ebb2d3c | 2019-12-19 23:01:48 -0800 | [diff] [blame] | 17 | }; |
| 18 | lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios)); |
| 19 | } |
| 20 | |
Shaunak Saha | dbf6f68 | 2020-04-29 13:19:44 -0700 | [diff] [blame] | 21 | #if !CONFIG(EC_GOOGLE_CHROMEEC_SWITCHES) |
Ravi Sarawadi | ebb2d3c | 2019-12-19 23:01:48 -0800 | [diff] [blame] | 22 | int get_lid_switch(void) |
| 23 | { |
| 24 | /* Lid always open */ |
| 25 | return 1; |
| 26 | } |
| 27 | |
| 28 | int get_recovery_mode_switch(void) |
| 29 | { |
| 30 | return 0; |
| 31 | } |
| 32 | |
Shaunak Saha | dbf6f68 | 2020-04-29 13:19:44 -0700 | [diff] [blame] | 33 | #endif /*!CONFIG(EC_GOOGLE_CHROMEEC_SWITCHES) */ |
| 34 | |
Ravi Sarawadi | ebb2d3c | 2019-12-19 23:01:48 -0800 | [diff] [blame] | 35 | int get_write_protect_state(void) |
| 36 | { |
| 37 | /* No write protect */ |
| 38 | return 0; |
| 39 | } |
| 40 | |
| 41 | void mainboard_chromeos_acpi_generate(void) |
| 42 | { |
| 43 | const struct cros_gpio *gpios; |
| 44 | size_t num; |
| 45 | |
| 46 | gpios = variant_cros_gpios(&num); |
| 47 | chromeos_acpi_gpio_generate(gpios, num); |
| 48 | } |