[Intel-gfx] [PATCH 1/2] drm/i915/backlight: Restore backlight on resume

Maarten Lankhorst maarten.lankhorst at linux.intel.com
Thu Nov 29 12:42:46 UTC 2018


Restore our saved values for backlight. This way even with fastset on
S4 resume we will correctly restore the backlight to the active values.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
Cc: Tolga Cakir <cevelnet at gmail.com>
Cc: Basil Eric Rabi <ericbasil.rabi at gmail.com>
Cc: Hans de Goede <jwrdegoede at fedoraproject.org>
Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
Reported-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c |  2 ++
 drivers/gpu/drm/i915/intel_drv.h     |  1 +
 drivers/gpu/drm/i915/intel_panel.c   | 29 ++++++++++++++++++++++++++++
 3 files changed, 32 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index d07fa4456150..3faccfcd39a8 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -15844,7 +15844,9 @@ void intel_display_resume(struct drm_device *dev)
 	if (!ret)
 		ret = __intel_display_resume(dev, state, &ctx);
 
+	intel_panel_restore_backlight(dev_priv);
 	intel_enable_ipc(dev_priv);
+
 	drm_modeset_drop_locks(&ctx);
 	drm_modeset_acquire_fini(&ctx);
 
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 40edb21087a7..e2c10acd7bc8 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1983,6 +1983,7 @@ int intel_panel_init(struct intel_panel *panel,
 		     struct drm_display_mode *fixed_mode,
 		     struct drm_display_mode *downclock_mode);
 void intel_panel_fini(struct intel_panel *panel);
+void intel_panel_restore_backlight(struct drm_i915_private *dev_priv);
 void intel_fixed_panel_mode(const struct drm_display_mode *fixed_mode,
 			    struct drm_display_mode *adjusted_mode);
 void intel_pch_panel_fitting(struct intel_crtc *crtc,
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index e6cd7b55c018..39b9717ac36a 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -1903,6 +1903,35 @@ intel_panel_init_backlight_funcs(struct intel_panel *panel)
 	}
 }
 
+void intel_panel_restore_backlight(struct drm_i915_private *dev_priv)
+{
+	struct intel_connector *connector;
+	struct drm_connector_list_iter conn_iter;
+
+	/* Kill all the work that may have been queued by hpd. */
+	drm_connector_list_iter_begin(&dev_priv->drm, &conn_iter);
+	for_each_intel_connector_iter(connector, &conn_iter) {
+		struct intel_panel *panel = &connector->panel;
+		const struct drm_connector_state *conn_state =
+			connector->base.state;
+
+		if (!panel->backlight.present)
+			continue;
+
+		if (panel->backlight.enabled && conn_state->crtc) {
+			const struct intel_crtc_state *crtc_state =
+				to_intel_crtc_state(conn_state->crtc->state);
+
+			intel_panel_enable_backlight(crtc_state, conn_state);
+		} else {
+			WARN(panel->backlight.enabled, "Backlight enabled without crtc\n");
+
+			intel_panel_disable_backlight(conn_state);
+		}
+	}
+	drm_connector_list_iter_end(&conn_iter);
+}
+
 int intel_panel_init(struct intel_panel *panel,
 		     struct drm_display_mode *fixed_mode,
 		     struct drm_display_mode *downclock_mode)
-- 
2.19.2



More information about the Intel-gfx mailing list