Matt DeVillier | 89683c0 | 2015-12-25 01:15:41 -0600 | [diff] [blame] | 1 | /* |
| 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 DeVillier | 89683c0 | 2015-12-25 01:15:41 -0600 | [diff] [blame] | 17 | #include <superio/ite/it8772f/it8772f.h> |
| 18 | #include "onboard.h" |
| 19 | |
Matt DeVillier | 7c6951b | 2016-12-06 17:59:23 -0600 | [diff] [blame] | 20 | void set_power_led(int state) |
Matt DeVillier | 89683c0 | 2015-12-25 01:15:41 -0600 | [diff] [blame] | 21 | { |
Matt DeVillier | aaa4ae76 | 2017-01-26 10:58:15 -0600 | [diff] [blame] | 22 | 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 DeVillier | 7c6951b | 2016-12-06 17:59:23 -0600 | [diff] [blame] | 30 | it8772f_gpio_led(IT8772F_GPIO_DEV, |
Elyes HAOUAS | 808fc8e | 2018-05-28 13:30:59 +0200 | [diff] [blame] | 31 | 1, /* set */ |
| 32 | 0x01, /* select */ |
Matt DeVillier | aaa4ae76 | 2017-01-26 10:58:15 -0600 | [diff] [blame] | 33 | polarity, /* polarity */ |
Matt DeVillier | 7c6951b | 2016-12-06 17:59:23 -0600 | [diff] [blame] | 34 | state == LED_BLINK ? 0x01 : 0x00, /* pullup/pulldown */ |
Elyes HAOUAS | 808fc8e | 2018-05-28 13:30:59 +0200 | [diff] [blame] | 35 | 0x01, /* output */ |
Matt DeVillier | 7c6951b | 2016-12-06 17:59:23 -0600 | [diff] [blame] | 36 | state == LED_BLINK ? 0x00 : 0x01, /* I/O function */ |
| 37 | SIO_GPIO_BLINK_GPIO10, |
| 38 | IT8772F_GPIO_BLINK_FREQUENCY_1_HZ); |
Matt DeVillier | 89683c0 | 2015-12-25 01:15:41 -0600 | [diff] [blame] | 39 | } |