Angel Pons | feedf23 | 2020-04-05 13:22:01 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 2 | |
Kyösti Mälkki | ab72809 | 2014-05-03 16:47:52 +0300 | [diff] [blame] | 3 | #include <bootmode.h> |
Kyösti Mälkki | 9c5a9bb | 2019-08-17 05:28:38 +0300 | [diff] [blame] | 4 | #include <boot/coreboot_tables.h> |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 5 | #include <southbridge/intel/bd82x6x/pch.h> |
Patrick Rudolph | e8e66f4 | 2016-02-06 17:42:42 +0100 | [diff] [blame] | 6 | #include <southbridge/intel/common/gpio.h> |
Aaron Durbin | b0f8151 | 2016-07-25 21:31:41 -0500 | [diff] [blame] | 7 | #include <vendorcode/google/chromeos/chromeos.h> |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 8 | |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 9 | void fill_lb_gpios(struct lb_gpios *gpios) |
| 10 | { |
Joel Kitching | 2e1f655 | 2019-03-23 12:41:04 +0800 | [diff] [blame] | 11 | struct lb_gpio chromeos_gpios[] = { |
Joel Kitching | 2e1f655 | 2019-03-23 12:41:04 +0800 | [diff] [blame] | 12 | /* Lid: the "switch" comes from the EC */ |
| 13 | {-1, ACTIVE_HIGH, get_lid_switch(), "lid"}, |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 14 | |
Joel Kitching | 2e1f655 | 2019-03-23 12:41:04 +0800 | [diff] [blame] | 15 | /* Power Button: hard-coded as not pressed; we'll detect later |
| 16 | * presses via SMI. */ |
| 17 | {-1, ACTIVE_HIGH, 0, "power"}, |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 18 | |
Joel Kitching | 2e1f655 | 2019-03-23 12:41:04 +0800 | [diff] [blame] | 19 | /* Did we load the VGA Option ROM? */ |
| 20 | /* -1 indicates that this is a pseudo GPIO */ |
| 21 | {-1, ACTIVE_HIGH, gfx_get_init_done(), "oprom"}, |
| 22 | }; |
| 23 | lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios)); |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 24 | } |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 25 | |
Patrick Georgi | 2f31ef1 | 2015-06-30 12:49:50 +0200 | [diff] [blame] | 26 | int get_write_protect_state(void) |
| 27 | { |
Patrick Rudolph | e8e66f4 | 2016-02-06 17:42:42 +0100 | [diff] [blame] | 28 | return get_gpio(57); |
Patrick Georgi | 2f31ef1 | 2015-06-30 12:49:50 +0200 | [diff] [blame] | 29 | } |
| 30 | |
Aaron Durbin | b0f8151 | 2016-07-25 21:31:41 -0500 | [diff] [blame] | 31 | static const struct cros_gpio cros_gpios[] = { |
| 32 | CROS_GPIO_REC_AL(9, CROS_GPIO_DEVICE_NAME), |
| 33 | CROS_GPIO_WP_AH(57, CROS_GPIO_DEVICE_NAME), |
| 34 | }; |
| 35 | |
| 36 | void mainboard_chromeos_acpi_generate(void) |
| 37 | { |
| 38 | chromeos_acpi_gpio_generate(cros_gpios, ARRAY_SIZE(cros_gpios)); |
| 39 | } |