coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
fan_control.h File Reference
#include <stdint.h>
Include dependency graph for fan_control.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  fintek_fan
 

Macros

#define FAN_TYPE_PWM_CHECK   1 /* bit 0 must be 0 for PWM */
 
#define HWM_STATUS_SUCCESS   0
 
#define HWM_STATUS_INVALID_FAN   -1
 
#define HWM_STATUS_INVALID_TEMP_SOURCE   -2
 
#define HWM_STATUS_INVALID_TYPE   -3
 
#define HWM_STATUS_INVALID_MODE   -4
 
#define HWM_STATUS_INVALID_RATE   -5
 
#define HWM_STATUS_INVALID_FREQUENCY   -6
 
#define HWM_STATUS_INVALID_TEMP_SENSOR   -7
 
#define HWM_STATUS_INVALID_BOUNDARY_VALUE   -8
 
#define HWM_STATUS_INVALID_SECTION_VALUE   -9
 
#define HWM_STATUS_BOUNDARY_WRONG_ORDER   -10
 
#define HWM_STATUS_SECTIONS_WRONG_ORDER   -11
 
#define HWM_STATUS_WARNING_SENSOR_DISCONNECTED   1
 
#define HWM_STATUS_WARNING_FAN_NOT_PWM   2
 
#define CPU_DAMAGE_TEMP   110
 
#define FINTEK_BOUNDARIES_SIZE   4
 
#define FINTEK_SECTIONS_SIZE   5
 

Enumerations

enum  external_sensor {
  IGNORE_SENSOR = 0 , EXTERNAL_SENSOR1 , EXTERNAL_SENSOR2 , EXTERNAL_SENSOR3 ,
  EXTERNAL_SENSOR4
}
 
enum  temp_sensor_type { TEMP_SENSOR_THERMISTOR = 0 , TEMP_SENSOR_BJT , TEMP_SENSOR_DEFAULT }
 
enum  fan_type { FAN_TYPE_PWM_PUSH_PULL = 0 , FAN_TYPE_DAC_POWER , FAN_TYPE_PWM_OPEN_DRAIN , FAN_TYPE_RESERVED }
 
enum  fan_mode {
  FAN_MODE_AUTO_RPM = 0 , FAN_MODE_AUTO_PWM_DAC , FAN_MODE_MANUAL_RPM , FAN_MODE_MANUAL_PWM_DAC ,
  FAN_MODE_DEFAULT
}
 
enum  fan_pwm_freq { FAN_PWM_FREQ_23500 = 0 , FAN_PWM_FREQ_11750 , FAN_PWM_FREQ_5875 , FAN_PWM_FREQ_220 }
 
enum  fan_temp_source {
  FAN_TEMP_PECI = 0 , FAN_TEMP_EXTERNAL_1 , FAN_TEMP_EXTERNAL_2 , FAN_TEMP_TSI = 4 ,
  FAN_TEMP_MXM
}
 
enum  fan_rate_up {
  FAN_UP_RATE_2HZ = 0 , FAN_UP_RATE_5HZ , FAN_UP_RATE_10HZ , FAN_UP_RATE_20HZ ,
  FAN_UP_RATE_DEFAULT , FAN_UP_RATE_JUMP = 8
}
 
enum  fan_rate_down {
  FAN_DOWN_RATE_2HZ = 0 , FAN_DOWN_RATE_5HZ , FAN_DOWN_RATE_10HZ , FAN_DOWN_RATE_20HZ ,
  FAN_DOWN_RATE_DEFAULT , FAN_DOWN_RATE_SAME_AS_UP , FAN_DOWN_RATE_JUMP = 8
}
 
enum  fan_follow { FAN_FOLLOW_STEP = 0 , FAN_FOLLOW_INTERPOLATION }
 

Functions

int set_sensor_type (u16 base_address, external_sensor sensor, temp_sensor_type type)
 
int set_fan_temperature_source (u16 base_address, u8 fan, fan_temp_source source)
 
int set_fan_type_mode (u16 base_address, u8 fan, fan_type type, fan_mode mode)
 
