13 #define ANXERROR(format, ...) \
14 printk(BIOS_ERR, "%s: " format, __func__, ##__VA_ARGS__)
15 #define ANXINFO(format, ...) \
16 printk(BIOS_INFO, "%s: " format, __func__, ##__VA_ARGS__)
17 #define ANXDEBUG(format, ...) \
18 printk(BIOS_DEBUG, "%s: " format, __func__, ##__VA_ARGS__)
28 static uint8_t saddr_backup = 0;
31 if (saddr == saddr_backup)
87 ANXERROR(
"Failed to read i2c block=%#x:%#x[len=%#x]\n", saddr,
102 ANXERROR(
"Failed to write i2c id=%#x:%#x\n", saddr, reg_addr);
142 ANXERROR(
"Timed out waiting aux operation.\n");
147 if (ret < 0 ||
val & 0x0F) {
155 static unsigned long gcd(
unsigned long a,
unsigned long b)
174 unsigned long gcd_num;
175 unsigned long a = *_a, b = *_b, old_a, old_b;
202 unsigned long *
m,
unsigned long *n,
208 ANXERROR(
"pixelclock %u higher than %lu, "
209 "output may be unstable\n",
216 ANXERROR(
"pixelclock %u lower than %lu, "
217 "output may be unstable\n",
224 for (post_divider = 1;
230 for (post_divider = 1;
236 ANXERROR(
"cannot find property post_divider(%d)\n",
243 if (post_divider == 7) {
246 }
else if (post_divider == 11) {
249 }
else if (post_divider == 13 || post_divider == 14) {
255 ANXINFO(
"act clock(%u) large than maximum(%lu)\n",
309 &post_divider) < 0) {
310 ANXERROR(
"cannot get property m n value.\n");
314 ANXINFO(
"compute M(%lu), N(%lu), divider(%d).\n",
m, n, post_divider);
387 ANXERROR(
"mipi dsi setup IO error.\n");
402 ANXERROR(
"IO error: access MIPI_SWAP.\n");
418 ANXERROR(
"IO error: swap dsi lane 3 failed.\n");
447 ANXERROR(
"dsi video tg config failed\n");
465 ANXERROR(
"IO error: mipi dsi enable init failed.\n");
483 ANXERROR(
"IO error: api dsi config error.\n");
493 ANXERROR(
"IO error: enable mipi rx failed.\n");
497 ANXINFO(
"success to config DSI\n");
541 ANXERROR(
"IO error: access AUX BUFF.\n");
557 for (cnt = 0; cnt < 3; cnt++) {
564 ANXERROR(
"edid read failed, reset!\n");
595 ANXERROR(
"IO error: aux initial failed.\n");
599 for (cnt = 0; cnt < 3; cnt++) {
606 ANXERROR(
"segment read failed, reset!\n");
623 int count, blocks_num;
625 int i, ret, g_edid_break = 0;
633 ANXERROR(
"access aux channel IO error.\n");
647 for (i = 0; i < 8; i++) {
666 for (i = 0; i < 8; i++) {
667 edid_pos = (i +
count * 8) *
676 memcpy(&pedid_blocks_buf[edid_pos],
684 die(
"%s: count should be <= 3", __func__);
690 }
while (blocks_num >=
count);
710 ANXERROR(
"Failed to disable PD feature.\n");
712 ANXINFO(
"Disabled PD feature.\n");
715 #define FLASH_LOAD_STA 0x05
716 #define FLASH_LOAD_STA_CHK (1 << 7)
777 ANXERROR(
"IO error: Failed to clear interrupt status.\n");
783 ANXINFO(
"HPD received 0x7e:0x45=%#x\n", status);
814 ANXINFO(
"detected IVO panel, use k value 0x3b\n");
817 ANXINFO(
"set default k value to 0x3d for panel\n");
821 " hactive(%d), hsync(%d), hfp(%d), hbp(%d)\n"
822 " vactive(%d), vsync(%d), vfp(%d), vbp(%d)\n",
837 ANXERROR(
"MIPI phy setup error.\n");
841 ANXINFO(
"MIPI phy setup OK.\n");
853 ANXERROR(
"Failed to get eDP EDID.\n");
859 ANXERROR(
"Failed to decode EDID.\n");
868 int retry_hpd_change = 50;
875 while (--retry_hpd_change) {
884 ANXERROR(
"Timed out to detect HPD change on bus %d.\n",
bus);
static int anx7625_calculate_m_n(u32 pixelclock, unsigned long *m, unsigned long *n, uint8_t *pd)
static int edid_read(uint8_t bus, uint8_t offset, uint8_t *pblock_buf)
static int anx7625_dsi_config(uint8_t bus, struct display_timing *dt)
int anx7625_init(uint8_t bus)
static int anx7625_power_on_init(uint8_t bus)
#define ANXDEBUG(format,...)
static int anx7625_dsi_video_config(uint8_t bus, struct display_timing *dt)
static int anx7625_reg_write(uint8_t bus, uint8_t saddr, uint8_t reg_addr, uint8_t reg_val)
static int anx7625_swap_dsi_lane3(uint8_t bus)
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 sp_tx_edid_read(uint8_t bus, uint8_t *pedid_blocks_buf, uint32_t size)
static int segments_edid_read(uint8_t bus, uint8_t segment, uint8_t *buf, uint8_t offset)
static int anx7625_api_dsi_config(uint8_t bus, struct display_timing *dt)
#define ANXERROR(format,...)
static int anx7625_write_and(uint8_t bus, uint8_t saddr, uint8_t offset, uint8_t mask)
static int anx7625_hpd_change_detect(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)
#define ANXINFO(format,...)
int anx7625_dp_get_edid(uint8_t bus, struct edid *out)
static void anx7625_reduction_of_a_fraction(unsigned long *_a, unsigned long *_b)
static void anx7625_parse_edid(const struct edid *edid, struct display_timing *dt)
static void anx7625_disable_pd_protocol(uint8_t bus)
static int anx7625_write_or(uint8_t bus, uint8_t saddr, uint8_t offset, uint8_t mask)
static int wait_aux_op_finish(uint8_t bus)
static int anx7625_odfc_config(uint8_t bus, uint8_t post_divider)
#define FLASH_LOAD_STA_CHK
static unsigned long gcd(unsigned long a, unsigned long b)
int anx7625_dp_start(uint8_t bus, const struct edid *edid)
static int anx7625_reg_block_read(uint8_t bus, uint8_t saddr, uint8_t reg_addr, uint8_t len, uint8_t *buf)
static void anx7625_start_dp_work(uint8_t bus)
static int sp_tx_rst_aux(uint8_t bus)
static int sp_tx_get_edid_block(uint8_t bus)
#define AP_AUX_CTRL_OP_EN
#define MIPI_DIGITAL_PLL_8
#define AP_AUX_CTRL_ADDRONLY
#define VERTICAL_BACK_PORCH
#define MIPI_LANE_CTRL_10
#define VERTICAL_SYNC_WIDTH
#define MIPI_PLL_M_NUM_7_0
#define MIPI_DIGITAL_PLL_6
#define MIPI_TIME_HS_PRPR
#define MIPI_PLL_VCO_TUNE_REG_VAL
#define MIPI_CLK_DET_DET_BYPASS
#define HORIZONTAL_BACK_PORCH_H
#define HORIZONTAL_TOTAL_PIXELS_H
#define AP_AUX_ADDR_19_16
#define MIPI_VIDEO_STABLE_CNT
#define HORIZONTAL_TOTAL_PIXELS_L
#define MAX_UNSIGNED_24BIT
#define MIPI_PLL_N_NUM_15_8
#define VERTICAL_FRONT_PORCH
#define HORIZONTAL_SYNC_WIDTH_L
#define HORIZONTAL_FRONT_PORCH_H
#define HORIZONTAL_FRONT_PORCH_L
#define MIPI_PLL_M_NUM_15_8
#define MIPI_DIGITAL_PLL_18
#define AP_AUX_CTRL_STATUS
#define MIPI_CLK_RT_MANUAL_PD_EN
#define PLL_OUT_FREQ_ABS_MAX
#define MIPI_DIGITAL_PLL_16
#define MIPI_DIGITAL_ADJ_1
#define HORIZONTAL_SYNC_WIDTH_H
#define HORIZONTAL_BACK_PORCH_L
#define MIPI_PD_LPTX_CH_MANUAL_PD_EN
#define PLL_OUT_FREQ_ABS_MIN
#define AP_AUX_BUFF_START
#define TCPC_INTERFACE_ADDR
#define MIPI_PLL_N_NUM_7_0
#define MAX_DPCD_BUFFER_SIZE
#define MIPI_PLL_M_NUM_23_16
#define MIPI_PHY_CONTROL_3
#define MIPI_DIGITAL_PLL_7
#define MIPI_CLK_MISS_CTRL
#define HORIZONTAL_ACTIVE_PIXELS_H
#define HORIZONTAL_ACTIVE_PIXELS_L
#define MIPI_CLK_HS_MANUAL_PD_EN
#define MIPI_PLL_N_NUM_23_16
void * memcpy(void *dest, const void *src, size_t n)
#define retry(attempts, condition,...)
void __noreturn die(const char *fmt,...)
void mdelay(unsigned int msecs)
static int i2c_writeb(unsigned int bus, uint8_t slave, uint8_t reg, uint8_t data)
Write a byte with one segment in one frame.
static int i2c_readb(unsigned int bus, uint8_t slave, uint8_t reg, uint8_t *data)
Read a byte with two segments in one frame.
static int i2c_read_bytes(unsigned int bus, uint8_t slave, uint8_t reg, uint8_t *data, int len)
Read multi-bytes with two segments in one frame.
int decode_edid(unsigned char *edid, int size, struct edid *out)
int strncmp(const char *s1, const char *s2, int maxlen)
unsigned int hfront_porch
unsigned int vfront_porch
char manufacturer_name[3+1]
#define m(clkreg, src_bits, pmcreg, dst_bits)