blob: f9b9d3b8dbdfca109485a3b7814cda9c1f348d09 [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>
Stefan Reinauere1ae4b22012-04-27 23:20:58 +02006#include <southbridge/intel/bd82x6x/pch.h>
7#include <southbridge/intel/bd82x6x/me.h>
8#include <northbridge/intel/sandybridge/sandybridge.h>
Stefan Reinauere1ae4b22012-04-27 23:20:58 +02009
david80ef7b72015-01-19 17:11:36 +080010/* Include for SIO helper functions */
11#include <superio/ite/it8772f/it8772f.h>
Joel Linnfb516612024-03-29 14:08:35 +010012#define GPIO_DEV PNP_DEV(0x2e, IT8772F_GPIO)
Stefan Reinauere1ae4b22012-04-27 23:20:58 +020013
Stefan Reinauere1ae4b22012-04-27 23:20:58 +020014/*
15 * Change LED_POWER# (SIO GPIO 45) state based on sleep type.
david80ef7b72015-01-19 17:11:36 +080016*/
Stefan Reinauere1ae4b22012-04-27 23:20:58 +020017void mainboard_smi_sleep(u8 slp_typ)
18{
david80ef7b72015-01-19 17:11:36 +080019 printk(BIOS_DEBUG, "SMI: sleep S%d\n", slp_typ);
Stefan Reinauere1ae4b22012-04-27 23:20:58 +020020 switch (slp_typ) {
Aaron Durbin30b0c7a2016-07-13 13:01:13 -050021 case ACPI_S3:
22 case ACPI_S4:
Joel Linnfb516612024-03-29 14:08:35 +010023 it8772f_gpio_led(GPIO_DEV, 4 /* set */, (0x1 << 5) /* select */,
Elyes HAOUASa5aad2e2016-09-19 09:47:16 -060024 (0x1 << 5) /* polarity */, (0x1 << 5) /* 1 = pullup */,
25 (0x1 << 5) /* output */, 0x00, /* 0 = Alternate function */
david80ef7b72015-01-19 17:11:36 +080026 SIO_GPIO_BLINK_GPIO45, IT8772F_GPIO_BLINK_FREQUENCY_1_HZ);
Stefan Reinauere1ae4b22012-04-27 23:20:58 +020027 break;
28
Aaron Durbin30b0c7a2016-07-13 13:01:13 -050029 case ACPI_S5:
Joel Linnfb516612024-03-29 14:08:35 +010030 it8772f_gpio_led(GPIO_DEV, 4 /* set */, (0x1 << 5) /* select */,
Elyes HAOUASa5aad2e2016-09-19 09:47:16 -060031 0x00 /* polarity: non-inverting */, 0x00 /* 0 = pulldown */,
32 (0x1 << 5) /* output */, (0x1 << 5) /* 1 = Simple IO function */,
david80ef7b72015-01-19 17:11:36 +080033 SIO_GPIO_BLINK_GPIO45, IT8772F_GPIO_BLINK_FREQUENCY_1_HZ);
34 break;
35 default:
Stefan Reinauere1ae4b22012-04-27 23:20:58 +020036 break;
37 }
38}