blob: 540803ca1a240821a2110a7d651d0525e06a602e [file] [log] [blame]
Angel Ponsfeedf232020-04-05 13:22:01 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Stefan Reinauer49428d82013-02-21 15:48:37 -08002
Kyösti Mälkkiab728092014-05-03 16:47:52 +03003#include <bootmode.h>
Kyösti Mälkki9c5a9bb2019-08-17 05:28:38 +03004#include <boot/coreboot_tables.h>
Stefan Reinauer49428d82013-02-21 15:48:37 -08005#include <southbridge/intel/bd82x6x/pch.h>
Patrick Rudolphe8e66f42016-02-06 17:42:42 +01006#include <southbridge/intel/common/gpio.h>
Aaron Durbinb0f81512016-07-25 21:31:41 -05007#include <vendorcode/google/chromeos/chromeos.h>
Stefan Reinauer49428d82013-02-21 15:48:37 -08008
Stefan Reinauer49428d82013-02-21 15:48:37 -08009void fill_lb_gpios(struct lb_gpios *gpios)
10{
Joel Kitching2e1f6552019-03-23 12:41:04 +080011 struct lb_gpio chromeos_gpios[] = {
Joel Kitching2e1f6552019-03-23 12:41:04 +080012 /* Lid: the "switch" comes from the EC */
13 {-1, ACTIVE_HIGH, get_lid_switch(), "lid"},
Stefan Reinauer49428d82013-02-21 15:48:37 -080014
Joel Kitching2e1f6552019-03-23 12:41:04 +080015 /* Power Button: hard-coded as not pressed; we'll detect later
16 * presses via SMI. */
17 {-1, ACTIVE_HIGH, 0, "power"},
Stefan Reinauer49428d82013-02-21 15:48:37 -080018
Joel Kitching2e1f6552019-03-23 12:41:04 +080019 /* 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 Reinauer49428d82013-02-21 15:48:37 -080024}
Stefan Reinauer49428d82013-02-21 15:48:37 -080025
Patrick Georgi2f31ef12015-06-30 12:49:50 +020026int get_write_protect_state(void)
27{
Patrick Rudolphe8e66f42016-02-06 17:42:42 +010028 return get_gpio(57);
Patrick Georgi2f31ef12015-06-30 12:49:50 +020029}
30
Aaron Durbinb0f81512016-07-25 21:31:41 -050031static 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
36void mainboard_chromeos_acpi_generate(void)
37{
38 chromeos_acpi_gpio_generate(cros_gpios, ARRAY_SIZE(cros_gpios));
39}