dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: David Francis <David.Francis@amd.com>
To: dri-devel@lists.freedesktop.org
Cc: Leo Li <sunpeng.li@amd.com>, David Francis <David.Francis@amd.com>
Subject: [PATCH v4 3/5] drm/dp-mst: Add MST support to DP DPCD R/W functions
Date: Thu, 22 Aug 2019 09:57:39 -0400	[thread overview]
Message-ID: <20190822135741.12923-4-David.Francis@amd.com> (raw)
In-Reply-To: <20190822135741.12923-1-David.Francis@amd.com>

Instead of having drm_dp_dpcd_read/write and
drm_dp_mst_dpcd_read/write as entry points into the
aux code, have drm_dp_dpcd_read/write handle both.

This means that DRM drivers can make MST DPCD read/writes.

v2: Fix spacing

Cc: Leo Li <sunpeng.li@amd.com>
Cc: Lyude Paul <lyude@redhat.com>
Signed-off-by: David Francis <David.Francis@amd.com>
---
 drivers/gpu/drm/drm_dp_aux_dev.c | 12 ++----------
 drivers/gpu/drm/drm_dp_helper.c  | 10 ++++++++--
 2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/drm_dp_aux_dev.c b/drivers/gpu/drm/drm_dp_aux_dev.c
index 0cfb386754c3..418cad4f649a 100644
--- a/drivers/gpu/drm/drm_dp_aux_dev.c
+++ b/drivers/gpu/drm/drm_dp_aux_dev.c
@@ -163,11 +163,7 @@ static ssize_t auxdev_read_iter(struct kiocb *iocb, struct iov_iter *to)
 			break;
 		}
 
-		if (aux_dev->aux->is_remote)
-			res = drm_dp_mst_dpcd_read(aux_dev->aux, pos, buf,
-						   todo);
-		else
-			res = drm_dp_dpcd_read(aux_dev->aux, pos, buf, todo);
+		res = drm_dp_dpcd_read(aux_dev->aux, pos, buf, todo);
 
 		if (res <= 0)
 			break;
@@ -215,11 +211,7 @@ static ssize_t auxdev_write_iter(struct kiocb *iocb, struct iov_iter *from)
 			break;
 		}
 
-		if (aux_dev->aux->is_remote)
-			res = drm_dp_mst_dpcd_write(aux_dev->aux, pos, buf,
-						    todo);
-		else
-			res = drm_dp_dpcd_write(aux_dev->aux, pos, buf, todo);
+		res = drm_dp_mst_dpcd_write(aux_dev->aux, pos, buf, todo);
 
 		if (res <= 0)
 			break;
diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index ffc68d305afe..b1599760b6a3 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -30,6 +30,7 @@
 #include <linux/seq_file.h>
 
 #include <drm/drm_dp_helper.h>
+#include <drm/drm_dp_mst_helper.h>
 #include <drm/drm_print.h>
 #include <drm/drm_vblank.h>
 
@@ -251,7 +252,7 @@ static int drm_dp_dpcd_access(struct drm_dp_aux *aux, u8 request,
 
 /**
  * drm_dp_dpcd_read() - read a series of bytes from the DPCD
- * @aux: DisplayPort AUX channel
+ * @aux: DisplayPort AUX channel (SST or MST)
  * @offset: address of the (first) register to read
  * @buffer: buffer to store the register values
  * @size: number of bytes in @buffer
@@ -268,6 +269,8 @@ ssize_t drm_dp_dpcd_read(struct drm_dp_aux *aux, unsigned int offset,
 {
 	int ret;
 
+	if (aux->is_remote)
+		return drm_dp_mst_dpcd_read(aux, offset, buffer, size);
 	/*
 	 * HP ZR24w corrupts the first DPCD access after entering power save
 	 * mode. Eg. on a read, the entire buffer will be filled with the same
@@ -296,7 +299,7 @@ EXPORT_SYMBOL(drm_dp_dpcd_read);
 
 /**
  * drm_dp_dpcd_write() - write a series of bytes to the DPCD
- * @aux: DisplayPort AUX channel
+ * @aux: DisplayPort AUX channel (SST or MST)
  * @offset: address of the (first) register to write
  * @buffer: buffer containing the values to write
  * @size: number of bytes in @buffer
@@ -313,6 +316,9 @@ ssize_t drm_dp_dpcd_write(struct drm_dp_aux *aux, unsigned int offset,
 {
 	int ret;
 
+	if (aux->is_remote)
+		return drm_dp_mst_dpcd_write(aux, offset, buffer, size);
+
 	ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_WRITE, offset, buffer,
 				 size);
 	drm_dp_dump_access(aux, DP_AUX_NATIVE_WRITE, offset, buffer, ret);
-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2019-08-22 13:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-22 13:57 [PATCH v4 0/5] MST DSC support in drm-mst David Francis
2019-08-22 13:57 ` [PATCH v4 1/5] drm/dp-mst: Add PBN calculation for DSC modes David Francis
2019-08-22 21:42   ` Lyude Paul
2019-08-22 13:57 ` [PATCH v4 2/5] drm/dp-mst: Parse FEC capability on MST ports David Francis
2019-08-22 13:57 ` David Francis [this message]
2019-08-22 21:54   ` [PATCH v4 3/5] drm/dp-mst: Add MST support to DP DPCD R/W functions Lyude Paul
2019-08-22 13:57 ` [PATCH v4 4/5] drm/dp-mst: Fill branch->num_ports David Francis
2019-08-22 21:55   ` Lyude Paul
2019-08-22 13:57 ` [PATCH v4 5/5] drm/dp-mst: Add helpers for querying and enabling MST DSC David Francis
2019-08-22 23:49   ` Lyude Paul
2019-08-22 21:39 ` [PATCH v4 0/5] MST DSC support in drm-mst Lyude Paul
2019-08-23  0:03 ` Lyude Paul
2019-08-23 20:24   ` Francis, David
2019-08-26 19:50     ` Dave Airlie
2019-08-26 21:12       ` Harry Wentland

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=20190822135741.12923-4-David.Francis@amd.com \
    --to=david.francis@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sunpeng.li@amd.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