coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
ec.c File Reference
#include <console/console.h>
#include <device/device.h>
#include <device/pnp.h>
#include <ec/acpi/ec.h>
#include <option.h>
#include "ec.h"
#include "chip.h"
Include dependency graph for ec.c:

Go to the source code of this file.

Typedefs

typedef struct ec_kontron_it8516e_config config_t
 

Enumerations

enum  {
  IT8516E_CMD_SET_SYSTEMP_TYPE = 0x06 , IT8516E_CMD_GET_SYSTEMP_TYPE = 0x07 , IT8516E_CMD_GET_FAN_MODE = 0x10 , IT8516E_CMD_SET_FAN_MODE = 0x11 ,
  IT8516E_CMD_GET_FAN_PWM = 0x12 , IT8516E_CMD_SET_FAN_PWM = 0x13 , IT8516E_CMD_GET_FAN_SPEED = 0x14 , IT8516E_CMD_SET_FAN_SPEED = 0x15 ,
  IT8516E_CMD_GET_FAN_TEMP = 0x16 , IT8516E_CMD_SET_FAN_TEMP = 0x17 , IT8516E_CMD_SET_FAN_LIMITS = 0x1a
}
 

Functions

static void it8516e_set_systemp_type (const u8 type)
 Sets the type of the external temperature sensor used. More...
 
static void it8516e_set_fan_mode (const u8 idx, const u8 mode)
 Sets the operating mode of a fan. More...
 
static void it8516e_set_fan_pwm (const u8 idx, const u8 pwm)
 Sets the PWM rate of a fan in IT8516E_MODE_PWM. More...
 
static void it8516e_set_fan_speed (const u8 idx, const u16 speed)
 Sets the target speed in RPM for a fan in IT8516E_MODE_SPEED. More...
 
static void it8516e_set_fan_temperature (const u8 idx, const u16 temp)
 Sets the target temperature for a fan in IT8516E_MODE_THERMAL. More...
 
static void it8516e_set_fan_limits (const u8 idx, const u8 min, const u8 max)
 Sets the minimum and maximum PWM rate of a fan in IT8516E_MODE_THERMAL. More...
 
static void it8516e_set_fan_from_options (const config_t *const config, const u8 fan_idx)
 
static void it8516e_pm2_init (struct device *dev)
 
static void it8516e_enable (struct device *dev)
 

Variables

static struct device_operations it8516e_pm2_ops
 
static struct pnp_info it8516e_dev_infos []
 
const struct chip_operations ec_kontron_it8516e_ops
 

Typedef Documentation

◆ config_t

Definition at line 1 of file ec.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
IT8516E_CMD_SET_SYSTEMP_TYPE 
IT8516E_CMD_GET_SYSTEMP_TYPE 
IT8516E_CMD_GET_FAN_MODE 
IT8516E_CMD_SET_FAN_MODE 
IT8516E_CMD_GET_FAN_PWM 
IT8516E_CMD_SET_FAN_PWM 
IT8516E_CMD_GET_FAN_SPEED 
IT8516E_CMD_SET_FAN_SPEED 
IT8516E_CMD_GET_FAN_TEMP 
IT8516E_CMD_SET_FAN_TEMP 
IT8516E_CMD_SET_FAN_LIMITS 

Definition at line 14 of file ec.c.

Function Documentation

◆ it8516e_enable()

static void it8516e_enable ( struct device dev)
static

Definition at line 235 of file ec.c.

◆ it8516e_pm2_init()

static void it8516e_pm2_init ( struct device dev)
static

Definition at line 196 of file ec.c.

◆ it8516e_set_fan_from_options()

static void it8516e_set_fan_from_options ( const config_t *const  config,
const u8  fan_idx 
)
static

◆ it8516e_set_fan_limits()

static void it8516e_set_fan_limits ( const u8  idx,
const u8  min,
const u8  max 
)
static

Sets the minimum and maximum PWM rate of a fan in IT8516E_MODE_THERMAL.

Parameters
idxSelects the fan; 0: CPU, 1: System
minMinimum PWM rate in %
maxMaximum PWM rate in %

Definition at line 111 of file ec.c.

References IT8516E_CMD_SET_FAN_LIMITS, send_ec_command(), and send_ec_data().

Referenced by it8516e_set_fan_from_options().

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

◆ it8516e_set_fan_mode()

static void it8516e_set_fan_mode ( const u8  idx,
const u8  mode 
)
static

Sets the operating mode of a fan.

Parameters
idxSelects the fan; 0: CPU, 1: System
modeMode to set

Definition at line 46 of file ec.c.

References IT8516E_CMD_SET_FAN_MODE, send_ec_command(), and send_ec_data().

