Commit a9b84b44 authored by Mahesh Kumar's avatar Mahesh Kumar Committed by Joonas Lahtinen

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: default avatarMahesh Kumar <mahesh1.kumar@intel.com>
Cc: Madhav Chauhan <madhav.chauhan@intel.com>
Cc: Manasi Navare <manasi.d.navare@intel.com>
Reviewed-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181004085043.10154-1-mahesh1.kumar@intel.com
(cherry picked from commit 176597a1)
Signed-off-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
parent d9a51586
...@@ -916,7 +916,7 @@ static int intel_ddi_hdmi_level(struct drm_i915_private *dev_priv, enum port por ...@@ -916,7 +916,7 @@ static int intel_ddi_hdmi_level(struct drm_i915_private *dev_priv, enum port por
level = dev_priv->vbt.ddi_port_info[port].hdmi_level_shift; level = dev_priv->vbt.ddi_port_info[port].hdmi_level_shift;
if (IS_ICELAKE(dev_priv)) { if (IS_ICELAKE(dev_priv)) {
if (port == PORT_A || port == PORT_B) if (intel_port_is_combophy(dev_priv, port))
icl_get_combo_buf_trans(dev_priv, port, icl_get_combo_buf_trans(dev_priv, port,
INTEL_OUTPUT_HDMI, &n_entries); INTEL_OUTPUT_HDMI, &n_entries);
else else
...@@ -1535,7 +1535,7 @@ static void icl_ddi_clock_get(struct intel_encoder *encoder, ...@@ -1535,7 +1535,7 @@ static void icl_ddi_clock_get(struct intel_encoder *encoder,
uint32_t pll_id; uint32_t pll_id;
pll_id = intel_get_shared_dpll_id(dev_priv, pipe_config->shared_dpll); pll_id = intel_get_shared_dpll_id(dev_priv, pipe_config->shared_dpll);
if (port == PORT_A || port == PORT_B) { if (intel_port_is_combophy(dev_priv, port)) {
if (intel_crtc_has_type(pipe_config, INTEL_OUTPUT_HDMI)) if (intel_crtc_has_type(pipe_config, INTEL_OUTPUT_HDMI))
link_clock = cnl_calc_wrpll_link(dev_priv, pll_id); link_clock = cnl_calc_wrpll_link(dev_priv, pll_id);
else else
...@@ -2235,7 +2235,7 @@ u8 intel_ddi_dp_voltage_max(struct intel_encoder *encoder) ...@@ -2235,7 +2235,7 @@ u8 intel_ddi_dp_voltage_max(struct intel_encoder *encoder)
int n_entries; int n_entries;
if (IS_ICELAKE(dev_priv)) { if (IS_ICELAKE(dev_priv)) {
if (port == PORT_A || port == PORT_B) if (intel_port_is_combophy(dev_priv, port))
icl_get_combo_buf_trans(dev_priv, port, encoder->type, icl_get_combo_buf_trans(dev_priv, port, encoder->type,
&n_entries); &n_entries);
else else
...@@ -2669,9 +2669,10 @@ static void icl_ddi_vswing_sequence(struct intel_encoder *encoder, ...@@ -2669,9 +2669,10 @@ static void icl_ddi_vswing_sequence(struct intel_encoder *encoder,
u32 level, u32 level,
enum intel_output_type type) enum intel_output_type type)
{ {
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
enum port port = encoder->port; enum port port = encoder->port;
if (port == PORT_A || port == PORT_B) if (intel_port_is_combophy(dev_priv, port))
icl_combo_phy_ddi_vswing_sequence(encoder, level, type); icl_combo_phy_ddi_vswing_sequence(encoder, level, type);
else else
icl_mg_phy_ddi_vswing_sequence(encoder, link_clock, level); 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,7 +2758,7 @@ void icl_map_plls_to_ports(struct drm_crtc *crtc,
val = I915_READ(DPCLKA_CFGCR0_ICL); val = I915_READ(DPCLKA_CFGCR0_ICL);
WARN_ON((val & DPCLKA_CFGCR0_DDI_CLK_OFF(port)) == 0); WARN_ON((val & DPCLKA_CFGCR0_DDI_CLK_OFF(port)) == 0);
if (port == PORT_A || port == PORT_B) { if (intel_port_is_combophy(dev_priv, port)) {
val &= ~DPCLKA_CFGCR0_DDI_CLK_SEL_MASK(port); val &= ~DPCLKA_CFGCR0_DDI_CLK_SEL_MASK(port);
val |= DPCLKA_CFGCR0_DDI_CLK_SEL(pll->info->id, port); val |= DPCLKA_CFGCR0_DDI_CLK_SEL(pll->info->id, port);
I915_WRITE(DPCLKA_CFGCR0_ICL, val); I915_WRITE(DPCLKA_CFGCR0_ICL, val);
...@@ -2810,7 +2811,7 @@ static void intel_ddi_clk_select(struct intel_encoder *encoder, ...@@ -2810,7 +2811,7 @@ static void intel_ddi_clk_select(struct intel_encoder *encoder,
mutex_lock(&dev_priv->dpll_lock); mutex_lock(&dev_priv->dpll_lock);
if (IS_ICELAKE(dev_priv)) { if (IS_ICELAKE(dev_priv)) {
if (port >= PORT_C) if (!intel_port_is_combophy(dev_priv, port))
I915_WRITE(DDI_CLK_SEL(port), I915_WRITE(DDI_CLK_SEL(port),
icl_pll_to_ddi_pll_sel(encoder, pll)); icl_pll_to_ddi_pll_sel(encoder, pll));
} else if (IS_CANNONLAKE(dev_priv)) { } else if (IS_CANNONLAKE(dev_priv)) {
...@@ -2852,7 +2853,7 @@ static void intel_ddi_clk_disable(struct intel_encoder *encoder) ...@@ -2852,7 +2853,7 @@ static void intel_ddi_clk_disable(struct intel_encoder *encoder)
enum port port = encoder->port; enum port port = encoder->port;
if (IS_ICELAKE(dev_priv)) { if (IS_ICELAKE(dev_priv)) {
if (port >= PORT_C) if (!intel_port_is_combophy(dev_priv, port))
I915_WRITE(DDI_CLK_SEL(port), DDI_CLK_SEL_NONE); I915_WRITE(DDI_CLK_SEL(port), DDI_CLK_SEL_NONE);
} else if (IS_CANNONLAKE(dev_priv)) { } else if (IS_CANNONLAKE(dev_priv)) {
I915_WRITE(DPCLKA_CFGCR0, I915_READ(DPCLKA_CFGCR0) | I915_WRITE(DPCLKA_CFGCR0, I915_READ(DPCLKA_CFGCR0) |
......
...@@ -5961,6 +5961,17 @@ static void i9xx_pfit_enable(struct intel_crtc *crtc) ...@@ -5961,6 +5961,17 @@ static void i9xx_pfit_enable(struct intel_crtc *crtc)
I915_WRITE(BCLRPAT(crtc->pipe), 0); I915_WRITE(BCLRPAT(crtc->pipe), 0);
} }
bool intel_port_is_combophy(struct drm_i915_private *dev_priv, enum port port)
{
if (port == PORT_NONE)
return false;
if (IS_ICELAKE(dev_priv))
return port <= PORT_B;
return false;
}
bool intel_port_is_tc(struct drm_i915_private *dev_priv, enum port port) bool intel_port_is_tc(struct drm_i915_private *dev_priv, enum port port)
{ {
if (IS_ICELAKE(dev_priv)) if (IS_ICELAKE(dev_priv))
......
...@@ -1517,6 +1517,7 @@ void intel_connector_attach_encoder(struct intel_connector *connector, ...@@ -1517,6 +1517,7 @@ void intel_connector_attach_encoder(struct intel_connector *connector,
struct intel_encoder *encoder); struct intel_encoder *encoder);
struct drm_display_mode * struct drm_display_mode *
intel_encoder_current_mode(struct intel_encoder *encoder); intel_encoder_current_mode(struct intel_encoder *encoder);
bool intel_port_is_combophy(struct drm_i915_private *dev_priv, enum port port);
bool intel_port_is_tc(struct drm_i915_private *dev_priv, enum port port); bool intel_port_is_tc(struct drm_i915_private *dev_priv, enum port port);
enum tc_port intel_port_to_tc(struct drm_i915_private *dev_priv, enum tc_port intel_port_to_tc(struct drm_i915_private *dev_priv,
enum port port); enum port port);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment