mainboard/google/poppy: Provide cros_gpio variant API
[coreboot.git] / src / mainboard / google / poppy / chromeos.c
blobe74933dd7ba8a4c05a6c420e376f50d6e9e0d8d2
1 /*
2 * This file is part of the coreboot project.
4 * Copyright (C) 2016 Google Inc.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
16 #include <arch/acpi.h>
17 #include <baseboard/variants.h>
18 #include <gpio.h>
19 #include <rules.h>
20 #include <soc/gpe.h>
21 #include <soc/gpio.h>
22 #include <tpm.h>
23 #include <vendorcode/google/chromeos/chromeos.h>
25 #include <variant/gpio.h>
27 #if ENV_RAMSTAGE
28 #include <boot/coreboot_tables.h>
30 void fill_lb_gpios(struct lb_gpios *gpios)
32 struct lb_gpio chromeos_gpios[] = {
33 {-1, ACTIVE_HIGH, get_write_protect_state(), "write protect"},
34 {-1, ACTIVE_HIGH, get_recovery_mode_switch(), "recovery"},
35 {-1, ACTIVE_HIGH, get_lid_switch(), "lid"},
36 {-1, ACTIVE_HIGH, 0, "power"},
37 {-1, ACTIVE_HIGH, gfx_get_init_done(), "oprom"},
38 {GPIO_EC_IN_RW, ACTIVE_HIGH, gpio_get(GPIO_EC_IN_RW),
39 "EC in RW"},
41 lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
43 #endif /* ENV_RAMSTAGE */
45 int get_write_protect_state(void)
47 /* Read PCH_WP GPIO. */
48 return gpio_get(GPIO_PCH_WP);
51 void mainboard_chromeos_acpi_generate(void)
53 const struct cros_gpio *gpios;
54 size_t num;
56 gpios = variant_cros_gpios(&num);
57 chromeos_acpi_gpio_generate(gpios, num);
60 int tis_plat_irq_status(void)
62 return acpi_get_gpe(GPE0_DW2_00);