All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Vasilev <oleg.vasilev-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: [PATCH v2 6/6] drm/amdgpu: utilize subconnector property for DP
Date: Mon, 15 Jul 2019 14:23:34 +0300	[thread overview]
Message-ID: <20190715112408.20114-7-oleg.vasilev@intel.com> (raw)
In-Reply-To: <20190715112408.20114-1-oleg.vasilev-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Since DP-specific information is stored in driver's structures, every
driver needs to implement subconnector property by itself.

Signed-off-by: Oleg Vasilev <oleg.vasilev@intel.com>
Cc: amd-gfx@lists.freedesktop.org
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 12 ++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h       |  1 +
 drivers/gpu/drm/amd/amdgpu/atombios_dp.c       | 18 +++++++++++++++++-
 3 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
index 73b2ede773d3..099286467c82 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
@@ -26,6 +26,7 @@
 
 #include <drm/drm_edid.h>
 #include <drm/drm_fb_helper.h>
+#include <drm/drm_dp_helper.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/amdgpu_drm.h>
 #include "amdgpu.h"
@@ -1407,6 +1408,10 @@ amdgpu_connector_dp_detect(struct drm_connector *connector, bool force)
 		pm_runtime_put_autosuspend(connector->dev->dev);
 	}
 
+	drm_dp_set_subconnector_property(&amdgpu_connector->base,
+					 ret,
+					 amdgpu_dig_connector->dpcd,
+					 amdgpu_dig_connector->downstream_ports);
 	return ret;
 }
 
@@ -1567,6 +1572,13 @@ amdgpu_connector_add(struct amdgpu_device *adev,
 			DRM_ERROR("Failed to assign router i2c bus! Check dmesg for i2c errors.\n");
 	}
 
+	if ((connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) ||
+		   (connector->connector_type == DRM_MODE_CONNECTOR_eDP))
+	{
+		drm_mode_add_dp_subconnector_property(&amdgpu_connector->base);
+	}
+
+
 	if (is_dp_bridge) {
 		amdgpu_dig_connector = kzalloc(sizeof(struct amdgpu_connector_atom_dig), GFP_KERNEL);
 		if (!amdgpu_dig_connector)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
index eb9975f4decb..cb360b44371c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
@@ -469,6 +469,7 @@ struct amdgpu_encoder {
 struct amdgpu_connector_atom_dig {
 	/* displayport */
 	u8 dpcd[DP_RECEIVER_CAP_SIZE];
+	u8 downstream_ports[DP_MAX_DOWNSTREAM_PORTS];
 	u8 dp_sink_type;
 	int dp_clock;
 	int dp_lane_count;
diff --git a/drivers/gpu/drm/amd/amdgpu/atombios_dp.c b/drivers/gpu/drm/amd/amdgpu/atombios_dp.c
index 6858cde9fc5d..b0d414553e71 100644
--- a/drivers/gpu/drm/amd/amdgpu/atombios_dp.c
+++ b/drivers/gpu/drm/amd/amdgpu/atombios_dp.c
@@ -334,6 +334,22 @@ static void amdgpu_atombios_dp_probe_oui(struct amdgpu_connector *amdgpu_connect
 			      buf[0], buf[1], buf[2]);
 }
 
+static void amdgpu_atombios_dp_ds_ports(struct amdgpu_connector *amdgpu_connector)
+{
+	struct amdgpu_connector_atom_dig *dig_connector = amdgpu_connector->con_priv;
+	int ret;
+
+	if (dig_connector->dpcd[DP_DPCD_REV] > 0x10) {
+		ret = drm_dp_dpcd_read(&amdgpu_connector->ddc_bus->aux,
+				       DP_DOWNSTREAM_PORT_0,
+				       dig_connector->downstream_ports,
+				       DP_MAX_DOWNSTREAM_PORTS);
+		if (ret)
+			memset(dig_connector->downstream_ports, 0,
+			       DP_MAX_DOWNSTREAM_PORTS);
+	}
+}
+
 int amdgpu_atombios_dp_get_dpcd(struct amdgpu_connector *amdgpu_connector)
 {
 	struct amdgpu_connector_atom_dig *dig_connector = amdgpu_connector->con_priv;
@@ -349,7 +365,7 @@ int amdgpu_atombios_dp_get_dpcd(struct amdgpu_connector *amdgpu_connector)
 			      dig_connector->dpcd);
 
 		amdgpu_atombios_dp_probe_oui(amdgpu_connector);
-
+		amdgpu_atombios_dp_ds_ports(amdgpu_connector);
 		return 0;
 	}
 
-- 
2.22.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

      parent reply	other threads:[~2019-07-15 11:23 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-01  8:00 [PATCH 1/2] drm: report dp downstream port type as a subconnector property Oleg Vasilev
2019-07-01  8:00 ` [PATCH 2/2] drm/i915: utilize subconnector property for DP Oleg Vasilev
2019-07-01  9:37 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/2] drm: report dp downstream port type as a subconnector property Patchwork
2019-07-01  9:40 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-07-01 10:07 ` ✓ Fi.CI.BAT: success " Patchwork
2019-07-02 11:15 ` ✓ Fi.CI.IGT: " Patchwork
2019-07-02 12:36 ` [Intel-gfx] [PATCH 1/2] " Ville Syrjälä
2019-07-02 13:38 ` Emil Velikov
2019-07-03  8:19   ` Vasilev, Oleg
2019-07-03 13:35     ` [Intel-gfx] " Emil Velikov
2019-07-15 11:23 ` Subconnector property for DP downstream type Oleg Vasilev
2019-07-15 11:23   ` [PATCH v2 1/6] drm: move DP_MAX_DOWNSTREAM_PORTS from i915 to drm core Oleg Vasilev
2019-07-15 11:23   ` [PATCH v2 2/6] drm: always determine branch device with drm_dp_is_branch() Oleg Vasilev
2019-07-15 11:23   ` [PATCH v2 3/6] drm: report dp downstream port type as a subconnector property Oleg Vasilev
2019-07-15 11:23   ` [PATCH v2 4/6] drm/i915: utilize subconnector property for DP Oleg Vasilev
2019-07-15 11:23   ` [PATCH v2 5/6] drm/nouveau: " Oleg Vasilev
2019-07-15 12:15     ` Emil Velikov
     [not found]   ` <20190715112408.20114-1-oleg.vasilev-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2019-07-15 11:23     ` Oleg Vasilev [this message]

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=20190715112408.20114-7-oleg.vasilev@intel.com \
    --to=oleg.vasilev-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.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.