aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMahesh Kumar <mahesh1.kumar@intel.com>2018-10-04 04:50:43 -0400
committerJoonas Lahtinen <joonas.lahtinen@linux.intel.com>2018-10-18 03:23:20 -0400
commita9b84b4492774668237b19aa65536e934df51567 (patch)
tree35eb812debd112dcc486afb3791ec42dce6dc808
parentd9a515867bdba59ebf196a6ade10faae8e8be36a (diff)
drm/i915/icl: create function to identify combophy port
This patch creates a function/wrapper to check if port is combophy port instead of explicitly comparing ports. Changes since V1: - keep all intel_port_is_* helper together (Lucas) Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com> Cc: Madhav Chauhan <madhav.chauhan@intel.com> Cc: Manasi Navare <manasi.d.navare@intel.com> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20181004085043.10154-1-mahesh1.kumar@intel.com (cherry picked from commit 176597a12d61709727d1639836e5d68a6e7c437b) Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
-rw-r--r--drivers/gpu/drm/i915/intel_ddi.c15
-rw-r--r--drivers/gpu/drm/i915/intel_display.c11
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h1
3 files changed, 20 insertions, 7 deletions
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index b6910c8b4e08..aeb7d337f2dc 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -916,7 +916,7 @@ static int intel_ddi_hdmi_level(struct drm_i915_private *dev_priv, enum port por
916 level = dev_priv->vbt.ddi_port_info[port].hdmi_level_shift; 916 level = dev_priv->vbt.ddi_port_info[port].hdmi_level_shift;
917 917
918 if (IS_ICELAKE(dev_priv)) { 918 if (IS_ICELAKE(dev_priv)) {
919 if (port == PORT_A || port == PORT_B) 919 if (intel_port_is_combophy(dev_priv, port))
920 icl_get_combo_buf_trans(dev_priv, port, 920 icl_get_combo_buf_trans(dev_priv, port,
921 INTEL_OUTPUT_HDMI, &n_entries); 921 INTEL_OUTPUT_HDMI, &n_entries);
922 else 922 else
@@ -1535,7 +1535,7 @@ static void icl_ddi_clock_get(struct intel_encoder *encoder,
1535 uint32_t pll_id; 1535 uint32_t pll_id;
1536 1536
1537 pll_id = intel_get_shared_dpll_id(dev_priv, pipe_config->shared_dpll); 1537 pll_id = intel_get_shared_dpll_id(dev_priv, pipe_config->shared_dpll);
1538 if (port == PORT_A || port == PORT_B) { 1538 if (intel_port_is_combophy(dev_priv, port)) {
1539 if (intel_crtc_has_type(pipe_config, INTEL_OUTPUT_HDMI)) 1539 if (intel_crtc_has_type(pipe_config, INTEL_OUTPUT_HDMI))
1540 link_clock = cnl_calc_wrpll_link(dev_priv, pll_id); 1540 link_clock = cnl_calc_wrpll_link(dev_priv, pll_id);
1541 else 1541 else
@@ -2235,7 +2235,7 @@ u8 intel_ddi_dp_voltage_max(struct intel_encoder *encoder)
2235 int n_entries; 2235 int n_entries;
2236 2236
2237 if (IS_ICELAKE(dev_priv)) { 2237 if (IS_ICELAKE(dev_priv)) {
2238 if (port == PORT_A || port == PORT_B) 2238 if (intel_port_is_combophy(dev_priv, port))
2239 icl_get_combo_buf_trans(dev_priv, port, encoder->type, 2239 icl_get_combo_buf_trans(dev_priv, port, encoder->type,
2240 &n_entries); 2240 &n_entries);
2241 else 2241 else
@@ -2669,9 +2669,10 @@ static void icl_ddi_vswing_sequence(struct intel_encoder *encoder,
2669 u32 level, 2669 u32 level,
2670 enum intel_output_type type) 2670 enum intel_output_type type)
2671{ 2671{
2672 struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
2672 enum port port = encoder->port; 2673 enum port port = encoder->port;
2673 2674
2674 if (port == PORT_A || port == PORT_B) 2675 if (intel_port_is_combophy(dev_priv, port))
2675 icl_combo_phy_ddi_vswing_sequence(encoder, level, type); 2676 icl_combo_phy_ddi_vswing_sequence(encoder, level, type);
2676 else 2677 else
2677 icl_mg_phy_ddi_vswing_sequence(encoder, link_clock, level); 2678 icl_mg_phy_ddi_vswing_sequence(encoder, link_clock, level);
@@ -2757,7 +2758,7 @@ void icl_map_plls_to_ports(struct drm_crtc *crtc,
2757 val = I915_READ(DPCLKA_CFGCR0_ICL); 2758 val = I915_READ(DPCLKA_CFGCR0_ICL);
2758 WARN_ON((val & DPCLKA_CFGCR0_DDI_CLK_OFF(port)) == 0); 2759 WARN_ON((val & DPCLKA_CFGCR0_DDI_CLK_OFF(port)) == 0);
2759 2760
2760 if (port == PORT_A || port == PORT_B) { 2761 if (intel_port_is_combophy(dev_priv, port)) {
2761 val &= ~DPCLKA_CFGCR0_DDI_CLK_SEL_MASK(port); 2762 val &= ~DPCLKA_CFGCR0_DDI_CLK_SEL_MASK(port);
2762 val |= DPCLKA_CFGCR0_DDI_CLK_SEL(pll->info->id, port); 2763 val |= DPCLKA_CFGCR0_DDI_CLK_SEL(pll->info->id, port);
2763 I915_WRITE(DPCLKA_CFGCR0_ICL, val); 2764 I915_WRITE(DPCLKA_CFGCR0_ICL, val);
@@ -2810,7 +2811,7 @@ static void intel_ddi_clk_select(struct intel_encoder *encoder,
2810 mutex_lock(&dev_priv->dpll_lock); 2811 mutex_lock(&dev_priv->dpll_lock);
2811 2812
2812 if (IS_ICELAKE(dev_priv)) { 2813 if (IS_ICELAKE(dev_priv)) {
2813 if (port >= PORT_C) 2814 if (!intel_port_is_combophy(dev_priv, port))
2814 I915_WRITE(DDI_CLK_SEL(port), 2815 I915_WRITE(DDI_CLK_SEL(port),
2815 icl_pll_to_ddi_pll_sel(encoder, pll)); 2816 icl_pll_to_ddi_pll_sel(encoder, pll));
2816 } else if (IS_CANNONLAKE(dev_priv)) { 2817 } else if (IS_CANNONLAKE(dev_priv)) {
@@ -2852,7 +2853,7 @@ static void intel_ddi_clk_disable(struct intel_encoder *encoder)
2852 enum port port = encoder->port; 2853 enum port port = encoder->port;
2853 2854
2854 if (IS_ICELAKE(dev_priv)) { 2855 if (IS_ICELAKE(dev_priv)) {
2855 if (port >= PORT_C) 2856 if (!intel_port_is_combophy(dev_priv, port))
2856 I915_WRITE(DDI_CLK_SEL(port), DDI_CLK_SEL_NONE); 2857 I915_WRITE(DDI_CLK_SEL(port), DDI_CLK_SEL_NONE);
2857 } else if (IS_CANNONLAKE(dev_priv)) { 2858 } else if (IS_CANNONLAKE(dev_priv)) {
2858 I915_WRITE(DPCLKA_CFGCR0, I915_READ(DPCLKA_CFGCR0) | 2859 I915_WRITE(DPCLKA_CFGCR0, I915_READ(DPCLKA_CFGCR0) |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 3cd813c21af1..9741cc419e1b 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -5961,6 +5961,17 @@ static void i9xx_pfit_enable(struct intel_crtc *crtc)
5961 I915_WRITE(BCLRPAT(crtc->pipe), 0); 5961 I915_WRITE(BCLRPAT(crtc->pipe), 0);
5962} 5962}
5963 5963
5964bool intel_port_is_combophy(struct drm_i915_private *dev_priv, enum port port)
5965{
5966 if (port == PORT_NONE)
5967 return false;
5968
5969 if (IS_ICELAKE(dev_priv))
5970 return port <= PORT_B;
5971
5972 return false;
5973}
5974
5964bool intel_port_is_tc(struct drm_i915_private *dev_priv, enum port port) 5975bool intel_port_is_tc(struct drm_i915_private *dev_priv, enum port port)
5965{ 5976{
5966 if (IS_ICELAKE(dev_priv)) 5977 if (IS_ICELAKE(dev_priv))
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index a34c2f1f9159..f8dc84b2d2d3 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1517,6 +1517,7 @@ void intel_connector_attach_encoder(struct intel_connector *connector,
1517 struct intel_encoder *encoder); 1517 struct intel_encoder *encoder);
1518struct drm_display_mode * 1518struct drm_display_mode *
1519intel_encoder_current_mode(struct intel_encoder *encoder); 1519intel_encoder_current_mode(struct intel_encoder *encoder);
1520bool intel_port_is_combophy(struct drm_i915_private *dev_priv, enum port port);
1520bool intel_port_is_tc(struct drm_i915_private *dev_priv, enum port port); 1521bool intel_port_is_tc(struct drm_i915_private *dev_priv, enum port port);
1521enum tc_port intel_port_to_tc(struct drm_i915_private *dev_priv, 1522enum tc_port intel_port_to_tc(struct drm_i915_private *dev_priv,
1522 enum port port); 1523 enum port port);