Angel Pons | 2712398 | 2020-04-05 13:22:30 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Furquan Shaikh | 06cd903 | 2016-12-14 12:10:21 -0800 | [diff] [blame] | 2 | |
Furquan Shaikh | 76cedd2 | 2020-05-02 10:24:23 -0700 | [diff] [blame] | 3 | #include <acpi/acpi.h> |
Furquan Shaikh | 374d1ff | 2017-04-14 15:44:15 -0700 | [diff] [blame] | 4 | #include <baseboard/variants.h> |
Kyösti Mälkki | be7692a | 2021-11-03 17:54:14 +0200 | [diff] [blame^] | 5 | #include <bootmode.h> |
Kyösti Mälkki | 17887d0 | 2019-07-23 19:08:01 +0300 | [diff] [blame] | 6 | #include <boot/coreboot_tables.h> |
Furquan Shaikh | 06cd903 | 2016-12-14 12:10:21 -0800 | [diff] [blame] | 7 | #include <gpio.h> |
Furquan Shaikh | 06cd903 | 2016-12-14 12:10:21 -0800 | [diff] [blame] | 8 | #include <soc/gpio.h> |
| 9 | #include <vendorcode/google/chromeos/chromeos.h> |
| 10 | |
Furquan Shaikh | 76c392d | 2017-04-13 14:15:56 -0700 | [diff] [blame] | 11 | #include <variant/gpio.h> |
Furquan Shaikh | 06cd903 | 2016-12-14 12:10:21 -0800 | [diff] [blame] | 12 | |
Furquan Shaikh | 06cd903 | 2016-12-14 12:10:21 -0800 | [diff] [blame] | 13 | void fill_lb_gpios(struct lb_gpios *gpios) |
| 14 | { |
| 15 | struct lb_gpio chromeos_gpios[] = { |
Furquan Shaikh | 06cd903 | 2016-12-14 12:10:21 -0800 | [diff] [blame] | 16 | {-1, ACTIVE_HIGH, get_lid_switch(), "lid"}, |
| 17 | {-1, ACTIVE_HIGH, 0, "power"}, |
| 18 | {-1, ACTIVE_HIGH, gfx_get_init_done(), "oprom"}, |
| 19 | {GPIO_EC_IN_RW, ACTIVE_HIGH, gpio_get(GPIO_EC_IN_RW), |
| 20 | "EC in RW"}, |
Nick Vaccaro | 9818977 | 2019-08-29 20:11:48 -0700 | [diff] [blame] | 21 | #ifdef EC_SYNC_GPIO |
| 22 | {EC_SYNC_GPIO, ACTIVE_LOW, gpio_get(EC_SYNC_GPIO), "EC sync gpio"}, |
| 23 | #endif |
Furquan Shaikh | 06cd903 | 2016-12-14 12:10:21 -0800 | [diff] [blame] | 24 | }; |
| 25 | lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios)); |
| 26 | } |
Furquan Shaikh | 06cd903 | 2016-12-14 12:10:21 -0800 | [diff] [blame] | 27 | |
| 28 | int get_write_protect_state(void) |
| 29 | { |
| 30 | /* Read PCH_WP GPIO. */ |
| 31 | return gpio_get(GPIO_PCH_WP); |
| 32 | } |
| 33 | |
Furquan Shaikh | 06cd903 | 2016-12-14 12:10:21 -0800 | [diff] [blame] | 34 | void mainboard_chromeos_acpi_generate(void) |
| 35 | { |
Furquan Shaikh | 374d1ff | 2017-04-14 15:44:15 -0700 | [diff] [blame] | 36 | const struct cros_gpio *gpios; |
| 37 | size_t num; |
| 38 | |
| 39 | gpios = variant_cros_gpios(&num); |
| 40 | chromeos_acpi_gpio_generate(gpios, num); |
Furquan Shaikh | 06cd903 | 2016-12-14 12:10:21 -0800 | [diff] [blame] | 41 | } |