[PATCH v3 4/6] drm/i915: Extract opregion vbt presence check

Thomas Weißschuh thomas.weissschuh at linutronix.de
Tue Mar 12 11:05:11 UTC 2024


On Wed, Feb 28, 2024 at 01:32:33PM -0800, Radhakrishna Sripada wrote:
> 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.

This doesn't compile when CONFIG_ACPI is not enabled:

  CC [M]  drivers/gpu/drm/xe/i915-display/intel_bios.o
drivers/gpu/drm/i915/display/intel_bios.c: In function 'intel_bios_is_lvds_present':
drivers/gpu/drm/i915/display/intel_bios.c:3425:24: error: implicit declaration of function 'intel_opregion_vbt_present'; did you mean
 'intel_opregion_asle_present'? [-Werror=implicit-function-declaration]
 3425 |                 return intel_opregion_vbt_present(i915);
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~
      |                        intel_opregion_asle_present
cc1: all warnings being treated as errors

Seen on next-20240312.

> 
> Suggested-by: Jani Nikula <jani.nikula at intel.com>
> Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada at intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_bios.c     |  3 +--
>  drivers/gpu/drm/i915/display/intel_opregion.c | 10 ++++++++++
>  drivers/gpu/drm/i915/display/intel_opregion.h |  1 +
>  3 files changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
> index a66fc79466bd..c283a5a07010 100644
> --- a/drivers/gpu/drm/i915/display/intel_bios.c
> +++ b/drivers/gpu/drm/i915/display/intel_bios.c
> @@ -3364,8 +3364,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;
> diff --git a/drivers/gpu/drm/i915/display/intel_opregion.c b/drivers/gpu/drm/i915/display/intel_opregion.c
> index 5d07a002edaa..58dfecb617b0 100644
> --- a/drivers/gpu/drm/i915/display/intel_opregion.c
> +++ b/drivers/gpu/drm/i915/display/intel_opregion.c
> @@ -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;
> diff --git a/drivers/gpu/drm/i915/display/intel_opregion.h b/drivers/gpu/drm/i915/display/intel_opregion.h
> index 0bec224f711f..63573c38d735 100644
> --- a/drivers/gpu/drm/i915/display/intel_opregion.h
> +++ b/drivers/gpu/drm/i915/display/intel_opregion.h
> @@ -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);

This declaration is in a #ifdef CONFIG_ACPI block.

>  const void *intel_opregion_get_vbt(struct drm_i915_private *i915, size_t *size);
>  
>  bool intel_opregion_headless_sku(struct drm_i915_private *i915);
> -- 
> 2.34.1
> 


More information about the Intel-gfx mailing list