static void ibx_pch_dpll_disable(struct drm_i915_private *dev_priv, struct intel_shared_dpll *pll) { struct drm_device *dev = dev_priv->dev; struct intel_crtc *crtc; /* Make sure no transcoder isn't still depending on us. */ for_each_intel_crtc(dev, crtc) { if (crtc->config->shared_dpll == pll) assert_pch_transcoder_disabled(dev_priv, crtc->pipe); } I915_WRITE(PCH_DPLL(pll->id), 0); POSTING_READ(PCH_DPLL(pll->id)); udelay(200); }
static void ibx_pch_dpll_enable(struct drm_i915_private *dev_priv, struct intel_shared_dpll *pll) { /* PCH refclock must be enabled first */ ibx_assert_pch_refclk_enabled(dev_priv); I915_WRITE(PCH_DPLL(pll->id), pll->config.hw_state.dpll); /* Wait for the clocks to stabilize. */ POSTING_READ(PCH_DPLL(pll->id)); udelay(150); /* The pixel multiplier can only be updated once the * DPLL is enabled and the clocks are stable. * * So write it again. */ I915_WRITE(PCH_DPLL(pll->id), pll->config.hw_state.dpll); POSTING_READ(PCH_DPLL(pll->id)); udelay(200); }
/* For ILK+ */ static void assert_pch_pll(struct drm_i915_private *dev_priv, enum pipe pipe, bool state) { int reg; u32 val; bool cur_state; reg = PCH_DPLL(pipe); val = I915_READ(reg); cur_state = !!(val & DPLL_VCO_ENABLE); if (cur_state != state) fprintf(stderr, "PCH PLL state assertion failure (expected %s, current %s)\n", state_string(state), state_string(cur_state)); }
static bool i915_pipe_enabled(struct drm_device *dev, enum i915_pipe pipe) { struct drm_i915_private *dev_priv = dev->dev_private; u32 dpll_reg; /* On IVB, 3rd pipe shares PLL with another one */ if (pipe > 1) return false; if (HAS_PCH_SPLIT(dev)) dpll_reg = PCH_DPLL(pipe); else dpll_reg = (pipe == PIPE_A) ? _DPLL_A : _DPLL_B; return (I915_READ(dpll_reg) & DPLL_VCO_ENABLE); }
static bool ibx_pch_dpll_get_hw_state(struct drm_i915_private *dev_priv, struct intel_shared_dpll *pll, struct intel_dpll_hw_state *hw_state) { uint32_t val; if (!intel_display_power_get_if_enabled(dev_priv, POWER_DOMAIN_PLLS)) return false; val = I915_READ(PCH_DPLL(pll->id)); hw_state->dpll = val; hw_state->fp0 = I915_READ(PCH_FP0(pll->id)); hw_state->fp1 = I915_READ(PCH_FP1(pll->id)); intel_display_power_put(dev_priv, POWER_DOMAIN_PLLS); return val & DPLL_VCO_ENABLE; }
static void intel_disable_pch_pll(struct drm_i915_private *dev_priv, enum pipe pipe) { int reg; u32 val; /* PCH only available on ILK+ */ assert(dev_priv->info->gen < 5); /* Make sure transcoder isn't still depending on us */ assert_transcoder_disabled(dev_priv, pipe); reg = PCH_DPLL(pipe); val = I915_READ(reg); val &= ~DPLL_VCO_ENABLE; I915_WRITE(reg, val); POSTING_READ(reg); udelay(200); }
/** * intel_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 drm_i915_private *dev_priv, enum pipe pipe) { int reg; u32 val; /* PCH only available on ILK+ */ assert(dev_priv->info->gen < 5); /* PCH refclock must be enabled first */ assert_pch_refclk_enabled(dev_priv); reg = PCH_DPLL(pipe); val = I915_READ(reg); val |= DPLL_VCO_ENABLE; I915_WRITE(reg, val); POSTING_READ(reg); udelay(200); }