Skip to content

Commit cff742c

Browse files
committed
drm/i915: Hoist the encoder->audio_{enable,disable}() calls higher up
Push the encoder->audio_{enable,disable}() calls out from the encoder->{enable,disable}() hooks. Moving towards audio fastset. Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20231121054324.9988-10-ville.syrjala@linux.intel.com
1 parent 3654a48 commit cff742c

File tree

5 files changed

+49
-19
lines changed

5 files changed

+49
-19
lines changed

drivers/gpu/drm/i915/display/g4x_dp.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,8 +516,6 @@ static void intel_disable_dp(struct intel_atomic_state *state,
516516
{
517517
struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
518518

519-
encoder->audio_disable(encoder, old_crtc_state, old_conn_state);
520-
521519
intel_dp->link_trained = false;
522520

523521
/*

drivers/gpu/drm/i915/display/g4x_hdmi.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,6 @@ static void g4x_enable_hdmi(struct intel_atomic_state *state,
273273
const struct drm_connector_state *conn_state)
274274
{
275275
g4x_hdmi_enable_port(encoder, pipe_config);
276-
277-
encoder->audio_enable(encoder, pipe_config, conn_state);
278276
}
279277

280278
static void ibx_enable_hdmi(struct intel_atomic_state *state,
@@ -322,8 +320,6 @@ static void ibx_enable_hdmi(struct intel_atomic_state *state,
322320
intel_de_write(dev_priv, intel_hdmi->hdmi_reg, temp);
323321
intel_de_posting_read(dev_priv, intel_hdmi->hdmi_reg);
324322
}
325-
326-
encoder->audio_enable(encoder, pipe_config, conn_state);
327323
}
328324

329325
static void cpt_enable_hdmi(struct intel_atomic_state *state,
@@ -373,16 +369,13 @@ static void cpt_enable_hdmi(struct intel_atomic_state *state,
373369
intel_de_rmw(dev_priv, TRANS_CHICKEN1(pipe),
374370
TRANS_CHICKEN1_HDMIUNIT_GC_DISABLE, 0);
375371
}
376-
377-
encoder->audio_enable(encoder, pipe_config, conn_state);
378372
}
379373

380374
static void vlv_enable_hdmi(struct intel_atomic_state *state,
381375
struct intel_encoder *encoder,
382376
const struct intel_crtc_state *pipe_config,
383377
const struct drm_connector_state *conn_state)
384378
{
385-
encoder->audio_enable(encoder, pipe_config, conn_state);
386379
}
387380

388381
static void intel_disable_hdmi(struct intel_atomic_state *state,
@@ -449,8 +442,6 @@ static void g4x_disable_hdmi(struct intel_atomic_state *state,
449442
const struct intel_crtc_state *old_crtc_state,
450443
const struct drm_connector_state *old_conn_state)
451444
{
452-
encoder->audio_disable(encoder, old_crtc_state, old_conn_state);
453-
454445
intel_disable_hdmi(state, encoder, old_crtc_state, old_conn_state);
455446
}
456447

@@ -459,7 +450,6 @@ static void pch_disable_hdmi(struct intel_atomic_state *state,
459450
const struct intel_crtc_state *old_crtc_state,
460451
const struct drm_connector_state *old_conn_state)
461452
{
462-
encoder->audio_disable(encoder, old_crtc_state, old_conn_state);
463453
}
464454

465455
static void pch_post_disable_hdmi(struct intel_atomic_state *state,

drivers/gpu/drm/i915/display/intel_ddi.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3359,7 +3359,6 @@ static void intel_enable_ddi(struct intel_atomic_state *state,
33593359

33603360
intel_hdcp_enable(state, encoder, crtc_state, conn_state);
33613361

3362-
encoder->audio_enable(encoder, crtc_state, conn_state);
33633362
}
33643363

33653364
static void intel_disable_ddi_dp(struct intel_atomic_state *state,
@@ -3403,8 +3402,6 @@ static void intel_disable_ddi(struct intel_atomic_state *state,
34033402
const struct intel_crtc_state *old_crtc_state,
34043403
const struct drm_connector_state *old_conn_state)
34053404
{
3406-
encoder->audio_disable(encoder, old_crtc_state, old_conn_state);
3407-
34083405
intel_tc_port_link_cancel_reset_work(enc_to_dig_port(encoder));
34093406

34103407
intel_hdcp_disable(to_intel_connector(old_conn_state->connector));

drivers/gpu/drm/i915/display/intel_display.c

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,48 @@ static bool needs_async_flip_vtd_wa(const struct intel_crtc_state *crtc_state)
888888
(DISPLAY_VER(i915) == 9 || IS_BROADWELL(i915) || IS_HASWELL(i915));
889889
}
890890

891+
static void intel_encoders_audio_enable(struct intel_atomic_state *state,
892+
struct intel_crtc *crtc)
893+
{
894+
const struct intel_crtc_state *crtc_state =
895+
intel_atomic_get_new_crtc_state(state, crtc);
896+
const struct drm_connector_state *conn_state;
897+
struct drm_connector *conn;
898+
int i;
899+
900+
for_each_new_connector_in_state(&state->base, conn, conn_state, i) {
901+
struct intel_encoder *encoder =
902+
to_intel_encoder(conn_state->best_encoder);
903+
904+
if (conn_state->crtc != &crtc->base)
905+
continue;
906+
907+
if (encoder->audio_enable)
908+
encoder->audio_enable(encoder, crtc_state, conn_state);
909+
}
910+
}
911+
912+
static void intel_encoders_audio_disable(struct intel_atomic_state *state,
913+
struct intel_crtc *crtc)
914+
{
915+
const struct intel_crtc_state *old_crtc_state =
916+
intel_atomic_get_old_crtc_state(state, crtc);
917+
const struct drm_connector_state *old_conn_state;
918+
struct drm_connector *conn;
919+
int i;
920+
921+
for_each_old_connector_in_state(&state->base, conn, old_conn_state, i) {
922+
struct intel_encoder *encoder =
923+
to_intel_encoder(old_conn_state->best_encoder);
924+
925+
if (old_conn_state->crtc != &crtc->base)
926+
continue;
927+
928+
if (encoder->audio_disable)
929+
encoder->audio_disable(encoder, old_crtc_state, old_conn_state);
930+
}
931+
}
932+
891933
#define is_enabling(feature, old_crtc_state, new_crtc_state) \
892934
((!(old_crtc_state)->feature || intel_crtc_needs_modeset(new_crtc_state)) && \
893935
(new_crtc_state)->feature)
@@ -1460,6 +1502,7 @@ static void ilk_crtc_enable(struct intel_atomic_state *state,
14601502
intel_crtc_vblank_on(new_crtc_state);
14611503

14621504
intel_encoders_enable(state, crtc);
1505+
intel_encoders_audio_enable(state, crtc);
14631506

14641507
if (HAS_PCH_CPT(dev_priv))
14651508
intel_wait_for_pipe_scanline_moving(crtc);
@@ -1633,6 +1676,7 @@ static void hsw_crtc_enable(struct intel_atomic_state *state,
16331676
intel_crtc_vblank_on(new_crtc_state);
16341677

16351678
intel_encoders_enable(state, crtc);
1679+
intel_encoders_audio_enable(state, crtc);
16361680

16371681
if (psl_clkgate_wa) {
16381682
intel_crtc_wait_for_next_vblank(crtc);
@@ -1684,6 +1728,7 @@ static void ilk_crtc_disable(struct intel_atomic_state *state,
16841728
intel_set_cpu_fifo_underrun_reporting(dev_priv, pipe, false);
16851729
intel_set_pch_fifo_underrun_reporting(dev_priv, pipe, false);
16861730

1731+
intel_encoders_audio_disable(state, crtc);
16871732
intel_encoders_disable(state, crtc);
16881733

16891734
intel_crtc_vblank_off(old_crtc_state);
@@ -1718,6 +1763,7 @@ static void hsw_crtc_disable(struct intel_atomic_state *state,
17181763
* Need care with mst->ddi interactions.
17191764
*/
17201765
if (!intel_crtc_is_bigjoiner_slave(old_crtc_state)) {
1766+
intel_encoders_audio_disable(state, crtc);
17211767
intel_encoders_disable(state, crtc);
17221768
intel_encoders_post_disable(state, crtc);
17231769
}
@@ -1987,6 +2033,7 @@ static void valleyview_crtc_enable(struct intel_atomic_state *state,
19872033
intel_crtc_vblank_on(new_crtc_state);
19882034

19892035
intel_encoders_enable(state, crtc);
2036+
intel_encoders_audio_enable(state, crtc);
19902037
}
19912038

19922039
static void i9xx_crtc_enable(struct intel_atomic_state *state,
@@ -2028,6 +2075,7 @@ static void i9xx_crtc_enable(struct intel_atomic_state *state,
20282075
intel_crtc_vblank_on(new_crtc_state);
20292076

20302077
intel_encoders_enable(state, crtc);
2078+
intel_encoders_audio_enable(state, crtc);
20312079

20322080
/* prevents spurious underruns */
20332081
if (DISPLAY_VER(dev_priv) == 2)
@@ -2064,6 +2112,7 @@ static void i9xx_crtc_disable(struct intel_atomic_state *state,
20642112
if (DISPLAY_VER(dev_priv) == 2)
20652113
intel_crtc_wait_for_next_vblank(crtc);
20662114

2115+
intel_encoders_audio_disable(state, crtc);
20672116
intel_encoders_disable(state, crtc);
20682117

20692118
intel_crtc_vblank_off(old_crtc_state);

drivers/gpu/drm/i915/display/intel_dp_mst.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -918,8 +918,6 @@ static void intel_mst_disable_dp(struct intel_atomic_state *state,
918918
drm_dbg_kms(&i915->drm, "active links %d\n",
919919
intel_dp->active_mst_links);
920920

921-
encoder->audio_disable(encoder, old_crtc_state, old_conn_state);
922-
923921
intel_hdcp_disable(intel_mst->connector);
924922

925923
intel_dp_sink_disable_decompression(state, connector, old_crtc_state);
@@ -1165,8 +1163,6 @@ static void intel_mst_enable_dp(struct intel_atomic_state *state,
11651163
intel_crtc_vblank_on(pipe_config);
11661164

11671165
intel_hdcp_enable(state, encoder, pipe_config, conn_state);
1168-
1169-
encoder->audio_enable(encoder, pipe_config, conn_state);
11701166
}
11711167

11721168
static bool intel_dp_mst_enc_get_hw_state(struct intel_encoder *encoder,

0 commit comments

Comments
 (0)