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

Go to the source code of this file.

Macros

#define BANK_SELECT   0x00
 
#define MODE_SELECTION   0x22
 
#define MODE_SELECTION_LTD_EN   (1 << 6)
 
#define MODE_SELECTION_RTDx(x, val)   ((val) << (x) * 2)
 
#define PECI_ENABLE   0x23
 
#define PECI_ENABLE_AGENTx(x)   (1 << (x))
 
#define FAN_ENABLE   0x24
 
#define FANx_ENABLE(fan)   (1 << (fan))
 
#define FAN_CTRL(fan)   (0x60 + (fan))
 
#define CLOSE_LOOP_FAN_RPM_CTRL   0x63
 
#define CLOSE_LOOP_FANx_EN(fan)   (1 << ((fan) + 5))
 
#define CLOSE_LOOP_FANx_HIGH_RPM(fan)   (1 << ((fan) + 2))
 
#define CLOSE_LOOP_FAN_PECI_ERR_MASK   (3 << 0)
 
#define CLOSE_LOOP_FAN_PECI_ERR_CURR   (0 << 0)
 
#define CLOSE_LOOP_FAN_PECI_ERR_VALUE   (1 << 0)
 
#define CLOSE_LOOP_FAN_PECI_ERR_MAX   (2 << 0)
 
#define TEMP_SHIFT(temp)   (((temp) % 2) * 4)
 
#define TEMP_TO_FAN_MAP(temp)   (0x64 + (temp) / 2)
 
#define TEMPx_TO_FAN_MAP_MASK(temp)   (7 << TEMP_SHIFT(temp))
 
#define TEMPx_TO_FANy_MAP(temp, fan)   (1 << (TEMP_SHIFT(temp) + (fan)))
 
#define FAN_CTRL_TEMP_SRC(temp)   (0x68 + (temp) / 2)
 
#define FAN_CTRL_TEMPx_SRC_MASK(temp)   (7 << TEMP_SHIFT(temp))
 
#define FAN_CTRL_TEMPx_SRCy(temp, src)   ((src) << TEMP_SHIFT(temp))
 
#define FAN_DUTY_ON_PECI_ERROR   0x7a
 
#define TABLEx_TEMP_POINTy(fan, pt)   (0x80 + (0x10 * (fan)) + (pt))
 
#define TABLEx_TARGET_POINTy(fan, pt)   (0x85 + (0x10 * (fan)) + (pt))
 
#define PECI_CTRL_1   0x01
 
#define PECI_CTRL_1_EN   (1 << 7)
 
#define PECI_CTRL_1_MANUAL_EN   (1 << 1)
 
#define PECI_CTRL_1_ROUTINE_EN   (1 << 0)
 
#define PECI_CTRL_3   0x03
 
#define PECI_CTRL_3_EN_AGENTx(x)   (1 << ((x) + 4))
 
#define PECI_CTRL_3_HAS_DOM1_AGENTx(x)   (1 << (x))
 
#define PECI_REPORT_TEMP_STYLE   0x04
 
#define PECI_TEMP_STYLE_DOM0_AGENTx(x)   (0 << ((x) + 1))
 
#define PECI_TEMP_STYLE_DOM1_AGENTx(x)   (1 << ((x) + 1))
 
#define PECI_TEMP_STYLE_SINGLE   (0 << 0)
 
#define PECI_TEMP_STYLE_HIGHEST   (1 << 0)
 
#define PECI_BASE_TEMP_AGENT(x)   (0x09 + (x))
 
#define PECI_BASE_TEMP_MAX   (0x7f << 0)
 

Functions

static int nct7802y_select_bank (struct device *const dev, const u8 bank)
 
static int nct7802y_write (struct device *const dev, const u8 reg, const u8 value)
 
static int nct7802y_update (struct device *const dev, const u8 reg, const u8 clear_mask, const u8 set_mask)
 
void nct7802y_init_fan (struct device *dev)
 
void nct7802y_init_peci (struct device *dev)
 

Macro Definition Documentation

◆ BANK_SELECT

#define BANK_SELECT   0x00

Definition at line 11 of file nct7802y.h.

◆ CLOSE_LOOP_FAN_PECI_ERR_CURR

#define CLOSE_LOOP_FAN_PECI_ERR_CURR   (0 << 0)

