Haswell VGA fixes
Subsystems (2)
cover Haswell VGA fixes
From: Paulo Zanoni <[email protected]>
Hi
As you may have noticed this is not "Haswell VGA enablement", but "Haswell VGA fixes" since VGA is already enabled on Haswell. Even though it's enabled, whenever I try to "xrandr --output VGA1 --auto" my machine hard hangs.
So what does this series fixes?
- It makes our code follow the "mode set sequence for CRT" described in our documentation.
- It makes my old VGA monitor work :)
What kind of problems remain?
- I really don't know exactly what problems remain, but this series just does not touch the code that sets the PCH clocks and I'm sure that code is incomplete. We are probably still relying on the fact that the BIOS enables things for us. But since I didn't even touch that code and VGA works for me, I think we can address those problems in a later patch series.
How does the series fix the problems?
- It forks some of the Ironlake PCH functions.
- It makes all those forked functions aware of the fact that there's only one CPU transcoder and that CPU transcoder may be different from CPU pipe.
- It changes a lot of things to make sure we follow the mode set sequence.
The number of patches may be scary, but each patch tries to be really small and easy to review, so if you grab our "mode set sequence" document you'll be able to review a lot of patches in just a few minutes :)
Cheers,
Paulo
Paulo Zanoni (36):
drm/i915: don't set ADPA pipe select on LPT
drm/i915: use intel_ddi_get_hw_state on CRT encoder too drm/i915: add lpt_pch_enable
drm/i915: remove Haswell/LPT bits from ironlake_pch_enable drm/i915: remove ironlake bits from lpt_pch_enable drm/i915: train Haswell FDI at the right time
drm/i915: use the right FDI_RX_CTL register on Haswell drm/i915: set the correct number of FDI lanes on Haswell drm/i915: don't rely on DDI_BUF_CTL previous values drm/i915: program the FDI RX TUSIZE register on hsw_fdi_link_train drm/i915: properly program FDI_RX_MISC pwrdn lane values on HSW drm/i915: wait only 35us for the FDI link training drm/i915: remove an useless indentation level on hsw_fdi_link_train drm/i915: disable FDI_RX_ENABLE, not FDI_RX_PLL_ENABLE drm/i915: change Haswell FDI link training error messages drm/i915: try each voltage twice at hsw_fdi_link_train drm/i915: fix Haswell FDI link disable path
drm/i915: don't write FDI_RX_TUSIZE on lpt_pch_enable drm/i915: rename intel_enable_pch_pll to ironlake_enable_pch_pll drm/i915: don't call ironlake_enable_pch_pll on lpt_pch_enable drm/i915: don't assert_panel_unlocked on LPT
drm/i915: use the CPU and PCH transcoders on lpt_pch_enable drm/i915: rename intel_{en,dis}able_transcoder
drm/i915: fork lpt version of ironlake_{en,dis}able_pch_transcoder drm/i915: remove Haswell code from ironlake_enable_pch_transcoder drm/i915: remove IBX code from lpt_enable_pch_transcoder drm/i915: don't assert_pch_pll_enabled on lpt_enable_pch_transcoder drm/i915: use CPU and PCH transcoders on lpt_enable_pch_transcoder drm/i915: use PIPECONF_INTERLACE_MASK_HSW on
lpt_enable_pch_transcoder
drm/i915: don't rely on previous values when setting LPT TRANSCONF drm/i915: don't assert_pch_ports_disabled on LPT drm/i915: use CPU and PCH transcoders on lpt_disable_pch_transcoder drm/i915: implement timing override workarounds on LPT drm/i915: don't intel_disable_pch_pll on Haswell/LPT drm/i915: don't limit Haswell CRT encoder to pipe A drm/i915: don't assert disabled FDI before disabling the FDI
drivers/gpu/drm/i915/i915_reg.h | 17 +++-- drivers/gpu/drm/i915/intel_crt.c | 14 ++-- drivers/gpu/drm/i915/intel_ddi.c | 134 +++++++++++++++++++++++------------ drivers/gpu/drm/i915/intel_display.c | 127 +++++++++++++++++++++++---------- drivers/gpu/drm/i915/intel_drv.h | 4 +- 5 files changed, 202 insertions(+), 94 deletions(-)
Signature · 1 line
1.7.11.4
PATCH 1/36 drm/i915: don't set ADPA pipe select on LPT
From: Paulo Zanoni <[email protected]>
Those bits just don't exist on LPT. The CRT DAC, PCH transcoder and FDI RX are always connected to DDI E.
--- drivers/gpu/drm/i915/intel_crt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_crt.c +3 -1
@@ -245,7 +245,9 @@ static void intel_crt_mode_set(struct drm_encoder *encoder, adpa |=ADPA_VSYNC_ACTIVE_HIGH ;/* For CPT allow 3 pipe config, for others just use A or B */ -if (HAS_PCH_CPT (dev)) +if (HAS_PCH_LPT (dev)) + ;/* Those bits don't exist here */ +else if (HAS_PCH_CPT (dev)) adpa |=PORT_TRANS_SEL_CPT (intel_crtc->pipe);else if (intel_crtc->pipe ==0 ) adpa |=ADPA_PIPE_A_SELECT ;
Signature · 1 line
1.7.11.4
PATCH 2/36 drm/i915: use intel_ddi_get_hw_state on CRT encoder too
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
Because things changed on Haswell/LPT and the bits checked by intel_crt_get_hw_state have moved to other registers.
--- drivers/gpu/drm/i915/intel_crt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_crt.c +4 -1
@@ -784,7 +784,10 @@ void intel_crt_init(struct drm_device *dev) crt->base.disable = intel_disable_crt; crt->base.enable = intel_enable_crt; - crt->base.get_hw_state = intel_crt_get_hw_state; +if (IS_HASWELL (dev)) + crt->base.get_hw_state = intel_ddi_get_hw_state; +else + crt->base.get_hw_state = intel_crt_get_hw_state; intel_connector->get_hw_state = intel_connector_get_hw_state;drm_encoder_helper_add (&crt->base.base, &crt_encoder_funcs);
Signature · 1 line
1.7.11.4
PATCH 3/36 drm/i915: add lpt_pch_enable
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
For now it's just a fork of ironlake_pch_enable. The next commits will change this.
--- drivers/gpu/drm/i915/intel_display.c | 111 ++++++++++++++++++++++++++++++++++- 1 file changed, 110 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +110 -1
@@ -3137,6 +3137,115 @@ static void ironlake_pch_enable(struct drm_crtc *crtc)intel_enable_transcoder (dev_priv, pipe); } +static void lpt_pch_enable (struct drm_crtc *crtc) +{ +struct drm_device *dev = crtc->dev; +struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +int pipe = intel_crtc->pipe; +u32 reg, temp; + +assert_transcoder_disabled (dev_priv, pipe); + +/* Write the TU size bits before fdi link training, so that error +* detection works. */ +I915_WRITE (FDI_RX_TUSIZE1 (pipe), +I915_READ (PIPE_DATA_M1 (pipe)) &TU_SIZE_MASK ); + +/* For PCH output, training FDI link */ + dev_priv->display.fdi_link_train (crtc); + +/* XXX: pch pll's can be enabled any time before we enable the PCH +* transcoder, and we actually should do this to not upset any PCH +* transcoder that already use the clock when we share it. +* +* Note that enable_pch_pll tries to do the right thing, but get_pch_pll +* unconditionally resets the pll - we need that to have the right LVDS +* enable sequence. */ +intel_enable_pch_pll (intel_crtc); + +if (HAS_PCH_LPT (dev)) { +DRM_DEBUG_KMS ("LPT detected: programming iCLKIP\n" ); +lpt_program_iclkip (crtc); + }else if (HAS_PCH_CPT (dev)) { +u32 sel; + + temp =I915_READ (PCH_DPLL_SEL ); +switch (pipe) { +default : +case 0 : + temp |=TRANSA_DPLL_ENABLE ; + sel =TRANSA_DPLLB_SEL ; +break ; +case 1 : + temp |=TRANSB_DPLL_ENABLE ; + sel =TRANSB_DPLLB_SEL ; +break ; +case 2 : + temp |=TRANSC_DPLL_ENABLE ; + sel =TRANSC_DPLLB_SEL ; +break ; + } +if (intel_crtc->pch_pll->pll_reg == _PCH_DPLL_B) + temp |= sel; +else + temp &= ~sel; +I915_WRITE (PCH_DPLL_SEL , temp); + } + +/* set transcoder timing, panel must allow it */ +assert_panel_unlocked (dev_priv, pipe); +I915_WRITE (TRANS_HTOTAL (pipe),I915_READ (HTOTAL (pipe))); +I915_WRITE (TRANS_HBLANK (pipe),I915_READ (HBLANK (pipe))); +I915_WRITE (TRANS_HSYNC (pipe),I915_READ (HSYNC (pipe))); + +I915_WRITE (TRANS_VTOTAL (pipe),I915_READ (VTOTAL (pipe))); +I915_WRITE (TRANS_VBLANK (pipe),I915_READ (VBLANK (pipe))); +I915_WRITE (TRANS_VSYNC (pipe),I915_READ (VSYNC (pipe))); +I915_WRITE (TRANS_VSYNCSHIFT (pipe),I915_READ (VSYNCSHIFT (pipe))); + +if (!IS_HASWELL (dev)) +intel_fdi_normal_train (crtc); + +/* For PCH DP, enable TRANS_DP_CTL */ +if (HAS_PCH_CPT (dev) && + (intel_pipe_has_type (crtc,INTEL_OUTPUT_DISPLAYPORT ) || +intel_pipe_has_type (crtc,INTEL_OUTPUT_EDP ))) { +u32 bpc = (I915_READ (PIPECONF (pipe)) &PIPE_BPC_MASK ) >>5 ; + reg =TRANS_DP_CTL (pipe); + temp =I915_READ (reg); + temp &= ~(TRANS_DP_PORT_SEL_MASK | +TRANS_DP_SYNC_MASK | +TRANS_DP_BPC_MASK ); + temp |= (TRANS_DP_OUTPUT_ENABLE | +TRANS_DP_ENH_FRAMING ); + temp |= bpc <<9 ;/* same format but at 11:9 */ + +if (crtc->mode.flags &DRM_MODE_FLAG_PHSYNC ) + temp |=TRANS_DP_HSYNC_ACTIVE_HIGH ; +if (crtc->mode.flags &DRM_MODE_FLAG_PVSYNC ) + temp |=TRANS_DP_VSYNC_ACTIVE_HIGH ; + +switch (intel_trans_dp_port_sel (crtc)) { +case PCH_DP_B : + temp |=TRANS_DP_PORT_SEL_B ; +break ; +case PCH_DP_C : + temp |=TRANS_DP_PORT_SEL_C ; +break ; +case PCH_DP_D : + temp |=TRANS_DP_PORT_SEL_D ; +break ; +default : +BUG (); + } + +I915_WRITE (reg, temp); + } + +intel_enable_transcoder (dev_priv, pipe); +} +static void intel_put_pch_pll (struct intel_crtc *intel_crtc) {struct intel_pch_pll *pll = intel_crtc->pch_pll;
@@ -3383,7 +3492,7 @@ static void haswell_crtc_enable(struct drm_crtc *crtc)intel_enable_plane (dev_priv, plane, pipe);if (is_pch_port) -ironlake_pch_enable (crtc); +lpt_pch_enable (crtc);mutex_lock (&dev->struct_mutex);intel_update_fbc (dev);
Signature · 1 line
1.7.11.4
PATCH 4/36 drm/i915: remove Haswell/LPT bits from ironlake_pch_enable
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
Since now we have lpt_pch_enable for them.
--- drivers/gpu/drm/i915/intel_display.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_display.c +2 -6
@@ -3055,10 +3055,7 @@ static void ironlake_pch_enable(struct drm_crtc *crtc)* enable sequence. */ intel_enable_pch_pll (intel_crtc); -if (HAS_PCH_LPT (dev)) { -DRM_DEBUG_KMS ("LPT detected: programming iCLKIP\n" ); -lpt_program_iclkip (crtc); - }else if (HAS_PCH_CPT (dev)) { +if (HAS_PCH_CPT (dev)) {u32 sel; temp =I915_READ (PCH_DPLL_SEL );
@@ -3095,8 +3092,7 @@ static void ironlake_pch_enable(struct drm_crtc *crtc)I915_WRITE (TRANS_VSYNC (pipe),I915_READ (VSYNC (pipe)));I915_WRITE (TRANS_VSYNCSHIFT (pipe),I915_READ (VSYNCSHIFT (pipe))); -if (!IS_HASWELL (dev)) -intel_fdi_normal_train (crtc); +intel_fdi_normal_train (crtc);/* For PCH DP, enable TRANS_DP_CTL */ if (HAS_PCH_CPT(dev) &&
Signature · 1 line
1.7.11.4
PATCH 5/36 drm/i915: remove ironlake bits from lpt_pch_enable
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
Since this function will only run on Haswell/LPT and newer.
--- drivers/gpu/drm/i915/intel_display.c | 69 +----------------------------------- 1 file changed, 1 insertion(+), 68 deletions(-)
drivers/gpu/drm/i915/intel_display.c +1 -68
@@ -3139,7 +3139,6 @@ static void lpt_pch_enable(struct drm_crtc *crtc)struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc);int pipe = intel_crtc->pipe; -u32 reg, temp;assert_transcoder_disabled (dev_priv, pipe);
@@ -3160,34 +3159,7 @@ static void lpt_pch_enable(struct drm_crtc *crtc)* enable sequence. */ intel_enable_pch_pll (intel_crtc); -if (HAS_PCH_LPT (dev)) { -DRM_DEBUG_KMS ("LPT detected: programming iCLKIP\n" ); -lpt_program_iclkip (crtc); - }else if (HAS_PCH_CPT (dev)) { -u32 sel; - - temp =I915_READ (PCH_DPLL_SEL ); -switch (pipe) { -default : -case 0 : - temp |=TRANSA_DPLL_ENABLE ; - sel =TRANSA_DPLLB_SEL ; -break ; -case 1 : - temp |=TRANSB_DPLL_ENABLE ; - sel =TRANSB_DPLLB_SEL ; -break ; -case 2 : - temp |=TRANSC_DPLL_ENABLE ; - sel =TRANSC_DPLLB_SEL ; -break ; - } -if (intel_crtc->pch_pll->pll_reg == _PCH_DPLL_B) - temp |= sel; -else - temp &= ~sel; -I915_WRITE (PCH_DPLL_SEL , temp); - } +lpt_program_iclkip (crtc);/* set transcoder timing, panel must allow it */ assert_panel_unlocked (dev_priv, pipe);
@@ -3200,45 +3172,6 @@ static void lpt_pch_enable(struct drm_crtc *crtc)I915_WRITE (TRANS_VSYNC (pipe),I915_READ (VSYNC (pipe)));I915_WRITE (TRANS_VSYNCSHIFT (pipe),I915_READ (VSYNCSHIFT (pipe))); -if (!IS_HASWELL (dev)) -intel_fdi_normal_train (crtc); - -/* For PCH DP, enable TRANS_DP_CTL */ -if (HAS_PCH_CPT (dev) && - (intel_pipe_has_type (crtc,INTEL_OUTPUT_DISPLAYPORT ) || -intel_pipe_has_type (crtc,INTEL_OUTPUT_EDP ))) { -u32 bpc = (I915_READ (PIPECONF (pipe)) &PIPE_BPC_MASK ) >>5 ; - reg =TRANS_DP_CTL (pipe); - temp =I915_READ (reg); - temp &= ~(TRANS_DP_PORT_SEL_MASK | -TRANS_DP_SYNC_MASK | -TRANS_DP_BPC_MASK ); - temp |= (TRANS_DP_OUTPUT_ENABLE | -TRANS_DP_ENH_FRAMING ); - temp |= bpc <<9 ;/* same format but at 11:9 */ - -if (crtc->mode.flags &DRM_MODE_FLAG_PHSYNC ) - temp |=TRANS_DP_HSYNC_ACTIVE_HIGH ; -if (crtc->mode.flags &DRM_MODE_FLAG_PVSYNC ) - temp |=TRANS_DP_VSYNC_ACTIVE_HIGH ; - -switch (intel_trans_dp_port_sel (crtc)) { -case PCH_DP_B : - temp |=TRANS_DP_PORT_SEL_B ; -break ; -case PCH_DP_C : - temp |=TRANS_DP_PORT_SEL_C ; -break ; -case PCH_DP_D : - temp |=TRANS_DP_PORT_SEL_D ; -break ; -default : -BUG (); - } - -I915_WRITE (reg, temp); - } -intel_enable_transcoder (dev_priv, pipe); }
Signature · 1 line
1.7.11.4
PATCH 6/36 drm/i915: train Haswell FDI at the right time
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
Haswell FDI link training is very different from the previous generations.
After this commit, hsw_fdi_link_train is responsible for implementing all the steps described as "Enable and train FDI" from the Haswell CRT mode set sequence documentation.
We need to train the FDI before enabling the pipes and planes, so we're moving the call from lpt_pch_enable to haswell_crtc_enable directly.
We are also removing ironlake_fdi_pll_enable since the PLL enablement on Haswell is completely different and is also done during the link training steps.
There are still quite a few things we need to fix on hsw_fdi_link_train, so stay tuned for the next patches :)
--- drivers/gpu/drm/i915/i915_reg.h | 17 +++++++++++------ drivers/gpu/drm/i915/intel_ddi.c | 34 ++++++++++++++++++++++++---------- drivers/gpu/drm/i915/intel_display.c | 5 +---- 3 files changed, 36 insertions(+), 20 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +11 -6
@@ -3917,16 +3917,21 @@#define FDI_PORT_WIDTH_2X_LPT (1<<19)#define FDI_PORT_WIDTH_1X_LPT (0<<19) -#define _FDI_RXA_MISC 0xf0010 -#define _FDI_RXB_MISC 0xf1010 +#define _FDI_RXA_MISC 0xf0010 +#define _FDI_RXB_MISC 0xf1010 +#define FDI_RX_PWRDN_LANE1_MASK (3<<26) +#define FDI_RX_PWRDN_LANE1_VAL (x) ((x)<<26) +#define FDI_RX_PWRDN_LANE0_MASK (3<<24) +#define FDI_RX_PWRDN_LANE0_VAL (x) ((x)<<24) +#define FDI_RX_TP1_TO_TP2_48 (2<<20) +#define FDI_RX_TP1_TO_TP2_64 (3<<20) +#define FDI_RX_FDI_DELAY_90 (0x90<<0) +#define FDI_RX_MISC (pipe) _PIPE(pipe, _FDI_RXA_MISC, _FDI_RXB_MISC) +#define _FDI_RXA_TUSIZE1 0xf0030#define _FDI_RXA_TUSIZE2 0xf0038#define _FDI_RXB_TUSIZE1 0xf1030#define _FDI_RXB_TUSIZE2 0xf1038 -#define FDI_RX_TP1_TO_TP2_48 (2<<20) -#define FDI_RX_TP1_TO_TP2_64 (3<<20) -#define FDI_RX_FDI_DELAY_90 (0x90<<0) -#define FDI_RX_MISC (pipe) _PIPE(pipe, _FDI_RXA_MISC, _FDI_RXB_MISC)#define FDI_RX_TUSIZE1 (pipe) _PIPE(pipe, _FDI_RXA_TUSIZE1, _FDI_RXB_TUSIZE1)#define FDI_RX_TUSIZE2 (pipe) _PIPE(pipe, _FDI_RXA_TUSIZE2, _FDI_RXB_TUSIZE2)
drivers/gpu/drm/i915/intel_ddi.c +24 -10
@@ -154,7 +154,30 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc);int pipe = intel_crtc->pipe; -u32 reg, temp, i; +u32 reg, temp, i, rx_ctl_val; + +/* Set the FDI_RX_MISC pwrdn lanes and the 2 workarounds listed at the +* mode set "sequence for CRT port" document: +* - TP1 to TP2 time with the default value +* - FDI delay to 90h +*/ +I915_WRITE (_FDI_RXA_MISC,FDI_RX_PWRDN_LANE1_VAL (2 ) | +FDI_RX_PWRDN_LANE0_VAL (2 ) | +FDI_RX_TP1_TO_TP2_48 |FDI_RX_FDI_DELAY_90 ); + +/* Enable the PCH Receiver FDI PLL */ + rx_ctl_val =FDI_RX_PLL_ENABLE |FDI_RX_ENHANCE_FRAME_ENABLE | + ((intel_crtc->fdi_lanes -1 ) <<19 ); +I915_WRITE (_FDI_RXA_CTL, rx_ctl_val); +POSTING_READ (_FDI_RXA_CTL); +udelay (220 ); + +/* Switch from Rawclk to PCDclk */ + rx_ctl_val |=FDI_PCDCLK ; +I915_WRITE (_FDI_RXA_CTL, rx_ctl_val); + +/* Configure Port Clock Select */ +I915_WRITE (PORT_CLK_SEL (PORT_E ), intel_crtc->ddi_pll_sel);/* Start the training iterating through available voltages and emphasis */ for (i=0 ; i <ARRAY_SIZE (hsw_ddi_buf_ctl_values); i++) {
@@ -176,15 +199,6 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)udelay (600 ); -/* We need to program FDI_RX_MISC with the default TP1 to TP2 -* values before enabling the receiver, and configure the delay -* for the FDI timing generator to 90h. Luckily, all the other -* bits are supposed to be zeroed, so we can write those values -* directly. -*/ -I915_WRITE (FDI_RX_MISC (pipe),FDI_RX_TP1_TO_TP2_48 | -FDI_RX_FDI_DELAY_90 ); -/* Enable CPU FDI Receiver with auto-training */ reg =FDI_RX_CTL (pipe); I915_WRITE(reg,
drivers/gpu/drm/i915/intel_display.c +1 -4
@@ -3147,9 +3147,6 @@ static void lpt_pch_enable(struct drm_crtc *crtc)I915_WRITE (FDI_RX_TUSIZE1 (pipe),I915_READ (PIPE_DATA_M1 (pipe)) &TU_SIZE_MASK ); -/* For PCH output, training FDI link */ - dev_priv->display.fdi_link_train (crtc); -/* XXX: pch pll's can be enabled any time before we enable the PCH * transcoder, and we actually should do this to not upset any PCH * transcoder that already use the clock when we share it.
@@ -3389,7 +3386,7 @@ static void haswell_crtc_enable(struct drm_crtc *crtc) is_pch_port =haswell_crtc_driving_pch (crtc);if (is_pch_port) -ironlake_fdi_pll_enable (intel_crtc); + dev_priv->display.fdi_link_train (crtc);for_each_encoder_on_crtc (dev, crtc, encoder)if (encoder->pre_enable)
Signature · 1 line
1.7.11.4
Re: [PATCH 06/36] drm/i915: train Haswell FDI at the right time
Quoted 72 lines · Paulo Zanoni
From: Paulo Zanoni <[email protected]>
Haswell FDI link training is very different from the previous generations.
After this commit,
hsw_fdi_link_trainis responsible for implementing all the steps described as "Enable and train FDI" from the Haswell CRT mode set sequence documentation.We need to train the FDI before enabling the pipes and planes, so we're moving the call from
lpt_pch_enabletohaswell_crtc_enabledirectly.We are also removing
ironlake_fdi_pll_enablesince the PLL enablement on Haswell is completely different and is also done during the link training steps.There are still quite a few things we need to fix on
hsw_fdi_link_train, so stay tuned for the next patches :)Signed-off-by Paulo Zanoni <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 17 +++++++++++------ drivers/gpu/drm/i915/intel_ddi.c | 34 ++++++++++++++++++++++++---------- drivers/gpu/drm/i915/intel_display.c | 5 +---- 3 files changed, 36 insertions(+), 20 deletions(-)drivers/gpu/drm/i915/i915_reg.h +11
-6@@ -3917,16 +3917,21 @@#define FDI_PORT_WIDTH_2X_LPT (1<<19)#define FDI_PORT_WIDTH_1X_LPT (0<<19) -#define _FDI_RXA_MISC 0xf0010 -#define _FDI_RXB_MISC 0xf1010 +#define _FDI_RXA_MISC 0xf0010 +#define _FDI_RXB_MISC 0xf1010 +#define FDI_RX_PWRDN_LANE1_MASK (3<<26) +#define FDI_RX_PWRDN_LANE1_VAL (x) ((x)<<26) +#define FDI_RX_PWRDN_LANE0_MASK (3<<24) +#define FDI_RX_PWRDN_LANE0_VAL (x) ((x)<<24) +#define FDI_RX_TP1_TO_TP2_48 (2<<20) +#define FDI_RX_TP1_TO_TP2_64 (3<<20) +#define FDI_RX_FDI_DELAY_90 (0x90<<0) +#define FDI_RX_MISC (pipe) _PIPE(pipe, _FDI_RXA_MISC, _FDI_RXB_MISC) +#define _FDI_RXA_TUSIZE1 0xf0030#define _FDI_RXA_TUSIZE2 0xf0038#define _FDI_RXB_TUSIZE1 0xf1030#define _FDI_RXB_TUSIZE2 0xf1038 -#define FDI_RX_TP1_TO_TP2_48 (2<<20) -#define FDI_RX_TP1_TO_TP2_64 (3<<20) -#define FDI_RX_FDI_DELAY_90 (0x90<<0) -#define FDI_RX_MISC (pipe) _PIPE(pipe, _FDI_RXA_MISC, _FDI_RXB_MISC)#define FDI_RX_TUSIZE1 (pipe) _PIPE(pipe, _FDI_RXA_TUSIZE1, _FDI_RXB_TUSIZE1)#define FDI_RX_TUSIZE2 (pipe) _PIPE(pipe, _FDI_RXA_TUSIZE2, _FDI_RXB_TUSIZE2)drivers/gpu/drm/i915/intel_ddi.c +4
-1@@ -154,7 +154,30 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc);int pipe = intel_crtc->pipe; -u32 reg, temp, i; +u32 reg, temp, i, rx_ctl_val; + +/* Set the FDI_RX_MISC pwrdn lanes and the 2 workarounds listed at the +* mode set "sequence for CRT port" document:
drivers/gpu/drm/i915/intel_ddi.c void hsw_fdi_link_train(struct drm_crtc *crtc) · line 170
Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c +10
-0+* - TP1 to TP2 time with the default value +* - FDI delay to 90h +*/ +I915_WRITE (_FDI_RXA_MISC,FDI_RX_PWRDN_LANE1_VAL (2 ) | +FDI_RX_PWRDN_LANE0_VAL (2 ) | +FDI_RX_TP1_TO_TP2_48 |FDI_RX_FDI_DELAY_90 ); + +/* Enable the PCH Receiver FDI PLL */ + rx_ctl_val =FDI_RX_PLL_ENABLE |FDI_RX_ENHANCE_FRAME_ENABLE | + ((intel_crtc->fdi_lanes -1 ) <<19 );
You switch here to a variable selection of the port width/number of fdi lanes you're using on the RX side. But the TX side below is still fixed to 2X. I guess this part here belongs in another patch?
-Daniel
Quoted 59 lines
drivers/gpu/drm/i915/intel_ddi.c +10
-9+I915_WRITE (_FDI_RXA_CTL, rx_ctl_val); +POSTING_READ (_FDI_RXA_CTL); +udelay (220 ); + +/* Switch from Rawclk to PCDclk */ + rx_ctl_val |=FDI_PCDCLK ; +I915_WRITE (_FDI_RXA_CTL, rx_ctl_val); + +/* Configure Port Clock Select */ +I915_WRITE (PORT_CLK_SEL (PORT_E ), intel_crtc->ddi_pll_sel);/* Start the training iterating through available voltages and emphasis */ for (i=0 ; i <ARRAY_SIZE (hsw_ddi_buf_ctl_values); i++) {@@ -176,15 +199,6 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)udelay (600 ); -/* We need to program FDI_RX_MISC with the default TP1 to TP2 -* values before enabling the receiver, and configure the delay -* for the FDI timing generator to 90h. Luckily, all the other -* bits are supposed to be zeroed, so we can write those values -* directly. -*/ -I915_WRITE (FDI_RX_MISC (pipe),FDI_RX_TP1_TO_TP2_48 | -FDI_RX_FDI_DELAY_90 ); -/* Enable CPU FDI Receiver with auto-training */ reg =FDI_RX_CTL (pipe); I915_WRITE(reg,drivers/gpu/drm/i915/intel_display.c +1
-4@@ -3147,9 +3147,6 @@ static void lpt_pch_enable(struct drm_crtc *crtc)I915_WRITE (FDI_RX_TUSIZE1 (pipe),I915_READ (PIPE_DATA_M1 (pipe)) &TU_SIZE_MASK ); -/* For PCH output, training FDI link */ - dev_priv->display.fdi_link_train (crtc); -/* XXX: pch pll's can be enabled any time before we enable the PCH * transcoder, and we actually should do this to not upset any PCH * transcoder that already use the clock when we share it. @@ -3389,7 +3386,7 @@ static void haswell_crtc_enable(struct drm_crtc *crtc) is_pch_port =haswell_crtc_driving_pch (crtc);if (is_pch_port) -ironlake_fdi_pll_enable (intel_crtc); + dev_priv->display.fdi_link_train (crtc);for_each_encoder_on_crtc (dev, crtc, encoder)if (encoder->pre_enable)Signature · 6 lines
1.7.11.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 7/36 drm/i915: use the right FDI_RX_CTL register on Haswell
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
There is only one PCH transcoder, so it's always _FDI_RXA_CTL. Using "pipe" here is wrong.
While at it, also reuse the rx_ctl_val variable created in the previous commit.
--- drivers/gpu/drm/i915/intel_ddi.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +8 -16
@@ -153,8 +153,7 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)struct drm_device *dev = crtc->dev;struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -int pipe = intel_crtc->pipe; -u32 reg, temp, i, rx_ctl_val; +u32 temp, i, rx_ctl_val;/* Set the FDI_RX_MISC pwrdn lanes and the 2 workarounds listed at the * mode set "sequence for CRT port" document:
@@ -199,17 +198,10 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)udelay (600 ); -/* Enable CPU FDI Receiver with auto-training */ - reg =FDI_RX_CTL (pipe); -I915_WRITE (reg, -I915_READ (reg) | -FDI_LINK_TRAIN_AUTO | -FDI_RX_ENABLE | -FDI_LINK_TRAIN_PATTERN_1_CPT | -FDI_RX_ENHANCE_FRAME_ENABLE | -FDI_PORT_WIDTH_2X_LPT | -FDI_RX_PLL_ENABLE ); -POSTING_READ (reg); +/* Enable PCH FDI Receiver with auto-training */ + rx_ctl_val |=FDI_RX_ENABLE |FDI_LINK_TRAIN_AUTO ; +I915_WRITE (_FDI_RXA_CTL, rx_ctl_val); +POSTING_READ (_FDI_RXA_CTL);udelay (100 ); temp =I915_READ (DP_TP_STATUS (PORT_E ));
@@ -231,9 +223,9 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)I915_WRITE (DP_TP_CTL (PORT_E ),I915_READ (DP_TP_CTL (PORT_E )) & ~DP_TP_CTL_ENABLE ); -I915_WRITE (FDI_RX_CTL (pipe), -I915_READ (FDI_RX_CTL (pipe)) & - ~FDI_RX_PLL_ENABLE ); + + rx_ctl_val &= ~FDI_RX_PLL_ENABLE ; +I915_WRITE (_FDI_RXA_CTL, rx_ctl_val);continue ; } }
Signature · 1 line
1.7.11.4
Re: [PATCH 07/36] drm/i915: use the right FDI_RX_CTL register on Haswell
Quoted 28 lines · Paulo Zanoni
From: Paulo Zanoni <[email protected]>
There is only one PCH transcoder, so it's always
_FDI_RXA_CTL. Using "pipe" here is wrong.While at it, also reuse the
rx_ctl_valvariable created in the previous commit.Signed-off-by Paulo Zanoni <[email protected]>--- drivers/gpu/drm/i915/intel_ddi.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-)drivers/gpu/drm/i915/intel_ddi.c +1
-2@@ -153,8 +153,7 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)struct drm_device *dev = crtc->dev;struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -int pipe = intel_crtc->pipe; -u32 reg, temp, i, rx_ctl_val; +u32 temp, i, rx_ctl_val;/* Set the FDI_RX_MISC pwrdn lanes and the 2 workarounds listed at the * mode set "sequence for CRT port" document:
drivers/gpu/drm/i915/intel_ddi.c void hsw_fdi_link_train(struct drm_crtc *crtc) · line 208
Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c +0
-7@@ -199,17 +198,10 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)udelay (600 ); -/* Enable CPU FDI Receiver with auto-training */ - reg =FDI_RX_CTL (pipe); - I915_WRITE(reg, - I915_READ(reg) | - FDI_LINK_TRAIN_AUTO | - FDI_RX_ENABLE | - FDI_LINK_TRAIN_PATTERN_1_CPT |
The LINK_TRAIN_PAT1 here seems to disappear. Is that simply because when using auto training, we may not set this? If so, please mention that in the commit message. All the other flags are set, safe for ...
drivers/gpu/drm/i915/intel_ddi.c void hsw_fdi_link_train(struct drm_crtc *crtc) · line 210
Quoted 2 lines
drivers/gpu/drm/i915/intel_ddi.c +0
-2-FDI_RX_ENHANCE_FRAME_ENABLE | - FDI_PORT_WIDTH_2X_LPT |
... dropping the 2X_LPT mode here will blow up on low-res, see my comment in the previous patch.
-Daniel
Quoted 29 lines
drivers/gpu/drm/i915/intel_ddi.c +7
-5- FDI_RX_PLL_ENABLE); -POSTING_READ (reg); +/* Enable PCH FDI Receiver with auto-training */ + rx_ctl_val |=FDI_RX_ENABLE |FDI_LINK_TRAIN_AUTO ; +I915_WRITE (_FDI_RXA_CTL, rx_ctl_val); +POSTING_READ (_FDI_RXA_CTL);udelay (100 ); temp =I915_READ (DP_TP_STATUS (PORT_E ));@@ -231,9 +223,9 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)I915_WRITE (DP_TP_CTL (PORT_E ),I915_READ (DP_TP_CTL (PORT_E )) & ~DP_TP_CTL_ENABLE ); -I915_WRITE (FDI_RX_CTL (pipe), -I915_READ (FDI_RX_CTL (pipe)) & - ~FDI_RX_PLL_ENABLE ); + + rx_ctl_val &= ~FDI_RX_PLL_ENABLE ; +I915_WRITE (_FDI_RXA_CTL, rx_ctl_val);continue ; } }Signature · 6 lines
1.7.11.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Re: [PATCH 07/36] drm/i915: use the right FDI_RX_CTL register on Haswell
Hi
2012/11/1 Daniel Vetter <[email protected]>:
Quoted 43 lines · Paulo Zanoni
Quoted 28 lines
From: Paulo Zanoni <[email protected]>
There is only one PCH transcoder, so it's always
_FDI_RXA_CTL. Using "pipe" here is wrong.While at it, also reuse the
rx_ctl_valvariable created in the previous commit.Signed-off-by Paulo Zanoni <[email protected]>--- drivers/gpu/drm/i915/intel_ddi.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-)drivers/gpu/drm/i915/intel_ddi.c +1
-2@@ -153,8 +153,7 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)struct drm_device *dev = crtc->dev;struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -int pipe = intel_crtc->pipe; -u32 reg, temp, i, rx_ctl_val; +u32 temp, i, rx_ctl_val;/* Set the FDI_RX_MISC pwrdn lanes and the 2 workarounds listed at the * mode set "sequence for CRT port" document: drivers/gpu/drm/i915/intel_ddi.c void hsw_fdi_link_train(struct drm_crtc *crtc) · line 208
Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c +0
-7@@ -199,17 +198,10 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)udelay (600 ); -/* Enable CPU FDI Receiver with auto-training */ - reg =FDI_RX_CTL (pipe); - I915_WRITE(reg, - I915_READ(reg) | - FDI_LINK_TRAIN_AUTO | - FDI_RX_ENABLE | - FDI_LINK_TRAIN_PATTERN_1_CPT |The
LINK_TRAIN_PAT1here seems to disappear. Is that simply because when using auto training, we may not set this? If so, please mention that in the commit message. All the other flags are set, safe for ...
Quoted 5 lines
drivers/gpu/drm/i915/intel_ddi.c void hsw_fdi_link_train(struct drm_crtc *crtc) · line 210
Quoted 2 lines
drivers/gpu/drm/i915/intel_ddi.c +0
-2-FDI_RX_ENHANCE_FRAME_ENABLE | - FDI_PORT_WIDTH_2X_LPT |... dropping the 2X_LPT mode here will blow up on low-res, see my comment in the previous patch.
It would blow up if everything else was actually working...
If you take a look at intel_ddi_enable_pipe_func, you will see that before my series it sets the width to 1x where the other pieces of our code set to 2x, which is just wrong. On my series, as I change the functions I change them to use the "correct width", and after patch 8 we do have the "correct width" being set, but VGA really doesn't work yet because of the other thousand problems it has: you can't notice the difference in patch 8 because you need all the other future fixes.
So I really think we should just assume VGA is a total failure until before the very last patch :)
Quoted 36 lines
-Daniel
Quoted 25 lines
drivers/gpu/drm/i915/intel_ddi.c +7
-6- FDI_RX_PLL_ENABLE); -POSTING_READ (reg); +/* Enable PCH FDI Receiver with auto-training */ + rx_ctl_val |=FDI_RX_ENABLE |FDI_LINK_TRAIN_AUTO ; +I915_WRITE (_FDI_RXA_CTL, rx_ctl_val); +POSTING_READ (_FDI_RXA_CTL);udelay (100 ); temp =I915_READ (DP_TP_STATUS (PORT_E ));@@ -231,9 +223,9 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)I915_WRITE (DP_TP_CTL (PORT_E ),I915_READ (DP_TP_CTL (PORT_E )) & ~DP_TP_CTL_ENABLE ); -I915_WRITE (FDI_RX_CTL (pipe), -I915_READ (FDI_RX_CTL (pipe)) & - ~FDI_RX_PLL_ENABLE ); + + rx_ctl_val &= ~FDI_RX_PLL_ENABLE ; +I915_WRITE (_FDI_RXA_CTL, rx_ctl_val);continue ; } } --1.7.11.4
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
Signature · 1 line
Paulo Zanoni
PATCH 8/36 drm/i915: set the correct number of FDI lanes on Haswell
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
--- drivers/gpu/drm/i915/intel_ddi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_ddi.c +2 -1
@@ -193,7 +193,7 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)I915_WRITE (DDI_BUF_CTL (PORT_E ), temp |DDI_BUF_CTL_ENABLE | -DDI_PORT_WIDTH_X2 | + ((intel_crtc->fdi_lanes -1 ) <<1 ) | hsw_ddi_buf_ctl_values[i]);udelay (600 );
@@ -958,6 +958,7 @@ void intel_ddi_enable_pipe_func(struct drm_crtc *crtc) }else if (type ==INTEL_OUTPUT_ANALOG ) { temp |=TRANS_DDI_MODE_SELECT_FDI ; + temp |= (intel_crtc->fdi_lanes -1 ) <<1 ; }else if (type ==INTEL_OUTPUT_DISPLAYPORT || type ==INTEL_OUTPUT_EDP ) {
Signature · 1 line
1.7.11.4
PATCH 9/36 drm/i915: don't rely on DDI_BUF_CTL previous values
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
... inside hsw_fdi_link_train. Just set the bits we want, everything else is zero.
While at it, also POSTING_READ the register before waiting.
--- drivers/gpu/drm/i915/intel_ddi.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +4 -6
@@ -188,13 +188,11 @@ void hsw_fdi_link_train(struct drm_crtc *crtc) DP_TP_CTL_ENABLE);/* Configure and enable DDI_BUF_CTL for DDI E with next voltage */ - temp =I915_READ (DDI_BUF_CTL (PORT_E )); - temp = (temp & ~DDI_BUF_EMP_MASK );I915_WRITE (DDI_BUF_CTL (PORT_E ), - temp | -DDI_BUF_CTL_ENABLE | - ((intel_crtc->fdi_lanes -1 ) <<1 ) | - hsw_ddi_buf_ctl_values[i]); +DDI_BUF_CTL_ENABLE | + ((intel_crtc->fdi_lanes -1 ) <<1 ) | + hsw_ddi_buf_ctl_values[i]); +POSTING_READ (DDI_BUF_CTL (PORT_E ));udelay (600 );
Signature · 1 line
1.7.11.4
PATCH 10/36 drm/i915: program the FDI RX TUSIZE register on hsw_fdi_link_train
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
According to the mode set sequence documentation, this is the right place. According to the FDI_RX_TUSIZE register description, this is the value we should set.
--- drivers/gpu/drm/i915/intel_ddi.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/intel_ddi.c +3 -0
@@ -196,6 +196,9 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)udelay (600 ); +/* Program PCH FDI Receiver TU */ +I915_WRITE (_FDI_RXA_TUSIZE1,0x7E000000 ); +/* Enable PCH FDI Receiver with auto-training */ rx_ctl_val |=FDI_RX_ENABLE |FDI_LINK_TRAIN_AUTO ;I915_WRITE (_FDI_RXA_CTL, rx_ctl_val);
Signature · 1 line
1.7.11.4
Re: [PATCH 10/36] drm/i915: program the FDI RX TUSIZE register on hsw_fdi_link_train
Quoted 16 lines · Paulo Zanoni
From: Paulo Zanoni <[email protected]>
According to the mode set sequence documentation, this is the right place. According to the
FDI_RX_TUSIZEregister description, this is the value we should set.Signed-off-by Paulo Zanoni <[email protected]>--- drivers/gpu/drm/i915/intel_ddi.c | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/i915/intel_ddi.c +0
-0
drivers/gpu/drm/i915/intel_ddi.c void hsw_fdi_link_train(struct drm_crtc *crtc) · line 201
Quoted 6 lines
drivers/gpu/drm/i915/intel_ddi.c +3
-0@@ -196,6 +196,9 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)udelay (600 ); +/* Program PCH FDI Receiver TU */ +I915_WRITE (_FDI_RXA_TUSIZE1,0x7E000000 ); +
I think you also want to remove the setting of RX_TU_SIZE in lpt_pch_enable. And we have nice symbolic constants to encode that 0-based 64 shifter by 25 bits ...
-Daniel
Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c +0
-0/* Enable PCH FDI Receiver with auto-training */ rx_ctl_val |=FDI_RX_ENABLE |FDI_LINK_TRAIN_AUTO ;I915_WRITE (_FDI_RXA_CTL, rx_ctl_val);Signature · 6 lines
1.7.11.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 11/36 drm/i915: properly program FDI_RX_MISC pwrdn lane values on HSW
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
That's what our mode set sequence documentation says we need to do.
--- drivers/gpu/drm/i915/intel_ddi.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/gpu/drm/i915/intel_ddi.c +14 -0
@@ -205,6 +205,12 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)POSTING_READ (_FDI_RXA_CTL);udelay (100 ); +/* Program FDI_RX_MISC pwrdn lanes */ + temp =I915_READ (_FDI_RXA_MISC); + temp &= ~(FDI_RX_PWRDN_LANE1_MASK |FDI_RX_PWRDN_LANE0_MASK ); +I915_WRITE (_FDI_RXA_MISC, temp); +POSTING_READ (_FDI_RXA_MISC); + temp =I915_READ (DP_TP_STATUS (PORT_E ));if (temp &DP_TP_STATUS_AUTOTRAIN_DONE ) {DRM_DEBUG_DRIVER ("BUF_CTL training done on %d step\n" , i);
@@ -227,6 +233,14 @@ void hsw_fdi_link_train(struct drm_crtc *crtc) rx_ctl_val &= ~FDI_RX_PLL_ENABLE ;I915_WRITE (_FDI_RXA_CTL, rx_ctl_val); + + temp =I915_READ (_FDI_RXA_MISC); + temp &= ~(FDI_RX_PWRDN_LANE1_MASK | +FDI_RX_PWRDN_LANE0_MASK ); + temp |=FDI_RX_PWRDN_LANE1_VAL (2 ) | +FDI_RX_PWRDN_LANE0_VAL (2 ); +I915_WRITE (_FDI_RXA_MISC, temp); +continue ; } }
Signature · 1 line
1.7.11.4
Re: [PATCH 11/36] drm/i915: properly program FDI_RX_MISC pwrdn lane values on HSW
Quoted 5 lines · Paulo Zanoni
From: Paulo Zanoni <[email protected]>
That's what our mode set sequence documentation says we need to do.
Signed-off-by Paulo Zanoni <[email protected]>
As already bikeshedded on irc, I think the comment is a bit useless. Instead of "program foo" I think "set foo in bla" and "unset foo in bla" explains more ...
-Daniel
Quoted 43 lines
--- drivers/gpu/drm/i915/intel_ddi.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)drivers/gpu/drm/i915/intel_ddi.c +14
-0@@ -205,6 +205,12 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)POSTING_READ (_FDI_RXA_CTL);udelay (100 ); +/* Program FDI_RX_MISC pwrdn lanes */ + temp =I915_READ (_FDI_RXA_MISC); + temp &= ~(FDI_RX_PWRDN_LANE1_MASK |FDI_RX_PWRDN_LANE0_MASK ); +I915_WRITE (_FDI_RXA_MISC, temp); +POSTING_READ (_FDI_RXA_MISC); + temp =I915_READ (DP_TP_STATUS (PORT_E ));if (temp &DP_TP_STATUS_AUTOTRAIN_DONE ) {DRM_DEBUG_DRIVER ("BUF_CTL training done on %d step\n" , i);@@ -227,6 +233,14 @@ void hsw_fdi_link_train(struct drm_crtc *crtc) rx_ctl_val &= ~FDI_RX_PLL_ENABLE ;I915_WRITE (_FDI_RXA_CTL, rx_ctl_val); + + temp =I915_READ (_FDI_RXA_MISC); + temp &= ~(FDI_RX_PWRDN_LANE1_MASK | +FDI_RX_PWRDN_LANE0_MASK ); + temp |=FDI_RX_PWRDN_LANE1_VAL (2 ) | +FDI_RX_PWRDN_LANE0_VAL (2 ); +I915_WRITE (_FDI_RXA_MISC, temp); +continue ; } }Signature · 6 lines
1.7.11.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 12/36 drm/i915: wait only 35us for the FDI link training
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
First we wait 30us for the FDI receiver lane calibration, then we wait 5us for the FDI auto training time.
--- drivers/gpu/drm/i915/intel_ddi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_ddi.c +6 -1
@@ -203,7 +203,9 @@ void hsw_fdi_link_train(struct drm_crtc *crtc) rx_ctl_val |=FDI_RX_ENABLE |FDI_LINK_TRAIN_AUTO ;I915_WRITE (_FDI_RXA_CTL, rx_ctl_val);POSTING_READ (_FDI_RXA_CTL); -udelay (100 ); + +/* Wait for FDI receiver lane calibration */ +udelay (30 );/* Program FDI_RX_MISC pwrdn lanes */ temp =I915_READ (_FDI_RXA_MISC);
@@ -211,6 +213,9 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)I915_WRITE (_FDI_RXA_MISC, temp);POSTING_READ (_FDI_RXA_MISC); +/* Wait for FDI auto training time */ +udelay (5 ); + temp =I915_READ (DP_TP_STATUS (PORT_E ));if (temp &DP_TP_STATUS_AUTOTRAIN_DONE ) {DRM_DEBUG_DRIVER ("BUF_CTL training done on %d step\n" , i);
Signature · 1 line
1.7.11.4
PATCH 13/36 drm/i915: remove an useless indentation level on hsw_fdi_link_train
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
We already "break" when the link training succeeds.
--- drivers/gpu/drm/i915/intel_ddi.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +11 -16
@@ -228,26 +228,21 @@ void hsw_fdi_link_train(struct drm_crtc *crtc) DP_TP_CTL_ENABLE);break ; - }else { -DRM_ERROR ("Error training BUF_CTL %d\n" , i); + } -/* Disable DP_TP_CTL and FDI_RX_CTL) and retry */ -I915_WRITE (DP_TP_CTL (PORT_E ), -I915_READ (DP_TP_CTL (PORT_E )) & - ~DP_TP_CTL_ENABLE ); +DRM_ERROR ("Error training BUF_CTL %d\n" , i); - rx_ctl_val &= ~FDI_RX_PLL_ENABLE ; -I915_WRITE (_FDI_RXA_CTL, rx_ctl_val); +/* Disable DP_TP_CTL and FDI_RX_CTL) and retry */ +I915_WRITE (DP_TP_CTL (PORT_E ), +I915_READ (DP_TP_CTL (PORT_E )) & ~DP_TP_CTL_ENABLE ); - temp =I915_READ (_FDI_RXA_MISC); - temp &= ~(FDI_RX_PWRDN_LANE1_MASK | -FDI_RX_PWRDN_LANE0_MASK ); - temp |=FDI_RX_PWRDN_LANE1_VAL (2 ) | -FDI_RX_PWRDN_LANE0_VAL (2 ); -I915_WRITE (_FDI_RXA_MISC, temp); + rx_ctl_val &= ~FDI_RX_PLL_ENABLE ; +I915_WRITE (_FDI_RXA_CTL, rx_ctl_val); -continue ; - } + temp =I915_READ (_FDI_RXA_MISC); + temp &= ~(FDI_RX_PWRDN_LANE1_MASK |FDI_RX_PWRDN_LANE0_MASK ); + temp |=FDI_RX_PWRDN_LANE1_VAL (2 ) |FDI_RX_PWRDN_LANE0_VAL (2 ); +I915_WRITE (_FDI_RXA_MISC, temp); }DRM_DEBUG_KMS ("FDI train done.\n" );
Signature · 1 line
1.7.11.4
PATCH 14/36 drm/i915: disable FDI_RX_ENABLE, not FDI_RX_PLL_ENABLE
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
... on hsw_fdi_link_train. Check the mode set sequence documentation.
--- drivers/gpu/drm/i915/intel_ddi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_ddi.c +1 -1
@@ -236,7 +236,7 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)I915_WRITE (DP_TP_CTL (PORT_E ),I915_READ (DP_TP_CTL (PORT_E )) & ~DP_TP_CTL_ENABLE ); - rx_ctl_val &= ~FDI_RX_PLL_ENABLE ; + rx_ctl_val &= ~FDI_RX_ENABLE ;I915_WRITE (_FDI_RXA_CTL, rx_ctl_val); temp =I915_READ (_FDI_RXA_MISC);
Signature · 1 line
1.7.11.4
PATCH 15/36 drm/i915: change Haswell FDI link training error messages
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
We shouldn't call DRM_ERROR when still looping through voltage levels since this is expected and not really a failure. So in this commit we adjust the error path to only DRM_ERROR when we really fail after trying everything.
While at it, replace DRM_DEBUG_DRIVER with DRM_DEBUG_KMS since it's what we use everywhere.
--- drivers/gpu/drm/i915/intel_ddi.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +3 -5
@@ -218,7 +218,7 @@ void hsw_fdi_link_train(struct drm_crtc *crtc) temp =I915_READ (DP_TP_STATUS (PORT_E ));if (temp &DP_TP_STATUS_AUTOTRAIN_DONE ) { -DRM_DEBUG_DRIVER ("BUF_CTL training done on %d step\n" , i); +DRM_DEBUG_KMS ("FDI link training done on step %d\n" , i);/* Enable normal pixel sending for FDI */ I915_WRITE(DP_TP_CTL(PORT_E),
@@ -227,11 +227,9 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)DP_TP_CTL_ENHANCED_FRAME_ENABLE | DP_TP_CTL_ENABLE); -break ; +return ; } -DRM_ERROR ("Error training BUF_CTL %d\n" , i); -/* Disable DP_TP_CTL and FDI_RX_CTL) and retry */ I915_WRITE (DP_TP_CTL (PORT_E ),I915_READ (DP_TP_CTL (PORT_E )) & ~DP_TP_CTL_ENABLE );
@@ -245,7 +243,7 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)I915_WRITE (_FDI_RXA_MISC, temp); } -DRM_DEBUG_KMS ("FDI train done.\n" ); +DRM_ERROR ("FDI link training failed!\n" ); }/* WRPLL clock dividers */
Signature · 1 line
1.7.11.4
PATCH 16/36 drm/i915: try each voltage twice at hsw_fdi_link_train
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
Quoted 1 line
From the mode set sequence document: "Each setting should be tried at
least twice before failing mode set".
--- drivers/gpu/drm/i915/intel_ddi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +2 -2
@@ -179,7 +179,7 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)I915_WRITE (PORT_CLK_SEL (PORT_E ), intel_crtc->ddi_pll_sel);/* Start the training iterating through available voltages and emphasis */ -for (i=0 ; i <ARRAY_SIZE (hsw_ddi_buf_ctl_values); i++) { +for (i =0 ; i <ARRAY_SIZE (hsw_ddi_buf_ctl_values) *2 ; i++) {/* Configure DP_TP_CTL with auto-training */ I915_WRITE(DP_TP_CTL(PORT_E), DP_TP_CTL_FDI_AUTOTRAIN |
@@ -191,7 +191,7 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)I915_WRITE (DDI_BUF_CTL (PORT_E ),DDI_BUF_CTL_ENABLE | ((intel_crtc->fdi_lanes -1 ) <<1 ) | - hsw_ddi_buf_ctl_values[i]); + hsw_ddi_buf_ctl_values[i >>1 ]);POSTING_READ (DDI_BUF_CTL (PORT_E ));udelay (600 );
Signature · 1 line
1.7.11.4
Re: [PATCH 16/36] drm/i915: try each voltage twice at hsw_fdi_link_train
Quoted 24 lines · Paulo Zanoni
From: Paulo Zanoni <[email protected]>
From the mode set sequence document: "Each setting should be tried at least twice before failing mode set".
Signed-off-by Paulo Zanoni <[email protected]>--- drivers/gpu/drm/i915/intel_ddi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/intel_ddi.c +1
-1@@ -179,7 +179,7 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)I915_WRITE (PORT_CLK_SEL (PORT_E ), intel_crtc->ddi_pll_sel);/* Start the training iterating through available voltages and emphasis */ -for (i=0 ; i <ARRAY_SIZE (hsw_ddi_buf_ctl_values); i++) { +for (i =0 ; i <ARRAY_SIZE (hsw_ddi_buf_ctl_values) *2 ; i++) {/* Configure DP_TP_CTL with auto-training */ I915_WRITE(DP_TP_CTL(PORT_E), DP_TP_CTL_FDI_AUTOTRAIN |
drivers/gpu/drm/i915/intel_ddi.c void hsw_fdi_link_train(struct drm_crtc *crtc) · line 194
Quoted 5 lines
drivers/gpu/drm/i915/intel_ddi.c +1
-1@@ -191,7 +191,7 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)I915_WRITE (DDI_BUF_CTL (PORT_E ),DDI_BUF_CTL_ENABLE | ((intel_crtc->fdi_lanes -1 ) <<1 ) | - hsw_ddi_buf_ctl_values[i]); + hsw_ddi_buf_ctl_values[i >>1 ]);
I think a simple / 2 is clearer here and symmetric with the * 2 above. The compiler will apply clever tricks for you anyway ;-)
-Daniel
Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c +0
-0POSTING_READ (DDI_BUF_CTL (PORT_E ));udelay (600 );Signature · 6 lines
1.7.11.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 17/36 drm/i915: fix Haswell FDI link disable path
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
This covers the "Disable FDI" section from the CRT mode set sequence. This disables the FDI receiver and also the FDI pll.
--- drivers/gpu/drm/i915/intel_ddi.c | 26 ++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_display.c | 3 +-- drivers/gpu/drm/i915/intel_drv.h | 4 +++- 3 files changed, 30 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +26 -0
@@ -1363,6 +1363,32 @@ void intel_ddi_prepare_link_retrain(struct drm_encoder *encoder)udelay (600 ); } +void intel_ddi_fdi_disable (struct drm_crtc *crtc) +{ +struct drm_i915_private *dev_priv = crtc->dev->dev_private; +struct intel_encoder *intel_encoder =intel_ddi_get_crtc_encoder (crtc); +uint32_t val; + +intel_ddi_post_disable (intel_encoder); + + val =I915_READ (_FDI_RXA_CTL); + val &= ~FDI_RX_ENABLE ; +I915_WRITE (_FDI_RXA_CTL, val); + + val =I915_READ (_FDI_RXA_MISC); + val &= ~(FDI_RX_PWRDN_LANE1_MASK |FDI_RX_PWRDN_LANE0_MASK ); + val |=FDI_RX_PWRDN_LANE1_VAL (2 ) |FDI_RX_PWRDN_LANE0_VAL (2 ); +I915_WRITE (_FDI_RXA_MISC, val); + + val =I915_READ (_FDI_RXA_CTL); + val &= ~FDI_PCDCLK ; +I915_WRITE (_FDI_RXA_CTL, val); + + val =I915_READ (_FDI_RXA_CTL); + val &= ~FDI_RX_PLL_ENABLE ; +I915_WRITE (_FDI_RXA_CTL, val); +} +static void intel_ddi_hot_plug (struct intel_encoder *intel_encoder) {struct intel_dp *intel_dp =enc_to_intel_dp (&intel_encoder->base);
drivers/gpu/drm/i915/intel_display.c +1 -2
@@ -3563,10 +3563,9 @@ static void haswell_crtc_disable(struct drm_crtc *crtc) encoder->post_disable (encoder);if (is_pch_port) { -ironlake_fdi_disable (crtc);intel_disable_transcoder (dev_priv, pipe);intel_disable_pch_pll (intel_crtc); -ironlake_fdi_pll_disable (intel_crtc); +intel_ddi_fdi_disable (crtc); } intel_crtc->active = false;
drivers/gpu/drm/i915/intel_drv.h +3 -1
@@ -662,6 +662,8 @@ extern bool intel_ddi_pll_mode_set(struct drm_crtc *crtc, int clock);extern void intel_ddi_put_crtc_pll (struct drm_crtc *crtc);extern void intel_ddi_set_pipe_settings (struct drm_crtc *crtc);extern void intel_ddi_prepare_link_retrain (struct drm_encoder *encoder); -bool intel_ddi_connector_get_hw_state (struct intel_connector *intel_connector); +extern bool +intel_ddi_connector_get_hw_state (struct intel_connector *intel_connector); +extern void intel_ddi_fdi_disable (struct drm_crtc *crtc);#endif /* __INTEL_DRV_H__ */
Signature · 1 line
1.7.11.4
PATCH 18/36 drm/i915: don't write FDI_RX_TUSIZE on lpt_pch_enable
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
This is done way earlier on HSW/LPT and is just wrong here.
--- drivers/gpu/drm/i915/intel_display.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/gpu/drm/i915/intel_display.c +0 -5
@@ -3142,11 +3142,6 @@ static void lpt_pch_enable(struct drm_crtc *crtc)assert_transcoder_disabled (dev_priv, pipe); -/* Write the TU size bits before fdi link training, so that error -* detection works. */ -I915_WRITE (FDI_RX_TUSIZE1 (pipe), -I915_READ (PIPE_DATA_M1 (pipe)) &TU_SIZE_MASK ); -/* XXX: pch pll's can be enabled any time before we enable the PCH * transcoder, and we actually should do this to not upset any PCH * transcoder that already use the clock when we share it.
Signature · 1 line
1.7.11.4
Re: [PATCH 18/36] drm/i915: don't write FDI_RX_TUSIZE on lpt_pch_enable
Quoted 5 lines · Paulo Zanoni
From: Paulo Zanoni <[email protected]>
This is done way earlier on HSW/LPT and is just wrong here.
Signed-off-by Paulo Zanoni <[email protected]>
Ok, I'll probably regret it right away, but I think splitting the fdi link training code up into that many patches was a bit too much - imo it makes reviewing more painful, since you can essentially only check things once you have all patches applied and can look at the end result.
So in hindsight I think the following 2 patches would have been good enough:
- move RX_TU_SIZE programming to the right spot (since that also touches code outside of the fdi link train code)
- fixup the fdi link train. It is essentially a complete rewrite, it's not a lot of code (I think just 100 lines in the end), and you pretty much can only check the end result with bspec. Ofc, this commit needs a nice big commit message that explains all the little fixes that have been required.
In a way this is a special case, since all the changes are concentrated in just one fucntion and don't have any implications towards other code outside of that function.
For other fixes that are not so well contained, I still prefer small patches over big patches ;-)
Cheers, Daniel
Quoted 27 lines
--- drivers/gpu/drm/i915/intel_display.c | 5 ----- 1 file changed, 5 deletions(-)drivers/gpu/drm/i915/intel_display.c +0
-5@@ -3142,11 +3142,6 @@ static void lpt_pch_enable(struct drm_crtc *crtc)assert_transcoder_disabled (dev_priv, pipe); -/* Write the TU size bits before fdi link training, so that error -* detection works. */ -I915_WRITE (FDI_RX_TUSIZE1 (pipe), -I915_READ (PIPE_DATA_M1 (pipe)) &TU_SIZE_MASK ); -/* XXX: pch pll's can be enabled any time before we enable the PCH * transcoder, and we actually should do this to not upset any PCH * transcoder that already use the clock when we share it. Signature · 6 lines
1.7.11.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 19/36 drm/i915: rename intel_enable_pch_pll to ironlake_enable_pch_pll
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
Because this function is only for the older PCHs, not the newer ones.
--- drivers/gpu/drm/i915/intel_display.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_display.c +4 -4
@@ -1579,14 +1579,14 @@ out_unlock: }/** -* intel_enable_pch_pll - enable PCH PLL +* ironlake_enable_pch_pll - enable PCH PLL * @dev_priv: i915 private structure * @pipe: pipe PLL to enable * * The PCH PLL needs to be enabled before the PCH transcoder, since it * drives the transcoder clock. */ -static void intel_enable_pch_pll (struct intel_crtc *intel_crtc) +static void ironlake_enable_pch_pll (struct intel_crtc *intel_crtc) {struct drm_i915_private *dev_priv = intel_crtc->base.dev->dev_private;struct intel_pch_pll *pll;
@@ -3053,7 +3053,7 @@ static void ironlake_pch_enable(struct drm_crtc *crtc)* Note that enable_pch_pll tries to do the right thing, but get_pch_pll * unconditionally resets the pll - we need that to have the right LVDS * enable sequence. */ -intel_enable_pch_pll (intel_crtc); +ironlake_enable_pch_pll (intel_crtc);if (HAS_PCH_CPT (dev)) {u32 sel;
@@ -3149,7 +3149,7 @@ static void lpt_pch_enable(struct drm_crtc *crtc)* Note that enable_pch_pll tries to do the right thing, but get_pch_pll * unconditionally resets the pll - we need that to have the right LVDS * enable sequence. */ -intel_enable_pch_pll (intel_crtc); +ironlake_enable_pch_pll (intel_crtc);lpt_program_iclkip (crtc);
Signature · 1 line
1.7.11.4
Re: [PATCH 19/36] drm/i915: rename intel_enable_pch_pll to ironlake_enable_pch_pll
Quoted 5 lines · Paulo Zanoni
From: Paulo Zanoni <[email protected]>
Because this function is only for the older PCHs, not the newer ones.
Signed-off-by Paulo Zanoni <[email protected]>
Ok, I've merged patches 1-6 plus this one here for now. gtg, will resume reviewing afterwards.
Thanks a lot for digging through this mess.
Cheers, Daniel
Quoted 50 lines
--- drivers/gpu/drm/i915/intel_display.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/intel_display.c +4
-4@@ -1579,14 +1579,14 @@ out_unlock: }/** -* intel_enable_pch_pll - enable PCH PLL +* ironlake_enable_pch_pll - enable PCH PLL * @dev_priv: i915 private structure * @pipe: pipe PLL to enable * * The PCH PLL needs to be enabled before the PCH transcoder, since it * drives the transcoder clock. */ -static void intel_enable_pch_pll (struct intel_crtc *intel_crtc) +static void ironlake_enable_pch_pll (struct intel_crtc *intel_crtc) {struct drm_i915_private *dev_priv = intel_crtc->base.dev->dev_private;struct intel_pch_pll *pll;@@ -3053,7 +3053,7 @@ static void ironlake_pch_enable(struct drm_crtc *crtc)* Note that enable_pch_pll tries to do the right thing, but get_pch_pll * unconditionally resets the pll - we need that to have the right LVDS * enable sequence. */ -intel_enable_pch_pll (intel_crtc); +ironlake_enable_pch_pll (intel_crtc);if (HAS_PCH_CPT (dev)) {u32 sel;@@ -3149,7 +3149,7 @@ static void lpt_pch_enable(struct drm_crtc *crtc)* Note that enable_pch_pll tries to do the right thing, but get_pch_pll * unconditionally resets the pll - we need that to have the right LVDS * enable sequence. */ -intel_enable_pch_pll (intel_crtc); +ironlake_enable_pch_pll (intel_crtc);lpt_program_iclkip (crtc);Signature · 6 lines
1.7.11.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 20/36 drm/i915: don't call ironlake_enable_pch_pll on lpt_pch_enable
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
This is just wrong. The lpt_program_iclkip should disable the PCH pixel clocks (and yes, we plan to rename it later).
--- drivers/gpu/drm/i915/intel_display.c | 9 --------- 1 file changed, 9 deletions(-)
drivers/gpu/drm/i915/intel_display.c +0 -9
@@ -3142,15 +3142,6 @@ static void lpt_pch_enable(struct drm_crtc *crtc)assert_transcoder_disabled (dev_priv, pipe); -/* XXX: pch pll's can be enabled any time before we enable the PCH -* transcoder, and we actually should do this to not upset any PCH -* transcoder that already use the clock when we share it. -* -* Note that enable_pch_pll tries to do the right thing, but get_pch_pll -* unconditionally resets the pll - we need that to have the right LVDS -* enable sequence. */ -ironlake_enable_pch_pll (intel_crtc); -lpt_program_iclkip (crtc);/* set transcoder timing, panel must allow it */
Signature · 1 line
1.7.11.4
PATCH 21/36 drm/i915: don't assert_panel_unlocked on LPT
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
There is no LVDS, so don't poke the LVDS registers.
--- drivers/gpu/drm/i915/intel_display.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +1 -2
@@ -3144,8 +3144,7 @@ static void lpt_pch_enable(struct drm_crtc *crtc)lpt_program_iclkip (crtc); -/* set transcoder timing, panel must allow it */ -assert_panel_unlocked (dev_priv, pipe); +/* Set transcoder timing. */ I915_WRITE (TRANS_HTOTAL (pipe),I915_READ (HTOTAL (pipe)));I915_WRITE (TRANS_HBLANK (pipe),I915_READ (HBLANK (pipe)));I915_WRITE (TRANS_HSYNC (pipe),I915_READ (HSYNC (pipe)));
Signature · 1 line
1.7.11.4
PATCH 22/36 drm/i915: use the CPU and PCH transcoders on lpt_pch_enable
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
On Haswell/LPT, pipe, cpu_transcoder and pch_transcoder are different things with different values, unlinke the previous gens. So here we use the right thing at the right place.
--- drivers/gpu/drm/i915/intel_display.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/intel_display.c +10 -10
@@ -3138,23 +3138,23 @@ static void lpt_pch_enable(struct drm_crtc *crtc)struct drm_device *dev = crtc->dev;struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -int pipe = intel_crtc->pipe; +enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder; -assert_transcoder_disabled (dev_priv, pipe); +assert_transcoder_disabled (dev_priv,TRANSCODER_A );lpt_program_iclkip (crtc);/* Set transcoder timing. */ -I915_WRITE (TRANS_HTOTAL (pipe),I915_READ (HTOTAL (pipe))); -I915_WRITE (TRANS_HBLANK (pipe),I915_READ (HBLANK (pipe))); -I915_WRITE (TRANS_HSYNC (pipe),I915_READ (HSYNC (pipe))); +I915_WRITE (_TRANS_HTOTAL_A,I915_READ (HTOTAL (cpu_transcoder))); +I915_WRITE (_TRANS_HBLANK_A,I915_READ (HBLANK (cpu_transcoder))); +I915_WRITE (_TRANS_HSYNC_A,I915_READ (HSYNC (cpu_transcoder))); -I915_WRITE (TRANS_VTOTAL (pipe),I915_READ (VTOTAL (pipe))); -I915_WRITE (TRANS_VBLANK (pipe),I915_READ (VBLANK (pipe))); -I915_WRITE (TRANS_VSYNC (pipe),I915_READ (VSYNC (pipe))); -I915_WRITE (TRANS_VSYNCSHIFT (pipe),I915_READ (VSYNCSHIFT (pipe))); +I915_WRITE (_TRANS_VTOTAL_A,I915_READ (VTOTAL (cpu_transcoder))); +I915_WRITE (_TRANS_VBLANK_A,I915_READ (VBLANK (cpu_transcoder))); +I915_WRITE (_TRANS_VSYNC_A,I915_READ (VSYNC (cpu_transcoder))); +I915_WRITE (_TRANS_VSYNCSHIFT_A,I915_READ (VSYNCSHIFT (cpu_transcoder))); -intel_enable_transcoder (dev_priv, pipe); +intel_enable_transcoder (dev_priv, intel_crtc->pipe); }static void intel_put_pch_pll (struct intel_crtc *intel_crtc)
Signature · 1 line
1.7.11.4
PATCH 23/36 drm/i915: rename intel_{en, dis}able_transcoder
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
To ironlake_{en,dis}able_pch_transcoder since these functions will be different on Haswell/LPT and since the "transcoder" they {en,dis}able is on the PCH.
--- drivers/gpu/drm/i915/intel_display.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_display.c +8 -8
@@ -1670,8 +1670,8 @@ static void intel_disable_pch_pll(struct intel_crtc *intel_crtc) pll->on = false; } -static void intel_enable_transcoder (struct drm_i915_private *dev_priv, -enum pipe pipe) +static void ironlake_enable_pch_transcoder (struct drm_i915_private *dev_priv, +enum pipe pipe) {int reg;u32 val, pipeconf_val;
@@ -1721,8 +1721,8 @@ static void intel_enable_transcoder(struct drm_i915_private *dev_priv,DRM_ERROR ("failed to enable transcoder %d\n" , pipe); } -static void intel_disable_transcoder (struct drm_i915_private *dev_priv, -enum pipe pipe) +static void ironlake_disable_pch_transcoder (struct drm_i915_private *dev_priv, +enum pipe pipe) {int reg;u32 val;
@@ -3130,7 +3130,7 @@ static void ironlake_pch_enable(struct drm_crtc *crtc)I915_WRITE (reg, temp); } -intel_enable_transcoder (dev_priv, pipe); +ironlake_enable_pch_transcoder (dev_priv, pipe); }static void lpt_pch_enable (struct drm_crtc *crtc)
@@ -3154,7 +3154,7 @@ static void lpt_pch_enable(struct drm_crtc *crtc)I915_WRITE (_TRANS_VSYNC_A,I915_READ (VSYNC (cpu_transcoder)));I915_WRITE (_TRANS_VSYNCSHIFT_A,I915_READ (VSYNCSHIFT (cpu_transcoder))); -intel_enable_transcoder (dev_priv, intel_crtc->pipe); +ironlake_enable_pch_transcoder (dev_priv, intel_crtc->pipe); }static void intel_put_pch_pll (struct intel_crtc *intel_crtc)
@@ -3463,7 +3463,7 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc)ironlake_fdi_disable (crtc); -intel_disable_transcoder (dev_priv, pipe); +ironlake_disable_pch_transcoder (dev_priv, pipe);if (HAS_PCH_CPT (dev)) {/* disable TRANS_DP_CTL */
@@ -3548,7 +3548,7 @@ static void haswell_crtc_disable(struct drm_crtc *crtc) encoder->post_disable (encoder);if (is_pch_port) { -intel_disable_transcoder (dev_priv, pipe); +ironlake_disable_pch_transcoder (dev_priv, pipe);intel_disable_pch_pll (intel_crtc);intel_ddi_fdi_disable (crtc); }
Signature · 1 line
1.7.11.4
PATCH 24/36 drm/i915: fork lpt version of ironlake_{en, dis}able_pch_transcoder
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
For now the new functions are just copies. Differences will be added later.
--- drivers/gpu/drm/i915/intel_display.c | 77 +++++++++++++++++++++++++++++++++++- 1 file changed, 75 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +75 -2
@@ -1721,6 +1721,57 @@ static void ironlake_enable_pch_transcoder(struct drm_i915_private *dev_priv,DRM_ERROR ("failed to enable transcoder %d\n" , pipe); } +static void lpt_enable_pch_transcoder (struct drm_i915_private *dev_priv, +enum pipe pipe) +{ +int reg; +u32 val, pipeconf_val; +struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe]; + +/* PCH only available on ILK+ */ +BUG_ON (dev_priv->info->gen <5 ); + +/* Make sure PCH DPLL is enabled */ +assert_pch_pll_enabled (dev_priv, +to_intel_crtc (crtc)->pch_pll, +to_intel_crtc (crtc)); + +/* FDI must be feeding us bits for PCH ports */ +assert_fdi_tx_enabled (dev_priv, pipe); +assert_fdi_rx_enabled (dev_priv, pipe); + +if (IS_HASWELL (dev_priv->dev) && pipe >0 ) { +DRM_ERROR ("Attempting to enable transcoder on Haswell with pipe > 0\n" ); +return ; + } + reg =TRANSCONF (pipe); + val =I915_READ (reg); + pipeconf_val =I915_READ (PIPECONF (pipe)); + +if (HAS_PCH_IBX (dev_priv->dev)) { +/* +* make the BPC in transcoder be consistent with +* that in pipeconf reg. +*/ + val &= ~PIPE_BPC_MASK ; + val |= pipeconf_val &PIPE_BPC_MASK ; + } + + val &= ~TRANS_INTERLACE_MASK ; +if ((pipeconf_val &PIPECONF_INTERLACE_MASK ) ==PIPECONF_INTERLACED_ILK ) +if (HAS_PCH_IBX (dev_priv->dev) && +intel_pipe_has_type (crtc,INTEL_OUTPUT_SDVO )) + val |=TRANS_LEGACY_INTERLACED_ILK ; +else + val |=TRANS_INTERLACED ; +else + val |=TRANS_PROGRESSIVE ; + +I915_WRITE (reg, val |TRANS_ENABLE ); +if (wait_for (I915_READ (reg) &TRANS_STATE_ENABLE ,100 )) +DRM_ERROR ("failed to enable transcoder %d\n" , pipe); +} +static void ironlake_disable_pch_transcoder (struct drm_i915_private *dev_priv,enum pipe pipe) {
@@ -1743,6 +1794,28 @@ static void ironlake_disable_pch_transcoder(struct drm_i915_private *dev_priv,DRM_ERROR ("failed to disable transcoder %d\n" , pipe); } +static void lpt_disable_pch_transcoder (struct drm_i915_private *dev_priv, +enum pipe pipe) +{ +int reg; +u32 val; + +/* FDI relies on the transcoder */ +assert_fdi_tx_disabled (dev_priv, pipe); +assert_fdi_rx_disabled (dev_priv, pipe); + +/* Ports must be off as well */ +assert_pch_ports_disabled (dev_priv, pipe); + + reg =TRANSCONF (pipe); + val =I915_READ (reg); + val &= ~TRANS_ENABLE ; +I915_WRITE (reg, val); +/* wait for PCH transcoder off, transcoder state */ +if (wait_for ((I915_READ (reg) &TRANS_STATE_ENABLE ) ==0 ,50 )) +DRM_ERROR ("failed to disable transcoder %d\n" , pipe); +} +/** * intel_enable_pipe - enable a pipe, asserting requirements * @dev_priv: i915 private structure
@@ -3154,7 +3227,7 @@ static void lpt_pch_enable(struct drm_crtc *crtc)I915_WRITE (_TRANS_VSYNC_A,I915_READ (VSYNC (cpu_transcoder)));I915_WRITE (_TRANS_VSYNCSHIFT_A,I915_READ (VSYNCSHIFT (cpu_transcoder))); -ironlake_enable_pch_transcoder (dev_priv, intel_crtc->pipe); +lpt_enable_pch_transcoder (dev_priv, intel_crtc->pipe); }static void intel_put_pch_pll (struct intel_crtc *intel_crtc)
@@ -3548,7 +3621,7 @@ static void haswell_crtc_disable(struct drm_crtc *crtc) encoder->post_disable (encoder);if (is_pch_port) { -ironlake_disable_pch_transcoder (dev_priv, pipe); +lpt_disable_pch_transcoder (dev_priv, pipe);intel_disable_pch_pll (intel_crtc);intel_ddi_fdi_disable (crtc); }
Signature · 1 line
1.7.11.4
PATCH 25/36 drm/i915: remove Haswell code from ironlake_enable_pch_transcoder
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
Since now we have lpt_enable_pch_transcoder.
--- drivers/gpu/drm/i915/intel_display.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/gpu/drm/i915/intel_display.c +0 -4
@@ -1689,10 +1689,6 @@ static void ironlake_enable_pch_transcoder(struct drm_i915_private *dev_priv,assert_fdi_tx_enabled (dev_priv, pipe);assert_fdi_rx_enabled (dev_priv, pipe); -if (IS_HASWELL (dev_priv->dev) && pipe >0 ) { -DRM_ERROR ("Attempting to enable transcoder on Haswell with pipe > 0\n" ); -return ; - } reg =TRANSCONF (pipe); val =I915_READ (reg); pipeconf_val =I915_READ (PIPECONF (pipe));
Signature · 1 line
1.7.11.4
PATCH 26/36 drm/i915: remove IBX code from lpt_enable_pch_transcoder
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
--- drivers/gpu/drm/i915/intel_display.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-)
drivers/gpu/drm/i915/intel_display.c +1 -14
@@ -1744,22 +1744,9 @@ static void lpt_enable_pch_transcoder(struct drm_i915_private *dev_priv, val =I915_READ (reg); pipeconf_val =I915_READ (PIPECONF (pipe)); -if (HAS_PCH_IBX (dev_priv->dev)) { -/* -* make the BPC in transcoder be consistent with -* that in pipeconf reg. -*/ - val &= ~PIPE_BPC_MASK ; - val |= pipeconf_val &PIPE_BPC_MASK ; - } - val &= ~TRANS_INTERLACE_MASK ;if ((pipeconf_val &PIPECONF_INTERLACE_MASK ) ==PIPECONF_INTERLACED_ILK ) -if (HAS_PCH_IBX (dev_priv->dev) && -intel_pipe_has_type (crtc,INTEL_OUTPUT_SDVO )) - val |=TRANS_LEGACY_INTERLACED_ILK ; -else - val |=TRANS_INTERLACED ; + val |=TRANS_INTERLACED ;else val |=TRANS_PROGRESSIVE ;
Signature · 1 line
1.7.11.4
PATCH 27/36 drm/i915: don't assert_pch_pll_enabled on lpt_enable_pch_transcoder
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
These asserts are specific to IBX/CPT/PPT. Inside the assert_pch_pll function we even "return" in case we detect LPT, but I prefer to just not call it. In the future we might rename to something like ibx_assert_pch_pll.
--- drivers/gpu/drm/i915/intel_display.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/gpu/drm/i915/intel_display.c +0 -6
@@ -1722,16 +1722,10 @@ static void lpt_enable_pch_transcoder(struct drm_i915_private *dev_priv, {int reg;u32 val, pipeconf_val; -struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe];/* PCH only available on ILK+ */ BUG_ON (dev_priv->info->gen <5 ); -/* Make sure PCH DPLL is enabled */ -assert_pch_pll_enabled (dev_priv, -to_intel_crtc (crtc)->pch_pll, -to_intel_crtc (crtc)); -/* FDI must be feeding us bits for PCH ports */ assert_fdi_tx_enabled (dev_priv, pipe);assert_fdi_rx_enabled (dev_priv, pipe);
Signature · 1 line
1.7.11.4
Re: [PATCH 27/36] drm/i915: don't assert_pch_pll_enabled on lpt_enable_pch_transcoder
Quoted 8 lines · Paulo Zanoni
From: Paulo Zanoni <[email protected]>
These asserts are specific to IBX/CPT/PPT. Inside the
assert_pch_pllfunction we even "return" in case we detect LPT, but I prefer to just not call it. In the future we might rename to something likeibx_assert_pch_pll.Signed-off-by Paulo Zanoni <[email protected]>
Can't we now remove the HAS_LPT check from assert_pch_pll? Afaics we only call it from ilk_pch_transcoder_enable and from the pch_pll handling functions, both of which should no longer be called from haswell code.
For renaming them, I think that particular problem will solve itself once we move all the ilk-ivb crtc/pch code into it's own file. With all these splits you've done here for vga, I don't see much common code between older pch and new-style ddi pch any more ...
-Daniel
Quoted 32 lines
--- drivers/gpu/drm/i915/intel_display.c | 6 ------ 1 file changed, 6 deletions(-)drivers/gpu/drm/i915/intel_display.c +0
-6@@ -1722,16 +1722,10 @@ static void lpt_enable_pch_transcoder(struct drm_i915_private *dev_priv, {int reg;u32 val, pipeconf_val; -struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe];/* PCH only available on ILK+ */ BUG_ON (dev_priv->info->gen <5 ); -/* Make sure PCH DPLL is enabled */ -assert_pch_pll_enabled (dev_priv, -to_intel_crtc (crtc)->pch_pll, -to_intel_crtc (crtc)); -/* FDI must be feeding us bits for PCH ports */ assert_fdi_tx_enabled (dev_priv, pipe);assert_fdi_rx_enabled (dev_priv, pipe);Signature · 6 lines
1.7.11.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 28/36 drm/i915: use CPU and PCH transcoders on lpt_enable_pch_transcoder
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
... instead of using "pipe". As already explained in previous commits, since Haswell/LPT cpu_transcoder, pch_transcoder and pipe are not the same thing.
--- drivers/gpu/drm/i915/intel_display.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/intel_display.c +9 -15
@@ -1718,25 +1718,19 @@ static void ironlake_enable_pch_transcoder(struct drm_i915_private *dev_priv, }static void lpt_enable_pch_transcoder (struct drm_i915_private *dev_priv, -enum pipe pipe) +enum transcoder cpu_transcoder) { -int reg;u32 val, pipeconf_val;/* PCH only available on ILK+ */ BUG_ON (dev_priv->info->gen <5 );/* FDI must be feeding us bits for PCH ports */ -assert_fdi_tx_enabled (dev_priv, pipe); -assert_fdi_rx_enabled (dev_priv, pipe); +assert_fdi_tx_enabled (dev_priv, cpu_transcoder); +assert_fdi_rx_enabled (dev_priv,TRANSCODER_A ); -if (IS_HASWELL (dev_priv->dev) && pipe >0 ) { -DRM_ERROR ("Attempting to enable transcoder on Haswell with pipe > 0\n" ); -return ; - } - reg =TRANSCONF (pipe); - val =I915_READ (reg); - pipeconf_val =I915_READ (PIPECONF (pipe)); + val =I915_READ (_TRANSACONF); + pipeconf_val =I915_READ (PIPECONF (cpu_transcoder)); val &= ~TRANS_INTERLACE_MASK ;if ((pipeconf_val &PIPECONF_INTERLACE_MASK ) ==PIPECONF_INTERLACED_ILK )
@@ -1744,9 +1738,9 @@ static void lpt_enable_pch_transcoder(struct drm_i915_private *dev_priv,else val |=TRANS_PROGRESSIVE ; -I915_WRITE (reg, val |TRANS_ENABLE ); -if (wait_for (I915_READ (reg) &TRANS_STATE_ENABLE ,100 )) -DRM_ERROR ("failed to enable transcoder %d\n" , pipe); +I915_WRITE (_TRANSACONF, val |TRANS_ENABLE ); +if (wait_for (I915_READ (_TRANSACONF) &TRANS_STATE_ENABLE ,100 )) +DRM_ERROR ("Failed to enable PCH transcoder\n" ); } static void ironlake_disable_pch_transcoder(struct drm_i915_private *dev_priv,
@@ -3204,7 +3198,7 @@ static void lpt_pch_enable(struct drm_crtc *crtc)I915_WRITE (_TRANS_VSYNC_A,I915_READ (VSYNC (cpu_transcoder)));I915_WRITE (_TRANS_VSYNCSHIFT_A,I915_READ (VSYNCSHIFT (cpu_transcoder))); -lpt_enable_pch_transcoder (dev_priv, intel_crtc->pipe); +lpt_enable_pch_transcoder (dev_priv, cpu_transcoder); }static void intel_put_pch_pll (struct intel_crtc *intel_crtc)
Signature · 1 line
1.7.11.4
PATCH 29/36 drm/i915: use PIPECONF_INTERLACE_MASK_HSW on lpt_enable_pch_transcoder
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
... instead of PIPECONF_INTERLACE_MASK.
--- drivers/gpu/drm/i915/intel_display.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +2 -1
@@ -1733,7 +1733,8 @@ static void lpt_enable_pch_transcoder(struct drm_i915_private *dev_priv, pipeconf_val =I915_READ (PIPECONF (cpu_transcoder)); val &= ~TRANS_INTERLACE_MASK ; -if ((pipeconf_val &PIPECONF_INTERLACE_MASK ) ==PIPECONF_INTERLACED_ILK ) +if ((pipeconf_val &PIPECONF_INTERLACE_MASK_HSW ) == +PIPECONF_INTERLACED_ILK ) val |=TRANS_INTERLACED ;else val |=TRANS_PROGRESSIVE ;
Signature · 1 line
1.7.11.4
Re: [PATCH 29/36] drm/i915: use PIPECONF_INTERLACE_MASK_HSW on lpt_enable_pch_transcoder
Quoted 5 lines · Paulo Zanoni
From: Paulo Zanoni <[email protected]>
... instead of
PIPECONF_INTERLACE_MASK.Signed-off-by Paulo Zanoni <[email protected]>
My Bspec here still has bits 23:21 for the interlaced bits on the lpt pch, but everything with bit 23 set is a reserved value. Sinc we set the correct stuff anyway, I don't think we need to change the mask here - the same would apply to cpt. So I'll drop this one here.
-Daniel
Quoted 25 lines
--- drivers/gpu/drm/i915/intel_display.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/intel_display.c +2
-1@@ -1733,7 +1733,8 @@ static void lpt_enable_pch_transcoder(struct drm_i915_private *dev_priv, pipeconf_val =I915_READ (PIPECONF (cpu_transcoder)); val &= ~TRANS_INTERLACE_MASK ; -if ((pipeconf_val &PIPECONF_INTERLACE_MASK ) ==PIPECONF_INTERLACED_ILK ) +if ((pipeconf_val &PIPECONF_INTERLACE_MASK_HSW ) == +PIPECONF_INTERLACED_ILK ) val |=TRANS_INTERLACED ;else val |=TRANS_PROGRESSIVE ;Signature · 6 lines
1.7.11.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Re: [PATCH 29/36] drm/i915: use PIPECONF_INTERLACE_MASK_HSW on lpt_enable_pch_transcoder
Hi
2012/11/1 Daniel Vetter <[email protected]>:
Quoted 11 lines · Paulo Zanoni
Quoted 5 lines
From: Paulo Zanoni <[email protected]>
... instead of
PIPECONF_INTERLACE_MASK.Signed-off-by Paulo Zanoni <[email protected]>My Bspec here still has bits 23:21 for the interlaced bits on the lpt pch, but everything with bit 23 set is a reserved value. Sinc we set the correct stuff anyway, I don't think we need to change the mask here - the same would apply to cpt. So I'll drop this one here.
But here we're dealing with "pipeconf_val" which the value we read in PIPECONF, which is on the CPU, not on the PCH.
TRANS_CONF has bits 23:21 for the interlaced mode, but PIPECONF has bits 22:21 for the interlaced mode. We're reading from PIPECONF to write to TRANSCONF, but the mask is being applied to pipeconf, so the mask should be 22:21.
I still think my patch is correct.
Quoted 32 lines
-Daniel
Quoted 21 lines
--- drivers/gpu/drm/i915/intel_display.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/intel_display.c +2
-2@@ -1733,7 +1733,8 @@ static void lpt_enable_pch_transcoder(struct drm_i915_private *dev_priv, pipeconf_val =I915_READ (PIPECONF (cpu_transcoder)); val &= ~TRANS_INTERLACE_MASK ; -if ((pipeconf_val &PIPECONF_INTERLACE_MASK ) ==PIPECONF_INTERLACED_ILK ) +if ((pipeconf_val &PIPECONF_INTERLACE_MASK_HSW ) == +PIPECONF_INTERLACED_ILK ) val |=TRANS_INTERLACED ;else val |=TRANS_PROGRESSIVE ; --1.7.11.4
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
Signature · 1 line
Paulo Zanoni
Re: [PATCH 29/36] drm/i915: use PIPECONF_INTERLACE_MASK_HSW on lpt_enable_pch_transcoder
Quoted 18 lines · Paulo Zanoni
Hi
2012/11/1 Daniel Vetter <[email protected]>:
Quoted 11 lines · Paulo Zanoni
Quoted 5 lines
From: Paulo Zanoni <[email protected]>
... instead of
PIPECONF_INTERLACE_MASK.Signed-off-by Paulo Zanoni <[email protected]>My Bspec here still has bits 23:21 for the interlaced bits on the lpt pch, but everything with bit 23 set is a reserved value. Sinc we set the correct stuff anyway, I don't think we need to change the mask here - the same would apply to cpt. So I'll drop this one here.
But here we're dealing with "
pipeconf_val" which the value we read in PIPECONF, which is on the CPU, not on the PCH.
Quoted 6 lines
TRANS_CONFhas bits 23:21 for the interlaced mode, but PIPECONF has bits 22:21 for the interlaced mode. We're reading from PIPECONF to write to TRANSCONF, but the mask is being applied to pipeconf, so the mask should be 22:21.I still think my patch is correct.
Ah, now I see, thanks for the correction, patch applied.
Btw, while reading Bspec I've noticed some restrictions on the interlaced mode we're using (i.e. progressive->interlaced conversion): We seem to need a 7x5 panel fitter (which doesn't exist on all pipes) and have a limit of 2048 on the source width ...
-Daniel
Quoted 38 lines
Quoted 33 lines
-Daniel
Quoted 21 lines
--- drivers/gpu/drm/i915/intel_display.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/intel_display.c +2
-2@@ -1733,7 +1733,8 @@ static void lpt_enable_pch_transcoder(struct drm_i915_private *dev_priv, pipeconf_val =I915_READ (PIPECONF (cpu_transcoder)); val &= ~TRANS_INTERLACE_MASK ; -if ((pipeconf_val &PIPECONF_INTERLACE_MASK ) ==PIPECONF_INTERLACED_ILK ) +if ((pipeconf_val &PIPECONF_INTERLACE_MASK_HSW ) == +PIPECONF_INTERLACED_ILK ) val |=TRANS_INTERLACED ;else val |=TRANS_PROGRESSIVE ; --1.7.11.4
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.chSignature · 1 line
Paulo Zanoni
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 30/36 drm/i915: don't rely on previous values when setting LPT TRANSCONF
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
Because we already set all the bits we can set.
--- drivers/gpu/drm/i915/intel_display.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_display.c +2 -3
@@ -1729,17 +1729,16 @@ static void lpt_enable_pch_transcoder(struct drm_i915_private *dev_priv,assert_fdi_tx_enabled (dev_priv, cpu_transcoder);assert_fdi_rx_enabled (dev_priv,TRANSCODER_A ); - val =I915_READ (_TRANSACONF); + val =TRANS_ENABLE ; pipeconf_val =I915_READ (PIPECONF (cpu_transcoder)); - val &= ~TRANS_INTERLACE_MASK ;if ((pipeconf_val &PIPECONF_INTERLACE_MASK_HSW ) ==PIPECONF_INTERLACED_ILK ) val |=TRANS_INTERLACED ;else val |=TRANS_PROGRESSIVE ; -I915_WRITE (_TRANSACONF, val |TRANS_ENABLE ); +I915_WRITE (_TRANSACONF, val);if (wait_for (I915_READ (_TRANSACONF) &TRANS_STATE_ENABLE ,100 ))DRM_ERROR ("Failed to enable PCH transcoder\n" ); }
Signature · 1 line
1.7.11.4
PATCH 31/36 drm/i915: don't assert_pch_ports_disabled on LPT
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
That function is made for IBX. Running it on LPT will trigger tons of "unclaimed register" errors. The only port remaining on LPT is PCH_ADPA.
--- drivers/gpu/drm/i915/intel_display.c | 3 --- 1 file changed, 3 deletions(-)
drivers/gpu/drm/i915/intel_display.c +0 -3
@@ -1775,9 +1775,6 @@ static void lpt_disable_pch_transcoder(struct drm_i915_private *dev_priv,assert_fdi_tx_disabled (dev_priv, pipe);assert_fdi_rx_disabled (dev_priv, pipe); -/* Ports must be off as well */ -assert_pch_ports_disabled (dev_priv, pipe); - reg =TRANSCONF (pipe); val =I915_READ (reg); val &= ~TRANS_ENABLE ;
Signature · 1 line
1.7.11.4
Re: [PATCH 31/36] drm/i915: don't assert_pch_ports_disabled on LPT
Quoted 7 lines · Paulo Zanoni
From: Paulo Zanoni <[email protected]>
That function is made for IBX. Running it on LPT will trigger tons of "unclaimed register" errors. The only port remaining on LPT is
PCH_ADPA.Signed-off-by Paulo Zanoni <[email protected]>
Actually I've had to stay around for a while longer before heading off, so reviewed and applied a few more patches, up to this one here (minus the one I've dropped).
Thanks, Daniel
Quoted 25 lines
--- drivers/gpu/drm/i915/intel_display.c | 3 --- 1 file changed, 3 deletions(-)drivers/gpu/drm/i915/intel_display.c +0
-3@@ -1775,9 +1775,6 @@ static void lpt_disable_pch_transcoder(struct drm_i915_private *dev_priv,assert_fdi_tx_disabled (dev_priv, pipe);assert_fdi_rx_disabled (dev_priv, pipe); -/* Ports must be off as well */ -assert_pch_ports_disabled (dev_priv, pipe); - reg =TRANSCONF (pipe); val =I915_READ (reg); val &= ~TRANS_ENABLE ;Signature · 6 lines
1.7.11.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 32/36 drm/i915: use CPU and PCH transcoders on lpt_disable_pch_transcoder
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
... instead of "pipe", which is wrong.
--- drivers/gpu/drm/i915/intel_display.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/intel_display.c +8 -10
@@ -1766,22 +1766,20 @@ static void ironlake_disable_pch_transcoder(struct drm_i915_private *dev_priv, }static void lpt_disable_pch_transcoder (struct drm_i915_private *dev_priv, -enum pipe pipe) +enum transcoder cpu_transcoder) { -int reg;u32 val;/* FDI relies on the transcoder */ -assert_fdi_tx_disabled (dev_priv, pipe); -assert_fdi_rx_disabled (dev_priv, pipe); +assert_fdi_tx_disabled (dev_priv, cpu_transcoder); +assert_fdi_rx_disabled (dev_priv,TRANSCODER_A ); - reg =TRANSCONF (pipe); - val =I915_READ (reg); + val =I915_READ (_TRANSACONF); val &= ~TRANS_ENABLE ; -I915_WRITE (reg, val); +I915_WRITE (_TRANSACONF, val);/* wait for PCH transcoder off, transcoder state */ -if (wait_for ((I915_READ (reg) &TRANS_STATE_ENABLE ) ==0 ,50 )) -DRM_ERROR ("failed to disable transcoder %d\n" , pipe); +if (wait_for ((I915_READ (_TRANSACONF) &TRANS_STATE_ENABLE ) ==0 ,50 )) +DRM_ERROR ("Failed to disable PCH transcoder\n" ); }/**
@@ -3589,7 +3587,7 @@ static void haswell_crtc_disable(struct drm_crtc *crtc) encoder->post_disable (encoder);if (is_pch_port) { -lpt_disable_pch_transcoder (dev_priv, pipe); +lpt_disable_pch_transcoder (dev_priv, cpu_transcoder);intel_disable_pch_pll (intel_crtc);intel_ddi_fdi_disable (crtc); }
Signature · 1 line
1.7.11.4
PATCH 33/36 drm/i915: implement timing override workarounds on LPT
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
These workarounds are documented on the CRT mode set sequence.
--- drivers/gpu/drm/i915/intel_display.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/gpu/drm/i915/intel_display.c +10 -0
@@ -1729,6 +1729,11 @@ static void lpt_enable_pch_transcoder(struct drm_i915_private *dev_priv,assert_fdi_tx_enabled (dev_priv, cpu_transcoder);assert_fdi_rx_enabled (dev_priv,TRANSCODER_A ); +/* Workaround: set timing override bit. */ + val =I915_READ (_TRANSA_CHICKEN2); + val |=TRANS_AUTOTRAIN_GEN_STALL_DIS ; +I915_WRITE (_TRANSA_CHICKEN2, val); + val =TRANS_ENABLE ; pipeconf_val =I915_READ (PIPECONF (cpu_transcoder));
@@ -1780,6 +1785,11 @@ static void lpt_disable_pch_transcoder(struct drm_i915_private *dev_priv,/* wait for PCH transcoder off, transcoder state */ if (wait_for ((I915_READ (_TRANSACONF) &TRANS_STATE_ENABLE ) ==0 ,50 ))DRM_ERROR ("Failed to disable PCH transcoder\n" ); + +/* Workaround: clear timing override bit. */ + val =I915_READ (_TRANSA_CHICKEN2); + val &= ~TRANS_AUTOTRAIN_GEN_STALL_DIS ; +I915_WRITE (_TRANSA_CHICKEN2, val); }/**
Signature · 1 line
1.7.11.4
PATCH 34/36 drm/i915: don't intel_disable_pch_pll on Haswell/LPT
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
This function is only for the previous gens.
--- drivers/gpu/drm/i915/intel_display.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +0 -1
@@ -3598,7 +3598,6 @@ static void haswell_crtc_disable(struct drm_crtc *crtc)if (is_pch_port) {lpt_disable_pch_transcoder (dev_priv, cpu_transcoder); -intel_disable_pch_pll (intel_crtc);intel_ddi_fdi_disable (crtc); }
Signature · 1 line
1.7.11.4
PATCH 35/36 drm/i915: don't limit Haswell CRT encoder to pipe A
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
This is a full revert of 59c859d6f2e78344945e8a8406a194156176bc4e:
drm/i915: account for only one PCH receiver on Haswell
Now that the PCH code is fixed to be able use the only PCH transcoder independently of the pipe and CPU transcoder, we can revert this.
--- drivers/gpu/drm/i915/intel_crt.c | 5 +---- drivers/gpu/drm/i915/intel_display.c | 15 +++------------ 2 files changed, 4 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/intel_crt.c +1 -4
@@ -764,10 +764,7 @@ void intel_crt_init(struct drm_device *dev) crt->base.type =INTEL_OUTPUT_ANALOG ; crt->base.cloneable = true; -if (IS_HASWELL (dev)) - crt->base.crtc_mask = (1 <<0 ); -else - crt->base.crtc_mask = (1 <<0 ) | (1 <<1 ) | (1 <<2 ); + crt->base.crtc_mask = (1 <<0 ) | (1 <<1 ) | (1 <<2 );if (IS_GEN2 (dev)) connector->interlace_allowed =0 ;
drivers/gpu/drm/i915/intel_display.c +3 -12
@@ -1151,14 +1151,9 @@ static void assert_fdi_rx(struct drm_i915_private *dev_priv,u32 val;bool cur_state; -if (IS_HASWELL (dev_priv->dev) && pipe >0 ) { -DRM_ERROR ("Attempting to enable FDI_RX on Haswell pipe > 0\n" ); -return ; - }else { - reg =FDI_RX_CTL (pipe); - val =I915_READ (reg); - cur_state = !!(val &FDI_RX_ENABLE ); - } + reg =FDI_RX_CTL (pipe); + val =I915_READ (reg); + cur_state = !!(val &FDI_RX_ENABLE );WARN (cur_state != state,"FDI RX state assertion failure (expected %s, current %s)\n" ,state_string (state),state_string (cur_state));
@@ -1191,10 +1186,6 @@ static void assert_fdi_rx_pll_enabled(struct drm_i915_private *dev_priv,int reg;u32 val; -if (IS_HASWELL (dev_priv->dev) && pipe >0 ) { -DRM_ERROR ("Attempting to enable FDI on Haswell with pipe > 0\n" ); -return ; - } reg =FDI_RX_CTL (pipe); val =I915_READ (reg);WARN (!(val &FDI_RX_PLL_ENABLE ),"FDI RX PLL assertion failure, should be active but is disabled\n" );
Signature · 1 line
1.7.11.4
PATCH 36/36 drm/i915: don't assert disabled FDI before disabling the FDI
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
On Haswell/LPT we must disable the PCH transcoder before we disable the FDI, so don't check for disabled FDI there.
--- drivers/gpu/drm/i915/intel_display.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/intel_display.c +2 -7
@@ -1761,15 +1761,10 @@ static void ironlake_disable_pch_transcoder(struct drm_i915_private *dev_priv,DRM_ERROR ("failed to disable transcoder %d\n" , pipe); } -static void lpt_disable_pch_transcoder (struct drm_i915_private *dev_priv, -enum transcoder cpu_transcoder) +static void lpt_disable_pch_transcoder (struct drm_i915_private *dev_priv) {u32 val; -/* FDI relies on the transcoder */ -assert_fdi_tx_disabled (dev_priv, cpu_transcoder); -assert_fdi_rx_disabled (dev_priv,TRANSCODER_A ); - val =I915_READ (_TRANSACONF); val &= ~TRANS_ENABLE ;I915_WRITE (_TRANSACONF, val);
@@ -3588,7 +3583,7 @@ static void haswell_crtc_disable(struct drm_crtc *crtc) encoder->post_disable (encoder);if (is_pch_port) { -lpt_disable_pch_transcoder (dev_priv, cpu_transcoder); +lpt_disable_pch_transcoder (dev_priv);intel_ddi_fdi_disable (crtc); }
Signature · 1 line
1.7.11.4
Re: [PATCH 36/36] drm/i915: don't assert disabled FDI before disabling the FDI
Quoted 6 lines · Paulo Zanoni
From: Paulo Zanoni <[email protected]>
On Haswell/LPT we must disable the PCH transcoder before we disable the FDI, so don't check for disabled FDI there.
Signed-off-by Paulo Zanoni <[email protected]>
Ok, I've slurped in the last few patches here, safe for patch 35, I'll do that last. Next up: fdi link train madness ;-)
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch