coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
dp.c File Reference
#include <console/console.h>
#include <delay.h>
#include <device/device.h>
#include <device/i2c_simple.h>
#include <edid.h>
#include <soc/addressmap.h>
#include <soc/nvidia/tegra/i2c.h>
#include <soc/nvidia/tegra/dc.h>
#include <soc/nvidia/tegra/displayport.h>
#include <soc/sor.h>
#include <string.h>
#include <types.h>
#include "chip.h"
Include dependency graph for dp.c:

Go to the source code of this file.

Enumerations

enum  { DP_LT_SUCCESS = 0 , DP_LT_FAILED = -1 }
 

Functions

static u32 tegra_dpaux_readl (struct tegra_dc_dp_data *dp, u32 reg)
 
static void tegra_dpaux_writel (struct tegra_dc_dp_data *dp, u32 reg, u32 val)
 
static u32 tegra_dc_dpaux_poll_register (struct tegra_dc_dp_data *dp, u32 reg, u32 mask, u32 exp_val, u32 poll_interval_us, u32 timeout_us)
 
static int tegra_dpaux_wait_transaction (struct tegra_dc_dp_data *dp)
 
static int tegra_dc_dpaux_write_chunk (struct tegra_dc_dp_data *dp, u32 cmd, u32 addr, u8 *data, u32 *size, u32 *aux_stat)
 
static int tegra_dc_dpaux_read_chunk (struct tegra_dc_dp_data *dp, u32 cmd, u32 addr, u8 *data, u32 *size, u32 *aux_stat)
 
static int tegra_dc_dpaux_read (struct tegra_dc_dp_data *dp, u32 cmd, u32 addr, u8 *data, u32 *size, u32 *aux_stat)
 
static int tegra_dc_dp_dpcd_read (struct tegra_dc_dp_data *dp, u32 cmd, u8 *data_ptr)
 
static int tegra_dc_dp_dpcd_write (struct tegra_dc_dp_data *dp, u32 cmd, u8 data)
 
static int tegra_dc_i2c_aux_read (struct tegra_dc_dp_data *dp, u32 i2c_addr, u8 addr, u8 *data, u32 *size, u32 *aux_stat)
 
static void tegra_dc_dpaux_enable (struct tegra_dc_dp_data *dp)
 
static void tegra_dc_dp_dump_link_cfg (struct tegra_dc_dp_data *dp, const struct tegra_dc_dp_link_config *link_cfg)
 
static int _tegra_dp_lower_link_config (struct tegra_dc_dp_data *dp, struct tegra_dc_dp_link_config *cfg)
 
static int tegra_dc_dp_calc_config (struct tegra_dc_dp_data *dp, const struct soc_nvidia_tegra124_config *config, struct tegra_dc_dp_link_config *link_cfg)
 
static int tegra_dc_dp_init_max_link_cfg (struct soc_nvidia_tegra124_config *config, struct tegra_dc_dp_data *dp, struct tegra_dc_dp_link_config *link_cfg)
 
static int tegra_dc_dp_set_assr (struct tegra_dc_dp_data *dp, int ena)
 
static int tegra_dp_set_link_bandwidth (struct tegra_dc_dp_data *dp, u8 link_bw)
 
static int tegra_dp_set_lane_count (struct tegra_dc_dp_data *dp, const struct tegra_dc_dp_link_config *link_cfg)
 
static int tegra_dc_dp_link_trained (struct tegra_dc_dp_data *dp, const struct tegra_dc_dp_link_config *cfg)
 
static int tegra_dp_channel_eq_status (struct tegra_dc_dp_data *dp)
 
static u8 tegra_dp_clock_recovery_status (struct tegra_dc_dp_data *dp)
 
static void tegra_dp_lt_adjust (struct tegra_dc_dp_data *dp, u32 pe[4], u32 vs[4], u32 pc[4], u8 pc_supported)
 
static u32 tegra_dp_wait_aux_training (struct tegra_dc_dp_data *dp, u8 is_clk_recovery)
 
static void tegra_dp_tpg (struct tegra_dc_dp_data *dp, u32 tp, u32 n_lanes)
 
