Skip to contentSkip to conversation

Enable lspcon support for GEN9 devices

PATCH Superseded Shashank Sharma 3 participants 21 messages May 31, 2016 – Jun 1, 2016

Subsystems (3)

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

cover Enable lspcon support for GEN9 devices

LSPCON is essencially a dp++->hdmi adaptor with dual mode of operation. These modes are:
- Level Shifter mode: In LS mode, this device works as a type2 dp->hdmi ===================== passive dongle, which steps up DP++ output to appropriate HDMI 1.4 signal. This mode doesn't do any conversion at the protocol level.

- Protocol Converter mode: In PCON mode, this device acts as a ========================== active DP++->HDMI 2.0 dongle, which converts the DP++ output to compatible HDMI 2.0 output. In PCON mode, lspcon can support 4k@60 outputs, using DP HBR2 mode.

Many of Intel GEN9 devices come with in-built lspcon card in motherboartd down mode. This patch series adds support for lspcon devices in I915 driver.

While unit-testing this code, I was able to see a 4k@60 modeset with:
- BXT-T board
- Single HDMI 4k@60 display (ACER S)
- Ubuntu 14.04 desktop

This patch set is a re-spin of old lspcon patch series, with following design changes / review comments addressed.

Ville:
1. Use DRM_DP_DUAL_MODE APIs for core lspcon probing, as its a dp->hdmi adaptor only.
2. Move lspcon detection code in drm_dp_dual_mode_helper layer, instead of keeping it in i915 layer.

Paulo:
1. Do not create a separate connector for lspcon, re-use the existing ddi layer, with special detection sequence (Mutually agreed by Daniel)

Shashank Sharma (5):
drm: Helper for LSPCON in drm_dp_dual_mode
drm/i915: Add lspcon support for I915 driver
drm/i915: lspcon detection
drm/i915: Parse VBT data for lspcon
drm/i915: Enable lspcon initialization

 drivers/gpu/drm/drm_dp_dual_mode_helper.c |  85 +++++++++++++++
 drivers/gpu/drm/i915/Makefile             |   1 +
 drivers/gpu/drm/i915/i915_drv.h           |   3 +
 drivers/gpu/drm/i915/intel_bios.c         |  44 ++++++++
 drivers/gpu/drm/i915/intel_ddi.c          |  50 ++++++++-
 drivers/gpu/drm/i915/intel_dp.c           |  12 +++
 drivers/gpu/drm/i915/intel_drv.h          |  17 +++
 drivers/gpu/drm/i915/intel_hdmi.c         |  31 +++++-
 drivers/gpu/drm/i915/intel_lspcon.c       | 165 ++++++++++++++++++++++++++++++
 include/drm/drm_dp_dual_mode_helper.h     |  29 ++++++
 10 files changed, 431 insertions(+), 6 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/intel_lspcon.c
Signature · 6 lines
1.9.1

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

PATCH 1/5 drm: Helper for LSPCON in drm_dp_dual_mode

---
 drivers/gpu/drm/drm_dp_dual_mode_helper.c | 85 +++++++++++++++++++++++++++++++
 include/drm/drm_dp_dual_mode_helper.h     | 29 +++++++++++
 2 files changed, 114 insertions(+)
drivers/gpu/drm/drm_dp_dual_mode_helper.c +85 -0
index a7b2a75..11cab25 100644
@@ -148,6 +148,12 @@ static bool is_type2_adaptor(uint8_t adaptor_id)
 			      DP_DUAL_MODE_REV_TYPE2);
 }
 
+bool is_lspcon_adaptor(const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN],
+	const uint8_t adaptor_id)
+{
+	return is_hdmi_adaptor(hdmi_id) && (adaptor_id == 0xa8);
+}
+
 /**
  * drm_dp_dual_mode_detect - Identify the DP dual mode adaptor
  * @adapter: I2C adapter for the DDC bus
@@ -203,6 +209,8 @@ enum drm_dp_dual_mode_type drm_dp_dual_mode_detect(struct i2c_adapter *adapter)
 	ret = drm_dp_dual_mode_read(adapter, DP_DUAL_MODE_ADAPTOR_ID,
 				    &adaptor_id, sizeof(adaptor_id));
 	if (ret == 0) {
+		if (is_lspcon_adaptor(hdmi_id, adaptor_id))
+			return DRM_DP_DUAL_MODE_LSPCON;
 		if (is_type2_adaptor(adaptor_id)) {
 			if (is_hdmi_adaptor(hdmi_id))
 				return DRM_DP_DUAL_MODE_TYPE2_HDMI;
@@ -364,3 +372,80 @@ const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type)
 	}
 }
 EXPORT_SYMBOL(drm_dp_get_dual_mode_type_name);
+
+/**
+ * drm_lspcon_get_current_mode: Get LSPCON's current mode of operation by
+ * by reading offset (0x80, 0x41)
+ * @i2c_adapter: I2C-over-aux adapter
+ *
+ * Returns:
+ * Enum representing current mode of operation
+ */
+enum drm_lspcon_mode
+drm_lspcon_get_current_mode(struct i2c_adapter *adapter)
+{
+	u8 data;
+	int err = 0;
+
+	/* Read Status: i2c over aux */
+	err = drm_dp_dual_mode_read(adapter, DP_DUAL_MODE_LSPCON_CURRENT_MODE,
+			(void *)&data, sizeof(data));
+	if (err < 0) {
+		DRM_ERROR("LSPCON read(0x80, 0x41) failed\n");
+		return DRM_LSPCON_MODE_INVALID;
+	}
+
+	return data & DP_DUAL_MODE_LSPCON_MODE_MASK ?
+		DRM_LSPCON_MODE_PCON : DRM_LSPCON_MODE_LS;
+}
+EXPORT_SYMBOL(drm_lspcon_get_current_mode);
+
+/**
+ * drm_lspcon_change_mode: Change LSPCON's mode of operation by
+ * by writing offset (0x80, 0x40)
+ * @i2c_adapter: I2C-over-aux adapter
+ * @reqd_mode: required mode of operation
+ *
+ * Returns:
+ * 0 on success, -error on failure/timeout
+ */
+int drm_lspcon_change_mode(struct i2c_adapter *adapter,
+	enum drm_lspcon_mode reqd_mode)
+{
+	u8 data;
+	int err;
+	int time_out = 200;
+
+	if (reqd_mode == DRM_LSPCON_MODE_LS)
+		data = ~DP_DUAL_MODE_LSPCON_MODE_MASK;
+	else
+		data = DP_DUAL_MODE_LSPCON_MODE_MASK;
+
+	/* Change mode */
+	err = drm_dp_dual_mode_write(adapter, DP_DUAL_MODE_LSPCON_MODE_CHANGE,
+			&data, sizeof(data));
+	if (err < 0) {
+		DRM_ERROR("LSPCON mode change failed\n");
+		return err;
+	}
+
+	/*
+	* Confirm mode change by reading the status bit.
+	* Sometimes, it takes a while to change the mode,
+	* so wait and retry until time out or done.
+	*/
+	while (time_out) {
+		if (reqd_mode != drm_lspcon_get_current_mode(adapter)) {
+			mdelay(10);
+			time_out -= 10;
+		} else {
+			DRM_DEBUG_KMS("LSPCON mode changed to %s\n",
+			reqd_mode == DRM_LSPCON_MODE_LS ? "LS" : "PCON");
+			return 0;
+		}
+	}
+
+	DRM_ERROR("LSPCON mode change timed out\n");
+	return -EFAULT;
+}
+EXPORT_SYMBOL(drm_lspcon_change_mode);
include/drm/drm_dp_dual_mode_helper.h +29 -0
index e8a9dfd..f335df5 100644
@@ -24,6 +24,7 @@
 #define DRM_DP_DUAL_MODE_HELPER_H
 
 #include <linux/types.h>
+#include <drm/drm_edid.h>
 
 /*
  * Optional for type 1 DVI adaptors
@@ -54,6 +55,9 @@
 #define DP_DUAL_MODE_HDMI_PIN_CTRL 0x21
 #define  DP_DUAL_MODE_CEC_ENABLE 0x01
 #define DP_DUAL_MODE_I2C_SPEED_CTRL 0x22
+#define DP_DUAL_MODE_LSPCON_MODE_CHANGE		0x40
+#define DP_DUAL_MODE_LSPCON_CURRENT_MODE		0x41
+#define DP_DUAL_MODE_LSPCON_MODE_MASK			0x1
 
 struct i2c_adapter;
 
@@ -63,6 +67,20 @@ ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter,
 			       u8 offset, const void *buffer, size_t size);
 
 /**
+* enum drm_lspcon_mode
+* @lspcon_mode_invalid: No idea what's going on
+* @lspcon_mode_ls: Level shifter mode of LSPCON
+*	which drives DP++ to HDMI 1.4 conversion.
+* @lspcon_mode_pcon: Protocol converter mode of LSPCON
+*	which drives DP++ to HDMI 2.0 active conversion.
+*/
+enum drm_lspcon_mode {
+	DRM_LSPCON_MODE_INVALID,
+	DRM_LSPCON_MODE_LS,
+	DRM_LSPCON_MODE_PCON,
+};
+
+/**
  * enum drm_dp_dual_mode_type - Type of the DP dual mode adaptor
  * @DRM_DP_DUAL_MODE_NONE: No DP dual mode adaptor
  * @DRM_DP_DUAL_MODE_UNKNOWN: Could be either none or type 1 DVI adaptor
@@ -70,6 +88,7 @@ ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter,
  * @DRM_DP_DUAL_MODE_TYPE1_HDMI: Type 1 HDMI adaptor
  * @DRM_DP_DUAL_MODE_TYPE2_DVI: Type 2 DVI adaptor
  * @DRM_DP_DUAL_MODE_TYPE2_HDMI: Type 2 HDMI adaptor
+ * @DRM_DP_DUAL_MODE_TYPE2_LSPCON: Level shifter /protocol converter
  */
 enum drm_dp_dual_mode_type {
 	DRM_DP_DUAL_MODE_NONE,
@@ -78,6 +97,7 @@ enum drm_dp_dual_mode_type {
 	DRM_DP_DUAL_MODE_TYPE1_HDMI,
 	DRM_DP_DUAL_MODE_TYPE2_DVI,
 	DRM_DP_DUAL_MODE_TYPE2_HDMI,
+	DRM_DP_DUAL_MODE_LSPCON,
 };
 
 enum drm_dp_dual_mode_type drm_dp_dual_mode_detect(struct i2c_adapter *adapter);
@@ -89,4 +109,13 @@ int drm_dp_dual_mode_set_tmds_output(enum drm_dp_dual_mode_type type,
 				     struct i2c_adapter *adapter, bool enable);
 const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type);
 
+int drm_dp_dual_mode_ioa_read(struct i2c_adapter *adapter, u8 *buffer,
+		u8 offset, u8 no_of_bytes);
+int drm_dp_dual_mode_ioa_write(struct i2c_adapter *adapter, u8 *buffer,
+		u8 offset, u8 no_of_bytes);
+int drm_dp_dual_mode_get_edid(void *data,
+	u8 *buf, unsigned int block, size_t len);
+enum drm_lspcon_mode drm_lspcon_get_current_mode(struct i2c_adapter *adapter);
+int drm_lspcon_change_mode(struct i2c_adapter *adapter,
+		enum drm_lspcon_mode reqd_mode);
 #endif
Signature · 6 lines
1.9.1

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

Re: [PATCH 1/5] drm: Helper for LSPCON in drm_dp_dual_mode

Quoted 11 lines · Shashank Sharma
---
 drivers/gpu/drm/drm_dp_dual_mode_helper.c | 85 +++++++++++++++++++++++++++++++
 include/drm/drm_dp_dual_mode_helper.h     | 29 +++++++++++
 2 files changed, 114 insertions(+)
drivers/gpu/drm/drm_dp_dual_mode_helper.c +0 -0
index a7b2a75..11cab25 100644

drivers/gpu/drm/drm_dp_dual_mode_helper.c static bool is_type2_adaptor(uint8_t adaptor_id) · line 154

Quoted 7 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +4 -0
@@ -148,6 +148,12 @@ static bool is_type2_adaptor(uint8_t adaptor_id)
 			      DP_DUAL_MODE_REV_TYPE2);
 }
 
+bool is_lspcon_adaptor(const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN],
+	const uint8_t adaptor_id)
+{
+	return is_hdmi_adaptor(hdmi_id) && (adaptor_id == 0xa8);

I'd probably make this something like

#define DP_DUAL_MODE_RESERVED_LSPCON 0x08

        return adaptor_id == (DP_DUAL_MODE_TYPE_TYPE2 |
	                      DP_DUAL_MODE_RESERVED_LSPCON |
	                      DP_DUAL_MODE_REV_TYPE2);
Quoted 19 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +5 -0
+}
+
 /**
  * drm_dp_dual_mode_detect - Identify the DP dual mode adaptor
  * @adapter: I2C adapter for the DDC bus
@@ -203,6 +209,8 @@ enum drm_dp_dual_mode_type drm_dp_dual_mode_detect(struct i2c_adapter *adapter)
 	ret = drm_dp_dual_mode_read(adapter, DP_DUAL_MODE_ADAPTOR_ID,
 				    &adaptor_id, sizeof(adaptor_id));
 	if (ret == 0) {
+		if (is_lspcon_adaptor(hdmi_id, adaptor_id))
+			return DRM_DP_DUAL_MODE_LSPCON;
 		if (is_type2_adaptor(adaptor_id)) {
 			if (is_hdmi_adaptor(hdmi_id))
 				return DRM_DP_DUAL_MODE_TYPE2_HDMI;
@@ -364,3 +372,80 @@ const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type)
 	}
 }
 EXPORT_SYMBOL(drm_dp_get_dual_mode_type_name);
+

drivers/gpu/drm/drm_dp_dual_mode_helper.c const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type) · line 385

Quoted 10 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +10 -0
+/**
+ * drm_lspcon_get_current_mode: Get LSPCON's current mode of operation by
+ * by reading offset (0x80, 0x41)
+ * @i2c_adapter: I2C-over-aux adapter
+ *
+ * Returns:
+ * Enum representing current mode of operation
+ */
+enum drm_lspcon_mode
+drm_lspcon_get_current_mode(struct i2c_adapter *adapter)

To match with drm_dp_dual_mode_get_tmds_output() this may want to return the error status, and return the actual mode via a function argument.

As for the name drm_dp_dual_mode_get_lspcon_mode() and drm_dp_dual_mode_set_lspcon_mode() perhaps?
Or drm_lspcon_get_mode()/drm_lspcon_set_mode() perhaps if we want to keep things shorter?

drivers/gpu/drm/drm_dp_dual_mode_helper.c const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type) · line 388

Quoted 3 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +3 -0
+{
+	u8 data;
+	int err = 0;

I used 'ret' in the rest of the code. This is a bit inconsistent.

drivers/gpu/drm/drm_dp_dual_mode_helper.c const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type) · line 392

Quoted 4 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +4 -0
+
+	/* Read Status: i2c over aux */
+	err = drm_dp_dual_mode_read(adapter, DP_DUAL_MODE_LSPCON_CURRENT_MODE,
+			(void *)&data, sizeof(data));

Pointless cast.

drivers/gpu/drm/drm_dp_dual_mode_helper.c const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type) · line 393

Quoted 1 line
drivers/gpu/drm/drm_dp_dual_mode_helper.c +1 -0
+	if (err < 0) {

if (ret) is what I've used elsewhere.

drivers/gpu/drm/drm_dp_dual_mode_helper.c const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type) · line 394

Quoted 1 line
drivers/gpu/drm/drm_dp_dual_mode_helper.c +1 -0
+		DRM_ERROR("LSPCON read(0x80, 0x41) failed\n");

I'm not sure we want and ERROR from a helper. I used DRM_DEBUG_KMS for the other error paths.

Quoted 16 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +16 -0
+		return DRM_LSPCON_MODE_INVALID;
+	}
+
+	return data & DP_DUAL_MODE_LSPCON_MODE_MASK ?
+		DRM_LSPCON_MODE_PCON : DRM_LSPCON_MODE_LS;
+}
+EXPORT_SYMBOL(drm_lspcon_get_current_mode);
+
+/**
+ * drm_lspcon_change_mode: Change LSPCON's mode of operation by
+ * by writing offset (0x80, 0x40)
+ * @i2c_adapter: I2C-over-aux adapter
+ * @reqd_mode: required mode of operation
+ *
+ * Returns:
+ * 0 on success, -error on failure/timeout

drivers/gpu/drm/drm_dp_dual_mode_helper.c const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type) · line 420

Quoted 10 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +10 -0
+ */
+int drm_lspcon_change_mode(struct i2c_adapter *adapter,
+	enum drm_lspcon_mode reqd_mode)
+{
+	u8 data;
+	int err;
+	int time_out = 200;
+
+	if (reqd_mode == DRM_LSPCON_MODE_LS)
+		data = ~DP_DUAL_MODE_LSPCON_MODE_MASK;

Is that really correct?

Quoted 6 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +6 -0
+	else
+		data = DP_DUAL_MODE_LSPCON_MODE_MASK;
+
+	/* Change mode */
+	err = drm_dp_dual_mode_write(adapter, DP_DUAL_MODE_LSPCON_MODE_CHANGE,
+			&data, sizeof(data));

drivers/gpu/drm/drm_dp_dual_mode_helper.c const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type) · line 436

Quoted 10 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +10 -0
+	if (err < 0) {
+		DRM_ERROR("LSPCON mode change failed\n");
+		return err;
+	}
+
+	/*
+	* Confirm mode change by reading the status bit.
+	* Sometimes, it takes a while to change the mode,
+	* so wait and retry until time out or done.
+	*/

indent fail

drivers/gpu/drm/drm_dp_dual_mode_helper.c const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type) · line 439

Quoted 3 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +3 -0
+	while (time_out) {
+		if (reqd_mode != drm_lspcon_get_current_mode(adapter)) {
+			mdelay(10);

mdelay() is bad.

drivers/gpu/drm/drm_dp_dual_mode_helper.c const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type) · line 449

Quoted 10 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +10 -0
+			time_out -= 10;
+		} else {
+			DRM_DEBUG_KMS("LSPCON mode changed to %s\n",
+			reqd_mode == DRM_LSPCON_MODE_LS ? "LS" : "PCON");
+			return 0;
+		}
+	}
+
+	DRM_ERROR("LSPCON mode change timed out\n");
+	return -EFAULT;

EFAULT doens't seem like a sensible error value here. ETIMEDOUT I suppose seems like what we should return.

Quoted 15 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +2 -0
+}
+EXPORT_SYMBOL(drm_lspcon_change_mode);
include/drm/drm_dp_dual_mode_helper.h +1 -0
index e8a9dfd..f335df5 100644
@@ -24,6 +24,7 @@
 #define DRM_DP_DUAL_MODE_HELPER_H
 
 #include <linux/types.h>
+#include <drm/drm_edid.h>
 
 /*
  * Optional for type 1 DVI adaptors

include/drm/drm_dp_dual_mode_helper.h line 57

Quoted 3 lines
include/drm/drm_dp_dual_mode_helper.h +0 -0
@@ -54,6 +55,9 @@
 #define DP_DUAL_MODE_HDMI_PIN_CTRL 0x21
 #define  DP_DUAL_MODE_CEC_ENABLE 0x01
 #define DP_DUAL_MODE_I2C_SPEED_CTRL 0x22

Maybe leave an empty line here to separate the standard regs from the vendor specific ones. Hmm. Actually the vendor register space is 0x30-0x3f, whereas 0x40+ is reserved. But anyway empty line would seem warranted.

include/drm/drm_dp_dual_mode_helper.h line 60

Quoted 3 lines
include/drm/drm_dp_dual_mode_helper.h +3 -0
+#define DP_DUAL_MODE_LSPCON_MODE_CHANGE		0x40
+#define DP_DUAL_MODE_LSPCON_CURRENT_MODE		0x41
+#define DP_DUAL_MODE_LSPCON_MODE_MASK			0x1

Please indent the bit defnition by one space to make it stand out from the reg defines a little.

Quoted 8 lines
include/drm/drm_dp_dual_mode_helper.h +2 -0
 struct i2c_adapter;
 
@@ -63,6 +67,20 @@ ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter,
 			       u8 offset, const void *buffer, size_t size);
 
 /**
+* enum drm_lspcon_mode
+* @lspcon_mode_invalid: No idea what's going on

include/drm/drm_dp_dual_mode_helper.h ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter, · line 81

Quoted 10 lines
include/drm/drm_dp_dual_mode_helper.h +10 -0
+* @lspcon_mode_ls: Level shifter mode of LSPCON
+*	which drives DP++ to HDMI 1.4 conversion.
+* @lspcon_mode_pcon: Protocol converter mode of LSPCON
+*	which drives DP++ to HDMI 2.0 active conversion.
+*/
+enum drm_lspcon_mode {
+	DRM_LSPCON_MODE_INVALID,
+	DRM_LSPCON_MODE_LS,
+	DRM_LSPCON_MODE_PCON,
+};

If we change the _get_mode() thing to return the error status separately from the mode, we won't need the INVALID value.

Quoted 37 lines
include/drm/drm_dp_dual_mode_helper.h +13 -0
+
+/**
  * enum drm_dp_dual_mode_type - Type of the DP dual mode adaptor
  * @DRM_DP_DUAL_MODE_NONE: No DP dual mode adaptor
  * @DRM_DP_DUAL_MODE_UNKNOWN: Could be either none or type 1 DVI adaptor
@@ -70,6 +88,7 @@ ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter,
  * @DRM_DP_DUAL_MODE_TYPE1_HDMI: Type 1 HDMI adaptor
  * @DRM_DP_DUAL_MODE_TYPE2_DVI: Type 2 DVI adaptor
  * @DRM_DP_DUAL_MODE_TYPE2_HDMI: Type 2 HDMI adaptor
+ * @DRM_DP_DUAL_MODE_TYPE2_LSPCON: Level shifter /protocol converter
  */
 enum drm_dp_dual_mode_type {
 	DRM_DP_DUAL_MODE_NONE,
@@ -78,6 +97,7 @@ enum drm_dp_dual_mode_type {
 	DRM_DP_DUAL_MODE_TYPE1_HDMI,
 	DRM_DP_DUAL_MODE_TYPE2_DVI,
 	DRM_DP_DUAL_MODE_TYPE2_HDMI,
+	DRM_DP_DUAL_MODE_LSPCON,
 };
 
 enum drm_dp_dual_mode_type drm_dp_dual_mode_detect(struct i2c_adapter *adapter);
@@ -89,4 +109,13 @@ int drm_dp_dual_mode_set_tmds_output(enum drm_dp_dual_mode_type type,
 				     struct i2c_adapter *adapter, bool enable);
 const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type);
 
+int drm_dp_dual_mode_ioa_read(struct i2c_adapter *adapter, u8 *buffer,
+		u8 offset, u8 no_of_bytes);
+int drm_dp_dual_mode_ioa_write(struct i2c_adapter *adapter, u8 *buffer,
+		u8 offset, u8 no_of_bytes);
+int drm_dp_dual_mode_get_edid(void *data,
+	u8 *buf, unsigned int block, size_t len);
+enum drm_lspcon_mode drm_lspcon_get_current_mode(struct i2c_adapter *adapter);
+int drm_lspcon_change_mode(struct i2c_adapter *adapter,
+		enum drm_lspcon_mode reqd_mode);
 #endif
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
#3 lore raw

Re: [PATCH 1/5] drm: Helper for LSPCON in drm_dp_dual_mode

Thanks for the review, Ville.
My comments, inline.

Regards
Shashank

Quoted 23 lines · Ville Syrjälä
Quoted 11 lines · Shashank Sharma
---
  drivers/gpu/drm/drm_dp_dual_mode_helper.c | 85 +++++++++++++++++++++++++++++++
  include/drm/drm_dp_dual_mode_helper.h     | 29 +++++++++++
  2 files changed, 114 insertions(+)
drivers/gpu/drm/drm_dp_dual_mode_helper.c +0 -0
index a7b2a75..11cab25 100644

drivers/gpu/drm/drm_dp_dual_mode_helper.c static bool is_type2_adaptor(uint8_t adaptor_id) · line 154

Quoted 7 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +4 -0
@@ -148,6 +148,12 @@ static bool is_type2_adaptor(uint8_t adaptor_id)
  			      DP_DUAL_MODE_REV_TYPE2);
  }
 
+bool is_lspcon_adaptor(const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN],
+	const uint8_t adaptor_id)
+{
+	return is_hdmi_adaptor(hdmi_id) && (adaptor_id == 0xa8);

I'd probably make this something like

Quoted 6 lines

#define DP_DUAL_MODE_RESERVED_LSPCON 0x08

         return adaptor_id == (DP_DUAL_MODE_TYPE_TYPE2 |
	                      DP_DUAL_MODE_RESERVED_LSPCON |
	                      DP_DUAL_MODE_REV_TYPE2);

Thanks, this is a good suggestion, I will do so.

Quoted 26 lines
Quoted 26 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +11 -0
+}
+
  /**
   * drm_dp_dual_mode_detect - Identify the DP dual mode adaptor
   * @adapter: I2C adapter for the DDC bus
@@ -203,6 +209,8 @@ enum drm_dp_dual_mode_type drm_dp_dual_mode_detect(struct i2c_adapter *adapter)
  	ret = drm_dp_dual_mode_read(adapter, DP_DUAL_MODE_ADAPTOR_ID,
  				    &adaptor_id, sizeof(adaptor_id));
  	if (ret == 0) {
+		if (is_lspcon_adaptor(hdmi_id, adaptor_id))
+			return DRM_DP_DUAL_MODE_LSPCON;
  		if (is_type2_adaptor(adaptor_id)) {
  			if (is_hdmi_adaptor(hdmi_id))
  				return DRM_DP_DUAL_MODE_TYPE2_HDMI;
@@ -364,3 +372,80 @@ const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type)
  	}
  }
  EXPORT_SYMBOL(drm_dp_get_dual_mode_type_name);
+
+/**
+ * drm_lspcon_get_current_mode: Get LSPCON's current mode of operation by
+ * by reading offset (0x80, 0x41)
+ * @i2c_adapter: I2C-over-aux adapter
+ *
+ * Returns:
Quoted 9 lines

drivers/gpu/drm/drm_dp_dual_mode_helper.c const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type) · line 385

Quoted 4 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +4 -0
+ * Enum representing current mode of operation
+ */
+enum drm_lspcon_mode
+drm_lspcon_get_current_mode(struct i2c_adapter *adapter)

To match with drm_dp_dual_mode_get_tmds_output() this may want to return the error status, and return the actual mode via a function argument.

sure, can be done.

Quoted 5 lines

As for the name drm_dp_dual_mode_get_lspcon_mode() and drm_dp_dual_mode_set_lspcon_mode() perhaps?
Or drm_lspcon_get_mode()/drm_lspcon_set_mode() perhaps if we want to keep things shorter?

Yep, initially I made the same names as you suggested, but drm_dp_dual_mode_get_lspcon_mode dint sound good to me :). drm_lspcon_get/set_mode sounds good.

Quoted 5 lines

drivers/gpu/drm/drm_dp_dual_mode_helper.c const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type) · line 388

Quoted 3 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +3 -0
+{
+	u8 data;
+	int err = 0;

I used 'ret' in the rest of the code. This is a bit inconsistent.

got it.

Quoted 8 lines

drivers/gpu/drm/drm_dp_dual_mode_helper.c const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type) · line 392

Quoted 5 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +4 -0
+
+	/* Read Status: i2c over aux */
+	err = drm_dp_dual_mode_read(adapter, DP_DUAL_MODE_LSPCON_CURRENT_MODE,
+			(void *)&data, sizeof(data));

Pointless cast.

good catch, this is unnecessary.

Quoted 3 lines

drivers/gpu/drm/drm_dp_dual_mode_helper.c const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type) · line 393

Quoted 1 line
drivers/gpu/drm/drm_dp_dual_mode_helper.c +1 -0
+	if (err < 0) {

if (ret) is what I've used elsewhere.

got it.

Quoted 6 lines

drivers/gpu/drm/drm_dp_dual_mode_helper.c const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type) · line 394

Quoted 2 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +1 -0
+		DRM_ERROR("LSPCON read(0x80, 0x41) failed\n");

I'm not sure we want and ERROR from a helper. I used DRM_DEBUG_KMS for the other error paths.

IMHO, This is a failure which needs notice, as it can point out to a HW level problem, or a problem in LSPCON FW, so I will prefer to keep it as error.

Quoted 20 lines
Quoted 20 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +20 -0
+		return DRM_LSPCON_MODE_INVALID;
+	}
+
+	return data & DP_DUAL_MODE_LSPCON_MODE_MASK ?
+		DRM_LSPCON_MODE_PCON : DRM_LSPCON_MODE_LS;
+}
+EXPORT_SYMBOL(drm_lspcon_get_current_mode);
+
+/**
+ * drm_lspcon_change_mode: Change LSPCON's mode of operation by
+ * by writing offset (0x80, 0x40)
+ * @i2c_adapter: I2C-over-aux adapter
+ * @reqd_mode: required mode of operation
+ *
+ * Returns:
+ * 0 on success, -error on failure/timeout
+ */
+int drm_lspcon_change_mode(struct i2c_adapter *adapter,
+	enum drm_lspcon_mode reqd_mode)
+{
Quoted 9 lines

drivers/gpu/drm/drm_dp_dual_mode_helper.c const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type) · line 420

Quoted 6 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +6 -0
+	u8 data;
+	int err;
+	int time_out = 200;
+
+	if (reqd_mode == DRM_LSPCON_MODE_LS)
+		data = ~DP_DUAL_MODE_LSPCON_MODE_MASK;

Is that really correct?

Oops, it was a blunder, but fortunately that register only bothers about bit 0, and that's why it worked, I will fix this.

Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +10 -0
+	else
+		data = DP_DUAL_MODE_LSPCON_MODE_MASK;
+
+	/* Change mode */
+	err = drm_dp_dual_mode_write(adapter, DP_DUAL_MODE_LSPCON_MODE_CHANGE,
+			&data, sizeof(data));
+	if (err < 0) {
+		DRM_ERROR("LSPCON mode change failed\n");
+		return err;
+	}
Quoted 8 lines

drivers/gpu/drm/drm_dp_dual_mode_helper.c const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type) · line 436

Quoted 6 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +6 -0
+
+	/*
+	* Confirm mode change by reading the status bit.
+	* Sometimes, it takes a while to change the mode,
+	* so wait and retry until time out or done.
+	*/

indent fail

OK.

Quoted 6 lines

drivers/gpu/drm/drm_dp_dual_mode_helper.c const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type) · line 439

Quoted 4 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +3 -0
+	while (time_out) {
+		if (reqd_mode != drm_lspcon_get_current_mode(adapter)) {
+			mdelay(10);

mdelay() is bad.

Do you think I should replace with some of the non-busy wait (like msleep or so ?)

Quoted 14 lines

drivers/gpu/drm/drm_dp_dual_mode_helper.c const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type) · line 449

Quoted 11 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +10 -0
+			time_out -= 10;
+		} else {
+			DRM_DEBUG_KMS("LSPCON mode changed to %s\n",
+			reqd_mode == DRM_LSPCON_MODE_LS ? "LS" : "PCON");
+			return 0;
+		}
+	}
+
+	DRM_ERROR("LSPCON mode change timed out\n");
+	return -EFAULT;

EFAULT doens't seem like a sensible error value here. ETIMEDOUT I suppose seems like what we should return.

Sure.

Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +2 -0
+}
+EXPORT_SYMBOL(drm_lspcon_change_mode);
include/drm/drm_dp_dual_mode_helper.h +1 -0
index e8a9dfd..f335df5 100644
@@ -24,6 +24,7 @@
  #define DRM_DP_DUAL_MODE_HELPER_H
 
  #include <linux/types.h>
+#include <drm/drm_edid.h>
 
Quoted 12 lines

include/drm/drm_dp_dual_mode_helper.h line 57

Quoted 6 lines
include/drm/drm_dp_dual_mode_helper.h +0 -0
  /*
   * Optional for type 1 DVI adaptors
@@ -54,6 +55,9 @@
  #define DP_DUAL_MODE_HDMI_PIN_CTRL 0x21
  #define  DP_DUAL_MODE_CEC_ENABLE 0x01
  #define DP_DUAL_MODE_I2C_SPEED_CTRL 0x22

Maybe leave an empty line here to separate the standard regs from the vendor specific ones. Hmm. Actually the vendor register space is 0x30-0x3f, whereas 0x40+ is reserved. But anyway empty line would seem warranted.

Got it.

Quoted 7 lines

include/drm/drm_dp_dual_mode_helper.h line 60

Quoted 3 lines
include/drm/drm_dp_dual_mode_helper.h +3 -0
+#define DP_DUAL_MODE_LSPCON_MODE_CHANGE		0x40
+#define DP_DUAL_MODE_LSPCON_CURRENT_MODE		0x41
+#define DP_DUAL_MODE_LSPCON_MODE_MASK			0x1

Please indent the bit defnition by one space to make it stand out from the reg defines a little.

Ok, the first two are registers only, I guess this is for DP_DUAL_MODE_LSPCON_MODE_MASK. I will align it.

Quoted 5 lines
Quoted 5 lines
include/drm/drm_dp_dual_mode_helper.h +0 -0
  struct i2c_adapter;
 
@@ -63,6 +67,20 @@ ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter,
  			       u8 offset, const void *buffer, size_t size);
 
Quoted 17 lines

include/drm/drm_dp_dual_mode_helper.h ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter, · line 81

Quoted 13 lines
include/drm/drm_dp_dual_mode_helper.h +12 -0
  /**
+* enum drm_lspcon_mode
+* @lspcon_mode_invalid: No idea what's going on
+* @lspcon_mode_ls: Level shifter mode of LSPCON
+*	which drives DP++ to HDMI 1.4 conversion.
+* @lspcon_mode_pcon: Protocol converter mode of LSPCON
+*	which drives DP++ to HDMI 2.0 active conversion.
+*/
+enum drm_lspcon_mode {
+	DRM_LSPCON_MODE_INVALID,
+	DRM_LSPCON_MODE_LS,
+	DRM_LSPCON_MODE_PCON,
+};

