[SRU][OEM-5.10][PATCH 2/6] drm/i915: Add an encoder .shutdown() hook

chris.chiu at canonical.com chris.chiu at canonical.com
Thu Jun 17 16:13:13 UTC 2021


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

BugLink: https://bugs.launchpad.net/bugs/1931072

Add a new encoder hook .shutdown() which will get called at the end
of the pci .shutdown() hook. We shall use this to deal with the
panel power cycle delay issues.

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201001151640.14590-2-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula at intel.com>
(cherry picked from commit 100fe4c01efff5e3b930c7aaff9c2ebeb78d1b87)
Signed-off-by: Chris Chiu <chris.chiu at canonical.com>
---
 drivers/gpu/drm/i915/display/intel_display_types.h |  5 +++++
 drivers/gpu/drm/i915/i915_drv.c                    | 13 +++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
index 3cb525a0dd00..85084d96337f 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -214,6 +214,11 @@ struct intel_encoder {
 	 * device interrupts are disabled.
 	 */
 	void (*suspend)(struct intel_encoder *);
+	/*
+	 * Called during system reboot/shutdown after all the
+	 * encoders have been disabled and suspended.
+	 */
+	void (*shutdown)(struct intel_encoder *encoder);
 	enum hpd_pin hpd_pin;
 	enum intel_display_power_domain power_domain;
 	/* for communication with audio component; protected by av_mutex */
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 667dc8010185..09dff7989b23 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1031,6 +1031,18 @@ static void intel_suspend_encoders(struct drm_i915_private *dev_priv)
 	drm_modeset_unlock_all(dev);
 }
 
+static void intel_shutdown_encoders(struct drm_i915_private *dev_priv)
+{
+	struct drm_device *dev = &dev_priv->drm;
+	struct intel_encoder *encoder;
+
+	drm_modeset_lock_all(dev);
+	for_each_intel_encoder(dev, encoder)
+		if (encoder->shutdown)
+			encoder->shutdown(encoder);
+	drm_modeset_unlock_all(dev);
+}
+
 void i915_driver_shutdown(struct drm_i915_private *i915)
 {
 	i915_gem_suspend(i915);
@@ -1045,6 +1057,7 @@ void i915_driver_shutdown(struct drm_i915_private *i915)
 	intel_hpd_cancel_work(i915);
 
 	intel_suspend_encoders(i915);
+	intel_shutdown_encoders(i915);
 }
 
 static bool suspend_to_idle(struct drm_i915_private *dev_priv)
-- 
2.25.1




More information about the kernel-team mailing list