Skip to content

Commit 3fbb3a6

Browse files
Venkateshwar Rao GannavarapuMichal Simek
authored andcommitted
drm: xlnx: hdmi: Add FRL support in PIO interrupt handler
This patch adds support for FRL mode in PIO interrupt handler. Signed-off-by: Venkateshwar Rao Gannavarapu <venkateshwar.rao.gannavarapu@xilinx.com>
1 parent 0d283cd commit 3fbb3a6

File tree

1 file changed

+68
-34
lines changed

1 file changed

+68
-34
lines changed

‎drivers/gpu/drm/xlnx/xlnx_hdmi.c‎

Lines changed: 68 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2018,7 +2018,7 @@ xlnx_hdmi_start_frl_train(struct xlnx_hdmi *hdmi, u32 frl_rate)
20182018
static void xlnx_hdmi_piointr_handler(struct xlnx_hdmi *hdmi)
20192019
{
20202020
union phy_configure_opts phy_cfg = {0};
2021-
int ret;
2021+
int ret, i;
20222022
u32 event, data;
20232023

20242024
/* Read PIO IN Event register */
@@ -2040,28 +2040,49 @@ static void xlnx_hdmi_piointr_handler(struct xlnx_hdmi *hdmi)
20402040
if (data & HDMI_TX_PIO_IN_HPD_CONNECT) {
20412041
hdmi->cable_connected = 1;
20422042
hdmi->connector.status = connector_status_connected;
2043-
xlnx_hdmi_frl_sleep(hdmi);
20442043
xlnx_hdmi_ddc_disable(hdmi);
20452044

20462045
phy_cfg.hdmi.ibufds = 1;
20472046
phy_cfg.hdmi.ibufds_en = true;
2048-
ret = phy_configure(hdmi->phy[0], &phy_cfg);
2049-
if (ret)
2050-
dev_err(hdmi->dev, "phy_cfg: Ibufds err\n");
2047+
for (i = 0; i < HDMI_MAX_LANES; i++) {
2048+
ret = phy_configure(hdmi->phy[i], &phy_cfg);
2049+
if (ret) {
2050+
dev_err(hdmi->dev, "phy_cfg: Ibufds err\n");
2051+
return;
2052+
}
2053+
}
20512054

20522055
phy_cfg.hdmi.config_hdmi20 = 1;
2053-
ret = phy_configure(hdmi->phy[0], &phy_cfg);
2054-
if (ret)
2055-
dev_err(hdmi->dev, "phy_cfg: hdmi20 err\n");
2056+
for (i = 0; i < HDMI_MAX_LANES; i++) {
2057+
ret = phy_configure(hdmi->phy[i], &phy_cfg);
2058+
if (ret) {
2059+
dev_err(hdmi->dev, "phy_cfg: hdmi20 err\n");
2060+
return;
2061+
}
2062+
}
2063+
2064+
phy_cfg.hdmi.clkout1_obuftds = 1;
2065+
phy_cfg.hdmi.clkout1_obuftds_en = false;
2066+
for (i = 0; i < HDMI_MAX_LANES; i++) {
2067+
ret = phy_configure(hdmi->phy[i], &phy_cfg);
2068+
if (ret) {
2069+
dev_err(hdmi->dev, "phy_cfg:obuftds_en err\n");
2070+
return;
2071+
}
2072+
}
20562073
} else {
20572074
hdmi->cable_connected = 0;
20582075
hdmi->connector.status = connector_status_disconnected;
20592076
dev_info(hdmi->dev, "stream is not connected\n");
20602077
phy_cfg.hdmi.clkout1_obuftds = 1;
20612078
phy_cfg.hdmi.clkout1_obuftds_en = false;
2062-
ret = phy_configure(hdmi->phy[0], &phy_cfg);
2063-
if (ret)
2064-
dev_err(hdmi->dev, "phy_cfg:10bufds_en err\n");
2079+
for (i = 0; i < HDMI_MAX_LANES; i++) {
2080+
ret = phy_configure(hdmi->phy[i], &phy_cfg);
2081+
if (ret) {
2082+
dev_err(hdmi->dev, "phy_cfg:obuftds_dis err\n");
2083+
return;
2084+
}
2085+
}
20652086
}
20662087

20672088
if (hdmi->connector.dev)
@@ -2072,6 +2093,8 @@ static void xlnx_hdmi_piointr_handler(struct xlnx_hdmi *hdmi)
20722093

20732094
/* Bridge Unlocked event has occurred */
20742095
if (event & HDMI_TX_PIO_IN_BRIDGE_LOCKED) {
2096+
dev_dbg(hdmi->dev, "PIO IN status = 0x%x\n",
2097+
xlnx_hdmi_readl(hdmi, HDMI_TX_PIO_IN));
20752098
if (data & HDMI_TX_PIO_IN_BRIDGE_LOCKED)
20762099
dev_dbg(hdmi->dev, "Bridge locked\n");
20772100
else
@@ -2091,30 +2114,41 @@ static void xlnx_hdmi_piointr_handler(struct xlnx_hdmi *hdmi)
20912114
/* Check the link status */
20922115
if (data & HDMI_TX_PIO_IN_LNK_RDY) {
20932116
hdmi->stream.state = HDMI_TX_STATE_STREAM_UP;
2094-
xlnx_hdmi_aux_enable(hdmi);
2095-
xlnx_hdmi_auxintr_enable(hdmi);
2117+
if (hdmi->stream.frl_config.frl_train_states ==
2118+
HDMI_TX_FRLSTATE_LTS_3_ARM) {
2119+
/* Execute state machine */
2120+
xlnx_hdmi_exec_frl_state(hdmi);
2121+
}
2122+
if (!hdmi->stream.is_frl) {
2123+
xlnx_hdmi_aux_enable(hdmi);
2124+
xlnx_hdmi_auxintr_enable(hdmi);
2125+
2126+
phy_cfg.hdmi.clkout1_obuftds = 1;
2127+
phy_cfg.hdmi.clkout1_obuftds_en = true;
2128+
for (i = 0; i < HDMI_MAX_LANES; i++) {
2129+
ret = phy_configure(hdmi->phy[i],
2130+
&phy_cfg);
2131+
if (ret) {
2132+
dev_err(hdmi->dev, "phy_cfg: 10bufds_en err\n");
2133+
return;
2134+
}
2135+
}
2136+
xlnx_hdmi_set_samplerate(hdmi, 1);
20962137

2097-
phy_cfg.hdmi.clkout1_obuftds = 1;
2098-
phy_cfg.hdmi.clkout1_obuftds_en = true;
2099-
ret = phy_configure(hdmi->phy[0], &phy_cfg);
2100-
if (ret)
2101-
dev_err(hdmi->dev, "phy_cfg: 10bufds_en err\n");
2102-
2103-
xlnx_hdmi_set_samplerate(hdmi, 1);
2104-
2105-
/* release vid_in bridge resets */
2106-
xlnx_hdmi_ext_sysrst_deassert(hdmi);
2107-
xlnx_hdmi_ext_vrst_deassert(hdmi);
2108-
/* release tx core resets */
2109-
xlnx_hdmi_int_lrst_deassert(hdmi);
2110-
xlnx_hdmi_int_vrst_deassert(hdmi);
2111-
2112-
hdmi->hdmi_stream_up = 1;
2113-
2114-
xlnx_pioout_bridge_yuv_clr(hdmi);
2115-
xlnx_pioout_bridge_pixel_clr(hdmi);
2116-
xlnx_hdmi_stream_start(hdmi);
2117-
xlnx_hdmi_clkratio(hdmi);
2138+
/* release vid_in bridge resets */
2139+
xlnx_hdmi_ext_sysrst_deassert(hdmi);
2140+
xlnx_hdmi_ext_vrst_deassert(hdmi);
2141+
/* release tx core resets */
2142+
xlnx_hdmi_int_lrst_deassert(hdmi);
2143+
xlnx_hdmi_int_vrst_deassert(hdmi);
2144+
2145+
hdmi->hdmi_stream_up = 1;
2146+
2147+
xlnx_pioout_bridge_yuv_clr(hdmi);
2148+
xlnx_pioout_bridge_pixel_clr(hdmi);
2149+
xlnx_hdmi_stream_start(hdmi);
2150+
xlnx_hdmi_clkratio(hdmi);
2151+
}
21182152
} else {
21192153
/* Set stream status to down */
21202154
hdmi->stream.state = HDMI_TX_STATE_STREAM_DOWN;

0 commit comments

Comments
 (0)