Commit cc2ee76a authored by Imre Deak's avatar Imre Deak

drm/i915: Move encoder suspend/shutdown helpers to intel_encoder.c

Move the encoder suspend/shutdown helpers to intel_encoder.c, this being
the logical place for encoder functions.

This also allows sharing the above helpers with the xe driver, done in a
follow-up patch.

While at it rename the functions using the usual intel_encoder prefix
and in the functions rename the dev_priv parameter to i915.

v2: Remove extra w/s in the include section. (Jani)

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> # v1
Reviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
Signed-off-by: default avatarImre Deak <imre.deak@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240618125255.4080303-1-imre.deak@intel.com
parent 67577e2e
...@@ -37,3 +37,47 @@ void intel_encoder_link_check_queue_work(struct intel_encoder *encoder, int dela ...@@ -37,3 +37,47 @@ void intel_encoder_link_check_queue_work(struct intel_encoder *encoder, int dela
mod_delayed_work(i915->unordered_wq, mod_delayed_work(i915->unordered_wq,
&encoder->link_check_work, msecs_to_jiffies(delay_ms)); &encoder->link_check_work, msecs_to_jiffies(delay_ms));
} }
void intel_encoder_suspend_all(struct drm_i915_private *i915)
{
struct intel_encoder *encoder;
if (!HAS_DISPLAY(i915))
return;
/*
* TODO: check and remove holding the modeset locks if none of
* the encoders depends on this.
*/
drm_modeset_lock_all(&i915->drm);
for_each_intel_encoder(&i915->drm, encoder)
if (encoder->suspend)
encoder->suspend(encoder);
drm_modeset_unlock_all(&i915->drm);
for_each_intel_encoder(&i915->drm, encoder)
if (encoder->suspend_complete)
encoder->suspend_complete(encoder);
}
void intel_encoder_shutdown_all(struct drm_i915_private *i915)
{
struct intel_encoder *encoder;
if (!HAS_DISPLAY(i915))
return;
/*
* TODO: check and remove holding the modeset locks if none of
* the encoders depends on this.
*/
drm_modeset_lock_all(&i915->drm);
for_each_intel_encoder(&i915->drm, encoder)
if (encoder->shutdown)
encoder->shutdown(encoder);
drm_modeset_unlock_all(&i915->drm);
for_each_intel_encoder(&i915->drm, encoder)
if (encoder->shutdown_complete)
encoder->shutdown_complete(encoder);
}
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#ifndef __INTEL_ENCODER_H__ #ifndef __INTEL_ENCODER_H__
#define __INTEL_ENCODER_H__ #define __INTEL_ENCODER_H__
struct drm_i915_private;
struct intel_encoder; struct intel_encoder;
void intel_encoder_link_check_init(struct intel_encoder *encoder, void intel_encoder_link_check_init(struct intel_encoder *encoder,
...@@ -13,4 +14,7 @@ void intel_encoder_link_check_init(struct intel_encoder *encoder, ...@@ -13,4 +14,7 @@ void intel_encoder_link_check_init(struct intel_encoder *encoder,
void intel_encoder_link_check_queue_work(struct intel_encoder *encoder, int delay_ms); void intel_encoder_link_check_queue_work(struct intel_encoder *encoder, int delay_ms);
void intel_encoder_link_check_flush_work(struct intel_encoder *encoder); void intel_encoder_link_check_flush_work(struct intel_encoder *encoder);
void intel_encoder_suspend_all(struct drm_i915_private *i915);
void intel_encoder_shutdown_all(struct drm_i915_private *i915);
#endif /* __INTEL_ENCODER_H__ */ #endif /* __INTEL_ENCODER_H__ */
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
#include "display/intel_dmc.h" #include "display/intel_dmc.h"
#include "display/intel_dp.h" #include "display/intel_dp.h"
#include "display/intel_dpt.h" #include "display/intel_dpt.h"
#include "display/intel_encoder.h"
#include "display/intel_fbdev.h" #include "display/intel_fbdev.h"
#include "display/intel_hotplug.h" #include "display/intel_hotplug.h"
#include "display/intel_overlay.h" #include "display/intel_overlay.h"
...@@ -933,50 +934,6 @@ static void i915_driver_postclose(struct drm_device *dev, struct drm_file *file) ...@@ -933,50 +934,6 @@ static void i915_driver_postclose(struct drm_device *dev, struct drm_file *file)
i915_gem_flush_free_objects(to_i915(dev)); i915_gem_flush_free_objects(to_i915(dev));
} }
static void intel_suspend_encoders(struct drm_i915_private *dev_priv)
{
struct intel_encoder *encoder;
if (!HAS_DISPLAY(dev_priv))
return;
/*
* TODO: check and remove holding the modeset locks if none of
* the encoders depends on this.
*/
drm_modeset_lock_all(&dev_priv->drm);
for_each_intel_encoder(&dev_priv->drm, encoder)
if (encoder->suspend)
encoder->suspend(encoder);
drm_modeset_unlock_all(&dev_priv->drm);
for_each_intel_encoder(&dev_priv->drm, encoder)
if (encoder->suspend_complete)
encoder->suspend_complete(encoder);
}
static void intel_shutdown_encoders(struct drm_i915_private *dev_priv)
{
struct intel_encoder *encoder;
if (!HAS_DISPLAY(dev_priv))
return;
/*
* TODO: check and remove holding the modeset locks if none of
* the encoders depends on this.
*/
drm_modeset_lock_all(&dev_priv->drm);
for_each_intel_encoder(&dev_priv->drm, encoder)
if (encoder->shutdown)
encoder->shutdown(encoder);
drm_modeset_unlock_all(&dev_priv->drm);
for_each_intel_encoder(&dev_priv->drm, encoder)
if (encoder->shutdown_complete)
encoder->shutdown_complete(encoder);
}
void i915_driver_shutdown(struct drm_i915_private *i915) void i915_driver_shutdown(struct drm_i915_private *i915)
{ {
disable_rpm_wakeref_asserts(&i915->runtime_pm); disable_rpm_wakeref_asserts(&i915->runtime_pm);
...@@ -999,8 +956,8 @@ void i915_driver_shutdown(struct drm_i915_private *i915) ...@@ -999,8 +956,8 @@ void i915_driver_shutdown(struct drm_i915_private *i915)
if (HAS_DISPLAY(i915)) if (HAS_DISPLAY(i915))
intel_display_driver_suspend_access(i915); intel_display_driver_suspend_access(i915);
intel_suspend_encoders(i915); intel_encoder_suspend_all(i915);
intel_shutdown_encoders(i915); intel_encoder_shutdown_all(i915);
intel_dmc_suspend(i915); intel_dmc_suspend(i915);
...@@ -1083,7 +1040,7 @@ static int i915_drm_suspend(struct drm_device *dev) ...@@ -1083,7 +1040,7 @@ static int i915_drm_suspend(struct drm_device *dev)
if (HAS_DISPLAY(dev_priv)) if (HAS_DISPLAY(dev_priv))
intel_display_driver_suspend_access(dev_priv); intel_display_driver_suspend_access(dev_priv);
intel_suspend_encoders(dev_priv); intel_encoder_suspend_all(dev_priv);
/* Must be called before GGTT is suspended. */ /* Must be called before GGTT is suspended. */
intel_dpt_suspend(dev_priv); intel_dpt_suspend(dev_priv);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment