Skip to contentSkip to conversation

drm/i915: DP branch devices

PATCH Superseded Mika Kahola 4 participants 31 messages Aug 17, 2016 – Sep 9, 2016

Subsystems (3)

v8 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

v8 cover drm/i915: DP branch devices

Prep work for DP branch device handling

This series of patches reads DPCD register 0x80h for receiver capabilities for DP branch devices. The branch device types are converters for the following standards

- DP to VGA
- DP to DVI
- DP to HDMI
- DP++ dual mode
- Wireless WiGig

DPCD register defines max pixel rate for VGA dongles. This check is carried out during mode validation.

[1] git://github.com/mkahola/drm-intel-mika.git dp_branch_device

v2: DPCD register read outs moved to drm (Ville, Daniel)
v3: Max pixel rate computation moved to drm (Daniel)
v4: Use of drm_dp_helper routines to collect data (Ville)
v5: Remove duplicate code and unnecessary functions from drm_dp_helper (Ville)
v6: Rebase and i915_debugfs cleanup
v7: Structure cleanups and initial step to move DP debugging info to drm_dp_helpers
v8: Cleanups and TMDS clock frequency check for HDMI adapter

Mika Kahola (12):
drm: Add missing DP downstream port types
drm: Drop VGA from bpc definitions
drm: Helper to read max clock rate
drm: Helper to read max bits per component
drm: Read DP branch device id
drm/i915: Cleanup DisplayPort AUX channel initialization drm/i915: Read DP branch device HW revision drm/i915: Read DP branch device SW revision drm/i915: Check pixel rate for DP to VGA dongle drm/i915: Update bits per component for display info
drm: Add DP branch device info on debugfs drm/i915: Check TMDS clock DP to HDMI dongle

 drivers/gpu/drm/drm_dp_helper.c     | 168 ++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_debugfs.c |   3 +
 drivers/gpu/drm/i915/intel_dp.c     |  89 ++++++++++++++++++-
 drivers/gpu/drm/i915/intel_drv.h    |   3 +
 drivers/gpu/drm/i915/intel_hdmi.c   |  27 ++++++
 include/drm/drm_dp_helper.h         |  22 +++--
 6 files changed, 303 insertions(+), 9 deletions(-)
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH v8 1/12 drm: Add missing DP downstream port types

Add missing DisplayPort downstream port types. The introduced new port types are DP++ and Wireless.

---
 include/drm/drm_dp_helper.h | 2 ++
 1 file changed, 2 insertions(+)
include/drm/drm_dp_helper.h +2 -0
index 63b8bd5..ba9731e 100644
@@ -211,6 +211,8 @@
 # define DP_DS_PORT_TYPE_DVI		    2
 # define DP_DS_PORT_TYPE_HDMI		    3
 # define DP_DS_PORT_TYPE_NON_EDID	    4
+# define DP_DS_PORT_TYPE_DP_DUALMODE        5
+# define DP_DS_PORT_TYPE_WIRELESS           6
 # define DP_DS_PORT_HPD			    (1 << 3)
 /* offset 1 for VGA is maximum megapixels per second / 8 */
 /* offset 2 */
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

PATCH v8 2/12 drm: Drop VGA from bpc definitions

In reply to Mika Kahola

Drop "VGA" from bits per component definitions as these are also used by other standards such as DVI, HDMI, DP++.

---
 include/drm/drm_dp_helper.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
include/drm/drm_dp_helper.h +5 -5
index ba9731e..0d84046 100644
@@ -216,11 +216,11 @@
 # define DP_DS_PORT_HPD			    (1 << 3)
 /* offset 1 for VGA is maximum megapixels per second / 8 */
 /* offset 2 */
-# define DP_DS_VGA_MAX_BPC_MASK		    (3 << 0)
-# define DP_DS_VGA_8BPC			    0
-# define DP_DS_VGA_10BPC		    1
-# define DP_DS_VGA_12BPC		    2
-# define DP_DS_VGA_16BPC		    3
+# define DP_DS_MAX_BPC_MASK	            (3 << 0)
+# define DP_DS_8BPC		            0
+# define DP_DS_10BPC		            1
+# define DP_DS_12BPC		            2
+# define DP_DS_16BPC		            3
 
 /* link configuration */
 #define	DP_LINK_BW_SET		            0x100
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

PATCH v8 3/12 drm: Helper to read max clock rate

In reply to Mika Kahola

Helper routine to read out maximum supported pixel rate for DisplayPort legay VGA converter or TMDS clock rate for other digital legacy converters. The helper returns clock rate in kHz.

v2: Return early if detailed port cap info is not available.
Replace if-else ladder with switch-case (Ville)

---
 drivers/gpu/drm/drm_dp_helper.c | 33 +++++++++++++++++++++++++++++++++
 include/drm/drm_dp_helper.h     |  2 ++
 2 files changed, 35 insertions(+)
drivers/gpu/drm/drm_dp_helper.c +33 -0
index 031c4d3..7497490 100644
@@ -439,6 +439,39 @@ int drm_dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link)
 }
 EXPORT_SYMBOL(drm_dp_link_configure);
 
+/**
+ * drm_dp_downstream_max_clock() - extract branch device max
+ *                                 pixel rate for legacy VGA
+ *                                 converter or max TMDS clock
+ *                                 rate for others
+ * @dpcd: DisplayPort configuration data
+ * @port_cap: port capabilities
+ *
+ * Returns max clock in kHz on success or 0 if max clock not defined
+ */
+int drm_dp_downstream_max_clock(const u8 dpcd[DP_RECEIVER_CAP_SIZE],
+				const u8 port_cap[4])
+{
+	int type = port_cap[0] & DP_DS_PORT_TYPE_MASK;
+	bool detailed_cap_info = dpcd[DP_DOWNSTREAMPORT_PRESENT] &
+		DP_DETAILED_CAP_INFO_AVAILABLE;
+
+	if (!detailed_cap_info)
+		return 0;
+
+	switch (type) {
+	case DP_DS_PORT_TYPE_VGA:
+		return port_cap[1] * 8 * 1000;
+	case DP_DS_PORT_TYPE_DVI:
+	case DP_DS_PORT_TYPE_HDMI:
+	case DP_DS_PORT_TYPE_DP_DUALMODE:
+		return port_cap[1] * 2500;
+	default:
+		return 0;
+	}
+}
+EXPORT_SYMBOL(drm_dp_downstream_max_clock);
+
 /*
  * I2C-over-AUX implementation
  */
include/drm/drm_dp_helper.h +2 -0
index 0d84046..60dd9dc 100644
@@ -815,6 +815,8 @@ int drm_dp_link_probe(struct drm_dp_aux *aux, struct drm_dp_link *link);
 int drm_dp_link_power_up(struct drm_dp_aux *aux, struct drm_dp_link *link);
 int drm_dp_link_power_down(struct drm_dp_aux *aux, struct drm_dp_link *link);
 int drm_dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link);
+int drm_dp_downstream_max_clock(const u8 dpcd[DP_RECEIVER_CAP_SIZE],
+				const u8 port_cap[4]);
 
 void drm_dp_aux_init(struct drm_dp_aux *aux);
 int drm_dp_aux_register(struct drm_dp_aux *aux);
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

Re: [PATCH v8 03/12] drm: Helper to read max clock rate

Quoted 40 lines · Mika Kahola

Helper routine to read out maximum supported pixel rate for DisplayPort legay VGA converter or TMDS clock rate for other digital legacy converters. The helper returns clock rate in kHz.

v2: Return early if detailed port cap info is not available.
Replace if-else ladder with switch-case (Ville)

---
 drivers/gpu/drm/drm_dp_helper.c | 33 +++++++++++++++++++++++++++++++++
 include/drm/drm_dp_helper.h     |  2 ++
 2 files changed, 35 insertions(+)
drivers/gpu/drm/drm_dp_helper.c +17 -0
index 031c4d3..7497490 100644
@@ -439,6 +439,39 @@ int drm_dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link)
 }
 EXPORT_SYMBOL(drm_dp_link_configure);
 
+/**
+ * drm_dp_downstream_max_clock() - extract branch device max
+ *                                 pixel rate for legacy VGA
+ *                                 converter or max TMDS clock
+ *                                 rate for others
+ * @dpcd: DisplayPort configuration data
+ * @port_cap: port capabilities
+ *
+ * Returns max clock in kHz on success or 0 if max clock not defined
+ */
+int drm_dp_downstream_max_clock(const u8 dpcd[DP_RECEIVER_CAP_SIZE],
+				const u8 port_cap[4])
+{
+	int type = port_cap[0] & DP_DS_PORT_TYPE_MASK;
+	bool detailed_cap_info = dpcd[DP_DOWNSTREAMPORT_PRESENT] &
+		DP_DETAILED_CAP_INFO_AVAILABLE;
+

drivers/gpu/drm/drm_dp_helper.c int drm_dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link) · line 468

Quoted 10 lines
drivers/gpu/drm/drm_dp_helper.c +10 -0
+	if (!detailed_cap_info)
+		return 0;
+
+	switch (type) {
+	case DP_DS_PORT_TYPE_VGA:
+		return port_cap[1] * 8 * 1000;
+	case DP_DS_PORT_TYPE_DVI:
+	case DP_DS_PORT_TYPE_HDMI:
+	case DP_DS_PORT_TYPE_DP_DUALMODE:
+		return port_cap[1] * 2500;

The spec says that if the detailed_cap_info==0, then DVI/HDMI/DP++ must support at least 165 MHz TMDS clock. I was thinking we might want to limit things to 165 in that case to guarantee that we advertize only modes guaranteed to work.

Quoted 24 lines
drivers/gpu/drm/drm_dp_helper.c +6 -0
+	default:
+		return 0;
+	}
+}
+EXPORT_SYMBOL(drm_dp_downstream_max_clock);
+
 /*
  * I2C-over-AUX implementation
  */
include/drm/drm_dp_helper.h +2 -0
index 0d84046..60dd9dc 100644
@@ -815,6 +815,8 @@ int drm_dp_link_probe(struct drm_dp_aux *aux, struct drm_dp_link *link);
 int drm_dp_link_power_up(struct drm_dp_aux *aux, struct drm_dp_link *link);
 int drm_dp_link_power_down(struct drm_dp_aux *aux, struct drm_dp_link *link);
 int drm_dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link);
+int drm_dp_downstream_max_clock(const u8 dpcd[DP_RECEIVER_CAP_SIZE],
+				const u8 port_cap[4]);
 
 void drm_dp_aux_init(struct drm_dp_aux *aux);
 int drm_dp_aux_register(struct drm_dp_aux *aux);
Signature · 1 line
1.9.1
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#5 lore raw

RE: [PATCH v8 03/12] drm: Helper to read max clock rate

Quoted 57 lines

-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Thursday, September 8, 2016 4:02 PM
To: Kahola, Mika <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v8 03/12] drm: Helper to read max clock rate

Quoted 11 lines · Mika Kahola

Helper routine to read out maximum supported pixel rate for DisplayPort legay VGA converter or TMDS clock rate for other digital legacy converters. The helper returns clock rate in kHz.

v2: Return early if detailed port cap info is not available.
Replace if-else ladder with switch-case (Ville)

---
 drivers/gpu/drm/drm_dp_helper.c | 33

+++++++++++++++++++++++++++++++++

drivers/gpu/drm/drm_dp_helper.c int drm_dp_link_configure(struct drm_dp_aux

Quoted 8 lines
 include/drm/drm_dp_helper.h     |  2 ++
 2 files changed, 35 insertions(+)
(quoted diff) +0 -0

b/drivers/gpu/drm/drm_dp_helper.c index 031c4d3..7497490 100644

drivers/gpu/drm/drm_dp_helper.c +0 -0
@@ -439,6 +439,39 @@ int drm_dp_link_configure(struct drm_dp_aux

*aux,

Quoted 26 lines
drivers/gpu/drm/drm_dp_helper.c +24 -0
 struct drm_dp_link *link)  }  EXPORT_SYMBOL(drm_dp_link_configure);
 
