Commit 65ea19a6 authored by Jani Nikula's avatar Jani Nikula

drm/i915/hdmi: convert *_port_to_ddc_pin() to *_encoder_to_ddc_pin()

Pass encoder to the _port_to_ddc_pin() functions, and rename to
_encoder_to_ddc_pin(). The encoder will be more helpful than just port
in the subsequent changes.
Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/c94debf36816157de1105a186b061fd90dab574a.1710949619.git.jani.nikula@intel.comSigned-off-by: default avatarJani Nikula <jani.nikula@intel.com>
parent 4c8d5562
...@@ -2664,8 +2664,9 @@ bool intel_hdmi_handle_sink_scrambling(struct intel_encoder *encoder, ...@@ -2664,8 +2664,9 @@ bool intel_hdmi_handle_sink_scrambling(struct intel_encoder *encoder,
drm_scdc_set_scrambling(connector, scrambling); drm_scdc_set_scrambling(connector, scrambling);
} }
static u8 chv_port_to_ddc_pin(struct drm_i915_private *dev_priv, enum port port) static u8 chv_encoder_to_ddc_pin(struct intel_encoder *encoder)
{ {
enum port port = encoder->port;
u8 ddc_pin; u8 ddc_pin;
switch (port) { switch (port) {
...@@ -2686,8 +2687,9 @@ static u8 chv_port_to_ddc_pin(struct drm_i915_private *dev_priv, enum port port) ...@@ -2686,8 +2687,9 @@ static u8 chv_port_to_ddc_pin(struct drm_i915_private *dev_priv, enum port port)
return ddc_pin; return ddc_pin;
} }
static u8 bxt_port_to_ddc_pin(struct drm_i915_private *dev_priv, enum port port) static u8 bxt_encoder_to_ddc_pin(struct intel_encoder *encoder)
{ {
enum port port = encoder->port;
u8 ddc_pin; u8 ddc_pin;
switch (port) { switch (port) {
...@@ -2705,9 +2707,9 @@ static u8 bxt_port_to_ddc_pin(struct drm_i915_private *dev_priv, enum port port) ...@@ -2705,9 +2707,9 @@ static u8 bxt_port_to_ddc_pin(struct drm_i915_private *dev_priv, enum port port)
return ddc_pin; return ddc_pin;
} }
static u8 cnp_port_to_ddc_pin(struct drm_i915_private *dev_priv, static u8 cnp_encoder_to_ddc_pin(struct intel_encoder *encoder)
enum port port)
{ {
enum port port = encoder->port;
u8 ddc_pin; u8 ddc_pin;
switch (port) { switch (port) {
...@@ -2731,8 +2733,10 @@ static u8 cnp_port_to_ddc_pin(struct drm_i915_private *dev_priv, ...@@ -2731,8 +2733,10 @@ static u8 cnp_port_to_ddc_pin(struct drm_i915_private *dev_priv,
return ddc_pin; return ddc_pin;
} }
static u8 icl_port_to_ddc_pin(struct drm_i915_private *dev_priv, enum port port) static u8 icl_encoder_to_ddc_pin(struct intel_encoder *encoder)
{ {
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
enum port port = encoder->port;
enum phy phy = intel_port_to_phy(dev_priv, port); enum phy phy = intel_port_to_phy(dev_priv, port);
if (intel_phy_is_combo(dev_priv, phy)) if (intel_phy_is_combo(dev_priv, phy))
...@@ -2744,8 +2748,10 @@ static u8 icl_port_to_ddc_pin(struct drm_i915_private *dev_priv, enum port port) ...@@ -2744,8 +2748,10 @@ static u8 icl_port_to_ddc_pin(struct drm_i915_private *dev_priv, enum port port)
return GMBUS_PIN_2_BXT; return GMBUS_PIN_2_BXT;
} }
static u8 mcc_port_to_ddc_pin(struct drm_i915_private *dev_priv, enum port port) static u8 mcc_encoder_to_ddc_pin(struct intel_encoder *encoder)
{ {
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
enum port port = encoder->port;
enum phy phy = intel_port_to_phy(dev_priv, port); enum phy phy = intel_port_to_phy(dev_priv, port);
u8 ddc_pin; u8 ddc_pin;
...@@ -2767,8 +2773,10 @@ static u8 mcc_port_to_ddc_pin(struct drm_i915_private *dev_priv, enum port port) ...@@ -2767,8 +2773,10 @@ static u8 mcc_port_to_ddc_pin(struct drm_i915_private *dev_priv, enum port port)
return ddc_pin; return ddc_pin;
} }
static u8 rkl_port_to_ddc_pin(struct drm_i915_private *dev_priv, enum port port) static u8 rkl_encoder_to_ddc_pin(struct intel_encoder *encoder)
{ {
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
enum port port = encoder->port;
enum phy phy = intel_port_to_phy(dev_priv, port); enum phy phy = intel_port_to_phy(dev_priv, port);
WARN_ON(port == PORT_C); WARN_ON(port == PORT_C);
...@@ -2785,8 +2793,10 @@ static u8 rkl_port_to_ddc_pin(struct drm_i915_private *dev_priv, enum port port) ...@@ -2785,8 +2793,10 @@ static u8 rkl_port_to_ddc_pin(struct drm_i915_private *dev_priv, enum port port)
return GMBUS_PIN_1_BXT + phy; return GMBUS_PIN_1_BXT + phy;
} }
static u8 gen9bc_tgp_port_to_ddc_pin(struct drm_i915_private *i915, enum port port) static u8 gen9bc_tgp_encoder_to_ddc_pin(struct intel_encoder *encoder)
{ {
struct drm_i915_private *i915 = to_i915(encoder->base.dev);
enum port port = encoder->port;
enum phy phy = intel_port_to_phy(i915, port); enum phy phy = intel_port_to_phy(i915, port);
drm_WARN_ON(&i915->drm, port == PORT_A); drm_WARN_ON(&i915->drm, port == PORT_A);
...@@ -2803,13 +2813,18 @@ static u8 gen9bc_tgp_port_to_ddc_pin(struct drm_i915_private *i915, enum port po ...@@ -2803,13 +2813,18 @@ static u8 gen9bc_tgp_port_to_ddc_pin(struct drm_i915_private *i915, enum port po
return GMBUS_PIN_1_BXT + phy; return GMBUS_PIN_1_BXT + phy;
} }
static u8 dg1_port_to_ddc_pin(struct drm_i915_private *dev_priv, enum port port) static u8 dg1_encoder_to_ddc_pin(struct intel_encoder *encoder)
{ {
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
enum port port = encoder->port;
return intel_port_to_phy(dev_priv, port) + 1; return intel_port_to_phy(dev_priv, port) + 1;
} }
static u8 adls_port_to_ddc_pin(struct drm_i915_private *dev_priv, enum port port) static u8 adls_encoder_to_ddc_pin(struct intel_encoder *encoder)
{ {
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
enum port port = encoder->port;
enum phy phy = intel_port_to_phy(dev_priv, port); enum phy phy = intel_port_to_phy(dev_priv, port);
WARN_ON(port == PORT_B || port == PORT_C); WARN_ON(port == PORT_B || port == PORT_C);
...@@ -2824,9 +2839,9 @@ static u8 adls_port_to_ddc_pin(struct drm_i915_private *dev_priv, enum port port ...@@ -2824,9 +2839,9 @@ static u8 adls_port_to_ddc_pin(struct drm_i915_private *dev_priv, enum port port
return GMBUS_PIN_9_TC1_ICP + phy - PHY_B; return GMBUS_PIN_9_TC1_ICP + phy - PHY_B;
} }
static u8 g4x_port_to_ddc_pin(struct drm_i915_private *dev_priv, static u8 g4x_encoder_to_ddc_pin(struct intel_encoder *encoder)
enum port port)
{ {
enum port port = encoder->port;
u8 ddc_pin; u8 ddc_pin;
switch (port) { switch (port) {
...@@ -2850,30 +2865,29 @@ static u8 g4x_port_to_ddc_pin(struct drm_i915_private *dev_priv, ...@@ -2850,30 +2865,29 @@ static u8 g4x_port_to_ddc_pin(struct drm_i915_private *dev_priv,
static u8 intel_hdmi_default_ddc_pin(struct intel_encoder *encoder) static u8 intel_hdmi_default_ddc_pin(struct intel_encoder *encoder)
{ {
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
enum port port = encoder->port;
u8 ddc_pin; u8 ddc_pin;
if (IS_ALDERLAKE_S(dev_priv)) if (IS_ALDERLAKE_S(dev_priv))
ddc_pin = adls_port_to_ddc_pin(dev_priv, port); ddc_pin = adls_encoder_to_ddc_pin(encoder);
else if (INTEL_PCH_TYPE(dev_priv) >= PCH_DG1) else if (INTEL_PCH_TYPE(dev_priv) >= PCH_DG1)
ddc_pin = dg1_port_to_ddc_pin(dev_priv, port); ddc_pin = dg1_encoder_to_ddc_pin(encoder);
else if (IS_ROCKETLAKE(dev_priv)) else if (IS_ROCKETLAKE(dev_priv))
ddc_pin = rkl_port_to_ddc_pin(dev_priv, port); ddc_pin = rkl_encoder_to_ddc_pin(encoder);
else if (DISPLAY_VER(dev_priv) == 9 && HAS_PCH_TGP(dev_priv)) else if (DISPLAY_VER(dev_priv) == 9 && HAS_PCH_TGP(dev_priv))
ddc_pin = gen9bc_tgp_port_to_ddc_pin(dev_priv, port); ddc_pin = gen9bc_tgp_encoder_to_ddc_pin(encoder);
else if ((IS_JASPERLAKE(dev_priv) || IS_ELKHARTLAKE(dev_priv)) && else if ((IS_JASPERLAKE(dev_priv) || IS_ELKHARTLAKE(dev_priv)) &&
HAS_PCH_TGP(dev_priv)) HAS_PCH_TGP(dev_priv))
ddc_pin = mcc_port_to_ddc_pin(dev_priv, port); ddc_pin = mcc_encoder_to_ddc_pin(encoder);
else if (INTEL_PCH_TYPE(dev_priv) >= PCH_ICP) else if (INTEL_PCH_TYPE(dev_priv) >= PCH_ICP)
ddc_pin = icl_port_to_ddc_pin(dev_priv, port); ddc_pin = icl_encoder_to_ddc_pin(encoder);
else if (HAS_PCH_CNP(dev_priv)) else if (HAS_PCH_CNP(dev_priv))
ddc_pin = cnp_port_to_ddc_pin(dev_priv, port); ddc_pin = cnp_encoder_to_ddc_pin(encoder);
else if (IS_GEMINILAKE(dev_priv) || IS_BROXTON(dev_priv)) else if (IS_GEMINILAKE(dev_priv) || IS_BROXTON(dev_priv))
ddc_pin = bxt_port_to_ddc_pin(dev_priv, port); ddc_pin = bxt_encoder_to_ddc_pin(encoder);
else if (IS_CHERRYVIEW(dev_priv)) else if (IS_CHERRYVIEW(dev_priv))
ddc_pin = chv_port_to_ddc_pin(dev_priv, port); ddc_pin = chv_encoder_to_ddc_pin(encoder);
else else
ddc_pin = g4x_port_to_ddc_pin(dev_priv, port); ddc_pin = g4x_encoder_to_ddc_pin(encoder);
return ddc_pin; return ddc_pin;
} }
......
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