blob: d7faafb245078577aff8436a3b214bd4a250b2e0 [file] [log] [blame]
Matt DeVillier89683c02015-12-25 01:15:41 -06001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2015 Google Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#include <types.h>
Matt DeVillier89683c02015-12-25 01:15:41 -060017#include <superio/ite/it8772f/it8772f.h>
18#include "onboard.h"
19
Matt DeVillier7c6951b2016-12-06 17:59:23 -060020void set_power_led(int state)
Matt DeVillier89683c02015-12-25 01:15:41 -060021{
Matt DeVillieraaa4ae762017-01-26 10:58:15 -060022 int polarity;
23
24 if (IS_ENABLED(CONFIG_BOARD_GOOGLE_TIDUS)) {
25 polarity = state == LED_OFF ? 0x00 : 0x01;
26 } else {
27 polarity = state == LED_BLINK ? 0x01 : 0x00;
28 }
29
Matt DeVillier7c6951b2016-12-06 17:59:23 -060030 it8772f_gpio_led(IT8772F_GPIO_DEV,
Elyes HAOUAS808fc8e2018-05-28 13:30:59 +020031 1, /* set */
32 0x01, /* select */
Matt DeVillieraaa4ae762017-01-26 10:58:15 -060033 polarity, /* polarity */
Matt DeVillier7c6951b2016-12-06 17:59:23 -060034 state == LED_BLINK ? 0x01 : 0x00, /* pullup/pulldown */
Elyes HAOUAS808fc8e2018-05-28 13:30:59 +020035 0x01, /* output */
Matt DeVillier7c6951b2016-12-06 17:59:23 -060036 state == LED_BLINK ? 0x00 : 0x01, /* I/O function */
37 SIO_GPIO_BLINK_GPIO10,
38 IT8772F_GPIO_BLINK_FREQUENCY_1_HZ);
Matt DeVillier89683c02015-12-25 01:15:41 -060039}