Eric Lai | b052c4b | 2020-11-27 13:50:02 +0800 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
| 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> |
Eric Lai | b052c4b | 2020-11-27 13:50:02 +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[] = { |
| 13 | {-1, ACTIVE_HIGH, get_lid_switch(), "lid"}, |
| 14 | {-1, ACTIVE_HIGH, 0, "power"}, |
| 15 | {-1, ACTIVE_HIGH, gfx_get_init_done(), "oprom"}, |
Tim Wawrzynczak | c4e9c4e | 2021-03-05 16:40:25 -0700 | [diff] [blame] | 16 | {GPIO_EC_IN_RW, ACTIVE_HIGH, gpio_get(GPIO_EC_IN_RW), "EC in RW"}, |
Eric Lai | b052c4b | 2020-11-27 13:50:02 +0800 | [diff] [blame] | 17 | }; |
| 18 | lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios)); |
| 19 | } |
| 20 | |
Eric Lai | b052c4b | 2020-11-27 13:50:02 +0800 | [diff] [blame] | 21 | int get_write_protect_state(void) |
| 22 | { |
Tim Wawrzynczak | c4e9c4e | 2021-03-05 16:40:25 -0700 | [diff] [blame] | 23 | return gpio_get(GPIO_PCH_WP); |
Eric Lai | b052c4b | 2020-11-27 13:50:02 +0800 | [diff] [blame] | 24 | } |
| 25 | |
| 26 | void mainboard_chromeos_acpi_generate(void) |
| 27 | { |
| 28 | const struct cros_gpio *gpios; |
| 29 | size_t num; |
| 30 | gpios = variant_cros_gpios(&num); |
| 31 | chromeos_acpi_gpio_generate(gpios, num); |
| 32 | } |