coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
dptx_hal.c File Reference
#include <console/console.h>
#include <device/mmio.h>
#include <delay.h>
#include <edid.h>
#include <soc/dptx.h>
#include <soc/dptx_hal.h>
#include <soc/dptx_reg.h>
#include <types.h>
Include dependency graph for dptx_hal.c:

Go to the source code of this file.

Data Structures

struct  shift_mask
 

Macros

#define REG_OFFSET_LIMIT   0x8000
 

Functions

u32 mtk_dp_read (struct mtk_dp *mtk_dp, u32 offset)
 
void mtk_dp_write (struct mtk_dp *mtk_dp, u32 offset, u32 val)
 
void mtk_dp_mask (struct mtk_dp *mtk_dp, u32 offset, u32 val, u32 mask)
 
void mtk_dp_write_byte (struct mtk_dp *mtk_dp, u32 addr, u8 val, u32 mask)
 
void dptx_hal_verify_clock (struct mtk_dp *mtk_dp)
 
void dptx_hal_init_setting (struct mtk_dp *mtk_dp)
 
void dptx_hal_bypassmsa_en (struct mtk_dp *mtk_dp, bool enable)
 
void dptx_hal_set_msa (struct mtk_dp *mtk_dp)
 
void dptx_hal_set_color_format (struct mtk_dp *mtk_dp, u8 out_format)
 
void dptx_hal_set_color_depth (struct mtk_dp *mtk_dp, u8 color_depth)
 
void dptx_hal_setmisc (struct mtk_dp *mtk_dp, u8 cmisc[2])
 
void dptx_hal_overwrite_mn (struct mtk_dp *mtk_dp, bool enable, u32 video_m, u32 video_n)
 
u8 dptx_hal_get_colorbpp (struct mtk_dp *mtk_dp)
 
void dptx_hal_settu_sramrd_start (struct mtk_dp *mtk_dp, u16 value)
 
void dptx_hal_setsdp_downcnt_init_inhblanking (struct mtk_dp *mtk_dp, u16 value)
 
void dptx_hal_setsdp_downcnt_init (struct mtk_dp *mtk_dp, u16 value)
 
void dptx_hal_settu_setencoder (struct mtk_dp *mtk_dp)
 
bool dptx_hal_hpd_high (struct mtk_dp *mtk_dp)
 
bool dptx_hal_auxread_bytes (struct mtk_dp *mtk_dp, u8 cmd, u32 dpcd_addr, size_t length, u8 *rx_buf)
 
bool dptx_hal_auxwrite_bytes (struct mtk_dp *mtk_dp, u8 cmd, u32 dpcd_addr, size_t length, u8 *data)
 
bool dptx_hal_setswing_preemphasis (struct mtk_dp *mtk_dp, int lane_num, int swing_value, int preemphasis)
 
void dptx_hal_reset_swing_preemphasis (struct mtk_dp *mtk_dp)
 
void dptx_hal_hpd_int_en (struct mtk_dp *mtk_dp, bool enable)
 
void dptx_hal_hpd_detect_setting (struct mtk_dp *mtk_dp)
 
void dptx_hal_phy_setting (struct mtk_dp *mtk_dp)
 
void dptx_hal_ssc_en (struct mtk_dp *mtk_dp, bool enable)
 
void dptx_hal_aux_setting (struct mtk_dp *mtk_dp)
 
void dptx_hal_digital_setting (struct mtk_dp *mtk_dp)
 
void dptx_hal_digital_swreset (struct mtk_dp *mtk_dp)
 
void dptx_hal_phyd_reset (struct mtk_dp *mtk_dp)
 
void dptx_hal_set_txlane (struct mtk_dp *mtk_dp, int value)
 
void dptx_hal_set_txrate (struct mtk_dp *mtk_dp, int value)
 
void dptx_hal_set_txtrainingpattern (struct mtk_dp *mtk_dp, int value)
 
void dptx_hal_phy_setidlepattern (struct mtk_dp *mtk_dp, bool enable)
 
void dptx_hal_set_ef_mode (struct mtk_dp *mtk_dp, bool enable)
 
void dptx_hal_setscramble (struct mtk_dp *mtk_dp, bool enable)
 
void dptx_hal_videomute (struct mtk_dp *mtk_dp, bool enable)
 
void dptx_hal_analog_power_en (struct mtk_dp *mtk_dp, bool enable)
 

Variables

static const struct shift_mask volt_swing [DPTX_LANE_MAX]
 
static const struct shift_mask volt_preemphasis [DPTX_LANE_MAX]
 

Macro Definition Documentation

◆ REG_OFFSET_LIMIT

#define REG_OFFSET_LIMIT   0x8000

Definition at line 12 of file dptx_hal.c.

Function Documentation

◆ dptx_hal_analog_power_en()

void dptx_hal_analog_power_en ( struct mtk_dp mtk_dp,
bool  enable 
)

Definition at line 810 of file dptx_hal.c.

References BIT, DP_TX_TOP_RESET_AND_PROBE, DP_WRITE2BYTE, mdelay(), mtk_dp_write_byte(), and TOP_OFFSET.

Referenced by dptx_init_port().

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

◆ dptx_hal_aux_setting()

void dptx_hal_aux_setting ( struct mtk_dp mtk_dp)

◆ dptx_hal_auxread_bytes()

◆ dptx_hal_auxwrite_bytes()

◆ dptx_hal_bypassmsa_en()

void dptx_hal_bypassmsa_en ( struct mtk_dp mtk_dp,
bool  enable 
)

Definition at line 110 of file dptx_hal.c.

References mtk_dp_mask(), and REG_3030_DP_ENCODER0_P0.

Referenced by dptx_set_dptxout().

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

◆ dptx_hal_digital_setting()

void dptx_hal_digital_setting ( struct mtk_dp mtk_dp)

◆ dptx_hal_digital_swreset()

void dptx_hal_digital_swreset ( struct mtk_dp mtk_dp)

Definition at line 693 of file dptx_hal.c.

References BIT, mdelay(), mtk_dp_write_byte(), and REG_340C_DP_TRANS_P0.

Referenced by dptx_init_port().

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

◆ dptx_hal_get_colorbpp()

u8 dptx_hal_get_colorbpp ( struct mtk_dp mtk_dp)

◆ dptx_hal_hpd_detect_setting()

void dptx_hal_hpd_detect_setting ( struct mtk_dp mtk_dp)

Definition at line 597 of file dptx_hal.c.

References DP_WRITE1BYTE, GENMASK, mtk_dp_write_byte(), REG_3410_DP_TRANS_P0, and REG_3430_DP_TRANS_P0.

Referenced by dptx_init_port().

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

◆ dptx_hal_hpd_high()

bool dptx_hal_hpd_high ( struct mtk_dp mtk_dp)

Definition at line 348 of file dptx_hal.c.

References BIT, mtk_dp_read(), and REG_3414_DP_TRANS_P0.

Referenced by mtk_edp_init().

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

◆ dptx_hal_hpd_int_en()

void dptx_hal_hpd_int_en ( struct mtk_dp mtk_dp,
bool  enable 
)

Definition at line 590 of file dptx_hal.c.

References GENMASK, mtk_dp_write_byte(), and REG_3418_DP_TRANS_P0.

Referenced by dptx_init_port().

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

◆ dptx_hal_init_setting()

void dptx_hal_init_setting ( struct mtk_dp mtk_dp)

Definition at line 101 of file dptx_hal.c.

References BIT, DP_TX_TOP_IRQ_MASK, DP_WRITE1BYTE, mtk_dp_mask(), REG_304C_DP_ENCODER0_P0, REG_31EC_DP_ENCODER0_P0, REG_342C_DP_TRANS_P0, and REG_3540_DP_TRANS_P0.

Referenced by dptx_init_port().

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

◆ dptx_hal_overwrite_mn()

void dptx_hal_overwrite_mn ( struct mtk_dp mtk_dp,
bool  enable,
u32  video_m,
u32  video_n 
)

Definition at line 231 of file dptx_hal.c.

References BIT, DP_WRITE1BYTE, DP_WRITE2BYTE, mtk_dp_write_byte(), REG_3004_DP_ENCODER0_P0, REG_3008_DP_ENCODER0_P0, REG_300C_DP_ENCODER0_P0, REG_3044_DP_ENCODER0_P0, REG_3048_DP_ENCODER0_P0, REG_3050_DP_ENCODER0_P0, and REG_3054_DP_ENCODER0_P0.

