Skip to content

Commit 1239902

Browse files
zehortigozarodrigovivi
authored andcommitted
drm/i915/display: Load DP_TP_CTL/STATUS offset before use it
Right now dp.regs.dp_tp_ctl/status are only set during the encoder pre_enable() hook, what is causing all reads and writes to those registers to go to offset 0x0 before pre_enable() is executed. So if i915 takes the BIOS state and don't do a modeset any following link retraing will fail. In the case that i915 needs to do a modeset, the DDI disable sequence will write to a wrong register not disabling DP 'Transport Enable' in DP_TP_CTL, making a HDMI modeset in the same port/transcoder to not light up the monitor. So here for GENs older than 12, that have those registers fixed at port offset range it is loading at encoder/port init while for GEN12 it will keep setting it at encoder pre_enable() and during HW state readout. Fixes: 4444df6 ("drm/i915/tgl: move DP_TP_* to transcoder") Cc: Matt Roper <[email protected]> Cc: Lucas De Marchi <[email protected]> Signed-off-by: José Roberto de Souza <[email protected]> Reviewed-by: Matt Roper <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] (cherry picked from commit edcb902) Signed-off-by: Rodrigo Vivi <[email protected]>
1 parent 335f62e commit 1239902

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

drivers/gpu/drm/i915/display/intel_ddi.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3141,9 +3141,6 @@ static void hsw_ddi_pre_enable_dp(struct intel_encoder *encoder,
31413141
intel_dp_set_link_params(intel_dp, crtc_state->port_clock,
31423142
crtc_state->lane_count, is_mst);
31433143

3144-
intel_dp->regs.dp_tp_ctl = DP_TP_CTL(port);
3145-
intel_dp->regs.dp_tp_status = DP_TP_STATUS(port);
3146-
31473144
intel_edp_panel_on(intel_dp);
31483145

31493146
intel_ddi_clk_select(encoder, crtc_state);
@@ -3848,12 +3845,18 @@ void intel_ddi_get_config(struct intel_encoder *encoder,
38483845
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
38493846
struct intel_crtc *intel_crtc = to_intel_crtc(pipe_config->uapi.crtc);
38503847
enum transcoder cpu_transcoder = pipe_config->cpu_transcoder;
3848+
struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
38513849
u32 temp, flags = 0;
38523850

38533851
/* XXX: DSI transcoder paranoia */
38543852
if (drm_WARN_ON(&dev_priv->drm, transcoder_is_dsi(cpu_transcoder)))
38553853
return;
38563854

3855+
if (INTEL_GEN(dev_priv) >= 12) {
3856+
intel_dp->regs.dp_tp_ctl = TGL_DP_TP_CTL(cpu_transcoder);
3857+
intel_dp->regs.dp_tp_status = TGL_DP_TP_STATUS(cpu_transcoder);
3858+
}
3859+
38573860
intel_dsc_get_config(encoder, pipe_config);
38583861

38593862
temp = intel_de_read(dev_priv, TRANS_DDI_FUNC_CTL(cpu_transcoder));
@@ -4173,6 +4176,7 @@ static const struct drm_encoder_funcs intel_ddi_funcs = {
41734176
static struct intel_connector *
41744177
intel_ddi_init_dp_connector(struct intel_digital_port *intel_dig_port)
41754178
{
4179+
struct drm_i915_private *dev_priv = to_i915(intel_dig_port->base.base.dev);
41764180
struct intel_connector *connector;
41774181
enum port port = intel_dig_port->base.port;
41784182

@@ -4183,6 +4187,10 @@ intel_ddi_init_dp_connector(struct intel_digital_port *intel_dig_port)
41834187
intel_dig_port->dp.output_reg = DDI_BUF_CTL(port);
41844188
intel_dig_port->dp.prepare_link_retrain =
41854189
intel_ddi_prepare_link_retrain;
4190+
if (INTEL_GEN(dev_priv) < 12) {
4191+
intel_dig_port->dp.regs.dp_tp_ctl = DP_TP_CTL(port);
4192+
intel_dig_port->dp.regs.dp_tp_status = DP_TP_STATUS(port);
4193+
}
41864194

41874195
if (!intel_dp_init_connector(intel_dig_port, connector)) {
41884196
kfree(connector);

drivers/gpu/drm/i915/display/intel_dp.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2517,9 +2517,6 @@ static void intel_dp_prepare(struct intel_encoder *encoder,
25172517
intel_crtc_has_type(pipe_config,
25182518
INTEL_OUTPUT_DP_MST));
25192519

2520-
intel_dp->regs.dp_tp_ctl = DP_TP_CTL(port);
2521-
intel_dp->regs.dp_tp_status = DP_TP_STATUS(port);
2522-
25232520
/*
25242521
* There are four kinds of DP registers:
25252522
*
@@ -7836,6 +7833,8 @@ bool intel_dp_init(struct drm_i915_private *dev_priv,
78367833

78377834
intel_dig_port->dp.output_reg = output_reg;
78387835
intel_dig_port->max_lanes = 4;
7836+
intel_dig_port->dp.regs.dp_tp_ctl = DP_TP_CTL(port);
7837+
intel_dig_port->dp.regs.dp_tp_status = DP_TP_STATUS(port);
78397838

78407839
intel_encoder->type = INTEL_OUTPUT_DP;
78417840
intel_encoder->power_domain = intel_port_to_power_domain(port);

0 commit comments

Comments
 (0)