[PATCH 4.18 165/197] drm/amd/display: Dont share clk source between DP and HDMI

From: Greg Kroah-Hartman
Date: Thu Sep 13 2018 - 10:03:46 EST


4.18-stable review patch. If anyone has any objections, please let me know.

------------------

From: Mikita Lipski <mikita.lipski@xxxxxxx>

commit 3e27e10e2ecee0d3a0083f8ae76354ac9c6ad15c upstream.

[why]
Prevent clock source sharing between HDMI and DP connectors.
DP shouldn't be sharing its ref clock with phy clock,
which caused an issue of older ASICS booting up with multiple
diplays plugged in.

[how]
Add an extra check that would prevent HDMI and DP sharing clk.

Signed-off-by: Mikita Lipski <mikita.lipski@xxxxxxx>
Reviewed-by: Hersen Wu <hersenxs.wu@xxxxxxx>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@xxxxxxx>
Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 22 +++++++++++++++-
drivers/gpu/drm/amd/display/dc/dc.h | 1
drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c | 2 -
drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c | 3 ++
4 files changed, 26 insertions(+), 2 deletions(-)

--- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
@@ -330,6 +330,9 @@ bool resource_are_streams_timing_synchro
!= stream2->timing.pix_clk_khz)
return false;

+ if (stream1->clamping.c_depth != stream2->clamping.c_depth)
+ return false;
+
if (stream1->phy_pix_clk != stream2->phy_pix_clk
&& (!dc_is_dp_signal(stream1->signal)
|| !dc_is_dp_signal(stream2->signal)))
@@ -337,6 +340,20 @@ bool resource_are_streams_timing_synchro

return true;
}
+static bool is_dp_and_hdmi_sharable(
+ struct dc_stream_state *stream1,
+ struct dc_stream_state *stream2)
+{
+ if (stream1->ctx->dc->caps.disable_dp_clk_share)
+ return false;
+
+ if (stream1->clamping.c_depth != COLOR_DEPTH_888 ||
+ stream2->clamping.c_depth != COLOR_DEPTH_888)
+ return false;
+
+ return true;
+
+}

static bool is_sharable_clk_src(
const struct pipe_ctx *pipe_with_clk_src,
@@ -348,7 +365,10 @@ static bool is_sharable_clk_src(
if (pipe_with_clk_src->stream->signal == SIGNAL_TYPE_VIRTUAL)
return false;

- if (dc_is_dp_signal(pipe_with_clk_src->stream->signal))
+ if (dc_is_dp_signal(pipe_with_clk_src->stream->signal) ||
+ (dc_is_dp_signal(pipe->stream->signal) &&
+ !is_dp_and_hdmi_sharable(pipe_with_clk_src->stream,
+ pipe->stream)))
return false;

if (dc_is_hdmi_signal(pipe_with_clk_src->stream->signal)
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -77,6 +77,7 @@ struct dc_caps {
bool dual_link_dvi;
bool post_blend_color_processing;
bool force_dp_tps4_for_cp2520;
+ bool disable_dp_clk_share;
};

struct dc_dcc_surface_param {
--- a/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c
@@ -884,7 +884,7 @@ static bool construct(
dc->caps.i2c_speed_in_khz = 40;
dc->caps.max_cursor_size = 128;
dc->caps.dual_link_dvi = true;
-
+ dc->caps.disable_dp_clk_share = true;
for (i = 0; i < pool->base.pipe_count; i++) {
pool->base.timing_generators[i] =
dce100_timing_generator_create(
--- a/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c
@@ -902,6 +902,7 @@ static bool dce80_construct(
}

dc->caps.max_planes = pool->base.pipe_count;
+ dc->caps.disable_dp_clk_share = true;

if (!resource_construct(num_virtual_links, dc, &pool->base,
&res_create_funcs))
@@ -1087,6 +1088,7 @@ static bool dce81_construct(
}

dc->caps.max_planes = pool->base.pipe_count;
+ dc->caps.disable_dp_clk_share = true;

if (!resource_construct(num_virtual_links, dc, &pool->base,
&res_create_funcs))
@@ -1268,6 +1270,7 @@ static bool dce83_construct(
}

dc->caps.max_planes = pool->base.pipe_count;
+ dc->caps.disable_dp_clk_share = true;

if (!resource_construct(num_virtual_links, dc, &pool->base,
&res_create_funcs))