Referenced by dptx_video_config().

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

◆ dptx_hal_phy_setidlepattern()

void dptx_hal_phy_setidlepattern ( struct mtk_dp mtk_dp,
bool  enable 
)

Definition at line 763 of file dptx_hal.c.

References mtk_dp_write_byte(), and REG_3580_DP_TRANS_P0.

Referenced by dptx_hal_set_txtrainingpattern(), and dptx_init_port().

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

◆ dptx_hal_phy_setting()

void dptx_hal_phy_setting ( struct mtk_dp mtk_dp)

Definition at line 608 of file dptx_hal.c.

References BIT, DP_PWR_STATE_FLDMASK, DP_PWR_STATE_FLDMASK_POS, DP_TX_TOP_PWR_STATE, mtk_dp_mask(), and mtk_dp_write().

Referenced by dptx_init_port().

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

◆ dptx_hal_phyd_reset()

void dptx_hal_phyd_reset ( struct mtk_dp mtk_dp)

Definition at line 700 of file dptx_hal.c.

References BIT, mdelay(), and mtk_dp_write_byte().

Referenced by dptx_training_changemode().

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

◆ dptx_hal_reset_swing_preemphasis()

void dptx_hal_reset_swing_preemphasis ( struct mtk_dp mtk_dp)

Definition at line 578 of file dptx_hal.c.

References DP_TX_TOP_SWING_EMP, DPTX_LANE_MAX, mask, mtk_dp_mask(), volt_preemphasis, and volt_swing.

Referenced by dptx_training_changemode().

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

◆ dptx_hal_set_color_depth()

void dptx_hal_set_color_depth ( struct mtk_dp mtk_dp,
u8  color_depth 
)

Definition at line 196 of file dptx_hal.c.

References DP_COLOR_DEPTH_10BIT, DP_COLOR_DEPTH_12BIT, DP_COLOR_DEPTH_16BIT, DP_COLOR_DEPTH_6BIT, DP_COLOR_DEPTH_8BIT, mtk_dp_write_byte(), REG_3034_DP_ENCODER0_P0, REG_303C_DP_ENCODER0_P0, and val.

Referenced by dptx_hal_digital_setting(), and dptx_set_color_depth().

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

◆ dptx_hal_set_color_format()

void dptx_hal_set_color_format ( struct mtk_dp mtk_dp,
u8  out_format 
)

Definition at line 171 of file dptx_hal.c.

References BIT, DP_COLOR_FORMAT_RGB_444, DP_COLOR_FORMAT_YUV_420, DP_COLOR_FORMAT_YUV_422, DP_COLOR_FORMAT_YUV_444, GENMASK, mtk_dp_write_byte(), REG_3034_DP_ENCODER0_P0, and REG_303C_DP_ENCODER0_P0.

Referenced by dptx_hal_digital_setting(), and dptx_set_color_format().

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

◆ dptx_hal_set_ef_mode()

void dptx_hal_set_ef_mode ( struct mtk_dp mtk_dp,
bool  enable 
)

Definition at line 769 of file dptx_hal.c.

References BIT, mtk_dp_write_byte(), and REG_3000_DP_ENCODER0_P0.

Referenced by dptx_trainingflow().

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

◆ dptx_hal_set_msa()

◆ dptx_hal_set_txlane()

void dptx_hal_set_txlane ( struct mtk_dp mtk_dp,
int  value 
)

Definition at line 707 of file dptx_hal.c.

References BIOS_ERR, BIT, mtk_dp_write_byte(), printk, REG_3000_DP_ENCODER0_P0, REG_34A4_DP_TRANS_P0, REG_35F0_DP_TRANS_P0, UINT8_MAX, and value.

Referenced by dptx_trainingflow().

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

◆ dptx_hal_set_txrate()

void dptx_hal_set_txrate ( struct mtk_dp mtk_dp,
int  value 
)

Definition at line 726 of file dptx_hal.c.

