From patchwork Fri May 10 19:35:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Barnes X-Patchwork-Id: 2552161 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id B3A60DF2A2 for ; Fri, 10 May 2013 20:14:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9D385E64EB for ; Fri, 10 May 2013 13:14:02 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from oproxy14-pub.unifiedlayer.com (oproxy14-pub.unifiedlayer.com [67.222.51.224]) by gabe.freedesktop.org (Postfix) with SMTP id 323B1E64F5 for ; Fri, 10 May 2013 13:12:38 -0700 (PDT) Received: (qmail 4249 invoked by uid 0); 10 May 2013 19:35:42 -0000 Received: from unknown (HELO box514.bluehost.com) (74.220.219.114) by oproxy14.unifiedlayer.com with SMTP; 10 May 2013 19:35:42 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuousgeek.org; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:To:From; bh=7XcqHeHqAcsabMxKj4FHO0teqfqsKaNQUvZYnq0zY88=; b=bFlAV3n3KtrVJUEpCUzcMnRDYFmNSpcylbwwdKfETQaGQQYqJlr85OpEVKuLW9SkCm/ZVrSaqe3OwWMw5TerjeklQhjuAzfGM3+XXjdTwTT8D/w7nAvNLX8SsJZMJFza; Received: from [67.161.37.189] (port=58707 helo=localhost.localdomain) by box514.bluehost.com with esmtpsa (TLSv1:CAMELLIA256-SHA:256) (Exim 4.80) (envelope-from ) id 1Uat6U-0003L4-Fl for intel-gfx@lists.freedesktop.org; Fri, 10 May 2013 13:35:42 -0600 From: Jesse Barnes To: intel-gfx@lists.freedesktop.org Date: Fri, 10 May 2013 12:35:41 -0700 Message-Id: <1368214541-2182-1-git-send-email-jbarnes@virtuousgeek.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1368212722-2448-1-git-send-email-jbarnes@virtuousgeek.org> References: <1368212722-2448-1-git-send-email-jbarnes@virtuousgeek.org> X-Identified-User: {10642:box514.bluehost.com:virtuous:virtuousgeek.org} {sentby:smtp auth 67.161.37.189 authed with jbarnes@virtuousgeek.org} Subject: [Intel-gfx] [PATCH] drm/i915: fetch PCH PLL state at init time v2 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org We need to properly track PCH PLL sharing configs, and generally set up PCH PLL state at init time as part of the state readout process. v2: update to new code, use intel_crtc instead (Jesse) I-told-you-so-by: Daniel Vetter Signed-off-by: Jesse Barnes --- drivers/gpu/drm/i915/intel_display.c | 48 +++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index dda4501..2e7a5bb 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -6974,6 +6974,49 @@ static void i9xx_crtc_clock_get(struct intel_crtc *crtc, pipe_config->adjusted_mode.clock = clock.dot; } +static void ironlake_crtc_pll_get(struct intel_crtc *crtc) +{ + struct drm_device *dev = crtc->base.dev; + struct drm_i915_private *dev_priv = dev->dev_private; + u32 dpll_sel; + + if (HAS_PCH_IBX(dev_priv->dev)) + crtc->pch_pll = &dev_priv->pch_plls[crtc->pipe]; + + if (HAS_PCH_CPT(dev_priv->dev)) { + dpll_sel = I915_READ(PCH_DPLL_SEL); + + switch (crtc->pipe) { + case PIPE_A: + if ((dpll_sel & TRANSA_DPLL_ENABLE) && + (dpll_sel & TRANSA_DPLLB_SEL)) + crtc->pch_pll = &dev_priv->pch_plls[1]; + else if (dpll_sel & TRANSA_DPLL_ENABLE) + crtc->pch_pll = &dev_priv->pch_plls[0]; + break; + case PIPE_B: + if ((dpll_sel & TRANSB_DPLL_ENABLE) && + (dpll_sel & TRANSB_DPLLB_SEL)) + crtc->pch_pll = &dev_priv->pch_plls[1]; + else if (dpll_sel & TRANSB_DPLL_ENABLE) + crtc->pch_pll = &dev_priv->pch_plls[0]; + break; + case PIPE_C: + if ((dpll_sel & TRANSC_DPLL_ENABLE) && + (dpll_sel & TRANSC_DPLLB_SEL)) + crtc->pch_pll = &dev_priv->pch_plls[1]; + else if (dpll_sel & TRANSC_DPLL_ENABLE) + crtc->pch_pll = &dev_priv->pch_plls[0]; + break; + default: + BUG(); + } + } + + crtc->pch_pll->refcount++; + crtc->pch_pll->active = 1; +} + static void ironlake_crtc_clock_get(struct intel_crtc *crtc, struct intel_crtc_config *pipe_config) { @@ -7021,6 +7064,8 @@ static void ironlake_crtc_clock_get(struct intel_crtc *crtc, do_div(clock, link_n); pipe_config->adjusted_mode.clock = clock; + + ironlake_crtc_pll_get(crtc); } /** Returns the currently programmed mode of the given pipe. */ @@ -9611,7 +9656,8 @@ setup_pipes: if (crtc->active) { intel_pipe_config_to_crtc(crtc, &crtc->config); - DRM_DEBUG_KMS("[CRTC:%d] found active mode: "); + DRM_DEBUG_KMS("[CRTC:%d] found active mode: ", + crtc->base.base.id); drm_mode_debug_printmodeline(&crtc->base.mode); }