]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
drm/i915: move VBT based eDP port check to intel_bios.c
authorJani Nikula <jani.nikula@intel.com>
Wed, 16 Mar 2016 10:43:31 +0000 (12:43 +0200)
committerJani Nikula <jani.nikula@intel.com>
Wed, 16 Mar 2016 16:28:36 +0000 (18:28 +0200)
Hide knowledge about VBT child devices in intel_bios.c.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1458125015-7931-3-git-send-email-jani.nikula@intel.com
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/intel_bios.c
drivers/gpu/drm/i915/intel_dp.c

index c3c8663573bca2905ba569b2c50c9d23ada5373a..e252978d6f1ba5c7d2da80eab0f7578c86bb14bc 100644 (file)
@@ -3355,6 +3355,7 @@ int intel_bios_init(struct drm_i915_private *dev_priv);
 bool intel_bios_is_valid_vbt(const void *buf, size_t size);
 bool intel_bios_is_tv_present(struct drm_i915_private *dev_priv);
 bool intel_bios_is_lvds_present(struct drm_i915_private *dev_priv, u8 *i2c_pin);
+bool intel_bios_is_port_edp(struct drm_i915_private *dev_priv, enum port port);
 
 /* intel_opregion.c */
 #ifdef CONFIG_ACPI
index 4f7eba36a8493c9be707a7b73eab9a2a24c4e8f2..7f61ca8165f0af90a7ca0ea552afb348a595de84 100644 (file)
@@ -1522,3 +1522,36 @@ bool intel_bios_is_lvds_present(struct drm_i915_private *dev_priv, u8 *i2c_pin)
 
        return false;
 }
+
+/**
+ * intel_bios_is_port_edp - is the device in given port eDP
+ * @dev_priv:  i915 device instance
+ * @port:      port to check
+ *
+ * Return true if the device in %port is eDP.
+ */
+bool intel_bios_is_port_edp(struct drm_i915_private *dev_priv, enum port port)
+{
+       union child_device_config *p_child;
+       static const short port_mapping[] = {
+               [PORT_B] = DVO_PORT_DPB,
+               [PORT_C] = DVO_PORT_DPC,
+               [PORT_D] = DVO_PORT_DPD,
+               [PORT_E] = DVO_PORT_DPE,
+       };
+       int i;
+
+       if (!dev_priv->vbt.child_dev_num)
+               return false;
+
+       for (i = 0; i < dev_priv->vbt.child_dev_num; i++) {
+               p_child = dev_priv->vbt.child_dev + i;
+
+               if (p_child->common.dvo_port == port_mapping[port] &&
+                   (p_child->common.device_type & DEVICE_TYPE_eDP_BITS) ==
+                   (DEVICE_TYPE_eDP & DEVICE_TYPE_eDP_BITS))
+                       return true;
+       }
+
+       return false;
+}
index ba2d0242d532befed35400e34ac3ed78813753c0..3ff8f1d6759435fefc9551f0ad58acfd97bfd808 100644 (file)
@@ -4993,14 +4993,6 @@ put_power:
 bool intel_dp_is_edp(struct drm_device *dev, enum port port)
 {
        struct drm_i915_private *dev_priv = dev->dev_private;
-       union child_device_config *p_child;
-       int i;
-       static const short port_mapping[] = {
-               [PORT_B] = DVO_PORT_DPB,
-               [PORT_C] = DVO_PORT_DPC,
-               [PORT_D] = DVO_PORT_DPD,
-               [PORT_E] = DVO_PORT_DPE,
-       };
 
        /*
         * eDP not supported on g4x. so bail out early just
@@ -5012,18 +5004,7 @@ bool intel_dp_is_edp(struct drm_device *dev, enum port port)
        if (port == PORT_A)
                return true;
 
-       if (!dev_priv->vbt.child_dev_num)
-               return false;
-
-       for (i = 0; i < dev_priv->vbt.child_dev_num; i++) {
-               p_child = dev_priv->vbt.child_dev + i;
-
-               if (p_child->common.dvo_port == port_mapping[port] &&
-                   (p_child->common.device_type & DEVICE_TYPE_eDP_BITS) ==
-                   (DEVICE_TYPE_eDP & DEVICE_TYPE_eDP_BITS))
-                       return true;
-       }
-       return false;
+       return intel_bios_is_port_edp(dev_priv, port);
 }
 
 void