diff mbox series

[3/6] drm/i915/bios: Use i915->vbt.ports[] for all g4x+

Message ID 20211217155403.31477-4-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: Extend parse_ddi_port() to all g4x+ platforms | expand

Commit Message

Ville Syrjälä Dec. 17, 2021, 3:54 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

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), we 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).

TODO: actually smoke test on various platforms

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_bios.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Jani Nikula Dec. 22, 2021, 9:19 a.m. UTC | #1
On Fri, 17 Dec 2021, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> 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), we 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).

Aligns with what I figured in my reply earlier in the thread. I still
think we should do this for maintainability, even though there's a risk
we'll need to follow-up with additional checks/sanitization for older
platforms in parse_ddi_port().

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

>
> TODO: actually smoke test on various platforms
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  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 b7adea9827c3..d7d64d3bf083 100644
> --- a/drivers/gpu/drm/i915/display/intel_bios.c
> +++ b/drivers/gpu/drm/i915/display/intel_bios.c
> @@ -2075,7 +2075,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)
> @@ -2085,9 +2085,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);
>  }
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
index b7adea9827c3..d7d64d3bf083 100644
--- a/drivers/gpu/drm/i915/display/intel_bios.c
+++ b/drivers/gpu/drm/i915/display/intel_bios.c
@@ -2075,7 +2075,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)
@@ -2085,9 +2085,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);
 }