drm/i915/bios: create fake child devices on missing VBT

Instead of initialing data directly in ddi_port_info array, create fake
child devices for default outputs when the VBT is missing. This makes
further unification of output handling easier.

This will make intel_bios_is_port_present() return true for the fake
child devices. This may cause subtle changes in a handful of places.

Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/91675b40a78bd04bf138598d979661257181880d.1615998927.git.jani.nikula@intel.com
This commit is contained in:
Jani Nikula 2021-03-17 18:36:46 +02:00
parent 3ae04c0c7e
commit 51f5748179

View File

@ -2087,8 +2087,8 @@ init_vbt_missing_defaults(struct drm_i915_private *i915)
return;
for_each_port_masked(port, ports) {
struct ddi_vbt_port_info *info =
&i915->vbt.ddi_port_info[port];
struct display_device_data *devdata;
struct child_device_config *child;
enum phy phy = intel_port_to_phy(i915, port);
/*
@ -2098,11 +2098,38 @@ init_vbt_missing_defaults(struct drm_i915_private *i915)
if (intel_phy_is_tc(i915, phy))
continue;
info->supports_dvi = (port != PORT_A && port != PORT_E);
info->supports_hdmi = info->supports_dvi;
info->supports_dp = (port != PORT_E);
info->supports_edp = (port == PORT_A);
/* Create fake child device config */
devdata = kzalloc(sizeof(*devdata), GFP_KERNEL);
if (!devdata)
break;
child = &devdata->child;
if (port == PORT_F)
child->dvo_port = DVO_PORT_HDMIF;
else if (port == PORT_E)
child->dvo_port = DVO_PORT_HDMIE;
else
child->dvo_port = DVO_PORT_HDMIA + port;
if (port != PORT_A && port != PORT_E)
child->device_type |= DEVICE_TYPE_TMDS_DVI_SIGNALING;
if (port != PORT_E)
child->device_type |= DEVICE_TYPE_DISPLAYPORT_OUTPUT;
if (port == PORT_A)
child->device_type |= DEVICE_TYPE_INTERNAL_CONNECTOR;
list_add_tail(&devdata->node, &i915->vbt.display_devices);
drm_dbg_kms(&i915->drm,
"Generating default VBT child device with type 0x04%x on port %c\n",
child->device_type, port_name(port));
}
/* Bypass some minimum baseline VBT version checks */
i915->vbt.version = 155;
}
static const struct bdb_header *get_bdb_header(const struct vbt_header *vbt)
@ -2279,10 +2306,6 @@ void intel_bios_init(struct drm_i915_private *i915)
/* Depends on child device list */
parse_compression_parameters(i915, bdb);
/* Further processing on pre-parsed data */
parse_sdvo_device_mapping(i915);
parse_ddi_ports(i915);
out:
if (!vbt) {
drm_info(&i915->drm,
@ -2290,6 +2313,10 @@ out:
init_vbt_missing_defaults(i915);
}
/* Further processing on pre-parsed or generated child device data */
parse_sdvo_device_mapping(i915);
parse_ddi_ports(i915);
kfree(oprom_vbt);
}