coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
anx7625.c File Reference
#include <console/console.h>
#include <delay.h>
#include <device/i2c_simple.h>
#include <edid.h>
#include <gpio.h>
#include <string.h>
#include <types.h>
#include "anx7625.h"
Include dependency graph for anx7625.c:

Go to the source code of this file.

Macros

#define ANXERROR(format, ...)    printk(BIOS_ERR, "%s: " format, __func__, ##__VA_ARGS__)
 
#define ANXINFO(format, ...)    printk(BIOS_INFO, "%s: " format, __func__, ##__VA_ARGS__)
 
#define ANXDEBUG(format, ...)    printk(BIOS_DEBUG, "%s: " format, __func__, ##__VA_ARGS__)
 
#define FLASH_LOAD_STA   0x05
 
#define FLASH_LOAD_STA_CHK   (1 << 7)
 

Functions

static int i2c_access_workaround (uint8_t bus, uint8_t saddr)
 
static int anx7625_reg_read (uint8_t bus, uint8_t saddr, uint8_t offset, uint8_t *val)
 
static int anx7625_reg_block_read (uint8_t bus, uint8_t saddr, uint8_t reg_addr, uint8_t len, uint8_t *buf)
 
static int anx7625_reg_write (uint8_t bus, uint8_t saddr, uint8_t reg_addr, uint8_t reg_val)
 
static int anx7625_write_or (uint8_t bus, uint8_t saddr, uint8_t offset, uint8_t mask)
 
static int anx7625_write_and (uint8_t bus, uint8_t saddr, uint8_t offset, uint8_t mask)
 
static int wait_aux_op_finish (uint8_t bus)
 
static unsigned long gcd (unsigned long a, unsigned long b)
 
static void anx7625_reduction_of_a_fraction (unsigned long *_a, unsigned long *_b)
 
static int anx7625_calculate_m_n (u32 pixelclock, unsigned long *m, unsigned long *n, uint8_t *pd)
 
static int anx7625_odfc_config (uint8_t bus, uint8_t post_divider)
 
static int anx7625_dsi_video_config (uint8_t bus, struct display_timing *dt)
 
static int anx7625_swap_dsi_lane3 (uint8_t bus)
 
static int anx7625_api_dsi_config (uint8_t bus, struct display_timing *dt)
 
static int anx7625_dsi_config (uint8_t bus, struct display_timing *dt)
 
static int sp_tx_rst_aux (uint8_t bus)
 
static int sp_tx_aux_wr (uint8_t bus, uint8_t offset)
 
static int sp_tx_aux_rd (uint8_t bus, uint8_t len_cmd)
 
static int sp_tx_get_edid_block (uint8_t bus)
 
static int edid_read (uint8_t bus, uint8_t offset, uint8_t *pblock_buf)
 
static int segments_edid_read (uint8_t bus, uint8_t segment, uint8_t *buf, uint8_t offset)
 
static int sp_tx_edid_read (uint8_t bus, uint8_t *pedid_blocks_buf, uint32_t size)
 
static void anx7625_disable_pd_protocol (uint8_t bus)
 
static int anx7625_power_on_init (uint8_t bus)
 
static void anx7625_start_dp_work (uint8_t bus)
 
static int anx7625_hpd_change_detect (uint8_t bus)
 
static void anx7625_parse_edid (const struct edid *edid, struct display_timing *dt)
 
int anx7625_dp_start (uint8_t bus, const struct edid *edid)
 
int anx7625_dp_get_edid (uint8_t bus, struct edid *out)
 
int anx7625_init (uint8_t bus)
 

Macro Definition Documentation

◆ ANXDEBUG

