]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/i915: Iterate all child devs in intel_bios_is_port_present()
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 14 Feb 2023 07:38:18 +0000 (09:38 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 14 Feb 2023 12:08:30 +0000 (14:08 +0200)
Instead of consulting vbt.ports[] lets just go through the
whole child device list to check whether a specific port
was declared by the VBT or not.

Note that this doesn't change anything wrt. detecting duplicate
child devices with the same port as vbt.ports[] would also always
contain exactly one of the duplicates.

v2: Include a is_port_valid() check to deal with some broken VBTs
    Mention something about duplicate port detection (Jani)

Cc: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230214073818.20231-1-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
drivers/gpu/drm/i915/display/intel_bios.c

index db0beb9faf3f23d90396e358aff5655bbc9ff5a2..41c584f3c1520edf8d6ea189e51ac3230d50caba 100644 (file)
@@ -3399,10 +3399,22 @@ bool intel_bios_is_lvds_present(struct drm_i915_private *i915, u8 *i2c_pin)
  */
 bool intel_bios_is_port_present(struct drm_i915_private *i915, enum port port)
 {
+       const struct intel_bios_encoder_data *devdata;
+
        if (WARN_ON(!has_ddi_port_info(i915)))
                return true;
 
-       return i915->display.vbt.ports[port];
+       if (!is_port_valid(i915, port))
+               return false;
+
+       list_for_each_entry(devdata, &i915->display.vbt.display_devices, node) {
+               const struct child_device_config *child = &devdata->child;
+
+               if (dvo_port_to_port(i915, child->dvo_port) == port)
+                       return true;
+       }
+
+       return false;
 }
 
 /**