All of lore.kernel.org
 help / color / mirror / Atom feed
From: Durgadoss R <durgadoss.r@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 5/7] drm/i915/dp: Add methods to update link train params
Date: Fri, 11 Dec 2015 15:09:26 +0530	[thread overview]
Message-ID: <1449826768-19415-6-git-send-email-durgadoss.r@intel.com> (raw)
In-Reply-To: <1449826768-19415-1-git-send-email-durgadoss.r@intel.com>

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 <durgadoss.r@intel.com>
---
 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);
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2015-12-11  9:09 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-11  9:39 [PATCH 0/7] Add USB typeC based DP support for BXT platform Durgadoss R
2015-12-11  9:39 ` [PATCH 1/7] drm/i915/dp: Reuse encoder if it is already available Durgadoss R
2015-12-11  9:39 ` [PATCH 2/7] drm/i915/dp: Reuse shared DPLL if it exists already Durgadoss R
2015-12-11  9:39 ` [PATCH 3/7] drm/i915/dp: Abstract all get_ddi_pll methods Durgadoss R
2015-12-11  9:39 ` [PATCH 4/7] drm/i915/dp: Export enable/disable_shared_dpll methods Durgadoss R
2015-12-11  9:39 ` Durgadoss R [this message]
2016-01-11 14:36   ` [PATCH 5/7] drm/i915/dp: Add methods to update link train params Ander Conselvan De Oliveira
2016-01-12  6:35     ` R, Durgadoss
2015-12-11  9:39 ` [PATCH 6/7] drm/i915: Make finding unused crtc as a generic function Durgadoss R
2015-12-11  9:39 ` [PATCH 7/7] drm/i915/dp: Enable Upfront link training for typeC DP support on BXT Durgadoss R
2015-12-29 17:22   ` Ander Conselvan De Oliveira
2015-12-29 18:50     ` R, Durgadoss
2016-01-11 14:10       ` Ander Conselvan De Oliveira
2016-01-11 17:51         ` R, Durgadoss
2015-12-29 23:48   ` Dave Airlie
2016-01-04 18:39     ` Jim Bride
2016-01-11 15:15   ` Ander Conselvan De Oliveira
2016-01-11 17:53     ` R, Durgadoss
2016-01-12  9:37       ` Ander Conselvan De Oliveira

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1449826768-19415-6-git-send-email-durgadoss.r@intel.com \
    --to=durgadoss.r@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.