Commit 174edf1f authored by Paulo Zanoni's avatar Paulo Zanoni Committed by Daniel Vetter

drm/i915: add port field to intel_digital_port

Both "intel_dp" and "intel_hdmi" structs had a "port" field, which
always had the same value. It makes more sense to move this to
intel_digital_port, so we can know the port independently of the
connector type.
Signed-off-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: default avatarDamien Lespiau <damien.lespiau@intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent d63885da
...@@ -63,13 +63,11 @@ static enum port intel_ddi_get_encoder_port(struct intel_encoder *intel_encoder) ...@@ -63,13 +63,11 @@ static enum port intel_ddi_get_encoder_port(struct intel_encoder *intel_encoder)
struct drm_encoder *encoder = &intel_encoder->base; struct drm_encoder *encoder = &intel_encoder->base;
int type = intel_encoder->type; int type = intel_encoder->type;
if (type == INTEL_OUTPUT_DISPLAYPORT || type == INTEL_OUTPUT_EDP) { if (type == INTEL_OUTPUT_DISPLAYPORT || type == INTEL_OUTPUT_EDP ||
struct intel_dp *intel_dp = enc_to_intel_dp(encoder); type == INTEL_OUTPUT_HDMI) {
return intel_dp->port; struct intel_digital_port *intel_dig_port =
enc_to_dig_port(encoder);
} else if (type == INTEL_OUTPUT_HDMI) { return intel_dig_port->port;
struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
return intel_hdmi->ddi_port;
} else if (type == INTEL_OUTPUT_ANALOG) { } else if (type == INTEL_OUTPUT_ANALOG) {
return PORT_E; return PORT_E;
...@@ -925,11 +923,13 @@ void intel_ddi_enable_pipe_func(struct drm_crtc *crtc) ...@@ -925,11 +923,13 @@ void intel_ddi_enable_pipe_func(struct drm_crtc *crtc)
struct drm_i915_private *dev_priv = crtc->dev->dev_private; struct drm_i915_private *dev_priv = crtc->dev->dev_private;
enum pipe pipe = intel_crtc->pipe; enum pipe pipe = intel_crtc->pipe;
enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder; enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder;
enum port port = intel_ddi_get_encoder_port(intel_encoder);
int type = intel_encoder->type; int type = intel_encoder->type;
uint32_t temp; uint32_t temp;
/* Enable TRANS_DDI_FUNC_CTL for the pipe to work in HDMI mode */ /* Enable TRANS_DDI_FUNC_CTL for the pipe to work in HDMI mode */
temp = TRANS_DDI_FUNC_ENABLE; temp = TRANS_DDI_FUNC_ENABLE;
temp |= TRANS_DDI_SELECT_PORT(port);
switch (intel_crtc->bpp) { switch (intel_crtc->bpp) {
case 18: case 18:
...@@ -979,18 +979,14 @@ void intel_ddi_enable_pipe_func(struct drm_crtc *crtc) ...@@ -979,18 +979,14 @@ void intel_ddi_enable_pipe_func(struct drm_crtc *crtc)
else else
temp |= TRANS_DDI_MODE_SELECT_DVI; temp |= TRANS_DDI_MODE_SELECT_DVI;
temp |= TRANS_DDI_SELECT_PORT(intel_hdmi->ddi_port);
} else if (type == INTEL_OUTPUT_ANALOG) { } else if (type == INTEL_OUTPUT_ANALOG) {
temp |= TRANS_DDI_MODE_SELECT_FDI; temp |= TRANS_DDI_MODE_SELECT_FDI;
temp |= TRANS_DDI_SELECT_PORT(PORT_E);
} else if (type == INTEL_OUTPUT_DISPLAYPORT || } else if (type == INTEL_OUTPUT_DISPLAYPORT ||
type == INTEL_OUTPUT_EDP) { type == INTEL_OUTPUT_EDP) {
struct intel_dp *intel_dp = enc_to_intel_dp(encoder); struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
temp |= TRANS_DDI_MODE_SELECT_DP_SST; temp |= TRANS_DDI_MODE_SELECT_DP_SST;
temp |= TRANS_DDI_SELECT_PORT(intel_dp->port);
switch (intel_dp->lane_count) { switch (intel_dp->lane_count) {
case 1: case 1:
...@@ -1297,9 +1293,10 @@ void intel_ddi_pll_init(struct drm_device *dev) ...@@ -1297,9 +1293,10 @@ void intel_ddi_pll_init(struct drm_device *dev)
void intel_ddi_prepare_link_retrain(struct drm_encoder *encoder) void intel_ddi_prepare_link_retrain(struct drm_encoder *encoder)
{ {
struct intel_dp *intel_dp = enc_to_intel_dp(encoder); struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
struct intel_dp *intel_dp = &intel_dig_port->dp;
struct drm_i915_private *dev_priv = encoder->dev->dev_private; struct drm_i915_private *dev_priv = encoder->dev->dev_private;
enum port port = intel_dp->port; enum port port = intel_dig_port->port;
bool wait; bool wait;
uint32_t val; uint32_t val;
......
...@@ -336,7 +336,8 @@ intel_dp_aux_ch(struct intel_dp *intel_dp, ...@@ -336,7 +336,8 @@ intel_dp_aux_ch(struct intel_dp *intel_dp,
uint8_t *recv, int recv_size) uint8_t *recv, int recv_size)
{ {
uint32_t output_reg = intel_dp->output_reg; uint32_t output_reg = intel_dp->output_reg;
struct drm_device *dev = intel_dp_to_dev(intel_dp); struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
struct drm_device *dev = intel_dig_port->base.base.dev;
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
uint32_t ch_ctl = output_reg + 0x10; uint32_t ch_ctl = output_reg + 0x10;
uint32_t ch_data = ch_ctl + 4; uint32_t ch_data = ch_ctl + 4;
...@@ -347,7 +348,7 @@ intel_dp_aux_ch(struct intel_dp *intel_dp, ...@@ -347,7 +348,7 @@ intel_dp_aux_ch(struct intel_dp *intel_dp,
int try, precharge; int try, precharge;
if (IS_HASWELL(dev)) { if (IS_HASWELL(dev)) {
switch (intel_dp->port) { switch (intel_dig_port->port) {
case PORT_A: case PORT_A:
ch_ctl = DPA_AUX_CH_CTL; ch_ctl = DPA_AUX_CH_CTL;
ch_data = DPA_AUX_CH_DATA1; ch_data = DPA_AUX_CH_DATA1;
...@@ -1677,13 +1678,15 @@ intel_dp_set_link_train(struct intel_dp *intel_dp, ...@@ -1677,13 +1678,15 @@ intel_dp_set_link_train(struct intel_dp *intel_dp,
uint32_t dp_reg_value, uint32_t dp_reg_value,
uint8_t dp_train_pat) uint8_t dp_train_pat)
{ {
struct drm_device *dev = intel_dp_to_dev(intel_dp); struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
struct drm_device *dev = intel_dig_port->base.base.dev;
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
enum port port = intel_dig_port->port;
int ret; int ret;
uint32_t temp; uint32_t temp;
if (IS_HASWELL(dev)) { if (IS_HASWELL(dev)) {
temp = I915_READ(DP_TP_CTL(intel_dp->port)); temp = I915_READ(DP_TP_CTL(port));
if (dp_train_pat & DP_LINK_SCRAMBLING_DISABLE) if (dp_train_pat & DP_LINK_SCRAMBLING_DISABLE)
temp |= DP_TP_CTL_SCRAMBLE_DISABLE; temp |= DP_TP_CTL_SCRAMBLE_DISABLE;
...@@ -1694,9 +1697,9 @@ intel_dp_set_link_train(struct intel_dp *intel_dp, ...@@ -1694,9 +1697,9 @@ intel_dp_set_link_train(struct intel_dp *intel_dp,
switch (dp_train_pat & DP_TRAINING_PATTERN_MASK) { switch (dp_train_pat & DP_TRAINING_PATTERN_MASK) {
case DP_TRAINING_PATTERN_DISABLE: case DP_TRAINING_PATTERN_DISABLE:
temp |= DP_TP_CTL_LINK_TRAIN_IDLE; temp |= DP_TP_CTL_LINK_TRAIN_IDLE;
I915_WRITE(DP_TP_CTL(intel_dp->port), temp); I915_WRITE(DP_TP_CTL(port), temp);
if (wait_for((I915_READ(DP_TP_STATUS(intel_dp->port)) & if (wait_for((I915_READ(DP_TP_STATUS(port)) &
DP_TP_STATUS_IDLE_DONE), 1)) DP_TP_STATUS_IDLE_DONE), 1))
DRM_ERROR("Timed out waiting for DP idle patterns\n"); DRM_ERROR("Timed out waiting for DP idle patterns\n");
...@@ -1714,7 +1717,7 @@ intel_dp_set_link_train(struct intel_dp *intel_dp, ...@@ -1714,7 +1717,7 @@ intel_dp_set_link_train(struct intel_dp *intel_dp,
temp |= DP_TP_CTL_LINK_TRAIN_PAT3; temp |= DP_TP_CTL_LINK_TRAIN_PAT3;
break; break;
} }
I915_WRITE(DP_TP_CTL(intel_dp->port), temp); I915_WRITE(DP_TP_CTL(port), temp);
} else if (HAS_PCH_CPT(dev) && } else if (HAS_PCH_CPT(dev) &&
(IS_GEN7(dev) || !is_cpu_edp(intel_dp))) { (IS_GEN7(dev) || !is_cpu_edp(intel_dp))) {
...@@ -2697,7 +2700,7 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port, ...@@ -2697,7 +2700,7 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
struct drm_device *dev = intel_encoder->base.dev; struct drm_device *dev = intel_encoder->base.dev;
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_display_mode *fixed_mode = NULL; struct drm_display_mode *fixed_mode = NULL;
enum port port = intel_dp->port; enum port port = intel_dig_port->port;
const char *name = NULL; const char *name = NULL;
int type; int type;
...@@ -2883,7 +2886,7 @@ intel_dp_init(struct drm_device *dev, int output_reg, enum port port) ...@@ -2883,7 +2886,7 @@ intel_dp_init(struct drm_device *dev, int output_reg, enum port port)
intel_encoder->get_hw_state = intel_dp_get_hw_state; intel_encoder->get_hw_state = intel_dp_get_hw_state;
} }
intel_dig_port->dp.port = port; intel_dig_port->port = port;
intel_dig_port->dp.output_reg = output_reg; intel_dig_port->dp.output_reg = output_reg;
intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
......
...@@ -333,7 +333,6 @@ struct dip_infoframe { ...@@ -333,7 +333,6 @@ struct dip_infoframe {
struct intel_hdmi { struct intel_hdmi {
u32 sdvox_reg; u32 sdvox_reg;
int ddc_bus; int ddc_bus;
int ddi_port;
uint32_t color_range; uint32_t color_range;
bool has_hdmi_sink; bool has_hdmi_sink;
bool has_audio; bool has_audio;
...@@ -353,7 +352,6 @@ struct intel_dp { ...@@ -353,7 +352,6 @@ struct intel_dp {
uint8_t link_configuration[DP_LINK_CONFIGURATION_SIZE]; uint8_t link_configuration[DP_LINK_CONFIGURATION_SIZE];
bool has_audio; bool has_audio;
enum hdmi_force_audio force_audio; enum hdmi_force_audio force_audio;
enum port port;
uint32_t color_range; uint32_t color_range;
uint8_t link_bw; uint8_t link_bw;
uint8_t lane_count; uint8_t lane_count;
...@@ -375,6 +373,7 @@ struct intel_dp { ...@@ -375,6 +373,7 @@ struct intel_dp {
struct intel_digital_port { struct intel_digital_port {
struct intel_encoder base; struct intel_encoder base;
enum port port;
struct intel_dp dp; struct intel_dp dp;
struct intel_hdmi hdmi; struct intel_hdmi hdmi;
}; };
......
...@@ -971,7 +971,7 @@ static void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port, ...@@ -971,7 +971,7 @@ static void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
struct intel_encoder *intel_encoder = &intel_dig_port->base; struct intel_encoder *intel_encoder = &intel_dig_port->base;
struct drm_device *dev = intel_encoder->base.dev; struct drm_device *dev = intel_encoder->base.dev;
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
enum port port = intel_hdmi->ddi_port; enum port port = intel_dig_port->port;
drm_connector_init(dev, connector, &intel_hdmi_connector_funcs, drm_connector_init(dev, connector, &intel_hdmi_connector_funcs,
DRM_MODE_CONNECTOR_HDMIA); DRM_MODE_CONNECTOR_HDMIA);
...@@ -1076,7 +1076,7 @@ void intel_hdmi_init(struct drm_device *dev, int sdvox_reg, enum port port) ...@@ -1076,7 +1076,7 @@ void intel_hdmi_init(struct drm_device *dev, int sdvox_reg, enum port port)
intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
intel_encoder->cloneable = false; intel_encoder->cloneable = false;
intel_dig_port->hdmi.ddi_port = port; intel_dig_port->port = port;
intel_dig_port->hdmi.sdvox_reg = sdvox_reg; intel_dig_port->hdmi.sdvox_reg = sdvox_reg;
intel_dig_port->dp.output_reg = 0; intel_dig_port->dp.output_reg = 0;
......
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