drm/i915/dsi: merge pre_pll_enable hook to pre_enable
Subsystems (2)
PATCH 1/3 drm/i915/dsi: merge pre_pll_enable hook to pre_enable
For DSI, the pre_pll_enable and the pre_enable hooks are called back-to-back on all platforms that support DSI. The distinction is artificial for DSI, for which we enable the DSI PLL in the encoder hooks. Do everything in pre_enable, and remove DSI pre_pll_enable hook.
--- drivers/gpu/drm/i915/intel_dsi.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/intel_dsi.c +5 -11
@@ -462,6 +462,8 @@ static void intel_dsi_enable(struct intel_encoder *encoder)intel_panel_enable_backlight (intel_dsi->attached_connector); } +static void intel_dsi_prepare (struct intel_encoder *intel_encoder); +static void intel_dsi_pre_enable (struct intel_encoder *encoder) {struct drm_device *dev = encoder->base.dev;
@@ -474,6 +476,9 @@ static void intel_dsi_pre_enable(struct intel_encoder *encoder)DRM_DEBUG_KMS ("\n" ); +intel_dsi_prepare (encoder); +intel_enable_dsi_pll (encoder); +/* Panel Enable over CRC PMIC */ if (intel_dsi->gpio_panel)gpiod_set_value_cansleep (intel_dsi->gpio_panel,1 );
@@ -1026,15 +1031,6 @@ static void intel_dsi_prepare(struct intel_encoder *intel_encoder) } } -static void intel_dsi_pre_pll_enable (struct intel_encoder *encoder) -{ -DRM_DEBUG_KMS ("\n" ); - -intel_dsi_prepare (encoder); -intel_enable_dsi_pll (encoder); - -} -static enum drm_connector_status intel_dsi_detect (struct drm_connector *connector,bool force) {
@@ -1154,9 +1150,7 @@ void intel_dsi_init(struct drm_device *dev)drm_encoder_init (dev, encoder, &intel_dsi_funcs,DRM_MODE_ENCODER_DSI ); -/* XXX: very likely not all of these are needed */ intel_encoder->compute_config = intel_dsi_compute_config; - intel_encoder->pre_pll_enable = intel_dsi_pre_pll_enable; intel_encoder->pre_enable = intel_dsi_pre_enable; intel_encoder->enable = intel_dsi_enable_nop; intel_encoder->disable = intel_dsi_pre_disable;
Signature · 6 lines
2.1.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/3 drm/i915: remove pre_pll_enable hook from DDI/gen9+ crtc enable
The hook was added to cater for DSI, but with the hooks rearranged on the DSI encoder side, this is no longer needed. It was a bit silly anyway to have two hooks called back-to-back.
--- drivers/gpu/drm/i915/intel_display.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +0 -2
@@ -4981,8 +4981,6 @@ static void haswell_crtc_enable(struct drm_crtc *crtc)intel_set_cpu_fifo_underrun_reporting (dev_priv, pipe, true);for_each_encoder_on_crtc (dev, crtc, encoder) { -if (encoder->pre_pll_enable) - encoder->pre_pll_enable (encoder);if (encoder->pre_enable) encoder->pre_enable (encoder); }
Signature · 6 lines
2.1.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/3 drm/i915: add has_dsi_encoder to crtc state
In reply to Jani NikulaDSI has quite a few special cases, like DP, so add it to crtc state. This way we can get rid of a number of intel_pipe_has_type() checks for DSI. This isn't necessarily the prettiest way, but it's a step towards being aligned with what's being done with other encoders.
--- drivers/gpu/drm/i915/intel_display.c | 49 ++++++++++++------------------------ drivers/gpu/drm/i915/intel_drv.h | 3 +++ drivers/gpu/drm/i915/intel_dsi.c | 8 ++++-- 3 files changed, 25 insertions(+), 35 deletions(-)
drivers/gpu/drm/i915/intel_display.c +16 -33
@@ -2130,7 +2130,7 @@ static void intel_enable_pipe(struct intel_crtc *crtc)* need the check. */ if (HAS_GMCH_DISPLAY (dev_priv->dev)) -if (intel_pipe_has_type (crtc,INTEL_OUTPUT_DSI )) +if (crtc->config->has_dsi_encoder)assert_dsi_pll_enabled (dev_priv);else assert_pll_enabled (dev_priv, pipe);
@@ -4636,7 +4636,7 @@ static void intel_crtc_load_lut(struct drm_crtc *crtc)return ;if (HAS_GMCH_DISPLAY (dev_priv->dev)) { -if (intel_pipe_has_type (intel_crtc,INTEL_OUTPUT_DSI )) +if (intel_crtc->config->has_dsi_encoder)assert_dsi_pll_enabled (dev_priv);else assert_pll_enabled (dev_priv, pipe);
@@ -4946,7 +4946,6 @@ static void haswell_crtc_enable(struct drm_crtc *crtc)int pipe = intel_crtc->pipe, hsw_workaround_pipe;struct intel_crtc_state *pipe_config =to_intel_crtc_state (crtc->state); -bool is_dsi =intel_pipe_has_type (intel_crtc,INTEL_OUTPUT_DSI );if (WARN_ON (intel_crtc->active))return ;
@@ -4988,7 +4987,7 @@ static void haswell_crtc_enable(struct drm_crtc *crtc)if (intel_crtc->config->has_pch_encoder) dev_priv->display.fdi_link_train (crtc); -if (!is_dsi) +if (!intel_crtc->config->has_dsi_encoder)intel_ddi_enable_pipe_clock (intel_crtc);if (INTEL_INFO (dev)->gen >=9 )
@@ -5003,7 +5002,7 @@ static void haswell_crtc_enable(struct drm_crtc *crtc)intel_crtc_load_lut (crtc);intel_ddi_set_pipe_settings (crtc); -if (!is_dsi) +if (!intel_crtc->config->has_dsi_encoder)intel_ddi_enable_transcoder_func (crtc);intel_update_watermarks (crtc);
@@ -5012,7 +5011,7 @@ static void haswell_crtc_enable(struct drm_crtc *crtc)if (intel_crtc->config->has_pch_encoder)lpt_pch_enable (crtc); -if (intel_crtc->config->dp_encoder_is_mst && !is_dsi) +if (intel_crtc->config->dp_encoder_is_mst)intel_ddi_set_vc_payload_alloc (crtc, true);assert_vblank_disabled (crtc);
@@ -5123,7 +5122,6 @@ static void haswell_crtc_disable(struct drm_crtc *crtc)struct intel_crtc *intel_crtc =to_intel_crtc (crtc);struct intel_encoder *encoder;enum transcoder cpu_transcoder = intel_crtc->config->cpu_transcoder; -bool is_dsi =intel_pipe_has_type (intel_crtc,INTEL_OUTPUT_DSI );if (intel_crtc->config->has_pch_encoder) intel_set_pch_fifo_underrun_reporting(dev_priv, TRANSCODER_A,
@@ -5142,7 +5140,7 @@ static void haswell_crtc_disable(struct drm_crtc *crtc)if (intel_crtc->config->dp_encoder_is_mst)intel_ddi_set_vc_payload_alloc (crtc, false); -if (!is_dsi) +if (!intel_crtc->config->has_dsi_encoder)intel_ddi_disable_transcoder_func (dev_priv, cpu_transcoder);if (INTEL_INFO (dev)->gen >=9 )
@@ -5150,7 +5148,7 @@ static void haswell_crtc_disable(struct drm_crtc *crtc)else ironlake_pfit_disable (intel_crtc, false); -if (!is_dsi) +if (!intel_crtc->config->has_dsi_encoder)intel_ddi_disable_pipe_clock (intel_crtc);if (intel_crtc->config->has_pch_encoder) {
@@ -6152,13 +6150,10 @@ static void valleyview_crtc_enable(struct drm_crtc *crtc)struct intel_crtc *intel_crtc =to_intel_crtc (crtc);struct intel_encoder *encoder;int pipe = intel_crtc->pipe; -bool is_dsi;if (WARN_ON (intel_crtc->active))return ; - is_dsi =intel_pipe_has_type (intel_crtc,INTEL_OUTPUT_DSI ); -if (intel_crtc->config->has_dp_encoder)intel_dp_set_m_n (intel_crtc,M1_N1 );
@@ -6181,7 +6176,7 @@ static void valleyview_crtc_enable(struct drm_crtc *crtc)if (encoder->pre_pll_enable) encoder->pre_pll_enable (encoder); -if (!is_dsi) { +if (!intel_crtc->config->has_dsi_encoder) {if (IS_CHERRYVIEW (dev)) {chv_prepare_pll (intel_crtc, intel_crtc->config);chv_enable_pll (intel_crtc, intel_crtc->config);
@@ -6307,7 +6302,7 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)if (encoder->post_disable) encoder->post_disable (encoder); -if (!intel_pipe_has_type (intel_crtc,INTEL_OUTPUT_DSI )) { +if (!intel_crtc->config->has_dsi_encoder) {if (IS_CHERRYVIEW (dev))chv_disable_pll (dev_priv, pipe);else if (IS_VALLEYVIEW (dev))
@@ -7920,8 +7915,6 @@ static int i9xx_crtc_compute_clock(struct intel_crtc *crtc,int refclk, num_connectors =0 ;intel_clock_t clock;bool ok; -bool is_dsi = false; -struct intel_encoder *encoder;const intel_limit_t *limit;struct drm_atomic_state *state = crtc_state->base.state;struct drm_connector *connector;
@@ -7931,26 +7924,14 @@ static int i9xx_crtc_compute_clock(struct intel_crtc *crtc,memset (&crtc_state->dpll_hw_state,0 ,sizeof (crtc_state->dpll_hw_state)); -for_each_connector_in_state (state, connector, connector_state, i) { -if (connector_state->crtc != &crtc->base) -continue ; - - encoder =to_intel_encoder (connector_state->best_encoder); - -switch (encoder->type) { -case INTEL_OUTPUT_DSI : - is_dsi = true; -break ; -default : -break ; - } +if (crtc_state->has_dsi_encoder) +return 0 ; - num_connectors++; +for_each_connector_in_state (state, connector, connector_state, i) { +if (connector_state->crtc == &crtc->base) + num_connectors++; } -if (is_dsi) -return 0 ; -if (!crtc_state->clock_set) { refclk =i9xx_get_refclk (crtc_state, num_connectors);
@@ -12599,6 +12580,8 @@ intel_pipe_config_compare(struct drm_device *dev, }else PIPE_CONF_CHECK_M_N_ALT (dp_m_n, dp_m2_n2); +PIPE_CONF_CHECK_I (has_dsi_encoder); +PIPE_CONF_CHECK_I (base.adjusted_mode.crtc_hdisplay);PIPE_CONF_CHECK_I (base.adjusted_mode.crtc_htotal);PIPE_CONF_CHECK_I (base.adjusted_mode.crtc_hblank_start);
drivers/gpu/drm/i915/intel_drv.h +3 -0
@@ -393,6 +393,9 @@ struct intel_crtc_state {* accordingly. */ bool has_dp_encoder; +/* DSI has special cases */ +bool has_dsi_encoder; +/* Whether we should send NULL infoframes. Required for audio. */ bool has_hdmi_sink;
drivers/gpu/drm/i915/intel_dsi.c +6 -2
@@ -266,16 +266,18 @@ static inline bool is_cmd_mode(struct intel_dsi *intel_dsi) }static bool intel_dsi_compute_config (struct intel_encoder *encoder, -struct intel_crtc_state *config) +struct intel_crtc_state *pipe_config) { struct intel_dsi *intel_dsi = container_of(encoder, struct intel_dsi, base);struct intel_connector *intel_connector = intel_dsi->attached_connector;struct drm_display_mode *fixed_mode = intel_connector->panel.fixed_mode; -struct drm_display_mode *adjusted_mode = &config->base.adjusted_mode; +struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;DRM_DEBUG_KMS ("\n" ); + pipe_config->has_dsi_encoder = true; +if (fixed_mode)intel_fixed_panel_mode (fixed_mode, adjusted_mode);
@@ -704,6 +706,8 @@ static void intel_dsi_get_config(struct intel_encoder *encoder,u32 pclk =0 ;DRM_DEBUG_KMS ("\n" ); + pipe_config->has_dsi_encoder = true; +/* * DPLL_MD is not used in case of DSI, reading will get some default value * set dpll_md = 0
Signature · 6 lines
2.1.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 6 lines · Jani Nikula
For DSI, the
pre_pll_enableand thepre_enablehooks are called back-to-back on all platforms that support DSI. The distinction is artificial for DSI, for which we enable the DSI PLL in the encoder hooks. Do everything inpre_enable, and remove DSIpre_pll_enablehook.Signed-off-by Jani Nikula <[email protected]>
I was eyeing this same thing at some point.
For the series:
Quoted 60 lines
--- drivers/gpu/drm/i915/intel_dsi.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-)drivers/gpu/drm/i915/intel_dsi.c +5
-11@@ -462,6 +462,8 @@ static void intel_dsi_enable(struct intel_encoder *encoder)intel_panel_enable_backlight (intel_dsi->attached_connector); } +static void intel_dsi_prepare (struct intel_encoder *intel_encoder); +static void intel_dsi_pre_enable (struct intel_encoder *encoder) {struct drm_device *dev = encoder->base.dev;@@ -474,6 +476,9 @@ static void intel_dsi_pre_enable(struct intel_encoder *encoder)DRM_DEBUG_KMS ("\n" ); +intel_dsi_prepare (encoder); +intel_enable_dsi_pll (encoder); +/* Panel Enable over CRC PMIC */ if (intel_dsi->gpio_panel)gpiod_set_value_cansleep (intel_dsi->gpio_panel,1 );@@ -1026,15 +1031,6 @@ static void intel_dsi_prepare(struct intel_encoder *intel_encoder) } } -static void intel_dsi_pre_pll_enable (struct intel_encoder *encoder) -{ -DRM_DEBUG_KMS ("\n" ); - -intel_dsi_prepare (encoder); -intel_enable_dsi_pll (encoder); - -} -static enum drm_connector_status intel_dsi_detect (struct drm_connector *connector,bool force) {@@ -1154,9 +1150,7 @@ void intel_dsi_init(struct drm_device *dev)drm_encoder_init (dev, encoder, &intel_dsi_funcs,DRM_MODE_ENCODER_DSI ); -/* XXX: very likely not all of these are needed */ intel_encoder->compute_config = intel_dsi_compute_config; - intel_encoder->pre_pll_enable = intel_dsi_pre_pll_enable; intel_encoder->pre_enable = intel_dsi_pre_enable; intel_encoder->enable = intel_dsi_enable_nop; intel_encoder->disable = intel_dsi_pre_disable;Signature · 6 lines
2.1.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Daniel Vetter
Reviewed-byQuoted 6 lines · Ville Syrjälä
Quoted 5 lines · Jani Nikula
For DSI, the
pre_pll_enableand thepre_enablehooks are called back-to-back on all platforms that support DSI. The distinction is artificial for DSI, for which we enable the DSI PLL in the encoder hooks. Do everything inpre_enable, and remove DSIpre_pll_enablehook.
Quoted 6 lines
Quoted 1 line
Signed-off-by Jani Nikula <[email protected]>I was eyeing this same thing at some point.
For the series:
Reviewed-by Ville Syrjälä <[email protected]>
Yeah, all the pretties in here!
Btw about bxt dsi I wonder whether we should partially merge this with the cpu transcoder (since it's only either that or a dsi encoder aparrently). At least I remember that we still had some issues with bxt's dsi_get_hw_state?
Cheers, Daniel
Quoted 69 lines
Quoted 61 lines
--- drivers/gpu/drm/i915/intel_dsi.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-)drivers/gpu/drm/i915/intel_dsi.c +5
-11@@ -462,6 +462,8 @@ static void intel_dsi_enable(struct intel_encoder *encoder)intel_panel_enable_backlight (intel_dsi->attached_connector); } +static void intel_dsi_prepare (struct intel_encoder *intel_encoder); +static void intel_dsi_pre_enable (struct intel_encoder *encoder) {struct drm_device *dev = encoder->base.dev;@@ -474,6 +476,9 @@ static void intel_dsi_pre_enable(struct intel_encoder *encoder)DRM_DEBUG_KMS ("\n" ); +intel_dsi_prepare (encoder); +intel_enable_dsi_pll (encoder); +/* Panel Enable over CRC PMIC */ if (intel_dsi->gpio_panel)gpiod_set_value_cansleep (intel_dsi->gpio_panel,1 );@@ -1026,15 +1031,6 @@ static void intel_dsi_prepare(struct intel_encoder *intel_encoder) } } -static void intel_dsi_pre_pll_enable (struct intel_encoder *encoder) -{ -DRM_DEBUG_KMS ("\n" ); - -intel_dsi_prepare (encoder); -intel_enable_dsi_pll (encoder); - -} -static enum drm_connector_status intel_dsi_detect (struct drm_connector *connector,bool force) {@@ -1154,9 +1150,7 @@ void intel_dsi_init(struct drm_device *dev)drm_encoder_init (dev, encoder, &intel_dsi_funcs,DRM_MODE_ENCODER_DSI ); -/* XXX: very likely not all of these are needed */ intel_encoder->compute_config = intel_dsi_compute_config; - intel_encoder->pre_pll_enable = intel_dsi_pre_pll_enable; intel_encoder->pre_enable = intel_dsi_pre_enable; intel_encoder->enable = intel_dsi_enable_nop; intel_encoder->disable = intel_dsi_pre_disable;Signature · 6 lines
2.1.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfxSignature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 14 lines · Daniel Vetter
Quoted 6 lines · Ville Syrjälä
Quoted 5 lines · Jani Nikula
For DSI, the
pre_pll_enableand thepre_enablehooks are called back-to-back on all platforms that support DSI. The distinction is artificial for DSI, for which we enable the DSI PLL in the encoder hooks. Do everything inpre_enable, and remove DSIpre_pll_enablehook.Quoted 6 lines
Quoted 1 line
Signed-off-by Jani Nikula <[email protected]>I was eyeing this same thing at some point.
For the series:
Reviewed-by Ville Syrjälä <[email protected]>
Quoted 8 lines
Yeah, all the pretties in here!
Reviewed-by Daniel Vetter <[email protected]>Btw about bxt dsi I wonder whether we should partially merge this with the cpu transcoder (since it's only either that or a dsi encoder aparrently). At least I remember that we still had some issues with bxt's
dsi_get_hw_state?
One step at a time, maybe as a follow-up. I'm kind of hesitant to conflate this with cpu transcoder, in case some new platform changes the rules.
So for now, I've pushed this to drm-intel-next-queued, thanks for the reviews.
BR,
Jani.
Quoted 72 lines
Cheers, Daniel
Quoted 69 lines
Quoted 61 lines
--- drivers/gpu/drm/i915/intel_dsi.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-)drivers/gpu/drm/i915/intel_dsi.c +5
-11@@ -462,6 +462,8 @@ static void intel_dsi_enable(struct intel_encoder *encoder)intel_panel_enable_backlight (intel_dsi->attached_connector); } +static void intel_dsi_prepare (struct intel_encoder *intel_encoder); +static void intel_dsi_pre_enable (struct intel_encoder *encoder) {struct drm_device *dev = encoder->base.dev;@@ -474,6 +476,9 @@ static void intel_dsi_pre_enable(struct intel_encoder *encoder)DRM_DEBUG_KMS ("\n" ); +intel_dsi_prepare (encoder); +intel_enable_dsi_pll (encoder); +/* Panel Enable over CRC PMIC */ if (intel_dsi->gpio_panel)gpiod_set_value_cansleep (intel_dsi->gpio_panel,1 );@@ -1026,15 +1031,6 @@ static void intel_dsi_prepare(struct intel_encoder *intel_encoder) } } -static void intel_dsi_pre_pll_enable (struct intel_encoder *encoder) -{ -DRM_DEBUG_KMS ("\n" ); - -intel_dsi_prepare (encoder); -intel_enable_dsi_pll (encoder); - -} -static enum drm_connector_status intel_dsi_detect (struct drm_connector *connector,bool force) {@@ -1154,9 +1150,7 @@ void intel_dsi_init(struct drm_device *dev)drm_encoder_init (dev, encoder, &intel_dsi_funcs,DRM_MODE_ENCODER_DSI ); -/* XXX: very likely not all of these are needed */ intel_encoder->compute_config = intel_dsi_compute_config; - intel_encoder->pre_pll_enable = intel_dsi_pre_pll_enable; intel_encoder->pre_enable = intel_dsi_pre_enable; intel_encoder->enable = intel_dsi_enable_nop; intel_encoder->disable = intel_dsi_pre_disable;Signature · 6 lines
2.1.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfxSignature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx