Commit bdabdb63 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Add enum aux_ch and clean up the aux init to use it

Since we no longer have a 1:1 correspondence between ports and AUX
channels, let's give AUX channels their own enum. Makes it easier
to tell the apples from the oranges, and we get rid of the
port E AUX power domain FIXME since we now derive the power domain
from the actual AUX CH.

v2: Rebase due to AUX F
v3: Split out the power domain fix (Rodrigo)

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> #v2
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> #v2
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180222181036.15251-2-ville.syrjala@linux.intel.com
parent ff63861c
...@@ -5353,8 +5353,8 @@ enum { ...@@ -5353,8 +5353,8 @@ enum {
#define _DPF_AUX_CH_DATA4 (dev_priv->info.display_mmio_offset + 0x64520) #define _DPF_AUX_CH_DATA4 (dev_priv->info.display_mmio_offset + 0x64520)
#define _DPF_AUX_CH_DATA5 (dev_priv->info.display_mmio_offset + 0x64524) #define _DPF_AUX_CH_DATA5 (dev_priv->info.display_mmio_offset + 0x64524)
#define DP_AUX_CH_CTL(port) _MMIO_PORT(port, _DPA_AUX_CH_CTL, _DPB_AUX_CH_CTL) #define DP_AUX_CH_CTL(aux_ch) _MMIO_PORT(aux_ch, _DPA_AUX_CH_CTL, _DPB_AUX_CH_CTL)
#define DP_AUX_CH_DATA(port, i) _MMIO(_PORT(port, _DPA_AUX_CH_DATA1, _DPB_AUX_CH_DATA1) + (i) * 4) /* 5 registers */ #define DP_AUX_CH_DATA(aux_ch, i) _MMIO(_PORT(aux_ch, _DPA_AUX_CH_DATA1, _DPB_AUX_CH_DATA1) + (i) * 4) /* 5 registers */
#define DP_AUX_CH_CTL_SEND_BUSY (1 << 31) #define DP_AUX_CH_CTL_SEND_BUSY (1 << 31)
#define DP_AUX_CH_CTL_DONE (1 << 30) #define DP_AUX_CH_CTL_DONE (1 << 30)
...@@ -7881,8 +7881,8 @@ enum { ...@@ -7881,8 +7881,8 @@ enum {
#define _PCH_DPD_AUX_CH_DATA4 0xe4320 #define _PCH_DPD_AUX_CH_DATA4 0xe4320
#define _PCH_DPD_AUX_CH_DATA5 0xe4324 #define _PCH_DPD_AUX_CH_DATA5 0xe4324
#define PCH_DP_AUX_CH_CTL(port) _MMIO_PORT((port) - PORT_B, _PCH_DPB_AUX_CH_CTL, _PCH_DPC_AUX_CH_CTL) #define PCH_DP_AUX_CH_CTL(aux_ch) _MMIO_PORT((aux_ch) - AUX_CH_B, _PCH_DPB_AUX_CH_CTL, _PCH_DPC_AUX_CH_CTL)
#define PCH_DP_AUX_CH_DATA(port, i) _MMIO(_PORT((port) - PORT_B, _PCH_DPB_AUX_CH_DATA1, _PCH_DPC_AUX_CH_DATA1) + (i) * 4) /* 5 registers */ #define PCH_DP_AUX_CH_DATA(aux_ch, i) _MMIO(_PORT((aux_ch) - AUX_CH_B, _PCH_DPB_AUX_CH_DATA1, _PCH_DPC_AUX_CH_DATA1) + (i) * 4) /* 5 registers */
/* CPT */ /* CPT */
#define PORT_TRANS_A_SEL_CPT 0 #define PORT_TRANS_A_SEL_CPT 0
......
...@@ -139,6 +139,17 @@ enum dpio_phy { ...@@ -139,6 +139,17 @@ enum dpio_phy {
#define I915_NUM_PHYS_VLV 2 #define I915_NUM_PHYS_VLV 2
enum aux_ch {
AUX_CH_A,
AUX_CH_B,
AUX_CH_C,
AUX_CH_D,
_AUX_CH_E, /* does not exist */
AUX_CH_F,
};
#define aux_ch_name(a) ((a) + 'A')
enum intel_display_power_domain { enum intel_display_power_domain {
POWER_DOMAIN_PIPE_A, POWER_DOMAIN_PIPE_A,
POWER_DOMAIN_PIPE_B, POWER_DOMAIN_PIPE_B,
......
...@@ -1307,171 +1307,194 @@ intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) ...@@ -1307,171 +1307,194 @@ intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
return ret; return ret;
} }
static enum port intel_aux_port(struct drm_i915_private *dev_priv, static enum aux_ch intel_aux_ch(struct intel_dp *intel_dp)
enum port port)
{ {
struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base;
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
enum port port = encoder->port;
const struct ddi_vbt_port_info *info = const struct ddi_vbt_port_info *info =
&dev_priv->vbt.ddi_port_info[port]; &dev_priv->vbt.ddi_port_info[port];
enum port aux_port; enum aux_ch aux_ch;
if (!info->alternate_aux_channel) { if (!info->alternate_aux_channel) {
aux_ch = (enum aux_ch) port;
DRM_DEBUG_KMS("using AUX %c for port %c (platform default)\n", DRM_DEBUG_KMS("using AUX %c for port %c (platform default)\n",
port_name(port), port_name(port)); aux_ch_name(aux_ch), port_name(port));
return port; return aux_ch;
} }
switch (info->alternate_aux_channel) { switch (info->alternate_aux_channel) {
case DP_AUX_A: case DP_AUX_A:
aux_port = PORT_A; aux_ch = AUX_CH_A;
break; break;
case DP_AUX_B: case DP_AUX_B:
aux_port = PORT_B; aux_ch = AUX_CH_B;
break; break;
case DP_AUX_C: case DP_AUX_C:
aux_port = PORT_C; aux_ch = AUX_CH_C;
break; break;
case DP_AUX_D: case DP_AUX_D:
aux_port = PORT_D; aux_ch = AUX_CH_D;
break; break;
case DP_AUX_F: case DP_AUX_F:
aux_port = PORT_F; aux_ch = AUX_CH_F;
break; break;
default: default:
MISSING_CASE(info->alternate_aux_channel); MISSING_CASE(info->alternate_aux_channel);
aux_port = PORT_A; aux_ch = AUX_CH_A;
break; break;
} }
DRM_DEBUG_KMS("using AUX %c for port %c (VBT)\n", DRM_DEBUG_KMS("using AUX %c for port %c (VBT)\n",
port_name(aux_port), port_name(port)); aux_ch_name(aux_ch), port_name(port));
return aux_port; return aux_ch;
}
static enum intel_display_power_domain
intel_aux_power_domain(struct intel_dp *intel_dp)
{
switch (intel_dp->aux_ch) {
case AUX_CH_A:
return POWER_DOMAIN_AUX_A;
case AUX_CH_B:
return POWER_DOMAIN_AUX_B;
case AUX_CH_C:
return POWER_DOMAIN_AUX_C;
case AUX_CH_D:
return POWER_DOMAIN_AUX_D;
case AUX_CH_F:
return POWER_DOMAIN_AUX_F;
default:
MISSING_CASE(intel_dp->aux_ch);
return POWER_DOMAIN_AUX_A;
}
} }
static i915_reg_t g4x_aux_ctl_reg(struct drm_i915_private *dev_priv, static i915_reg_t g4x_aux_ctl_reg(struct drm_i915_private *dev_priv,
enum port port) enum aux_ch aux_ch)
{ {
switch (port) { switch (aux_ch) {
case PORT_B: case AUX_CH_B:
case PORT_C: case AUX_CH_C:
case PORT_D: case AUX_CH_D:
return DP_AUX_CH_CTL(port); return DP_AUX_CH_CTL(aux_ch);
default: default:
MISSING_CASE(port); MISSING_CASE(aux_ch);
return DP_AUX_CH_CTL(PORT_B); return DP_AUX_CH_CTL(AUX_CH_B);
} }
} }
static i915_reg_t g4x_aux_data_reg(struct drm_i915_private *dev_priv, static i915_reg_t g4x_aux_data_reg(struct drm_i915_private *dev_priv,
enum port port, int index) enum aux_ch aux_ch, int index)
{ {
switch (port) { switch (aux_ch) {
case PORT_B: case AUX_CH_B:
case PORT_C: case AUX_CH_C:
case PORT_D: case AUX_CH_D:
return DP_AUX_CH_DATA(port, index); return DP_AUX_CH_DATA(aux_ch, index);
default: default:
MISSING_CASE(port); MISSING_CASE(aux_ch);
return DP_AUX_CH_DATA(PORT_B, index); return DP_AUX_CH_DATA(AUX_CH_B, index);
} }
} }
static i915_reg_t ilk_aux_ctl_reg(struct drm_i915_private *dev_priv, static i915_reg_t ilk_aux_ctl_reg(struct drm_i915_private *dev_priv,
enum port port) enum aux_ch aux_ch)
{ {
switch (port) { switch (aux_ch) {
case PORT_A: case AUX_CH_A:
return DP_AUX_CH_CTL(port); return DP_AUX_CH_CTL(aux_ch);
case PORT_B: case AUX_CH_B:
case PORT_C: case AUX_CH_C:
case PORT_D: case AUX_CH_D:
return PCH_DP_AUX_CH_CTL(port); return PCH_DP_AUX_CH_CTL(aux_ch);
default: default:
MISSING_CASE(port); MISSING_CASE(aux_ch);
return DP_AUX_CH_CTL(PORT_A); return DP_AUX_CH_CTL(AUX_CH_A);
} }
} }
static i915_reg_t ilk_aux_data_reg(struct drm_i915_private *dev_priv, static i915_reg_t ilk_aux_data_reg(struct drm_i915_private *dev_priv,
enum port port, int index) enum aux_ch aux_ch, int index)
{ {
switch (port) { switch (aux_ch) {
case PORT_A: case AUX_CH_A:
return DP_AUX_CH_DATA(port, index); return DP_AUX_CH_DATA(aux_ch, index);
case PORT_B: case AUX_CH_B:
case PORT_C: case AUX_CH_C:
case PORT_D: case AUX_CH_D:
return PCH_DP_AUX_CH_DATA(port, index); return PCH_DP_AUX_CH_DATA(aux_ch, index);
default: default:
MISSING_CASE(port); MISSING_CASE(aux_ch);
return DP_AUX_CH_DATA(PORT_A, index); return DP_AUX_CH_DATA(AUX_CH_A, index);
} }
} }
static i915_reg_t skl_aux_ctl_reg(struct drm_i915_private *dev_priv, static i915_reg_t skl_aux_ctl_reg(struct drm_i915_private *dev_priv,
enum port port) enum aux_ch aux_ch)
{ {
switch (port) { switch (aux_ch) {
case PORT_A: case AUX_CH_A:
case PORT_B: case AUX_CH_B:
case PORT_C: case AUX_CH_C:
case PORT_D: case AUX_CH_D:
case PORT_F: case AUX_CH_F:
return DP_AUX_CH_CTL(port); return DP_AUX_CH_CTL(aux_ch);
default: default:
MISSING_CASE(port); MISSING_CASE(aux_ch);
return DP_AUX_CH_CTL(PORT_A); return DP_AUX_CH_CTL(AUX_CH_A);
} }
} }
static i915_reg_t skl_aux_data_reg(struct drm_i915_private *dev_priv, static i915_reg_t skl_aux_data_reg(struct drm_i915_private *dev_priv,
enum port port, int index) enum aux_ch aux_ch, int index)
{ {
switch (port) { switch (aux_ch) {
case PORT_A: case AUX_CH_A:
case PORT_B: case AUX_CH_B:
case PORT_C: case AUX_CH_C:
case PORT_D: case AUX_CH_D:
case PORT_F: case AUX_CH_F:
return DP_AUX_CH_DATA(port, index); return DP_AUX_CH_DATA(aux_ch, index);
default: default:
MISSING_CASE(port); MISSING_CASE(aux_ch);
return DP_AUX_CH_DATA(PORT_A, index); return DP_AUX_CH_DATA(AUX_CH_A, index);
} }
} }
static i915_reg_t intel_aux_ctl_reg(struct drm_i915_private *dev_priv, static i915_reg_t intel_aux_ctl_reg(struct drm_i915_private *dev_priv,
enum port port) enum aux_ch aux_ch)
{ {
if (INTEL_GEN(dev_priv) >= 9) if (INTEL_GEN(dev_priv) >= 9)
return skl_aux_ctl_reg(dev_priv, port); return skl_aux_ctl_reg(dev_priv, aux_ch);
else if (HAS_PCH_SPLIT(dev_priv)) else if (HAS_PCH_SPLIT(dev_priv))
return ilk_aux_ctl_reg(dev_priv, port); return ilk_aux_ctl_reg(dev_priv, aux_ch);
else else
return g4x_aux_ctl_reg(dev_priv, port); return g4x_aux_ctl_reg(dev_priv, aux_ch);
} }
static i915_reg_t intel_aux_data_reg(struct drm_i915_private *dev_priv, static i915_reg_t intel_aux_data_reg(struct drm_i915_private *dev_priv,
enum port port, int index) enum aux_ch aux_ch, int index)
{ {
if (INTEL_GEN(dev_priv) >= 9) if (INTEL_GEN(dev_priv) >= 9)
return skl_aux_data_reg(dev_priv, port, index); return skl_aux_data_reg(dev_priv, aux_ch, index);
else if (HAS_PCH_SPLIT(dev_priv)) else if (HAS_PCH_SPLIT(dev_priv))
return ilk_aux_data_reg(dev_priv, port, index); return ilk_aux_data_reg(dev_priv, aux_ch, index);
else else
return g4x_aux_data_reg(dev_priv, port, index); return g4x_aux_data_reg(dev_priv, aux_ch, index);
} }
static void intel_aux_reg_init(struct intel_dp *intel_dp) static void intel_aux_reg_init(struct intel_dp *intel_dp)
{ {
struct drm_i915_private *dev_priv = to_i915(intel_dp_to_dev(intel_dp)); struct drm_i915_private *dev_priv = to_i915(intel_dp_to_dev(intel_dp));
enum port port = intel_aux_port(dev_priv, enum aux_ch aux_ch = intel_dp->aux_ch;
dp_to_dig_port(intel_dp)->base.port);
int i; int i;
intel_dp->aux_ch_ctl_reg = intel_aux_ctl_reg(dev_priv, port); intel_dp->aux_ch_ctl_reg = intel_aux_ctl_reg(dev_priv, aux_ch);
for (i = 0; i < ARRAY_SIZE(intel_dp->aux_ch_data_reg); i++) for (i = 0; i < ARRAY_SIZE(intel_dp->aux_ch_data_reg); i++)
intel_dp->aux_ch_data_reg[i] = intel_aux_data_reg(dev_priv, port, i); intel_dp->aux_ch_data_reg[i] = intel_aux_data_reg(dev_priv, aux_ch, i);
} }
static void static void
...@@ -1483,14 +1506,17 @@ intel_dp_aux_fini(struct intel_dp *intel_dp) ...@@ -1483,14 +1506,17 @@ intel_dp_aux_fini(struct intel_dp *intel_dp)
static void static void
intel_dp_aux_init(struct intel_dp *intel_dp) intel_dp_aux_init(struct intel_dp *intel_dp)
{ {
struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base;
enum port port = intel_dig_port->base.port;
intel_dp->aux_ch = intel_aux_ch(intel_dp);
intel_dp->aux_power_domain = intel_aux_power_domain(intel_dp);
intel_aux_reg_init(intel_dp); intel_aux_reg_init(intel_dp);
drm_dp_aux_init(&intel_dp->aux); drm_dp_aux_init(&intel_dp->aux);
/* Failure to allocate our preferred name is not critical */ /* Failure to allocate our preferred name is not critical */
intel_dp->aux.name = kasprintf(GFP_KERNEL, "DPDDC-%c", port_name(port)); intel_dp->aux.name = kasprintf(GFP_KERNEL, "DPDDC-%c",
port_name(encoder->port));
intel_dp->aux.transfer = intel_dp_aux_transfer; intel_dp->aux.transfer = intel_dp_aux_transfer;
} }
...@@ -6009,38 +6035,6 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp, ...@@ -6009,38 +6035,6 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
return false; return false;
} }
/* Set up the hotplug pin and aux power domain. */
static void
intel_dp_init_connector_port_info(struct intel_digital_port *intel_dig_port)
{
struct intel_encoder *encoder = &intel_dig_port->base;
struct intel_dp *intel_dp = &intel_dig_port->dp;
struct intel_encoder *intel_encoder = &intel_dig_port->base;
struct drm_i915_private *dev_priv = to_i915(intel_encoder->base.dev);
encoder->hpd_pin = intel_hpd_pin_default(dev_priv, encoder->port);
switch (intel_aux_port(dev_priv, encoder->port)) {
case PORT_A:
intel_dp->aux_power_domain = POWER_DOMAIN_AUX_A;
break;
case PORT_B:
intel_dp->aux_power_domain = POWER_DOMAIN_AUX_B;
break;
case PORT_C:
intel_dp->aux_power_domain = POWER_DOMAIN_AUX_C;
break;
case PORT_D:
intel_dp->aux_power_domain = POWER_DOMAIN_AUX_D;
break;
case PORT_F:
intel_dp->aux_power_domain = POWER_DOMAIN_AUX_F;
break;
default:
MISSING_CASE(encoder->port);
}
}
static void intel_dp_modeset_retry_work_fn(struct work_struct *work) static void intel_dp_modeset_retry_work_fn(struct work_struct *work)
{ {
struct intel_connector *intel_connector; struct intel_connector *intel_connector;
...@@ -6146,7 +6140,7 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port, ...@@ -6146,7 +6140,7 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
connector->interlace_allowed = true; connector->interlace_allowed = true;
connector->doublescan_allowed = 0; connector->doublescan_allowed = 0;
intel_dp_init_connector_port_info(intel_dig_port); intel_encoder->hpd_pin = intel_hpd_pin_default(dev_priv, port);
intel_dp_aux_init(intel_dp); intel_dp_aux_init(intel_dp);
......
...@@ -971,6 +971,7 @@ struct intel_dp { ...@@ -971,6 +971,7 @@ struct intel_dp {
bool detect_done; bool detect_done;
bool channel_eq_status; bool channel_eq_status;
bool reset_link_params; bool reset_link_params;
enum aux_ch aux_ch;
uint8_t dpcd[DP_RECEIVER_CAP_SIZE]; uint8_t dpcd[DP_RECEIVER_CAP_SIZE];
uint8_t psr_dpcd[EDP_PSR_RECEIVER_CAP_SIZE]; uint8_t psr_dpcd[EDP_PSR_RECEIVER_CAP_SIZE];
uint8_t downstream_ports[DP_MAX_DOWNSTREAM_PORTS]; uint8_t downstream_ports[DP_MAX_DOWNSTREAM_PORTS];
......
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