mb/google/nissa/var/telith: Configure Acoustic noise mitigation
[coreboot.git] / src / mainboard / asrock / fatal1ty_z87_professional / smihandler.c
blob6736c15bcd9ff5cdefc4329bb427ab52b0859c85
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <cpu/x86/smm.h>
4 #include <device/pnp_ops.h>
5 #include <southbridge/intel/lynxpoint/pch.h>
6 #include <superio/nuvoton/common/nuvoton.h>
7 #include <superio/nuvoton/nct6776/nct6776.h>
9 #define GPIO1_DEV PNP_DEV(0x2e, NCT6776_WDT1_GPIO01A_V)
10 #define NUVOTON_ENTRY_KEY 0x87
11 #define NUVOTON_EXIT_KEY 0xAA
13 /* Enable configuration: pass entry key '0x87' into index port dev
14 * two times. */
15 void nuvoton_pnp_enter_conf_state(pnp_devfn_t dev)
17 u16 port = dev >> 8;
18 outb(NUVOTON_ENTRY_KEY, port);
19 outb(NUVOTON_ENTRY_KEY, port);
22 /* Disable configuration: pass exit key '0xAA' into index port dev. */
23 void nuvoton_pnp_exit_conf_state(pnp_devfn_t dev)
25 u16 port = dev >> 8;
26 outb(NUVOTON_EXIT_KEY, port);
29 void mainboard_smi_sleep(u8 slp_typ)
32 * Cut off power to LEDs when system goes to sleep.
34 if (slp_typ >= ACPI_S3) {
36 nuvoton_pnp_enter_conf_state(GPIO1_DEV);
38 pnp_set_logical_device(GPIO1_DEV);
40 pnp_write_config(GPIO1_DEV, 0xf0, 0xff);
41 pnp_write_config(GPIO1_DEV, 0xf1, 0xff);
43 nuvoton_pnp_exit_conf_state(GPIO1_DEV);