Definition at line 30 of file nct7802y.h.

◆ CLOSE_LOOP_FAN_PECI_ERR_MASK

#define CLOSE_LOOP_FAN_PECI_ERR_MASK   (3 << 0)

Definition at line 29 of file nct7802y.h.

◆ CLOSE_LOOP_FAN_PECI_ERR_MAX

#define CLOSE_LOOP_FAN_PECI_ERR_MAX   (2 << 0)

Definition at line 32 of file nct7802y.h.

◆ CLOSE_LOOP_FAN_PECI_ERR_VALUE

#define CLOSE_LOOP_FAN_PECI_ERR_VALUE   (1 << 0)

Definition at line 31 of file nct7802y.h.

◆ CLOSE_LOOP_FAN_RPM_CTRL

#define CLOSE_LOOP_FAN_RPM_CTRL   0x63

Definition at line 26 of file nct7802y.h.

◆ CLOSE_LOOP_FANx_EN

#define CLOSE_LOOP_FANx_EN (   fan)    (1 << ((fan) + 5))

Definition at line 27 of file nct7802y.h.

◆ CLOSE_LOOP_FANx_HIGH_RPM

#define CLOSE_LOOP_FANx_HIGH_RPM (   fan)    (1 << ((fan) + 2))

Definition at line 28 of file nct7802y.h.

◆ FAN_CTRL

#define FAN_CTRL (   fan)    (0x60 + (fan))

Definition at line 24 of file nct7802y.h.

◆ FAN_CTRL_TEMP_SRC

#define FAN_CTRL_TEMP_SRC (   temp)    (0x68 + (temp) / 2)

Definition at line 39 of file nct7802y.h.

◆ FAN_CTRL_TEMPx_SRC_MASK

#define FAN_CTRL_TEMPx_SRC_MASK (   temp)    (7 << TEMP_SHIFT(temp))

Definition at line 40 of file nct7802y.h.

◆ FAN_CTRL_TEMPx_SRCy

#define FAN_CTRL_TEMPx_SRCy (   temp,
  src 
)    ((src) << TEMP_SHIFT(temp))

Definition at line 41 of file nct7802y.h.

◆ FAN_DUTY_ON_PECI_ERROR

#define FAN_DUTY_ON_PECI_ERROR   0x7a

Definition at line 43 of file nct7802y.h.

◆ FAN_ENABLE

#define FAN_ENABLE   0x24

Definition at line 21 of file nct7802y.h.

◆ FANx_ENABLE

#define FANx_ENABLE (   fan)    (1 << (fan))

Definition at line 22 of file nct7802y.h.

◆ MODE_SELECTION

#define MODE_SELECTION   0x22

Definition at line 14 of file nct7802y.h.

◆ MODE_SELECTION_LTD_EN

#define MODE_SELECTION_LTD_EN   (1 << 6)

Definition at line 15 of file nct7802y.h.

◆ MODE_SELECTION_RTDx

#define MODE_SELECTION_RTDx (   x,
  val 
)    ((val) << (x) * 2)

Definition at line 16 of file nct7802y.h.

◆ PECI_BASE_TEMP_AGENT

#define PECI_BASE_TEMP_AGENT (   x)    (0x09 + (x))

Definition at line 65 of file nct7802y.h.

◆ PECI_BASE_TEMP_MAX

#define PECI_BASE_TEMP_MAX   (0x7f << 0)

Definition at line 66 of file nct7802y.h.

◆ PECI_CTRL_1

#define PECI_CTRL_1   0x01

Definition at line 50 of file nct7802y.h.

◆ PECI_CTRL_1_EN

#define PECI_CTRL_1_EN   (1 << 7)

Definition at line 51 of file nct7802y.h.

◆ PECI_CTRL_1_MANUAL_EN

#define PECI_CTRL_1_MANUAL_EN   (1 << 1)

Definition at line 52 of file nct7802y.h.

◆ PECI_CTRL_1_ROUTINE_EN

#define PECI_CTRL_1_ROUTINE_EN   (1 << 0)

Definition at line 53 of file nct7802y.h.

◆ PECI_CTRL_3

#define PECI_CTRL_3   0x03

Definition at line 55 of file nct7802y.h.

