aboutsummaryrefslogtreecommitdiff
path: root/src/mainboard/google/rush_ryu/chromeos.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainboard/google/rush_ryu/chromeos.c')
-rw-r--r--src/mainboard/google/rush_ryu/chromeos.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/mainboard/google/rush_ryu/chromeos.c b/src/mainboard/google/rush_ryu/chromeos.c
index f752aeee6c..2fd9bb1048 100644
--- a/src/mainboard/google/rush_ryu/chromeos.c
+++ b/src/mainboard/google/rush_ryu/chromeos.c
@@ -17,6 +17,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <boardid.h>
#include <boot/coreboot_tables.h>
#include <console/console.h>
#include <ec/google/chromeec/ec.h>
@@ -26,6 +27,14 @@
#include "gpio.h"
+static inline uint32_t get_pwr_btn_polarity(void)
+{
+ if (board_id() < BOARD_ID_PROTO_3)
+ return ACTIVE_HIGH;
+
+ return ACTIVE_LOW;
+}
+
void fill_lb_gpios(struct lb_gpios *gpios)
{
int count = 0;
@@ -48,9 +57,9 @@ void fill_lb_gpios(struct lb_gpios *gpios)
/* TODO(adurbin): add lid switch */
- /* Power: active low */
- gpios->gpios[count].port = POWER_BUTTON_INDEX,
- gpios->gpios[count].polarity = ACTIVE_HIGH;
+ /* Power: active low / high depending on board id */
+ gpios->gpios[count].port = POWER_BUTTON_INDEX;
+ gpios->gpios[count].polarity = get_pwr_btn_polarity();
gpios->gpios[count].value = gpio_get(POWER_BUTTON);
strncpy((char *)gpios->gpios[count].name, "power",
GPIO_MAX_NAME_LENGTH);