References BIOS_ERR, DP_LINKRATE_HBR, DP_LINKRATE_HBR2, DP_LINKRATE_HBR3, DP_LINKRATE_RBR, mtk_dp_write(), printk, and value.

Referenced by dptx_trainingflow().

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

◆ dptx_hal_set_txtrainingpattern()

void dptx_hal_set_txtrainingpattern ( struct mtk_dp mtk_dp,
int  value 
)

Definition at line 753 of file dptx_hal.c.

References BIT, dptx_hal_phy_setidlepattern(), GENMASK, mtk_dp_write_byte(), REG_3400_DP_TRANS_P0, and value.

Referenced by dptx_train_tps1(), dptx_train_tps2_3(), and dptx_trainingflow().

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

◆ dptx_hal_setmisc()

void dptx_hal_setmisc ( struct mtk_dp mtk_dp,
u8  cmisc[2] 
)

Definition at line 225 of file dptx_hal.c.

References mtk_dp_write_byte(), and REG_3034_DP_ENCODER0_P0.

Referenced by dptx_set_misc().

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

◆ dptx_hal_setscramble()

void dptx_hal_setscramble ( struct mtk_dp mtk_dp,
bool  enable 
)

Definition at line 783 of file dptx_hal.c.

References BIT, mtk_dp_write_byte(), and REG_3404_DP_TRANS_P0.

Referenced by dptx_train_tps1(), and dptx_trainingflow().

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

◆ dptx_hal_setsdp_downcnt_init()

void dptx_hal_setsdp_downcnt_init ( struct mtk_dp mtk_dp,
u16  value 
)

Definition at line 330 of file dptx_hal.c.

References mtk_dp_mask(), REG_3040_DP_ENCODER0_P0, and value.

Referenced by dptx_setsdp_downcnt_init().

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

◆ dptx_hal_setsdp_downcnt_init_inhblanking()

void dptx_hal_setsdp_downcnt_init_inhblanking ( struct mtk_dp mtk_dp,
u16  value 
)

Definition at line 324 of file dptx_hal.c.

References mtk_dp_mask(), REG_3364_DP_ENCODER1_P0, and value.

Referenced by dptx_setsdp_downcnt_init_inhblanking().

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

◆ dptx_hal_setswing_preemphasis()

bool dptx_hal_setswing_preemphasis ( struct mtk_dp mtk_dp,
int  lane_num,
int  swing_value,
int  preemphasis 
)

Definition at line 558 of file dptx_hal.c.

References BIOS_DEBUG, BIOS_ERR, DP_TX_TOP_SWING_EMP, DPTX_LANE_MAX, mask, mtk_dp_mask(), printk, volt_preemphasis, and volt_swing.

Referenced by dptx_training_checkswingpre().

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

◆ dptx_hal_settu_setencoder()

void dptx_hal_settu_setencoder ( struct mtk_dp mtk_dp)

Definition at line 335 of file dptx_hal.c.

References BIT, DP_WRITE2BYTE, mtk_dp_mask(), mtk_dp_write_byte(), REG_303C_DP_ENCODER0_P0, REG_3040_DP_ENCODER0_P0, REG_3300_DP_ENCODER1_P0, REG_3364_DP_ENCODER1_P0, and REG_3368_DP_ENCODER1_P0.

Referenced by dptx_set_tu().

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

◆ dptx_hal_settu_sramrd_start()

void dptx_hal_settu_sramrd_start ( struct mtk_dp mtk_dp,
u16  value 
)

Definition at line 315 of file dptx_hal.c.

References mtk_dp_write_byte(), REG_303C_DP_ENCODER0_P0, and value.

Referenced by dptx_set_tu().

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

◆ dptx_hal_ssc_en()

void dptx_hal_ssc_en ( struct mtk_dp mtk_dp,
bool  enable 
)

Definition at line 643 of file dptx_hal.c.

References BIT, GENMASK, mdelay(), and mtk_dp_mask().

Referenced by dptx_training_changemode().

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

◆ dptx_hal_verify_clock()

void dptx_hal_verify_clock ( struct mtk_dp mtk_dp)

Definition at line 87 of file dptx_hal.c.

