devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Damian Kos <dkos@cadence.com>
To: "David Airlie" <airlied@linux.ie>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Mark Rutland" <mark.rutland@arm.com>,
	"Archit Taneja" <architt@codeaurora.org>,
	"Andrzej Hajda" <a.hajda@samsung.com>,
	"Laurent Pinchart" <Laurent.pinchart@ideasonboard.com>,
	"Gustavo Padovan" <gustavo@padovan.org>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Sean Paul" <sean@poorly.run>, "Sandy Huang" <hjc@rock-chips.com>,
	"Heiko Stübner" <heiko@sntech.de>,
	"Damian Kos" <dkos@cadence.com>,
	"Quentin Schulz" <quentin.schulz@bootlin.com>,
	dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org
Cc: pgaj@cadence.com, ltyrala@cadence.com, stelford@cadence.com,
	jartur@cadence.com, piotrs@cadence.com
Subject: [PATCH v3 3/5] drm/dp: make dp_link_status and dp_get_lane_status usable from outside of the core
Date: Tue, 28 Aug 2018 11:24:46 +0100	[thread overview]
Message-ID: <1535451894-2518-4-git-send-email-dkos@cadence.com> (raw)
In-Reply-To: <1535451894-2518-1-git-send-email-dkos@cadence.com>

From: Quentin Schulz <quentin.schulz@bootlin.com>

dp_link_status and dp_get_lane_status are pretty generic and can be used for
other means, so let's make it "public".

This adds drm_dp_link_status and drm_dp_get_lane_status to the header file and
add the appropriate EXPORT_SYMBOL for it so that it can be used by other
drivers, be they compiled built-in or as modules.

Signed-off-by: Damian Kos <dkos@cadence.com>
---
 drivers/gpu/drm/drm_dp_helper.c | 20 +++++++++++---------
 include/drm/drm_dp_helper.h     |  3 +++
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index 4b5bf6ee7fa7..ee9ec2ccf878 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -43,19 +43,21 @@
  */
 
 /* Helpers for DP link training */
-static u8 dp_link_status(const u8 link_status[DP_LINK_STATUS_SIZE], int r)
+u8 drm_dp_link_status(const u8 link_status[DP_LINK_STATUS_SIZE], int r)
 {
 	return link_status[r - DP_LANE0_1_STATUS];
 }
+EXPORT_SYMBOL(drm_dp_link_status);
 
-static u8 dp_get_lane_status(const u8 link_status[DP_LINK_STATUS_SIZE],
+u8 drm_dp_get_lane_status(const 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);
+	u8 l = drm_dp_link_status(link_status, i);
 	return (l >> s) & 0xf;
 }
+EXPORT_SYMBOL(drm_dp_get_lane_status);
 
 bool drm_dp_channel_eq_ok(const u8 link_status[DP_LINK_STATUS_SIZE],
 			  int lane_count)