If we change the _get_mode() thing to return the error status separately from the mode, we won't need the INVALID value.

Agree.

Quoted 25 lines
Quoted 25 lines
include/drm/drm_dp_dual_mode_helper.h +4 -0
+
+/**
   * enum drm_dp_dual_mode_type - Type of the DP dual mode adaptor
   * @DRM_DP_DUAL_MODE_NONE: No DP dual mode adaptor
   * @DRM_DP_DUAL_MODE_UNKNOWN: Could be either none or type 1 DVI adaptor
@@ -70,6 +88,7 @@ ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter,
   * @DRM_DP_DUAL_MODE_TYPE1_HDMI: Type 1 HDMI adaptor
   * @DRM_DP_DUAL_MODE_TYPE2_DVI: Type 2 DVI adaptor
   * @DRM_DP_DUAL_MODE_TYPE2_HDMI: Type 2 HDMI adaptor
+ * @DRM_DP_DUAL_MODE_TYPE2_LSPCON: Level shifter /protocol converter
   */
  enum drm_dp_dual_mode_type {
  	DRM_DP_DUAL_MODE_NONE,
@@ -78,6 +97,7 @@ enum drm_dp_dual_mode_type {
  	DRM_DP_DUAL_MODE_TYPE1_HDMI,
  	DRM_DP_DUAL_MODE_TYPE2_DVI,
  	DRM_DP_DUAL_MODE_TYPE2_HDMI,
+	DRM_DP_DUAL_MODE_LSPCON,
  };
 
  enum drm_dp_dual_mode_type drm_dp_dual_mode_detect(struct i2c_adapter *adapter);
@@ -89,4 +109,13 @@ int drm_dp_dual_mode_set_tmds_output(enum drm_dp_dual_mode_type type,
  				     struct i2c_adapter *adapter, bool enable);
  const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type);
 
Quoted 13 lines
Quoted 11 lines
include/drm/drm_dp_dual_mode_helper.h +9 -1
+int drm_dp_dual_mode_ioa_read(struct i2c_adapter *adapter, u8 *buffer,
+		u8 offset, u8 no_of_bytes);
+int drm_dp_dual_mode_ioa_write(struct i2c_adapter *adapter, u8 *buffer,
+		u8 offset, u8 no_of_bytes);
+int drm_dp_dual_mode_get_edid(void *data,
+	u8 *buf, unsigned int block, size_t len);
+enum drm_lspcon_mode drm_lspcon_get_current_mode(struct i2c_adapter *adapter);
+int drm_lspcon_change_mode(struct i2c_adapter *adapter,
+		enum drm_lspcon_mode reqd_mode);
  #endif
--
Quoted 1 line

1.9.1

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

#4 lore raw

Re: [PATCH 1/5] drm: Helper for LSPCON in drm_dp_dual_mode

Quoted 100 lines · Shashank

Thanks for the review, Ville.
My comments, inline.

Regards
Shashank

Quoted 23 lines · Ville Syrjälä
Quoted 11 lines · Shashank Sharma
---
  drivers/gpu/drm/drm_dp_dual_mode_helper.c | 85 +++++++++++++++++++++++++++++++
  include/drm/drm_dp_dual_mode_helper.h     | 29 +++++++++++
  2 files changed, 114 insertions(+)
drivers/gpu/drm/drm_dp_dual_mode_helper.c +0 -0
index a7b2a75..11cab25 100644

drivers/gpu/drm/drm_dp_dual_mode_helper.c static bool is_type2_adaptor(uint8_t adaptor_id) · line 154

Quoted 7 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +4 -0
@@ -148,6 +148,12 @@ static bool is_type2_adaptor(uint8_t adaptor_id)
  			      DP_DUAL_MODE_REV_TYPE2);
  }
 
+bool is_lspcon_adaptor(const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN],
+	const uint8_t adaptor_id)
+{
+	return is_hdmi_adaptor(hdmi_id) && (adaptor_id == 0xa8);

I'd probably make this something like

Quoted 6 lines

#define DP_DUAL_MODE_RESERVED_LSPCON 0x08

         return adaptor_id == (DP_DUAL_MODE_TYPE_TYPE2 |
	                      DP_DUAL_MODE_RESERVED_LSPCON |
	                      DP_DUAL_MODE_REV_TYPE2);

Thanks, this is a good suggestion, I will do so.

Quoted 26 lines
Quoted 26 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +11 -0
+}
+
  /**
   * drm_dp_dual_mode_detect - Identify the DP dual mode adaptor
   * @adapter: I2C adapter for the DDC bus
@@ -203,6 +209,8 @@ enum drm_dp_dual_mode_type drm_dp_dual_mode_detect(struct i2c_adapter *adapter)
  	ret = drm_dp_dual_mode_read(adapter, DP_DUAL_MODE_ADAPTOR_ID,
  				    &adaptor_id, sizeof(adaptor_id));
  	if (ret == 0) {
+		if (is_lspcon_adaptor(hdmi_id, adaptor_id))
+			return DRM_DP_DUAL_MODE_LSPCON;
  		if (is_type2_adaptor(adaptor_id)) {
  			if (is_hdmi_adaptor(hdmi_id))
  				return DRM_DP_DUAL_MODE_TYPE2_HDMI;
@@ -364,3 +372,80 @@ const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type)
  	}
  }
  EXPORT_SYMBOL(drm_dp_get_dual_mode_type_name);
+
+/**
+ * drm_lspcon_get_current_mode: Get LSPCON's current mode of operation by
+ * by reading offset (0x80, 0x41)
+ * @i2c_adapter: I2C-over-aux adapter
+ *
+ * Returns:
Quoted 9 lines

drivers/gpu/drm/drm_dp_dual_mode_helper.c const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type) · line 385

Quoted 4 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +4 -0
+ * Enum representing current mode of operation
+ */
+enum drm_lspcon_mode
+drm_lspcon_get_current_mode(struct i2c_adapter *adapter)

To match with drm_dp_dual_mode_get_tmds_output() this may want to return the error status, and return the actual mode via a function argument.

sure, can be done.

Quoted 5 lines

As for the name drm_dp_dual_mode_get_lspcon_mode() and drm_dp_dual_mode_set_lspcon_mode() perhaps?
Or drm_lspcon_get_mode()/drm_lspcon_set_mode() perhaps if we want to keep things shorter?

Yep, initially I made the same names as you suggested, but drm_dp_dual_mode_get_lspcon_mode dint sound good to me :). drm_lspcon_get/set_mode sounds good.

Quoted 5 lines

drivers/gpu/drm/drm_dp_dual_mode_helper.c const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type) · line 388

Quoted 3 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +3 -0
+{
+	u8 data;
+	int err = 0;

I used 'ret' in the rest of the code. This is a bit inconsistent.

got it.

Quoted 8 lines

drivers/gpu/drm/drm_dp_dual_mode_helper.c const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type) · line 392

Quoted 5 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +4 -0
+
+	/* Read Status: i2c over aux */
+	err = drm_dp_dual_mode_read(adapter, DP_DUAL_MODE_LSPCON_CURRENT_MODE,
+			(void *)&data, sizeof(data));

Pointless cast.

good catch, this is unnecessary.

Quoted 3 lines

drivers/gpu/drm/drm_dp_dual_mode_helper.c const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type) · line 393

Quoted 1 line
drivers/gpu/drm/drm_dp_dual_mode_helper.c +1 -0
+	if (err < 0) {

if (ret) is what I've used elsewhere.

got it.

Quoted 1 line
Quoted 8 lines
Quoted 5 lines

drivers/gpu/drm/drm_dp_dual_mode_helper.c const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type) · line 394

Quoted 1 line
drivers/gpu/drm/drm_dp_dual_mode_helper.c +1 -0
+		DRM_ERROR("LSPCON read(0x80, 0x41) failed\n");

I'm not sure we want and ERROR from a helper. I used DRM_DEBUG_KMS for the other error paths.

IMHO, This is a failure which needs notice, as it can point out to a HW level problem, or a problem in LSPCON FW, so I will prefer to keep it as error.

Fair enough.

Quoted 51 lines
Quoted 20 lines
Quoted 20 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +20 -0
+		return DRM_LSPCON_MODE_INVALID;
+	}
+
+	return data & DP_DUAL_MODE_LSPCON_MODE_MASK ?
+		DRM_LSPCON_MODE_PCON : DRM_LSPCON_MODE_LS;
+}
+EXPORT_SYMBOL(drm_lspcon_get_current_mode);
+
+/**
+ * drm_lspcon_change_mode: Change LSPCON's mode of operation by
+ * by writing offset (0x80, 0x40)
+ * @i2c_adapter: I2C-over-aux adapter
+ * @reqd_mode: required mode of operation
+ *
+ * Returns:
+ * 0 on success, -error on failure/timeout
+ */
+int drm_lspcon_change_mode(struct i2c_adapter *adapter,
+	enum drm_lspcon_mode reqd_mode)
+{
Quoted 9 lines

drivers/gpu/drm/drm_dp_dual_mode_helper.c const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type) · line 420

Quoted 6 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +6 -0
+	u8 data;
+	int err;
+	int time_out = 200;
+
+	if (reqd_mode == DRM_LSPCON_MODE_LS)
+		data = ~DP_DUAL_MODE_LSPCON_MODE_MASK;

Is that really correct?

Oops, it was a blunder, but fortunately that register only bothers about bit 0, and that's why it worked, I will fix this.

Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +10 -0
+	else
+		data = DP_DUAL_MODE_LSPCON_MODE_MASK;
+
+	/* Change mode */
+	err = drm_dp_dual_mode_write(adapter, DP_DUAL_MODE_LSPCON_MODE_CHANGE,
+			&data, sizeof(data));
+	if (err < 0) {
+		DRM_ERROR("LSPCON mode change failed\n");
+		return err;
+	}
Quoted 8 lines

drivers/gpu/drm/drm_dp_dual_mode_helper.c const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type) · line 436

Quoted 6 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +6 -0
+
+	/*
+	* Confirm mode change by reading the status bit.
+	* Sometimes, it takes a while to change the mode,
+	* so wait and retry until time out or done.
+	*/

indent fail

OK.

Quoted 1 line
Quoted 7 lines
Quoted 5 lines

drivers/gpu/drm/drm_dp_dual_mode_helper.c const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type) · line 439

Quoted 3 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +3 -0
+	while (time_out) {
+		if (reqd_mode != drm_lspcon_get_current_mode(adapter)) {
+			mdelay(10);

mdelay() is bad.

Do you think I should replace with some of the non-busy wait (like msleep or so ?)

How long would we typically have to wait for the mode to change?

Quoted 111 lines
Quoted 14 lines

drivers/gpu/drm/drm_dp_dual_mode_helper.c const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type) · line 449

Quoted 11 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +10 -0
+			time_out -= 10;
+		} else {
+			DRM_DEBUG_KMS("LSPCON mode changed to %s\n",
+			reqd_mode == DRM_LSPCON_MODE_LS ? "LS" : "PCON");
+			return 0;
+		}
+	}
+
+	DRM_ERROR("LSPCON mode change timed out\n");
+	return -EFAULT;

EFAULT doens't seem like a sensible error value here. ETIMEDOUT I suppose seems like what we should return.

Sure.

Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +2 -0
+}
+EXPORT_SYMBOL(drm_lspcon_change_mode);
include/drm/drm_dp_dual_mode_helper.h +1 -0
index e8a9dfd..f335df5 100644
@@ -24,6 +24,7 @@
  #define DRM_DP_DUAL_MODE_HELPER_H
 
  #include <linux/types.h>
+#include <drm/drm_edid.h>
 
Quoted 12 lines

include/drm/drm_dp_dual_mode_helper.h line 57

Quoted 6 lines
include/drm/drm_dp_dual_mode_helper.h +0 -0
  /*
   * Optional for type 1 DVI adaptors
@@ -54,6 +55,9 @@
  #define DP_DUAL_MODE_HDMI_PIN_CTRL 0x21
  #define  DP_DUAL_MODE_CEC_ENABLE 0x01
  #define DP_DUAL_MODE_I2C_SPEED_CTRL 0x22

Maybe leave an empty line here to separate the standard regs from the vendor specific ones. Hmm. Actually the vendor register space is 0x30-0x3f, whereas 0x40+ is reserved. But anyway empty line would seem warranted.

Got it.

Quoted 7 lines

include/drm/drm_dp_dual_mode_helper.h line 60

Quoted 3 lines
include/drm/drm_dp_dual_mode_helper.h +3 -0
+#define DP_DUAL_MODE_LSPCON_MODE_CHANGE		0x40
+#define DP_DUAL_MODE_LSPCON_CURRENT_MODE		0x41
+#define DP_DUAL_MODE_LSPCON_MODE_MASK			0x1

Please indent the bit defnition by one space to make it stand out from the reg defines a little.

Ok, the first two are registers only, I guess this is for DP_DUAL_MODE_LSPCON_MODE_MASK. I will align it.

Quoted 5 lines
Quoted 5 lines
include/drm/drm_dp_dual_mode_helper.h +0 -0
  struct i2c_adapter;
 
@@ -63,6 +67,20 @@ ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter,
  			       u8 offset, const void *buffer, size_t size);
 
Quoted 17 lines

include/drm/drm_dp_dual_mode_helper.h ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter, · line 81

Quoted 13 lines
include/drm/drm_dp_dual_mode_helper.h +12 -0
  /**
+* enum drm_lspcon_mode
+* @lspcon_mode_invalid: No idea what's going on
+* @lspcon_mode_ls: Level shifter mode of LSPCON
+*	which drives DP++ to HDMI 1.4 conversion.
+* @lspcon_mode_pcon: Protocol converter mode of LSPCON
+*	which drives DP++ to HDMI 2.0 active conversion.
+*/
+enum drm_lspcon_mode {
+	DRM_LSPCON_MODE_INVALID,
+	DRM_LSPCON_MODE_LS,
+	DRM_LSPCON_MODE_PCON,
+};

If we change the _get_mode() thing to return the error status separately from the mode, we won't need the INVALID value.

Agree.

Quoted 38 lines
Quoted 37 lines
include/drm/drm_dp_dual_mode_helper.h +13 -1
+
+/**
   * enum drm_dp_dual_mode_type - Type of the DP dual mode adaptor
   * @DRM_DP_DUAL_MODE_NONE: No DP dual mode adaptor
   * @DRM_DP_DUAL_MODE_UNKNOWN: Could be either none or type 1 DVI adaptor
@@ -70,6 +88,7 @@ ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter,
   * @DRM_DP_DUAL_MODE_TYPE1_HDMI: Type 1 HDMI adaptor
   * @DRM_DP_DUAL_MODE_TYPE2_DVI: Type 2 DVI adaptor
   * @DRM_DP_DUAL_MODE_TYPE2_HDMI: Type 2 HDMI adaptor
+ * @DRM_DP_DUAL_MODE_TYPE2_LSPCON: Level shifter /protocol converter
   */
  enum drm_dp_dual_mode_type {
  	DRM_DP_DUAL_MODE_NONE,
@@ -78,6 +97,7 @@ enum drm_dp_dual_mode_type {
  	DRM_DP_DUAL_MODE_TYPE1_HDMI,
  	DRM_DP_DUAL_MODE_TYPE2_DVI,
  	DRM_DP_DUAL_MODE_TYPE2_HDMI,
+	DRM_DP_DUAL_MODE_LSPCON,
  };
 
  enum drm_dp_dual_mode_type drm_dp_dual_mode_detect(struct i2c_adapter *adapter);
@@ -89,4 +109,13 @@ int drm_dp_dual_mode_set_tmds_output(enum drm_dp_dual_mode_type type,
  				     struct i2c_adapter *adapter, bool enable);
  const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type);
 
+int drm_dp_dual_mode_ioa_read(struct i2c_adapter *adapter, u8 *buffer,
+		u8 offset, u8 no_of_bytes);
+int drm_dp_dual_mode_ioa_write(struct i2c_adapter *adapter, u8 *buffer,
+		u8 offset, u8 no_of_bytes);
+int drm_dp_dual_mode_get_edid(void *data,
+	u8 *buf, unsigned int block, size_t len);
+enum drm_lspcon_mode drm_lspcon_get_current_mode(struct i2c_adapter *adapter);
+int drm_lspcon_change_mode(struct i2c_adapter *adapter,
+		enum drm_lspcon_mode reqd_mode);
  #endif
--

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
#5 lore raw

Re: [PATCH 1/5] drm: Helper for LSPCON in drm_dp_dual_mode

Regards
Shashank

Quoted 168 lines · Ville Syrjälä
Quoted 100 lines · Shashank

Thanks for the review, Ville.
My comments, inline.

Regards
Shashank

Quoted 23 lines · Ville Syrjälä
Quoted 11 lines · Shashank Sharma
---
   drivers/gpu/drm/drm_dp_dual_mode_helper.c | 85 +++++++++++++++++++++++++++++++
   include/drm/drm_dp_dual_mode_helper.h     | 29 +++++++++++
   2 files changed, 114 insertions(+)
drivers/gpu/drm/drm_dp_dual_mode_helper.c +0 -0
index a7b2a75..11cab25 100644

drivers/gpu/drm/drm_dp_dual_mode_helper.c static bool is_type2_adaptor(uint8_t adaptor_id) · line 154

Quoted 7 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +4 -0
@@ -148,6 +148,12 @@ static bool is_type2_adaptor(uint8_t adaptor_id)
   			      DP_DUAL_MODE_REV_TYPE2);
   }
 
+bool is_lspcon_adaptor(const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN],
+	const uint8_t adaptor_id)
+{
+	return is_hdmi_adaptor(hdmi_id) && (adaptor_id == 0xa8);

I'd probably make this something like

Quoted 6 lines

#define DP_DUAL_MODE_RESERVED_LSPCON 0x08

          return adaptor_id == (DP_DUAL_MODE_TYPE_TYPE2 |
	                      DP_DUAL_MODE_RESERVED_LSPCON |
	                      DP_DUAL_MODE_REV_TYPE2);

Thanks, this is a good suggestion, I will do so.

Quoted 26 lines
Quoted 26 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +11 -0
+}
+
   /**
    * drm_dp_dual_mode_detect - Identify the DP dual mode adaptor
    * @adapter: I2C adapter for the DDC bus
@@ -203,6 +209,8 @@ enum drm_dp_dual_mode_type drm_dp_dual_mode_detect(struct i2c_adapter *adapter)
   	ret = drm_dp_dual_mode_read(adapter, DP_DUAL_MODE_ADAPTOR_ID,
   				    &adaptor_id, sizeof(adaptor_id));
   	if (ret == 0) {
+		if (is_lspcon_adaptor(hdmi_id, adaptor_id))
+			return DRM_DP_DUAL_MODE_LSPCON;
   		if (is_type2_adaptor(adaptor_id)) {
   			if (is_hdmi_adaptor(hdmi_id))
   				return DRM_DP_DUAL_MODE_TYPE2_HDMI;
@@ -364,3 +372,80 @@ const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type)
   	}
   }
   EXPORT_SYMBOL(drm_dp_get_dual_mode_type_name);
+
+/**
+ * drm_lspcon_get_current_mode: Get LSPCON's current mode of operation by
+ * by reading offset (0x80, 0x41)
+ * @i2c_adapter: I2C-over-aux adapter
+ *
+ * Returns:
Quoted 9 lines

drivers/gpu/drm/drm_dp_dual_mode_helper.c const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type) · line 385

Quoted 4 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +4 -0
+ * Enum representing current mode of operation
+ */
+enum drm_lspcon_mode
+drm_lspcon_get_current_mode(struct i2c_adapter *adapter)

To match with drm_dp_dual_mode_get_tmds_output() this may want to return the error status, and return the actual mode via a function argument.

sure, can be done.

Quoted 5 lines

As for the name drm_dp_dual_mode_get_lspcon_mode() and drm_dp_dual_mode_set_lspcon_mode() perhaps?
Or drm_lspcon_get_mode()/drm_lspcon_set_mode() perhaps if we want to keep things shorter?

Yep, initially I made the same names as you suggested, but drm_dp_dual_mode_get_lspcon_mode dint sound good to me :). drm_lspcon_get/set_mode sounds good.

Quoted 5 lines

drivers/gpu/drm/drm_dp_dual_mode_helper.c const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type) · line 388

Quoted 3 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +3 -0
+{
+	u8 data;
+	int err = 0;

I used 'ret' in the rest of the code. This is a bit inconsistent.

got it.

Quoted 8 lines

drivers/gpu/drm/drm_dp_dual_mode_helper.c const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type) · line 392

Quoted 5 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +4 -0
+
+	/* Read Status: i2c over aux */
+	err = drm_dp_dual_mode_read(adapter, DP_DUAL_MODE_LSPCON_CURRENT_MODE,
+			(void *)&data, sizeof(data));

Pointless cast.

good catch, this is unnecessary.

Quoted 3 lines

drivers/gpu/drm/drm_dp_dual_mode_helper.c const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type) · line 393

Quoted 1 line
drivers/gpu/drm/drm_dp_dual_mode_helper.c +1 -0
+	if (err < 0) {

if (ret) is what I've used elsewhere.

got it.

Quoted 1 line
Quoted 8 lines
Quoted 5 lines

drivers/gpu/drm/drm_dp_dual_mode_helper.c const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type) · line 394

Quoted 1 line
drivers/gpu/drm/drm_dp_dual_mode_helper.c +1 -0
+		DRM_ERROR("LSPCON read(0x80, 0x41) failed\n");

I'm not sure we want and ERROR from a helper. I used DRM_DEBUG_KMS for the other error paths.

IMHO, This is a failure which needs notice, as it can point out to a HW level problem, or a problem in LSPCON FW, so I will prefer to keep it as error.

Fair enough.

Quoted 56 lines
Quoted 20 lines
Quoted 20 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +20 -0
+		return DRM_LSPCON_MODE_INVALID;
+	}
+
+	return data & DP_DUAL_MODE_LSPCON_MODE_MASK ?
+		DRM_LSPCON_MODE_PCON : DRM_LSPCON_MODE_LS;
+}
+EXPORT_SYMBOL(drm_lspcon_get_current_mode);
+
+/**
+ * drm_lspcon_change_mode: Change LSPCON's mode of operation by
+ * by writing offset (0x80, 0x40)
+ * @i2c_adapter: I2C-over-aux adapter
+ * @reqd_mode: required mode of operation
+ *
+ * Returns:
+ * 0 on success, -error on failure/timeout
+ */
+int drm_lspcon_change_mode(struct i2c_adapter *adapter,
+	enum drm_lspcon_mode reqd_mode)
+{
Quoted 9 lines

drivers/gpu/drm/drm_dp_dual_mode_helper.c const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type) · line 420

Quoted 6 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +6 -0
+	u8 data;
+	int err;
+	int time_out = 200;
+
+	if (reqd_mode == DRM_LSPCON_MODE_LS)
+		data = ~DP_DUAL_MODE_LSPCON_MODE_MASK;

Is that really correct?

Oops, it was a blunder, but fortunately that register only bothers about bit 0, and that's why it worked, I will fix this.

Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +10 -0
+	else
+		data = DP_DUAL_MODE_LSPCON_MODE_MASK;
+
+	/* Change mode */
+	err = drm_dp_dual_mode_write(adapter, DP_DUAL_MODE_LSPCON_MODE_CHANGE,
+			&data, sizeof(data));
+	if (err < 0) {
+		DRM_ERROR("LSPCON mode change failed\n");
+		return err;
+	}
Quoted 8 lines

drivers/gpu/drm/drm_dp_dual_mode_helper.c const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type) · line 436

Quoted 6 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +6 -0
+
+	/*
+	* Confirm mode change by reading the status bit.
+	* Sometimes, it takes a while to change the mode,
+	* so wait and retry until time out or done.
+	*/

indent fail

OK.

Quoted 6 lines

drivers/gpu/drm/drm_dp_dual_mode_helper.c const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type) · line 439

Quoted 4 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +3 -0
+	while (time_out) {
+		if (reqd_mode != drm_lspcon_get_current_mode(adapter)) {
+			mdelay(10);

mdelay() is bad.

Quoted 5 lines
Quoted 2 lines

Do you think I should replace with some of the non-busy wait (like msleep or so ?)

How long would we typically have to wait for the mode to change?

In a normal scenario, it takes max 1-2 iterations (max 20ms) but
on Android trees, We had initially observed it taking as much as 300ms, (but thats once in a blue moon). MCA has made some changes in the latest LSPCON FW, to make it better. But 200ms is just to be in the safer side.

Quoted 98 lines
Quoted 98 lines
Quoted 14 lines

drivers/gpu/drm/drm_dp_dual_mode_helper.c const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type) · line 449

Quoted 11 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +10 -0
+			time_out -= 10;
+		} else {
+			DRM_DEBUG_KMS("LSPCON mode changed to %s\n",
+			reqd_mode == DRM_LSPCON_MODE_LS ? "LS" : "PCON");
+			return 0;
+		}
+	}
+
+	DRM_ERROR("LSPCON mode change timed out\n");
+	return -EFAULT;

EFAULT doens't seem like a sensible error value here. ETIMEDOUT I suppose seems like what we should return.

Sure.

Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +2 -0
+}
+EXPORT_SYMBOL(drm_lspcon_change_mode);
include/drm/drm_dp_dual_mode_helper.h +1 -0
index e8a9dfd..f335df5 100644
@@ -24,6 +24,7 @@
   #define DRM_DP_DUAL_MODE_HELPER_H
 
   #include <linux/types.h>
+#include <drm/drm_edid.h>
 
Quoted 12 lines

include/drm/drm_dp_dual_mode_helper.h line 57

Quoted 6 lines
include/drm/drm_dp_dual_mode_helper.h +0 -0
   /*
    * Optional for type 1 DVI adaptors
@@ -54,6 +55,9 @@
   #define DP_DUAL_MODE_HDMI_PIN_CTRL 0x21
   #define  DP_DUAL_MODE_CEC_ENABLE 0x01
   #define DP_DUAL_MODE_I2C_SPEED_CTRL 0x22

Maybe leave an empty line here to separate the standard regs from the vendor specific ones. Hmm. Actually the vendor register space is 0x30-0x3f, whereas 0x40+ is reserved. But anyway empty line would seem warranted.

Got it.

Quoted 7 lines

include/drm/drm_dp_dual_mode_helper.h line 60

Quoted 3 lines
include/drm/drm_dp_dual_mode_helper.h +3 -0
+#define DP_DUAL_MODE_LSPCON_MODE_CHANGE		0x40
+#define DP_DUAL_MODE_LSPCON_CURRENT_MODE		0x41
+#define DP_DUAL_MODE_LSPCON_MODE_MASK			0x1

Please indent the bit defnition by one space to make it stand out from the reg defines a little.

Ok, the first two are registers only, I guess this is for DP_DUAL_MODE_LSPCON_MODE_MASK. I will align it.

Quoted 5 lines
Quoted 5 lines
include/drm/drm_dp_dual_mode_helper.h +0 -0
   struct i2c_adapter;
 
@@ -63,6 +67,20 @@ ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter,
   			       u8 offset, const void *buffer, size_t size);
 
Quoted 17 lines

include/drm/drm_dp_dual_mode_helper.h ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter, · line 81

Quoted 13 lines
include/drm/drm_dp_dual_mode_helper.h +12 -0
   /**
+* enum drm_lspcon_mode
+* @lspcon_mode_invalid: No idea what's going on
+* @lspcon_mode_ls: Level shifter mode of LSPCON
+*	which drives DP++ to HDMI 1.4 conversion.
+* @lspcon_mode_pcon: Protocol converter mode of LSPCON
+*	which drives DP++ to HDMI 2.0 active conversion.
+*/
+enum drm_lspcon_mode {
+	DRM_LSPCON_MODE_INVALID,
+	DRM_LSPCON_MODE_LS,
+	DRM_LSPCON_MODE_PCON,
+};

If we change the _get_mode() thing to return the error status separately from the mode, we won't need the INVALID value.

Agree.

Quoted 25 lines
Quoted 25 lines
include/drm/drm_dp_dual_mode_helper.h +4 -0
+
+/**
    * enum drm_dp_dual_mode_type - Type of the DP dual mode adaptor
    * @DRM_DP_DUAL_MODE_NONE: No DP dual mode adaptor
    * @DRM_DP_DUAL_MODE_UNKNOWN: Could be either none or type 1 DVI adaptor
@@ -70,6 +88,7 @@ ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter,
    * @DRM_DP_DUAL_MODE_TYPE1_HDMI: Type 1 HDMI adaptor
    * @DRM_DP_DUAL_MODE_TYPE2_DVI: Type 2 DVI adaptor
    * @DRM_DP_DUAL_MODE_TYPE2_HDMI: Type 2 HDMI adaptor
+ * @DRM_DP_DUAL_MODE_TYPE2_LSPCON: Level shifter /protocol converter
    */
   enum drm_dp_dual_mode_type {
   	DRM_DP_DUAL_MODE_NONE,
@@ -78,6 +97,7 @@ enum drm_dp_dual_mode_type {
   	DRM_DP_DUAL_MODE_TYPE1_HDMI,
   	DRM_DP_DUAL_MODE_TYPE2_DVI,
   	DRM_DP_DUAL_MODE_TYPE2_HDMI,
+	DRM_DP_DUAL_MODE_LSPCON,
   };
 
   enum drm_dp_dual_mode_type drm_dp_dual_mode_detect(struct i2c_adapter *adapter);
@@ -89,4 +109,13 @@ int drm_dp_dual_mode_set_tmds_output(enum drm_dp_dual_mode_type type,
   				     struct i2c_adapter *adapter, bool enable);
   const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type);
 
Quoted 14 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
include/drm/drm_dp_dual_mode_helper.h +5 -0
+int drm_dp_dual_mode_ioa_read(struct i2c_adapter *adapter, u8 *buffer,
+		u8 offset, u8 no_of_bytes);
+int drm_dp_dual_mode_ioa_write(struct i2c_adapter *adapter, u8 *buffer,
+		u8 offset, u8 no_of_bytes);
+int drm_dp_dual_mode_get_edid(void *data,
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
include/drm/drm_dp_dual_mode_helper.h +4 -1
+	u8 *buf, unsigned int block, size_t len);
+enum drm_lspcon_mode drm_lspcon_get_current_mode(struct i2c_adapter *adapter);
+int drm_lspcon_change_mode(struct i2c_adapter *adapter,
+		enum drm_lspcon_mode reqd_mode);
   #endif
--

1.9.1

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

#6 lore raw

Re: [PATCH 1/5] drm: Helper for LSPCON in drm_dp_dual_mode

In reply to Shashank Sharma
Quoted 9 lines · Shashank Sharma
include/drm/drm_dp_dual_mode_helper.h +1 -0
@@ -78,6 +97,7 @@ enum drm_dp_dual_mode_type {
 	DRM_DP_DUAL_MODE_TYPE1_HDMI,
 	DRM_DP_DUAL_MODE_TYPE2_DVI,
 	DRM_DP_DUAL_MODE_TYPE2_HDMI,
+	DRM_DP_DUAL_MODE_LSPCON,
 };
 
 enum drm_dp_dual_mode_type drm_dp_dual_mode_detect(struct i2c_adapter *adapter);

include/drm/drm_dp_dual_mode_helper.h int drm_dp_dual_mode_set_tmds_output(enum drm_dp_dual_mode_type type, · line 117

Quoted 9 lines
include/drm/drm_dp_dual_mode_helper.h +6 -0
@@ -89,4 +109,13 @@ int drm_dp_dual_mode_set_tmds_output(enum drm_dp_dual_mode_type type,
 				     struct i2c_adapter *adapter, bool enable);
 const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type);
 
+int drm_dp_dual_mode_ioa_read(struct i2c_adapter *adapter, u8 *buffer,
+		u8 offset, u8 no_of_bytes);
+int drm_dp_dual_mode_ioa_write(struct i2c_adapter *adapter, u8 *buffer,
+		u8 offset, u8 no_of_bytes);
+int drm_dp_dual_mode_get_edid(void *data,
+	u8 *buf, unsigned int block, size_t len);

These look like leftovers from an earlier attempt.

Quoted 6 lines
include/drm/drm_dp_dual_mode_helper.h +3 -0
+enum drm_lspcon_mode drm_lspcon_get_current_mode(struct i2c_adapter *adapter);
+int drm_lspcon_change_mode(struct i2c_adapter *adapter,
+		enum drm_lspcon_mode reqd_mode);
 #endif
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
#7 lore raw

Re: [PATCH 1/5] drm: Helper for LSPCON in drm_dp_dual_mode

Regards
Shashank

Quoted 13 lines · Ville Syrjälä
Quoted 12 lines · Shashank Sharma
include/drm/drm_dp_dual_mode_helper.h +1 -0
@@ -78,6 +97,7 @@ enum drm_dp_dual_mode_type {
  	DRM_DP_DUAL_MODE_TYPE1_HDMI,
  	DRM_DP_DUAL_MODE_TYPE2_DVI,
  	DRM_DP_DUAL_MODE_TYPE2_HDMI,
+	DRM_DP_DUAL_MODE_LSPCON,
  };
 
  enum drm_dp_dual_mode_type drm_dp_dual_mode_detect(struct i2c_adapter *adapter);
@@ -89,4 +109,13 @@ int drm_dp_dual_mode_set_tmds_output(enum drm_dp_dual_mode_type type,
  				     struct i2c_adapter *adapter, bool enable);
  const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type);
 
Quoted 8 lines

include/drm/drm_dp_dual_mode_helper.h int drm_dp_dual_mode_set_tmds_output(enum drm_dp_dual_mode_type type, · line 117

Quoted 6 lines
include/drm/drm_dp_dual_mode_helper.h +6 -0
+int drm_dp_dual_mode_ioa_read(struct i2c_adapter *adapter, u8 *buffer,
+		u8 offset, u8 no_of_bytes);
+int drm_dp_dual_mode_ioa_write(struct i2c_adapter *adapter, u8 *buffer,
+		u8 offset, u8 no_of_bytes);
+int drm_dp_dual_mode_get_edid(void *data,
+	u8 *buf, unsigned int block, size_t len);

These look like leftovers from an earlier attempt.

Yes, I noticed I missed them during cleanup. Will remove these.

Quoted 8 lines
Quoted 7 lines
include/drm/drm_dp_dual_mode_helper.h +3 -1
+enum drm_lspcon_mode drm_lspcon_get_current_mode(struct i2c_adapter *adapter);
+int drm_lspcon_change_mode(struct i2c_adapter *adapter,
+		enum drm_lspcon_mode reqd_mode);
  #endif
--

1.9.1

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

#8 lore raw

PATCH 2/5 drm/i915: Add lspcon support for I915 driver

In reply to Shashank Sharma

lspcon is a dp->hdmi adaptor has two modes of operation. ls mode: level shifter mode, passive dp->hdmi dongle pcon mode: protocol converter mode, active dp->hdmi 2.0 converter.

This patch adds a new file, to accommodate lspcon support for I915 driver. These functions probe, detect, initialize and configure an on-board lspcon device during the driver init time.

Also, this patch adds a small structure for lspcon device, which will provide the runtime status of the device.

---
 drivers/gpu/drm/i915/Makefile       |   1 +
 drivers/gpu/drm/i915/intel_drv.h    |  13 ++-
 drivers/gpu/drm/i915/intel_lspcon.c | 159 ++++++++++++++++++++++++++++++++++++
 3 files changed, 172 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/i915/intel_lspcon.c
drivers/gpu/drm/i915/Makefile +1 -0
index 7e29444..1bd6026 100644
@@ -93,6 +93,7 @@ i915-y += dvo_ch7017.o \
 	  intel_dvo.o \
 	  intel_hdmi.o \
 	  intel_i2c.o \
+	  intel_lspcon.o \
 	  intel_lvds.o \
 	  intel_panel.o \
 	  intel_sdvo.o \
drivers/gpu/drm/i915/intel_drv.h +12 -1
index 9b5f663..205a463 100644
@@ -896,12 +896,19 @@ struct intel_dp {
 	bool compliance_test_active;
 };
 
+struct intel_lspcon {
+	bool active;
+	enum drm_lspcon_mode mode_of_op;
+	struct drm_dp_aux *aux;
+};
+
 struct intel_digital_port {
 	struct intel_encoder base;
 	enum port port;
 	u32 saved_port_bits;
 	struct intel_dp dp;
 	struct intel_hdmi hdmi;
+	struct intel_lspcon lspcon;
 	enum irqreturn (*hpd_pulse)(struct intel_digital_port *, bool);
 	bool release_cl2_override;
 	uint8_t max_lanes;
@@ -1446,7 +1453,6 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
 			       struct intel_crtc_state *pipe_config);
 void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable);
 
-
 /* intel_lvds.c */
 void intel_lvds_init(struct drm_device *dev);
 bool intel_is_dual_link_lvds(struct drm_device *dev);
@@ -1734,4 +1740,9 @@ int intel_color_check(struct drm_crtc *crtc, struct drm_crtc_state *state);
 void intel_color_set_csc(struct drm_crtc_state *crtc_state);
 void intel_color_load_luts(struct drm_crtc_state *crtc_state);
 
+/* intel_lspcon.c */
+bool lspcon_init(struct intel_digital_port *intel_dig_port);
+enum drm_connector_status
+lspcon_ls_mode_detect(struct drm_connector *connector, bool force);
+bool is_lspcon_active(struct intel_digital_port *dig_port);
 #endif /* __INTEL_DRV_H__ */
drivers/gpu/drm/i915/intel_lspcon.c new file +159 -0

159 lines not on this page · raw message

Signature · 6 lines
1.9.1

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

Re: [PATCH 2/5] drm/i915: Add lspcon support for I915 driver

Quoted 105 lines · Shashank Sharma

lspcon is a dp->hdmi adaptor has two modes of operation. ls mode: level shifter mode, passive dp->hdmi dongle pcon mode: protocol converter mode, active dp->hdmi 2.0 converter.

This patch adds a new file, to accommodate lspcon support for I915 driver. These functions probe, detect, initialize and configure an on-board lspcon device during the driver init time.

Also, this patch adds a small structure for lspcon device, which will provide the runtime status of the device.

---
 drivers/gpu/drm/i915/Makefile       |   1 +
 drivers/gpu/drm/i915/intel_drv.h    |  13 ++-
 drivers/gpu/drm/i915/intel_lspcon.c | 159 ++++++++++++++++++++++++++++++++++++
 3 files changed, 172 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/i915/intel_lspcon.c
drivers/gpu/drm/i915/Makefile +1 -0
index 7e29444..1bd6026 100644
@@ -93,6 +93,7 @@ i915-y += dvo_ch7017.o \
 	  intel_dvo.o \
 	  intel_hdmi.o \
 	  intel_i2c.o \
+	  intel_lspcon.o \
 	  intel_lvds.o \
 	  intel_panel.o \
 	  intel_sdvo.o \
drivers/gpu/drm/i915/intel_drv.h +12 -1
index 9b5f663..205a463 100644
@@ -896,12 +896,19 @@ struct intel_dp {
 	bool compliance_test_active;
 };
 
+struct intel_lspcon {
+	bool active;
+	enum drm_lspcon_mode mode_of_op;
+	struct drm_dp_aux *aux;
+};
+
 struct intel_digital_port {
 	struct intel_encoder base;
 	enum port port;
 	u32 saved_port_bits;
 	struct intel_dp dp;
 	struct intel_hdmi hdmi;
+	struct intel_lspcon lspcon;
 	enum irqreturn (*hpd_pulse)(struct intel_digital_port *, bool);
 	bool release_cl2_override;
 	uint8_t max_lanes;
@@ -1446,7 +1453,6 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
 			       struct intel_crtc_state *pipe_config);
 void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable);
 
-
 /* intel_lvds.c */
 void intel_lvds_init(struct drm_device *dev);
 bool intel_is_dual_link_lvds(struct drm_device *dev);
@@ -1734,4 +1740,9 @@ int intel_color_check(struct drm_crtc *crtc, struct drm_crtc_state *state);
 void intel_color_set_csc(struct drm_crtc_state *crtc_state);
 void intel_color_load_luts(struct drm_crtc_state *crtc_state);
 
+/* intel_lspcon.c */
+bool lspcon_init(struct intel_digital_port *intel_dig_port);
+enum drm_connector_status
+lspcon_ls_mode_detect(struct drm_connector *connector, bool force);
+bool is_lspcon_active(struct intel_digital_port *dig_port);
 #endif /* __INTEL_DRV_H__ */
drivers/gpu/drm/i915/intel_lspcon.c new file +23 -0
new file mode 100644
index 0000000..dd50491
@@ -0,0 +1,159 @@
+/*
+ * Copyright © 2016 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ *

drivers/gpu/drm/i915/intel_lspcon.c line 33

Quoted 10 lines
drivers/gpu/drm/i915/intel_lspcon.c new file +10 -0
+ */
+#include <drm/drm_edid.h>
+#include <drm/drm_atomic_helper.h>
+#include <drm/drm_dp_dual_mode_helper.h>
+#include "intel_drv.h"
+
+#define LSPCON_I2C_ADDRESS			0x80
+#define LSPCON_ADAPTER_SIGN_OFFSET		0x00
+#define LSPCON_IDENTIFIER_OFFSET		0x10
+#define LSPCON_IDENTIFIER_LENGTH		0x10

Leftovers?

Quoted 9 lines
drivers/gpu/drm/i915/intel_lspcon.c new file +9 -0
+
+bool is_lspcon_active(struct intel_digital_port *dig_port)
+{
+	return dig_port->lspcon.active;
+}
+
+enum drm_lspcon_mode lspcon_get_current_mode(struct intel_lspcon *lspcon)
+{
+	enum drm_lspcon_mode current_mode;

drivers/gpu/drm/i915/intel_lspcon.c line 52

Quoted 10 lines
drivers/gpu/drm/i915/intel_lspcon.c new file +10 -0
+	struct i2c_adapter *adapter = &lspcon->aux->ddc;
+
+	current_mode = drm_lspcon_get_current_mode(adapter);
+	if (current_mode == DRM_LSPCON_MODE_INVALID)
+		DRM_ERROR("Error reading LSPCON mode\n");
+	else
+		DRM_DEBUG_KMS("Current LSPCON mode %s\n",
+			current_mode == DRM_LSPCON_MODE_PCON ? "PCON" : "LS");
+	return current_mode;
+}

This file seems to be just contain these sort of wrappers that don't look very useful to me.

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

Re: [PATCH 2/5] drm/i915: Add lspcon support for I915 driver

Regards
Shashank

Quoted 110 lines · Ville Syrjälä
Quoted 109 lines · Shashank Sharma

lspcon is a dp->hdmi adaptor has two modes of operation. ls mode: level shifter mode, passive dp->hdmi dongle pcon mode: protocol converter mode, active dp->hdmi 2.0 converter.

This patch adds a new file, to accommodate lspcon support for I915 driver. These functions probe, detect, initialize and configure an on-board lspcon device during the driver init time.

Also, this patch adds a small structure for lspcon device, which will provide the runtime status of the device.

---
  drivers/gpu/drm/i915/Makefile       |   1 +
  drivers/gpu/drm/i915/intel_drv.h    |  13 ++-
  drivers/gpu/drm/i915/intel_lspcon.c | 159 ++++++++++++++++++++++++++++++++++++
  3 files changed, 172 insertions(+), 1 deletion(-)

create mode 100644 drivers/gpu/drm/i915/intel_lspcon.c

drivers/gpu/drm/i915/Makefile +1 -0
index 7e29444..1bd6026 100644
@@ -93,6 +93,7 @@ i915-y += dvo_ch7017.o \
  	  intel_dvo.o \
  	  intel_hdmi.o \
  	  intel_i2c.o \
+	  intel_lspcon.o \
  	  intel_lvds.o \
  	  intel_panel.o \
  	  intel_sdvo.o \
drivers/gpu/drm/i915/intel_drv.h +12 -1
index 9b5f663..205a463 100644
@@ -896,12 +896,19 @@ struct intel_dp {
  	bool compliance_test_active;
  };
 
+struct intel_lspcon {
+	bool active;
+	enum drm_lspcon_mode mode_of_op;
+	struct drm_dp_aux *aux;
+};
+
  struct intel_digital_port {
  	struct intel_encoder base;
  	enum port port;
  	u32 saved_port_bits;
  	struct intel_dp dp;
  	struct intel_hdmi hdmi;
+	struct intel_lspcon lspcon;
  	enum irqreturn (*hpd_pulse)(struct intel_digital_port *, bool);
  	bool release_cl2_override;
  	uint8_t max_lanes;
@@ -1446,7 +1453,6 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
  			       struct intel_crtc_state *pipe_config);
  void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable);
 
-
  /* intel_lvds.c */
  void intel_lvds_init(struct drm_device *dev);
  bool intel_is_dual_link_lvds(struct drm_device *dev);
@@ -1734,4 +1740,9 @@ int intel_color_check(struct drm_crtc *crtc, struct drm_crtc_state *state);
  void intel_color_set_csc(struct drm_crtc_state *crtc_state);
  void intel_color_load_luts(struct drm_crtc_state *crtc_state);
 
+/* intel_lspcon.c */
+bool lspcon_init(struct intel_digital_port *intel_dig_port);
+enum drm_connector_status
+lspcon_ls_mode_detect(struct drm_connector *connector, bool force);
+bool is_lspcon_active(struct intel_digital_port *dig_port);
  #endif /* __INTEL_DRV_H__ */
drivers/gpu/drm/i915/intel_lspcon.c new file +27 -0
new file mode 100644
index 0000000..dd50491
@@ -0,0 +1,159 @@
+/*
+ * Copyright © 2016 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ *
+ */
+#include <drm/drm_edid.h>
+#include <drm/drm_atomic_helper.h>
+#include <drm/drm_dp_dual_mode_helper.h>
Quoted 8 lines

drivers/gpu/drm/i915/intel_lspcon.c line 33

Quoted 6 lines
drivers/gpu/drm/i915/intel_lspcon.c new file +6 -0
+#include "intel_drv.h"
+
+#define LSPCON_I2C_ADDRESS			0x80
+#define LSPCON_ADAPTER_SIGN_OFFSET		0x00
+#define LSPCON_IDENTIFIER_OFFSET		0x10
+#define LSPCON_IDENTIFIER_LENGTH		0x10

Leftovers?

Yep, will clean this up too.

Quoted 15 lines
Quoted 15 lines
drivers/gpu/drm/i915/intel_lspcon.c new file +14 -0
+
+bool is_lspcon_active(struct intel_digital_port *dig_port)
+{
+	return dig_port->lspcon.active;
+}
+
+enum drm_lspcon_mode lspcon_get_current_mode(struct intel_lspcon *lspcon)
+{
+	enum drm_lspcon_mode current_mode;
+	struct i2c_adapter *adapter = &lspcon->aux->ddc;
+
+	current_mode = drm_lspcon_get_current_mode(adapter);
+	if (current_mode == DRM_LSPCON_MODE_INVALID)
+		DRM_ERROR("Error reading LSPCON mode\n");
Quoted 9 lines

drivers/gpu/drm/i915/intel_lspcon.c line 52

Quoted 5 lines
drivers/gpu/drm/i915/intel_lspcon.c new file +5 -0
+	else
+		DRM_DEBUG_KMS("Current LSPCON mode %s\n",
+			current_mode == DRM_LSPCON_MODE_PCON ? "PCON" : "LS");
+	return current_mode;
+}

This file seems to be just contain these sort of wrappers that don't look very useful to me.

I agree, that most of the real work is happening in dp_dual_mode layer now. Actually, the idea behind this file is to contains all the I915 specific operations, for lspcon.

This API (get_current_mode) is a small function, but if you see others (like init and probe) they do specific work which we want to do in I915 lspcon handling. This is good for readability as well as this makes code modular too.

For example, reading i2c_ove_aux address 0x80 offset 0x41, doesn't make much sense for ppl who don't know much about lspcon, but create a wrapper function and let it return ls_mode or pcon_mode, makes code very simple to read and debug.

Going forward, if there is a requirement to support other HDMI 2.0 features over lspcon, there would be scope for expansion of file with many more wrappers and some core functions too.

Please let me know, if this idea makes any sense :)

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

#11 lore raw

PATCH 3/5 drm/i915: lspcon detection

In reply to Shashank Sharma

lspcon is a tricky device to detect.
When in LS mode:
It should be detected as a HDMI device, by reading EDID, on I2C over Aux chanel

When in PCON mode:
It should be detected as a DP device by reading DPCD over the Aux channel.

This patch accommodates these specific requirements of lspcon detection by adding appropriate changes in I915 drivers HDMI/DP detection sequence.

---
 drivers/gpu/drm/i915/intel_ddi.c    | 14 ++++++++++++++
 drivers/gpu/drm/i915/intel_dp.c     | 12 ++++++++++++
 drivers/gpu/drm/i915/intel_drv.h    |  2 ++
 drivers/gpu/drm/i915/intel_hdmi.c   | 14 ++++++++++----
 drivers/gpu/drm/i915/intel_lspcon.c |  6 ++++++
 5 files changed, 44 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +14 -0
index c454744..811c829 100644
@@ -2243,12 +2243,26 @@ static bool intel_ddi_compute_config(struct intel_encoder *encoder,
 {
 	int type = encoder->type;
 	int port = intel_ddi_get_encoder_port(encoder);
+	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
 
 	WARN(type == INTEL_OUTPUT_UNKNOWN, "compute_config() on unknown output!\n");
 
 	if (port == PORT_A)
 		pipe_config->cpu_transcoder = TRANSCODER_EDP;
 
+	/*
+	* A digital port with active lspcon device, should be detected
+	* as HDMI when in LS mode and as DP when in PCON mode.
+	*/
+	if (is_lspcon_active(dig_port)) {
+		struct intel_lspcon *lspcon = &dig_port->lspcon;
+
+		if (lspcon->mode_of_op == DRM_LSPCON_MODE_LS)
+			type = INTEL_OUTPUT_HDMI;
+		else
+			type = INTEL_OUTPUT_DISPLAYPORT;
+	}
+
 	if (type == INTEL_OUTPUT_HDMI)
 		return intel_hdmi_compute_config(encoder, pipe_config);
 	else
drivers/gpu/drm/i915/intel_dp.c +12 -0
index aa9c59e..39ce16e 100644
@@ -4276,6 +4276,18 @@ intel_dp_detect(struct drm_connector *connector, bool force)
 	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
 		      connector->base.id, connector->name);
 
+	/*
+	* LSPCON is a DP->HDMI converter which should be detected as
+	* HDMI in LS mode, and DP in PCON mode. So if LSPCON is in LS
+	* mode, do not try to read DPCD, but detect as HDMI.
+	*/
+	if (is_lspcon_active(intel_dig_port)) {
+		struct intel_lspcon *lspcon = &intel_dig_port->lspcon;
+
+		if (lspcon->mode_of_op == DRM_LSPCON_MODE_LS)
+			return lspcon_ls_mode_detect(connector, force);
+	}
+
 	if (intel_dp->is_mst) {
 		/* MST devices are disconnected from a monitor POV */
 		intel_dp_unset_edid(intel_dp);
drivers/gpu/drm/i915/intel_drv.h +2 -0
index 205a463..fa77886 100644
@@ -1452,6 +1452,8 @@ struct intel_hdmi *enc_to_intel_hdmi(struct drm_encoder *encoder);
 bool intel_hdmi_compute_config(struct intel_encoder *encoder,
 			       struct intel_crtc_state *pipe_config);
 void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable);
+enum drm_connector_status
+intel_hdmi_detect(struct drm_connector *connector, bool force);
 
 /* intel_lvds.c */
 void intel_lvds_init(struct drm_device *dev);
drivers/gpu/drm/i915/intel_hdmi.c +10 -4
index 6b52c6a..79184e2 100644
@@ -1444,15 +1444,21 @@ intel_hdmi_set_edid(struct drm_connector *connector, bool force)
 {
 	struct drm_i915_private *dev_priv = to_i915(connector->dev);
 	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
+	struct intel_digital_port *dig_port = hdmi_to_dig_port(intel_hdmi);
+	struct i2c_adapter *adapter;
 	struct edid *edid = NULL;
 	bool connected = false;
 
 	if (force) {
 		intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
 
-		edid = drm_get_edid(connector,
-				    intel_gmbus_get_adapter(dev_priv,
-				    intel_hdmi->ddc_bus));
+		if (is_lspcon_active(dig_port))
+			adapter = &dig_port->lspcon.aux->ddc;
+		else
+			adapter = intel_gmbus_get_adapter(dev_priv,
+				intel_hdmi->ddc_bus);
+
+		edid = drm_get_edid(connector, adapter);
 
 		intel_hdmi_dp_dual_mode_detect(connector, edid != NULL);
 
@@ -1479,7 +1485,7 @@ intel_hdmi_set_edid(struct drm_connector *connector, bool force)
 	return connected;
 }
 
-static enum drm_connector_status
+enum drm_connector_status
 intel_hdmi_detect(struct drm_connector *connector, bool force)
 {
 	enum drm_connector_status status;
drivers/gpu/drm/i915/intel_lspcon.c +6 -0
index dd50491..75b5028 100644
@@ -37,6 +37,12 @@ bool is_lspcon_active(struct intel_digital_port *dig_port)
 	return dig_port->lspcon.active;
 }
 
+enum drm_connector_status
+lspcon_ls_mode_detect(struct drm_connector *connector, bool force)
+{
+	return intel_hdmi_detect(connector, force);
+}
+
 enum drm_lspcon_mode lspcon_get_current_mode(struct intel_lspcon *lspcon)
 {
 	enum drm_lspcon_mode current_mode;
Signature · 6 lines
1.9.1

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

Re: [PATCH 3/5] drm/i915: lspcon detection

Quoted 38 lines · Shashank Sharma

lspcon is a tricky device to detect.
When in LS mode:
It should be detected as a HDMI device, by reading EDID, on I2C over Aux chanel

When in PCON mode:
It should be detected as a DP device by reading DPCD over the Aux channel.

This patch accommodates these specific requirements of lspcon detection by adding appropriate changes in I915 drivers HDMI/DP detection sequence.

---
 drivers/gpu/drm/i915/intel_ddi.c    | 14 ++++++++++++++
 drivers/gpu/drm/i915/intel_dp.c     | 12 ++++++++++++
 drivers/gpu/drm/i915/intel_drv.h    |  2 ++
 drivers/gpu/drm/i915/intel_hdmi.c   | 14 ++++++++++----
 drivers/gpu/drm/i915/intel_lspcon.c |  6 ++++++
 5 files changed, 44 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +3 -0
index c454744..811c829 100644
@@ -2243,12 +2243,26 @@ static bool intel_ddi_compute_config(struct intel_encoder *encoder,
 {
 	int type = encoder->type;
 	int port = intel_ddi_get_encoder_port(encoder);
+	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
 
 	WARN(type == INTEL_OUTPUT_UNKNOWN, "compute_config() on unknown output!\n");
 
 	if (port == PORT_A)
 		pipe_config->cpu_transcoder = TRANSCODER_EDP;
 
+	/*
+	* A digital port with active lspcon device, should be detected

drivers/gpu/drm/i915/intel_ddi.c static bool intel_ddi_compute_config(struct intel_encoder *encoder, · line 2264

Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c +10 -0
+	* as HDMI when in LS mode and as DP when in PCON mode.
+	*/
+	if (is_lspcon_active(dig_port)) {
+		struct intel_lspcon *lspcon = &dig_port->lspcon;
+
+		if (lspcon->mode_of_op == DRM_LSPCON_MODE_LS)
+			type = INTEL_OUTPUT_HDMI;
+		else
+			type = INTEL_OUTPUT_DISPLAYPORT;
+	}

Argh. I really wanted to kill this dual role DDI encoder mess (see [1])

I realize that with LSPCON we probably don't want separate encoders for the two roles. Or maybe we do? At least we don't want two connectors, which probably means two encoders might become messy.

In any case I don't think we want to be frobbing around with the encoder->type anymore. Maybe I need to rethink my approach to DDI encoders, and try to come up with something sane. For LSPCON at least we want to keep track of the current mode in pipe_config most likely. For LSPCON it's maybe a bit easier since the mode won't affect the DDC stuff and whanot, so from the probe side there is just one role except perhaps w.r.t. DPCD. For regular DDI stuff I'm still thinking two encoder might be the most sensible apporach since we have totally different paths for probe as well.

Probably the biggest kink in all of this is hpd handling. What, if anything, should hpd_pulse do for LSPCON? And if something, should it only do it in PCON mode? How is HPD routed anyway with LSPCON?

[1] https://patchwork.freedesktop.org/series/1596/

Quoted 56 lines
drivers/gpu/drm/i915/intel_ddi.c +1 -0
+
 	if (type == INTEL_OUTPUT_HDMI)
 		return intel_hdmi_compute_config(encoder, pipe_config);
 	else
drivers/gpu/drm/i915/intel_dp.c +12 -0
index aa9c59e..39ce16e 100644
@@ -4276,6 +4276,18 @@ intel_dp_detect(struct drm_connector *connector, bool force)
 	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
 		      connector->base.id, connector->name);
 
+	/*
+	* LSPCON is a DP->HDMI converter which should be detected as
+	* HDMI in LS mode, and DP in PCON mode. So if LSPCON is in LS
+	* mode, do not try to read DPCD, but detect as HDMI.
+	*/
+	if (is_lspcon_active(intel_dig_port)) {
+		struct intel_lspcon *lspcon = &intel_dig_port->lspcon;
+
+		if (lspcon->mode_of_op == DRM_LSPCON_MODE_LS)
+			return lspcon_ls_mode_detect(connector, force);
+	}
+
 	if (intel_dp->is_mst) {
 		/* MST devices are disconnected from a monitor POV */
 		intel_dp_unset_edid(intel_dp);
drivers/gpu/drm/i915/intel_drv.h +2 -0
index 205a463..fa77886 100644
@@ -1452,6 +1452,8 @@ struct intel_hdmi *enc_to_intel_hdmi(struct drm_encoder *encoder);
 bool intel_hdmi_compute_config(struct intel_encoder *encoder,
 			       struct intel_crtc_state *pipe_config);
 void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable);
+enum drm_connector_status
+intel_hdmi_detect(struct drm_connector *connector, bool force);
 
 /* intel_lvds.c */
 void intel_lvds_init(struct drm_device *dev);
drivers/gpu/drm/i915/intel_hdmi.c +2 -0
index 6b52c6a..79184e2 100644
@@ -1444,15 +1444,21 @@ intel_hdmi_set_edid(struct drm_connector *connector, bool force)
 {
 	struct drm_i915_private *dev_priv = to_i915(connector->dev);
 	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
+	struct intel_digital_port *dig_port = hdmi_to_dig_port(intel_hdmi);
+	struct i2c_adapter *adapter;
 	struct edid *edid = NULL;
 	bool connected = false;
 
 	if (force) {
 		intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
 

drivers/gpu/drm/i915/intel_hdmi.c intel_hdmi_set_edid(struct drm_connector *connector, bool force) · line 1461

Quoted 10 lines
drivers/gpu/drm/i915/intel_hdmi.c +7 -3
-		edid = drm_get_edid(connector,
-				    intel_gmbus_get_adapter(dev_priv,
-				    intel_hdmi->ddc_bus));
+		if (is_lspcon_active(dig_port))
+			adapter = &dig_port->lspcon.aux->ddc;
+		else
+			adapter = intel_gmbus_get_adapter(dev_priv,
+				intel_hdmi->ddc_bus);
+
+		edid = drm_get_edid(connector, adapter);

I'm not a fan of this. This is even taking the wrong power domain now, as does intel_hdmi_detect(). Probably LSPCON should just have a dedicated codepath for this stuff.

If we ever have a board design with a DP++ port without a GMBUS connection, then we might have rethink things because then we'd have to use AUX also for HDMI DDC. But so far I'm not aware of such board designs existing, so might as well keep LSPCON separate.

Quoted 31 lines
drivers/gpu/drm/i915/intel_hdmi.c +1 -1
 		intel_hdmi_dp_dual_mode_detect(connector, edid != NULL);
 
@@ -1479,7 +1485,7 @@ intel_hdmi_set_edid(struct drm_connector *connector, bool force)
 	return connected;
 }
 
-static enum drm_connector_status
+enum drm_connector_status
 intel_hdmi_detect(struct drm_connector *connector, bool force)
 {
 	enum drm_connector_status status;
drivers/gpu/drm/i915/intel_lspcon.c +6 -0
index dd50491..75b5028 100644
@@ -37,6 +37,12 @@ bool is_lspcon_active(struct intel_digital_port *dig_port)
 	return dig_port->lspcon.active;
 }
 
+enum drm_connector_status
+lspcon_ls_mode_detect(struct drm_connector *connector, bool force)
+{
+	return intel_hdmi_detect(connector, force);
+}
+
 enum drm_lspcon_mode lspcon_get_current_mode(struct intel_lspcon *lspcon)
 {
 	enum drm_lspcon_mode current_mode;
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
#13 lore raw

Re: [PATCH 3/5] drm/i915: lspcon detection

Regards
Shashank

Quoted 52 lines · Ville Syrjälä
Quoted 38 lines · Shashank Sharma

lspcon is a tricky device to detect.
When in LS mode:
It should be detected as a HDMI device, by reading EDID, on I2C over Aux chanel

When in PCON mode:
It should be detected as a DP device by reading DPCD over the Aux channel.

This patch accommodates these specific requirements of lspcon detection by adding appropriate changes in I915 drivers HDMI/DP detection sequence.

---
  drivers/gpu/drm/i915/intel_ddi.c    | 14 ++++++++++++++
  drivers/gpu/drm/i915/intel_dp.c     | 12 ++++++++++++
  drivers/gpu/drm/i915/intel_drv.h    |  2 ++
  drivers/gpu/drm/i915/intel_hdmi.c   | 14 ++++++++++----
  drivers/gpu/drm/i915/intel_lspcon.c |  6 ++++++
  5 files changed, 44 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +3 -0
index c454744..811c829 100644
@@ -2243,12 +2243,26 @@ static bool intel_ddi_compute_config(struct intel_encoder *encoder,
  {
  	int type = encoder->type;
  	int port = intel_ddi_get_encoder_port(encoder);
+	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
 
  	WARN(type == INTEL_OUTPUT_UNKNOWN, "compute_config() on unknown output!\n");
 
  	if (port == PORT_A)
  		pipe_config->cpu_transcoder = TRANSCODER_EDP;
 
+	/*
+	* A digital port with active lspcon device, should be detected

drivers/gpu/drm/i915/intel_ddi.c static bool intel_ddi_compute_config(struct intel_encoder *encoder, · line 2264

Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c +10 -0
+	* as HDMI when in LS mode and as DP when in PCON mode.
+	*/
+	if (is_lspcon_active(dig_port)) {
+		struct intel_lspcon *lspcon = &dig_port->lspcon;
+
+		if (lspcon->mode_of_op == DRM_LSPCON_MODE_LS)
+			type = INTEL_OUTPUT_HDMI;
+		else
+			type = INTEL_OUTPUT_DISPLAYPORT;
+	}

Argh. I really wanted to kill this dual role DDI encoder mess (see [1])

Quoted 4 lines

I realize that with LSPCON we probably don't want separate encoders for the two roles. Or maybe we do? At least we don't want two connectors, which probably means two encoders might become messy.

Yes, you are right. We neither need two encoders or two connectors. Actually if you closely observe, we have just attached once encoder, which is type DDI, and once connector, which is type DP.

Quoted 2 lines

In any case I don't think we want to be frobbing around with the encoder->type anymore.

Actually this check is just to cover any corner case / future case where a lspcon device detection path reaches this path, in LS mode.
In LS mode of operation, there is no DPCD, and the aux channel read/write for DPCD register will not be valid, and we will not be able to detect the monitor. In this case, we should just get EDID over i2c_over_aux and detect.

Will it make more sense, if I add a separate lspcon_detect function, and call it from HDMI/DP detect, and in that function take this call of reading EDID or DPCD based on lspcon_mode ? Please suggest. Maybe I need to rethink my approach to DDI

Quoted 8 lines

encoders, and try to come up with something sane. For LSPCON at least we want to keep track of the current mode in pipe_config most likely. For LSPCON it's maybe a bit easier since the mode won't affect the DDC stuff and whanot, so from the probe side there is just one role except perhaps w.r.t. DPCD. For regular DDI stuff I'm still thinking two encoder might be the most sensible apporach since we have totally different paths for probe as well.

Quoted 4 lines

Probably the biggest kink in all of this is hpd handling. What, if anything, should hpd_pulse do for LSPCON? And if something, should it only do it in PCON mode? How is HPD routed anyway with LSPCON?

Right now, from this patch series onwards, I am keeping lspcon always in PCON mode, so it will always be acting as a DP device, so any long HPD sequence which is valid for DP, will be valid for lspcon.

May be I should block short pulse handling if lspcon is active on the port ?

Quoted 58 lines

[1] https://patchwork.freedesktop.org/series/1596/

Quoted 56 lines
drivers/gpu/drm/i915/intel_ddi.c +1 -0
+
  	if (type == INTEL_OUTPUT_HDMI)
  		return intel_hdmi_compute_config(encoder, pipe_config);
  	else
drivers/gpu/drm/i915/intel_dp.c +12 -0
index aa9c59e..39ce16e 100644
@@ -4276,6 +4276,18 @@ intel_dp_detect(struct drm_connector *connector, bool force)
  	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
  		      connector->base.id, connector->name);
 
+	/*
+	* LSPCON is a DP->HDMI converter which should be detected as
+	* HDMI in LS mode, and DP in PCON mode. So if LSPCON is in LS
+	* mode, do not try to read DPCD, but detect as HDMI.
+	*/
+	if (is_lspcon_active(intel_dig_port)) {
+		struct intel_lspcon *lspcon = &intel_dig_port->lspcon;
+
+		if (lspcon->mode_of_op == DRM_LSPCON_MODE_LS)
+			return lspcon_ls_mode_detect(connector, force);
+	}
+
  	if (intel_dp->is_mst) {
  		/* MST devices are disconnected from a monitor POV */
  		intel_dp_unset_edid(intel_dp);
drivers/gpu/drm/i915/intel_drv.h +2 -0
index 205a463..fa77886 100644
@@ -1452,6 +1452,8 @@ struct intel_hdmi *enc_to_intel_hdmi(struct drm_encoder *encoder);
  bool intel_hdmi_compute_config(struct intel_encoder *encoder,
  			       struct intel_crtc_state *pipe_config);
  void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable);
+enum drm_connector_status
+intel_hdmi_detect(struct drm_connector *connector, bool force);
 
  /* intel_lvds.c */
  void intel_lvds_init(struct drm_device *dev);
drivers/gpu/drm/i915/intel_hdmi.c +2 -0
index 6b52c6a..79184e2 100644
@@ -1444,15 +1444,21 @@ intel_hdmi_set_edid(struct drm_connector *connector, bool force)
  {
  	struct drm_i915_private *dev_priv = to_i915(connector->dev);
  	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
+	struct intel_digital_port *dig_port = hdmi_to_dig_port(intel_hdmi);
+	struct i2c_adapter *adapter;
  	struct edid *edid = NULL;
  	bool connected = false;
 
  	if (force) {
  		intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
 
Quoted 15 lines

drivers/gpu/drm/i915/intel_hdmi.c intel_hdmi_set_edid(struct drm_connector *connector, bool force) · line 1461

Quoted 10 lines
drivers/gpu/drm/i915/intel_hdmi.c +7 -3
-		edid = drm_get_edid(connector,
-				    intel_gmbus_get_adapter(dev_priv,
-				    intel_hdmi->ddc_bus));
+		if (is_lspcon_active(dig_port))
+			adapter = &dig_port->lspcon.aux->ddc;
+		else
+			adapter = intel_gmbus_get_adapter(dev_priv,
+				intel_hdmi->ddc_bus);
+
+		edid = drm_get_edid(connector, adapter);

I'm not a fan of this. This is even taking the wrong power domain now, as does intel_hdmi_detect(). Probably LSPCON should just have a dedicated codepath for this stuff.

Got it, I will add-in a new function for lspcon's edid detection. And thanks for pointing out this power domain stuff.

Quoted 5 lines

If we ever have a board design with a DP++ port without a GMBUS connection, then we might have rethink things because then we'd have to use AUX also for HDMI DDC. But so far I'm not aware of such board designs existing, so might as well keep LSPCON separate.

Yes, and also, lspcon will be valid only for gen9/9.5 devices, until we get HDMI 2.0 native port. So I think we can call it ok to go.

Quoted 20 lines
Quoted 20 lines
drivers/gpu/drm/i915/intel_hdmi.c +1 -1
  		intel_hdmi_dp_dual_mode_detect(connector, edid != NULL);
 
@@ -1479,7 +1485,7 @@ intel_hdmi_set_edid(struct drm_connector *connector, bool force)
  	return connected;
  }
 
-static enum drm_connector_status
+enum drm_connector_status
  intel_hdmi_detect(struct drm_connector *connector, bool force)
  {
  	enum drm_connector_status status;
drivers/gpu/drm/i915/intel_lspcon.c +0 -0
index dd50491..75b5028 100644
@@ -37,6 +37,12 @@ bool is_lspcon_active(struct intel_digital_port *dig_port)
  	return dig_port->lspcon.active;
  }
 
Quoted 12 lines
Quoted 11 lines
drivers/gpu/drm/i915/intel_lspcon.c +6 -1
+enum drm_connector_status
+lspcon_ls_mode_detect(struct drm_connector *connector, bool force)
+{
+	return intel_hdmi_detect(connector, force);
+}
+
  enum drm_lspcon_mode lspcon_get_current_mode(struct intel_lspcon *lspcon)
  {
  	enum drm_lspcon_mode current_mode;
--

1.9.1

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

#14 lore raw

PATCH 4/5 drm/i915: Parse VBT data for lspcon

In reply to Shashank Sharma

Many GEN9 boards come with on-board lspcon cards.
Fot these boards, VBT configuration should properly point out if a particular port contains lspcon device, so that driver can initialize it properly.

This patch adds a utility function, which checks the VBT flag for lspcon bit, and tells us if a port is configured to have a lspcon device or not.

---
 drivers/gpu/drm/i915/i915_drv.h   |  3 +++
 drivers/gpu/drm/i915/intel_bios.c | 44 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +3 -0
index e4c8e34..32ddde5 100644
@@ -3622,6 +3622,9 @@ bool intel_bios_is_port_dp_dual_mode(struct drm_i915_private *dev_priv, enum por
 bool intel_bios_is_dsi_present(struct drm_i915_private *dev_priv, enum port *port);
 bool intel_bios_is_port_hpd_inverted(struct drm_i915_private *dev_priv,
 				     enum port port);
+bool intel_bios_is_lspcon_present(struct drm_i915_private *dev_priv,
+				enum port port);
+
 
 /* intel_opregion.c */
 #ifdef CONFIG_ACPI
drivers/gpu/drm/i915/intel_bios.c +44 -0

47 lines not on this page · raw message

Signature · 6 lines
1.9.1

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

Re: [PATCH 4/5] drm/i915: Parse VBT data for lspcon

Quoted 64 lines · Shashank Sharma

Many GEN9 boards come with on-board lspcon cards.
Fot these boards, VBT configuration should properly point out if a particular port contains lspcon device, so that driver can initialize it properly.

This patch adds a utility function, which checks the VBT flag for lspcon bit, and tells us if a port is configured to have a lspcon device or not.

---
 drivers/gpu/drm/i915/i915_drv.h   |  3 +++
 drivers/gpu/drm/i915/intel_bios.c | 44 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +3 -0
index e4c8e34..32ddde5 100644
@@ -3622,6 +3622,9 @@ bool intel_bios_is_port_dp_dual_mode(struct drm_i915_private *dev_priv, enum por
 bool intel_bios_is_dsi_present(struct drm_i915_private *dev_priv, enum port *port);
 bool intel_bios_is_port_hpd_inverted(struct drm_i915_private *dev_priv,
 				     enum port port);
+bool intel_bios_is_lspcon_present(struct drm_i915_private *dev_priv,
+				enum port port);
+
 
 /* intel_opregion.c */
 #ifdef CONFIG_ACPI
drivers/gpu/drm/i915/intel_bios.c +27 -0
index 624e755..501b57f 100644
@@ -1715,3 +1715,47 @@ intel_bios_is_port_hpd_inverted(struct drm_i915_private *dev_priv,
 
 	return false;
 }
+
+/**
+ * intel_bios_is_lspcon_present - if LSPCON is attached on %port
+ * @dev_priv:	i915 device instance
+ * @port:	port to check
+ *
+ * Return true if LSPCON is present on this port
+ */
+bool
+intel_bios_is_lspcon_present(struct drm_i915_private *dev_priv,
+				enum port port)
+{
+	int i;
+
+	if (WARN_ON_ONCE(!IS_GEN9(dev_priv)))
+		return false;
+
+	for (i = 0; i < dev_priv->vbt.child_dev_num; i++) {
+		if (!dev_priv->vbt.child_dev[i].common.lspcon)
+			continue;
+
+		switch (dev_priv->vbt.child_dev[i].common.dvo_port) {
+		case DVO_PORT_DPA:
+		case DVO_PORT_HDMIA:
+			if (port == PORT_A)
+				return true;
+			break;

drivers/gpu/drm/i915/intel_bios.c intel_bios_is_port_hpd_inverted(struct drm_i915_private *dev_priv, · line 1754

Quoted 10 lines
drivers/gpu/drm/i915/intel_bios.c +10 -0
+		case DVO_PORT_DPB:
+		case DVO_PORT_HDMIB:
+			if (port == PORT_B)
+				return true;
+			break;
+		case DVO_PORT_DPC:
+		case DVO_PORT_HDMIC:
+			if (port == PORT_C)
+				return true;
+			break;

With just A/B/C this looks like it's expecting only BXT, but you're checking for gen9 here. What's the deal?

Quoted 9 lines
drivers/gpu/drm/i915/intel_bios.c +7 -0
+		default:
+			break;
+		}
+	}
+
+	return false;
+}
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
#16 lore raw

Re: [PATCH 4/5] drm/i915: Parse VBT data for lspcon

Regards
Shashank

Quoted 70 lines · Ville Syrjälä
Quoted 69 lines · Shashank Sharma

Many GEN9 boards come with on-board lspcon cards.
Fot these boards, VBT configuration should properly point out if a particular port contains lspcon device, so that driver can initialize it properly.

This patch adds a utility function, which checks the VBT flag for lspcon bit, and tells us if a port is configured to have a lspcon device or not.

---
  drivers/gpu/drm/i915/i915_drv.h   |  3 +++
  drivers/gpu/drm/i915/intel_bios.c | 44 +++++++++++++++++++++++++++++++++++++++
  2 files changed, 47 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +3 -0
index e4c8e34..32ddde5 100644
@@ -3622,6 +3622,9 @@ bool intel_bios_is_port_dp_dual_mode(struct drm_i915_private *dev_priv, enum por
  bool intel_bios_is_dsi_present(struct drm_i915_private *dev_priv, enum port *port);
  bool intel_bios_is_port_hpd_inverted(struct drm_i915_private *dev_priv,
  				     enum port port);
+bool intel_bios_is_lspcon_present(struct drm_i915_private *dev_priv,
+				enum port port);
+
 
  /* intel_opregion.c */
  #ifdef CONFIG_ACPI
drivers/gpu/drm/i915/intel_bios.c +32 -0
index 624e755..501b57f 100644
@@ -1715,3 +1715,47 @@ intel_bios_is_port_hpd_inverted(struct drm_i915_private *dev_priv,
 
  	return false;
  }
+
+/**
+ * intel_bios_is_lspcon_present - if LSPCON is attached on %port
+ * @dev_priv:	i915 device instance
+ * @port:	port to check
+ *
+ * Return true if LSPCON is present on this port
+ */
+bool
+intel_bios_is_lspcon_present(struct drm_i915_private *dev_priv,
+				enum port port)
+{
+	int i;
+
+	if (WARN_ON_ONCE(!IS_GEN9(dev_priv)))
+		return false;
+
+	for (i = 0; i < dev_priv->vbt.child_dev_num; i++) {
+		if (!dev_priv->vbt.child_dev[i].common.lspcon)
+			continue;
+
+		switch (dev_priv->vbt.child_dev[i].common.dvo_port) {
+		case DVO_PORT_DPA:
+		case DVO_PORT_HDMIA:
+			if (port == PORT_A)
+				return true;
+			break;
+		case DVO_PORT_DPB:
+		case DVO_PORT_HDMIB:
+			if (port == PORT_B)
+				return true;
+			break;
Quoted 9 lines

drivers/gpu/drm/i915/intel_bios.c intel_bios_is_port_hpd_inverted(struct drm_i915_private *dev_priv, · line 1754

Quoted 5 lines
drivers/gpu/drm/i915/intel_bios.c +5 -0
+		case DVO_PORT_DPC:
+		case DVO_PORT_HDMIC:
+			if (port == PORT_C)
+				return true;
+			break;

With just A/B/C this looks like it's expecting only BXT, but you're checking for gen9 here. What's the deal?

Guilty, just copy-pasted from above function :), will add other ports too. Its supposed to work with Gen9.

Quoted 10 lines
Quoted 9 lines
drivers/gpu/drm/i915/intel_bios.c +7 -1
+		default:
+			break;
+		}
+	}
+
+	return false;
+}
--

1.9.1

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

#17 lore raw

PATCH 5/5 drm/i915: Enable lspcon initialization

In reply to Shashank Sharma

This patch adds initialization code for lspcon. What we are doing here is:
- Check if lspcon is configured in VBT for this port
- If lspcon is configured, configure it as DP port
- Register additional HDMI functions to support LS mode functionalities.

---
 drivers/gpu/drm/i915/intel_ddi.c  | 36 ++++++++++++++++++++++++++++++++++--
 drivers/gpu/drm/i915/intel_drv.h  |  4 ++++
 drivers/gpu/drm/i915/intel_hdmi.c | 17 +++++++++++++++++
 3 files changed, 55 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +34 -2
index 811c829..2107c0d 100644
@@ -2314,8 +2314,9 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_digital_port *intel_dig_port;
 	struct intel_encoder *intel_encoder;
+	struct intel_connector *intel_connector = NULL;
 	struct drm_encoder *encoder;
-	bool init_hdmi, init_dp;
+	bool init_hdmi, init_dp, init_lspcon = false;
 	int max_lanes;
 
 	if (I915_READ(DDI_BUF_CTL(PORT_A)) & DDI_A_4_LANES) {
@@ -2347,6 +2348,19 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
 	init_hdmi = (dev_priv->vbt.ddi_port_info[port].supports_dvi ||
 		     dev_priv->vbt.ddi_port_info[port].supports_hdmi);
 	init_dp = dev_priv->vbt.ddi_port_info[port].supports_dp;
+
+	if (intel_bios_is_lspcon_present(dev_priv, port)) {
+		/*
+		* Lspcon device needs to be driven with DP connector
+		* with special detection sequence. So make sure DP
+		* is initialized before lspcon.
+		*/
+		init_dp = true;
+		init_lspcon = true;
+		init_hdmi = false;
+		DRM_DEBUG_KMS("VBT says port %c has lspcon\n", port_name(port));
+	}
+
 	if (!init_dp && !init_hdmi) {
 		DRM_DEBUG_KMS("VBT says port %c is not DVI/HDMI/DP compatible, respect it\n",
 			      port_name(port));
@@ -2399,7 +2413,8 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
 	intel_encoder->cloneable = 0;
 
 	if (init_dp) {
-		if (!intel_ddi_init_dp_connector(intel_dig_port))
+		intel_connector = intel_ddi_init_dp_connector(intel_dig_port);
+		if (!intel_connector)
 			goto err;
 
 		intel_dig_port->hpd_pulse = intel_dp_hpd_pulse;
@@ -2420,6 +2435,23 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
 			goto err;
 	}
 
+	if (init_lspcon) {
+		if (lspcon_init(intel_dig_port)) {
+			if (intel_hdmi_init_minimum(intel_dig_port,
+				intel_connector)) {
+				DRM_ERROR("HDMI init for LSPCON failed\n");
+				goto err;
+			}
+		} else {
+			/*
+			* LSPCON init faied, but DP init was success, so lets try to
+			* drive as DP++ port.
+			*/
+			DRM_ERROR("LSPCON init failed on port %c\n",
+				port_name(port));
+		}
+	}
+
 	return;
 
 err:
drivers/gpu/drm/i915/intel_drv.h +4 -0
index fa77886..402e656 100644
@@ -1454,6 +1454,10 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
 void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable);
 enum drm_connector_status
 intel_hdmi_detect(struct drm_connector *connector, bool force);
+int intel_hdmi_init_minimum(struct intel_digital_port *intel_dig_port,
+			       struct intel_connector *intel_connector);
+
+
 
 /* intel_lvds.c */
 void intel_lvds_init(struct drm_device *dev);
drivers/gpu/drm/i915/intel_hdmi.c +17 -0
index 79184e2..54b0b46 100644
@@ -1931,6 +1931,23 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
 	}
 }
 
+int intel_hdmi_init_minimum(struct intel_digital_port *intel_dig_port,
+			       struct intel_connector *intel_connector)
+{
+	struct intel_hdmi *intel_hdmi = &intel_dig_port->hdmi;
+
+	if (WARN(intel_dig_port->max_lanes < 4,
+		"Not enough lanes (%d) for HDMI on port %c\n",
+		intel_dig_port->max_lanes, port_name(intel_dig_port->port)))
+		return -EINVAL;
+
+	intel_hdmi->write_infoframe = hsw_write_infoframe;
+	intel_hdmi->set_infoframes = hsw_set_infoframes;
+	intel_hdmi->infoframe_enabled = hsw_infoframe_enabled;
+	intel_hdmi->attached_connector = intel_connector;
+	return 0;
+}
+
 void intel_hdmi_init(struct drm_device *dev,
 		     i915_reg_t hdmi_reg, enum port port)
 {
Signature · 6 lines
1.9.1

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

Re: [PATCH 5/5] drm/i915: Enable lspcon initialization

Quoted 112 lines · Shashank Sharma

This patch adds initialization code for lspcon. What we are doing here is:
- Check if lspcon is configured in VBT for this port
- If lspcon is configured, configure it as DP port
- Register additional HDMI functions to support LS mode functionalities.

---
 drivers/gpu/drm/i915/intel_ddi.c  | 36 ++++++++++++++++++++++++++++++++++--
 drivers/gpu/drm/i915/intel_drv.h  |  4 ++++
 drivers/gpu/drm/i915/intel_hdmi.c | 17 +++++++++++++++++
 3 files changed, 55 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +34 -2
index 811c829..2107c0d 100644
@@ -2314,8 +2314,9 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_digital_port *intel_dig_port;
 	struct intel_encoder *intel_encoder;
+	struct intel_connector *intel_connector = NULL;
 	struct drm_encoder *encoder;
-	bool init_hdmi, init_dp;
+	bool init_hdmi, init_dp, init_lspcon = false;
 	int max_lanes;
 
 	if (I915_READ(DDI_BUF_CTL(PORT_A)) & DDI_A_4_LANES) {
@@ -2347,6 +2348,19 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
 	init_hdmi = (dev_priv->vbt.ddi_port_info[port].supports_dvi ||
 		     dev_priv->vbt.ddi_port_info[port].supports_hdmi);
 	init_dp = dev_priv->vbt.ddi_port_info[port].supports_dp;
+
+	if (intel_bios_is_lspcon_present(dev_priv, port)) {
+		/*
+		* Lspcon device needs to be driven with DP connector
+		* with special detection sequence. So make sure DP
+		* is initialized before lspcon.
+		*/
+		init_dp = true;
+		init_lspcon = true;
+		init_hdmi = false;
+		DRM_DEBUG_KMS("VBT says port %c has lspcon\n", port_name(port));
+	}
+
 	if (!init_dp && !init_hdmi) {
 		DRM_DEBUG_KMS("VBT says port %c is not DVI/HDMI/DP compatible, respect it\n",
 			      port_name(port));
@@ -2399,7 +2413,8 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
 	intel_encoder->cloneable = 0;
 
 	if (init_dp) {
-		if (!intel_ddi_init_dp_connector(intel_dig_port))
+		intel_connector = intel_ddi_init_dp_connector(intel_dig_port);
+		if (!intel_connector)
 			goto err;
 
 		intel_dig_port->hpd_pulse = intel_dp_hpd_pulse;
@@ -2420,6 +2435,23 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
 			goto err;
 	}
 
+	if (init_lspcon) {
+		if (lspcon_init(intel_dig_port)) {
+			if (intel_hdmi_init_minimum(intel_dig_port,
+				intel_connector)) {
+				DRM_ERROR("HDMI init for LSPCON failed\n");
+				goto err;
+			}
+		} else {
+			/*
+			* LSPCON init faied, but DP init was success, so lets try to
+			* drive as DP++ port.
+			*/
+			DRM_ERROR("LSPCON init failed on port %c\n",
+				port_name(port));
+		}
+	}
+
 	return;
 
 err:
drivers/gpu/drm/i915/intel_drv.h +4 -0
index fa77886..402e656 100644
@@ -1454,6 +1454,10 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
 void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable);
 enum drm_connector_status
 intel_hdmi_detect(struct drm_connector *connector, bool force);
+int intel_hdmi_init_minimum(struct intel_digital_port *intel_dig_port,
+			       struct intel_connector *intel_connector);
+
+
 
 /* intel_lvds.c */
 void intel_lvds_init(struct drm_device *dev);
drivers/gpu/drm/i915/intel_hdmi.c +6 -0
index 79184e2..54b0b46 100644
@@ -1931,6 +1931,23 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
 	}
 }
 
+int intel_hdmi_init_minimum(struct intel_digital_port *intel_dig_port,
+			       struct intel_connector *intel_connector)
+{
+	struct intel_hdmi *intel_hdmi = &intel_dig_port->hdmi;
+
+	if (WARN(intel_dig_port->max_lanes < 4,

drivers/gpu/drm/i915/intel_hdmi.c void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port, · line 1949

Quoted 10 lines
drivers/gpu/drm/i915/intel_hdmi.c +10 -0
+		"Not enough lanes (%d) for HDMI on port %c\n",
+		intel_dig_port->max_lanes, port_name(intel_dig_port->port)))
+		return -EINVAL;
+
+	intel_hdmi->write_infoframe = hsw_write_infoframe;
+	intel_hdmi->set_infoframes = hsw_set_infoframes;
+	intel_hdmi->infoframe_enabled = hsw_infoframe_enabled;
+	intel_hdmi->attached_connector = intel_connector;
+	return 0;
+}

Hmm. I think I had patches somewhere to isolate the infoframe stuff from the HDMI code a bit better. I think I even had patches to move the infoframe hooks to the dig_port level. Should maybe dig those up.

Quoted 6 lines
drivers/gpu/drm/i915/intel_hdmi.c +1 -0
+
 void intel_hdmi_init(struct drm_device *dev,
 		     i915_reg_t hdmi_reg, enum port port)
 {
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
#19 lore raw

Re: [PATCH 5/5] drm/i915: Enable lspcon initialization

Regards
Shashank

Quoted 119 lines · Ville Syrjälä
Quoted 118 lines · Shashank Sharma

This patch adds initialization code for lspcon. What we are doing here is:
- Check if lspcon is configured in VBT for this port
- If lspcon is configured, configure it as DP port
- Register additional HDMI functions to support LS mode functionalities.

---
  drivers/gpu/drm/i915/intel_ddi.c  | 36 ++++++++++++++++++++++++++++++++++--
  drivers/gpu/drm/i915/intel_drv.h  |  4 ++++
  drivers/gpu/drm/i915/intel_hdmi.c | 17 +++++++++++++++++
  3 files changed, 55 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +34 -2
index 811c829..2107c0d 100644
@@ -2314,8 +2314,9 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
  	struct drm_i915_private *dev_priv = dev->dev_private;
  	struct intel_digital_port *intel_dig_port;
  	struct intel_encoder *intel_encoder;
+	struct intel_connector *intel_connector = NULL;
  	struct drm_encoder *encoder;
-	bool init_hdmi, init_dp;
+	bool init_hdmi, init_dp, init_lspcon = false;
  	int max_lanes;
 
  	if (I915_READ(DDI_BUF_CTL(PORT_A)) & DDI_A_4_LANES) {
@@ -2347,6 +2348,19 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
  	init_hdmi = (dev_priv->vbt.ddi_port_info[port].supports_dvi ||
  		     dev_priv->vbt.ddi_port_info[port].supports_hdmi);
  	init_dp = dev_priv->vbt.ddi_port_info[port].supports_dp;
+
+	if (intel_bios_is_lspcon_present(dev_priv, port)) {
+		/*
+		* Lspcon device needs to be driven with DP connector
+		* with special detection sequence. So make sure DP
+		* is initialized before lspcon.
+		*/
+		init_dp = true;
+		init_lspcon = true;
+		init_hdmi = false;
+		DRM_DEBUG_KMS("VBT says port %c has lspcon\n", port_name(port));
+	}
+
  	if (!init_dp && !init_hdmi) {
  		DRM_DEBUG_KMS("VBT says port %c is not DVI/HDMI/DP compatible, respect it\n",
  			      port_name(port));
@@ -2399,7 +2413,8 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
  	intel_encoder->cloneable = 0;
 
  	if (init_dp) {
-		if (!intel_ddi_init_dp_connector(intel_dig_port))
+		intel_connector = intel_ddi_init_dp_connector(intel_dig_port);
+		if (!intel_connector)
  			goto err;
 
  		intel_dig_port->hpd_pulse = intel_dp_hpd_pulse;
@@ -2420,6 +2435,23 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
  			goto err;
  	}
 
+	if (init_lspcon) {
+		if (lspcon_init(intel_dig_port)) {
+			if (intel_hdmi_init_minimum(intel_dig_port,
+				intel_connector)) {
+				DRM_ERROR("HDMI init for LSPCON failed\n");
+				goto err;
+			}
+		} else {
+			/*
+			* LSPCON init faied, but DP init was success, so lets try to
+			* drive as DP++ port.
+			*/
+			DRM_ERROR("LSPCON init failed on port %c\n",
+				port_name(port));
+		}
+	}
+
  	return;
 
  err:
drivers/gpu/drm/i915/intel_drv.h +4 -0
index fa77886..402e656 100644
@@ -1454,6 +1454,10 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
  void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable);
  enum drm_connector_status
  intel_hdmi_detect(struct drm_connector *connector, bool force);
+int intel_hdmi_init_minimum(struct intel_digital_port *intel_dig_port,
+			       struct intel_connector *intel_connector);
+
+
 
  /* intel_lvds.c */
  void intel_lvds_init(struct drm_device *dev);
drivers/gpu/drm/i915/intel_hdmi.c +12 -0
index 79184e2..54b0b46 100644
@@ -1931,6 +1931,23 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
  	}
  }
 
+int intel_hdmi_init_minimum(struct intel_digital_port *intel_dig_port,
+			       struct intel_connector *intel_connector)
+{
+	struct intel_hdmi *intel_hdmi = &intel_dig_port->hdmi;
+
+	if (WARN(intel_dig_port->max_lanes < 4,
+		"Not enough lanes (%d) for HDMI on port %c\n",
+		intel_dig_port->max_lanes, port_name(intel_dig_port->port)))
+		return -EINVAL;
+
+	intel_hdmi->write_infoframe = hsw_write_infoframe;
+	intel_hdmi->set_infoframes = hsw_set_infoframes;
Quoted 8 lines

drivers/gpu/drm/i915/intel_hdmi.c void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port, · line 1949

Quoted 4 lines
drivers/gpu/drm/i915/intel_hdmi.c +4 -0
+	intel_hdmi->infoframe_enabled = hsw_infoframe_enabled;
+	intel_hdmi->attached_connector = intel_connector;
+	return 0;
+}

Hmm. I think I had patches somewhere to isolate the infoframe stuff from the HDMI code a bit better. I think I even had patches to move the infoframe hooks to the dig_port level. Should maybe dig those up.

Sure, that will be more systematic, and a better design.

Quoted 8 lines
Quoted 7 lines
drivers/gpu/drm/i915/intel_hdmi.c +1 -1
+
  void intel_hdmi_init(struct drm_device *dev,
  		     i915_reg_t hdmi_reg, enum port port)
  {
--

1.9.1

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

#20 lore raw

✗ Ro.CI.BAT: warning for Enable lspcon support for GEN9 devices

In reply to Shashank Sharma
== Series Details ==

== Series Details ==

Series: Enable lspcon support for GEN9 devices
URL : https://patchwork.freedesktop.org/series/8024/
State : warning

== Summary ==

Series 8024v1 Enable lspcon support for GEN9 devices
http://patchwork.freedesktop.org/api/1.0/series/8024/revisions/1/mbox

Test core_auth:

        Subgroup basic-auth:
                pass       -> DMESG-WARN (ro-skl-i7-6700hq)
Test drv_module_reload_basic:
                pass       -> DMESG-WARN (fi-bdw-i7-5557u)
                pass       -> DMESG-WARN (ro-bdw-i7-5600u)
                pass       -> DMESG-WARN (fi-hsw-i7-4770r)
                pass       -> DMESG-WARN (ro-bdw-i5-5250u)
                pass       -> DMESG-WARN (ro-hsw-i7-4770r)
                pass       -> DMESG-WARN (fi-hsw-i7-4770k)
Test gem_busy:
        Subgroup basic-blt:
                pass       -> DMESG-WARN (ro-skl-i7-6700hq)
Test gem_close_race:
        Subgroup basic-process:
                dmesg-warn -> PASS       (ro-skl-i7-6700hq)
Test gem_exec_flush:
        Subgroup basic-batch-kernel-default-cmd:
                fail       -> PASS       (fi-byt-n2820)
        Subgroup basic-uc-set-default:
                pass       -> DMESG-WARN (ro-skl-i7-6700hq)
Test gem_exec_store:
        Subgroup basic-default:
                dmesg-warn -> PASS       (ro-ivb2-i7-3770)
Test gem_mmap_gtt:
        Subgroup basic-small-copy:
                dmesg-warn -> PASS       (ro-skl-i7-6700hq)
Test gem_storedw_loop:
        Subgroup basic-bsd:
                dmesg-warn -> PASS       (ro-skl-i7-6700hq)
Test kms_addfb_basic:
        Subgroup addfb25-framebuffer-vs-set-tiling:
                dmesg-warn -> PASS       (ro-skl-i7-6700hq)
        Subgroup addfb25-x-tiled:
                dmesg-warn -> PASS       (ro-skl-i7-6700hq)
        Subgroup addfb25-y-tiled-small:
                dmesg-warn -> PASS       (ro-skl-i7-6700hq)
        Subgroup bad-pitch-0:
                pass       -> DMESG-WARN (ro-skl-i7-6700hq)
        Subgroup bad-pitch-1024:
                dmesg-warn -> PASS       (ro-skl-i7-6700hq)
        Subgroup bad-pitch-63:
                dmesg-warn -> PASS       (ro-skl-i7-6700hq)
        Subgroup too-high:
                dmesg-warn -> PASS       (ro-skl-i7-6700hq)
        Subgroup too-wide:
                dmesg-warn -> PASS       (ro-skl-i7-6700hq)
Test kms_force_connector_basic:
        Subgroup prune-stale-modes:
                pass       -> DMESG-WARN (ro-ivb2-i7-3770)
Test kms_psr_sink_crc:
        Subgroup psr_basic:
                dmesg-warn -> PASS       (ro-skl-i7-6700hq)
fi-bdw-i7-5557u  total:102  pass:92   dwarn:1   dfail:0   fail:0   skip:8  
fi-bsw-n3050     total:209  pass:167  dwarn:0   dfail:0   fail:2   skip:40 
fi-byt-n2820     total:209  pass:169  dwarn:0   dfail:0   fail:2   skip:38 
fi-hsw-i7-4770k  total:209  pass:189  dwarn:1   dfail:0   fail:0   skip:19 
fi-hsw-i7-4770r  total:209  pass:185  dwarn:1   dfail:0   fail:0   skip:23 
fi-skl-i7-6700k  total:209  pass:184  dwarn:0   dfail:0   fail:0   skip:25 
fi-snb-i7-2600   total:209  pass:170  dwarn:0   dfail:0   fail:0   skip:39 
ro-bdw-i5-5250u  total:102  pass:92   dwarn:1   dfail:0   fail:0   skip:8  
ro-bdw-i7-5600u  total:102  pass:74   dwarn:1   dfail:0   fail:0   skip:26 
ro-bsw-n3050     total:209  pass:168  dwarn:0   dfail:0   fail:2   skip:39 
ro-byt-n2820     total:209  pass:169  dwarn:0   dfail:0   fail:3   skip:37 
ro-hsw-i7-4770r  total:102  pass:81   dwarn:1   dfail:0   fail:0   skip:19 
ro-ilk1-i5-650   total:204  pass:146  dwarn:0   dfail:0   fail:1   skip:57 
ro-ivb-i7-3770   total:102  pass:75   dwarn:0   dfail:0   fail:0   skip:26 
ro-ivb2-i7-3770  total:102  pass:45   dwarn:34  dfail:0   fail:0   skip:22 
ro-skl-i7-6700hq total:204  pass:178  dwarn:5   dfail:0   fail:0   skip:21 
ro-snb-i7-2620M  total:102  pass:72   dwarn:0   dfail:0   fail:0   skip:29 

ro-bdw-i7-5557U failed to connect after reboot

Results at /archive/results/CI_IGT_test/RO_Patchwork_1059/

031f2bb drm-intel-nightly: 2016y-05m-30d-17h-51m-33s UTC integration manifest 3616edf drm/i915: Enable lspcon initialization
558b095 drm/i915: Parse VBT data for lspcon
9681714 drm/i915: lspcon detection
9792f65 drm/i915: Add lspcon support for I915 driver
1e296d6 drm: Helper for LSPCON in drm_dp_dual_mode

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