References BIOS_DEBUG, dptx_training_info::linkrate, m, mtk_dp_read(), printk, REG_33C8_DP_ENCODER1_P0, and mtk_dp::train_info.

Referenced by dptx_video_enable().

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

◆ dptx_hal_videomute()

void dptx_hal_videomute ( struct mtk_dp mtk_dp,
bool  enable 
)

Definition at line 794 of file dptx_hal.c.

References BIOS_DEBUG, BIT, DP_TX_SECURE_REG11, mtk_dp_write_byte(), printk, read32(), REG_3000_DP_ENCODER0_P0, and mtk_dp::regs.

Referenced by dptx_videomute().

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

◆ mtk_dp_mask()

◆ mtk_dp_read()

u32 mtk_dp_read ( struct mtk_dp mtk_dp,
u32  offset 
)

Definition at line 31 of file dptx_hal.c.

References addr, BIOS_ERR, offset, printk, read32(), REG_OFFSET_LIMIT, and mtk_dp::regs.

Referenced by dptx_hal_auxread_bytes(), dptx_hal_auxwrite_bytes(), dptx_hal_hpd_high(), and dptx_hal_verify_clock().

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

◆ mtk_dp_write()

void mtk_dp_write ( struct mtk_dp mtk_dp,
u32  offset,
u32  val 
)

Definition at line 44 of file dptx_hal.c.

References addr, BIOS_ERR, offset, printk, REG_OFFSET_LIMIT, mtk_dp::regs, val, and write32().

Referenced by dptx_hal_phy_setting(), dptx_hal_set_txrate(), and mtk_dp_write_byte().

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

◆ mtk_dp_write_byte()

Variable Documentation

◆ volt_preemphasis

const struct shift_mask volt_preemphasis[DPTX_LANE_MAX]
static
Initial value:
= {
}
@ DPTX_LANE1
Definition: dptx_hal.h:25
@ DPTX_LANE0
Definition: dptx_hal.h:24
@ DPTX_LANE3
Definition: dptx_hal.h:27
@ DPTX_LANE2
Definition: dptx_hal.h:26
#define DP_TX2_PRE_EMPH_FLDMASK_POS
Definition: dptx_reg.h:4199
#define DP_TX3_PRE_EMPH_FLDMASK_POS
Definition: dptx_reg.h:4211
#define DP_TX2_PRE_EMPH_FLDMASK
Definition: dptx_reg.h:4198
#define DP_TX3_PRE_EMPH_FLDMASK
Definition: dptx_reg.h:4210
#define DP_TX1_PRE_EMPH_FLDMASK
Definition: dptx_reg.h:4186
#define DP_TX0_PRE_EMPH_FLDMASK
Definition: dptx_reg.h:4174
#define DP_TX1_PRE_EMPH_FLDMASK_POS
Definition: dptx_reg.h:4187
#define DP_TX0_PRE_EMPH_FLDMASK_POS
Definition: dptx_reg.h:4175

Definition at line 1 of file dptx_hal.c.

Referenced by dptx_hal_reset_swing_preemphasis(), and dptx_hal_setswing_preemphasis().

◆ volt_swing

const struct shift_mask volt_swing[DPTX_LANE_MAX]
static
Initial value:
= {
}
#define DP_TX0_VOLT_SWING_FLDMASK
Definition: dptx_reg.h:4170
#define DP_TX1_VOLT_SWING_FLDMASK
Definition: dptx_reg.h:4182
#define DP_TX1_VOLT_SWING_FLDMASK_POS
Definition: dptx_reg.h:4183
#define DP_TX0_VOLT_SWING_FLDMASK_POS
Definition: dptx_reg.h:4171
#define DP_TX2_VOLT_SWING_FLDMASK_POS
Definition: dptx_reg.h:4195
#define DP_TX3_VOLT_SWING_FLDMASK_POS
Definition: dptx_reg.h:4207
#define DP_TX2_VOLT_SWING_FLDMASK
Definition: dptx_reg.h:4194
#define DP_TX3_VOLT_SWING_FLDMASK
Definition: dptx_reg.h:4206

Definition at line 1 of file dptx_hal.c.

Referenced by dptx_hal_reset_swing_preemphasis(), and dptx_hal_setswing_preemphasis().