@@ -64,12 +66,12 @@ bool drm_dp_channel_eq_ok(const u8 link_status[DP_LINK_STATUS_SIZE],
 	u8 lane_status;
 	int lane;
 
-	lane_align = dp_link_status(link_status,
-				    DP_LANE_ALIGN_STATUS_UPDATED);
+	lane_align = drm_dp_link_status(link_status,
+					DP_LANE_ALIGN_STATUS_UPDATED);
 	if ((lane_align & DP_INTERLANE_ALIGN_DONE) == 0)
 		return false;
 	for (lane = 0; lane < lane_count; lane++) {
-		lane_status = dp_get_lane_status(link_status, lane);
+		lane_status = drm_dp_get_lane_status(link_status, lane);
 		if ((lane_status & DP_CHANNEL_EQ_BITS) != DP_CHANNEL_EQ_BITS)
 			return false;
 	}
@@ -84,7 +86,7 @@ bool drm_dp_clock_recovery_ok(const u8 link_status[DP_LINK_STATUS_SIZE],
 	u8 lane_status;
 
 	for (lane = 0; lane < lane_count; lane++) {
-		lane_status = dp_get_lane_status(link_status, lane);
+		lane_status = drm_dp_get_lane_status(link_status, lane);
 		if ((lane_status & DP_LANE_CR_DONE) == 0)
 			return false;
 	}
@@ -99,7 +101,7 @@ u8 drm_dp_get_adjust_request_voltage(const u8 link_status[DP_LINK_STATUS_SIZE],
 	int s = ((lane & 1) ?
 		 DP_ADJUST_VOLTAGE_SWING_LANE1_SHIFT :
 		 DP_ADJUST_VOLTAGE_SWING_LANE0_SHIFT);
-	u8 l = dp_link_status(link_status, i);
+	u8 l = drm_dp_link_status(link_status, i);
 
 	return ((l >> s) & 0x3) << DP_TRAIN_VOLTAGE_SWING_SHIFT;
 }
@@ -112,7 +114,7 @@ u8 drm_dp_get_adjust_request_pre_emphasis(const u8 link_status[DP_LINK_STATUS_SI
 	int s = ((lane & 1) ?
 		 DP_ADJUST_PRE_EMPHASIS_LANE1_SHIFT :
 		 DP_ADJUST_PRE_EMPHASIS_LANE0_SHIFT);
-	u8 l = dp_link_status(link_status, i);
+	u8 l = drm_dp_link_status(link_status, i);
 
 	return ((l >> s) & 0x3) << DP_TRAIN_PRE_EMPHASIS_SHIFT;
 }
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index 06a478679781..9930b2b269f2 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -952,6 +952,9 @@
 #define DP_MST_LOGICAL_PORT_0 8
 
 #define DP_LINK_STATUS_SIZE	   6
+
+u8 drm_dp_link_status(const u8 link_status[DP_LINK_STATUS_SIZE], int r);
+u8 drm_dp_get_lane_status(const u8 link_status[DP_LINK_STATUS_SIZE], int lane);
 bool drm_dp_channel_eq_ok(const u8 link_status[DP_LINK_STATUS_SIZE],
 			  int lane_count);
 bool drm_dp_clock_recovery_ok(const u8 link_status[DP_LINK_STATUS_SIZE],
-- 
2.17.1

  parent reply	other threads:[~2018-08-28 10:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-28 10:24 [PATCH v3 0/5] drm: add support for Cadence MHDP DPI/DP bridge Damian Kos
2018-08-28 10:24 ` [PATCH v3 1/5] drm/rockchip: prepare common code for cdns and rk dpi/dp driver Damian Kos
2018-09-13 10:00   ` Andrzej Hajda
     [not found]     ` <20180913100100eucas1p23e7e33035b6cba51d6219a58b34eea92~T7VgDpN8L3204732047eucas1p2_-PmokGAFL9ItqW5MlFJXMulaTQe2KTcn/@public.gmane.org>
2018-09-13 10:15       ` Damian Kos
2018-08-28 10:24 ` [PATCH v3 2/5] drm/dp: fix link probing for devices supporting DP 1.4+ Damian Kos
2018-09-13 11:08   ` Andrzej Hajda
2018-08-28 10:24 ` Damian Kos [this message]
2018-09-13 11:20   ` [PATCH v3 3/5] drm/dp: make dp_link_status and dp_get_lane_status usable from outside of the core Andrzej Hajda
2018-08-28 10:24 ` [PATCH v3 4/5] dt-bindings: drm/bridge Document Cadence MHDP DPI/DP bridge bindings Damian Kos
2018-08-29  0:28   ` Rob Herring
2018-09-13 11:23   ` Andrzej Hajda
2018-08-28 10:24 ` [PATCH v3 5/5] drm/bridge: add preliminary driver for cadence dpi/dp bridge Damian Kos
2018-09-13 12:30   ` Heiko Stuebner
2018-09-13 12:31 ` [PATCH v3 0/5] drm: add support for Cadence MHDP DPI/DP bridge Heiko Stuebner
2018-09-18 13:18   ` Damian Kos

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=1535451894-2518-4-git-send-email-dkos@cadence.com \
    --to=dkos@cadence.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=a.hajda@samsung.com \
    --cc=airlied@linux.ie \
    --cc=architt@codeaurora.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gustavo@padovan.org \
    --cc=heiko@sntech.de \
    --cc=hjc@rock-chips.com \
    --cc=jartur@cadence.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=ltyrala@cadence.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mark.rutland@arm.com \
    --cc=pgaj@cadence.com \
    --cc=piotrs@cadence.com \
    --cc=quentin.schulz@bootlin.com \
    --cc=robh+dt@kernel.org \
    --cc=sean@poorly.run \
    --cc=stelford@cadence.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).