+/**
+ * drm_dp_downstream_max_clock() - extract branch device max
+ *                                 pixel rate for legacy VGA
+ *                                 converter or max TMDS clock
+ *                                 rate for others
+ * @dpcd: DisplayPort configuration data
+ * @port_cap: port capabilities
+ *
+ * Returns max clock in kHz on success or 0 if max clock not defined
+*/ int drm_dp_downstream_max_clock(const u8
+dpcd[DP_RECEIVER_CAP_SIZE],
+				const u8 port_cap[4])
+{
+	int type = port_cap[0] & DP_DS_PORT_TYPE_MASK;
+	bool detailed_cap_info = dpcd[DP_DOWNSTREAMPORT_PRESENT] &
+		DP_DETAILED_CAP_INFO_AVAILABLE;
+
+	if (!detailed_cap_info)
+		return 0;
+
+	switch (type) {
+	case DP_DS_PORT_TYPE_VGA:
+		return port_cap[1] * 8 * 1000;
+	case DP_DS_PORT_TYPE_DVI:
Quoted 8 lines

drivers/gpu/drm/drm_dp_helper.c int drm_dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link) · line 468

Quoted 3 lines
drivers/gpu/drm/drm_dp_helper.c +3 -0
+	case DP_DS_PORT_TYPE_HDMI:
+	case DP_DS_PORT_TYPE_DP_DUALMODE:
+		return port_cap[1] * 2500;

The spec says that if the detailed_cap_info==0, then DVI/HDMI/DP++ must support at least 165 MHz TMDS clock. I was thinking we might want to limit things to 165 in that case to guarantee that we advertize only modes guaranteed to work.

That is a valid point. What I had in mind was by returning 0 from this function it is indicated that the value is not found. With the remaining patches that call this function the check is in place so we can skip the step if explicit clock rate is not found.

Quoted 25 lines

Review

Quoted 11 lines
drivers/gpu/drm/drm_dp_helper.c +6 -0
+	default:
+		return 0;
+	}
+}
+EXPORT_SYMBOL(drm_dp_downstream_max_clock);
+
 /*
  * I2C-over-AUX implementation
  */
(quoted diff) +0 -0

b/include/drm/drm_dp_helper.h

Quoted 10 lines

index 0d84046..60dd9dc 100644

include/drm/drm_dp_helper.h +0 -0
@@ -815,6 +815,8 @@ int drm_dp_link_probe(struct drm_dp_aux *aux,

struct drm_dp_link *link); int drm_dp_link_power_up(struct drm_dp_aux *aux, struct drm_dp_link *link); int drm_dp_link_power_down(struct drm_dp_aux *aux, struct drm_dp_link *link); int drm_dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link);
+int drm_dp_downstream_max_clock(const u8

dpcd[DP_RECEIVER_CAP_SIZE],

Quoted 2 lines
include/drm/drm_dp_helper.h +1 -0
+				const u8 port_cap[4]);
Quoted 8 lines
Quoted 4 lines

void drm_dp_aux_init(struct drm_dp_aux *aux); int
drm_dp_aux_register(struct drm_dp_aux *aux); --
1.9.1

--
Ville Syrjälä
Intel OTC

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#6 lore raw

PATCH v8 4/12 drm: Helper to read max bits per component

In reply to Mika Kahola

Helper routine to read out maximum supported bits per component for DisplayPort legay converters.

v2: Return early if detailed port cap info is not available.
Replace if-else ladder with switch-case (Ville)

---
 drivers/gpu/drm/drm_dp_helper.c | 42 +++++++++++++++++++++++++++++++++++++++++
 include/drm/drm_dp_helper.h     |  2 ++
 2 files changed, 44 insertions(+)
drivers/gpu/drm/drm_dp_helper.c +42 -0
index 7497490..14e8ea0 100644
@@ -472,6 +472,48 @@ int drm_dp_downstream_max_clock(const u8 dpcd[DP_RECEIVER_CAP_SIZE],
 }
 EXPORT_SYMBOL(drm_dp_downstream_max_clock);
 
+/**
+ * drm_dp_downstream_max_bpc() - extract branch device max
+ *                               bits per component
+ * @dpcd: DisplayPort configuration data
+ * @port_cap: port capabilities
+ *
+ * Returns max bpc on success or 0 if max bpc not defined
+ */
+int drm_dp_downstream_max_bpc(const u8 dpcd[DP_RECEIVER_CAP_SIZE],
+			      const u8 port_cap[4])
+{
+	int type = port_cap[0] & DP_DS_PORT_TYPE_MASK;
+	bool detailed_cap_info = dpcd[DP_DOWNSTREAMPORT_PRESENT] &
+		DP_DETAILED_CAP_INFO_AVAILABLE;
+	int bpc;
+
+	if (!detailed_cap_info)
+		return 0;
+
+	switch (type) {
+	case DP_DS_PORT_TYPE_VGA:
+	case DP_DS_PORT_TYPE_DVI:
+	case DP_DS_PORT_TYPE_HDMI:
+	case DP_DS_PORT_TYPE_DP_DUALMODE:
+		bpc = port_cap[2] & DP_DS_MAX_BPC_MASK;
+
+		switch (bpc) {
+		case DP_DS_8BPC:
+			return 8;
+		case DP_DS_10BPC:
+			return 10;
+		case DP_DS_12BPC:
+			return 12;
+		case DP_DS_16BPC:
+			return 16;
+		}
+	default:
+		return 0;
+	}
+}
+EXPORT_SYMBOL(drm_dp_downstream_max_bpc);
+
 /*
  * I2C-over-AUX implementation
  */
include/drm/drm_dp_helper.h +2 -0
index 60dd9dc..f3d1424 100644
@@ -817,6 +817,8 @@ int drm_dp_link_power_down(struct drm_dp_aux *aux, struct drm_dp_link *link);
 int drm_dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link);
 int drm_dp_downstream_max_clock(const u8 dpcd[DP_RECEIVER_CAP_SIZE],
 				const u8 port_cap[4]);
+int drm_dp_downstream_max_bpc(const u8 dpcd[DP_RECEIVER_CAP_SIZE],
+			      const u8 port_cap[4]);
 
 void drm_dp_aux_init(struct drm_dp_aux *aux);
 int drm_dp_aux_register(struct drm_dp_aux *aux);
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

Re: [PATCH v8 04/12] drm: Helper to read max bits per component

Quoted 35 lines · Mika Kahola

Helper routine to read out maximum supported bits per component for DisplayPort legay converters.

v2: Return early if detailed port cap info is not available.
Replace if-else ladder with switch-case (Ville)

---
 drivers/gpu/drm/drm_dp_helper.c | 42 +++++++++++++++++++++++++++++++++++++++++
 include/drm/drm_dp_helper.h     |  2 ++
 2 files changed, 44 insertions(+)
drivers/gpu/drm/drm_dp_helper.c +14 -0
index 7497490..14e8ea0 100644
@@ -472,6 +472,48 @@ int drm_dp_downstream_max_clock(const u8 dpcd[DP_RECEIVER_CAP_SIZE],
 }
 EXPORT_SYMBOL(drm_dp_downstream_max_clock);
 
+/**
+ * drm_dp_downstream_max_bpc() - extract branch device max
+ *                               bits per component
+ * @dpcd: DisplayPort configuration data
+ * @port_cap: port capabilities
+ *
+ * Returns max bpc on success or 0 if max bpc not defined
+ */
+int drm_dp_downstream_max_bpc(const u8 dpcd[DP_RECEIVER_CAP_SIZE],
+			      const u8 port_cap[4])
+{
+	int type = port_cap[0] & DP_DS_PORT_TYPE_MASK;
+	bool detailed_cap_info = dpcd[DP_DOWNSTREAMPORT_PRESENT] &
+		DP_DETAILED_CAP_INFO_AVAILABLE;

drivers/gpu/drm/drm_dp_helper.c int drm_dp_downstream_max_clock(const u8 dpcd[DP_RECEIVER_CAP_SIZE], · line 498

Quoted 10 lines
drivers/gpu/drm/drm_dp_helper.c +10 -0
+	int bpc;
+
+	if (!detailed_cap_info)
+		return 0;
+
+	switch (type) {
+	case DP_DS_PORT_TYPE_VGA:
+	case DP_DS_PORT_TYPE_DVI:
+	case DP_DS_PORT_TYPE_HDMI:
+	case DP_DS_PORT_TYPE_DP_DUALMODE:

I think we might want return 8; for the detailed_cap_info==0 case with these port types.

Quoted 36 lines
drivers/gpu/drm/drm_dp_helper.c +18 -0
+		bpc = port_cap[2] & DP_DS_MAX_BPC_MASK;
+
+		switch (bpc) {
+		case DP_DS_8BPC:
+			return 8;
+		case DP_DS_10BPC:
+			return 10;
+		case DP_DS_12BPC:
+			return 12;
+		case DP_DS_16BPC:
+			return 16;
+		}
+	default:
+		return 0;
+	}
+}
+EXPORT_SYMBOL(drm_dp_downstream_max_bpc);
+
 /*
  * I2C-over-AUX implementation
  */
include/drm/drm_dp_helper.h +2 -0
index 60dd9dc..f3d1424 100644
@@ -817,6 +817,8 @@ int drm_dp_link_power_down(struct drm_dp_aux *aux, struct drm_dp_link *link);
 int drm_dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link);
 int drm_dp_downstream_max_clock(const u8 dpcd[DP_RECEIVER_CAP_SIZE],
 				const u8 port_cap[4]);
+int drm_dp_downstream_max_bpc(const u8 dpcd[DP_RECEIVER_CAP_SIZE],
+			      const u8 port_cap[4]);
 
 void drm_dp_aux_init(struct drm_dp_aux *aux);
 int drm_dp_aux_register(struct drm_dp_aux *aux);
Signature · 1 line
1.9.1
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw

PATCH v8 5/12 drm: Read DP branch device id

In reply to Mika Kahola

Read DisplayPort branch device id string.

---
 drivers/gpu/drm/drm_dp_helper.c | 12 ++++++++++++
 include/drm/drm_dp_helper.h     |  2 ++
 2 files changed, 14 insertions(+)
drivers/gpu/drm/drm_dp_helper.c +12 -0
index 14e8ea0..01ee7af 100644
@@ -514,6 +514,18 @@ int drm_dp_downstream_max_bpc(const u8 dpcd[DP_RECEIVER_CAP_SIZE],
 }
 EXPORT_SYMBOL(drm_dp_downstream_max_bpc);
 
+/**
+ * drm_dp_downstream_id() - identify branch device
+ * @aux: DisplayPort AUX channel
+ *
+ * Returns branch device id on success or NULL on failure
+ */
+int drm_dp_downstream_id(struct drm_dp_aux *aux, char id[6])
+{
+	return drm_dp_dpcd_read(aux, DP_BRANCH_ID, id, 6);
+}
+EXPORT_SYMBOL(drm_dp_downstream_id);
+
 /*
  * I2C-over-AUX implementation
  */
include/drm/drm_dp_helper.h +2 -0
index f3d1424..faea76b 100644
@@ -445,6 +445,7 @@
 #define DP_SOURCE_OUI			    0x300
 #define DP_SINK_OUI			    0x400
 #define DP_BRANCH_OUI			    0x500
+#define DP_BRANCH_ID                        0x503
 
 #define DP_SET_POWER                        0x600
 # define DP_SET_POWER_D0                    0x1
@@ -819,6 +820,7 @@ int drm_dp_downstream_max_clock(const u8 dpcd[DP_RECEIVER_CAP_SIZE],
 				const u8 port_cap[4]);
 int drm_dp_downstream_max_bpc(const u8 dpcd[DP_RECEIVER_CAP_SIZE],
 			      const u8 port_cap[4]);
+int drm_dp_downstream_id(struct drm_dp_aux *aux, char id[6]);
 
 void drm_dp_aux_init(struct drm_dp_aux *aux);
 int drm_dp_aux_register(struct drm_dp_aux *aux);
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#9 lore raw

PATCH v8 6/12 drm/i915: Cleanup DisplayPort AUX channel initialization

In reply to Mika Kahola

Let's remove reference to "struct intel_connector *connector" in intel_dp_aux_init() function as it is no longer required.

---
 drivers/gpu/drm/i915/intel_dp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +2 -2
index 364db90..3dab3bf 100644
@@ -1243,7 +1243,7 @@ intel_dp_aux_fini(struct intel_dp *intel_dp)
 }
 
 static void
-intel_dp_aux_init(struct intel_dp *intel_dp, struct intel_connector *connector)
+intel_dp_aux_init(struct intel_dp *intel_dp)
 {
 	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
 	enum port port = intel_dig_port->port;
@@ -5598,7 +5598,7 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
 	connector->interlace_allowed = true;
 	connector->doublescan_allowed = 0;
 
-	intel_dp_aux_init(intel_dp, intel_connector);
+	intel_dp_aux_init(intel_dp);
 
 	INIT_DELAYED_WORK(&intel_dp->panel_vdd_work,
 			  edp_panel_vdd_work);
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v8 6/12
#10 lore raw

Re: [PATCH v8 06/12] drm/i915: Cleanup DisplayPort AUX channel initialization

Quoted 4 lines · Mika Kahola

Let's remove reference to "struct intel_connector *connector" in intel_dp_aux_init() function as it is no longer required.

Quoted 28 lines
---
 drivers/gpu/drm/i915/intel_dp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +2 -2
index 364db90..3dab3bf 100644
@@ -1243,7 +1243,7 @@ intel_dp_aux_fini(struct intel_dp *intel_dp)
 }
 
 static void