#define ANXDEBUG (   format,
  ... 
)     printk(BIOS_DEBUG, "%s: " format, __func__, ##__VA_ARGS__)

Definition at line 17 of file anx7625.c.

◆ ANXERROR

#define ANXERROR (   format,
  ... 
)     printk(BIOS_ERR, "%s: " format, __func__, ##__VA_ARGS__)

Definition at line 13 of file anx7625.c.

◆ ANXINFO

#define ANXINFO (   format,
  ... 
)     printk(BIOS_INFO, "%s: " format, __func__, ##__VA_ARGS__)

Definition at line 15 of file anx7625.c.

◆ FLASH_LOAD_STA

#define FLASH_LOAD_STA   0x05

Definition at line 715 of file anx7625.c.

◆ FLASH_LOAD_STA_CHK

#define FLASH_LOAD_STA_CHK   (1 << 7)

Definition at line 716 of file anx7625.c.

Function Documentation

◆ anx7625_api_dsi_config()

◆ anx7625_calculate_m_n()

static int anx7625_calculate_m_n ( u32  pixelclock,
unsigned long *  m,
unsigned long *  n,
uint8_t pd 
)
static

Definition at line 201 of file anx7625.c.

References anx7625_reduction_of_a_fraction(), ANXERROR, ANXINFO, m, PLL_OUT_FREQ_ABS_MAX, PLL_OUT_FREQ_ABS_MIN, PLL_OUT_FREQ_MIN, POST_DIVIDER_MAX, POST_DIVIDER_MIN, and XTAL_FRQ.

Referenced by anx7625_dsi_video_config().

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

◆ anx7625_disable_pd_protocol()

static void anx7625_disable_pd_protocol ( uint8_t  bus)
static

Definition at line 698 of file anx7625.c.

References anx7625_reg_write(), ANXERROR, ANXINFO, AP_AV_STATUS, AP_DISABLE_PD, and RX_P0_ADDR.

Referenced by anx7625_power_on_init().

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

◆ anx7625_dp_get_edid()

int anx7625_dp_get_edid ( uint8_t  bus,
struct edid out 
)

Definition at line 845 of file anx7625.c.

References ANXERROR, decode_edid(), EDID_CONFORMANT, FOUR_BLOCK_SIZE, ONE_BLOCK_SIZE, and sp_tx_edid_read().

Referenced by bridge_anx7625_get_edid(), configure_display(), and get_panel_description().

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

◆ anx7625_dp_start()

int anx7625_dp_start ( uint8_t  bus,
const struct edid edid 
)

Definition at line 828 of file anx7625.c.

References anx7625_dsi_config(), anx7625_parse_edid(), ANXERROR, and ANXINFO.

Referenced by bridge_anx7625_post_power_on(), and configure_display().

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

◆ anx7625_dsi_config()

static int anx7625_dsi_config ( uint8_t  bus,
struct display_timing dt 
)
static

Definition at line 472 of file anx7625.c.

References anx7625_api_dsi_config(), anx7625_write_and(), anx7625_write_or(), ANXERROR, ANXINFO, AP_AV_STATUS, AP_MIPI_MUTE, AP_MIPI_RX_EN, DSC_EN, R_DSC_CTRL_0, and RX_P0_ADDR.

Referenced by anx7625_dp_start().

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

◆ anx7625_dsi_video_config()

◆ anx7625_hpd_change_detect()

static int anx7625_hpd_change_detect ( uint8_t  bus)
static

Definition at line 770 of file anx7625.c.

References anx7625_reg_read(), anx7625_start_dp_work(), ANXERROR, ANXINFO, HPD_STATUS, RX_P0_ADDR, and SYSTEM_STSTUS.

Referenced by anx7625_init().

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

◆ anx7625_init()

int anx7625_init ( uint8_t  bus)

Definition at line 866 of file anx7625.c.

References anx7625_hpd_change_detect(), anx7625_power_on_init(), ANXERROR, mdelay(), and retry.

Referenced by bridge_anx7625_get_edid(), configure_display(), and get_panel_description().

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

◆ anx7625_odfc_config()

static int anx7625_odfc_config ( uint8_t  bus,
uint8_t  post_divider 
)
static

Definition at line 269 of file anx7625.c.

References anx7625_write_and(), anx7625_write_or(), ANXERROR, MIPI_DIGITAL_PLL_16, MIPI_DIGITAL_PLL_7, MIPI_DIGITAL_PLL_8, MIPI_FREF_D_IND, MIPI_PLL_RESET_N, MIPI_PLL_VCO_TUNE_REG_VAL, REF_CLK_27000kHz, and RX_P1_ADDR.

Referenced by anx7625_dsi_video_config().

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

◆ anx7625_parse_edid()

◆ anx7625_power_on_init()

static int anx7625_power_on_init ( uint8_t  bus)
static

Definition at line 718 of file anx7625.c.

References anx7625_disable_pd_protocol(), anx7625_reg_read(), anx7625_reg_write(), ANXERROR, ANXINFO, FLASH_LOAD_STA, FLASH_LOAD_STA_CHK, mdelay(), OCM_FW_REVERSION, OCM_FW_VERSION, OCM_LOADING_TIME, RX_P0_ADDR, val, version, XTAL_FRQ_27M, and XTAL_FRQ_SEL.

Referenced by anx7625_init().

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

◆ anx7625_reduction_of_a_fraction()

static void anx7625_reduction_of_a_fraction ( unsigned long *  _a,
unsigned long *  _b 
)
static

Definition at line 171 of file anx7625.c.

References gcd(), and MAX_UNSIGNED_24BIT.

Referenced by anx7625_calculate_m_n().

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

◆ anx7625_reg_block_read()

static int anx7625_reg_block_read ( uint8_t  bus,
uint8_t  saddr,
uint8_t  reg_addr,
uint8_t  len,
uint8_t buf 
)
static

Definition at line 79 of file anx7625.c.

References ANXERROR, buf, i2c_access_workaround(), and i2c_read_bytes().

Referenced by edid_read(), and segments_edid_read().

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

◆ anx7625_reg_read()

static int anx7625_reg_read ( uint8_t  bus,
uint8_t  saddr,
uint8_t  offset,
uint8_t val 
)
static

Definition at line 65 of file anx7625.c.

References ANXERROR, i2c_access_workaround(), i2c_readb(), offset, and val.

Referenced by anx7625_hpd_change_detect(), anx7625_power_on_init(), anx7625_start_dp_work(), anx7625_swap_dsi_lane3(), anx7625_write_and(), anx7625_write_or(), sp_tx_get_edid_block(), and wait_aux_op_finish().

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

◆ anx7625_reg_write()

static int anx7625_reg_write ( uint8_t  bus,
uint8_t  saddr,
uint8_t  reg_addr,
uint8_t  reg_val 
)
static

◆ anx7625_start_dp_work()

static void anx7625_start_dp_work ( uint8_t  bus)
static

Definition at line 748 of file anx7625.c.

References anx7625_reg_read(), anx7625_write_and(), anx7625_write_or(), ANXINFO, RX_P1_ADDR, and val.

Referenced by anx7625_hpd_change_detect().

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

◆ anx7625_swap_dsi_lane3()

static int anx7625_swap_dsi_lane3 ( uint8_t  bus)
static

Definition at line 394 of file anx7625.c.

References anx7625_reg_read(), anx7625_reg_write(), ANXERROR, MIPI_SWAP, MIPI_SWAP_CH3, RX_P1_ADDR, and val.

Referenced by anx7625_api_dsi_config().

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

◆ anx7625_write_and()

static int anx7625_write_and ( uint8_t  bus,
uint8_t  saddr,
uint8_t  offset,
uint8_t  mask 
)
static

Definition at line 121 of file anx7625.c.

References anx7625_reg_read(), anx7625_reg_write(), mask, offset, and val.

Referenced by anx7625_api_dsi_config(), anx7625_dsi_config(), anx7625_dsi_video_config(), anx7625_odfc_config(), anx7625_start_dp_work(), sp_tx_edid_read(), and sp_tx_rst_aux().

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

◆ anx7625_write_or()

static int anx7625_write_or ( uint8_t  bus,
uint8_t  saddr,
uint8_t  offset,
uint8_t  mask 
)
static

Definition at line 108 of file anx7625.c.

References anx7625_reg_read(), anx7625_reg_write(), mask, offset, and val.

Referenced by anx7625_api_dsi_config(), anx7625_dsi_config(), anx7625_dsi_video_config(), anx7625_odfc_config(), anx7625_start_dp_work(), sp_tx_aux_rd(), sp_tx_aux_wr(), and sp_tx_rst_aux().

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

◆ edid_read()

static int edid_read ( uint8_t  bus,
uint8_t  offset,
uint8_t pblock_buf 
)
static

Definition at line 553 of file anx7625.c.

References anx7625_reg_block_read(), ANXERROR, AP_AUX_BUFF_START, MAX_DPCD_BUFFER_SIZE, offset, RX_P0_ADDR, sp_tx_aux_rd(), sp_tx_aux_wr(), and sp_tx_rst_aux().

Referenced by sp_tx_edid_read().

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

◆ gcd()

static unsigned long gcd ( unsigned long  a,
unsigned long  b 
)
static

Definition at line 155 of file anx7625.c.

Referenced by anx7625_reduction_of_a_fraction().

Here is the caller graph for this function:

◆ i2c_access_workaround()

static int i2c_access_workaround ( uint8_t  bus,
uint8_t  saddr 
)
static

Definition at line 25 of file anx7625.c.

References ANXERROR, i2c_writeb(), offset, RSVD_00_ADDR, RSVD_39_ADDR, RSVD_60_ADDR, RSVD_7F_ADDR, RSVD_D1_ADDR, RX_P0_ADDR, RX_P1_ADDR, TCPC_INTERFACE_ADDR, TX_P0_ADDR, and TX_P1_ADDR.

Referenced by anx7625_reg_block_read(), anx7625_reg_read(), and anx7625_reg_write().

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

◆ segments_edid_read()

static int segments_edid_read ( uint8_t  bus,
uint8_t  segment,
uint8_t buf,
uint8_t  offset 
)
static

◆ sp_tx_aux_rd()

static int sp_tx_aux_rd ( uint8_t  bus,
uint8_t  len_cmd 
)
static

Definition at line 521 of file anx7625.c.

References anx7625_reg_write(), anx7625_write_or(), AP_AUX_COMMAND, AP_AUX_CTRL_OP_EN, AP_AUX_CTRL_STATUS, RX_P0_ADDR, and wait_aux_op_finish().

Referenced by edid_read(), segments_edid_read(), and sp_tx_get_edid_block().

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

◆ sp_tx_aux_wr()

static int sp_tx_aux_wr ( uint8_t  bus,
uint8_t  offset 
)
static

Definition at line 510 of file anx7625.c.

References anx7625_reg_write(), anx7625_write_or(), AP_AUX_BUFF_START, AP_AUX_COMMAND, AP_AUX_CTRL_OP_EN, AP_AUX_CTRL_STATUS, offset, RX_P0_ADDR, and wait_aux_op_finish().

Referenced by edid_read(), segments_edid_read(), and sp_tx_get_edid_block().

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

◆ sp_tx_edid_read()

static int sp_tx_edid_read ( uint8_t  bus,
uint8_t pedid_blocks_buf,
uint32_t  size 
)
static

Definition at line 619 of file anx7625.c.

References anx7625_reg_write(), anx7625_write_and(), ANXERROR, AP_AUX_ADDR_15_8, AP_AUX_ADDR_19_16, AP_AUX_ADDR_7_0, count, die(), edid_read(), MAX_DPCD_BUFFER_SIZE, memcpy(), offset, RX_P0_ADDR, segments_edid_read(), sp_tx_get_edid_block(), and sp_tx_rst_aux().

Referenced by anx7625_dp_get_edid().

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

◆ sp_tx_get_edid_block()

static int sp_tx_get_edid_block ( uint8_t  bus)
static

Definition at line 531 of file anx7625.c.

References anx7625_reg_read(), ANXERROR, ANXINFO, AP_AUX_BUFF_START, RX_P0_ADDR, sp_tx_aux_rd(), sp_tx_aux_wr(), and val.

Referenced by sp_tx_edid_read().

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

◆ sp_tx_rst_aux()

static int sp_tx_rst_aux ( uint8_t  bus)
static

Definition at line 501 of file anx7625.c.

References anx7625_write_and(), anx7625_write_or(), AUX_RST, RST_CTRL2, and TX_P2_ADDR.

Referenced by edid_read(), segments_edid_read(), and sp_tx_edid_read().

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

◆ wait_aux_op_finish()

static int wait_aux_op_finish ( uint8_t  bus)
static

Definition at line 134 of file anx7625.c.

References anx7625_reg_read(), ANXDEBUG, ANXERROR, AP_AUX_CTRL_OP_EN, AP_AUX_CTRL_STATUS, mdelay(), retry, RX_P0_ADDR, and val.

Referenced by segments_edid_read(), sp_tx_aux_rd(), and sp_tx_aux_wr().

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