static int tegra_dp_link_config (struct tegra_dc_dp_data *dp, const struct tegra_dc_dp_link_config *link_cfg)
 
static int tegra_dp_lower_link_config (struct tegra_dc_dp_data *dp, struct tegra_dc_dp_link_config *cfg)
 
static void tegra_dp_lt_config (struct tegra_dc_dp_data *dp, u32 pe[4], u32 vs[4], u32 pc[4])
 
static int _tegra_dp_channel_eq (struct tegra_dc_dp_data *dp, u32 pe[4], u32 vs[4], u32 pc[4], u8 pc_supported, u32 n_lanes)
 
static int tegra_dp_channel_eq (struct tegra_dc_dp_data *dp, u32 pe[4], u32 vs[4], u32 pc[4])
 
static int _tegra_dp_clk_recovery (struct tegra_dc_dp_data *dp, u32 pe[4], u32 vs[4], u32 pc[4], u8 pc_supported, u32 n_lanes)
 
static int tegra_dp_clk_recovery (struct tegra_dc_dp_data *dp, u32 pe[4], u32 vs[4], u32 pc[4])
 
static int tegra_dc_dp_full_link_training (struct tegra_dc_dp_data *dp)
 
static int tegra_dc_dp_fast_link_training (struct tegra_dc_dp_data *dp, const struct tegra_dc_dp_link_config *link_cfg)
 
static int tegra_dp_do_link_training (struct tegra_dc_dp_data *dp, const struct tegra_dc_dp_link_config *link_cfg)
 
static int tegra_dc_dp_explore_link_cfg (struct tegra_dc_dp_data *dp, struct tegra_dc_dp_link_config *link_cfg, const struct soc_nvidia_tegra124_config *config)
 
static void tegra_dp_update_config (struct tegra_dc_dp_data *dp, struct soc_nvidia_tegra124_config *config)
 
void dp_init (void *_config)
 
static void tegra_dp_hpd_config (struct tegra_dc_dp_data *dp, struct soc_nvidia_tegra124_config *config)
 
static int tegra_dp_hpd_plug (struct tegra_dc_dp_data *dp, int timeout_ms)
 
void dp_enable (void *_dp)
 

Variables

struct tegra_dc_dp_data dp_data
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
DP_LT_SUCCESS 
DP_LT_FAILED 

Definition at line 22 of file dp.c.

Function Documentation

◆ _tegra_dp_channel_eq()

static int _tegra_dp_channel_eq ( struct tegra_dc_dp_data dp,
u32  pe[4],
u32  vs[4],
u32  pc[4],
u8  pc_supported,
u32  n_lanes 
)
static

Definition at line 1020 of file dp.c.

References BIOS_ERR, DP_LT_FAILED, DP_LT_SUCCESS, printk, tegra_dp_channel_eq_status(), tegra_dp_clock_recovery_status(), tegra_dp_lt_adjust(), tegra_dp_lt_config(), and tegra_dp_wait_aux_training().

Referenced by tegra_dp_channel_eq().

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

◆ _tegra_dp_clk_recovery()

static int _tegra_dp_clk_recovery ( struct tegra_dc_dp_data dp,
u32  pe[4],
u32  vs[4],
u32  pc[4],
u8  pc_supported,
u32  n_lanes 
)
static

Definition at line 1066 of file dp.c.

References DP_LT_FAILED, DP_LT_SUCCESS, memcmp(), memcpy(), tegra_dp_clock_recovery_status(), tegra_dp_lt_adjust(), tegra_dp_lt_config(), and tegra_dp_wait_aux_training().

Referenced by tegra_dp_clk_recovery().

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

◆ _tegra_dp_lower_link_config()

static int _tegra_dp_lower_link_config ( struct tegra_dc_dp_data dp,
struct tegra_dc_dp_link_config cfg 
)
static

◆ dp_enable()

void dp_enable ( void _dp)

Definition at line 1394 of file dp.c.

Referenced by dp_display_startup().

Here is the caller graph for this function:

◆ dp_init()

void dp_init ( void _config)

Definition at line 1344 of file dp.c.

Referenced by dp_display_startup().

