|
@@ -1530,45 +1530,47 @@ static void assert_pch_ports_disabled(struct drm_i915_private *dev_priv,
|
|
assert_pch_hdmi_disabled(dev_priv, pipe, PCH_HDMID);
|
|
assert_pch_hdmi_disabled(dev_priv, pipe, PCH_HDMID);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static void _vlv_enable_pll(struct intel_crtc *crtc,
|
|
|
|
+ const struct intel_crtc_state *pipe_config)
|
|
|
|
+{
|
|
|
|
+ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
|
|
|
|
+ enum pipe pipe = crtc->pipe;
|
|
|
|
+
|
|
|
|
+ I915_WRITE(DPLL(pipe), pipe_config->dpll_hw_state.dpll);
|
|
|
|
+ POSTING_READ(DPLL(pipe));
|
|
|
|
+ udelay(150);
|
|
|
|
+
|
|
|
|
+ if (wait_for(((I915_READ(DPLL(pipe)) & DPLL_LOCK_VLV) == DPLL_LOCK_VLV), 1))
|
|
|
|
+ DRM_ERROR("DPLL %d failed to lock\n", pipe);
|
|
|
|
+}
|
|
|
|
+
|
|
static void vlv_enable_pll(struct intel_crtc *crtc,
|
|
static void vlv_enable_pll(struct intel_crtc *crtc,
|
|
const struct intel_crtc_state *pipe_config)
|
|
const struct intel_crtc_state *pipe_config)
|
|
{
|
|
{
|
|
- struct drm_device *dev = crtc->base.dev;
|
|
|
|
- struct drm_i915_private *dev_priv = dev->dev_private;
|
|
|
|
|
|
+ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
|
|
enum pipe pipe = crtc->pipe;
|
|
enum pipe pipe = crtc->pipe;
|
|
- i915_reg_t reg = DPLL(pipe);
|
|
|
|
- u32 dpll = pipe_config->dpll_hw_state.dpll;
|
|
|
|
|
|
|
|
assert_pipe_disabled(dev_priv, pipe);
|
|
assert_pipe_disabled(dev_priv, pipe);
|
|
|
|
|
|
/* PLL is protected by panel, make sure we can write it */
|
|
/* PLL is protected by panel, make sure we can write it */
|
|
assert_panel_unlocked(dev_priv, pipe);
|
|
assert_panel_unlocked(dev_priv, pipe);
|
|
|
|
|
|
- I915_WRITE(reg, dpll);
|
|
|
|
- POSTING_READ(reg);
|
|
|
|
- udelay(150);
|
|
|
|
-
|
|
|
|
- if (wait_for(((I915_READ(reg) & DPLL_LOCK_VLV) == DPLL_LOCK_VLV), 1))
|
|
|
|
- DRM_ERROR("DPLL %d failed to lock\n", pipe);
|
|
|
|
|
|
+ if (pipe_config->dpll_hw_state.dpll & DPLL_VCO_ENABLE)
|
|
|
|
+ _vlv_enable_pll(crtc, pipe_config);
|
|
|
|
|
|
I915_WRITE(DPLL_MD(pipe), pipe_config->dpll_hw_state.dpll_md);
|
|
I915_WRITE(DPLL_MD(pipe), pipe_config->dpll_hw_state.dpll_md);
|
|
POSTING_READ(DPLL_MD(pipe));
|
|
POSTING_READ(DPLL_MD(pipe));
|
|
}
|
|
}
|
|
|
|
|
|
-static void chv_enable_pll(struct intel_crtc *crtc,
|
|
|
|
- const struct intel_crtc_state *pipe_config)
|
|
|
|
|
|
+
|
|
|
|
+static void _chv_enable_pll(struct intel_crtc *crtc,
|
|
|
|
+ const struct intel_crtc_state *pipe_config)
|
|
{
|
|
{
|
|
- struct drm_device *dev = crtc->base.dev;
|
|
|
|
- struct drm_i915_private *dev_priv = dev->dev_private;
|
|
|
|
|
|
+ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
|
|
enum pipe pipe = crtc->pipe;
|
|
enum pipe pipe = crtc->pipe;
|
|
enum dpio_channel port = vlv_pipe_to_channel(pipe);
|
|
enum dpio_channel port = vlv_pipe_to_channel(pipe);
|
|
u32 tmp;
|
|
u32 tmp;
|
|
|
|
|
|
- assert_pipe_disabled(dev_priv, pipe);
|
|
|
|
-
|
|
|
|
- /* PLL is protected by panel, make sure we can write it */
|
|
|
|
- assert_panel_unlocked(dev_priv, pipe);
|
|
|
|
-
|
|
|
|
mutex_lock(&dev_priv->sb_lock);
|
|
mutex_lock(&dev_priv->sb_lock);
|
|
|
|
|
|
/* Enable back the 10bit clock to display controller */
|
|
/* Enable back the 10bit clock to display controller */
|
|
@@ -1589,6 +1591,21 @@ static void chv_enable_pll(struct intel_crtc *crtc,
|
|
/* Check PLL is locked */
|
|
/* Check PLL is locked */
|
|
if (wait_for(((I915_READ(DPLL(pipe)) & DPLL_LOCK_VLV) == DPLL_LOCK_VLV), 1))
|
|
if (wait_for(((I915_READ(DPLL(pipe)) & DPLL_LOCK_VLV) == DPLL_LOCK_VLV), 1))
|
|
DRM_ERROR("PLL %d failed to lock\n", pipe);
|
|
DRM_ERROR("PLL %d failed to lock\n", pipe);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static void chv_enable_pll(struct intel_crtc *crtc,
|
|
|
|
+ const struct intel_crtc_state *pipe_config)
|
|
|
|
+{
|
|
|
|
+ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
|
|
|
|
+ enum pipe pipe = crtc->pipe;
|
|
|
|
+
|
|
|
|
+ assert_pipe_disabled(dev_priv, pipe);
|
|
|
|
+
|
|
|
|
+ /* PLL is protected by panel, make sure we can write it */
|
|
|
|
+ assert_panel_unlocked(dev_priv, pipe);
|
|
|
|
+
|
|
|
|
+ if (pipe_config->dpll_hw_state.dpll & DPLL_VCO_ENABLE)
|
|
|
|
+ _chv_enable_pll(crtc, pipe_config);
|
|
|
|
|
|
if (pipe != PIPE_A) {
|
|
if (pipe != PIPE_A) {
|
|
/*
|
|
/*
|
|
@@ -6079,14 +6096,12 @@ static void valleyview_crtc_enable(struct drm_crtc *crtc)
|
|
if (encoder->pre_pll_enable)
|
|
if (encoder->pre_pll_enable)
|
|
encoder->pre_pll_enable(encoder);
|
|
encoder->pre_pll_enable(encoder);
|
|
|
|
|
|
- if (!intel_crtc->config->has_dsi_encoder) {
|
|
|
|
- if (IS_CHERRYVIEW(dev)) {
|
|
|
|
- chv_prepare_pll(intel_crtc, intel_crtc->config);
|
|
|
|
- chv_enable_pll(intel_crtc, intel_crtc->config);
|
|
|
|
- } else {
|
|
|
|
- vlv_prepare_pll(intel_crtc, intel_crtc->config);
|
|
|
|
- vlv_enable_pll(intel_crtc, intel_crtc->config);
|
|
|
|
- }
|
|
|
|
|
|
+ if (IS_CHERRYVIEW(dev)) {
|
|
|
|
+ chv_prepare_pll(intel_crtc, intel_crtc->config);
|
|
|
|
+ chv_enable_pll(intel_crtc, intel_crtc->config);
|
|
|
|
+ } else {
|
|
|
|
+ vlv_prepare_pll(intel_crtc, intel_crtc->config);
|
|
|
|
+ vlv_enable_pll(intel_crtc, intel_crtc->config);
|
|
}
|
|
}
|
|
|
|
|
|
for_each_encoder_on_crtc(dev, crtc, encoder)
|
|
for_each_encoder_on_crtc(dev, crtc, encoder)
|
|
@@ -6124,7 +6139,7 @@ static void i9xx_crtc_enable(struct drm_crtc *crtc)
|
|
struct intel_encoder *encoder;
|
|
struct intel_encoder *encoder;
|
|
struct intel_crtc_state *pipe_config =
|
|
struct intel_crtc_state *pipe_config =
|
|
to_intel_crtc_state(crtc->state);
|
|
to_intel_crtc_state(crtc->state);
|
|
- int pipe = intel_crtc->pipe;
|
|
|
|
|
|
+ enum pipe pipe = intel_crtc->pipe;
|
|
|
|
|
|
if (WARN_ON(intel_crtc->active))
|
|
if (WARN_ON(intel_crtc->active))
|
|
return;
|
|
return;
|
|
@@ -7180,11 +7195,15 @@ static void vlv_compute_dpll(struct intel_crtc *crtc,
|
|
struct intel_crtc_state *pipe_config)
|
|
struct intel_crtc_state *pipe_config)
|
|
{
|
|
{
|
|
pipe_config->dpll_hw_state.dpll = DPLL_INTEGRATED_REF_CLK_VLV |
|
|
pipe_config->dpll_hw_state.dpll = DPLL_INTEGRATED_REF_CLK_VLV |
|
|
- DPLL_REF_CLK_ENABLE_VLV | DPLL_VGA_MODE_DIS |
|
|
|
|
- DPLL_VCO_ENABLE | DPLL_EXT_BUFFER_ENABLE_VLV;
|
|
|
|
|
|
+ DPLL_REF_CLK_ENABLE_VLV | DPLL_VGA_MODE_DIS;
|
|
if (crtc->pipe != PIPE_A)
|
|
if (crtc->pipe != PIPE_A)
|
|
pipe_config->dpll_hw_state.dpll |= DPLL_INTEGRATED_CRI_CLK_VLV;
|
|
pipe_config->dpll_hw_state.dpll |= DPLL_INTEGRATED_CRI_CLK_VLV;
|
|
|
|
|
|
|
|
+ /* DPLL not used with DSI, but still need the rest set up */
|
|
|
|
+ if (!intel_pipe_will_have_type(pipe_config, INTEL_OUTPUT_DSI))
|
|
|
|
+ pipe_config->dpll_hw_state.dpll |= DPLL_VCO_ENABLE |
|
|
|
|
+ DPLL_EXT_BUFFER_ENABLE_VLV;
|
|
|
|
+
|
|
pipe_config->dpll_hw_state.dpll_md =
|
|
pipe_config->dpll_hw_state.dpll_md =
|
|
(pipe_config->pixel_multiplier - 1) << DPLL_MD_UDI_MULTIPLIER_SHIFT;
|
|
(pipe_config->pixel_multiplier - 1) << DPLL_MD_UDI_MULTIPLIER_SHIFT;
|
|
}
|
|
}
|
|
@@ -7193,11 +7212,14 @@ static void chv_compute_dpll(struct intel_crtc *crtc,
|
|
struct intel_crtc_state *pipe_config)
|
|
struct intel_crtc_state *pipe_config)
|
|
{
|
|
{
|
|
pipe_config->dpll_hw_state.dpll = DPLL_SSC_REF_CLK_CHV |
|
|
pipe_config->dpll_hw_state.dpll = DPLL_SSC_REF_CLK_CHV |
|
|
- DPLL_REF_CLK_ENABLE_VLV | DPLL_VGA_MODE_DIS |
|
|
|
|
- DPLL_VCO_ENABLE;
|
|
|
|
|
|
+ DPLL_REF_CLK_ENABLE_VLV | DPLL_VGA_MODE_DIS;
|
|
if (crtc->pipe != PIPE_A)
|
|
if (crtc->pipe != PIPE_A)
|
|
pipe_config->dpll_hw_state.dpll |= DPLL_INTEGRATED_CRI_CLK_VLV;
|
|
pipe_config->dpll_hw_state.dpll |= DPLL_INTEGRATED_CRI_CLK_VLV;
|
|
|
|
|
|
|
|
+ /* DPLL not used with DSI, but still need the rest set up */
|
|
|
|
+ if (!intel_pipe_will_have_type(pipe_config, INTEL_OUTPUT_DSI))
|
|
|
|
+ pipe_config->dpll_hw_state.dpll |= DPLL_VCO_ENABLE;
|
|
|
|
+
|
|
pipe_config->dpll_hw_state.dpll_md =
|
|
pipe_config->dpll_hw_state.dpll_md =
|
|
(pipe_config->pixel_multiplier - 1) << DPLL_MD_UDI_MULTIPLIER_SHIFT;
|
|
(pipe_config->pixel_multiplier - 1) << DPLL_MD_UDI_MULTIPLIER_SHIFT;
|
|
}
|
|
}
|
|
@@ -7207,11 +7229,20 @@ static void vlv_prepare_pll(struct intel_crtc *crtc,
|
|
{
|
|
{
|
|
struct drm_device *dev = crtc->base.dev;
|
|
struct drm_device *dev = crtc->base.dev;
|
|
struct drm_i915_private *dev_priv = dev->dev_private;
|
|
struct drm_i915_private *dev_priv = dev->dev_private;
|
|
- int pipe = crtc->pipe;
|
|
|
|
|
|
+ enum pipe pipe = crtc->pipe;
|
|
u32 mdiv;
|
|
u32 mdiv;
|
|
u32 bestn, bestm1, bestm2, bestp1, bestp2;
|
|
u32 bestn, bestm1, bestm2, bestp1, bestp2;
|
|
u32 coreclk, reg_val;
|
|
u32 coreclk, reg_val;
|
|
|
|
|
|
|
|
+ /* Enable Refclk */
|
|
|
|
+ I915_WRITE(DPLL(pipe),
|
|
|
|
+ pipe_config->dpll_hw_state.dpll &
|
|
|
|
+ ~(DPLL_VCO_ENABLE | DPLL_EXT_BUFFER_ENABLE_VLV));
|
|
|
|
+
|
|
|
|
+ /* No need to actually set up the DPLL with DSI */
|
|
|
|
+ if ((pipe_config->dpll_hw_state.dpll & DPLL_VCO_ENABLE) == 0)
|
|
|
|
+ return;
|
|
|
|
+
|
|
mutex_lock(&dev_priv->sb_lock);
|
|
mutex_lock(&dev_priv->sb_lock);
|
|
|
|
|
|
bestn = pipe_config->dpll.n;
|
|
bestn = pipe_config->dpll.n;
|
|
@@ -7298,14 +7329,21 @@ static void chv_prepare_pll(struct intel_crtc *crtc,
|
|
{
|
|
{
|
|
struct drm_device *dev = crtc->base.dev;
|
|
struct drm_device *dev = crtc->base.dev;
|
|
struct drm_i915_private *dev_priv = dev->dev_private;
|
|
struct drm_i915_private *dev_priv = dev->dev_private;
|
|
- int pipe = crtc->pipe;
|
|
|
|
- i915_reg_t dpll_reg = DPLL(crtc->pipe);
|
|
|
|
|
|
+ enum pipe pipe = crtc->pipe;
|
|
enum dpio_channel port = vlv_pipe_to_channel(pipe);
|
|
enum dpio_channel port = vlv_pipe_to_channel(pipe);
|
|
u32 loopfilter, tribuf_calcntr;
|
|
u32 loopfilter, tribuf_calcntr;
|
|
u32 bestn, bestm1, bestm2, bestp1, bestp2, bestm2_frac;
|
|
u32 bestn, bestm1, bestm2, bestp1, bestp2, bestm2_frac;
|
|
u32 dpio_val;
|
|
u32 dpio_val;
|
|
int vco;
|
|
int vco;
|
|
|
|
|
|
|
|
+ /* Enable Refclk and SSC */
|
|
|
|
+ I915_WRITE(DPLL(pipe),
|
|
|
|
+ pipe_config->dpll_hw_state.dpll & ~DPLL_VCO_ENABLE);
|
|
|
|
+
|
|
|
|
+ /* No need to actually set up the DPLL with DSI */
|
|
|
|
+ if ((pipe_config->dpll_hw_state.dpll & DPLL_VCO_ENABLE) == 0)
|
|
|
|
+ return;
|
|
|
|
+
|
|
bestn = pipe_config->dpll.n;
|
|
bestn = pipe_config->dpll.n;
|
|
bestm2_frac = pipe_config->dpll.m2 & 0x3fffff;
|
|
bestm2_frac = pipe_config->dpll.m2 & 0x3fffff;
|
|
bestm1 = pipe_config->dpll.m1;
|
|
bestm1 = pipe_config->dpll.m1;
|
|
@@ -7316,12 +7354,6 @@ static void chv_prepare_pll(struct intel_crtc *crtc,
|
|
dpio_val = 0;
|
|
dpio_val = 0;
|
|
loopfilter = 0;
|
|
loopfilter = 0;
|
|
|
|
|
|
- /*
|
|
|
|
- * Enable Refclk and SSC
|
|
|
|
- */
|
|
|
|
- I915_WRITE(dpll_reg,
|
|
|
|
- pipe_config->dpll_hw_state.dpll & ~DPLL_VCO_ENABLE);
|
|
|
|
-
|
|
|
|
mutex_lock(&dev_priv->sb_lock);
|
|
mutex_lock(&dev_priv->sb_lock);
|
|
|
|
|
|
/* p1 and p2 divider */
|
|
/* p1 and p2 divider */
|
|
@@ -7936,9 +7968,6 @@ static int chv_crtc_compute_clock(struct intel_crtc *crtc,
|
|
memset(&crtc_state->dpll_hw_state, 0,
|
|
memset(&crtc_state->dpll_hw_state, 0,
|
|
sizeof(crtc_state->dpll_hw_state));
|
|
sizeof(crtc_state->dpll_hw_state));
|
|
|
|
|
|
- if (crtc_state->has_dsi_encoder)
|
|
|
|
- return 0;
|
|
|
|
-
|
|
|
|
if (!crtc_state->clock_set &&
|
|
if (!crtc_state->clock_set &&
|
|
!chv_find_best_dpll(limit, crtc_state, crtc_state->port_clock,
|
|
!chv_find_best_dpll(limit, crtc_state, crtc_state->port_clock,
|
|
refclk, NULL, &crtc_state->dpll)) {
|
|
refclk, NULL, &crtc_state->dpll)) {
|
|
@@ -7960,9 +7989,6 @@ static int vlv_crtc_compute_clock(struct intel_crtc *crtc,
|
|
memset(&crtc_state->dpll_hw_state, 0,
|
|
memset(&crtc_state->dpll_hw_state, 0,
|
|
sizeof(crtc_state->dpll_hw_state));
|
|
sizeof(crtc_state->dpll_hw_state));
|
|
|
|
|
|
- if (crtc_state->has_dsi_encoder)
|
|
|
|
- return 0;
|
|
|
|
-
|
|
|
|
if (!crtc_state->clock_set &&
|
|
if (!crtc_state->clock_set &&
|
|
!vlv_find_best_dpll(limit, crtc_state, crtc_state->port_clock,
|
|
!vlv_find_best_dpll(limit, crtc_state, crtc_state->port_clock,
|
|
refclk, NULL, &crtc_state->dpll)) {
|
|
refclk, NULL, &crtc_state->dpll)) {
|