From patchwork Thu Oct 18 08:15:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 1609161 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 789AF3FE36 for ; Thu, 18 Oct 2012 09:42:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 64A859E880 for ; Thu, 18 Oct 2012 02:42:03 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-ee0-f49.google.com (mail-ee0-f49.google.com [74.125.83.49]) by gabe.freedesktop.org (Postfix) with ESMTP id 600559E9FF for ; Thu, 18 Oct 2012 01:15:42 -0700 (PDT) Received: by mail-ee0-f49.google.com with SMTP id c1so4333533eek.36 for ; Thu, 18 Oct 2012 01:15:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=EUBhxnDxV5hzmD+KWxqC0TDwHztvvX21XFK/UuSVQCo=; b=B8zPqdpheq0vO3CcROyj2KebrOg8z8yVJSOARDHMauZkByF2FT/rTIB5ynr5XlJ3gl BqUfAwcuroDK6VrjCaB7NG1Cx71WscNL4dWa/AuY2ZDAzZNE+lDUMvKVO+IjvOIprIpk rerS6XlPOAEtJRaZ/Tdwi/jplqvKRVQYn50mg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=EUBhxnDxV5hzmD+KWxqC0TDwHztvvX21XFK/UuSVQCo=; b=Yz2UaQqmaPOm7ynT2g0ymFt7VoD3/gOb7vl1er+8uSYyR0LnMygWzxwR+hf5n5jrjI rW6RoyfSkN/eJ84xn+hgI4yz5VT1KGGhI5/sUZ6qgaNHmm7FE8eqLGckyTyNRfK5/DfY b9Qa60jqPKEioHdLYhixPHaXPO1XlNyUOO1VrF3M7oWTIgzmsNFUxhYXAyitk1KPp0rA +Jn3XoC+uCr7VC8/OCNzoD3VJzhyfsEjlWFeG9+GI/TSTmyBAi10HTHshZggnqAjlX2c d87Mto0jcewsF5io4TNA/Rj5cxWifgOEgO7hKUaTNIjsGDxWR2KNIu4NB0cWUvhUvtIL r+6g== Received: by 10.14.213.201 with SMTP id a49mr30502430eep.4.1350548141934; Thu, 18 Oct 2012 01:15:41 -0700 (PDT) Received: from bremse.ffwll.local (178-83-130-250.dynamic.hispeed.ch. [178.83.130.250]) by mx.google.com with ESMTPS id 42sm38586341eee.0.2012.10.18.01.15.41 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 18 Oct 2012 01:15:41 -0700 (PDT) From: Daniel Vetter To: DRI Development Date: Thu, 18 Oct 2012 10:15:25 +0200 Message-Id: <1350548132-3037-4-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.7.11.4 In-Reply-To: <1350548132-3037-1-git-send-email-daniel.vetter@ffwll.ch> References: <1350548132-3037-1-git-send-email-daniel.vetter@ffwll.ch> X-Gm-Message-State: ALoCoQkMHIOKc+8eSaxRpIINbTb5LJ3OKAi+nG0PYZLLv4sE53lc42FPvmA2LbIGkmCHqUe/t4Z0 Cc: nouveau@lists.freedesktop.org, Intel Graphics Development , xorg-driver-ati@lists.x.org, Daniel Vetter Subject: [Intel-gfx] [PATCH 03/10] drm: dp helper: extract drm_dp_clock_recovery_ok 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 radeon and intel use the exact same definition. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/i915/intel_dp.c | 4 ++-- drivers/gpu/drm/radeon/atombios_dp.c | 25 +------------------------ include/drm/drm_dp_helper.h | 2 ++ 3 files changed, 5 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index d3f4db0..5a9ab3a 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -1845,7 +1845,7 @@ intel_dp_start_link_train(struct intel_dp *intel_dp) break; } - if (intel_clock_recovery_ok(link_status, intel_dp->lane_count)) { + if (drm_dp_clock_recovery_ok(link_status, intel_dp->lane_count)) { DRM_DEBUG_KMS("clock recovery OK\n"); clock_recovery = true; break; @@ -1932,7 +1932,7 @@ intel_dp_complete_link_train(struct intel_dp *intel_dp) break; /* Make sure clock is still ok */ - if (!intel_clock_recovery_ok(link_status, intel_dp->lane_count)) { + if (!drm_dp_clock_recovery_ok(link_status, intel_dp->lane_count)) { intel_dp_start_link_train(intel_dp); cr_tries++; continue; diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c index 8aa8187..75fdf34 100644 --- a/drivers/gpu/drm/radeon/atombios_dp.c +++ b/drivers/gpu/drm/radeon/atombios_dp.c @@ -294,29 +294,6 @@ static u8 dp_link_status(u8 link_status[DP_LINK_STATUS_SIZE], int r) return link_status[r - DP_LANE0_1_STATUS]; } -static u8 dp_get_lane_status(u8 link_status[DP_LINK_STATUS_SIZE], - int lane) -{ - int i = DP_LANE0_1_STATUS + (lane >> 1); - int s = (lane & 1) * 4; - u8 l = dp_link_status(link_status, i); - return (l >> s) & 0xf; -} - -static bool dp_clock_recovery_ok(u8 link_status[DP_LINK_STATUS_SIZE], - int lane_count) -{ - int lane; - u8 lane_status; - - for (lane = 0; lane < lane_count; lane++) { - lane_status = dp_get_lane_status(link_status, lane); - if ((lane_status & DP_LANE_CR_DONE) == 0) - return false; - } - return true; -} - static u8 dp_get_adjust_request_voltage(u8 link_status[DP_LINK_STATUS_SIZE], int lane) @@ -811,7 +788,7 @@ static int radeon_dp_link_train_cr(struct radeon_dp_link_train_info *dp_info) break; } - if (dp_clock_recovery_ok(dp_info->link_status, dp_info->dp_lane_count)) { + if (drm_dp_clock_recovery_ok(dp_info->link_status, dp_info->dp_lane_count)) { clock_recovery = true; break; } diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index 9e10420..89e92c9 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -326,5 +326,7 @@ i2c_dp_aux_add_bus(struct i2c_adapter *adapter); #define DP_LINK_STATUS_SIZE 6 bool drm_dp_channel_eq_ok(u8 link_status[DP_LINK_STATUS_SIZE], int lane_count); +bool drm_dp_clock_recovery_ok(u8 link_status[DP_LINK_STATUS_SIZE], + int lane_count); #endif /* _DRM_DP_HELPER_H_ */