drm/i915: Extract opregion vbt presence check
authorRadhakrishna Sripada <radhakrishna.sripada@intel.com>
Wed, 28 Feb 2024 21:32:33 +0000 (13:32 -0800)
committerJani Nikula <jani.nikula@intel.com>
Mon, 11 Mar 2024 10:37:29 +0000 (12:37 +0200)
We want to later change intel_opregion_get_vbt to duplicate the vbt
memory if present, which would be an overkill when we just want to
peek into the presence of opregion vbt. Carve out the presence check
into its own function to use in places where only the presence of vbt
is required.

Suggested-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240228213235.2495611-5-radhakrishna.sripada@intel.com
drivers/gpu/drm/i915/display/intel_bios.c
drivers/gpu/drm/i915/display/intel_opregion.c
drivers/gpu/drm/i915/display/intel_opregion.h

index 7d50d026026fb97b6dbae97db3f3a93a3fe36a5d..cbbef39c69cbe7778c4fb3bef7d3af9e7ca2dd63 100644 (file)
@@ -3414,8 +3414,7 @@ bool intel_bios_is_lvds_present(struct drm_i915_private *i915, u8 *i2c_pin)
                 * additional data.  Trust that if the VBT was written into
                 * the OpRegion then they have validated the LVDS's existence.
                 */
-               if (intel_opregion_get_vbt(i915, NULL))
-                       return true;
+               return intel_opregion_vbt_present(i915);
        }
 
        return false;
index 5d07a002edaaca8cfa0bfd308f1bd33869c36c7e..58dfecb617b07a076a7398ad59b39177c423e979 100644 (file)
@@ -1131,6 +1131,16 @@ const struct drm_edid *intel_opregion_get_edid(struct intel_connector *intel_con
        return drm_edid;
 }
 
+bool intel_opregion_vbt_present(struct drm_i915_private *i915)
+{
+       struct intel_opregion *opregion = i915->display.opregion;
+
+       if (!opregion || !opregion->vbt)
+               return false;
+
+       return true;
+}
+
 const void *intel_opregion_get_vbt(struct drm_i915_private *i915, size_t *size)
 {
        struct intel_opregion *opregion = i915->display.opregion;
index 0bec224f711fc48ce995b2c255b6389eb0df7d62..63573c38d735cf7deba1740dd0d28db06aa65d6a 100644 (file)
@@ -53,6 +53,7 @@ int intel_opregion_notify_adapter(struct drm_i915_private *dev_priv,
 int intel_opregion_get_panel_type(struct drm_i915_private *dev_priv);
 const struct drm_edid *intel_opregion_get_edid(struct intel_connector *connector);
 
+bool intel_opregion_vbt_present(struct drm_i915_private *i915);
 const void *intel_opregion_get_vbt(struct drm_i915_private *i915, size_t *size);
 
 bool intel_opregion_headless_sku(struct drm_i915_private *i915);