diff mbox

[RFC,2/4] drm/i915/dsi: call drm_bridge callbacks if available

Message ID df4a92fefc9701b63db7cc9b7a223d90bd4ccd72.1379679948.git.jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jani Nikula Sept. 20, 2013, 12:31 p.m. UTC
Not used yet, but this is similar to what the crtc helpers do with
drm_bridge callbacks. The same functions are mandatory as in crtc
helpers.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/intel_dsi.c |   31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
index 9f87238..0d49540 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -107,12 +107,17 @@  static bool intel_dsi_compute_config(struct intel_encoder *encoder,
 	struct drm_display_mode *fixed_mode = intel_connector->panel.fixed_mode;
 	struct drm_display_mode *adjusted_mode = &config->adjusted_mode;
 	struct drm_display_mode *mode = &config->requested_mode;
+	struct drm_bridge *bridge = encoder->base.bridge;
 
 	DRM_DEBUG_KMS("\n");
 
 	if (fixed_mode)
 		intel_fixed_panel_mode(fixed_mode, adjusted_mode);
 
+	if (bridge && bridge->funcs->mode_fixup)
+		return bridge->funcs->mode_fixup(bridge, mode, adjusted_mode);
+
+	/* transitional, will go away */
 	if (intel_dsi->dev.dev_ops->mode_fixup)
 		return intel_dsi->dev.dev_ops->mode_fixup(&intel_dsi->dev,
 							  mode, adjusted_mode);
@@ -129,7 +134,12 @@  static void intel_dsi_pre_pll_enable(struct intel_encoder *encoder)
 
 static void intel_dsi_pre_enable(struct intel_encoder *encoder)
 {
+	struct drm_bridge *bridge = encoder->base.bridge;
+
 	DRM_DEBUG_KMS("\n");
+
+	if (bridge)
+		bridge->funcs->pre_enable(bridge);
 }
 
 static void intel_dsi_enable(struct intel_encoder *encoder)
@@ -137,6 +147,7 @@  static void intel_dsi_enable(struct intel_encoder *encoder)
 	struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;
 	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
 	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
+	struct drm_bridge *bridge = encoder->base.bridge;
 	int pipe = intel_crtc->pipe;
 	u32 temp;
 
@@ -171,6 +182,10 @@  static void intel_dsi_enable(struct intel_encoder *encoder)
 		POSTING_READ(MIPI_PORT_CTRL(pipe));
 	}
 
+	if (bridge)
+		bridge->funcs->enable(bridge);
+
+	/* transitional, will go away */
 	intel_dsi->dev.dev_ops->enable(&intel_dsi->dev);
 }
 
@@ -179,11 +194,16 @@  static void intel_dsi_disable(struct intel_encoder *encoder)
 	struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;
 	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
 	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
+	struct drm_bridge *bridge = encoder->base.bridge;
 	int pipe = intel_crtc->pipe;
 	u32 temp;
 
 	DRM_DEBUG_KMS("\n");
 
+	if (bridge)
+		bridge->funcs->disable(bridge);
+
+	/* transitional, will go away */
 	intel_dsi->dev.dev_ops->disable(&intel_dsi->dev);
 
 	if (is_vid_mode(intel_dsi)) {
@@ -208,8 +228,13 @@  static void intel_dsi_disable(struct intel_encoder *encoder)
 
 static void intel_dsi_post_disable(struct intel_encoder *encoder)
 {
+	struct drm_bridge *bridge = encoder->base.bridge;
+
 	DRM_DEBUG_KMS("\n");
 
+	if (bridge)
+		bridge->funcs->post_disable(bridge);
+
 	vlv_disable_dsi_pll(encoder);
 }
 
@@ -339,8 +364,11 @@  static void intel_dsi_mode_set(struct intel_encoder *intel_encoder)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
 	struct intel_dsi *intel_dsi = enc_to_intel_dsi(encoder);
+	struct drm_bridge *bridge = encoder->bridge;
 	struct drm_display_mode *adjusted_mode =
 		&intel_crtc->config.adjusted_mode;
+	struct drm_display_mode *requested_mode =
+		&intel_crtc->config.requested_mode;
 	int pipe = intel_crtc->pipe;
 	unsigned int bpp = intel_crtc->config.pipe_bpp;
 	u32 val, tmp;
@@ -460,6 +488,9 @@  static void intel_dsi_mode_set(struct intel_encoder *intel_encoder)
 	if (is_vid_mode(intel_dsi))
 		I915_WRITE(MIPI_VIDEO_MODE_FORMAT(pipe),
 			   intel_dsi->video_mode_format);
+
+	if (bridge && bridge->funcs->mode_set)
+		bridge->funcs->mode_set(bridge, requested_mode, adjusted_mode);
 }
 
 static enum drm_connector_status