◆ PECI_CTRL_3_EN_AGENTx

#define PECI_CTRL_3_EN_AGENTx (   x)    (1 << ((x) + 4))

Definition at line 56 of file nct7802y.h.

◆ PECI_CTRL_3_HAS_DOM1_AGENTx

#define PECI_CTRL_3_HAS_DOM1_AGENTx (   x)    (1 << (x))

Definition at line 57 of file nct7802y.h.

◆ PECI_ENABLE

#define PECI_ENABLE   0x23

Definition at line 18 of file nct7802y.h.

◆ PECI_ENABLE_AGENTx

#define PECI_ENABLE_AGENTx (   x)    (1 << (x))

Definition at line 19 of file nct7802y.h.

◆ PECI_REPORT_TEMP_STYLE

#define PECI_REPORT_TEMP_STYLE   0x04

Definition at line 59 of file nct7802y.h.

◆ PECI_TEMP_STYLE_DOM0_AGENTx

#define PECI_TEMP_STYLE_DOM0_AGENTx (   x)    (0 << ((x) + 1))

Definition at line 60 of file nct7802y.h.

◆ PECI_TEMP_STYLE_DOM1_AGENTx

#define PECI_TEMP_STYLE_DOM1_AGENTx (   x)    (1 << ((x) + 1))

Definition at line 61 of file nct7802y.h.

◆ PECI_TEMP_STYLE_HIGHEST

#define PECI_TEMP_STYLE_HIGHEST   (1 << 0)

Definition at line 63 of file nct7802y.h.

◆ PECI_TEMP_STYLE_SINGLE

#define PECI_TEMP_STYLE_SINGLE   (0 << 0)

Definition at line 62 of file nct7802y.h.

◆ TABLEx_TARGET_POINTy

#define TABLEx_TARGET_POINTy (   fan,
  pt 
)    (0x85 + (0x10 * (fan)) + (pt))

Definition at line 46 of file nct7802y.h.

◆ TABLEx_TEMP_POINTy

#define TABLEx_TEMP_POINTy (   fan,
  pt 
)    (0x80 + (0x10 * (fan)) + (pt))

Definition at line 45 of file nct7802y.h.

◆ TEMP_SHIFT

#define TEMP_SHIFT (   temp)    (((temp) % 2) * 4)

Definition at line 34 of file nct7802y.h.

◆ TEMP_TO_FAN_MAP

#define TEMP_TO_FAN_MAP (   temp)    (0x64 + (temp) / 2)

Definition at line 35 of file nct7802y.h.

◆ TEMPx_TO_FAN_MAP_MASK

#define TEMPx_TO_FAN_MAP_MASK (   temp)    (7 << TEMP_SHIFT(temp))

Definition at line 36 of file nct7802y.h.

◆ TEMPx_TO_FANy_MAP

#define TEMPx_TO_FANy_MAP (   temp,
  fan 
)    (1 << (TEMP_SHIFT(temp) + (fan)))

Definition at line 37 of file nct7802y.h.

Function Documentation

◆ nct7802y_init_fan()

◆ nct7802y_init_peci()

◆ nct7802y_select_bank()

static int nct7802y_select_bank ( struct device *const  dev,
const u8  bank 
)
inlinestatic

Definition at line 68 of file nct7802y.h.

References BANK_SELECT, BIOS_NOTICE, CB_SUCCESS, i2c_dev_writeb_at(), and printk.

Referenced by nct7802y_init_fan(), and nct7802y_init_peci().

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

◆ nct7802y_update()

static int nct7802y_update ( struct device *const  dev,
const u8  reg,
const u8  clear_mask,
const u8  set_mask 
)
inlinestatic

Definition at line 82 of file nct7802y.h.

References i2c_dev_readb_at(), i2c_dev_writeb_at(), and val.

Referenced by init_fan(), nct7802y_init_fan(), and nct7802y_init_peci().

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

◆ nct7802y_write()

static int nct7802y_write ( struct device *const  dev,
const u8  reg,
const u8  value 
)
inlinestatic

Definition at line 76 of file nct7802y.h.

References i2c_dev_writeb_at(), and value.

Referenced by init_fan(), nct7802y_init_fan(), nct7802y_init_peci(), and nct7802y_init_sensors().

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