From patchwork Tue Feb 19 21:31:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Barnes X-Patchwork-Id: 2165291 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id EEB183FCF6 for ; Tue, 19 Feb 2013 21:40:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CAA4BE668E for ; Tue, 19 Feb 2013 13:40:26 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from oproxy6-pub.bluehost.com (oproxy6-pub.bluehost.com [67.222.54.6]) by gabe.freedesktop.org (Postfix) with SMTP id 06789E669B for ; Tue, 19 Feb 2013 13:37:50 -0800 (PST) Received: (qmail 31226 invoked by uid 0); 19 Feb 2013 21:37:50 -0000 Received: from unknown (HELO box514.bluehost.com) (74.220.219.114) by cpoproxy3.bluehost.com with SMTP; 19 Feb 2013 21:37:50 -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=6KE2cfbelpO/5V/2Wb8Cty3hbg+/Fc5JxaXnd0TJkJA=; b=Rm+hgr8H2Sm64chu6FkECqe0Vau+Yb1ztqNljDMkK/S2Ax1zU2aoXS70y4iWyu/g+umCxYpTJdhfaHf/8hFU9vkv1TGB82DWSoDhqr9+0S8Bh1ZiFNJA6wr7B8WT9/om; Received: from [67.161.37.189] (port=56006 helo=localhost.localdomain) by box514.bluehost.com with esmtpsa (TLSv1:CAMELLIA256-SHA:256) (Exim 4.80) (envelope-from ) id 1U7un3-0004Pz-S7 for intel-gfx@lists.freedesktop.org; Tue, 19 Feb 2013 14:31:53 -0700 From: Jesse Barnes To: intel-gfx@lists.freedesktop.org Date: Tue, 19 Feb 2013 13:31:46 -0800 Message-Id: <1361309508-4901-12-git-send-email-jbarnes@virtuousgeek.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1361309508-4901-1-git-send-email-jbarnes@virtuousgeek.org> References: <1361309508-4901-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 11/13] drm/i915: add clock_get for ironlake+ 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 Turns out it's easy to get the clock, though it may correspond to a potential pfit mode. In that case, we may still be able to flip if we can get the native mode params somehow. Signed-off-by: Jesse Barnes --- drivers/gpu/drm/i915/intel_display.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 91660b1..861af1a 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -6771,6 +6771,27 @@ static bool i9xx_crtc_get_mode(struct drm_crtc *crtc, return true; } +static int ironlake_crtc_clock_get(struct drm_crtc *crtc) +{ + struct drm_i915_private *dev_priv = crtc->dev->dev_private; + struct intel_crtc *intel_crtc = to_intel_crtc(crtc); + enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder; + int clock; + u32 link_m; + + /* + * PCH platforms make this easy: we can just use the LINK_M1 reg. + * Note: this may be the pixel clock for a fitted mode, in which + * case it won't match the native mode clock. That means we won't be + * able to do a simple flip in the fastboot case. + */ + link_m = I915_READ(PIPE_LINK_M1(cpu_transcoder)); + + clock = link_m; + + return clock; +} + static bool ironlake_crtc_get_mode(struct drm_crtc *crtc, struct drm_display_mode *mode) { @@ -6797,12 +6818,11 @@ static bool ironlake_crtc_get_mode(struct drm_crtc *crtc, mode->vsync_start = (tmp & 0xffff) + 1; mode->vsync_end = ((tmp & 0xffff0000) >> 16) + 1; - //mode->clock = i9xx_crtc_clock_get(crtc); - //mode->clock = 69300; + mode->clock = ironlake_crtc_clock_get(crtc); drm_mode_set_name(mode); - return false; /* XXX mode->clock unset */ + return true; } static __maybe_unused bool no_crtc_get_mode(struct drm_crtc *crtc,