Referenced by it8516e_set_fan_from_options().

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

◆ it8516e_set_fan_pwm()

static void it8516e_set_fan_pwm ( const u8  idx,
const u8  pwm 
)
static

Sets the PWM rate of a fan in IT8516E_MODE_PWM.

Parameters
idxSelects the fan; 0: CPU, 1: System
pwmPWM rate measured in 255ths

Definition at line 61 of file ec.c.

References IT8516E_CMD_SET_FAN_PWM, send_ec_command(), and send_ec_data().

Referenced by it8516e_set_fan_from_options().

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

◆ it8516e_set_fan_speed()

static void it8516e_set_fan_speed ( const u8  idx,
const u16  speed 
)
static

Sets the target speed in RPM for a fan in IT8516E_MODE_SPEED.

Parameters
idxSelects the fan; 0: CPU, 1: System
speedSpeed in RPM

Definition at line 76 of file ec.c.

References IT8516E_CMD_SET_FAN_SPEED, send_ec_command(), and send_ec_data().

Referenced by it8516e_set_fan_from_options().

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

◆ it8516e_set_fan_temperature()

static void it8516e_set_fan_temperature ( const u8  idx,
const u16  temp 
)
static

Sets the target temperature for a fan in IT8516E_MODE_THERMAL.

Parameters
idxSelects the fan; 0: CPU, 1: System
tempTemperature in 64ths degree C

Definition at line 93 of file ec.c.

References IT8516E_CMD_SET_FAN_TEMP, send_ec_command(), and send_ec_data().

Referenced by it8516e_set_fan_from_options().

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

◆ it8516e_set_systemp_type()

static void it8516e_set_systemp_type ( const u8  type)
static

Sets the type of the external temperature sensor used.

Parameters
typeType of sensor to set

Definition at line 33 of file ec.c.

References IT8516E_CMD_SET_SYSTEMP_TYPE, send_ec_command(), send_ec_data(), and type.

Here is the call graph for this function:

Variable Documentation

◆ ec_kontron_it8516e_ops

const struct chip_operations ec_kontron_it8516e_ops
Initial value:
= {
.enable_dev = it8516e_enable
}
static void it8516e_enable(struct device *dev)
Definition: ec.c:235

Definition at line 235 of file ec.c.

◆ it8516e_dev_infos

struct pnp_info it8516e_dev_infos[]
static
Initial value:
= {
{ NULL, IT8516E_LDN_KBD, PNP_IO0 | PNP_IO1 | PNP_IRQ0, 0x07ff, 0x07ff, },
{ NULL, IT8516E_LDN_BRAM, PNP_IO0 | PNP_IO1, 0xfffe, 0xfffe, },
{ NULL, IT8516E_LDN_PM1, PNP_IO0 | PNP_IO1 | PNP_IRQ0, 0x07ff, 0x07ff, },
{ NULL, IT8516E_LDN_PM3, PNP_IO0 | PNP_IO1 | PNP_IRQ0, 0x07ff, 0x07ff, },
}
static struct device_operations it8516e_pm2_ops
Definition: ec.c:214
@ IT8516E_LDN_SWUC
Definition: ec.h:9
@ IT8516E_LDN_PM3
Definition: ec.h:16
@ IT8516E_LDN_PM2
Definition: ec.h:15
@ IT8516E_LDN_UART2
Definition: ec.h:8
@ IT8516E_LDN_SMFI
Definition: ec.h:12
@ IT8516E_LDN_UART1
Definition: ec.h:7
@ IT8516E_LDN_PM1
Definition: ec.h:14
@ IT8516E_LDN_MOUSE
Definition: ec.h:10
@ IT8516E_LDN_BRAM
Definition: ec.h:13
@ IT8516E_LDN_KBD
Definition: ec.h:11
#define PNP_IO1
Definition: pnp.h:43
#define PNP_IO0
Definition: pnp.h:42
#define PNP_IRQ0
Definition: pnp.h:47
#define NULL
Definition: stddef.h:19

Definition at line 196 of file ec.c.

◆ it8516e_pm2_ops

struct device_operations it8516e_pm2_ops
static
Initial value:
= {
.read_resources = pnp_read_resources,
.set_resources = pnp_set_resources,
.enable_resources = pnp_enable_resources,
.enable = pnp_enable,
}
static void it8516e_pm2_init(struct device *dev)
Definition: ec.c:196
void pnp_enable(struct device *dev)
Definition: pnp_device.c:181
void pnp_read_resources(struct device *dev)
Definition: pnp_device.c:114
void pnp_set_resources(struct device *dev)
Definition: pnp_device.c:157
void pnp_enable_resources(struct device *dev)
Definition: pnp_device.c:173

Definition at line 196 of file ec.c.