Skip to content

Commit

Permalink
drm/i915/display: hide workaround for broken vbt in intel_bios.c
Browse files Browse the repository at this point in the history
Instead of poluting the normal code path in intel_display.c, make
intel_bios.c handle the brokenness of the VBT.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210430223808.1078010-5-lucas.demarchi@intel.com
  • Loading branch information
Lucas De Marchi committed May 10, 2021
1 parent 097d9e9 commit 5a9d38b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
20 changes: 20 additions & 0 deletions drivers/gpu/drm/i915/display/intel_bios.c
Original file line number Diff line number Diff line change
Expand Up @@ -1852,6 +1852,19 @@ intel_bios_encoder_supports_edp(const struct intel_bios_encoder_data *devdata)
devdata->child.device_type & DEVICE_TYPE_INTERNAL_CONNECTOR;
}

static bool is_port_valid(struct drm_i915_private *i915, enum port port)
{
/*
* On some ICL/CNL SKUs port F is not present, but broken VBTs mark
* the port as present. Only try to initialize port F for the
* SKUs that may actually have it.
*/
if (port == PORT_F && (IS_ICELAKE(i915) || IS_CANNONLAKE(i915)))
return IS_ICL_WITH_PORT_F(i915) || IS_CNL_WITH_PORT_F(i915);

return true;
}

static void parse_ddi_port(struct drm_i915_private *i915,
struct intel_bios_encoder_data *devdata)
{
Expand All @@ -1865,6 +1878,13 @@ static void parse_ddi_port(struct drm_i915_private *i915,
if (port == PORT_NONE)
return;

if (!is_port_valid(i915, port)) {
drm_dbg_kms(&i915->drm,
"VBT reports port %c as supported, but that can't be true: skipping\n",
port_name(port));
return;
}

info = &i915->vbt.ddi_port_info[port];

if (info->devdata) {
Expand Down
14 changes: 2 additions & 12 deletions drivers/gpu/drm/i915/display/intel_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -11199,15 +11199,7 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
intel_ddi_init(dev_priv, PORT_C);
intel_ddi_init(dev_priv, PORT_D);
intel_ddi_init(dev_priv, PORT_E);

/*
* On some ICL SKUs port F is not present, but broken VBTs mark
* the port as present. Only try to initialize port F for the
* SKUs that may actually have it.
*/
if (IS_ICL_WITH_PORT_F(dev_priv))
intel_ddi_init(dev_priv, PORT_F);

intel_ddi_init(dev_priv, PORT_F);
icl_dsi_init(dev_priv);
} else if (IS_GEMINILAKE(dev_priv) || IS_BROXTON(dev_priv)) {
intel_ddi_init(dev_priv, PORT_A);
Expand All @@ -11220,9 +11212,7 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
intel_ddi_init(dev_priv, PORT_C);
intel_ddi_init(dev_priv, PORT_D);
intel_ddi_init(dev_priv, PORT_E);

if (IS_CNL_WITH_PORT_F(dev_priv))
intel_ddi_init(dev_priv, PORT_F);
intel_ddi_init(dev_priv, PORT_F);
} else if (HAS_DDI(dev_priv)) {
u32 found;

Expand Down

0 comments on commit 5a9d38b

Please sign in to comment.