blob: a45ccdd9e072f6f22afd4f12613fca7a261a7717 [file] [log] [blame]
Angel Pons952f6b02020-04-05 13:22:37 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Aaron Durbine065bb42016-05-10 15:09:44 -05002
Aaron Durbin475d2cb2016-09-02 17:50:22 -05003#include <baseboard/variants.h>
Kyösti Mälkkibe7692a2021-11-03 17:54:14 +02004#include <bootmode.h>
Aaron Durbine065bb42016-05-10 15:09:44 -05005#include <boot/coreboot_tables.h>
Aaron Durbine065bb42016-05-10 15:09:44 -05006#include <gpio.h>
7#include <vendorcode/google/chromeos/chromeos.h>
8#include <soc/gpio.h>
Aaron Durbin114d7c32016-09-02 15:58:16 -05009#include <variant/gpio.h>
Aaron Durbine065bb42016-05-10 15:09:44 -050010
Aaron Durbine065bb42016-05-10 15:09:44 -050011void fill_lb_gpios(struct lb_gpios *gpios)
12{
13 struct lb_gpio chromeos_gpios[] = {
Aaron Durbine065bb42016-05-10 15:09:44 -050014 {-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 Durbine065bb42016-05-10 15:09:44 -050023int get_write_protect_state(void)
24{
25 /* Read PCH_WP GPIO. */
26 return gpio_get(GPIO_PCH_WP);
27}
Aaron Durbinb0f81512016-07-25 21:31:41 -050028
Aaron Durbinb0f81512016-07-25 21:31:41 -050029void mainboard_chromeos_acpi_generate(void)
30{
Aaron Durbin475d2cb2016-09-02 17:50:22 -050031 const struct cros_gpio *gpios;
32 size_t num;
33
34 gpios = variant_cros_gpios(&num);
35 chromeos_acpi_gpio_generate(gpios, num);
Aaron Durbinb0f81512016-07-25 21:31:41 -050036}