From patchwork Tue Aug 28 22:07:00 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Zanoni X-Patchwork-Id: 1382991 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id 9EA703FDF5 for ; Tue, 28 Aug 2012 22:30:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 67E429EAFF for ; Tue, 28 Aug 2012 15:30:57 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-gh0-f177.google.com (mail-gh0-f177.google.com [209.85.160.177]) by gabe.freedesktop.org (Postfix) with ESMTP id 74E639EB1F for ; Tue, 28 Aug 2012 15:08:22 -0700 (PDT) Received: by mail-gh0-f177.google.com with SMTP id f20so1147374ghb.36 for ; Tue, 28 Aug 2012 15:08:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=HJB/12CKWwEY6sSgVFBgTc4m/qQOyFlwvfomn02NvRQ=; b=wUlLvk/jFeI712EsXpEWwG+3kzRzqcjhxTtirB3RK8MxV9s/XRskQ8FntdOjjc5P7p A822ZNGPwb4BLyvL7XwuynuOT7V4b8ddLz4UvAWyiRMJ3QhWIfJtV5kh5VvHiRJN5pdi 0cxAdD+2f+x7tVWMocPFJoyb+hDDxnI/L9ymqmGMyqrUhWYQZWCubBPOaM0WpMBfKtDs +4GhPIfFvnoNowEOKQtlhKThl0Jb+l+bo9fc4t8M6sgjnt3YkLzfS1AQSGpRvzgy7zIF RaoScaL6VB+oqHO461zmV5w5nAoORqvIGYLvk/kGIvqxe2LzBve3qSslIzO4ojxvQQV+ kUVQ== Received: by 10.236.114.200 with SMTP id c48mr15255019yhh.118.1346191702346; Tue, 28 Aug 2012 15:08:22 -0700 (PDT) Received: from vicky.domain.invalid (189.114.178.236.dynamic.adsl.gvt.net.br. [189.114.178.236]) by mx.google.com with ESMTPS id z3sm4434172anj.20.2012.08.28.15.08.18 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 28 Aug 2012 15:08:21 -0700 (PDT) From: Paulo Zanoni To: intel-gfx@lists.freedesktop.org Date: Tue, 28 Aug 2012 19:07:00 -0300 Message-Id: <1346191621-12996-30-git-send-email-przanoni@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1346191621-12996-1-git-send-email-przanoni@gmail.com> References: <1346191621-12996-1-git-send-email-przanoni@gmail.com> Cc: Paulo Zanoni Subject: [Intel-gfx] [RFC 29/30] drm/i915: split intel_dp_commit into encoder and connector pieces X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org From: Paulo Zanoni 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 --- 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); +}