Blob Blame History Raw
From 30a6d3d052fd77ac8fa975b7e2ca3f5e3161912c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= <ville.syrjala@linux.intel.com>
Date: Fri, 17 Dec 2021 17:54:00 +0200
Subject: drm/i915/bios: Use i915->vbt.ports[] for all g4x+
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Git-commit: 594c504d33343657ad3b24ff8e4ef032cd4de25e
Patch-mainline: v5.18-rc1
References: jsc#PED-1166 jsc#PED-1168 jsc#PED-1170 jsc#PED-1218 jsc#PED-1220 jsc#PED-1222 jsc#PED-1223 jsc#PED-1225

Extend the vbt.ports[] stuff for all g4x+ platforms. We do need
to drop the version check as some elk/ctg machines may have VBTs
older than that. The oldest I know is an elk with version 142.
But the child device stuff has had the correct size since at
least version 125 (observed on my sdg), so from that angle this
should be totally safe.

This does couple of things:
- Start using the aux_ch/ddc_pin from VBT instead of just the
  hardcoded defaults. Hopefully there are no VBTs with entirely
  bogus information here.
- Start using i915->vbt.ports[] for intel_bios_is_port_dp_dual_mode().
  Should be fine as the logic doesn't actually change.
- Start using i915->vbt.ports[] for intel_bios_is_port_edp().
  The old codepath only looks at the DP DVO ports, the new codepath
  looks at both DP and HDMI DVO ports. In principle that should not
  matter. We also stop looking at some of the other device type bits
  (eg. LVDS,MIPI,ANALOG,etc.). Hopefully no VBT is broken enough that
  it sets up totally conflicting device type bits (eg. LVDS+eDP at the
  same time). We also lose the "g4x->no eDP ever" hardcoding (shouldn't
  be hard to re-introduce that into eg. sanitize_device_type() if needed).

Lightly smoke tested on a set of machines (one of ctg,ilk,snb,ivb each)
with both DP and HDMI (DP++). Everything still worked as it should.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211217155403.31477-4-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Patrik Jakobsson <pjakobsson@suse.de>
---
 drivers/gpu/drm/i915/display/intel_bios.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
index 1757f199a532..b705339fb716 100644
--- a/drivers/gpu/drm/i915/display/intel_bios.c
+++ b/drivers/gpu/drm/i915/display/intel_bios.c
@@ -2055,7 +2055,7 @@ static void parse_ddi_port(struct drm_i915_private *i915,
 
 static bool has_ddi_port_info(struct drm_i915_private *i915)
 {
-	return HAS_DDI(i915) || IS_CHERRYVIEW(i915);
+	return DISPLAY_VER(i915) >= 5 || IS_G4X(i915);
 }
 
 static void parse_ddi_ports(struct drm_i915_private *i915)
@@ -2065,9 +2065,6 @@ static void parse_ddi_ports(struct drm_i915_private *i915)
 	if (!has_ddi_port_info(i915))
 		return;
 
-	if (i915->vbt.version < 155)
-		return;
-
 	list_for_each_entry(devdata, &i915->vbt.display_devices, node)
 		parse_ddi_port(i915, devdata);
 }
-- 
2.38.1