All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paulo Zanoni <przanoni@gmail.com>
To: intel-gfx@lists.freedesktop.org
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Subject: [RFC 29/30] drm/i915: split intel_dp_commit into encoder and connector pieces
Date: Tue, 28 Aug 2012 19:07:00 -0300	[thread overview]
Message-ID: <1346191621-12996-30-git-send-email-przanoni@gmail.com> (raw)
In-Reply-To: <1346191621-12996-1-git-send-email-przanoni@gmail.com>

From: Paulo Zanoni <paulo.r.zanoni@intel.com>

Same reason as the previous HDMI commit: the DDI code will have its
own encoder init function but still use the DP and HDMI connectors.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c | 91 ++++++++++++++++++++++-------------------
 1 file changed, 50 insertions(+), 41 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 314b4c7..6cf3123 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -2586,40 +2586,26 @@ intel_dp_add_properties(struct drm_connector *connector)
 	intel_attach_broadcast_rgb_property(connector);
 }
 
-void
-intel_dp_init(struct drm_device *dev, int output_reg, enum port port)
+static void
+intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
+			struct intel_connector *intel_connector)
 {
+	struct drm_connector *connector = &intel_connector->base;
+	struct intel_dp *intel_dp = &intel_dig_port->dp;
+	struct intel_encoder *intel_encoder = &intel_dig_port->base;
+	struct drm_device *dev = intel_encoder->base.dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct drm_connector *connector;
-	struct intel_dp *intel_dp;
-	struct intel_encoder *intel_encoder;
-	struct intel_connector *intel_connector;
-	struct intel_digital_port *intel_dig_port;
+	enum port port = intel_dig_port->port;
 	const char *name = NULL;
 	int type;
 
-	intel_dig_port = kzalloc(sizeof(struct intel_digital_port), GFP_KERNEL);
-	if (!intel_dig_port)
-		return;
-
-	intel_dig_port->port = port;
-
-	intel_dp = &intel_dig_port->dp;
-	intel_dp->output_reg = output_reg;
 	intel_dp->dpms_mode = -1;
 
-	intel_connector = kzalloc(sizeof(struct intel_connector), GFP_KERNEL);
-	if (!intel_connector) {
-		kfree(intel_dig_port);
-		return;
-	}
-	intel_encoder = &intel_dig_port->base;
-
-	if (HAS_PCH_SPLIT(dev) && output_reg == PCH_DP_D)
+	if (HAS_PCH_SPLIT(dev) && port == PORT_D)
 		if (intel_dpd_is_edp(dev))
 			intel_dp->is_pch_edp = true;
 
-	if (output_reg == DP_A || is_pch_edp(intel_dp)) {
+	if (port == PORT_A || is_pch_edp(intel_dp)) {
 		type = DRM_MODE_CONNECTOR_eDP;
 		intel_encoder->type = INTEL_OUTPUT_EDP;
 	} else {
@@ -2627,32 +2613,17 @@ intel_dp_init(struct drm_device *dev, int output_reg, enum port port)
 		intel_encoder->type = INTEL_OUTPUT_DISPLAYPORT;
 	}
 
-	connector = &intel_connector->base;
 	drm_connector_init(dev, connector, &intel_dp_connector_funcs, type);
 	drm_connector_helper_add(connector, &intel_dp_connector_helper_funcs);
 
 	connector->polled = DRM_CONNECTOR_POLL_HPD;
 
-	intel_encoder->cloneable = false;
-
 	INIT_DELAYED_WORK(&intel_dp->panel_vdd_work,
 			  ironlake_panel_vdd_work);
 
-	intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
-
 	connector->interlace_allowed = true;
 	connector->doublescan_allowed = 0;
 
-	drm_encoder_init(dev, &intel_encoder->base, &intel_dp_enc_funcs,
-			 DRM_MODE_ENCODER_TMDS);
-
-	if (IS_HASWELL(dev))
-		drm_encoder_helper_add(&intel_encoder->base,
-				       &intel_dp_helper_funcs_hsw);
-	else
-		drm_encoder_helper_add(&intel_encoder->base,
-				       &intel_dp_helper_funcs);
-
 	intel_connector_attach_encoder(intel_connector, intel_encoder);
 	drm_sysfs_connector_add(connector);
 
@@ -2767,8 +2738,6 @@ intel_dp_init(struct drm_device *dev, int output_reg, enum port port)
 		ironlake_edp_panel_vdd_off(intel_dp, false);
 	}
 
-	intel_encoder->hot_plug = intel_dp_hot_plug;
-
 	if (is_edp(intel_dp)) {
 		dev_priv->int_edp_connector = connector;
 		intel_panel_setup_backlight(dev);
@@ -2785,3 +2754,43 @@ intel_dp_init(struct drm_device *dev, int output_reg, enum port port)
 		I915_WRITE(PEG_BAND_GAP_DATA, (temp & ~0xf) | 0xd);
 	}
 }
+
+void
+intel_dp_init(struct drm_device *dev, int output_reg, enum port port)
+{
+	struct intel_digital_port *intel_dig_port;
+	struct intel_encoder *intel_encoder;
+	struct drm_encoder *encoder;
+	struct intel_connector *intel_connector;
+
+	intel_dig_port = kzalloc(sizeof(struct intel_digital_port), GFP_KERNEL);
+	if (!intel_dig_port)
+		return;
+
+	intel_connector = kzalloc(sizeof(struct intel_connector), GFP_KERNEL);
+	if (!intel_connector) {
+		kfree(intel_dig_port);
+		return;
+	}
+
+	intel_encoder = &intel_dig_port->base;
+	encoder = &intel_encoder->base;
+
+	drm_encoder_init(dev, encoder, &intel_dp_enc_funcs,
+			 DRM_MODE_ENCODER_TMDS);
+
+	if (IS_HASWELL(dev))
+		drm_encoder_helper_add(encoder, &intel_dp_helper_funcs_hsw);
+	else
+		drm_encoder_helper_add(encoder, &intel_dp_helper_funcs);
+
+	intel_dig_port->port = port;
+	intel_dig_port->hdmi.sdvox_reg = 0;
+	intel_dig_port->dp.output_reg = output_reg;
+
+	intel_encoder->crtc_mask =  (1 << 0) | (1 << 1) | (1 << 2);
+	intel_encoder->cloneable = false;
+	intel_encoder->hot_plug = intel_dp_hot_plug;
+
+	intel_dp_init_connector(intel_dig_port, intel_connector);
+}
-- 
1.7.11.2

  parent reply	other threads:[~2012-08-28 22:08 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-28 22:06 [RFC 00/30] Haswell clocking+HDMI+DP+eDP fixes Paulo Zanoni
2012-08-28 22:06 ` [RFC 01/30] drm/i915: rewrite the LCPLL code Paulo Zanoni
2012-08-28 22:06 ` [RFC 02/30] drm/i915: disable DDI pipes and ports when initializing Paulo Zanoni
2012-08-28 22:06 ` [RFC 03/30] drm/i915: wait for idle DDI_BUF_CTL after disabling it Paulo Zanoni
2012-08-28 22:06 ` [RFC 04/30] drm/i915: implement DDI disable function Paulo Zanoni
2012-08-28 22:06 ` [RFC 05/30] drm/i915: implement intel_ddi_pll_mode_set Paulo Zanoni
2012-08-28 22:06 ` [RFC 06/30] drm/i915: extract intel_ddi_enable pipe from intel_ddi_mode_set Paulo Zanoni
2012-08-28 22:06 ` [RFC 07/30] drm/i915: make intel_ddi_enable_pipe work on DP Paulo Zanoni
2012-08-28 22:06 ` [RFC 08/30] drm/i915: don't sleep after selecting the DDI pipe clock Paulo Zanoni
2012-08-28 22:06 ` [RFC 09/30] drm/i915: add DP support to intel_ddi_pll_mode_set Paulo Zanoni
2012-08-28 22:06 ` [RFC 10/30] drm/i915: add DP support to intel_ddi_disable_port Paulo Zanoni
2012-08-28 22:06 ` [RFC 11/30] drm/i915: add DP support to intel_ddi_mode_set Paulo Zanoni
2012-08-28 22:06 ` [RFC 12/30] drm/i915: add basic Haswell DP link train bits Paulo Zanoni
2012-08-28 22:06 ` [RFC 13/30] drm/i915: add intel_ddi_commit Paulo Zanoni
2012-08-28 22:06 ` [RFC 14/30] drm/i915: fix Haswell M/N registers Paulo Zanoni
2012-08-28 22:06 ` [RFC 15/30] drm/i915: fix DP AUX register definitions on Haswell Paulo Zanoni
2012-08-28 22:06 ` [RFC 16/30] drm/i915: disable DDI on intel_dp_link_down Paulo Zanoni
2012-08-28 22:06 ` [RFC 17/30] drm/i915: add intel_ddi_prepare_link_retrain Paulo Zanoni
2012-08-28 22:06 ` [RFC 18/30] drm/i915: add DP support to intel_ddi_disable Paulo Zanoni
2012-08-28 22:06 ` [RFC 19/30] drm/i915: add Haswell DP encoder_helper function definitions Paulo Zanoni
2012-08-28 22:06 ` [RFC 20/30] drm/i915: add TRANSCODER_EDP Paulo Zanoni
2012-08-28 22:06 ` [RFC 21/30] drm/i915: enable eDP on Haswell Paulo Zanoni
2012-08-28 22:06 ` [RFC 22/30] drm/i915: don't run PCH code on non-PCH ports Paulo Zanoni
2012-08-28 22:06 ` [RFC 23/30] drm/i915: init DP on port B Paulo Zanoni
2012-08-28 22:06 ` [RFC 24/30] drm/i915: simplify assignments inside intel_dp.c Paulo Zanoni
2012-08-28 22:06 ` [RFC 25/30] drm/i915: add intel_dp_to_dev and intel_hdmi_to_dev Paulo Zanoni
2012-08-28 22:06 ` [RFC 26/30] drm/i915: create intel_digital_port and use it Paulo Zanoni
2012-08-28 22:06 ` [RFC 27/30] drm/i915: remove encoder args from intel_{dp, hdmi}_add_properties Paulo Zanoni
2012-08-28 22:06 ` [RFC 28/30] drm/i915: split intel_hdmi_init into encoder and connector pieces Paulo Zanoni
2012-08-28 22:07 ` Paulo Zanoni [this message]
2012-08-28 22:07 ` [RFC 30/30] drm/i915: make DDI an encoder Paulo Zanoni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1346191621-12996-30-git-send-email-przanoni@gmail.com \
    --to=przanoni@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=paulo.r.zanoni@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.