Commit affa9354 authored by Paulo Zanoni's avatar Paulo Zanoni Committed by Daniel Vetter

drm/i915: add HAS_DDI check

And use it whenever we call code that uses the DDIs. We already have
intel_ddi.c and prefix every function with intel_ddi_something instead of
haswell_something, so I think replacing the checks with HAS_DDI makes more
sense. Just a cosmetical change, yes I know, but I have this OCD...
Signed-off-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: default avatarImre Deak <imre.deak@intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 20749730
...@@ -1208,6 +1208,8 @@ struct drm_i915_file_private { ...@@ -1208,6 +1208,8 @@ struct drm_i915_file_private {
#define HAS_PIPE_CONTROL(dev) (INTEL_INFO(dev)->gen >= 5) #define HAS_PIPE_CONTROL(dev) (INTEL_INFO(dev)->gen >= 5)
#define HAS_DDI(dev) (IS_HASWELL(dev))
#define INTEL_PCH_DEVICE_ID_MASK 0xff00 #define INTEL_PCH_DEVICE_ID_MASK 0xff00
#define INTEL_PCH_IBX_DEVICE_ID_TYPE 0x3b00 #define INTEL_PCH_IBX_DEVICE_ID_TYPE 0x3b00
#define INTEL_PCH_CPT_DEVICE_ID_TYPE 0x1c00 #define INTEL_PCH_CPT_DEVICE_ID_TYPE 0x1c00
......
...@@ -771,7 +771,7 @@ void intel_crt_init(struct drm_device *dev) ...@@ -771,7 +771,7 @@ void intel_crt_init(struct drm_device *dev)
crt->base.disable = intel_disable_crt; crt->base.disable = intel_disable_crt;
crt->base.enable = intel_enable_crt; crt->base.enable = intel_enable_crt;
if (IS_HASWELL(dev)) if (HAS_DDI(dev))
crt->base.get_hw_state = intel_ddi_get_hw_state; crt->base.get_hw_state = intel_ddi_get_hw_state;
else else
crt->base.get_hw_state = intel_crt_get_hw_state; crt->base.get_hw_state = intel_crt_get_hw_state;
......
...@@ -115,7 +115,7 @@ void intel_prepare_ddi(struct drm_device *dev) ...@@ -115,7 +115,7 @@ void intel_prepare_ddi(struct drm_device *dev)
{ {
int port; int port;
if (IS_HASWELL(dev)) { if (HAS_DDI(dev)) {
for (port = PORT_A; port < PORT_E; port++) for (port = PORT_A; port < PORT_E; port++)
intel_prepare_ddi_buffers(dev, port, false); intel_prepare_ddi_buffers(dev, port, false);
......
...@@ -1072,8 +1072,8 @@ static void assert_fdi_tx(struct drm_i915_private *dev_priv, ...@@ -1072,8 +1072,8 @@ static void assert_fdi_tx(struct drm_i915_private *dev_priv,
enum transcoder cpu_transcoder = intel_pipe_to_cpu_transcoder(dev_priv, enum transcoder cpu_transcoder = intel_pipe_to_cpu_transcoder(dev_priv,
pipe); pipe);
if (IS_HASWELL(dev_priv->dev)) { if (HAS_DDI(dev_priv->dev)) {
/* On Haswell, DDI is used instead of FDI_TX_CTL */ /* DDI does not have a specific FDI_TX register */
reg = TRANS_DDI_FUNC_CTL(cpu_transcoder); reg = TRANS_DDI_FUNC_CTL(cpu_transcoder);
val = I915_READ(reg); val = I915_READ(reg);
cur_state = !!(val & TRANS_DDI_FUNC_ENABLE); cur_state = !!(val & TRANS_DDI_FUNC_ENABLE);
...@@ -1117,7 +1117,7 @@ static void assert_fdi_tx_pll_enabled(struct drm_i915_private *dev_priv, ...@@ -1117,7 +1117,7 @@ static void assert_fdi_tx_pll_enabled(struct drm_i915_private *dev_priv,
return; return;
/* On Haswell, DDI ports are responsible for the FDI PLL setup */ /* On Haswell, DDI ports are responsible for the FDI PLL setup */
if (IS_HASWELL(dev_priv->dev)) if (HAS_DDI(dev_priv->dev))
return; return;
reg = FDI_TX_CTL(pipe); reg = FDI_TX_CTL(pipe);
...@@ -7976,7 +7976,7 @@ static const struct drm_crtc_funcs intel_crtc_funcs = { ...@@ -7976,7 +7976,7 @@ static const struct drm_crtc_funcs intel_crtc_funcs = {
static void intel_cpu_pll_init(struct drm_device *dev) static void intel_cpu_pll_init(struct drm_device *dev)
{ {
if (IS_HASWELL(dev)) if (HAS_DDI(dev))
intel_ddi_pll_init(dev); intel_ddi_pll_init(dev);
} }
...@@ -8112,11 +8112,10 @@ static void intel_setup_outputs(struct drm_device *dev) ...@@ -8112,11 +8112,10 @@ static void intel_setup_outputs(struct drm_device *dev)
I915_WRITE(PFIT_CONTROL, 0); I915_WRITE(PFIT_CONTROL, 0);
} }
if (!(IS_HASWELL(dev) && if (!(HAS_DDI(dev) && (I915_READ(DDI_BUF_CTL(PORT_A)) & DDI_A_4_LANES)))
(I915_READ(DDI_BUF_CTL(PORT_A)) & DDI_A_4_LANES)))
intel_crt_init(dev); intel_crt_init(dev);
if (IS_HASWELL(dev)) { if (HAS_DDI(dev)) {
int found; int found;
/* Haswell uses DDI functions to detect digital outputs */ /* Haswell uses DDI functions to detect digital outputs */
...@@ -8360,7 +8359,7 @@ static void intel_init_display(struct drm_device *dev) ...@@ -8360,7 +8359,7 @@ static void intel_init_display(struct drm_device *dev)
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
/* We always want a DPMS function */ /* We always want a DPMS function */
if (IS_HASWELL(dev)) { if (HAS_DDI(dev)) {
dev_priv->display.crtc_mode_set = haswell_crtc_mode_set; dev_priv->display.crtc_mode_set = haswell_crtc_mode_set;
dev_priv->display.crtc_enable = haswell_crtc_enable; dev_priv->display.crtc_enable = haswell_crtc_enable;
dev_priv->display.crtc_disable = haswell_crtc_disable; dev_priv->display.crtc_disable = haswell_crtc_disable;
...@@ -8849,7 +8848,7 @@ void intel_modeset_setup_hw_state(struct drm_device *dev, ...@@ -8849,7 +8848,7 @@ void intel_modeset_setup_hw_state(struct drm_device *dev,
struct intel_encoder *encoder; struct intel_encoder *encoder;
struct intel_connector *connector; struct intel_connector *connector;
if (IS_HASWELL(dev)) { if (HAS_DDI(dev)) {
tmp = I915_READ(TRANS_DDI_FUNC_CTL(TRANSCODER_EDP)); tmp = I915_READ(TRANS_DDI_FUNC_CTL(TRANSCODER_EDP));
if (tmp & TRANS_DDI_FUNC_ENABLE) { if (tmp & TRANS_DDI_FUNC_ENABLE) {
...@@ -8890,7 +8889,7 @@ void intel_modeset_setup_hw_state(struct drm_device *dev, ...@@ -8890,7 +8889,7 @@ void intel_modeset_setup_hw_state(struct drm_device *dev,
crtc->active ? "enabled" : "disabled"); crtc->active ? "enabled" : "disabled");
} }
if (IS_HASWELL(dev)) if (HAS_DDI(dev))
intel_ddi_setup_hw_pll_state(dev); intel_ddi_setup_hw_pll_state(dev);
list_for_each_entry(encoder, &dev->mode_config.encoder_list, list_for_each_entry(encoder, &dev->mode_config.encoder_list,
......
...@@ -379,7 +379,7 @@ intel_dp_aux_ch(struct intel_dp *intel_dp, ...@@ -379,7 +379,7 @@ intel_dp_aux_ch(struct intel_dp *intel_dp,
* clock divider. * clock divider.
*/ */
if (is_cpu_edp(intel_dp)) { if (is_cpu_edp(intel_dp)) {
if (IS_HASWELL(dev)) if (HAS_DDI(dev))
aux_clock_divider = intel_ddi_get_cdclk_freq(dev_priv) >> 1; aux_clock_divider = intel_ddi_get_cdclk_freq(dev_priv) >> 1;
else if (IS_VALLEYVIEW(dev)) else if (IS_VALLEYVIEW(dev))
aux_clock_divider = 100; aux_clock_divider = 100;
...@@ -1791,7 +1791,7 @@ intel_dp_start_link_train(struct intel_dp *intel_dp) ...@@ -1791,7 +1791,7 @@ intel_dp_start_link_train(struct intel_dp *intel_dp)
int voltage_tries, loop_tries; int voltage_tries, loop_tries;
uint32_t DP = intel_dp->DP; uint32_t DP = intel_dp->DP;
if (IS_HASWELL(dev)) if (HAS_DDI(dev))
intel_ddi_prepare_link_retrain(encoder); intel_ddi_prepare_link_retrain(encoder);
/* Write the link configuration data */ /* Write the link configuration data */
...@@ -1981,7 +1981,7 @@ intel_dp_link_down(struct intel_dp *intel_dp) ...@@ -1981,7 +1981,7 @@ intel_dp_link_down(struct intel_dp *intel_dp)
* intel_ddi_prepare_link_retrain will take care of redoing the link * intel_ddi_prepare_link_retrain will take care of redoing the link
* train. * train.
*/ */
if (IS_HASWELL(dev)) if (HAS_DDI(dev))
return; return;
if (WARN_ON((I915_READ(intel_dp->output_reg) & DP_PORT_EN) == 0)) if (WARN_ON((I915_READ(intel_dp->output_reg) & DP_PORT_EN) == 0))
...@@ -2742,7 +2742,7 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port, ...@@ -2742,7 +2742,7 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
intel_connector_attach_encoder(intel_connector, intel_encoder); intel_connector_attach_encoder(intel_connector, intel_encoder);
drm_sysfs_connector_add(connector); drm_sysfs_connector_add(connector);
if (IS_HASWELL(dev)) if (HAS_DDI(dev))
intel_connector->get_hw_state = intel_ddi_connector_get_hw_state; intel_connector->get_hw_state = intel_ddi_connector_get_hw_state;
else else
intel_connector->get_hw_state = intel_connector_get_hw_state; intel_connector->get_hw_state = intel_connector_get_hw_state;
......
...@@ -48,7 +48,7 @@ assert_hdmi_port_disabled(struct intel_hdmi *intel_hdmi) ...@@ -48,7 +48,7 @@ assert_hdmi_port_disabled(struct intel_hdmi *intel_hdmi)
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
uint32_t enabled_bits; uint32_t enabled_bits;
enabled_bits = IS_HASWELL(dev) ? DDI_BUF_CTL_ENABLE : SDVO_ENABLE; enabled_bits = HAS_DDI(dev) ? DDI_BUF_CTL_ENABLE : SDVO_ENABLE;
WARN(I915_READ(intel_hdmi->sdvox_reg) & enabled_bits, WARN(I915_READ(intel_hdmi->sdvox_reg) & enabled_bits,
"HDMI port enabled, expecting disabled\n"); "HDMI port enabled, expecting disabled\n");
...@@ -1013,7 +1013,7 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port, ...@@ -1013,7 +1013,7 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
intel_hdmi->set_infoframes = cpt_set_infoframes; intel_hdmi->set_infoframes = cpt_set_infoframes;
} }
if (IS_HASWELL(dev)) if (HAS_DDI(dev))
intel_connector->get_hw_state = intel_ddi_connector_get_hw_state; intel_connector->get_hw_state = intel_ddi_connector_get_hw_state;
else else
intel_connector->get_hw_state = intel_connector_get_hw_state; intel_connector->get_hw_state = intel_connector_get_hw_state;
......
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