mainboard/[g-p]*: Remove copyright notices
[coreboot.git] / src / mainboard / intel / kblrvp / chromeos.c
blobc8629071708b04055ca3a716fa26c57bd9b43ccf
1 /*
2 * This file is part of the coreboot project.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; version 2 of the License.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
15 #include <boot/coreboot_tables.h>
16 #include <device/device.h>
17 #include <gpio.h>
18 #include <soc/gpio.h>
19 #include <ec/google/chromeec/ec.h>
20 #include <vendorcode/google/chromeos/chromeos.h>
22 #include "gpio.h"
23 #include "ec.h"
25 void fill_lb_gpios(struct lb_gpios *gpios)
27 struct lb_gpio chromeos_gpios[] = {
28 {-1, ACTIVE_HIGH, get_lid_switch(), "lid"},
29 {-1, ACTIVE_HIGH, 0, "power"},
30 {-1, ACTIVE_HIGH, gfx_get_init_done(), "oprom"},
32 lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
35 int get_lid_switch(void)
37 if (CONFIG(EC_GOOGLE_CHROMEEC))
38 /* Read lid switch state from the EC. */
39 return !!(google_chromeec_get_switches() & EC_SWITCH_LID_OPEN);
41 /* Lid always open */
42 return 1;
45 int get_recovery_mode_switch(void)
47 if (CONFIG(EC_GOOGLE_CHROMEEC)) {
48 /* Check for dedicated recovery switch first. */
49 if (google_chromeec_get_switches() &
50 EC_SWITCH_DEDICATED_RECOVERY)
51 return 1;
53 /* Otherwise check if the EC has posted the keyboard recovery
54 * event. */
55 return !!(google_chromeec_get_events_b() &
56 EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY));
59 return 0;
62 int get_write_protect_state(void)
64 /* No write protect */
65 return 0;
68 static const struct cros_gpio cros_gpios[] = {
69 CROS_GPIO_REC_AL(CROS_GPIO_VIRTUAL, CROS_GPIO_DEVICE_NAME),
70 CROS_GPIO_WP_AH(CROS_GPIO_VIRTUAL, CROS_GPIO_DEVICE_NAME),
73 void mainboard_chromeos_acpi_generate(void)
75 chromeos_acpi_gpio_generate(cros_gpios, ARRAY_SIZE(cros_gpios));