int set_pwm_frequency (u16 base_address, u8 fan, fan_pwm_freq frequency)
 
int set_sections (u16 base_address, u8 fan, u8 *boundaries, u8 *sections)
 
int set_fan_speed_change_rate (u16 base_address, u8 fan, fan_rate_up rate_up, fan_rate_down rate_down)
 
int set_fan_follow (u16 base_address, u8 fan, fan_follow follow)
 
int set_fan (struct fintek_fan *fan_init)
 

Macro Definition Documentation

◆ CPU_DAMAGE_TEMP

#define CPU_DAMAGE_TEMP   110

Definition at line 107 of file fan_control.h.

◆ FAN_TYPE_PWM_CHECK

#define FAN_TYPE_PWM_CHECK   1 /* bit 0 must be 0 for PWM */

Definition at line 28 of file fan_control.h.

◆ FINTEK_BOUNDARIES_SIZE

#define FINTEK_BOUNDARIES_SIZE   4

Definition at line 113 of file fan_control.h.

◆ FINTEK_SECTIONS_SIZE

#define FINTEK_SECTIONS_SIZE   5

Definition at line 121 of file fan_control.h.

◆ HWM_STATUS_BOUNDARY_WRONG_ORDER

#define HWM_STATUS_BOUNDARY_WRONG_ORDER   -10

Definition at line 102 of file fan_control.h.

◆ HWM_STATUS_INVALID_BOUNDARY_VALUE

#define HWM_STATUS_INVALID_BOUNDARY_VALUE   -8

Definition at line 100 of file fan_control.h.

◆ HWM_STATUS_INVALID_FAN

#define HWM_STATUS_INVALID_FAN   -1

Definition at line 93 of file fan_control.h.

◆ HWM_STATUS_INVALID_FREQUENCY

#define HWM_STATUS_INVALID_FREQUENCY   -6

Definition at line 98 of file fan_control.h.

◆ HWM_STATUS_INVALID_MODE

#define HWM_STATUS_INVALID_MODE   -4

Definition at line 96 of file fan_control.h.

◆ HWM_STATUS_INVALID_RATE

#define HWM_STATUS_INVALID_RATE   -5

Definition at line 97 of file fan_control.h.

◆ HWM_STATUS_INVALID_SECTION_VALUE

#define HWM_STATUS_INVALID_SECTION_VALUE   -9

Definition at line 101 of file fan_control.h.

◆ HWM_STATUS_INVALID_TEMP_SENSOR

#define HWM_STATUS_INVALID_TEMP_SENSOR   -7

Definition at line 99 of file fan_control.h.

◆ HWM_STATUS_INVALID_TEMP_SOURCE

#define HWM_STATUS_INVALID_TEMP_SOURCE   -2

Definition at line 94 of file fan_control.h.

◆ HWM_STATUS_INVALID_TYPE

#define HWM_STATUS_INVALID_TYPE   -3

Definition at line 95 of file fan_control.h.

◆ HWM_STATUS_SECTIONS_WRONG_ORDER

#define HWM_STATUS_SECTIONS_WRONG_ORDER   -11

Definition at line 103 of file fan_control.h.

◆ HWM_STATUS_SUCCESS

#define HWM_STATUS_SUCCESS   0

Definition at line 92 of file fan_control.h.

◆ HWM_STATUS_WARNING_FAN_NOT_PWM

#define HWM_STATUS_WARNING_FAN_NOT_PWM   2

Definition at line 105 of file fan_control.h.

◆ HWM_STATUS_WARNING_SENSOR_DISCONNECTED

#define HWM_STATUS_WARNING_SENSOR_DISCONNECTED   1

Definition at line 104 of file fan_control.h.

Enumeration Type Documentation

◆ external_sensor

Enumerator
IGNORE_SENSOR 
EXTERNAL_SENSOR1 
EXTERNAL_SENSOR2 
EXTERNAL_SENSOR3 
EXTERNAL_SENSOR4 

Definition at line 8 of file fan_control.h.

◆ fan_follow

