drm/i915: intel_prepare_ddi_buffers should be static
Subsystems (2)
PATCH 1/4 drm/i915: intel_prepare_ddi_buffers should be static
From: Paulo Zanoni <[email protected]>
It's not even declared on header files.
--- drivers/gpu/drm/i915/intel_ddi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_ddi.c +2 -1
@@ -84,7 +84,8 @@ static enum port intel_ddi_get_encoder_port(struct intel_encoder *intel_encoder)* in either FDI or DP modes only, as HDMI connections will work with both * of those */ -void intel_prepare_ddi_buffers (struct drm_device *dev,enum port port,bool use_fdi_mode) +static void intel_prepare_ddi_buffers (struct drm_device *dev,enum port port, +bool use_fdi_mode) {struct drm_i915_private *dev_priv = dev->dev_private;u32 reg;
Signature · 1 line
1.7.11.7
PATCH 2/4 drm/i915: remove Haswell code from ironlake_fdi_pll_enable
From: Paulo Zanoni <[email protected]>
This function is not called on Haswell anymore.
--- drivers/gpu/drm/i915/intel_display.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/intel_display.c +7 -11
@@ -2840,18 +2840,14 @@ static void ironlake_fdi_pll_enable(struct intel_crtc *intel_crtc)POSTING_READ (reg);udelay (200 ); -/* On Haswell, the PLL configuration for ports and pipes is handled -* separately, as part of DDI setup */ -if (!IS_HASWELL (dev)) { -/* Enable CPU FDI TX PLL, always on for Ironlake */ - reg =FDI_TX_CTL (pipe); - temp =I915_READ (reg); -if ((temp &FDI_TX_PLL_ENABLE ) ==0 ) { -I915_WRITE (reg, temp |FDI_TX_PLL_ENABLE ); +/* Enable CPU FDI TX PLL, always on for Ironlake */ + reg =FDI_TX_CTL (pipe); + temp =I915_READ (reg); +if ((temp &FDI_TX_PLL_ENABLE ) ==0 ) { +I915_WRITE (reg, temp |FDI_TX_PLL_ENABLE ); -POSTING_READ (reg); -udelay (100 ); - } +POSTING_READ (reg); +udelay (100 ); } }
Signature · 1 line
1.7.11.7
PATCH 3/4 drm/i915: add HAS_DDI check
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
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...
--- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/intel_crt.c | 2 +- drivers/gpu/drm/i915/intel_ddi.c | 2 +- drivers/gpu/drm/i915/intel_display.c | 19 +++++++++---------- drivers/gpu/drm/i915/intel_dp.c | 8 ++++---- drivers/gpu/drm/i915/intel_hdmi.c | 4 ++-- 6 files changed, 19 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +2 -0
@@ -1208,6 +1208,8 @@ struct drm_i915_file_private {#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_IBX_DEVICE_ID_TYPE 0x3b00#define INTEL_PCH_CPT_DEVICE_ID_TYPE 0x1c00
drivers/gpu/drm/i915/intel_crt.c +1 -1
@@ -771,7 +771,7 @@ void intel_crt_init(struct drm_device *dev) crt->base.disable = intel_disable_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;else crt->base.get_hw_state = intel_crt_get_hw_state;
drivers/gpu/drm/i915/intel_ddi.c +1 -1
@@ -115,7 +115,7 @@ void intel_prepare_ddi(struct drm_device *dev) {int port; -if (IS_HASWELL (dev)) { +if (HAS_DDI (dev)) {for (port =PORT_A ; port <PORT_E ; port++)intel_prepare_ddi_buffers (dev, port, false);
drivers/gpu/drm/i915/intel_display.c +9 -10
@@ -1125,8 +1125,8 @@ static void assert_fdi_tx(struct drm_i915_private *dev_priv,enum transcoder cpu_transcoder =intel_pipe_to_cpu_transcoder (dev_priv, pipe); -if (IS_HASWELL (dev_priv->dev)) { -/* On Haswell, DDI is used instead of FDI_TX_CTL */ +if (HAS_DDI (dev_priv->dev)) { +/* DDI does not have a specific FDI_TX register */ reg =TRANS_DDI_FUNC_CTL (cpu_transcoder); val =I915_READ (reg); cur_state = !!(val &TRANS_DDI_FUNC_ENABLE );
@@ -1170,7 +1170,7 @@ static void assert_fdi_tx_pll_enabled(struct drm_i915_private *dev_priv,return ;/* On Haswell, DDI ports are responsible for the FDI PLL setup */ -if (IS_HASWELL (dev_priv->dev)) +if (HAS_DDI (dev_priv->dev))return ; reg =FDI_TX_CTL (pipe);
@@ -8121,7 +8121,7 @@ static const struct drm_crtc_funcs intel_crtc_funcs = {static void intel_cpu_pll_init (struct drm_device *dev) { -if (IS_HASWELL (dev)) +if (HAS_DDI (dev))intel_ddi_pll_init (dev); }
@@ -8257,11 +8257,10 @@ static void intel_setup_outputs(struct drm_device *dev)I915_WRITE (PFIT_CONTROL ,0 ); } -if (!(IS_HASWELL (dev) && - (I915_READ (DDI_BUF_CTL (PORT_A )) &DDI_A_4_LANES ))) +if (!(HAS_DDI (dev) && (I915_READ (DDI_BUF_CTL (PORT_A )) &DDI_A_4_LANES )))intel_crt_init (dev); -if (IS_HASWELL (dev)) { +if (HAS_DDI (dev)) {int found;/* Haswell uses DDI functions to detect digital outputs */
@@ -8505,7 +8504,7 @@ static void intel_init_display(struct drm_device *dev)struct drm_i915_private *dev_priv = dev->dev_private;/* 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_enable = haswell_crtc_enable; dev_priv->display.crtc_disable = haswell_crtc_disable;
@@ -8993,7 +8992,7 @@ void intel_modeset_setup_hw_state(struct drm_device *dev)struct intel_encoder *encoder;struct intel_connector *connector; -if (IS_HASWELL (dev)) { +if (HAS_DDI (dev)) { tmp =I915_READ (TRANS_DDI_FUNC_CTL (TRANSCODER_EDP ));if (tmp &TRANS_DDI_FUNC_ENABLE ) {
@@ -9034,7 +9033,7 @@ void intel_modeset_setup_hw_state(struct drm_device *dev) crtc->active ? "enabled" : "disabled"); } -if (IS_HASWELL (dev)) +if (HAS_DDI (dev))intel_ddi_setup_hw_pll_state (dev); list_for_each_entry(encoder, &dev->mode_config.encoder_list,
drivers/gpu/drm/i915/intel_dp.c +4 -4
@@ -379,7 +379,7 @@ intel_dp_aux_ch(struct intel_dp *intel_dp,* clock divider. */ 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 ;else if (IS_VALLEYVIEW (dev)) aux_clock_divider =100 ;
@@ -1791,7 +1791,7 @@ intel_dp_start_link_train(struct intel_dp *intel_dp)int voltage_tries, loop_tries;uint32_t DP = intel_dp->DP; -if (IS_HASWELL (dev)) +if (HAS_DDI (dev))intel_ddi_prepare_link_retrain (encoder);/* Write the link configuration data */
@@ -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 * train. */ -if (IS_HASWELL (dev)) +if (HAS_DDI (dev))return ;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,intel_connector_attach_encoder (intel_connector, intel_encoder);drm_sysfs_connector_add (connector); -if (IS_HASWELL (dev)) +if (HAS_DDI (dev)) intel_connector->get_hw_state = intel_ddi_connector_get_hw_state;else intel_connector->get_hw_state = intel_connector_get_hw_state;
drivers/gpu/drm/i915/intel_hdmi.c +2 -2
@@ -48,7 +48,7 @@ assert_hdmi_port_disabled(struct intel_hdmi *intel_hdmi)struct drm_i915_private *dev_priv = dev->dev_private;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,"HDMI port enabled, expecting disabled\n" );
@@ -1011,7 +1011,7 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port, 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;else intel_connector->get_hw_state = intel_connector_get_hw_state;
Signature · 1 line
1.7.11.7
PATCH 4/4 drm/i915: only call intel_prepare_ddi if HAS_DDI
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
In other words, move the check from inside the function to outside it.
--- drivers/gpu/drm/i915/intel_ddi.c | 16 +++++++--------- drivers/gpu/drm/i915/intel_display.c | 3 ++- 2 files changed, 9 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +7 -9
@@ -115,16 +115,14 @@ void intel_prepare_ddi(struct drm_device *dev) {int port; -if (HAS_DDI (dev)) { -for (port =PORT_A ; port <PORT_E ; port++) -intel_prepare_ddi_buffers (dev, port, false); +for (port =PORT_A ; port <PORT_E ; port++) +intel_prepare_ddi_buffers (dev, port, false); -/* DDI E is the suggested one to work in FDI mode, so program is as such by -* default. It will have to be re-programmed in case a digital DP output -* will be detected on it -*/ -intel_prepare_ddi_buffers (dev,PORT_E , true); - } +/* DDI E is the suggested one to work in FDI mode, so program is as such +* by default. It will have to be re-programmed in case a digital DP +* output will be detected on it +*/ +intel_prepare_ddi_buffers (dev,PORT_E , true); }static const long hsw_ddi_buf_ctl_values[] = {
drivers/gpu/drm/i915/intel_display.c +2 -1
@@ -8742,7 +8742,8 @@ void intel_modeset_init_hw(struct drm_device *dev)*/ intel_init_power_wells (dev); -intel_prepare_ddi (dev); +if (HAS_DDI (dev)) +intel_prepare_ddi (dev);intel_init_clock_gating (dev);
Signature · 1 line
1.7.11.7
Re: [PATCH 4/4] drm/i915: only call intel_prepare_ddi if HAS_DDI
Quoted 3 lines · Paulo Zanoni
From: Paulo Zanoni <[email protected]>
In other words, move the check from inside the function to outside it.
Don't agree with this last step. You can make the function tidier with an early return, but it is paramount that the high level sequence inside intel_modeset_init_hw() be clear and comprehendable.
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
PATCH 1/1 drm/i915: invert the log inside intel_prepare_ddi
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
Do an early return in case we don't have DDI instead of having the whole function inside an "if" statement.
--- drivers/gpu/drm/i915/intel_ddi.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +10 -9
@@ -115,16 +115,17 @@ void intel_prepare_ddi(struct drm_device *dev) {int port; -if (HAS_DDI (dev)) { -for (port =PORT_A ; port <PORT_E ; port++) -intel_prepare_ddi_buffers (dev, port, false); +if (!HAS_DDI (dev)) +return ; -/* DDI E is the suggested one to work in FDI mode, so program is as such by -* default. It will have to be re-programmed in case a digital DP output -* will be detected on it -*/ -intel_prepare_ddi_buffers (dev,PORT_E , true); - } +for (port =PORT_A ; port <PORT_E ; port++) +intel_prepare_ddi_buffers (dev, port, false); + +/* DDI E is the suggested one to work in FDI mode, so program is as such +* by default. It will have to be re-programmed in case a digital DP +* output will be detected on it +*/ +intel_prepare_ddi_buffers (dev,PORT_E , true); }static const long hsw_ddi_buf_ctl_values[] = {
Signature · 1 line
1.7.11.7
Quoted 5 lines · Paulo Zanoni
From: Paulo Zanoni <[email protected]>
It's not even declared on header files.
Signed-off-by Paulo Zanoni <[email protected]>
On the series:
Quoted 9 lines · Imre Deak
Quoted 5 lines · Paulo Zanoni
From: Paulo Zanoni <[email protected]>
It's not even declared on header files.
Signed-off-by Paulo Zanoni <[email protected]>On the series:
Reviewed-by Imre Deak <[email protected]>
Series queued for -next, thanks for the patches&review. -Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch