Skip to content

Commit 6bdeff1

Browse files
Rodrigo Siqueiraalexdeucher
authored andcommitted
drm/amd/display: Add get_dig_frontend implementation for DCEx
Some old ASICs might not implement/require get_dig_frontend helper; in this scenario, we can have a NULL pointer exception when we try to call it inside vbios disable operation. For example, this situation might happen when using Polaris12 with an eDP panel. This commit avoids this situation by adding a specific get_dig_frontend implementation for DCEx. Cc: Alex Deucher <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Harry Wentland <[email protected]> Cc: Nicholas Kazlauskas <[email protected]> Cc: Chiawen Huang <[email protected]> Reported-and-tested-by: Borislav Petkov <[email protected]> Acked-by: Alex Deucher <[email protected]> Signed-off-by: Rodrigo Siqueira <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Cc: [email protected]
1 parent e607f6d commit 6bdeff1

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ static const struct link_encoder_funcs dce110_lnk_enc_funcs = {
120120
.is_dig_enabled = dce110_is_dig_enabled,
121121
.destroy = dce110_link_encoder_destroy,
122122
.get_max_link_cap = dce110_link_encoder_get_max_link_cap,
123+
.get_dig_frontend = dce110_get_dig_frontend,
123124
};
124125

125126
static enum bp_result link_transmitter_control(
@@ -235,6 +236,44 @@ static void set_link_training_complete(
235236

236237
}
237238

239+
unsigned int dce110_get_dig_frontend(struct link_encoder *enc)
240+
{
241+
struct dce110_link_encoder *enc110 = TO_DCE110_LINK_ENC(enc);
242+
u32 value;
243+
enum engine_id result;
244+
245+
REG_GET(DIG_BE_CNTL, DIG_FE_SOURCE_SELECT, &value);
246+
247+
switch (value) {
248+
case DCE110_DIG_FE_SOURCE_SELECT_DIGA:
249+
result = ENGINE_ID_DIGA;
250+
break;
251+
case DCE110_DIG_FE_SOURCE_SELECT_DIGB:
252+
result = ENGINE_ID_DIGB;
253+
break;
254+
case DCE110_DIG_FE_SOURCE_SELECT_DIGC:
255+
result = ENGINE_ID_DIGC;
256+
break;
257+
case DCE110_DIG_FE_SOURCE_SELECT_DIGD:
258+
result = ENGINE_ID_DIGD;
259+
break;
260+
case DCE110_DIG_FE_SOURCE_SELECT_DIGE:
261+
result = ENGINE_ID_DIGE;
262+
break;
263+
case DCE110_DIG_FE_SOURCE_SELECT_DIGF:
264+
result = ENGINE_ID_DIGF;
265+
break;
266+
case DCE110_DIG_FE_SOURCE_SELECT_DIGG:
267+
result = ENGINE_ID_DIGG;
268+
break;
269+
default:
270+
// invalid source select DIG
271+
result = ENGINE_ID_UNKNOWN;
272+
}
273+
274+
return result;
275+
}
276+
238277
void dce110_link_encoder_set_dp_phy_pattern_training_pattern(
239278
struct link_encoder *enc,
240279
uint32_t index)
@@ -1665,7 +1704,8 @@ static const struct link_encoder_funcs dce60_lnk_enc_funcs = {
16651704
.disable_hpd = dce110_link_encoder_disable_hpd,
16661705
.is_dig_enabled = dce110_is_dig_enabled,
16671706
.destroy = dce110_link_encoder_destroy,
1668-
.get_max_link_cap = dce110_link_encoder_get_max_link_cap
1707+
.get_max_link_cap = dce110_link_encoder_get_max_link_cap,
1708+
.get_dig_frontend = dce110_get_dig_frontend
16691709
};
16701710

16711711
void dce60_link_encoder_construct(

drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,8 @@ void dce110_link_encoder_connect_dig_be_to_fe(
295295
enum engine_id engine,
296296
bool connect);
297297

298+
unsigned int dce110_get_dig_frontend(struct link_encoder *enc);
299+
298300
void dce110_link_encoder_set_dp_phy_pattern_training_pattern(
299301
struct link_encoder *enc,
300302
uint32_t index);

0 commit comments

Comments
 (0)