int find_best_eq;
int eq_try_cnt = 20;
int pll_rst_max;
+/* cd lock threshold */
+int cdr_lock_level;
/*------------------------variable define end------------------------------*/
static int check_regmap_flag(unsigned int addr)
}
static const uint32_t phy_misci[][4] = {
- /* 0xd7 0xd8 0xe0 0xe1 */
+ /* 0xd7 0xd8 0xe0 0xe1 */
{ /* 24~45M */
- 0x3003707f, 0x00000080, 0x02218000, 0x00000010,
+ 0x3003707f, 0x00000080, 0x02218000, 0x00000010,
},
{ /* 45~74.5M */
- 0x3003707f, 0x00000080, 0x02218000, 0x00000010,
+ 0x3003707f, 0x00000080, 0x02218000, 0x00000010,
},
{ /* 77~155M */
- 0x3003707f, 0x00000080, 0x02218000, 0x00000010,
+ 0x3003707f, 0x00000080, 0x02218000, 0x00000010,
},
{ /* 155~340M */
- 0x3003707f, 0x00000080, 0x02218000, 0x00000010,
+ 0x3003707f, 0x00000080, 0x02218000, 0x00000010,
},
{ /* 340~525M */
- 0x3003707f, 0x007f0080, 0x02218000, 0x00000010,
+ 0x3003707f, 0x007f0080, 0x02218000, 0x00000010,
},
{ /* 525~600M */
- /* 0x3003707f, 0x007f0080, 0x02218000, 0x00000010, */
- 0x30037079, 0x007f8080, 0x02218000, 0x00000010,
+ 0x3003707f, 0x007f8080, 0x02218000, 0x00000010,
},
};
static const uint32_t phy_dcha[][3] = {
- /* 0xe2 0xe3 0xe4 */
+ /* 0xe2 0xe3 0xe4 */
{ /* 24~45M */
- 0x00000280, 0x4400c202, 0x030088a2,
+ 0x00000280, 0x4400c202, 0x030088a2,
},
{ /* 45~74.5M */
0x00000280, 0x4400c202, 0x030088a2,
},
{ /* 77~155M */
- 0x000002a2, 0x6800c202, 0x01009126,
+ 0x000002a2, 0x6800c202, 0x01009126,
},
{ /* 155~340M */
- 0x000002a2, 0x0800c202, 0x0100cc31,
+ 0x00000280, 0x0800c202, 0x0100cc31,
},
{ /* 340~525M */
- 0x000002a2, 0x0700003c, 0x1d00cc31,
+ 0x00000280, 0x0700003c, 0x1d00cc31,
},
{ /* 525~600M */
- /* 0x000002a2, 0x0700003c, 0x1d00cc31, */
- 0x00000282, 0x07000000, 0x1d00cc31,
+ 0x00000280, 0x07000000, 0x1d00cc31,
},
};
static const uint32_t phy_dcha_reva[][3] = {
- /* 0xe2 0xe3 0xe4 */
+ /* 0xe2 0xe3 0xe4 */
{ /* 24~45M */
- 0x00000280, 0x2400c202, 0x030088a2,
+ 0x00000280, 0x2400c202, 0x030088a2,
},
{ /* 45~74.5M */
0x00000280, 0x2400c202, 0x030088a2,
},
{ /* 77~155M */
- 0x000002a2, 0x4800c202, 0x01009126,
+ 0x000002a2, 0x4800c202, 0x01009126,
},
{ /* 155~340M */
- 0x000002a2, 0x0800c202, 0x0100cc31,
+ 0x000002a2, 0x0800c202, 0x0100cc31,
},
{ /* 340~525M */
- 0x000002a2, 0x0700003c, 0x1d00cc31,
+ 0x000002a2, 0x0700003c, 0x1d00cc31,
},
{ /* 525~600M */
- 0x000002a2, 0x0700003c, 0x1d00cc31,
+ 0x000002a2, 0x0700003c, 0x1d00cc31,
},
};
0x003c714a, 0x1e062620, 0x00018000,
},
{ /* 155~340M */
- 0x003c714a, 0x1e062620, 0x00018000,
+ 0x003c714a, 0x1e050064, 0x0001a000,
},
{ /* 340~525M */
- 0x003c714a, 0x1e051650, 0x0001a000,
+ 0x003c714a, 0x1e050064, 0x0001a000,
},
{ /* 525~600M */
- /*0x002c714a, 0x1e051650, 0x00018000,*/
- 0x003e714a, 0x1e050560, 0x0001a000,
+ 0x003e714a, 0x1e050560, 0x0001a000,
},
};
/* short cable */
static const uint32_t phy_dchd_2[][3] = {
- /* 0xe5 0xe6 0xe7 */
+ /* 0xe5 0xe6 0xe7 */
{ /* 24~45M */
- 0x003e714a, 0x1e022220, 0x00018000,
- },
- { /* 45~74.5M */
0x003e714a, 0x1e022220, 0x00018000,
},
- { /* 77~155M */
- 0x003c714a, 0x1e022220, 0x00018000,
- },
- { /* 155~340M */
- 0x003c714a, 0x1e022220, 0x00018000,
- },
- { /* 340~525M */
- 0x003c714a, 0x1e022220, 0x0001a000,
- },
- { /* 525~600M */
- /*0x002c714a, 0x1e022220, 0x00018000,*/
- 0x003e714a, 0x1e022220, 0x0001a000,
- },
-};
-
-
-/* long cable */
-static const uint32_t phy_dchd_3[][3] = {
- /* 0xe5 0xe6 0xe7 */
- { /* 24~45M */
- 0x002e712a, 0x1e062620, 0x00018000,
- },
{ /* 45~74.5M */
- 0x002e714a, 0x1e062620, 0x00018000,
- },
- { /* 77~155M */
- 0x002c715a, 0x1e062620, 0x00018000,
- },
- { /* 155~340M */
- 0x002c715a, 0x1e062620, 0x00018000,
- },
- { /* 340~525M */
- 0x002c715a, 0x1e051650, 0x00018000,
- },
- { /* 525~600M */
- 0x002c715a, 0x1e051650, 0x00018000,
- },
-};
-
-/* short cable */
-static const uint32_t phy_dchd_4[][3] = {
- /* 0xe5 0xe6 0xe7 */
- { /* 24~45M */
- 0x002e712a, 0x1e022220, 0x00018000,
- },
- { /* 45~74.5M */
- 0x002e714a, 0x1e022220, 0x00018000,
+ 0x003e714a, 0x1e022220, 0x00018000,
},
{ /* 77~155M */
- 0x002c715a, 0x1e022220, 0x00018000,
+ 0x003c714a, 0x1e022220, 0x00018000,
},
{ /* 155~340M */
- 0x002c715a, 0x1e022220, 0x00018000,
+ 0x003c714a, 0x1e022220, 0x0001a000,
},
{ /* 340~525M */
- 0x002c715a, 0x1e012330, 0x0001a000,
+ 0x003c714a, 0x1e040460, 0x0001a000,
},
{ /* 525~600M */
- 0x002c715a, 0x1e022220, 0x00018000,
+ 0x003e714a, 0x1e040460, 0x0001a000,
},
};
wr_reg_hhi(HHI_HDMIRX_PHY_DCHA_CNTL2,
phy_dcha[idx][2]);
}
- wr_reg_hhi(HHI_HDMIRX_PHY_DCHD_CNTL0,
- phy_dchd_1[idx][0]);
+ if (cdr_lock_level == 0)
+ wr_reg_hhi(HHI_HDMIRX_PHY_DCHD_CNTL0,
+ phy_dchd_1[idx][0]);
+ else if (cdr_lock_level == 1)
+ wr_reg_hhi(HHI_HDMIRX_PHY_DCHD_CNTL0,
+ 0x006f0041);
+ else if (cdr_lock_level == 2)
+ wr_reg_hhi(HHI_HDMIRX_PHY_DCHD_CNTL0,
+ 0x002f714a);
wr_reg_hhi(HHI_HDMIRX_PHY_DCHD_CNTL2,
phy_dchd_1[idx][2]);
phy_dcha[idx][2]);
}
- wr_reg_hhi(HHI_HDMIRX_PHY_DCHD_CNTL0, phy_dchd_1[idx][0]);
+ if (cdr_lock_level == 0)
+ wr_reg_hhi(HHI_HDMIRX_PHY_DCHD_CNTL0,
+ phy_dchd_1[idx][0]);
+ else if (cdr_lock_level == 1)
+ wr_reg_hhi(HHI_HDMIRX_PHY_DCHD_CNTL0,
+ 0x006f0041);
+ else if (cdr_lock_level == 2)
+ wr_reg_hhi(HHI_HDMIRX_PHY_DCHD_CNTL0,
+ 0x002f714a);
+ wr_reg_hhi(HHI_HDMIRX_PHY_DCHD_CNTL2,
+ phy_dchd_1[idx][2]);
+
wr_reg_hhi(HHI_HDMIRX_PHY_DCHD_CNTL2, phy_dchd_1[idx][2]);
if ((rx.phy.cablesel % 2) == 0)
data32 = phy_dchd_1[idx][1];
if (find_best_eq) {
data32 = phy_dchd_1[idx][1] & (~(MSK(16, 4)));
data32 |= find_best_eq << 4;
- } else if ((rx.phy.cablesel % 4) == 0)
+ } else if ((rx.phy.cablesel % 2) == 0)
data32 = phy_dchd_1[idx][1];
-
- else if ((rx.phy.cablesel % 4) == 1)
+ else if ((rx.phy.cablesel % 2) == 1)
data32 = phy_dchd_2[idx][1];
- else if ((rx.phy.cablesel % 4) == 2)
- data32 = phy_dchd_3[idx][1];
-
- else if ((rx.phy.cablesel % 4) == 3)
- data32 = phy_dchd_4[idx][1];
-
wr_reg_hhi(HHI_HDMIRX_PHY_DCHD_CNTL1, data32);
udelay(5);
if (is_tl1_former())
data2 = 0x000100c0;
else
- data2 = 0x080100c0;
+ /* decrease pll bw*/
+ data2 = 0x080130c0;//0x080100c0
data2 |= (od << 24);
wr_reg_hhi(HHI_HDMIRX_APLL_CNTL4, data2);
udelay(5);
static int hpd_wait_max = 40;
static int sig_unstable_cnt;
-static int sig_unstable_max = 80;
+static int sig_unstable_max = 40;/* 80 */
bool vic_check_en;
bool dvi_check_en;
static bool hdcp22_esm_reset2_enable;
int sm_pause;
int pre_port = 0xff;
-static int hdcp_none_wait_max = 100;
+static int hdcp_none_wait_max = 50;/* 100 */
static int esd_phy_rst_cnt;
static int esd_phy_rst_max;
static int cec_dev_info;
return pr_var(hdcp_enc_mode, index);
if (set_pr_var(tmpbuf, hbr_force_8ch, value, &index, ret))
return pr_var(hbr_force_8ch, index);
+ if (set_pr_var(tmpbuf, cdr_lock_level, value, &index, ret))
+ return pr_var(cdr_lock_level, index);
return 0;
}
pr_var(pll_rst_max, i++);
pr_var(hdcp_enc_mode, i++);
pr_var(hbr_force_8ch, i++);
+ pr_var(cdr_lock_level, i++);
}
void skip_frame(unsigned int cnt)
dvi_check_en = false;
break;
}
+ sig_stable_cnt = 0;
rx.skip = 0;
rx.state = FSM_SIG_READY;
rx.aud_sr_stable_cnt = 0;
static void dump_phy_status(void)
{
- uint32_t val0, val1, val2;
+ uint32_t val0, val1, val2, data32;
rx_pr("[PHY info]\n");
if (rx.chip_id >= CHIP_ID_TL1) {
rx_pr("TMDS_ALIGN_STAT = 0x%x\n",
hdmirx_rd_top(TOP_TMDS_ALIGN_STAT));
rx_pr("all valid = 0x%x\n", aml_phy_tmds_valid());
+
+ data32 = rd_reg_hhi(HHI_HDMIRX_PHY_DCHD_CNTL1);
+ data32 = data32 & 0xf0ffffff;
+ wr_reg_hhi(HHI_HDMIRX_PHY_DCHD_CNTL1, data32);
+ rx_pr("0x3bc-0=%x\n", rd_reg_hhi(HHI_HDMIRX_PHY_DCHD_STAT));
+ udelay(10);
+ data32 = ((data32 & 0xf0ffffff) | (0x2 << 24));
+ wr_reg_hhi(HHI_HDMIRX_PHY_DCHD_CNTL1, data32);
+ rx_pr("0x3bc-2=%x\n", rd_reg_hhi(HHI_HDMIRX_PHY_DCHD_STAT));
+ udelay(10);
+ data32 = ((data32 & 0xf0ffffff) | (0x4 << 24));
+ wr_reg_hhi(HHI_HDMIRX_PHY_DCHD_CNTL1, data32);
+ rx_pr("0x3bc-4=%x\n", rd_reg_hhi(HHI_HDMIRX_PHY_DCHD_STAT));
+ udelay(10);
+ data32 = ((data32 & 0xf0ffffff) | (0x6 << 24));
+ wr_reg_hhi(HHI_HDMIRX_PHY_DCHD_CNTL1, data32);
+ rx_pr("0x3bc-6=%x\n", rd_reg_hhi(HHI_HDMIRX_PHY_DCHD_STAT));
+ udelay(10);
+ data32 = ((data32 & 0xf0ffffff) | (0xe << 24));
+ wr_reg_hhi(HHI_HDMIRX_PHY_DCHD_CNTL1, data32);
+ if (log_level & VIDEO_LOG) {
+ rx_pr("0x3bc-e=%x\n",
+ rd_reg_hhi(HHI_HDMIRX_PHY_DCHD_STAT));
+ rx_pr("0x3bc-e=%x\n",
+ rd_reg_hhi(HHI_HDMIRX_PHY_DCHD_STAT));
+ rx_pr("0x3bc-e=%x\n",
+ rd_reg_hhi(HHI_HDMIRX_PHY_DCHD_STAT));
+ rx_pr("0x3bc-e=%x\n",
+ rd_reg_hhi(HHI_HDMIRX_PHY_DCHD_STAT));
+ rx_pr("0x3bc-e=%x\n",
+ rd_reg_hhi(HHI_HDMIRX_PHY_DCHD_STAT));
+ rx_pr("0x3bc-e=%x\n",
+ rd_reg_hhi(HHI_HDMIRX_PHY_DCHD_STAT));
+ rx_pr("0x3bc-e=%x\n",
+ rd_reg_hhi(HHI_HDMIRX_PHY_DCHD_STAT));
+ rx_pr("0x3bc-e=%x\n",
+ rd_reg_hhi(HHI_HDMIRX_PHY_DCHD_STAT));
+ rx_pr("0x3bc-e=%x\n",
+ rd_reg_hhi(HHI_HDMIRX_PHY_DCHD_STAT));
+ rx_pr("0x3bc-e=%x\n",
+ rd_reg_hhi(HHI_HDMIRX_PHY_DCHD_STAT));
+ rx_pr("0x3bc-e=%x\n",
+ rd_reg_hhi(HHI_HDMIRX_PHY_DCHD_STAT));
+ rx_pr("0x3bc-e=%x\n",
+ rd_reg_hhi(HHI_HDMIRX_PHY_DCHD_STAT));
+ rx_pr("0x3bc-e=%x\n",
+ rd_reg_hhi(HHI_HDMIRX_PHY_DCHD_STAT));
+ }
}
}