| 1 |
|
| 2 |
|
| 3 |
#include <bootmode.h> |
| 4 |
#include <boot/coreboot_tables.h> |
| 5 |
#include <device/device.h> |
| 6 |
#include <gpio.h> |
| 7 |
#include <ec/google/chromeec/ec.h> |
| 8 |
#include <types.h> |
| 9 |
#include <vendorcode/google/chromeos/chromeos.h> |
| 10 |
|
| 11 |
#include "gpio.h" |
| 12 |
#include "ec.h" |
| 13 |
|
| 14 |
void fill_lb_gpios(struct lb_gpios *gpios) |
| 15 |
{ |
| 16 |
struct lb_gpio chromeos_gpios[] = { |
| 17 |
{-1, ACTIVE_HIGH, get_lid_switch(), "lid"}, |
| 18 |
{-1, ACTIVE_HIGH, 0, "power"}, |
| 19 |
{-1, ACTIVE_HIGH, gfx_get_init_done(), "oprom"}, |
| 20 |
}; |
| 21 |
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios)); |
| 22 |
} |
| 23 |
|
| 24 |
int get_lid_switch(void) |
| 25 |
{ |
| 26 |
if (CONFIG(EC_GOOGLE_CHROMEEC)) |
| 27 |
|
| 28 |
return !!(google_chromeec_get_switches() & EC_SWITCH_LID_OPEN); |
| 29 |
|
| 30 |
|
| 31 |
return 1; |
| 32 |
} |
| 33 |
|
| 34 |
int get_recovery_mode_switch(void) |
| 35 |
{ |
| 36 |
if (CONFIG(EC_GOOGLE_CHROMEEC)) { |
| 37 |
|
| 38 |
if (google_chromeec_get_switches() & |
| 39 |
EC_SWITCH_DEDICATED_RECOVERY) |
| 40 |
return 1; |
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
return !!(google_chromeec_get_events_b() & |
| 45 |
EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY)); |
| 46 |
} |
| 47 |
|
| 48 |
return 0; |
| 49 |
} |
| 50 |
|
| 51 |
int get_write_protect_state(void) |
| 52 |
{ |
| 53 |
|
| 54 |
return 0; |
| 55 |
} |
| 56 |
|
| 57 |
static const struct cros_gpio cros_gpios[] = { |
| 58 |
CROS_GPIO_REC_AL(CROS_GPIO_VIRTUAL, CROS_GPIO_DEVICE_NAME), |
| 59 |
CROS_GPIO_WP_AH(CROS_GPIO_VIRTUAL, CROS_GPIO_DEVICE_NAME), |
| 60 |
}; |
| 61 |
DECLARE_CROS_GPIOS(cros_gpios); |
| 62 |
|
| 63 |
int get_ec_is_trusted(void) |
| 64 |
{ |
| 65 |
|
| 66 |
|
| 67 |
return 1; |
| 68 |
} |