[Intel-gfx] [PATCH 4/4] drm/i915/opregion: Register/unregister opregion on platforms without display

Jani Nikula jani.nikula at linux.intel.com
Tue Mar 7 08:50:49 UTC 2023


On Tue, 21 Feb 2023, Imre Deak <imre.deak at intel.com> wrote:
> Call the opregion register/unregister functions during driver
> loading/unloading on !HAS_DISPLAY platforms. These functions will send
> the opregion adapter power state notifications which is required on all
> platforms (similarly how this is sent during runtime and system
> suspend/resume). Skip registering the ACPI video notifier callback on
> !HAS_DISPLAY, where the corresponding video extensions are not
> supported.

I think the direction should be towards better separation of display
code, and this patch is counter productive. Basically we shouldn't
require calling display functions on !HAS_DISPLAY, and the early return
is what we should do.

This, in turn, means we probably need to handle opregion differently. :(

Dunno, maybe we need to move opregion under soc/ and have parts called
by high level driver code, and some other parts from display code.

BR,
Jani.


>
> Signed-off-by: Imre Deak <imre.deak at intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c  | 11 +++++++----
>  drivers/gpu/drm/i915/display/intel_opregion.c |  2 +-
>  2 files changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 7827ef3e2d1e6..467f6e2376057 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -8882,11 +8882,12 @@ bool intel_modeset_probe_defer(struct pci_dev *pdev)
>  
>  void intel_display_driver_register(struct drm_i915_private *i915)
>  {
> -	if (!HAS_DISPLAY(i915))
> -		return;
> -
>  	/* Must be done after probing outputs */
>  	intel_opregion_register(i915);
> +
> +	if (!HAS_DISPLAY(i915))
> +		return;
> +
>  	intel_acpi_video_register(i915);
>  
>  	intel_audio_init(i915);
> @@ -8914,7 +8915,7 @@ void intel_display_driver_register(struct drm_i915_private *i915)
>  void intel_display_driver_unregister(struct drm_i915_private *i915)
>  {
>  	if (!HAS_DISPLAY(i915))
> -		return;
> +		goto unregister_opregion;
>  
>  	intel_fbdev_unregister(i915);
>  	intel_audio_deinit(i915);
> @@ -8928,6 +8929,8 @@ void intel_display_driver_unregister(struct drm_i915_private *i915)
>  	drm_atomic_helper_shutdown(&i915->drm);
>  
>  	acpi_video_unregister();
> +
> +unregister_opregion:
>  	intel_opregion_unregister(i915);
>  }
>  
> diff --git a/drivers/gpu/drm/i915/display/intel_opregion.c b/drivers/gpu/drm/i915/display/intel_opregion.c
> index b7973a05d022d..37098e7f607e6 100644
> --- a/drivers/gpu/drm/i915/display/intel_opregion.c
> +++ b/drivers/gpu/drm/i915/display/intel_opregion.c
> @@ -1150,7 +1150,7 @@ void intel_opregion_register(struct drm_i915_private *i915)
>  	if (!opregion->header)
>  		return;
>  
> -	if (opregion->acpi) {
> +	if (HAS_DISPLAY(i915) && opregion->acpi) {
>  		opregion->acpi_notifier.notifier_call =
>  			intel_opregion_video_event;
>  		register_acpi_notifier(&opregion->acpi_notifier);

-- 
Jani Nikula, Intel Open Source Graphics Center


More information about the Intel-gfx mailing list