From patchwork Tue Dec 5 10:15:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Kahola X-Patchwork-Id: 10092647 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 964126035E for ; Tue, 5 Dec 2017 10:21:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8BEE928BD7 for ; Tue, 5 Dec 2017 10:21:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A68428BE5; Tue, 5 Dec 2017 10:21:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4ECB729728 for ; Tue, 5 Dec 2017 10:21:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9558F6E4B8; Tue, 5 Dec 2017 10:21:07 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id 04A716E4B8 for ; Tue, 5 Dec 2017 10:21:05 +0000 (UTC) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Dec 2017 02:21:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,363,1508828400"; d="scan'208";a="15555567" Received: from sorvi.fi.intel.com ([10.237.72.154]) by orsmga002.jf.intel.com with ESMTP; 05 Dec 2017 02:21:03 -0800 From: Mika Kahola To: intel-gfx@lists.freedesktop.org Date: Tue, 5 Dec 2017 12:15:39 +0200 Message-Id: <1512468939-3262-1-git-send-email-mika.kahola@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [Intel-gfx] [PATCH] drm/i915: Generalize definition for crtc mask X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP crtc_mask is defined explicitly defined for a certain number of pipes per platform. Let's generalize this in a way that crtc_mask dependens only on the number of pipes defined in device info. Signed-off-by: Mika Kahola --- drivers/gpu/drm/i915/intel_crt.c | 9 ++++++--- drivers/gpu/drm/i915/intel_ddi.c | 5 ++++- drivers/gpu/drm/i915/intel_dp.c | 12 ++++++++---- drivers/gpu/drm/i915/intel_hdmi.c | 4 +++- drivers/gpu/drm/i915/intel_lvds.c | 12 +++++++----- drivers/gpu/drm/i915/intel_sdvo.c | 5 ++++- drivers/gpu/drm/i915/intel_tv.c | 6 +++++- 7 files changed, 37 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index 9f31aea..34f65b5 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c @@ -903,6 +903,7 @@ void intel_crt_init(struct drm_i915_private *dev_priv) struct intel_connector *intel_connector; i915_reg_t adpa_reg; u32 adpa; + enum pipe pipe; if (HAS_PCH_SPLIT(dev_priv)) adpa_reg = PCH_ADPA; @@ -950,10 +951,12 @@ void intel_crt_init(struct drm_i915_private *dev_priv) crt->base.type = INTEL_OUTPUT_ANALOG; crt->base.cloneable = (1 << INTEL_OUTPUT_DVO) | (1 << INTEL_OUTPUT_HDMI); - if (IS_I830(dev_priv)) + if (IS_I830(dev_priv)) { crt->base.crtc_mask = (1 << 0); - else - crt->base.crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); + } else { + for_each_pipe(dev_priv, pipe) + crt->base.crtc_mask |= (1 << pipe); + } if (IS_GEN2(dev_priv)) connector->interlace_allowed = 0; diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c index eff3b51..9320542 100644 --- a/drivers/gpu/drm/i915/intel_ddi.c +++ b/drivers/gpu/drm/i915/intel_ddi.c @@ -2766,6 +2766,7 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port) struct drm_encoder *encoder; bool init_hdmi, init_dp, init_lspcon = false; int max_lanes; + enum pipe pipe; if (I915_READ(DDI_BUF_CTL(PORT_A)) & DDI_A_4_LANES) { switch (port) { @@ -2884,9 +2885,11 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port) intel_encoder->type = INTEL_OUTPUT_DDI; intel_encoder->power_domain = intel_port_to_power_domain(port); intel_encoder->port = port; - intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); intel_encoder->cloneable = 0; + for_each_pipe(dev_priv, pipe) + intel_encoder->crtc_mask |= (1 << pipe); + intel_infoframe_init(intel_dig_port); if (init_dp) { diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 957735c..37ba90d 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -6139,6 +6139,7 @@ bool intel_dp_init(struct drm_i915_private *dev_priv, struct intel_encoder *intel_encoder; struct drm_encoder *encoder; struct intel_connector *intel_connector; + enum pipe pipe; intel_dig_port = kzalloc(sizeof(*intel_dig_port), GFP_KERNEL); if (!intel_dig_port) @@ -6190,12 +6191,15 @@ bool intel_dp_init(struct drm_i915_private *dev_priv, intel_encoder->type = INTEL_OUTPUT_DP; intel_encoder->power_domain = intel_port_to_power_domain(port); if (IS_CHERRYVIEW(dev_priv)) { - if (port == PORT_D) + if (port == PORT_D) { intel_encoder->crtc_mask = 1 << 2; - else - intel_encoder->crtc_mask = (1 << 0) | (1 << 1); + } else { + for_each_pipe(dev_priv, pipe) + intel_encoder->crtc_mask |= (1 << pipe); + } } else { - intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); + for_each_pipe(dev_priv, pipe) + intel_encoder->crtc_mask |= (1 << pipe); } intel_encoder->cloneable = 0; intel_encoder->port = port; diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index a40f35a..43584d9 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c @@ -2072,6 +2072,7 @@ void intel_hdmi_init(struct drm_i915_private *dev_priv, struct intel_digital_port *intel_dig_port; struct intel_encoder *intel_encoder; struct intel_connector *intel_connector; + enum pipe pipe; intel_dig_port = kzalloc(sizeof(*intel_dig_port), GFP_KERNEL); if (!intel_dig_port) @@ -2128,7 +2129,8 @@ void intel_hdmi_init(struct drm_i915_private *dev_priv, else intel_encoder->crtc_mask = (1 << 0) | (1 << 1); } else { - intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); + for_each_pipe(dev_priv, pipe) + intel_encoder->crtc_mask |= (1 << pipe); } intel_encoder->cloneable = 1 << INTEL_OUTPUT_ANALOG; /* diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index ef80499..36eab86 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c @@ -945,6 +945,7 @@ void intel_lvds_init(struct drm_i915_private *dev_priv) u32 lvds; u8 pin; u32 allowed_scalers; + enum pipe pipe; if (!intel_lvds_supported(dev_priv)) return; @@ -1025,13 +1026,14 @@ void intel_lvds_init(struct drm_i915_private *dev_priv) intel_encoder->power_domain = POWER_DOMAIN_PORT_OTHER; intel_encoder->port = PORT_NONE; intel_encoder->cloneable = 0; - if (HAS_PCH_SPLIT(dev_priv)) - intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); - else if (IS_GEN4(dev_priv)) + if (HAS_PCH_SPLIT(dev_priv)) { + for_each_pipe(dev_priv, pipe) + intel_encoder->crtc_mask |= (1 << pipe); + } else if (IS_GEN4(dev_priv)) { intel_encoder->crtc_mask = (1 << 0) | (1 << 1); - else + } else { intel_encoder->crtc_mask = (1 << 1); - + } drm_connector_helper_add(connector, &intel_lvds_connector_helper_funcs); connector->display_info.subpixel_order = SubPixelHorizontalRGB; connector->interlace_allowed = false; diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index 2b87648..ac27fb9 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c @@ -2697,7 +2697,6 @@ intel_sdvo_output_setup(struct intel_sdvo *intel_sdvo, uint16_t flags) bytes[0], bytes[1]); return false; } - intel_sdvo->base.crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); return true; } @@ -3018,6 +3017,7 @@ bool intel_sdvo_init(struct drm_i915_private *dev_priv, struct intel_encoder *intel_encoder; struct intel_sdvo *intel_sdvo; int i; + enum pipe pipe; assert_sdvo_port_valid(dev_priv, port); @@ -3065,6 +3065,9 @@ bool intel_sdvo_init(struct drm_i915_private *dev_priv, intel_encoder->get_hw_state = intel_sdvo_get_hw_state; intel_encoder->get_config = intel_sdvo_get_config; + for_each_pipe(dev_priv, pipe) + intel_sdvo->base.crtc_mask = (1 << pipe); + /* In default case sdvo lvds is false */ if (!intel_sdvo_get_capabilities(intel_sdvo, &intel_sdvo->caps)) goto err; diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c index b3dabc2..2eb7d67 100644 --- a/drivers/gpu/drm/i915/intel_tv.c +++ b/drivers/gpu/drm/i915/intel_tv.c @@ -1465,6 +1465,7 @@ intel_tv_init(struct drm_i915_private *dev_priv) const char *tv_format_names[ARRAY_SIZE(tv_modes)]; int i, initial_mode = 0; struct drm_connector_state *state; + enum pipe pipe; if ((I915_READ(TV_CTL) & TV_FUSE_STATE_MASK) == TV_FUSE_STATE_DISABLED) return; @@ -1542,7 +1543,10 @@ intel_tv_init(struct drm_i915_private *dev_priv) intel_encoder->type = INTEL_OUTPUT_TVOUT; intel_encoder->power_domain = POWER_DOMAIN_PORT_OTHER; intel_encoder->port = PORT_NONE; - intel_encoder->crtc_mask = (1 << 0) | (1 << 1); + + for_each_pipe(dev_priv, pipe) + intel_encoder->crtc_mask |= (1 << pipe); + intel_encoder->cloneable = 0; intel_encoder->base.possible_crtcs = ((1 << 0) | (1 << 1)); intel_tv->type = DRM_MODE_CONNECTOR_Unknown;