Here is the caller graph for this function:

◆ tegra_dc_dp_calc_config()

◆ tegra_dc_dp_dpcd_read()

static int tegra_dc_dp_dpcd_read ( struct tegra_dc_dp_data dp,
u32  cmd,
u8 data_ptr 
)
static

Definition at line 316 of file dp.c.

References BIOS_ERR, DPAUX_DP_AUXCTL_CMD_AUXRD, printk, and tegra_dc_dpaux_read_chunk().

Referenced by dp_enable(), tegra_dc_dp_init_max_link_cfg(), tegra_dc_dp_link_trained(), tegra_dp_channel_eq_status(), tegra_dp_clock_recovery_status(), tegra_dp_link_config(), and tegra_dp_lt_adjust().

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

◆ tegra_dc_dp_dpcd_write()

static int tegra_dc_dp_dpcd_write ( struct tegra_dc_dp_data dp,
u32  cmd,
u8  data 
)
static

Definition at line 333 of file dp.c.

References BIOS_ERR, DPAUX_DP_AUXCTL_CMD_AUXWR, printk, and tegra_dc_dpaux_write_chunk().

Referenced by dp_enable(), tegra_dc_dp_fast_link_training(), tegra_dc_dp_set_assr(), tegra_dp_link_config(), tegra_dp_lt_config(), tegra_dp_set_lane_count(), tegra_dp_set_link_bandwidth(), and tegra_dp_tpg().

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

◆ tegra_dc_dp_dump_link_cfg()

◆ tegra_dc_dp_explore_link_cfg()

static int tegra_dc_dp_explore_link_cfg ( struct tegra_dc_dp_data dp,
struct tegra_dc_dp_link_config link_cfg,
const struct soc_nvidia_tegra124_config config 
)
static

◆ tegra_dc_dp_fast_link_training()

◆ tegra_dc_dp_full_link_training()

static int tegra_dc_dp_full_link_training ( struct tegra_dc_dp_data dp)
static

◆ tegra_dc_dp_init_max_link_cfg()

◆ tegra_dc_dp_link_trained()

◆ tegra_dc_dp_set_assr()

static int tegra_dc_dp_set_assr ( struct tegra_dc_dp_data dp,
int  ena 
)
static

Definition at line 693 of file dp.c.

References CHECK_RET, NV_DPCD_EDP_CONFIG_SET, NV_DPCD_EDP_CONFIG_SET_ASC_RESET_DISABLE, NV_DPCD_EDP_CONFIG_SET_ASC_RESET_ENABLE, tegra_dc_dp_data::sor, tegra_dc_dp_dpcd_write(), and tegra_dc_sor_set_internal_panel().

Referenced by tegra_dc_dp_fast_link_training(), and tegra_dp_link_config().

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

◆ tegra_dc_dpaux_enable()

static void tegra_dc_dpaux_enable ( struct tegra_dc_dp_data dp)
static

◆ tegra_dc_dpaux_poll_register()

static u32 tegra_dc_dpaux_poll_register ( struct tegra_dc_dp_data dp,
u32  reg,
u32  mask,
u32  exp_val,
u32  poll_interval_us,
u32  timeout_us 
)
inlinestatic

Definition at line 43 of file dp.c.

References BIOS_ERR, mask, printk, tegra_dpaux_readl(), and udelay().

Referenced by tegra_dpaux_wait_transaction().

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

◆ tegra_dc_dpaux_read()

static int tegra_dc_dpaux_read ( struct tegra_dc_dp_data dp,
u32  cmd,
u32  addr,
u8 data,
u32 size,
u32 aux_stat 
)
static

Definition at line 288 of file dp.c.

References addr, DP_AUX_MAX_BYTES, and tegra_dc_dpaux_read_chunk().

Referenced by tegra_dc_dp_fast_link_training().

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

◆ tegra_dc_dpaux_read_chunk()

◆ tegra_dc_dpaux_write_chunk()

◆ tegra_dc_i2c_aux_read()

static int tegra_dc_i2c_aux_read ( struct tegra_dc_dp_data dp,
u32  i2c_addr,
u8  addr,
u8 data,
u32 size,
u32 aux_stat 
)
static

