From patchwork Fri Dec 11 09:39:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: durgadoss.r@intel.com X-Patchwork-Id: 7827581 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 97978BEEE1 for ; Fri, 11 Dec 2015 09:09:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B3D63204C9 for ; Fri, 11 Dec 2015 09:09:29 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id A6680204AF for ; Fri, 11 Dec 2015 09:09:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0DC0B6EB26; Fri, 11 Dec 2015 01:09:28 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTP id 247EE6EB19 for ; Fri, 11 Dec 2015 01:09:21 -0800 (PST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP; 11 Dec 2015 01:08:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,412,1444719600"; d="scan'208";a="858685221" Received: from dr3-desktop.iind.intel.com ([10.223.26.125]) by fmsmga001.fm.intel.com with ESMTP; 11 Dec 2015 01:08:20 -0800 From: Durgadoss R To: intel-gfx@lists.freedesktop.org Date: Fri, 11 Dec 2015 15:09:26 +0530 Message-Id: <1449826768-19415-6-git-send-email-durgadoss.r@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1449826768-19415-1-git-send-email-durgadoss.r@intel.com> References: <1449826768-19415-1-git-send-email-durgadoss.r@intel.com> Subject: [Intel-gfx] [PATCH 5/7] drm/i915/dp: Add methods to update link train params X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Retrying with reduced lanes/bw and updating the final available lanes/bw to DPCD is needed for upfront link train logic. Hence, this patch adds these methods and exports them so that these can be called from other files like ddi.c/display.c. Signed-off-by: Durgadoss R --- drivers/gpu/drm/i915/intel_dp.c | 34 ++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 2 ++ 2 files changed, 36 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index f335c92..d8f7830 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -1660,6 +1660,40 @@ void intel_dp_set_link_params(struct intel_dp *intel_dp, intel_dp->lane_count = pipe_config->lane_count; } +void intel_dp_update_dpcd_params(struct intel_dp *intel_dp) +{ + intel_dp->dpcd[DP_MAX_LANE_COUNT] &= ~DP_MAX_LANE_COUNT_MASK; + intel_dp->dpcd[DP_MAX_LANE_COUNT] |= + intel_dp->lane_count & DP_MAX_LANE_COUNT_MASK; + + intel_dp->dpcd[DP_MAX_LINK_RATE] = + drm_dp_link_rate_to_bw_code(intel_dp->link_rate); +} + +bool intel_dp_get_link_retry_params(uint8_t *lane_count, uint8_t *link_bw) +{ + /* + * As per DP1.3 Spec, retry all link rates for a particular + * lane count value, before reducing number of lanes. + */ + if (*link_bw == DP_LINK_BW_5_4) { + *link_bw = DP_LINK_BW_2_7; + } else if (*link_bw == DP_LINK_BW_2_7) { + *link_bw = DP_LINK_BW_1_62; + } else if (*lane_count == 4) { + *lane_count = 2; + *link_bw = DP_LINK_BW_5_4; + } else if (*lane_count == 2) { + *lane_count = 1; + *link_bw = DP_LINK_BW_5_4; + } else { + /* Tried all combinations, so exit */ + return false; + } + + return true; +} + static void intel_dp_prepare(struct intel_encoder *encoder) { struct drm_device *dev = encoder->base.dev; diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index faa91fc..5cefb0e 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -1233,6 +1233,8 @@ bool intel_dp_init_connector(struct intel_digital_port *intel_dig_port, struct intel_connector *intel_connector); void intel_dp_set_link_params(struct intel_dp *intel_dp, const struct intel_crtc_state *pipe_config); +void intel_dp_update_dpcd_params(struct intel_dp *intel_dp); +bool intel_dp_get_link_retry_params(uint8_t *lane_count, uint8_t *link_bw); void intel_dp_start_link_train(struct intel_dp *intel_dp); void intel_dp_stop_link_train(struct intel_dp *intel_dp); void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode);