Angel Pons | d32b6de | 2020-04-03 01:23:13 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 2 | |
Furquan Shaikh | 76cedd2 | 2020-05-02 10:24:23 -0700 | [diff] [blame] | 3 | #include <acpi/acpi.h> |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 4 | #include <console/console.h> |
| 5 | #include <cpu/x86/smm.h> |
Kyösti Mälkki | 661ad46 | 2020-12-29 06:26:21 +0200 | [diff] [blame] | 6 | #include <soc/nvs.h> |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 7 | #include <southbridge/intel/bd82x6x/pch.h> |
| 8 | #include <southbridge/intel/bd82x6x/me.h> |
| 9 | #include <northbridge/intel/sandybridge/sandybridge.h> |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 10 | |
david | 80ef7b7 | 2015-01-19 17:11:36 +0800 | [diff] [blame] | 11 | /* Include for SIO helper functions */ |
| 12 | #include <superio/ite/it8772f/it8772f.h> |
Elyes HAOUAS | f5f1b38 | 2018-04-26 09:43:03 +0200 | [diff] [blame] | 13 | #define SUPERIO_DEV PNP_DEV(0x2e, 0) |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 14 | |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 15 | /* |
| 16 | * Change LED_POWER# (SIO GPIO 45) state based on sleep type. |
david | 80ef7b7 | 2015-01-19 17:11:36 +0800 | [diff] [blame] | 17 | */ |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 18 | void mainboard_smi_sleep(u8 slp_typ) |
| 19 | { |
david | 80ef7b7 | 2015-01-19 17:11:36 +0800 | [diff] [blame] | 20 | printk(BIOS_DEBUG, "SMI: sleep S%d\n", slp_typ); |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 21 | switch (slp_typ) { |
Aaron Durbin | 30b0c7a | 2016-07-13 13:01:13 -0500 | [diff] [blame] | 22 | case ACPI_S3: |
| 23 | case ACPI_S4: |
Elyes HAOUAS | f5f1b38 | 2018-04-26 09:43:03 +0200 | [diff] [blame] | 24 | it8772f_gpio_led(SUPERIO_DEV, 4 /* set */, (0x1 << 5) /* select */, |
Elyes HAOUAS | a5aad2e | 2016-09-19 09:47:16 -0600 | [diff] [blame] | 25 | (0x1 << 5) /* polarity */, (0x1 << 5) /* 1 = pullup */, |
| 26 | (0x1 << 5) /* output */, 0x00, /* 0 = Alternate function */ |
david | 80ef7b7 | 2015-01-19 17:11:36 +0800 | [diff] [blame] | 27 | SIO_GPIO_BLINK_GPIO45, IT8772F_GPIO_BLINK_FREQUENCY_1_HZ); |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 28 | break; |
| 29 | |
Aaron Durbin | 30b0c7a | 2016-07-13 13:01:13 -0500 | [diff] [blame] | 30 | case ACPI_S5: |
Elyes HAOUAS | f5f1b38 | 2018-04-26 09:43:03 +0200 | [diff] [blame] | 31 | it8772f_gpio_led(SUPERIO_DEV, 4 /* set */, (0x1 << 5) /* select */, |
Elyes HAOUAS | a5aad2e | 2016-09-19 09:47:16 -0600 | [diff] [blame] | 32 | 0x00 /* polarity: non-inverting */, 0x00 /* 0 = pulldown */, |
| 33 | (0x1 << 5) /* output */, (0x1 << 5) /* 1 = Simple IO function */, |
david | 80ef7b7 | 2015-01-19 17:11:36 +0800 | [diff] [blame] | 34 | SIO_GPIO_BLINK_GPIO45, IT8772F_GPIO_BLINK_FREQUENCY_1_HZ); |
| 35 | break; |
| 36 | default: |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 37 | break; |
| 38 | } |
| 39 | } |