Definition at line 349 of file dp.c.

References addr, BIOS_ERR, DP_AUX_MAX_BYTES, DPAUX_DP_AUXCTL_CMD_I2CRD, DPAUX_DP_AUXCTL_CMD_MOTWR, MIN, printk, tegra_dc_dpaux_read_chunk(), and tegra_dc_dpaux_write_chunk().

Referenced by tegra_dp_update_config().

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

◆ tegra_dp_channel_eq()

static int tegra_dp_channel_eq ( struct tegra_dc_dp_data dp,
u32  pe[4],
u32  vs[4],
u32  pc[4] 
)
static

Definition at line 1046 of file dp.c.

References _tegra_dp_channel_eq(), tegra_dc_dp_link_config::lane_count, tegra_dc_dp_data::link_cfg, tegra_dp_tpg(), tegra_dc_dp_link_config::tps3_supported, training_pattern_2, training_pattern_3, and training_pattern_disabled.

Referenced by tegra_dc_dp_full_link_training().

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

◆ tegra_dp_channel_eq_status()

◆ tegra_dp_clk_recovery()

static int tegra_dp_clk_recovery ( struct tegra_dc_dp_data dp,
u32  pe[4],
u32  vs[4],
u32  pc[4] 
)
static

Definition at line 1092 of file dp.c.

References _tegra_dp_clk_recovery(), tegra_dc_dp_link_config::lane_count, tegra_dc_dp_data::link_cfg, tegra_dp_tpg(), tegra_dc_dp_link_config::tps3_supported, training_pattern_1, and training_pattern_disabled.

Referenced by tegra_dc_dp_full_link_training().

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

◆ tegra_dp_clock_recovery_status()

static u8 tegra_dp_clock_recovery_status ( struct tegra_dc_dp_data dp)
static

Definition at line 792 of file dp.c.

References tegra_dc_dp_link_config::lane_count, tegra_dc_dp_data::link_cfg, NV_DPCD_LANE0_1_STATUS, NV_DPCD_STATUS_LANEX_CR_DONE_YES, NV_DPCD_STATUS_LANEXPLUS1_CR_DONE_YES, and tegra_dc_dp_dpcd_read().

Referenced by _tegra_dp_channel_eq(), and _tegra_dp_clk_recovery().

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

◆ tegra_dp_do_link_training()

static int tegra_dp_do_link_training ( struct tegra_dc_dp_data dp,
const struct tegra_dc_dp_link_config link_cfg 
)
static

◆ tegra_dp_hpd_config()

static void tegra_dp_hpd_config ( struct tegra_dc_dp_data dp,
struct soc_nvidia_tegra124_config config 
)
static

Definition at line 1367 of file dp.c.

References config, DPAUX_HPD_CONFIG, DPAUX_HPD_CONFIG_UNPLUG_MIN_TIME_SHIFT, DPAUX_HPD_IRQ_CONFIG, tegra_dpaux_writel(), and val.

Referenced by dp_enable().

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

◆ tegra_dp_hpd_plug()

static int tegra_dp_hpd_plug ( struct tegra_dc_dp_data dp,
int  timeout_ms 
)
static

Definition at line 1380 of file dp.c.

References DPAUX_DP_AUXSTAT, DPAUX_DP_AUXSTAT_HPD_STATUS_PLUGGED, tegra_dpaux_readl(), udelay(), and val.

Referenced by dp_enable().

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

◆ tegra_dp_link_config()

◆ tegra_dp_lower_link_config()

static int tegra_dp_lower_link_config ( struct tegra_dc_dp_data dp,
struct tegra_dc_dp_link_config cfg 
)
static

Definition at line 916 of file dp.c.

References _tegra_dp_lower_link_config(), tegra_dc::config, tegra_dc_dp_data::dc, DP_LT_FAILED, DP_LT_SUCCESS, tegra_dc_dp_link_config::is_valid, tegra_dc_dp_data::link_cfg, tegra_dc_dp_calc_config(), and tegra_dp_link_config().

Referenced by tegra_dc_dp_full_link_training().

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

◆ tegra_dp_lt_adjust()

