Angel Pons | 952f6b0 | 2020-04-05 13:22:37 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Aaron Durbin | e065bb4 | 2016-05-10 15:09:44 -0500 | [diff] [blame] | 2 | |
Aaron Durbin | 475d2cb | 2016-09-02 17:50:22 -0500 | [diff] [blame] | 3 | #include <baseboard/variants.h> |
Kyösti Mälkki | be7692a | 2021-11-03 17:54:14 +0200 | [diff] [blame^] | 4 | #include <bootmode.h> |
Aaron Durbin | e065bb4 | 2016-05-10 15:09:44 -0500 | [diff] [blame] | 5 | #include <boot/coreboot_tables.h> |
Aaron Durbin | e065bb4 | 2016-05-10 15:09:44 -0500 | [diff] [blame] | 6 | #include <gpio.h> |
| 7 | #include <vendorcode/google/chromeos/chromeos.h> |
| 8 | #include <soc/gpio.h> |
Aaron Durbin | 114d7c3 | 2016-09-02 15:58:16 -0500 | [diff] [blame] | 9 | #include <variant/gpio.h> |
Aaron Durbin | e065bb4 | 2016-05-10 15:09:44 -0500 | [diff] [blame] | 10 | |
Aaron Durbin | e065bb4 | 2016-05-10 15:09:44 -0500 | [diff] [blame] | 11 | void fill_lb_gpios(struct lb_gpios *gpios) |
| 12 | { |
| 13 | struct lb_gpio chromeos_gpios[] = { |
Aaron Durbin | e065bb4 | 2016-05-10 15:09:44 -0500 | [diff] [blame] | 14 | {-1, ACTIVE_HIGH, get_lid_switch(), "lid"}, |
| 15 | {-1, ACTIVE_HIGH, 0, "power"}, |
| 16 | {-1, ACTIVE_HIGH, gfx_get_init_done(), "oprom"}, |
| 17 | {GPIO_EC_IN_RW, ACTIVE_HIGH, |
| 18 | gpio_get(GPIO_EC_IN_RW), "EC in RW"}, |
| 19 | }; |
| 20 | lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios)); |
| 21 | } |
| 22 | |
Aaron Durbin | e065bb4 | 2016-05-10 15:09:44 -0500 | [diff] [blame] | 23 | int get_write_protect_state(void) |
| 24 | { |
| 25 | /* Read PCH_WP GPIO. */ |
| 26 | return gpio_get(GPIO_PCH_WP); |
| 27 | } |
Aaron Durbin | b0f8151 | 2016-07-25 21:31:41 -0500 | [diff] [blame] | 28 | |
Aaron Durbin | b0f8151 | 2016-07-25 21:31:41 -0500 | [diff] [blame] | 29 | void mainboard_chromeos_acpi_generate(void) |
| 30 | { |
Aaron Durbin | 475d2cb | 2016-09-02 17:50:22 -0500 | [diff] [blame] | 31 | const struct cros_gpio *gpios; |
| 32 | size_t num; |
| 33 | |
| 34 | gpios = variant_cros_gpios(&num); |
| 35 | chromeos_acpi_gpio_generate(gpios, num); |
Aaron Durbin | b0f8151 | 2016-07-25 21:31:41 -0500 | [diff] [blame] | 36 | } |