-intel_dp_aux_init(struct intel_dp *intel_dp, struct intel_connector *connector)
+intel_dp_aux_init(struct intel_dp *intel_dp)
 {
 	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
 	enum port port = intel_dig_port->port;
@@ -5598,7 +5598,7 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
 	connector->interlace_allowed = true;
 	connector->doublescan_allowed = 0;
 
-	intel_dp_aux_init(intel_dp, intel_connector);
+	intel_dp_aux_init(intel_dp);
 
 	INIT_DELAYED_WORK(&intel_dp->panel_vdd_work,
 			  edp_panel_vdd_work);
Signature · 1 line
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#11 lore raw

PATCH v8 7/12 drm/i915: Read DP branch device HW revision

In reply to Mika Kahola

HW revision is mandatory field for DisplayPort branch devices. This is defined in DPCD register field 0x509.

v2: move drm_dp_ds_revision structure to be part of
drm_dp_link structure (Daniel)
v3: remove dependency to drm_dp_helper but instead parse
DPCD and print HW revision info to dmesg (Ville)

---
 drivers/gpu/drm/i915/intel_dp.c | 21 +++++++++++++++++++++
 include/drm/drm_dp_helper.h     |  1 +
 2 files changed, 22 insertions(+)
drivers/gpu/drm/i915/intel_dp.c +21 -0
index 3dab3bf..9aebdf6 100644
@@ -1419,6 +1419,25 @@ static void intel_dp_print_rates(struct intel_dp *intel_dp)
 	DRM_DEBUG_KMS("common rates: %s\n", str);
 }
 