◆ tegra_dp_lt_config()

◆ tegra_dp_set_lane_count()

static int tegra_dp_set_lane_count ( struct tegra_dc_dp_data dp,
const struct tegra_dc_dp_link_config link_cfg 
)
static

◆ tegra_dp_set_link_bandwidth()

static int tegra_dp_set_link_bandwidth ( struct tegra_dc_dp_data dp,
u8  link_bw 
)
static

Definition at line 709 of file dp.c.

References NV_DPCD_LINK_BANDWIDTH_SET, tegra_dc_dp_data::sor, tegra_dc_dp_dpcd_write(), and tegra_dc_sor_set_link_bandwidth().

Referenced by tegra_dp_link_config().

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

◆ tegra_dp_tpg()

static void tegra_dp_tpg ( struct tegra_dc_dp_data dp,
u32  tp,
u32  n_lanes 
)
static

◆ tegra_dp_update_config()

static void tegra_dp_update_config ( struct tegra_dc_dp_data dp,
struct soc_nvidia_tegra124_config config 
)
static

Note edid->framebuffer_bits_per_pixel is currently hard-coded as 32, so we should keep the default value in device config.

EDID v1.3 panels may not have color depth info, so we need to check if these values are zero before updating config.

Definition at line 1297 of file dp.c.

References BIOS_ERR, BIOS_SPEW, buf, config, decode_edid(), EDID_CONFORMANT, edid_mode::ha, edid_mode::hbl, edid_mode::hso, edid_mode::hspw, edid::mode, edid::panel_bits_per_color, edid::panel_bits_per_pixel, edid_mode::pixel_clock, printk, tegra_dc_dpaux_enable(), tegra_dc_i2c_aux_read(), TEGRA_EDID_I2C_ADDRESS, edid_mode::va, edid_mode::vbl, edid_mode::vso, and edid_mode::vspw.

Referenced by dp_init().

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

◆ tegra_dp_wait_aux_training()

static u32 tegra_dp_wait_aux_training ( struct tegra_dc_dp_data dp,
u8  is_clk_recovery 
)
inlinestatic

Definition at line 846 of file dp.c.

References tegra_dc_dp_link_config::aux_rd_interval, tegra_dc_dp_data::link_cfg, mdelay(), and udelay().

Referenced by _tegra_dp_channel_eq(), and _tegra_dp_clk_recovery().

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

◆ tegra_dpaux_readl()

static u32 tegra_dpaux_readl ( struct tegra_dc_dp_data dp,
u32  reg 
)
inlinestatic

Definition at line 29 of file dp.c.

References addr, tegra_dc_dp_data::aux_base, and READL().

Referenced by dp_enable(), tegra_dc_dpaux_poll_register(), tegra_dc_dpaux_read_chunk(), tegra_dc_dpaux_write_chunk(), and tegra_dp_hpd_plug().

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

◆ tegra_dpaux_wait_transaction()

static int tegra_dpaux_wait_transaction ( struct tegra_dc_dp_data dp)
inlinestatic

Definition at line 69 of file dp.c.

References BIOS_INFO, DP_AUX_TIMEOUT_MS, DPAUX_DP_AUXCTL, DPAUX_DP_AUXCTL_TRANSACTREQ_DONE, DPAUX_DP_AUXCTL_TRANSACTREQ_MASK, printk, and tegra_dc_dpaux_poll_register().

Referenced by tegra_dc_dpaux_read_chunk(), and tegra_dc_dpaux_write_chunk().

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

◆ tegra_dpaux_writel()

static void tegra_dpaux_writel ( struct tegra_dc_dp_data dp,
u32  reg,
u32  val 
)
inlinestatic

Definition at line 36 of file dp.c.

References addr, tegra_dc_dp_data::aux_base, val, and WRITEL().

Referenced by tegra_dc_dpaux_enable(), tegra_dc_dpaux_read_chunk(), tegra_dc_dpaux_write_chunk(), and tegra_dp_hpd_config().

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

Variable Documentation

◆ dp_data

struct tegra_dc_dp_data dp_data

Definition at line 1 of file dp.c.

Referenced by dp_init().