blob: 2477a58b97cf69002359c0fc8cfa37b41f42fe25 [file] [log] [blame]
Angel Ponsd32b6de2020-04-03 01:23:13 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Stefan Reinauere1ae4b22012-04-27 23:20:58 +02002
Furquan Shaikh76cedd22020-05-02 10:24:23 -07003#include <acpi/acpi.h>
Stefan Reinauere1ae4b22012-04-27 23:20:58 +02004#include <console/console.h>
5#include <cpu/x86/smm.h>
Kyösti Mälkki661ad462020-12-29 06:26:21 +02006#include <soc/nvs.h>
Stefan Reinauere1ae4b22012-04-27 23:20:58 +02007#include <southbridge/intel/bd82x6x/pch.h>
8#include <southbridge/intel/bd82x6x/me.h>
9#include <northbridge/intel/sandybridge/sandybridge.h>
Stefan Reinauere1ae4b22012-04-27 23:20:58 +020010
david80ef7b72015-01-19 17:11:36 +080011/* Include for SIO helper functions */
12#include <superio/ite/it8772f/it8772f.h>
Elyes HAOUASf5f1b382018-04-26 09:43:03 +020013#define SUPERIO_DEV PNP_DEV(0x2e, 0)
Stefan Reinauere1ae4b22012-04-27 23:20:58 +020014
Stefan Reinauere1ae4b22012-04-27 23:20:58 +020015/*
16 * Change LED_POWER# (SIO GPIO 45) state based on sleep type.
david80ef7b72015-01-19 17:11:36 +080017*/
Stefan Reinauere1ae4b22012-04-27 23:20:58 +020018void mainboard_smi_sleep(u8 slp_typ)
19{
david80ef7b72015-01-19 17:11:36 +080020 printk(BIOS_DEBUG, "SMI: sleep S%d\n", slp_typ);
Stefan Reinauere1ae4b22012-04-27 23:20:58 +020021 switch (slp_typ) {
Aaron Durbin30b0c7a2016-07-13 13:01:13 -050022 case ACPI_S3:
23 case ACPI_S4:
Elyes HAOUASf5f1b382018-04-26 09:43:03 +020024 it8772f_gpio_led(SUPERIO_DEV, 4 /* set */, (0x1 << 5) /* select */,
Elyes HAOUASa5aad2e2016-09-19 09:47:16 -060025 (0x1 << 5) /* polarity */, (0x1 << 5) /* 1 = pullup */,
26 (0x1 << 5) /* output */, 0x00, /* 0 = Alternate function */
david80ef7b72015-01-19 17:11:36 +080027 SIO_GPIO_BLINK_GPIO45, IT8772F_GPIO_BLINK_FREQUENCY_1_HZ);
Stefan Reinauere1ae4b22012-04-27 23:20:58 +020028 break;
29
Aaron Durbin30b0c7a2016-07-13 13:01:13 -050030 case ACPI_S5:
Elyes HAOUASf5f1b382018-04-26 09:43:03 +020031 it8772f_gpio_led(SUPERIO_DEV, 4 /* set */, (0x1 << 5) /* select */,
Elyes HAOUASa5aad2e2016-09-19 09:47:16 -060032 0x00 /* polarity: non-inverting */, 0x00 /* 0 = pulldown */,
33 (0x1 << 5) /* output */, (0x1 << 5) /* 1 = Simple IO function */,
david80ef7b72015-01-19 17:11:36 +080034 SIO_GPIO_BLINK_GPIO45, IT8772F_GPIO_BLINK_FREQUENCY_1_HZ);
35 break;
36 default:
Stefan Reinauere1ae4b22012-04-27 23:20:58 +020037 break;
38 }
39}