mb/google/nissa: Create pujjogatwin variant
[coreboot2.git] / src / mainboard / amd / pademelon / fan_init.c
bloba2db5eaafca7313880b21bf3683f33f0764599aa
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <bootstate.h>
4 #include <superio/fintek/common/fan_control.h>
5 #include <amdblocks/lpc.h>
6 #include <device/pci_ops.h>
7 #include <soc/pci_devs.h>
9 #define CPU_FAN 1
10 #define SYSTEM_FAN 2
12 /* Boundaries in celsius, sections in percent */
13 static u8 cpu_boudaries[FINTEK_BOUNDARIES_SIZE] = {
14 80,
15 65,
16 50,
20 static u8 system_boudaries[FINTEK_BOUNDARIES_SIZE] = {
21 70,
22 55,
23 40,
27 static u8 cpu_section[FINTEK_SECTIONS_SIZE] = {
28 100,
29 85,
30 70,
31 55,
35 static u8 system_section[FINTEK_SECTIONS_SIZE] = {
36 100,
37 85,
38 70,
39 55,
43 struct fintek_fan cpu_fan = {
44 CPU_FAN,
45 IGNORE_SENSOR,
46 TEMP_SENSOR_DEFAULT,
47 FAN_TEMP_TSI,
48 FAN_TYPE_PWM_PUSH_PULL,
49 FAN_MODE_DEFAULT,
50 FAN_PWM_FREQ_23500,
51 FAN_UP_RATE_10HZ,
52 FAN_DOWN_RATE_10HZ,
53 FAN_FOLLOW_INTERPOLATION,
54 cpu_boudaries,
55 cpu_section
58 struct fintek_fan system_fan = {
59 SYSTEM_FAN,
60 EXTERNAL_SENSOR2,
61 TEMP_SENSOR_BJT,
62 FAN_TEMP_EXTERNAL_2,
63 FAN_TYPE_DAC_POWER,
64 FAN_MODE_DEFAULT,
65 FAN_PWM_FREQ_23500,
66 FAN_UP_RATE_10HZ,
67 FAN_DOWN_RATE_10HZ,
68 FAN_FOLLOW_INTERPOLATION,
69 system_boudaries,
70 system_section
73 static void init_fan_control(void *unused)
75 /* Open a LPC IO access to 0x0220-0x0227 */
76 pci_or_config32(SOC_LPC_DEV, LPC_IO_PORT_DECODE_ENABLE, DECODE_ENABLE_SERIAL_PORT2);
78 set_fan(&cpu_fan);
79 set_fan(&system_fan);
82 BOOT_STATE_INIT_ENTRY(BS_POST_DEVICE, BS_ON_ENTRY, init_fan_control, NULL);