+static void intel_dp_print_hw_revision(struct intel_dp *intel_dp)
+{
+	uint8_t rev;
+	int len;
+
+	if ((drm_debug & DRM_UT_KMS) == 0)
+		return;
+
+	if (!(intel_dp->dpcd[DP_DOWNSTREAMPORT_PRESENT] &
+	      DP_DWN_STRM_PORT_PRESENT))
+		return;
+
+	len = drm_dp_dpcd_read(&intel_dp->aux, DP_BRANCH_HW_REV, &rev, 1);
+	if (len < 0)
+		return;
+
+	DRM_DEBUG_KMS("sink hw revision: %d.%d\n", (rev & 0xf0) >> 4, rev & 0xf);
+}
+
 static int rate_to_index(int find, const int *rates)
 {
 	int i = 0;
@@ -4282,6 +4301,8 @@ intel_dp_long_pulse(struct intel_connector *intel_connector)
 
 	intel_dp_probe_oui(intel_dp);
 
+	intel_dp_print_hw_revision(intel_dp);
+
 	intel_dp_configure_mst(intel_dp);
 
 	if (intel_dp->is_mst) {
include/drm/drm_dp_helper.h +1 -0
index faea76b..19ac599 100644
@@ -446,6 +446,7 @@
 #define DP_SINK_OUI			    0x400
 #define DP_BRANCH_OUI			    0x500
 #define DP_BRANCH_ID                        0x503
+#define DP_BRANCH_HW_REV                    0x509
 
 #define DP_SET_POWER                        0x600
 # define DP_SET_POWER_D0                    0x1
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v8 7/12
#12 lore raw

Re: [PATCH v8 07/12] drm/i915: Read DP branch device HW revision

Quoted 9 lines · Mika Kahola

HW revision is mandatory field for DisplayPort branch devices. This is defined in DPCD register field 0x509.

v2: move drm_dp_ds_revision structure to be part of
drm_dp_link structure (Daniel)
v3: remove dependency to drm_dp_helper but instead parse
DPCD and print HW revision info to dmesg (Ville)

Quoted 58 lines
---
 drivers/gpu/drm/i915/intel_dp.c | 21 +++++++++++++++++++++
 include/drm/drm_dp_helper.h     |  1 +
 2 files changed, 22 insertions(+)
drivers/gpu/drm/i915/intel_dp.c +21 -0
index 3dab3bf..9aebdf6 100644
@@ -1419,6 +1419,25 @@ static void intel_dp_print_rates(struct intel_dp *intel_dp)
 	DRM_DEBUG_KMS("common rates: %s\n", str);
 }
 
+static void intel_dp_print_hw_revision(struct intel_dp *intel_dp)
+{
+	uint8_t rev;
+	int len;
+
+	if ((drm_debug & DRM_UT_KMS) == 0)
+		return;
+
+	if (!(intel_dp->dpcd[DP_DOWNSTREAMPORT_PRESENT] &
+	      DP_DWN_STRM_PORT_PRESENT))
+		return;
+
+	len = drm_dp_dpcd_read(&intel_dp->aux, DP_BRANCH_HW_REV, &rev, 1);
+	if (len < 0)
+		return;
+
+	DRM_DEBUG_KMS("sink hw revision: %d.%d\n", (rev & 0xf0) >> 4, rev & 0xf);
+}
+
 static int rate_to_index(int find, const int *rates)
 {
 	int i = 0;
@@ -4282,6 +4301,8 @@ intel_dp_long_pulse(struct intel_connector *intel_connector)
 
 	intel_dp_probe_oui(intel_dp);
 
+	intel_dp_print_hw_revision(intel_dp);
+
 	intel_dp_configure_mst(intel_dp);
 
 	if (intel_dp->is_mst) {
include/drm/drm_dp_helper.h +1 -0
index faea76b..19ac599 100644
@@ -446,6 +446,7 @@
 #define DP_SINK_OUI			    0x400
 #define DP_BRANCH_OUI			    0x500
 #define DP_BRANCH_ID                        0x503
+#define DP_BRANCH_HW_REV                    0x509
 
 #define DP_SET_POWER                        0x600
 # define DP_SET_POWER_D0                    0x1
Signature · 1 line
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#13 lore raw

PATCH v8 8/12 drm/i915: Read DP branch device SW revision

In reply to Mika Kahola

SW revision is mandatory field for DisplayPort branch devices. This is defined in DPCD register field 0x50A.

v2: move drm_dp_ds_revision structure to be part of
drm_dp_link structure (Daniel)
v3: remove dependency to drm_dp_helper but instead parse
DPCD and print SW revision info to dmesg (Ville)

---
 drivers/gpu/drm/i915/intel_dp.c | 20 ++++++++++++++++++++
 include/drm/drm_dp_helper.h     |  1 +
 2 files changed, 21 insertions(+)
drivers/gpu/drm/i915/intel_dp.c +20 -0
index 9aebdf6..91ffb79 100644
@@ -1438,6 +1438,25 @@ static void intel_dp_print_hw_revision(struct intel_dp *intel_dp)
 	DRM_DEBUG_KMS("sink hw revision: %d.%d\n", (rev & 0xf0) >> 4, rev & 0xf);
 }
 
+static void intel_dp_print_sw_revision(struct intel_dp *intel_dp)
+{
+	uint8_t rev[2];
+	int len;
+
+	if ((drm_debug & DRM_UT_KMS) == 0)
+		return;
+
+	if (!(intel_dp->dpcd[DP_DOWNSTREAMPORT_PRESENT] &
+	      DP_DWN_STRM_PORT_PRESENT))
+		return;
+
+	len = drm_dp_dpcd_read(&intel_dp->aux, DP_BRANCH_SW_REV, &rev, 2);
+	if (len < 0)
+		return;
+
+	DRM_DEBUG_KMS("sink sw revision: %d.%d\n", rev[0], rev[1]);
+}
+
 static int rate_to_index(int find, const int *rates)
 {
 	int i = 0;
@@ -4302,6 +4321,7 @@ intel_dp_long_pulse(struct intel_connector *intel_connector)
 	intel_dp_probe_oui(intel_dp);
 
 	intel_dp_print_hw_revision(intel_dp);
+	intel_dp_print_sw_revision(intel_dp);
 
 	intel_dp_configure_mst(intel_dp);
 
include/drm/drm_dp_helper.h +1 -0
index 19ac599..215202f 100644
@@ -447,6 +447,7 @@
 #define DP_BRANCH_OUI			    0x500
 #define DP_BRANCH_ID                        0x503
 #define DP_BRANCH_HW_REV                    0x509
+#define DP_BRANCH_SW_REV                    0x50A
 
 #define DP_SET_POWER                        0x600
 # define DP_SET_POWER_D0                    0x1
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v8 8/12
#14 lore raw

Re: [PATCH v8 08/12] drm/i915: Read DP branch device SW revision

Quoted 2 lines · Mika Kahola

SW revision is mandatory field for DisplayPort branch devices. This is defined in DPCD register field 0x50A.

To be precise, the revision info is in 0x50A and 0x50B. Since both the major and minor versions are called out separately in the DP spec it's probably worth mentioning both addresses in the commit message.

Quoted 7 lines

v2: move drm_dp_ds_revision structure to be part of
drm_dp_link structure (Daniel)
v3: remove dependency to drm_dp_helper but instead parse
DPCD and print SW revision info to dmesg (Ville)

With the commit message change requested above, this is:

Quoted 57 lines
---
 drivers/gpu/drm/i915/intel_dp.c | 20 ++++++++++++++++++++
 include/drm/drm_dp_helper.h     |  1 +
 2 files changed, 21 insertions(+)
drivers/gpu/drm/i915/intel_dp.c +20 -0
index 9aebdf6..91ffb79 100644
@@ -1438,6 +1438,25 @@ static void intel_dp_print_hw_revision(struct intel_dp *intel_dp)
 	DRM_DEBUG_KMS("sink hw revision: %d.%d\n", (rev & 0xf0) >> 4, rev & 0xf);
 }
 
+static void intel_dp_print_sw_revision(struct intel_dp *intel_dp)
+{
+	uint8_t rev[2];
+	int len;
+
+	if ((drm_debug & DRM_UT_KMS) == 0)
+		return;
+
+	if (!(intel_dp->dpcd[DP_DOWNSTREAMPORT_PRESENT] &
+	      DP_DWN_STRM_PORT_PRESENT))
+		return;
+
+	len = drm_dp_dpcd_read(&intel_dp->aux, DP_BRANCH_SW_REV, &rev, 2);
+	if (len < 0)
+		return;
+
+	DRM_DEBUG_KMS("sink sw revision: %d.%d\n", rev[0], rev[1]);
+}
+
 static int rate_to_index(int find, const int *rates)
 {
 	int i = 0;
@@ -4302,6 +4321,7 @@ intel_dp_long_pulse(struct intel_connector *intel_connector)
 	intel_dp_probe_oui(intel_dp);
 
 	intel_dp_print_hw_revision(intel_dp);
+	intel_dp_print_sw_revision(intel_dp);
 
 	intel_dp_configure_mst(intel_dp);
 
include/drm/drm_dp_helper.h +1 -0
index 19ac599..215202f 100644
@@ -447,6 +447,7 @@
 #define DP_BRANCH_OUI			    0x500
 #define DP_BRANCH_ID                        0x503
 #define DP_BRANCH_HW_REV                    0x509
+#define DP_BRANCH_SW_REV                    0x50A
 
 #define DP_SET_POWER                        0x600
 # define DP_SET_POWER_D0                    0x1
Signature · 1 line
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#15 lore raw

Re: [PATCH v8 08/12] drm/i915: Read DP branch device SW revision

Quoted 10 lines

-----Original Message-----
From: Jim Bride [mailto:[email protected]]
Sent: Thursday, September 8, 2016 12:20 AM
To: Kahola, Mika <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v8 08/12] drm/i915: Read DP branch device SW revision

Quoted 7 lines
Quoted 2 lines · Mika Kahola

SW revision is mandatory field for DisplayPort branch devices. This is defined in DPCD register field 0x50A.

To be precise, the revision info is in 0x50A and 0x50B. Since both the major and minor versions are called out separately in the DP spec it's probably worth mentioning both addresses in the commit message.

You're right. I will update the commit message to be more exact.

Quoted 68 lines
Quoted 8 lines

v2: move drm_dp_ds_revision structure to be part of
drm_dp_link structure (Daniel)
v3: remove dependency to drm_dp_helper but instead parse
DPCD and print SW revision info to dmesg (Ville)

With the commit message change requested above, this is:

drivers/gpu/drm/i915/intel_dp.c static void intel_dp_print_hw_revision(struct

Quoted 10 lines
---
 drivers/gpu/drm/i915/intel_dp.c | 20 ++++++++++++++++++++
 include/drm/drm_dp_helper.h     |  1 +
 2 files changed, 21 insertions(+)
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/intel_dp.c index 9aebdf6..91ffb79 100644

drivers/gpu/drm/i915/intel_dp.c +0 -0
@@ -1438,6 +1438,25 @@ static void intel_dp_print_hw_revision(struct

intel_dp *intel_dp)

drivers/gpu/drm/i915/intel_dp.c static void intel_dp_print_hw_revision(struct · line 1438

Quoted 1 line
drivers/gpu/drm/i915/intel_dp.c +0 -0
 	DRM_DEBUG_KMS("sink hw revision: %d.%d\n", (rev & 0xf0) >> 4,

rev &

Quoted 4 lines
drivers/gpu/drm/i915/intel_dp.c +2 -0
 0xf);  }
 
+static void intel_dp_print_sw_revision(struct intel_dp *intel_dp) {
+	uint8_t rev[2];

drivers/gpu/drm/i915/intel_dp.c static void intel_dp_print_hw_revision(struct intel_dp *intel_dp)

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +10 -0
+	int len;
+
+	if ((drm_debug & DRM_UT_KMS) == 0)
+		return;
+
+	if (!(intel_dp->dpcd[DP_DOWNSTREAMPORT_PRESENT] &
+	      DP_DWN_STRM_PORT_PRESENT))
+		return;
+
+	len = drm_dp_dpcd_read(&intel_dp->aux, DP_BRANCH_SW_REV,

&rev, 2);

drivers/gpu/drm/i915/intel_dp.c intel_dp_long_pulse(struct intel_connector

Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +5 -0
+	if (len < 0)
+		return;
+
+	DRM_DEBUG_KMS("sink sw revision: %d.%d\n", rev[0], rev[1]); }
+
 static int rate_to_index(int find, const int *rates)  {
 	int i = 0;
@@ -4302,6 +4321,7 @@ intel_dp_long_pulse(struct intel_connector

*intel_connector)

Review

Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +1 -0
 	intel_dp_probe_oui(intel_dp);
 
 	intel_dp_print_hw_revision(intel_dp);
+	intel_dp_print_sw_revision(intel_dp);
 
 	intel_dp_configure_mst(intel_dp);
 
(quoted diff) +0 -0

b/include/drm/drm_dp_helper.h

Quoted 9 lines

index 19ac599..215202f 100644

include/drm/drm_dp_helper.h +1 -0
@@ -447,6 +447,7 @@
 #define DP_BRANCH_OUI			    0x500
 #define DP_BRANCH_ID                        0x503
 #define DP_BRANCH_HW_REV                    0x509
+#define DP_BRANCH_SW_REV                    0x50A
 
Quoted 4 lines
Quoted 4 lines
include/drm/drm_dp_helper.h +0 -1
 #define DP_SET_POWER                        0x600
 # define DP_SET_POWER_D0                    0x1
--

1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#16 lore raw

PATCH v8 9/12 Check pixel rate for DP to VGA dongle

In reply to Mika Kahola

Filter out a mode that exceeds the max pixel rate setting for DP to VGA dongle. This is defined in DPCD register 0x81 if detailed cap info i.e. info field is 4 bytes long and it is available for DP downstream port.

The register defines the pixel rate divided by 8 in MP/s.

v2: DPCD read outs and computation moved to drm (Ville, Daniel)
v3: Sink pixel rate computation moved to drm_dp_max_sink_dotclock()
function (Daniel)
v4: Use of drm_dp_helper.c routines to compute max pixel clock (Ville)
v5: Use of intel_dp->downstream_ports to read out port capabilities.
Code restructuring (Ville)
v6: Move DP branch device check to drm_dp_helper.c (Daniel)
v7: Cleanup as suggested by Ville

---
 drivers/gpu/drm/i915/intel_dp.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp.c +26 -1
index 91ffb79..25f459e 100644
@@ -190,6 +190,29 @@ intel_dp_max_data_rate(int max_link_clock, int max_lanes)
 	return (max_link_clock * max_lanes * 8) / 10;
 }
 
+static int
+intel_dp_downstream_max_dotclock(struct intel_dp *intel_dp)
+{
+	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
+	struct intel_encoder *encoder = &intel_dig_port->base;
+	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+	int max_dotclk = dev_priv->max_dotclk_freq;
+	int ds_max_dotclk;
+
+	int type = intel_dp->downstream_ports[0] & DP_DS_PORT_TYPE_MASK;
+
+	if (type != DP_DS_PORT_TYPE_VGA)
+		return max_dotclk;
+
+	ds_max_dotclk = drm_dp_downstream_max_clock(intel_dp->dpcd,
+						    intel_dp->downstream_ports);
+
+	if (ds_max_dotclk != 0)
+		max_dotclk = min(max_dotclk, ds_max_dotclk);;
+
+	return max_dotclk;
+}
+
 static enum drm_mode_status
 intel_dp_mode_valid(struct drm_connector *connector,
 		    struct drm_display_mode *mode)
@@ -199,7 +222,9 @@ intel_dp_mode_valid(struct drm_connector *connector,
 	struct drm_display_mode *fixed_mode = intel_connector->panel.fixed_mode;
 	int target_clock = mode->clock;
 	int max_rate, mode_rate, max_lanes, max_link_clock;
-	int max_dotclk = to_i915(connector->dev)->max_dotclk_freq;
+	int max_dotclk;
+
+	max_dotclk = intel_dp_downstream_max_dotclock(intel_dp);
 
 	if (is_edp(intel_dp) && fixed_mode) {
 		if (mode->hdisplay > fixed_mode->hdisplay)
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v8 9/12
#17 lore raw

Re: [PATCH v8 09/12] Check pixel rate for DP to VGA dongle

Quoted 16 lines · Mika Kahola

Filter out a mode that exceeds the max pixel rate setting for DP to VGA dongle. This is defined in DPCD register 0x81 if detailed cap info i.e. info field is 4 bytes long and it is available for DP downstream port.

The register defines the pixel rate divided by 8 in MP/s.

v2: DPCD read outs and computation moved to drm (Ville, Daniel)
v3: Sink pixel rate computation moved to drm_dp_max_sink_dotclock()
function (Daniel)
v4: Use of drm_dp_helper.c routines to compute max pixel clock (Ville)
v5: Use of intel_dp->downstream_ports to read out port capabilities.
Code restructuring (Ville)
v6: Move DP branch device check to drm_dp_helper.c (Daniel)
v7: Cleanup as suggested by Ville

Quoted 1 line
Quoted 51 lines
---
 drivers/gpu/drm/i915/intel_dp.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp.c +26 -1
index 91ffb79..25f459e 100644
@@ -190,6 +190,29 @@ intel_dp_max_data_rate(int max_link_clock, int max_lanes)
 	return (max_link_clock * max_lanes * 8) / 10;
 }
 
+static int
+intel_dp_downstream_max_dotclock(struct intel_dp *intel_dp)
+{
+	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
+	struct intel_encoder *encoder = &intel_dig_port->base;
+	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+	int max_dotclk = dev_priv->max_dotclk_freq;
+	int ds_max_dotclk;
+
+	int type = intel_dp->downstream_ports[0] & DP_DS_PORT_TYPE_MASK;
+
+	if (type != DP_DS_PORT_TYPE_VGA)
+		return max_dotclk;
+
+	ds_max_dotclk = drm_dp_downstream_max_clock(intel_dp->dpcd,
+						    intel_dp->downstream_ports);
+
+	if (ds_max_dotclk != 0)
+		max_dotclk = min(max_dotclk, ds_max_dotclk);;
+
+	return max_dotclk;
+}
+
 static enum drm_mode_status
 intel_dp_mode_valid(struct drm_connector *connector,
 		    struct drm_display_mode *mode)
@@ -199,7 +222,9 @@ intel_dp_mode_valid(struct drm_connector *connector,
 	struct drm_display_mode *fixed_mode = intel_connector->panel.fixed_mode;
 	int target_clock = mode->clock;
 	int max_rate, mode_rate, max_lanes, max_link_clock;
-	int max_dotclk = to_i915(connector->dev)->max_dotclk_freq;
+	int max_dotclk;
+
+	max_dotclk = intel_dp_downstream_max_dotclock(intel_dp);
 
 	if (is_edp(intel_dp) && fixed_mode) {
 		if (mode->hdisplay > fixed_mode->hdisplay)
Signature · 1 line
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#18 lore raw

PATCH v8 9/12 drm/i915: Check pixel rate for DP to VGA dongle

In reply to Mika Kahola

Filter out a mode that exceeds the max pixel rate setting for DP to VGA dongle. This is defined in DPCD register 0x81 if detailed cap info i.e. info field is 4 bytes long and it is available for DP downstream port.

The register defines the pixel rate divided by 8 in MP/s.

v2: DPCD read outs and computation moved to drm (Ville, Daniel)
v3: Sink pixel rate computation moved to drm_dp_max_sink_dotclock()
function (Daniel)
v4: Use of drm_dp_helper.c routines to compute max pixel clock (Ville)
v5: Use of intel_dp->downstream_ports to read out port capabilities.
Code restructuring (Ville)
v6: Move DP branch device check to drm_dp_helper.c (Daniel)
v7: Cleanup as suggested by Ville

---
 drivers/gpu/drm/i915/intel_dp.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp.c +26 -1
index 91ffb79..25f459e 100644
@@ -190,6 +190,29 @@ intel_dp_max_data_rate(int max_link_clock, int max_lanes)
 	return (max_link_clock * max_lanes * 8) / 10;
 }
 
+static int
+intel_dp_downstream_max_dotclock(struct intel_dp *intel_dp)
+{
+	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
+	struct intel_encoder *encoder = &intel_dig_port->base;
+	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+	int max_dotclk = dev_priv->max_dotclk_freq;
+	int ds_max_dotclk;
+
+	int type = intel_dp->downstream_ports[0] & DP_DS_PORT_TYPE_MASK;
+
+	if (type != DP_DS_PORT_TYPE_VGA)
+		return max_dotclk;
+
+	ds_max_dotclk = drm_dp_downstream_max_clock(intel_dp->dpcd,
+						    intel_dp->downstream_ports);
+
+	if (ds_max_dotclk != 0)
+		max_dotclk = min(max_dotclk, ds_max_dotclk);;
+
+	return max_dotclk;
+}
+
 static enum drm_mode_status
 intel_dp_mode_valid(struct drm_connector *connector,
 		    struct drm_display_mode *mode)
@@ -199,7 +222,9 @@ intel_dp_mode_valid(struct drm_connector *connector,
 	struct drm_display_mode *fixed_mode = intel_connector->panel.fixed_mode;
 	int target_clock = mode->clock;
 	int max_rate, mode_rate, max_lanes, max_link_clock;
-	int max_dotclk = to_i915(connector->dev)->max_dotclk_freq;
+	int max_dotclk;
+
+	max_dotclk = intel_dp_downstream_max_dotclock(intel_dp);
 
 	if (is_edp(intel_dp) && fixed_mode) {
 		if (mode->hdisplay > fixed_mode->hdisplay)
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#19 lore raw

PATCH v8 10/12 drm/i915: Update bits per component for display info

In reply to Mika Kahola

DisplayPort branch device may define max supported bits per component. Update display info based on this value if bpc is defined.

v2: cleanup to match the drm_dp_helper.c patches introduced
earlier in this series
v3: Fill bpc for connector's display info in separate
drm_dp_helper function (Daniel)
v4: remove updating bpc for display info as it may be overridden
when parsing EDID. Instead, check bpc for DP branch device during compute_config

---
 drivers/gpu/drm/i915/intel_dp.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp.c +16 -1
index 25f459e..17110d1 100644
@@ -1524,6 +1524,20 @@ void intel_dp_compute_rate(struct intel_dp *intel_dp, int port_clock,
 	}
 }
 
+int intel_dp_compute_bpp(struct intel_dp *intel_dp,
+			 struct intel_crtc_state *pipe_config)
+{
+	int bpp, bpc;
+
+	bpp = pipe_config->pipe_bpp;
+	bpc = drm_dp_downstream_max_bpc(intel_dp->dpcd, intel_dp->downstream_ports);
+
+	if (bpc > 0)
+		bpp = min(bpp, 3*bpc);
+
+	return bpp;
+}
+
 bool
 intel_dp_compute_config(struct intel_encoder *encoder,
 			struct intel_crtc_state *pipe_config)
@@ -1589,7 +1603,8 @@ intel_dp_compute_config(struct intel_encoder *encoder,
 
 	/* Walk through all bpp values. Luckily they're all nicely spaced with 2
 	 * bpc in between. */
-	bpp = pipe_config->pipe_bpp;
+	bpp = intel_dp_compute_bpp(intel_dp, pipe_config);
+
 	if (is_edp(intel_dp)) {
 
 		/* Get bpp from vbt only for panels that dont have bpp in edid */
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#20 lore raw

Re: [PATCH v8 10/12] drm/i915: Update bits per component for display info

Quoted 22 lines · Mika Kahola

DisplayPort branch device may define max supported bits per component. Update display info based on this value if bpc is defined.

v2: cleanup to match the drm_dp_helper.c patches introduced
earlier in this series
v3: Fill bpc for connector's display info in separate
drm_dp_helper function (Daniel)
v4: remove updating bpc for display info as it may be overridden
when parsing EDID. Instead, check bpc for DP branch device during compute_config

---
 drivers/gpu/drm/i915/intel_dp.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp.c +0 -0
index 25f459e..17110d1 100644

drivers/gpu/drm/i915/intel_dp.c void intel_dp_compute_rate(struct intel_dp *intel_dp, int port_clock, · line 1528

Quoted 5 lines
drivers/gpu/drm/i915/intel_dp.c +2 -0
@@ -1524,6 +1524,20 @@ void intel_dp_compute_rate(struct intel_dp *intel_dp, int port_clock,
 	}
 }
 
+int intel_dp_compute_bpp(struct intel_dp *intel_dp,
+			 struct intel_crtc_state *pipe_config)

Indentation seems off.

drivers/gpu/drm/i915/intel_dp.c void intel_dp_compute_rate(struct intel_dp *intel_dp, int port_clock, · line 1535

Quoted 7 lines
drivers/gpu/drm/i915/intel_dp.c +7 -0
+{
+	int bpp, bpc;
+
+	bpp = pipe_config->pipe_bpp;
+	bpc = drm_dp_downstream_max_bpc(intel_dp->dpcd, intel_dp->downstream_ports);
+
+	if (bpc > 0)

Do we need to ensure that bpp is sane before this calculation as well?

drivers/gpu/drm/i915/intel_dp.c void intel_dp_compute_rate(struct intel_dp *intel_dp, int port_clock, · line 1543

Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +5 -0
+		bpp = min(bpp, 3*bpc);
+
+	return bpp;
+}
+
 bool
 intel_dp_compute_config(struct intel_encoder *encoder,
 			struct intel_crtc_state *pipe_config)

Indentation again.

Jim

Quoted 12 lines
drivers/gpu/drm/i915/intel_dp.c +2 -1
@@ -1589,7 +1603,8 @@ intel_dp_compute_config(struct intel_encoder *encoder,
 
 	/* Walk through all bpp values. Luckily they're all nicely spaced with 2
 	 * bpc in between. */
-	bpp = pipe_config->pipe_bpp;
+	bpp = intel_dp_compute_bpp(intel_dp, pipe_config);
+
 	if (is_edp(intel_dp)) {
 
 		/* Get bpp from vbt only for panels that dont have bpp in edid */
Signature · 1 line
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#21 lore raw

RE: [PATCH v8 10/12] drm/i915: Update bits per component for display info

Thanks for the review. I'll fix those indentations.

Quoted 40 lines

-----Original Message-----
From: Jim Bride [mailto:[email protected]]
Sent: Thursday, September 8, 2016 12:27 AM
To: Kahola, Mika <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v8 10/12] drm/i915: Update bits per component for display info

drivers/gpu/drm/i915/intel_dp.c void intel_dp_compute_rate(struct intel_dp

Quoted 21 lines · Mika Kahola

DisplayPort branch device may define max supported bits per component. Update display info based on this value if bpc is defined.

v2: cleanup to match the drm_dp_helper.c patches introduced
earlier in this series
v3: Fill bpc for connector's display info in separate
drm_dp_helper function (Daniel)
v4: remove updating bpc for display info as it may be overridden
when parsing EDID. Instead, check bpc for DP branch device during compute_config

---
 drivers/gpu/drm/i915/intel_dp.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/intel_dp.c index 25f459e..17110d1 100644

drivers/gpu/drm/i915/intel_dp.c +0 -0
@@ -1524,6 +1524,20 @@ void intel_dp_compute_rate(struct intel_dp

*intel_dp, int port_clock,

drivers/gpu/drm/i915/intel_dp.c void intel_dp_compute_rate(struct intel_dp *intel_dp, int port_clock, · line 1528

Quoted 5 lines
drivers/gpu/drm/i915/intel_dp.c +2 -0
 	}
 }
 
+int intel_dp_compute_bpp(struct intel_dp *intel_dp,
+			 struct intel_crtc_state *pipe_config)

Indentation seems off.

Quoted 10 lines

drivers/gpu/drm/i915/intel_dp.c void intel_dp_compute_rate(struct intel_dp *intel_dp, int port_clock, · line 1535

Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +8 -0
+{
+	int bpp, bpc;
+
+	bpp = pipe_config->pipe_bpp;
+	bpc = drm_dp_downstream_max_bpc(intel_dp->dpcd,
+intel_dp->downstream_ports);
+
+	if (bpc > 0)

Do we need to ensure that bpp is sane before this calculation as well?

drm_dp_downstream_max_bpc() routine returns 0 if we can't find bpc from DPCD. Therefore bpc sanity is checked so to ensure that bpp has some meaningful value other than 0.

Quoted 24 lines

drivers/gpu/drm/i915/intel_dp.c void intel_dp_compute_rate(struct intel_dp *intel_dp, int port_clock, · line 1543

Quoted 9 lines
drivers/gpu/drm/i915/intel_dp.c +5 -0
+		bpp = min(bpp, 3*bpc);
+
+	return bpp;
+}
+
 bool
 intel_dp_compute_config(struct intel_encoder *encoder,
 			struct intel_crtc_state *pipe_config)

Indentation again.

Jim

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +2 -1
@@ -1589,7 +1603,8 @@ intel_dp_compute_config(struct intel_encoder
 *encoder,
 
 	/* Walk through all bpp values. Luckily they're all nicely spaced with 2
 	 * bpc in between. */
-	bpp = pipe_config->pipe_bpp;
+	bpp = intel_dp_compute_bpp(intel_dp, pipe_config);
+
 	if (is_edp(intel_dp)) {
 
Quoted 4 lines
Quoted 1 line

/* Get bpp from vbt only for panels that dont have bpp in

edid */

Quoted 2 lines

--
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#22 lore raw

PATCH v8 11/12 drm: Add DP branch device info on debugfs

In reply to Mika Kahola

Read DisplayPort branch device info from through debugfs interface.

v2: use drm_dp_helper routines to collect data
v3: cleanup to match the drm_dp_helper.c patches introduced
earlier in this series
v4: move DP branch device info to function 'intel_dp_branch_device_info()'
v5: initial step to move debugging info from intel_dp. to drm_dp_helper.c (Daniel)
v6: read hw and sw revision without using specific drm_dp_helper routines

---
 drivers/gpu/drm/drm_dp_helper.c     | 81 +++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_debugfs.c |  3 ++
 include/drm/drm_dp_helper.h         |  2 +
 3 files changed, 86 insertions(+)
drivers/gpu/drm/drm_dp_helper.c +81 -0
index 01ee7af..23cd6dc 100644
@@ -526,6 +526,87 @@ int drm_dp_downstream_id(struct drm_dp_aux *aux, char id[6])
 }
 EXPORT_SYMBOL(drm_dp_downstream_id);
 
+/**
+ * drm_dp_downstream_debug() - debug DP branch devices
+ * @m: pointer for debugfs file
+ * @dpcd: DisplayPort configuration data
+ * @port_cap: port capabilities
+ * @aux: DisplayPort AUX channel
+ *
+ */
+void drm_dp_downstream_debug(struct seq_file *m, const u8 dpcd[DP_RECEIVER_CAP_SIZE],
+			     const u8 port_cap[4], struct drm_dp_aux *aux)
+{
+	bool detailed_cap_info = dpcd[DP_DOWNSTREAMPORT_PRESENT] &
+		DP_DETAILED_CAP_INFO_AVAILABLE;
+	int clk;
+	int bpc;
+	char id[6];
+	int len;
+	uint8_t rev[2];
+	int type = port_cap[0] & DP_DS_PORT_TYPE_MASK;
+	bool branch_device = dpcd[DP_DOWNSTREAMPORT_PRESENT] & DP_DWN_STRM_PORT_PRESENT;
+
+	seq_printf(m, "\tDP branch device present: %s\n", branch_device ? "yes" : "no");
+
+	if (!branch_device)
+		return;
+
+	switch (type) {
+	case DP_DS_PORT_TYPE_DP:
+		seq_printf(m, "\t\tType: DisplayPort\n");
+		break;
+	case DP_DS_PORT_TYPE_VGA:
+		seq_printf(m, "\t\tType: VGA\n");
+		break;
+	case DP_DS_PORT_TYPE_DVI:
+		seq_printf(m, "\t\tType: DVI\n");
+		break;
+	case DP_DS_PORT_TYPE_HDMI:
+		seq_printf(m, "\t\tType: HDMI\n");
+		break;
+	case DP_DS_PORT_TYPE_NON_EDID:
+		seq_printf(m, "\t\tType: others without EDID support\n");
+		break;
+	case DP_DS_PORT_TYPE_DP_DUALMODE:
+		seq_printf(m, "\t\tType: DP++\n");
+		break;
+	case DP_DS_PORT_TYPE_WIRELESS:
+		seq_printf(m, "\t\tType: Wireless\n");
+		break;
+	default:
+		seq_printf(m, "\t\tType: N/A\n");
+	}
+
+	drm_dp_downstream_id(aux, id);
+	seq_printf(m, "\t\tID: %s\n", id);
+
+	len = drm_dp_dpcd_read(aux, DP_BRANCH_HW_REV, &rev[0], 1);
+	if (len > 0)
+		seq_printf(m, "\t\tHW: %d.%d\n", (rev[0] & 0xf0) >> 4, rev[0] & 0xf);
+
+	len = drm_dp_dpcd_read(aux, DP_BRANCH_SW_REV, &rev, 2);
+	if (len > 0)
+		seq_printf(m, "\t\tSW: %d.%d\n", rev[0], rev[1]);
+
+	if (detailed_cap_info) {
+		clk = drm_dp_downstream_max_clock(dpcd, port_cap);
+
+		if (clk > 0) {
+			if (type == DP_DS_PORT_TYPE_VGA)
+				seq_printf(m, "\t\tMax dot clock: %d kHz\n", clk);
+			else
+				seq_printf(m, "\t\tMax TMDS clock: %d kHz\n", clk);
+		}
+
+		bpc = drm_dp_downstream_max_bpc(dpcd, port_cap);
+
+		if (bpc > 0)
+			seq_printf(m, "\t\tMax bpc: %d\n", bpc);
+	}
+}
+EXPORT_SYMBOL(drm_dp_downstream_debug);
+
 /*
  * I2C-over-AUX implementation
  */
drivers/gpu/drm/i915/i915_debugfs.c +3 -0
index 01ae5ee..90c736f 100644
@@ -2923,6 +2923,9 @@ static void intel_dp_info(struct seq_file *m,
 	seq_printf(m, "\taudio support: %s\n", yesno(intel_dp->has_audio));
 	if (intel_connector->base.connector_type == DRM_MODE_CONNECTOR_eDP)
 		intel_panel_info(m, &intel_connector->panel);
+
+	drm_dp_downstream_debug(m, intel_dp->dpcd, intel_dp->downstream_ports,
+				&intel_dp->aux);
 }
 
 static void intel_hdmi_info(struct seq_file *m,
include/drm/drm_dp_helper.h +2 -0
index 215202f..2a79882 100644
@@ -823,6 +823,8 @@ int drm_dp_downstream_max_clock(const u8 dpcd[DP_RECEIVER_CAP_SIZE],
 int drm_dp_downstream_max_bpc(const u8 dpcd[DP_RECEIVER_CAP_SIZE],
 			      const u8 port_cap[4]);
 int drm_dp_downstream_id(struct drm_dp_aux *aux, char id[6]);
+void drm_dp_downstream_debug(struct seq_file *m, const u8 dpcd[DP_RECEIVER_CAP_SIZE],
+			     const u8 port_cap[4], struct drm_dp_aux *aux);
 
 void drm_dp_aux_init(struct drm_dp_aux *aux);
 int drm_dp_aux_register(struct drm_dp_aux *aux);
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#23 lore raw

Re: [PATCH v8 11/12] drm: Add DP branch device info on debugfs

Quoted 25 lines · Mika Kahola

Read DisplayPort branch device info from through debugfs interface.

v2: use drm_dp_helper routines to collect data
v3: cleanup to match the drm_dp_helper.c patches introduced
earlier in this series
v4: move DP branch device info to function 'intel_dp_branch_device_info()'
v5: initial step to move debugging info from intel_dp. to drm_dp_helper.c (Daniel)
v6: read hw and sw revision without using specific drm_dp_helper routines

---
 drivers/gpu/drm/drm_dp_helper.c     | 81 +++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_debugfs.c |  3 ++
 include/drm/drm_dp_helper.h         |  2 +
 3 files changed, 86 insertions(+)
drivers/gpu/drm/drm_dp_helper.c +0 -0
index 01ee7af..23cd6dc 100644
@@ -526,6 +526,87 @@ int drm_dp_downstream_id(struct drm_dp_aux *aux, char id[6])
 }
 EXPORT_SYMBOL(drm_dp_downstream_id);
 

drivers/gpu/drm/drm_dp_helper.c int drm_dp_downstream_id(struct drm_dp_aux *aux, char id[6]) · line 538

Quoted 10 lines
drivers/gpu/drm/drm_dp_helper.c +10 -0
+/**
+ * drm_dp_downstream_debug() - debug DP branch devices
+ * @m: pointer for debugfs file
+ * @dpcd: DisplayPort configuration data
+ * @port_cap: port capabilities
+ * @aux: DisplayPort AUX channel
+ *
+ */
+void drm_dp_downstream_debug(struct seq_file *m, const u8 dpcd[DP_RECEIVER_CAP_SIZE],
+			     const u8 port_cap[4], struct drm_dp_aux *aux)

Indentation.

drivers/gpu/drm/drm_dp_helper.c int drm_dp_downstream_id(struct drm_dp_aux *aux, char id[6]) · line 541

Quoted 3 lines
drivers/gpu/drm/drm_dp_helper.c +3 -0
+{
+	bool detailed_cap_info = dpcd[DP_DOWNSTREAMPORT_PRESENT] &
+		DP_DETAILED_CAP_INFO_AVAILABLE;

Indentation.

Quoted 90 lines
drivers/gpu/drm/drm_dp_helper.c +68 -0
+	int clk;
+	int bpc;
+	char id[6];
+	int len;
+	uint8_t rev[2];
+	int type = port_cap[0] & DP_DS_PORT_TYPE_MASK;
+	bool branch_device = dpcd[DP_DOWNSTREAMPORT_PRESENT] & DP_DWN_STRM_PORT_PRESENT;
+
+	seq_printf(m, "\tDP branch device present: %s\n", branch_device ? "yes" : "no");
+
+	if (!branch_device)
+		return;
+
+	switch (type) {
+	case DP_DS_PORT_TYPE_DP:
+		seq_printf(m, "\t\tType: DisplayPort\n");
+		break;
+	case DP_DS_PORT_TYPE_VGA:
+		seq_printf(m, "\t\tType: VGA\n");
+		break;
+	case DP_DS_PORT_TYPE_DVI:
+		seq_printf(m, "\t\tType: DVI\n");
+		break;
+	case DP_DS_PORT_TYPE_HDMI:
+		seq_printf(m, "\t\tType: HDMI\n");
+		break;
+	case DP_DS_PORT_TYPE_NON_EDID:
+		seq_printf(m, "\t\tType: others without EDID support\n");
+		break;
+	case DP_DS_PORT_TYPE_DP_DUALMODE:
+		seq_printf(m, "\t\tType: DP++\n");
+		break;
+	case DP_DS_PORT_TYPE_WIRELESS:
+		seq_printf(m, "\t\tType: Wireless\n");
+		break;
+	default:
+		seq_printf(m, "\t\tType: N/A\n");
+	}
+
+	drm_dp_downstream_id(aux, id);
+	seq_printf(m, "\t\tID: %s\n", id);
+
+	len = drm_dp_dpcd_read(aux, DP_BRANCH_HW_REV, &rev[0], 1);
+	if (len > 0)
+		seq_printf(m, "\t\tHW: %d.%d\n", (rev[0] & 0xf0) >> 4, rev[0] & 0xf);
+
+	len = drm_dp_dpcd_read(aux, DP_BRANCH_SW_REV, &rev, 2);
+	if (len > 0)
+		seq_printf(m, "\t\tSW: %d.%d\n", rev[0], rev[1]);
+
+	if (detailed_cap_info) {
+		clk = drm_dp_downstream_max_clock(dpcd, port_cap);
+
+		if (clk > 0) {
+			if (type == DP_DS_PORT_TYPE_VGA)
+				seq_printf(m, "\t\tMax dot clock: %d kHz\n", clk);
+			else
+				seq_printf(m, "\t\tMax TMDS clock: %d kHz\n", clk);
+		}
+
+		bpc = drm_dp_downstream_max_bpc(dpcd, port_cap);
+
+		if (bpc > 0)
+			seq_printf(m, "\t\tMax bpc: %d\n", bpc);
+	}
+}
+EXPORT_SYMBOL(drm_dp_downstream_debug);
+
 /*
  * I2C-over-AUX implementation
  */
drivers/gpu/drm/i915/i915_debugfs.c +3 -0
index 01ae5ee..90c736f 100644
@@ -2923,6 +2923,9 @@ static void intel_dp_info(struct seq_file *m,
 	seq_printf(m, "\taudio support: %s\n", yesno(intel_dp->has_audio));
 	if (intel_connector->base.connector_type == DRM_MODE_CONNECTOR_eDP)
 		intel_panel_info(m, &intel_connector->panel);
+
+	drm_dp_downstream_debug(m, intel_dp->dpcd, intel_dp->downstream_ports,
+				&intel_dp->aux);
 }
 
 static void intel_hdmi_info(struct seq_file *m,
include/drm/drm_dp_helper.h +0 -0
index 215202f..2a79882 100644

include/drm/drm_dp_helper.h int drm_dp_downstream_max_clock(const u8 dpcd[DP_RECEIVER_CAP_SIZE], · line 827

Quoted 5 lines
include/drm/drm_dp_helper.h +2 -0
@@ -823,6 +823,8 @@ int drm_dp_downstream_max_clock(const u8 dpcd[DP_RECEIVER_CAP_SIZE],
 int drm_dp_downstream_max_bpc(const u8 dpcd[DP_RECEIVER_CAP_SIZE],
 			      const u8 port_cap[4]);
 int drm_dp_downstream_id(struct drm_dp_aux *aux, char id[6]);
+void drm_dp_downstream_debug(struct seq_file *m, const u8 dpcd[DP_RECEIVER_CAP_SIZE],
+			     const u8 port_cap[4], struct drm_dp_aux *aux);

Indentation.

Jim

Quoted 5 lines
include/drm/drm_dp_helper.h +0 -0
 void drm_dp_aux_init(struct drm_dp_aux *aux);
 int drm_dp_aux_register(struct drm_dp_aux *aux);
Signature · 1 line
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#24 lore raw

PATCH v8 12/12 drm/i915: Check TMDS clock DP to HDMI dongle

In reply to Mika Kahola

Respect max TMDS clock frequency from DPCD for active DP to HDMI adapters.

---
 drivers/gpu/drm/i915/intel_drv.h  |  3 +++
 drivers/gpu/drm/i915/intel_hdmi.c | 27 +++++++++++++++++++++++++++
 2 files changed, 30 insertions(+)
drivers/gpu/drm/i915/intel_drv.h +3 -0
index 1c700b0..b7fd551 100644
@@ -817,6 +817,9 @@ struct intel_hdmi {
 	i915_reg_t hdmi_reg;
 	int ddc_bus;
 	struct {
+		int max_tmds_clock;
+	} dp_to_hdmi;
+	struct {
 		enum drm_dp_dual_mode_type type;
 		int max_tmds_clock;
 	} dp_dual_mode;
drivers/gpu/drm/i915/intel_hdmi.c +27 -0
index 4df9f38..1469d00 100644
@@ -1204,6 +1204,9 @@ static int hdmi_port_clock_limit(struct intel_hdmi *hdmi,
 	int max_tmds_clock = intel_hdmi_source_max_tmds_clock(to_i915(dev));
 
 	if (respect_downstream_limits) {
+		if (hdmi->dp_to_hdmi.max_tmds_clock)
+			max_tmds_clock = min(max_tmds_clock,
+					     hdmi->dp_to_hdmi.max_tmds_clock);
 		if (hdmi->dp_dual_mode.max_tmds_clock)
 			max_tmds_clock = min(max_tmds_clock,
 					     hdmi->dp_dual_mode.max_tmds_clock);
@@ -1373,11 +1376,33 @@ intel_hdmi_unset_edid(struct drm_connector *connector)
 	intel_hdmi->dp_dual_mode.type = DRM_DP_DUAL_MODE_NONE;
 	intel_hdmi->dp_dual_mode.max_tmds_clock = 0;
 
+	intel_hdmi->dp_to_hdmi.max_tmds_clock = 0;
+
 	kfree(to_intel_connector(connector)->detect_edid);
 	to_intel_connector(connector)->detect_edid = NULL;
 }
 
 static void
+intel_hdmi_dp_adapter_detect(struct drm_connector *connector)
+{
+	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
+	struct intel_digital_port *intel_dig_port =
+		hdmi_to_dig_port(intel_hdmi);
+	struct intel_dp *intel_dp = &intel_dig_port->dp;
+	int type = intel_dp->downstream_ports[0] & DP_DS_PORT_TYPE_MASK;
+
+	if (type != DP_DS_PORT_TYPE_HDMI)
+		return;
+
+	intel_hdmi->dp_to_hdmi.max_tmds_clock =
+		drm_dp_downstream_max_clock(intel_dp->dpcd,
+					    intel_dp->downstream_ports);
+
+	DRM_DEBUG_KMS("DP HDMI adaptor detected (max TMDS clock : %d kHz\n",
+		      intel_hdmi->dp_to_hdmi.max_tmds_clock);
+}
+
+static void
 intel_hdmi_dp_dual_mode_detect(struct drm_connector *connector, bool has_edid)
 {
 	struct drm_i915_private *dev_priv = to_i915(connector->dev);
@@ -1438,6 +1463,8 @@ intel_hdmi_set_edid(struct drm_connector *connector, bool force)
 
 		intel_hdmi_dp_dual_mode_detect(connector, edid != NULL);
 
+		intel_hdmi_dp_adapter_detect(connector);
+
 		intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS);
 	}
 
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v8 12/12
#25 lore raw

Re: [PATCH v8 12/12] drm/i915: Check TMDS clock DP to HDMI dongle

Quoted 4 lines · Mika Kahola

Respect max TMDS clock frequency from DPCD for active DP to HDMI adapters.

Quoted 78 lines
---
 drivers/gpu/drm/i915/intel_drv.h  |  3 +++
 drivers/gpu/drm/i915/intel_hdmi.c | 27 +++++++++++++++++++++++++++
 2 files changed, 30 insertions(+)
drivers/gpu/drm/i915/intel_drv.h +3 -0
index 1c700b0..b7fd551 100644
@@ -817,6 +817,9 @@ struct intel_hdmi {
 	i915_reg_t hdmi_reg;
 	int ddc_bus;
 	struct {
+		int max_tmds_clock;
+	} dp_to_hdmi;
+	struct {
 		enum drm_dp_dual_mode_type type;
 		int max_tmds_clock;
 	} dp_dual_mode;
drivers/gpu/drm/i915/intel_hdmi.c +27 -0
index 4df9f38..1469d00 100644
@@ -1204,6 +1204,9 @@ static int hdmi_port_clock_limit(struct intel_hdmi *hdmi,
 	int max_tmds_clock = intel_hdmi_source_max_tmds_clock(to_i915(dev));
 
 	if (respect_downstream_limits) {
+		if (hdmi->dp_to_hdmi.max_tmds_clock)
+			max_tmds_clock = min(max_tmds_clock,
+					     hdmi->dp_to_hdmi.max_tmds_clock);
 		if (hdmi->dp_dual_mode.max_tmds_clock)
 			max_tmds_clock = min(max_tmds_clock,
 					     hdmi->dp_dual_mode.max_tmds_clock);
@@ -1373,11 +1376,33 @@ intel_hdmi_unset_edid(struct drm_connector *connector)
 	intel_hdmi->dp_dual_mode.type = DRM_DP_DUAL_MODE_NONE;
 	intel_hdmi->dp_dual_mode.max_tmds_clock = 0;
 
+	intel_hdmi->dp_to_hdmi.max_tmds_clock = 0;
+
 	kfree(to_intel_connector(connector)->detect_edid);
 	to_intel_connector(connector)->detect_edid = NULL;
 }
 
 static void
+intel_hdmi_dp_adapter_detect(struct drm_connector *connector)
+{
+	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
+	struct intel_digital_port *intel_dig_port =
+		hdmi_to_dig_port(intel_hdmi);
+	struct intel_dp *intel_dp = &intel_dig_port->dp;
+	int type = intel_dp->downstream_ports[0] & DP_DS_PORT_TYPE_MASK;
+
+	if (type != DP_DS_PORT_TYPE_HDMI)
+		return;
+
+	intel_hdmi->dp_to_hdmi.max_tmds_clock =
+		drm_dp_downstream_max_clock(intel_dp->dpcd,
+					    intel_dp->downstream_ports);
+
+	DRM_DEBUG_KMS("DP HDMI adaptor detected (max TMDS clock : %d kHz\n",
+		      intel_hdmi->dp_to_hdmi.max_tmds_clock);
+}
+
+static void
 intel_hdmi_dp_dual_mode_detect(struct drm_connector *connector, bool has_edid)
 {
 	struct drm_i915_private *dev_priv = to_i915(connector->dev);
@@ -1438,6 +1463,8 @@ intel_hdmi_set_edid(struct drm_connector *connector, bool force)
 
 		intel_hdmi_dp_dual_mode_detect(connector, edid != NULL);
 
+		intel_hdmi_dp_adapter_detect(connector);
+
 		intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS);
 	}
 
Signature · 1 line
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#26 lore raw

Re: [PATCH v8 12/12] drm/i915: Check TMDS clock DP to HDMI dongle

In reply to Mika Kahola
Quoted 52 lines · Mika Kahola

Respect max TMDS clock frequency from DPCD for active DP to HDMI adapters.

---
 drivers/gpu/drm/i915/intel_drv.h  |  3 +++
 drivers/gpu/drm/i915/intel_hdmi.c | 27 +++++++++++++++++++++++++++
 2 files changed, 30 insertions(+)
drivers/gpu/drm/i915/intel_drv.h +3 -0
index 1c700b0..b7fd551 100644
@@ -817,6 +817,9 @@ struct intel_hdmi {
 	i915_reg_t hdmi_reg;
 	int ddc_bus;
 	struct {
+		int max_tmds_clock;
+	} dp_to_hdmi;
+	struct {
 		enum drm_dp_dual_mode_type type;
 		int max_tmds_clock;
 	} dp_dual_mode;
drivers/gpu/drm/i915/intel_hdmi.c +9 -0
index 4df9f38..1469d00 100644
@@ -1204,6 +1204,9 @@ static int hdmi_port_clock_limit(struct intel_hdmi *hdmi,
 	int max_tmds_clock = intel_hdmi_source_max_tmds_clock(to_i915(dev));
 
 	if (respect_downstream_limits) {
+		if (hdmi->dp_to_hdmi.max_tmds_clock)
+			max_tmds_clock = min(max_tmds_clock,
+					     hdmi->dp_to_hdmi.max_tmds_clock);
 		if (hdmi->dp_dual_mode.max_tmds_clock)
 			max_tmds_clock = min(max_tmds_clock,
 					     hdmi->dp_dual_mode.max_tmds_clock);
@@ -1373,11 +1376,33 @@ intel_hdmi_unset_edid(struct drm_connector *connector)
 	intel_hdmi->dp_dual_mode.type = DRM_DP_DUAL_MODE_NONE;
 	intel_hdmi->dp_dual_mode.max_tmds_clock = 0;
 
+	intel_hdmi->dp_to_hdmi.max_tmds_clock = 0;
+
 	kfree(to_intel_connector(connector)->detect_edid);
 	to_intel_connector(connector)->detect_edid = NULL;
 }
 
 static void
+intel_hdmi_dp_adapter_detect(struct drm_connector *connector)
+{
+	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
+	struct intel_digital_port *intel_dig_port =

drivers/gpu/drm/i915/intel_hdmi.c intel_hdmi_unset_edid(struct drm_connector *connector) · line 1399

Quoted 10 lines
drivers/gpu/drm/i915/intel_hdmi.c +10 -0
+		hdmi_to_dig_port(intel_hdmi);
+	struct intel_dp *intel_dp = &intel_dig_port->dp;
+	int type = intel_dp->downstream_ports[0] & DP_DS_PORT_TYPE_MASK;
+
+	if (type != DP_DS_PORT_TYPE_HDMI)
+		return;
+
+	intel_hdmi->dp_to_hdmi.max_tmds_clock =
+		drm_dp_downstream_max_clock(intel_dp->dpcd,
+					    intel_dp->downstream_ports);

Poets driven by intel_hdmi don't have DPCD, so I don't know what this is supposed to achieve.

Quoted 20 lines
drivers/gpu/drm/i915/intel_hdmi.c +8 -0
+
+	DRM_DEBUG_KMS("DP HDMI adaptor detected (max TMDS clock : %d kHz\n",
+		      intel_hdmi->dp_to_hdmi.max_tmds_clock);
+}
+
+static void
 intel_hdmi_dp_dual_mode_detect(struct drm_connector *connector, bool has_edid)
 {
 	struct drm_i915_private *dev_priv = to_i915(connector->dev);
@@ -1438,6 +1463,8 @@ intel_hdmi_set_edid(struct drm_connector *connector, bool force)
 
 		intel_hdmi_dp_dual_mode_detect(connector, edid != NULL);
 
+		intel_hdmi_dp_adapter_detect(connector);
+
 		intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS);
 	}
 
Signature · 1 line
1.9.1
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#27 lore raw

Re: [PATCH v8 12/12] drm/i915: Check TMDS clock DP to HDMI dongle

Quoted 73 lines · Ville Syrjälä
Quoted 72 lines · Mika Kahola

Respect max TMDS clock frequency from DPCD for active DP to HDMI adapters.

---
 drivers/gpu/drm/i915/intel_drv.h  |  3 +++ drivers/gpu/drm/i915/intel_hdmi.c | 27 +++++++++++++++++++++++++++

 2 files changed, 30 insertions(+)
drivers/gpu/drm/i915/intel_drv.h +3 -0
index 1c700b0..b7fd551 100644
@@ -817,6 +817,9 @@ struct intel_hdmi {
  	i915_reg_t hdmi_reg;
  	int ddc_bus;
  	struct {
+		int max_tmds_clock;
+	} dp_to_hdmi;
+	struct {
  		enum drm_dp_dual_mode_type type;
  		int max_tmds_clock;
  	} dp_dual_mode;
drivers/gpu/drm/i915/intel_hdmi.c +0 -0
index 4df9f38..1469d00 100644
@@ -1204,6 +1204,9 @@ static int hdmi_port_clock_limit(struct
 intel_hdmi *hdmi,

  int max_tmds_clock =
intel_hdmi_source_max_tmds_clock(to_i915(dev));

  if (respect_downstream_limits) {

drivers/gpu/drm/i915/intel_hdmi.c +3 -0
+		if (hdmi->dp_to_hdmi.max_tmds_clock)
+			max_tmds_clock = min(max_tmds_clock,
+					     hdmi-
Quoted 1 line

dp_to_hdmi.max_tmds_clock);

  if (hdmi->dp_dual_mode.max_tmds_clock) max_tmds_clock = min(max_tmds_clock, hdmi-

Quoted 1 line

dp_dual_mode.max_tmds_clock);

drivers/gpu/drm/i915/intel_hdmi.c +0 -0
@@ -1373,11 +1376,33 @@ intel_hdmi_unset_edid(struct drm_connector
 *connector)
  	intel_hdmi->dp_dual_mode.type = DRM_DP_DUAL_MODE_NONE;
  	intel_hdmi->dp_dual_mode.max_tmds_clock = 0;

drivers/gpu/drm/i915/intel_hdmi.c +2 -0
+	intel_hdmi->dp_to_hdmi.max_tmds_clock = 0;
+

  kfree(to_intel_connector(connector)->detect_edid); to_intel_connector(connector)->detect_edid = NULL; }

 static void

drivers/gpu/drm/i915/intel_hdmi.c +3 -0
+intel_hdmi_dp_adapter_detect(struct drm_connector *connector)
+{
+	struct intel_hdmi *intel_hdmi =

intel_attached_hdmi(connector);

drivers/gpu/drm/i915/intel_hdmi.c +4 -0
+	struct intel_digital_port *intel_dig_port =
+		hdmi_to_dig_port(intel_hdmi);
+	struct intel_dp *intel_dp = &intel_dig_port->dp;
+	int type = intel_dp->downstream_ports[0] &

DP_DS_PORT_TYPE_MASK;

drivers/gpu/drm/i915/intel_hdmi.c +7 -0
+
+	if (type != DP_DS_PORT_TYPE_HDMI)
+		return;
+
+	intel_hdmi->dp_to_hdmi.max_tmds_clock =
+		drm_dp_downstream_max_clock(intel_dp->dpcd,
+					    intel_dp-
Quoted 3 lines
Quoted 1 line
Quoted 1 line

downstream_ports);

Poets driven by intel_hdmi don't have DPCD, so I don't know what this is supposed to achieve.

My understanding is that these HDMI adapters has DPCD and therefore I placed this function. In addition, I think we should respect the clocks if the adapter provides that information.

Quoted 28 lines
Quoted 28 lines
drivers/gpu/drm/i915/intel_hdmi.c +2 -0
+
+	DRM_DEBUG_KMS("DP HDMI adaptor detected (max TMDS clock :

%d kHz\n",

drivers/gpu/drm/i915/intel_hdmi.c +4 -0
+		      intel_hdmi->dp_to_hdmi.max_tmds_clock);
+}
+
+static void

 intel_hdmi_dp_dual_mode_detect(struct drm_connector *connector, bool has_edid)
 {
  struct drm_i915_private *dev_priv = to_i915(connector-

Quoted 1 line

dev);

drivers/gpu/drm/i915/intel_hdmi.c +0 -0
@@ -1438,6 +1463,8 @@ intel_hdmi_set_edid(struct drm_connector
 *connector, bool force)


  intel_hdmi_dp_dual_mode_detect(connector, edid != NULL);

drivers/gpu/drm/i915/intel_hdmi.c +2 -0
+		intel_hdmi_dp_adapter_detect(connector);
+

  intel_display_power_put(dev_priv,
POWER_DOMAIN_GMBUS);
  }

--
1.9.1

Signature · 6 lines
Mika Kahola - Intel OTC

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#28 lore raw

Re: [PATCH v8 12/12] drm/i915: Check TMDS clock DP to HDMI dongle

Quoted 74 lines · Mika Kahola
Quoted 73 lines · Ville Syrjälä
Quoted 72 lines · Mika Kahola

Respect max TMDS clock frequency from DPCD for active DP to HDMI adapters.

---
 drivers/gpu/drm/i915/intel_drv.h  |  3 +++ drivers/gpu/drm/i915/intel_hdmi.c | 27 +++++++++++++++++++++++++++

 2 files changed, 30 insertions(+)
drivers/gpu/drm/i915/intel_drv.h +3 -0
index 1c700b0..b7fd551 100644
@@ -817,6 +817,9 @@ struct intel_hdmi {
  	i915_reg_t hdmi_reg;
  	int ddc_bus;
  	struct {
+		int max_tmds_clock;
+	} dp_to_hdmi;
+	struct {
  		enum drm_dp_dual_mode_type type;
  		int max_tmds_clock;
  	} dp_dual_mode;
drivers/gpu/drm/i915/intel_hdmi.c +0 -0
index 4df9f38..1469d00 100644
@@ -1204,6 +1204,9 @@ static int hdmi_port_clock_limit(struct
 intel_hdmi *hdmi,

  int max_tmds_clock =
intel_hdmi_source_max_tmds_clock(to_i915(dev));

  if (respect_downstream_limits) {

drivers/gpu/drm/i915/intel_hdmi.c +3 -0
+		if (hdmi->dp_to_hdmi.max_tmds_clock)
+			max_tmds_clock = min(max_tmds_clock,
+					     hdmi-
Quoted 1 line

dp_to_hdmi.max_tmds_clock);

  if (hdmi->dp_dual_mode.max_tmds_clock) max_tmds_clock = min(max_tmds_clock, hdmi-

Quoted 1 line

dp_dual_mode.max_tmds_clock);

drivers/gpu/drm/i915/intel_hdmi.c +0 -0
@@ -1373,11 +1376,33 @@ intel_hdmi_unset_edid(struct drm_connector
 *connector)
  	intel_hdmi->dp_dual_mode.type = DRM_DP_DUAL_MODE_NONE;
  	intel_hdmi->dp_dual_mode.max_tmds_clock = 0;

drivers/gpu/drm/i915/intel_hdmi.c +2 -0
+	intel_hdmi->dp_to_hdmi.max_tmds_clock = 0;
+

  kfree(to_intel_connector(connector)->detect_edid); to_intel_connector(connector)->detect_edid = NULL; }

 static void

drivers/gpu/drm/i915/intel_hdmi.c +3 -0
+intel_hdmi_dp_adapter_detect(struct drm_connector *connector)
+{
+	struct intel_hdmi *intel_hdmi =

intel_attached_hdmi(connector);

drivers/gpu/drm/i915/intel_hdmi.c +4 -0
+	struct intel_digital_port *intel_dig_port =
+		hdmi_to_dig_port(intel_hdmi);
+	struct intel_dp *intel_dp = &intel_dig_port->dp;
+	int type = intel_dp->downstream_ports[0] &

DP_DS_PORT_TYPE_MASK;

drivers/gpu/drm/i915/intel_hdmi.c +7 -0
+
+	if (type != DP_DS_PORT_TYPE_HDMI)
+		return;
+
+	intel_hdmi->dp_to_hdmi.max_tmds_clock =
+		drm_dp_downstream_max_clock(intel_dp->dpcd,
+					    intel_dp-
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line

downstream_ports);

Poets driven by intel_hdmi don't have DPCD, so I don't know what this is supposed to achieve.

My understanding is that these HDMI adapters has DPCD and therefore I placed this function. In addition, I think we should respect the clocks if the adapter provides that information.

Only stuff driven by intel_dp has DPCD.

Quoted 31 lines
Quoted 29 lines
Quoted 29 lines
drivers/gpu/drm/i915/intel_hdmi.c +2 -0
+
+	DRM_DEBUG_KMS("DP HDMI adaptor detected (max TMDS clock :

%d kHz\n",

drivers/gpu/drm/i915/intel_hdmi.c +4 -0
+		      intel_hdmi->dp_to_hdmi.max_tmds_clock);
+}
+
+static void

 intel_hdmi_dp_dual_mode_detect(struct drm_connector *connector, bool has_edid)
 {
  struct drm_i915_private *dev_priv = to_i915(connector-

Quoted 1 line

dev);

drivers/gpu/drm/i915/intel_hdmi.c +0 -0
@@ -1438,6 +1463,8 @@ intel_hdmi_set_edid(struct drm_connector
 *connector, bool force)


  intel_hdmi_dp_dual_mode_detect(connector, edid != NULL);

drivers/gpu/drm/i915/intel_hdmi.c +2 -0
+		intel_hdmi_dp_adapter_detect(connector);
+

  intel_display_power_put(dev_priv,
POWER_DOMAIN_GMBUS);
  }

--
1.9.1

Signature · 1 line
Mika Kahola - Intel OTC
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#29 lore raw

Re: [PATCH v8 12/12] drm/i915: Check TMDS clock DP to HDMI dongle

Quoted 87 lines · Ville Syrjälä
Quoted 86 lines · Mika Kahola
Quoted 84 lines · Ville Syrjälä
Quoted 78 lines · Mika Kahola

Respect max TMDS clock frequency from DPCD for active DP to HDMI adapters.

---
 drivers/gpu/drm/i915/intel_drv.h  |  3 +++
 drivers/gpu/drm/i915/intel_hdmi.c | 27
+++++++++++++++++++++++++++

 2 files changed, 30 insertions(+)
drivers/gpu/drm/i915/intel_drv.h +3 -0
index 1c700b0..b7fd551 100644
@@ -817,6 +817,9 @@ struct intel_hdmi {
  	i915_reg_t hdmi_reg;
  	int ddc_bus;
  	struct {
+		int max_tmds_clock;
+	} dp_to_hdmi;
+	struct {
  		enum drm_dp_dual_mode_type type;
  		int max_tmds_clock;
  	} dp_dual_mode;
drivers/gpu/drm/i915/intel_hdmi.c +0 -0
index 4df9f38..1469d00 100644
@@ -1204,6 +1204,9 @@ static int hdmi_port_clock_limit(struct
 intel_hdmi *hdmi,

  int max_tmds_clock =
intel_hdmi_source_max_tmds_clock(to_i915(dev));

  if (respect_downstream_limits) {

drivers/gpu/drm/i915/intel_hdmi.c +3 -0
+		if (hdmi->dp_to_hdmi.max_tmds_clock)
+			max_tmds_clock = min(max_tmds_clock,
+					     hdmi-
Quoted 2 lines

dp_to_hdmi.max_tmds_clock);

  if (hdmi->dp_dual_mode.max_tmds_clock) max_tmds_clock = min(max_tmds_clock, hdmi-

Quoted 2 lines

dp_dual_mode.max_tmds_clock);

drivers/gpu/drm/i915/intel_hdmi.c +0 -0
@@ -1373,11 +1376,33 @@ intel_hdmi_unset_edid(struct

drm_connector
*connector)
  intel_hdmi->dp_dual_mode.type = DRM_DP_DUAL_MODE_NONE; intel_hdmi->dp_dual_mode.max_tmds_clock = 0;

drivers/gpu/drm/i915/intel_hdmi.c +2 -0
+	intel_hdmi->dp_to_hdmi.max_tmds_clock = 0;
+

  kfree(to_intel_connector(connector)->detect_edid); to_intel_connector(connector)->detect_edid = NULL; }

 static void

drivers/gpu/drm/i915/intel_hdmi.c +3 -0
+intel_hdmi_dp_adapter_detect(struct drm_connector *connector)
+{
+	struct intel_hdmi *intel_hdmi =

intel_attached_hdmi(connector);

drivers/gpu/drm/i915/intel_hdmi.c +4 -0
+	struct intel_digital_port *intel_dig_port =
+		hdmi_to_dig_port(intel_hdmi);
+	struct intel_dp *intel_dp = &intel_dig_port->dp;
+	int type = intel_dp->downstream_ports[0] &

DP_DS_PORT_TYPE_MASK;

drivers/gpu/drm/i915/intel_hdmi.c +7 -0
+
+	if (type != DP_DS_PORT_TYPE_HDMI)
+		return;
+
+	intel_hdmi->dp_to_hdmi.max_tmds_clock =
+		drm_dp_downstream_max_clock(intel_dp->dpcd,
+					    intel_dp-
Quoted 1 line
Quoted 1 line
Quoted 1 line

downstream_ports);

Poets driven by intel_hdmi don't have DPCD, so I don't know what this
is supposed to achieve.

Quoted 6 lines
Quoted 5 lines

My understanding is that these HDMI adapters has DPCD and therefore I
placed this function. In addition, I think we should respect the clocks
if the adapter provides that information.

Only stuff driven by intel_dp has DPCD.

All right. Then this patch can be discarded. Or maybe I move this stuff into intel_dp.

Quoted 39 lines
Quoted 39 lines
Quoted 22 lines
Quoted 22 lines
drivers/gpu/drm/i915/intel_hdmi.c +2 -0
+
+	DRM_DEBUG_KMS("DP HDMI adaptor detected (max TMDS

clock :
%d kHz\n",

drivers/gpu/drm/i915/intel_hdmi.c +4 -0
+		      intel_hdmi->dp_to_hdmi.max_tmds_clock);
+}
+
+static void

 intel_hdmi_dp_dual_mode_detect(struct drm_connector *connector,
bool has_edid)
 {
  struct drm_i915_private *dev_priv = to_i915(connector-

Quoted 2 lines

dev);

Quoted 15 lines
Quoted 9 lines
drivers/gpu/drm/i915/intel_hdmi.c +0 -0
@@ -1438,6 +1463,8 @@ intel_hdmi_set_edid(struct drm_connector
 *connector, bool force)


  intel_hdmi_dp_dual_mode_detect(connector, edid !=
NULL);

drivers/gpu/drm/i915/intel_hdmi.c +2 -0
+		intel_hdmi_dp_adapter_detect(connector);
+
Quoted 6 lines

  intel_display_power_put(dev_priv,
POWER_DOMAIN_GMBUS);
  }

--
1.9.1

--
Mika Kahola - Intel OTC

Signature · 6 lines
Mika Kahola - Intel OTC

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#30 lore raw

✗ Ro.CI.BAT: failure for drm/i915: DP branch devices (rev9)

In reply to Mika Kahola
== Series Details ==

== Series Details ==

Series: drm/i915: DP branch devices (rev9)
URL : https://patchwork.freedesktop.org/series/6658/
State : failure

== Summary ==

Series 6658v9 drm/i915: DP branch devices
http://patchwork.freedesktop.org/api/1.0/series/6658/revisions/9/mbox

Test kms_cursor_legacy:

        Subgroup basic-flip-vs-cursor-legacy:
                pass       -> FAIL       (ro-skl3-i5-6260u)
                pass       -> FAIL       (ro-bdw-i7-5557U)
        Subgroup basic-flip-vs-cursor-varying-size:
                pass       -> FAIL       (ro-byt-n2820)
Test kms_flip:
        Subgroup basic-flip-vs-wf_vblank:
                pass       -> FAIL       (ro-ivb-i7-3770)
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-a:
                dmesg-warn -> PASS       (ro-bdw-i7-5600u)
                dmesg-warn -> SKIP       (ro-bdw-i7-5557U)
                dmesg-warn -> SKIP       (ro-bdw-i5-5250u)
        Subgroup suspend-read-crc-pipe-b:
                dmesg-warn -> SKIP       (ro-bdw-i7-5557U)
fi-hsw-i7-4770k  total:244  pass:222  dwarn:0   dfail:0   fail:0   skip:22 
fi-kbl-qkkr      total:244  pass:185  dwarn:27  dfail:1   fail:3   skip:28 
fi-snb-i7-2600   total:244  pass:202  dwarn:0   dfail:0   fail:0   skip:42 
ro-bdw-i5-5250u  total:240  pass:219  dwarn:2   dfail:0   fail:1   skip:18 
ro-bdw-i7-5557U  total:240  pass:219  dwarn:1   dfail:0   fail:1   skip:19 
ro-bdw-i7-5600u  total:240  pass:207  dwarn:0   dfail:0   fail:1   skip:32 
ro-bsw-n3050     total:240  pass:197  dwarn:0   dfail:0   fail:1   skip:42 
ro-byt-n2820     total:240  pass:198  dwarn:0   dfail:0   fail:2   skip:40 
ro-hsw-i3-4010u  total:240  pass:214  dwarn:0   dfail:0   fail:0   skip:26 
ro-hsw-i7-4770r  total:240  pass:185  dwarn:0   dfail:0   fail:0   skip:55 
ro-ilk1-i5-650   total:235  pass:174  dwarn:0   dfail:0   fail:1   skip:60 
ro-ivb-i7-3770   total:240  pass:204  dwarn:0   dfail:0   fail:1   skip:35 
ro-ivb2-i7-3770  total:240  pass:209  dwarn:0   dfail:0   fail:0   skip:31 
ro-skl3-i5-6260u total:240  pass:222  dwarn:0   dfail:0   fail:4   skip:14 

fi-skl-i7-6700k failed to connect after reboot

Results at /archive/results/CI_IGT_test/RO_Patchwork_1900/

690c6b2 drm-intel-nightly: 2016y-08m-17d-10h-30m-13s UTC integration manifest 281b398 drm/i915: Check TMDS clock DP to HDMI dongle
296e5c8 drm: Add DP branch device info on debugfs
7295310 drm/i915: Update bits per component for display info e315aca drm/i915: Check pixel rate for DP to VGA dongle
d34169d drm/i915: Read DP branch device SW revision
0e42d3d drm/i915: Read DP branch device HW revision
44ad457 drm/i915: Cleanup DisplayPort AUX channel initialization 66b72b4 drm: Read DP branch device id
b1947af drm: Helper to read max bits per component
8909883 drm: Helper to read max clock rate
e37e3e9 drm: Drop VGA from bpc definitions
8a40a51 drm: Add missing DP downstream port types

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx