[Xenial] [PATCH 3/5] drm/i915: Parse VBT data for lspcon

Kai-Heng Feng kai.heng.feng at canonical.com
Tue Mar 28 07:42:16 UTC 2017


From: Shashank Sharma <shashank.sharma at intel.com>

BugLink: https://bugs.launchpad.net/bugs/1676747

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.

V2: Fixed review comments from Ville
- Do not forget PORT_D while checking lspcon for GEN9

V3: Addressed review comments from Rodrigo
- Create a HAS_LSPCON() macro for better use case handling.
- Do not dump warnings for non-gen-9 platforms, it will be noise.

V4: Rebase
V5: Rebase
V6: Pass dev_priv to HAS_LSPCON() macro

Signed-off-by: Shashank Sharma <shashank.sharma at intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi at intel.com>
Acked-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula at intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1476455212-27893-4-git-send-email-shashank.sharma@intel.com
(cherry picked from commit 6389dd83768485a251dc0c5252dbc9a96f86ca53)
Signed-off-by: Kai-Heng Feng <kai.heng.feng at canonical.com>
---
 ubuntu/i915/i915_drv.h   |  5 +++++
 ubuntu/i915/intel_bios.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+)

diff --git a/ubuntu/i915/i915_drv.h b/ubuntu/i915/i915_drv.h
index 17ea2689d2a3..499810cbf7d6 100644
--- a/ubuntu/i915/i915_drv.h
+++ b/ubuntu/i915/i915_drv.h
@@ -2736,6 +2736,8 @@ struct drm_i915_cmd_table {
 #define HAS_GMCH_DISPLAY(dev) (INTEL_INFO(dev)->gen < 5 || \
 			       IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev))
 
+#define HAS_LSPCON(dev_priv) (IS_GEN9(dev_priv))
+
 /* DPF == dynamic parity feature */
 #define HAS_L3_DPF(dev) (IS_IVYBRIDGE(dev) || IS_HASWELL(dev))
 #define NUM_L3_SLICES(dev) (IS_HSW_GT3(dev) ? 2 : HAS_L3_DPF(dev))
@@ -3497,6 +3499,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
diff --git a/ubuntu/i915/intel_bios.c b/ubuntu/i915/intel_bios.c
index b9022fa053d6..c42121e82791 100644
--- a/ubuntu/i915/intel_bios.c
+++ b/ubuntu/i915/intel_bios.c
@@ -1740,3 +1740,52 @@ 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 (!HAS_LSPCON(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;
+		case DVO_PORT_DPC:
+		case DVO_PORT_HDMIC:
+			if (port == PORT_C)
+				return true;
+			break;
+		case DVO_PORT_DPD:
+		case DVO_PORT_HDMID:
+			if (port == PORT_D)
+				return true;
+			break;
+		default:
+			break;
+		}
+	}
+
+	return false;
+}
-- 
2.12.1





More information about the kernel-team mailing list