Angel Pons | 60ec365 | 2020-04-03 01:22:13 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Maulik V Vaghela | dfc9917 | 2018-08-07 12:06:23 +0530 | [diff] [blame] | 2 | |
Furquan Shaikh | 76cedd2 | 2020-05-02 10:24:23 -0700 | [diff] [blame] | 3 | #include <acpi/acpi.h> |
Maulik V Vaghela | dfc9917 | 2018-08-07 12:06:23 +0530 | [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> |
Maulik V Vaghela | dfc9917 | 2018-08-07 12:06:23 +0530 | [diff] [blame] | 7 | #include <gpio.h> |
Maulik V Vaghela | dfc9917 | 2018-08-07 12:06:23 +0530 | [diff] [blame] | 8 | #include <soc/gpio.h> |
Maulik V Vaghela | dfc9917 | 2018-08-07 12:06:23 +0530 | [diff] [blame] | 9 | #include <vendorcode/google/chromeos/chromeos.h> |
| 10 | |
Maulik V Vaghela | dfc9917 | 2018-08-07 12:06:23 +0530 | [diff] [blame] | 11 | void fill_lb_gpios(struct lb_gpios *gpios) |
| 12 | { |
| 13 | struct lb_gpio chromeos_gpios[] = { |
Maulik V Vaghela | dfc9917 | 2018-08-07 12:06:23 +0530 | [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 | }; |
| 18 | lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios)); |
| 19 | } |
Maulik V Vaghela | dfc9917 | 2018-08-07 12:06:23 +0530 | [diff] [blame] | 20 | |
| 21 | int get_lid_switch(void) |
| 22 | { |
| 23 | /* Lid always open */ |
| 24 | return 1; |
| 25 | } |
| 26 | |
| 27 | int get_recovery_mode_switch(void) |
| 28 | { |
| 29 | return 0; |
| 30 | } |
| 31 | |
| 32 | int get_write_protect_state(void) |
| 33 | { |
| 34 | /* No write protect */ |
| 35 | return 0; |
| 36 | } |
| 37 | |
| 38 | void mainboard_chromeos_acpi_generate(void) |
| 39 | { |
| 40 | const struct cros_gpio *gpios; |
| 41 | size_t num; |
| 42 | |
| 43 | gpios = variant_cros_gpios(&num); |
| 44 | chromeos_acpi_gpio_generate(gpios, num); |
| 45 | } |