aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2014-06-25 15:01:51 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-07-10 16:05:24 -0400
commit082717ead9f5836fac1b2757aad38f652cc63636 (patch)
treee1fb947b22338b0ecdbe131dea29b39207aa865d
parent97b040aa391651793e4d463408c137b81517cc90 (diff)
drm/i915: Move the SPLL enabling into hsw_crt_pre_enable
The call to intel_ddi_pll_enable in haswell_crtc_mode_set is the only function that still touches the hardware state from the crtc mode_set callback on hsw. Since the SPLL isn't ever shared we can easily take it out into the hsw crt encoder functions. Temporarily we'll loose a bit of WARN_ON coverage with this, but once the WRPLLs are switched over that will be restored. For the SPLL selection add a WARN in the hsw fdi link training code. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> [imre: rebased on patchset version w/o pch/crt/fdi refactoring] Signed-off-by: Imre Deak <imre.deak@intel.com> Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--drivers/gpu/drm/i915/intel_crt.c13
-rw-r--r--drivers/gpu/drm/i915/intel_ddi.c19
2 files changed, 14 insertions, 18 deletions
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index 5a045d3bd77e..d312cf89c00a 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -137,6 +137,18 @@ static void hsw_crt_get_config(struct intel_encoder *encoder,
137 pipe_config->adjusted_mode.flags |= intel_crt_get_flags(encoder); 137 pipe_config->adjusted_mode.flags |= intel_crt_get_flags(encoder);
138} 138}
139 139
140static void hsw_crt_pre_enable(struct intel_encoder *encoder)
141{
142 struct drm_device *dev = encoder->base.dev;
143 struct drm_i915_private *dev_priv = dev->dev_private;
144
145 WARN(I915_READ(SPLL_CTL) & SPLL_PLL_ENABLE, "SPLL already enabled\n");
146 I915_WRITE(SPLL_CTL,
147 SPLL_PLL_ENABLE | SPLL_PLL_FREQ_1350MHz | SPLL_PLL_SSC);
148 POSTING_READ(SPLL_CTL);
149 udelay(20);
150}
151
140/* Note: The caller is required to filter out dpms modes not supported by the 152/* Note: The caller is required to filter out dpms modes not supported by the
141 * platform. */ 153 * platform. */
142static void intel_crt_set_dpms(struct intel_encoder *encoder, int mode) 154static void intel_crt_set_dpms(struct intel_encoder *encoder, int mode)
@@ -860,6 +872,7 @@ void intel_crt_init(struct drm_device *dev)
860 if (HAS_DDI(dev)) { 872 if (HAS_DDI(dev)) {
861 crt->base.get_config = hsw_crt_get_config; 873 crt->base.get_config = hsw_crt_get_config;
862 crt->base.get_hw_state = intel_ddi_get_hw_state; 874 crt->base.get_hw_state = intel_ddi_get_hw_state;
875 crt->base.pre_enable = hsw_crt_pre_enable;
863 } else { 876 } else {
864 crt->base.get_config = intel_crt_get_config; 877 crt->base.get_config = intel_crt_get_config;
865 crt->base.get_hw_state = intel_crt_get_hw_state; 878 crt->base.get_hw_state = intel_crt_get_hw_state;
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 8c57f9a141db..991ad0b9859c 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -278,6 +278,7 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)
278 278
279 /* Configure Port Clock Select */ 279 /* Configure Port Clock Select */
280 I915_WRITE(PORT_CLK_SEL(PORT_E), intel_crtc->ddi_pll_sel); 280 I915_WRITE(PORT_CLK_SEL(PORT_E), intel_crtc->ddi_pll_sel);
281 WARN_ON(intel_crtc->ddi_pll_sel != PORT_CLK_SEL_SPLL);
281 282
282 /* Start the training iterating through available voltages and emphasis, 283 /* Start the training iterating through available voltages and emphasis,
283 * testing each value twice. */ 284 * testing each value twice. */
@@ -848,23 +849,6 @@ void intel_ddi_pll_enable(struct intel_crtc *crtc)
848 BUILD_BUG_ON(enable_bit != WRPLL_PLL_ENABLE); 849 BUILD_BUG_ON(enable_bit != WRPLL_PLL_ENABLE);
849 850
850 switch (crtc->ddi_pll_sel) { 851 switch (crtc->ddi_pll_sel) {
851 case PORT_CLK_SEL_LCPLL_2700:
852 case PORT_CLK_SEL_LCPLL_1350:
853 case PORT_CLK_SEL_LCPLL_810:
854 /*
855 * LCPLL should always be enabled at this point of the mode set
856 * sequence, so nothing to do.
857 */
858 return;
859
860 case PORT_CLK_SEL_SPLL:
861 new_val = SPLL_PLL_ENABLE | SPLL_PLL_FREQ_1350MHz |
862 SPLL_PLL_SSC;
863 WARN(I915_READ(SPLL_CTL) & enable_bit, "SPLL already enabled\n");
864 I915_WRITE(SPLL_CTL, new_val);
865 POSTING_READ(SPLL_CTL);
866 udelay(20);
867 return;
868 case PORT_CLK_SEL_WRPLL1: 852 case PORT_CLK_SEL_WRPLL1:
869 case PORT_CLK_SEL_WRPLL2: 853 case PORT_CLK_SEL_WRPLL2:
870 if (crtc->ddi_pll_sel == PORT_CLK_SEL_WRPLL1) { 854 if (crtc->ddi_pll_sel == PORT_CLK_SEL_WRPLL1) {
@@ -889,7 +873,6 @@ void intel_ddi_pll_enable(struct intel_crtc *crtc)
889 WARN(1, "Bad selected pll: PORT_CLK_SEL_NONE\n"); 873 WARN(1, "Bad selected pll: PORT_CLK_SEL_NONE\n");
890 return; 874 return;
891 default: 875 default:
892 WARN(1, "Bad selected pll: 0x%08x\n", crtc->ddi_pll_sel);
893 return; 876 return;
894 } 877 }
895 878