drm/i915: set the correct number of FDI lanes on Haswell
Subsystems (2)
PATCH 1/4 drm/i915: set the correct number of FDI lanes on Haswell
From: Paulo Zanoni <[email protected]>
We had 2 places using X2 and one place using X1.
--- drivers/gpu/drm/i915/intel_ddi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +3 -2
@@ -171,7 +171,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 );
@@ -193,7 +193,7 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)FDI_RX_ENABLE |FDI_LINK_TRAIN_PATTERN_1_CPT |FDI_RX_ENHANCE_FRAME_ENABLE | -FDI_PORT_WIDTH_2X_LPT | + ((intel_crtc->fdi_lanes -1 ) <<19 ) | FDI_RX_PLL_ENABLE);POSTING_READ (reg);udelay (100 );
@@ -952,6 +952,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 2/4 drm/i915: fix Haswell FDI link training code
From: Paulo Zanoni <[email protected]>
This commit makes hsw_fdi_link_train responsible for implementing everything described in the "Enable and train FDI" section from the Hawell CRT mode set sequence documentation. We completely rewrite hsw_fdi_link_train to match the documentation and we also call it in the right place.
This patch was initially sent as a series of tiny patches fixing every little problem of the function, but since there were too many patches fixing the same function it got a little difficult to get the "big picture" of how the function would be in the end, so here we amended all the patches into a single big patch fixing the whole function.
Problems we fixed:
1 - Train Haswell FDI at the right time.
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.
2 - Use the right FDI_RX_CTL register on Haswell
There is only one PCH transcoder, so it's always _FDI_RXA_CTL. Using "pipe" here is wrong.
3 - Don't rely on DDI_BUF_CTL previous values
Just set the bits we want, everything else is zero. Also POSTING_READ the register before sleeping.
4 - Program the FDI RX TUSIZE register on hsw_fdi_link_train
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.
Also remove the code that sets this register from the old
location: lpt_pch_enable.
5 - Properly program FDI_RX_MISC pwrdn lane values on HSW
6 - Wait only 35us for the FDI link training
First we wait 30us for the FDI receiver lane calibration, then we wait 5us for the FDI auto training time.
7 - Remove an useless indentation level on hsw_fdi_link_train
We already "break" when the link training succeeds.
8 - Disable FDI_RX_ENABLE, not FDI_RX_PLL_ENABLE
When we fail the training.
9 - Change Haswell FDI link training error messages
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.
10 - Try each voltage twice at hsw_fdi_link_train
Now with Daniel Vetter's suggestion to use "/2" instead of ">>1".
--- drivers/gpu/drm/i915/i915_reg.h | 17 ++++-- drivers/gpu/drm/i915/intel_ddi.c | 108 +++++++++++++++++++++-------------- drivers/gpu/drm/i915/intel_display.c | 11 +--- 3 files changed, 76 insertions(+), 60 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +11 -6
@@ -3924,16 +3924,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 +64 -44
138 lines not on this page · raw message
drivers/gpu/drm/i915/intel_display.c +1 -10
@@ -3114,9 +3114,6 @@ static void ironlake_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.
@@ -3209,16 +3206,10 @@ 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,TRANSCODER_A ); -/* 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);
@@ -3451,7 +3442,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 2/4] drm/i915: fix Haswell FDI link training code
This is wrong.... Ignore it. I messed up rebasing it against the new patches.
2012/11/1 Paulo Zanoni <[email protected]>:
Quoted 301 lines
From: Paulo Zanoni <[email protected]>
This commit makes
hsw_fdi_link_trainresponsible for implementing everything described in the "Enable and train FDI" section from the Hawell CRT mode set sequence documentation. We completely rewritehsw_fdi_link_trainto match the documentation and we also call it in the right place.This patch was initially sent as a series of tiny patches fixing every little problem of the function, but since there were too many patches fixing the same function it got a little difficult to get the "big picture" of how the function would be in the end, so here we amended all the patches into a single big patch fixing the whole function.
Problems we fixed:
1 - Train Haswell FDI at the right time.
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.2 - Use the right
FDI_RX_CTLregister on HaswellThere is only one PCH transcoder, so it's always
_FDI_RXA_CTL. Using "pipe" here is wrong.3 - Don't rely on
DDI_BUF_CTLprevious valuesJust set the bits we want, everything else is zero. Also
POSTING_READthe register before sleeping.4 - Program the FDI RX TUSIZE register on
hsw_fdi_link_trainAccording 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.Also remove the code that sets this register from the old
location:lpt_pch_enable.5 - Properly program
FDI_RX_MISCpwrdn lane values on HSW6 - Wait only 35us for the FDI link training
First we wait 30us for the FDI receiver lane calibration, then we wait 5us for the FDI auto training time.
7 - Remove an useless indentation level on
hsw_fdi_link_trainWe already "break" when the link training succeeds.
8 - Disable
FDI_RX_ENABLE, notFDI_RX_PLL_ENABLEWhen we fail the training.
9 - Change Haswell FDI link training error messages
We shouldn't call
DRM_ERRORwhen still looping through voltage levels since this is expected and not really a failure. So in this commit we adjust the error path to onlyDRM_ERRORwhen we really fail after trying everything.While at it, replace
DRM_DEBUG_DRIVERwithDRM_DEBUG_KMSsince it's what we use everywhere.10 - Try each voltage twice at
hsw_fdi_link_trainNow with Daniel Vetter's suggestion to use "/2" instead of ">>1".
Signed-off-by Paulo Zanoni <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 17 ++++-- drivers/gpu/drm/i915/intel_ddi.c | 108 +++++++++++++++++++++-------------- drivers/gpu/drm/i915/intel_display.c | 11 +--- 3 files changed, 76 insertions(+), 60 deletions(-)drivers/gpu/drm/i915/i915_reg.h +11
-6@@ -3924,16 +3924,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 +64
-44@@ -153,11 +153,33 @@ 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; +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: +* - 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++) { +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 |@@ -166,41 +188,37 @@ 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 /2 ]); +POSTING_READ (DDI_BUF_CTL (PORT_E ));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, -I915_READ (reg) | -FDI_LINK_TRAIN_AUTO | -FDI_RX_ENABLE | -FDI_LINK_TRAIN_PATTERN_1_CPT | -FDI_RX_ENHANCE_FRAME_ENABLE | - ((intel_crtc->fdi_lanes -1 ) <<19 ) | -FDI_RX_PLL_ENABLE ); -POSTING_READ (reg); -udelay (100 ); +/* Program PCH FDI Receiver TU */ +I915_WRITE (_FDI_RXA_TUSIZE1,TU_SIZE (64 )); + +/* 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); + +/* Wait for FDI receiver lane calibration */ +udelay (30 ); + +/* Unset 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); + +/* 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); +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),@@ -209,22 +227,24 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)DP_TP_CTL_ENHANCED_FRAME_ENABLE | 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 ); -I915_WRITE (FDI_RX_CTL (pipe), -I915_READ (FDI_RX_CTL (pipe)) & - ~FDI_RX_PLL_ENABLE ); -continue ; +return ; } + +/* 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 ); + + rx_ctl_val &= ~FDI_RX_ENABLE ; +I915_WRITE (_FDI_RXA_CTL, rx_ctl_val); + +/* Reset FDI_RX_MISC pwrdn lanes */ + 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" ); +DRM_ERROR ("FDI link training failed!\n" ); }/* WRPLL clock dividers */ drivers/gpu/drm/i915/intel_display.c +1
-11@@ -3114,9 +3114,6 @@ static void ironlake_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. @@ -3209,16 +3206,10 @@ 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,TRANSCODER_A ); -/* 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);@@ -3451,7 +3442,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) --1.7.11.4
Signature · 1 line
Paulo Zanoni
PATCH 2/4 drm/i915: fix Haswell FDI link training code
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
This commit makes hsw_fdi_link_train responsible for implementing everything described in the "Enable and train FDI" section from the Hawell CRT mode set sequence documentation. We completely rewrite hsw_fdi_link_train to match the documentation and we also call it in the right place.
This patch was initially sent as a series of tiny patches fixing every little problem of the function, but since there were too many patches fixing the same function it got a little difficult to get the "big picture" of how the function would be in the end, so here we amended all the patches into a single big patch fixing the whole function.
Problems we fixed:
1 - Train Haswell FDI at the right time.
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.
2 - Use the right FDI_RX_CTL register on Haswell
There is only one PCH transcoder, so it's always _FDI_RXA_CTL. Using "pipe" here is wrong.
3 - Don't rely on DDI_BUF_CTL previous values
Just set the bits we want, everything else is zero. Also POSTING_READ the register before sleeping.
4 - Program the FDI RX TUSIZE register on hsw_fdi_link_train
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.
Also remove the code that sets this register from the old
location: lpt_pch_enable.
5 - Properly program FDI_RX_MISC pwrdn lane values on HSW
6 - Wait only 35us for the FDI link training
First we wait 30us for the FDI receiver lane calibration, then we wait 5us for the FDI auto training time.
7 - Remove an useless indentation level on hsw_fdi_link_train
We already "break" when the link training succeeds.
8 - Disable FDI_RX_ENABLE, not FDI_RX_PLL_ENABLE
When we fail the training.
9 - Change Haswell FDI link training error messages
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.
10 - Try each voltage twice at hsw_fdi_link_train
Now with Daniel Vetter's suggestion to use "/2" instead of ">>1".
--- drivers/gpu/drm/i915/i915_reg.h | 17 ++++-- drivers/gpu/drm/i915/intel_ddi.c | 108 +++++++++++++++++++++-------------- drivers/gpu/drm/i915/intel_display.c | 11 +--- 3 files changed, 76 insertions(+), 60 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +11 -6
@@ -3936,16 +3936,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 +64 -44
138 lines not on this page · raw message
drivers/gpu/drm/i915/intel_display.c +1 -10
@@ -3226,19 +3226,10 @@ 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,TRANSCODER_A ); -/* 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); -lpt_program_iclkip (crtc);/* Set transcoder timing. */
@@ -3464,7 +3455,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
PATCH 3/4 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
@@ -1364,6 +1364,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
@@ -3619,10 +3619,9 @@ static void haswell_crtc_disable(struct drm_crtc *crtc) encoder->post_disable (encoder);if (is_pch_port) { -ironlake_fdi_disable (crtc);lpt_disable_pch_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 3/4 drm/i915: fix Haswell FDI link disable path
From: 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
@@ -1364,6 +1364,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
@@ -3632,9 +3632,8 @@ static void haswell_crtc_disable(struct drm_crtc *crtc) encoder->post_disable (encoder);if (is_pch_port) { -ironlake_fdi_disable (crtc);lpt_disable_pch_transcoder (dev_priv); -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
Re: [PATCH 3/4] drm/i915: fix Haswell FDI link disable path
Quoted 6 lines · Paulo Zanoni
From: 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.
Signed-off-by Paulo Zanoni <[email protected]>
Ok, slurped in patches 1-3 (since patch 4 is already applied) of this series, with a minor bikeshed on patch 2.
Thanks, Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 4/4 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
@@ -1703,7 +1703,8 @@ static void ironlake_enable_pch_transcoder(struct drm_i915_private *dev_priv, } val &= ~TRANS_INTERLACE_MASK ; -if ((pipeconf_val &PIPECONF_INTERLACE_MASK ) ==PIPECONF_INTERLACED_ILK ) +if ((pipeconf_val &PIPECONF_INTERLACE_MASK_HSW ) == +PIPECONF_INTERLACED_ILK )if (HAS_PCH_IBX (dev_priv->dev) &&intel_pipe_has_type (crtc,INTEL_OUTPUT_SDVO )) val |=TRANS_LEGACY_INTERLACED_ILK ;
Signature · 1 line
1.7.11.4