From patchwork Thu Jun 1 13:19:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Timo Aaltonen X-Patchwork-Id: 769740 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 3wdnyJ2M9Tz9s72; Thu, 1 Jun 2017 23:20:08 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1dGQ1F-0000jt-6z; Thu, 01 Jun 2017 13:20:05 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1dGQ0f-0000TU-96 for kernel-team@lists.ubuntu.com; Thu, 01 Jun 2017 13:19:29 +0000 Received: from mobile-user-2e84bc-107.dhcp.inet.fi ([46.132.188.107] helo=deckard.tyrell) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1dGQ0e-0003BM-T7 for kernel-team@lists.ubuntu.com; Thu, 01 Jun 2017 13:19:29 +0000 From: Timo Aaltonen To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/8] drm/i915: Store port enum in intel_encoder Date: Thu, 1 Jun 2017 16:19:20 +0300 Message-Id: <1496323167-23456-2-git-send-email-tjaalton@ubuntu.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1496323167-23456-1-git-send-email-tjaalton@ubuntu.com> References: <1496323167-23456-1-git-send-email-tjaalton@ubuntu.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com From: "Pandiyan, Dhinakaran" BugLink: http://bugs.launchpad.net/bugs/1694665 Storing the port enum in intel_encoder makes it convenient to know the port attached to an encoder. Moving the port information up from intel_digital_port to intel_encoder avoids unecessary intel_digital_port access and handles MST encoders cleanly without requiring conditional checks for them (thanks danvet). v2: Renamed the port enum member from 'attached_port' to 'port' (danvet) Fixed missing initialization of port in intel_sdvo.c (danvet) v3: Fixed missing initialization of port in intel_crt.c (Ville) v4: Storing port for DVO encoders too. Signed-off-by: Dhinakaran Pandiyan Cc: Daniel Vetter Cc: Ville Syrjälä Acked-by: Daniel Vetter Reviewed-by: Lyude Signed-off-by: Rodrigo Vivi Link: http://patchwork.freedesktop.org/patch/msgid/1474334681-22690-3-git-send-email-dhinakaran.pandiyan@intel.com (backported from commit 03cdc1d4f79573a59392986fb4b50c55d47cff71) Signed-off-by: Timo Aaltonen --- ubuntu/i915/i915_drv.h | 1 + ubuntu/i915/intel_crt.c | 2 ++ ubuntu/i915/intel_ddi.c | 1 + ubuntu/i915/intel_dp.c | 1 + ubuntu/i915/intel_dp_mst.c | 1 + ubuntu/i915/intel_drv.h | 1 + ubuntu/i915/intel_dsi.c | 1 + ubuntu/i915/intel_dvo.c | 3 +++ ubuntu/i915/intel_hdmi.c | 1 + ubuntu/i915/intel_lvds.c | 3 ++- ubuntu/i915/intel_sdvo.c | 1 + ubuntu/i915/intel_tv.c | 2 ++ 12 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ubuntu/i915/i915_drv.h b/ubuntu/i915/i915_drv.h index 499810c..d6eed03 100644 --- a/ubuntu/i915/i915_drv.h +++ b/ubuntu/i915/i915_drv.h @@ -181,6 +181,7 @@ enum plane { #define sprite_name(p, s) ((p) * INTEL_INFO(dev)->num_sprites[(p)] + (s) + 'A') enum port { + PORT_NONE = -1, PORT_A = 0, PORT_B, PORT_C, diff --git a/ubuntu/i915/intel_crt.c b/ubuntu/i915/intel_crt.c index 662c94a..4dbd92c 100644 --- a/ubuntu/i915/intel_crt.c +++ b/ubuntu/i915/intel_crt.c @@ -869,9 +869,11 @@ void intel_crt_init(struct drm_device *dev) if (I915_HAS_HOTPLUG(dev)) crt->base.hpd_pin = HPD_CRT; if (HAS_DDI(dev)) { + crt->base.port = PORT_E; crt->base.get_config = hsw_crt_get_config; crt->base.get_hw_state = intel_ddi_get_hw_state; } else { + crt->base.port = PORT_NONE; crt->base.get_config = intel_crt_get_config; crt->base.get_hw_state = intel_crt_get_hw_state; } diff --git a/ubuntu/i915/intel_ddi.c b/ubuntu/i915/intel_ddi.c index 3772fb6..69de4bf 100644 --- a/ubuntu/i915/intel_ddi.c +++ b/ubuntu/i915/intel_ddi.c @@ -2394,6 +2394,7 @@ void intel_ddi_init(struct drm_device *dev, enum port port) intel_dig_port->max_lanes = max_lanes; intel_encoder->type = INTEL_OUTPUT_UNKNOWN; + intel_encoder->port = port; intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); intel_encoder->cloneable = 0; diff --git a/ubuntu/i915/intel_dp.c b/ubuntu/i915/intel_dp.c index c61759e..404c2d2 100644 --- a/ubuntu/i915/intel_dp.c +++ b/ubuntu/i915/intel_dp.c @@ -5987,6 +5987,7 @@ bool intel_dp_init(struct drm_device *dev, intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); } intel_encoder->cloneable = 0; + intel_encoder->port = port; intel_dig_port->hpd_pulse = intel_dp_hpd_pulse; dev_priv->hotplug.irq_port[port] = intel_dig_port; diff --git a/ubuntu/i915/intel_dp_mst.c b/ubuntu/i915/intel_dp_mst.c index 9d41990..f65cfa6 100644 --- a/ubuntu/i915/intel_dp_mst.c +++ b/ubuntu/i915/intel_dp_mst.c @@ -550,6 +550,7 @@ intel_dp_create_fake_mst_encoder(struct intel_digital_port *intel_dig_port, enum DRM_MODE_ENCODER_DPMST); intel_encoder->type = INTEL_OUTPUT_DP_MST; + intel_encoder->port = intel_dig_port->port; intel_encoder->crtc_mask = 0x7; intel_encoder->cloneable = 0; diff --git a/ubuntu/i915/intel_drv.h b/ubuntu/i915/intel_drv.h index 0fcd235..8f05de0 100644 --- a/ubuntu/i915/intel_drv.h +++ b/ubuntu/i915/intel_drv.h @@ -166,6 +166,7 @@ struct intel_encoder { struct drm_encoder base; enum intel_output_type type; + enum port port; unsigned int cloneable; void (*hot_plug)(struct intel_encoder *); bool (*compute_config)(struct intel_encoder *, diff --git a/ubuntu/i915/intel_dsi.c b/ubuntu/i915/intel_dsi.c index 5fd3457..6152089 100644 --- a/ubuntu/i915/intel_dsi.c +++ b/ubuntu/i915/intel_dsi.c @@ -1461,6 +1461,7 @@ void intel_dsi_init(struct drm_device *dev) intel_connector->get_hw_state = intel_connector_get_hw_state; intel_connector->unregister = intel_connector_unregister; + intel_encoder->port = port; /* * On BYT/CHV, pipe A maps to MIPI DSI port A, pipe B maps to MIPI DSI * port C. BXT isn't limited like this. diff --git a/ubuntu/i915/intel_dvo.c b/ubuntu/i915/intel_dvo.c index 7161deb..d41680a 100644 --- a/ubuntu/i915/intel_dvo.c +++ b/ubuntu/i915/intel_dvo.c @@ -449,6 +449,7 @@ void intel_dvo_init(struct drm_device *dev) bool dvoinit; enum pipe pipe; uint32_t dpll[I915_MAX_PIPES]; + enum port port = -1; /* Allow the I2C driver info to specify the GPIO to be used in * special cases, but otherwise default to what's defined @@ -497,7 +498,9 @@ void intel_dvo_init(struct drm_device *dev) continue; intel_encoder->type = INTEL_OUTPUT_DVO; + intel_encoder->port = port; intel_encoder->crtc_mask = (1 << 0) | (1 << 1); + switch (dvo->type) { case INTEL_DVO_CHIP_TMDS: intel_encoder->cloneable = (1 << INTEL_OUTPUT_ANALOG) | diff --git a/ubuntu/i915/intel_hdmi.c b/ubuntu/i915/intel_hdmi.c index 64e71ae..20e8b2e 100755 --- a/ubuntu/i915/intel_hdmi.c +++ b/ubuntu/i915/intel_hdmi.c @@ -2313,6 +2313,7 @@ void intel_hdmi_init(struct drm_device *dev, } intel_encoder->type = INTEL_OUTPUT_HDMI; + intel_encoder->port = port; if (IS_CHERRYVIEW(dev)) { if (port == PORT_D) intel_encoder->crtc_mask = 1 << 2; diff --git a/ubuntu/i915/intel_lvds.c b/ubuntu/i915/intel_lvds.c index 08dbf1e..a2988ce 100644 --- a/ubuntu/i915/intel_lvds.c +++ b/ubuntu/i915/intel_lvds.c @@ -994,8 +994,9 @@ void intel_lvds_init(struct drm_device *dev) intel_connector->unregister = intel_connector_unregister; intel_connector_attach_encoder(intel_connector, intel_encoder); - intel_encoder->type = INTEL_OUTPUT_LVDS; + intel_encoder->type = INTEL_OUTPUT_LVDS; + intel_encoder->port = PORT_NONE; intel_encoder->cloneable = 0; if (HAS_PCH_SPLIT(dev)) intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); diff --git a/ubuntu/i915/intel_sdvo.c b/ubuntu/i915/intel_sdvo.c index f497b3d..d8e221a 100644 --- a/ubuntu/i915/intel_sdvo.c +++ b/ubuntu/i915/intel_sdvo.c @@ -2980,6 +2980,7 @@ bool intel_sdvo_init(struct drm_device *dev, /* encoder type will be decided later */ intel_encoder = &intel_sdvo->base; intel_encoder->type = INTEL_OUTPUT_SDVO; + intel_encoder->port = port; drm_encoder_init(dev, &intel_encoder->base, &intel_sdvo_enc_funcs, 0); /* Read the regs to test if we can talk to the device */ diff --git a/ubuntu/i915/intel_tv.c b/ubuntu/i915/intel_tv.c index a71456f..041bf76 100644 --- a/ubuntu/i915/intel_tv.c +++ b/ubuntu/i915/intel_tv.c @@ -1603,7 +1603,9 @@ intel_tv_init(struct drm_device *dev) intel_connector->unregister = intel_connector_unregister; intel_connector_attach_encoder(intel_connector, intel_encoder); + intel_encoder->type = INTEL_OUTPUT_TVOUT; + intel_encoder->port = PORT_NONE; intel_encoder->crtc_mask = (1 << 0) | (1 << 1); intel_encoder->cloneable = 0; intel_encoder->base.possible_crtcs = ((1 << 0) | (1 << 1));