enum fan_follow
Enumerator
FAN_FOLLOW_STEP 
FAN_FOLLOW_INTERPOLATION 

Definition at line 72 of file fan_control.h.

◆ fan_mode

enum fan_mode
Enumerator
FAN_MODE_AUTO_RPM 
FAN_MODE_AUTO_PWM_DAC 
FAN_MODE_MANUAL_RPM 
FAN_MODE_MANUAL_PWM_DAC 
FAN_MODE_DEFAULT 

Definition at line 30 of file fan_control.h.

◆ fan_pwm_freq

Enumerator
FAN_PWM_FREQ_23500 
FAN_PWM_FREQ_11750 
FAN_PWM_FREQ_5875 
FAN_PWM_FREQ_220 

Definition at line 38 of file fan_control.h.

◆ fan_rate_down

Enumerator
FAN_DOWN_RATE_2HZ 
FAN_DOWN_RATE_5HZ 
FAN_DOWN_RATE_10HZ 
FAN_DOWN_RATE_20HZ 
FAN_DOWN_RATE_DEFAULT 
FAN_DOWN_RATE_SAME_AS_UP 
FAN_DOWN_RATE_JUMP 

Definition at line 62 of file fan_control.h.

◆ fan_rate_up

Enumerator
FAN_UP_RATE_2HZ 
FAN_UP_RATE_5HZ 
FAN_UP_RATE_10HZ 
FAN_UP_RATE_20HZ 
FAN_UP_RATE_DEFAULT 
FAN_UP_RATE_JUMP 

Definition at line 53 of file fan_control.h.

◆ fan_temp_source

Enumerator
FAN_TEMP_PECI 
FAN_TEMP_EXTERNAL_1 
FAN_TEMP_EXTERNAL_2 
FAN_TEMP_TSI 
FAN_TEMP_MXM 

Definition at line 45 of file fan_control.h.

◆ fan_type

enum fan_type
Enumerator
FAN_TYPE_PWM_PUSH_PULL 
FAN_TYPE_DAC_POWER 
FAN_TYPE_PWM_OPEN_DRAIN 
FAN_TYPE_RESERVED 

Definition at line 22 of file fan_control.h.

◆ temp_sensor_type

Enumerator
TEMP_SENSOR_THERMISTOR 
TEMP_SENSOR_BJT 
TEMP_SENSOR_DEFAULT 

Definition at line 16 of file fan_control.h.

Function Documentation

◆ set_fan()

◆ set_fan_follow()

int set_fan_follow ( u16  base_address,
u8  fan,
fan_follow  follow 
)

Definition at line 338 of file fan_control.c.

References BIOS_DEBUG, FAN_ADJUST, FAN_BIT_MASK, FAN_INTERPOLATION_SHIFT, FAN_TMP_MAPPING, FIRST_FAN, hwm_reg_modify(), HWM_STATUS_INVALID_FAN, HWM_STATUS_SUCCESS, LAST_FAN, message_invalid_1(), and printk.

Referenced by set_fan().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_fan_speed_change_rate()

◆ set_fan_temperature_source()

int set_fan_temperature_source ( u16  base_address,
u8  fan,
fan_temp_source  source 
)

◆ set_fan_type_mode()

int set_fan_type_mode ( u16  base_address,
u8  fan,
fan_type  type,
fan_mode  mode 
)

Definition at line 203 of file fan_control.c.

References BIOS_DEBUG, FAN_MODE_DEFAULT, FAN_MODE_MASK, FAN_MODE_REG, FAN_MODE_SHIFT, FAN_TYPE_MASK, FAN_TYPE_REG, FAN_TYPE_RESERVED, FAN_TYPE_SHIFT, FIRST_FAN, hwm_reg_modify(), HWM_STATUS_INVALID_FAN, HWM_STATUS_SUCCESS, LAST_FAN, message_invalid_1(), printk, select_hwm_bank(), and type.

Referenced by set_fan().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_pwm_frequency()

int set_pwm_frequency ( u16  base_address,
u8  fan,
fan_pwm_freq  frequency 
)

◆ set_sections()

◆ set_sensor_type()