mirror of https://gitee.com/openkylin/linux.git
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: Paulo Zanoni <paulo.r.zanoni@intel.com> Reviewed-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
d63885da96
commit
174edf1f86
|
@ -63,13 +63,11 @@ static enum port intel_ddi_get_encoder_port(struct intel_encoder *intel_encoder)
|
|||
struct drm_encoder *encoder = &intel_encoder->base;
|
||||
int type = intel_encoder->type;
|
||||
|
||||
if (type == INTEL_OUTPUT_DISPLAYPORT || type == INTEL_OUTPUT_EDP) {
|
||||
struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
|
||||
return intel_dp->port;
|
||||
|
||||
} else if (type == INTEL_OUTPUT_HDMI) {
|
||||
struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
|
||||
return intel_hdmi->ddi_port;
|
||||
if (type == INTEL_OUTPUT_DISPLAYPORT || type == INTEL_OUTPUT_EDP ||
|
||||
type == INTEL_OUTPUT_HDMI) {
|
||||
struct intel_digital_port *intel_dig_port =
|
||||
enc_to_dig_port(encoder);
|
||||
return intel_dig_port->port;
|
||||
|
||||
} else if (type == INTEL_OUTPUT_ANALOG) {
|
||||
return PORT_E;
|
||||
|
@ -925,11 +923,13 @@ void intel_ddi_enable_pipe_func(struct drm_crtc *crtc)
|
|||
struct drm_i915_private *dev_priv = crtc->dev->dev_private;
|
||||
enum pipe pipe = intel_crtc->pipe;
|
||||
enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder;
|
||||
enum port port = intel_ddi_get_encoder_port(intel_encoder);
|
||||
int type = intel_encoder->type;
|
||||
uint32_t temp;
|
||||
|
||||
/* Enable TRANS_DDI_FUNC_CTL for the pipe to work in HDMI mode */
|
||||
temp = TRANS_DDI_FUNC_ENABLE;
|
||||
temp |= TRANS_DDI_SELECT_PORT(port);
|
||||
|
||||
switch (intel_crtc->bpp) {
|
||||
case 18:
|
||||
|
@ -979,18 +979,14 @@ void intel_ddi_enable_pipe_func(struct drm_crtc *crtc)
|
|||
else
|
||||
temp |= TRANS_DDI_MODE_SELECT_DVI;
|
||||
|
||||
temp |= TRANS_DDI_SELECT_PORT(intel_hdmi->ddi_port);
|
||||
|
||||
} else if (type == INTEL_OUTPUT_ANALOG) {
|
||||
temp |= TRANS_DDI_MODE_SELECT_FDI;
|
||||
temp |= TRANS_DDI_SELECT_PORT(PORT_E);
|
||||
|
||||
} else if (type == INTEL_OUTPUT_DISPLAYPORT ||
|
||||
type == INTEL_OUTPUT_EDP) {
|
||||
struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
|
||||
|
||||
temp |= TRANS_DDI_MODE_SELECT_DP_SST;
|
||||
temp |= TRANS_DDI_SELECT_PORT(intel_dp->port);
|
||||
|
||||
switch (intel_dp->lane_count) {
|
||||
case 1:
|
||||
|
@ -1297,9 +1293,10 @@ void intel_ddi_pll_init(struct drm_device *dev)
|
|||
|
||||
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;
|
||||
enum port port = intel_dp->port;
|
||||
enum port port = intel_dig_port->port;
|
||||
bool wait;
|
||||
uint32_t val;
|
||||
|
||||
|
|
|
@ -336,7 +336,8 @@ intel_dp_aux_ch(struct intel_dp *intel_dp,
|
|||
uint8_t *recv, int recv_size)
|
||||
{
|
||||
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;
|
||||
uint32_t ch_ctl = output_reg + 0x10;
|
||||
uint32_t ch_data = ch_ctl + 4;
|
||||
|
@ -347,7 +348,7 @@ intel_dp_aux_ch(struct intel_dp *intel_dp,
|
|||
int try, precharge;
|
||||
|
||||
if (IS_HASWELL(dev)) {
|
||||
switch (intel_dp->port) {
|
||||
switch (intel_dig_port->port) {
|
||||
case PORT_A:
|
||||
ch_ctl = DPA_AUX_CH_CTL;
|
||||
ch_data = DPA_AUX_CH_DATA1;
|
||||
|
@ -1677,13 +1678,15 @@ intel_dp_set_link_train(struct intel_dp *intel_dp,
|
|||
uint32_t dp_reg_value,
|
||||
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;
|
||||
enum port port = intel_dig_port->port;
|
||||
int ret;
|
||||
uint32_t temp;
|
||||
|
||||
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)
|
||||
temp |= DP_TP_CTL_SCRAMBLE_DISABLE;
|
||||
|
@ -1694,9 +1697,9 @@ intel_dp_set_link_train(struct intel_dp *intel_dp,
|
|||
switch (dp_train_pat & DP_TRAINING_PATTERN_MASK) {
|
||||
case DP_TRAINING_PATTERN_DISABLE:
|
||||
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))
|
||||
DRM_ERROR("Timed out waiting for DP idle patterns\n");
|
||||
|
||||
|
@ -1714,7 +1717,7 @@ intel_dp_set_link_train(struct intel_dp *intel_dp,
|
|||
temp |= DP_TP_CTL_LINK_TRAIN_PAT3;
|
||||
break;
|
||||
}
|
||||
I915_WRITE(DP_TP_CTL(intel_dp->port), temp);
|
||||
I915_WRITE(DP_TP_CTL(port), temp);
|
||||
|
||||
} else if (HAS_PCH_CPT(dev) &&
|
||||
(IS_GEN7(dev) || !is_cpu_edp(intel_dp))) {
|
||||
|
@ -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_i915_private *dev_priv = dev->dev_private;
|
||||
struct drm_display_mode *fixed_mode = NULL;
|
||||
enum port port = intel_dp->port;
|
||||
enum port port = intel_dig_port->port;
|
||||
const char *name = NULL;
|
||||
int type;
|
||||
|
||||
|
@ -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_dig_port->dp.port = port;
|
||||
intel_dig_port->port = port;
|
||||
intel_dig_port->dp.output_reg = output_reg;
|
||||
|
||||
intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
|
||||
|
|
|
@ -333,7 +333,6 @@ struct dip_infoframe {
|
|||
struct intel_hdmi {
|
||||
u32 sdvox_reg;
|
||||
int ddc_bus;
|
||||
int ddi_port;
|
||||
uint32_t color_range;
|
||||
bool has_hdmi_sink;
|
||||
bool has_audio;
|
||||
|
@ -353,7 +352,6 @@ struct intel_dp {
|
|||
uint8_t link_configuration[DP_LINK_CONFIGURATION_SIZE];
|
||||
bool has_audio;
|
||||
enum hdmi_force_audio force_audio;
|
||||
enum port port;
|
||||
uint32_t color_range;
|
||||
uint8_t link_bw;
|
||||
uint8_t lane_count;
|
||||
|
@ -375,6 +373,7 @@ struct intel_dp {
|
|||
|
||||
struct intel_digital_port {
|
||||
struct intel_encoder base;
|
||||
enum port port;
|
||||
struct intel_dp dp;
|
||||
struct intel_hdmi hdmi;
|
||||
};
|
||||
|
|
|
@ -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 drm_device *dev = intel_encoder->base.dev;
|
||||
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_MODE_CONNECTOR_HDMIA);
|
||||
|
@ -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->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->dp.output_reg = 0;
|
||||
|
||||
|
|
Loading…
Reference in New Issue