Lee Leahy | 5cb9dda | 2015-05-01 10:34:54 -0700 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2012 Google Inc. |
| 5 | * Copyright (C) 2015 Intel Corp. |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; version 2 of the License. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
Lee Leahy | 5cb9dda | 2015-05-01 10:34:54 -0700 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | #ifndef MAINBOARD_EC_H |
| 18 | #define MAINBOARD_EC_H |
| 19 | |
| 20 | #include <ec/google/chromeec/ec_commands.h> |
| 21 | |
| 22 | /* GPIO_S0_000 is EC_SCI#, but it is bit 16 in GPE_STS */ |
| 23 | #define EC_SCI_GPI 16 |
| 24 | /* GPIO_S5_07 is EC_SMI#, but it is bit 19 in GPE_STS and ALT_GPIO_SMI. */ |
| 25 | #define EC_SMI_GPI 19 |
| 26 | |
| 27 | #define MAINBOARD_EC_SCI_EVENTS \ |
| 28 | (EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_CLOSED) |\ |
| 29 | EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN) |\ |
| 30 | EC_HOST_EVENT_MASK(EC_HOST_EVENT_AC_CONNECTED) |\ |
| 31 | EC_HOST_EVENT_MASK(EC_HOST_EVENT_AC_DISCONNECTED) |\ |
| 32 | EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY_LOW) |\ |
| 33 | EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY_CRITICAL) |\ |
| 34 | EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY) |\ |
| 35 | EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY_STATUS) |\ |
| 36 | EC_HOST_EVENT_MASK(EC_HOST_EVENT_THERMAL_THRESHOLD) |\ |
| 37 | EC_HOST_EVENT_MASK(EC_HOST_EVENT_THERMAL_OVERLOAD) |\ |
| 38 | EC_HOST_EVENT_MASK(EC_HOST_EVENT_THROTTLE_START) |\ |
| 39 | EC_HOST_EVENT_MASK(EC_HOST_EVENT_THROTTLE_STOP) |\ |
| 40 | EC_HOST_EVENT_MASK(EC_HOST_EVENT_USB_CHARGER)) |
| 41 | |
| 42 | #define MAINBOARD_EC_SMI_EVENTS \ |
| 43 | (EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_CLOSED)) |
| 44 | |
| 45 | /* EC can wake from S5 with lid or power button */ |
| 46 | #define MAINBOARD_EC_S5_WAKE_EVENTS \ |
| 47 | (EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN) |\ |
| 48 | EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON)) |
| 49 | |
| 50 | /* EC can wake from S3 with lid or power button or key press */ |
| 51 | #define MAINBOARD_EC_S3_WAKE_EVENTS \ |
| 52 | (MAINBOARD_EC_S5_WAKE_EVENTS |\ |
| 53 | EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEY_PRESSED)) |
| 54 | |
| 55 | /* Log EC wake events plus EC shutdown events */ |
| 56 | #define MAINBOARD_EC_LOG_EVENTS \ |
| 57 | (EC_HOST_EVENT_MASK(EC_HOST_EVENT_THERMAL_SHUTDOWN) |\ |
| 58 | EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY_SHUTDOWN)|\ |
| 59 | EC_HOST_EVENT_MASK(EC_HOST_EVENT_PANIC)) |
| 60 | |
| 61 | #ifndef __ACPI__ |
| 62 | extern void mainboard_ec_init(void); |
| 63 | #endif |
| 64 | |
| 65 | #endif |