Commit 80d57245 authored by Tomi Valkeinen's avatar Tomi Valkeinen Committed by Andrzej Hajda

drm/bridge: tc358767: split stream enable/disable

It is nicer to have enable/disable functions instead of set(bool enable)
style function.

Split tc_main_link_stream into tc_stream_enable and tc_stream_disable.
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: default avatarAndrzej Hajda <a.hajda@samsung.com>
Signed-off-by: default avatarAndrzej Hajda <a.hajda@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190528082747.3631-9-tomi.valkeinen@ti.com
parent 5761a259
...@@ -1014,22 +1014,21 @@ static int tc_main_link_setup(struct tc_data *tc) ...@@ -1014,22 +1014,21 @@ static int tc_main_link_setup(struct tc_data *tc)
return ret; return ret;
} }
static int tc_main_link_stream(struct tc_data *tc, int state) static int tc_stream_enable(struct tc_data *tc)
{ {
int ret; int ret;
u32 value; u32 value;
dev_dbg(tc->dev, "stream: %d\n", state); dev_dbg(tc->dev, "enable video stream\n");
if (state) {
ret = tc_set_video_mode(tc, tc->mode); ret = tc_set_video_mode(tc, tc->mode);
if (ret) if (ret)
goto err; return ret;
/* Set M/N */ /* Set M/N */
ret = tc_stream_clock_calc(tc); ret = tc_stream_clock_calc(tc);
if (ret) if (ret)
goto err; return ret;
value = VID_MN_GEN | DP_EN; value = VID_MN_GEN | DP_EN;
if (tc->link.base.capabilities & DP_LINK_CAP_ENHANCED_FRAMING) if (tc->link.base.capabilities & DP_LINK_CAP_ENHANCED_FRAMING)
...@@ -1052,9 +1051,19 @@ static int tc_main_link_stream(struct tc_data *tc, int state) ...@@ -1052,9 +1051,19 @@ static int tc_main_link_stream(struct tc_data *tc, int state)
else else
value |= DP0_VIDSRC_DPI_RX; value |= DP0_VIDSRC_DPI_RX;
tc_write(SYSCTRL, value); tc_write(SYSCTRL, value);
} else {
return 0;
err:
return ret;
}
static int tc_stream_disable(struct tc_data *tc)
{
int ret;
dev_dbg(tc->dev, "disable video stream\n");
tc_write(DP0CTL, 0); tc_write(DP0CTL, 0);
}
return 0; return 0;
err: err:
...@@ -1079,7 +1088,7 @@ static void tc_bridge_enable(struct drm_bridge *bridge) ...@@ -1079,7 +1088,7 @@ static void tc_bridge_enable(struct drm_bridge *bridge)
return; return;
} }
ret = tc_main_link_stream(tc, 1); ret = tc_stream_enable(tc);
if (ret < 0) { if (ret < 0) {
dev_err(tc->dev, "main link stream start error: %d\n", ret); dev_err(tc->dev, "main link stream start error: %d\n", ret);
return; return;
...@@ -1095,7 +1104,7 @@ static void tc_bridge_disable(struct drm_bridge *bridge) ...@@ -1095,7 +1104,7 @@ static void tc_bridge_disable(struct drm_bridge *bridge)
drm_panel_disable(tc->panel); drm_panel_disable(tc->panel);
ret = tc_main_link_stream(tc, 0); ret = tc_stream_disable(tc);
if (ret < 0) if (ret < 0)
dev_err(tc->dev, "main link stream stop error: %d\n", ret); dev_err(tc->dev, "main link stream stop error: %d\n", ret);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment