[Intel-gfx] [PATCH v2 08/21] drm/i915: Move panel's pipe from backlight setup to init

Chris Wilson chris at chris-wilson.co.uk
Mon May 30 08:38:26 UTC 2016


In the very near future, we will perform the backlight setup
consistently during connector registration - moving the setup further
away from the intel_panel_init call and to where we no longer know the
associated pipe. To pass that information along we need to store it
during init.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_dp.c    |  6 ++++--
 drivers/gpu/drm/i915/intel_drv.h   |  6 ++++--
 drivers/gpu/drm/i915/intel_dsi.c   |  6 ++++--
 drivers/gpu/drm/i915/intel_dvo.c   |  3 ++-
 drivers/gpu/drm/i915/intel_lvds.c  |  6 ++++--
 drivers/gpu/drm/i915/intel_panel.c | 11 +++++++----
 6 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index aa9c59ee17f6..b3626a7b984a 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -5399,9 +5399,11 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
 			      pipe_name(pipe));
 	}
 
-	intel_panel_init(&intel_connector->panel, fixed_mode, downclock_mode);
+	intel_panel_init(&intel_connector->panel,
+			 fixed_mode, downclock_mode,
+			 pipe);
 	intel_connector->panel.backlight.power = intel_edp_backlight_power;
-	intel_panel_setup_backlight(connector, pipe);
+	intel_panel_setup_backlight(connector);
 
 	return true;
 }
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 8dc22d0afafc..a81e2eb69d2a 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -202,6 +202,7 @@ struct intel_panel {
 	struct drm_display_mode *downclock_mode;
 	int fitting_mode;
 	bool is_panel;
+	enum pipe pipe;
 
 	/* backlight */
 	struct {
@@ -1476,7 +1477,8 @@ void intel_overlay_reset(struct drm_i915_private *dev_priv);
 /* intel_panel.c */
 int intel_panel_init(struct intel_panel *panel,
 		     struct drm_display_mode *fixed_mode,
-		     struct drm_display_mode *downclock_mode);
+		     struct drm_display_mode *downclock_mode,
+		     enum pipe pipe);
 void intel_panel_fini(struct intel_panel *panel);
 void intel_fixed_panel_mode(const struct drm_display_mode *fixed_mode,
 			    struct drm_display_mode *adjusted_mode);
@@ -1488,7 +1490,7 @@ void intel_gmch_panel_fitting(struct intel_crtc *crtc,
 			      int fitting_mode);
 void intel_panel_set_backlight_acpi(struct intel_connector *connector,
 				    u32 level, u32 max);
-int intel_panel_setup_backlight(struct drm_connector *connector, enum pipe pipe);
+int intel_panel_setup_backlight(struct drm_connector *connector);
 void intel_panel_enable_backlight(struct intel_connector *connector);
 void intel_panel_disable_backlight(struct intel_connector *connector);
 void intel_panel_destroy_backlight(struct drm_connector *connector);
diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
index 4009618a5b34..15be8a4c2657 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -1578,13 +1578,15 @@ void intel_dsi_init(struct drm_device *dev)
 		goto err;
 	}
 
-	intel_panel_init(&intel_connector->panel, fixed_mode, NULL);
+	intel_panel_init(&intel_connector->panel,
+			 fixed_mode, NULL,
+			 INVALID_PIPE);
 
 	intel_dsi_add_properties(intel_connector);
 
 	drm_connector_register(connector);
 
-	intel_panel_setup_backlight(connector, INVALID_PIPE);
+	intel_panel_setup_backlight(connector);
 
 	return;
 
diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c
index 286baec979c8..31611428fde5 100644
--- a/drivers/gpu/drm/i915/intel_dvo.c
+++ b/drivers/gpu/drm/i915/intel_dvo.c
@@ -533,7 +533,8 @@ void intel_dvo_init(struct drm_device *dev)
 			 */
 			intel_panel_init(&intel_connector->panel,
 					 intel_dvo_get_current_mode(connector),
-					 NULL);
+					 NULL,
+					 INVALID_PIPE);
 			intel_dvo->panel_wants_dither = true;
 		}
 
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index d65fd945607a..980658aa66e5 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -1116,7 +1116,9 @@ void intel_lvds_init(struct drm_device *dev)
 out:
 	mutex_unlock(&dev->mode_config.mutex);
 
-	intel_panel_init(&intel_connector->panel, fixed_mode, downclock_mode);
+	intel_panel_init(&intel_connector->panel,
+			 fixed_mode, downclock_mode,
+			 INVALID_PIPE);
 
 	lvds_encoder->is_dual_link = compute_is_dual_link_lvds(lvds_encoder);
 	DRM_DEBUG_KMS("detected %s-link lvds configuration\n",
@@ -1131,7 +1133,7 @@ out:
 	}
 	drm_connector_register(connector);
 
-	intel_panel_setup_backlight(connector, INVALID_PIPE);
+	intel_panel_setup_backlight(connector);
 
 	return;
 
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index 0c4111880605..c64aae6b673a 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -1657,7 +1657,7 @@ static int pwm_setup_backlight(struct intel_connector *connector,
 	return 0;
 }
 
-int intel_panel_setup_backlight(struct drm_connector *connector, enum pipe pipe)
+int intel_panel_setup_backlight(struct drm_connector *connector)
 {
 	struct drm_i915_private *dev_priv = to_i915(connector->dev);
 	struct intel_connector *intel_connector = to_intel_connector(connector);
@@ -1682,7 +1682,7 @@ int intel_panel_setup_backlight(struct drm_connector *connector, enum pipe pipe)
 
 	/* set level and max in panel struct */
 	mutex_lock(&dev_priv->backlight_lock);
-	ret = panel->backlight.setup(intel_connector, pipe);
+	ret = panel->backlight.setup(intel_connector, panel->pipe);
 	mutex_unlock(&dev_priv->backlight_lock);
 
 	if (ret) {
@@ -1790,13 +1790,16 @@ intel_panel_init_backlight_funcs(struct intel_panel *panel)
 
 int intel_panel_init(struct intel_panel *panel,
 		     struct drm_display_mode *fixed_mode,
-		     struct drm_display_mode *downclock_mode)
+		     struct drm_display_mode *downclock_mode,
+		     enum pipe pipe)
 {
 	intel_panel_init_backlight_funcs(panel);
 
+	panel->is_panel = true;
+	panel->pipe = pipe;
+
 	panel->fixed_mode = fixed_mode;
 	panel->downclock_mode = downclock_mode;
-	panel->is_panel = true;
 
 	return 0;
 }
-- 
2.8.1



More information about the Intel-gfx mailing list