mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 00:53:34 +02:00
drm/i915: Convert audio enable/disable into encoder vfuncs
Add encoder vfuncs for audio enable/disable. This will allow audio to be enabled/disabled during fastsets. An encoder hook is necessary as on pre-hsw platforms different encoder types implement audio in different ways. 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-9-ville.syrjala@linux.intel.com
This commit is contained in:
parent
4645e89804
commit
3654a48ab1
|
|
@ -516,7 +516,7 @@ static void intel_disable_dp(struct intel_atomic_state *state,
|
|||
{
|
||||
struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
|
||||
|
||||
g4x_dp_audio_disable(encoder, old_crtc_state, old_conn_state);
|
||||
encoder->audio_disable(encoder, old_crtc_state, old_conn_state);
|
||||
|
||||
intel_dp->link_trained = false;
|
||||
|
||||
|
|
@ -719,7 +719,7 @@ static void g4x_enable_dp(struct intel_atomic_state *state,
|
|||
{
|
||||
intel_enable_dp(state, encoder, pipe_config, conn_state);
|
||||
intel_edp_backlight_on(pipe_config, conn_state);
|
||||
g4x_dp_audio_enable(encoder, pipe_config, conn_state);
|
||||
encoder->audio_enable(encoder, pipe_config, conn_state);
|
||||
}
|
||||
|
||||
static void vlv_enable_dp(struct intel_atomic_state *state,
|
||||
|
|
@ -728,7 +728,7 @@ static void vlv_enable_dp(struct intel_atomic_state *state,
|
|||
const struct drm_connector_state *conn_state)
|
||||
{
|
||||
intel_edp_backlight_on(pipe_config, conn_state);
|
||||
g4x_dp_audio_enable(encoder, pipe_config, conn_state);
|
||||
encoder->audio_enable(encoder, pipe_config, conn_state);
|
||||
}
|
||||
|
||||
static void g4x_pre_enable_dp(struct intel_atomic_state *state,
|
||||
|
|
@ -1357,6 +1357,8 @@ bool g4x_dp_init(struct drm_i915_private *dev_priv,
|
|||
intel_encoder->disable = g4x_disable_dp;
|
||||
intel_encoder->post_disable = g4x_post_disable_dp;
|
||||
}
|
||||
intel_encoder->audio_enable = g4x_dp_audio_enable;
|
||||
intel_encoder->audio_disable = g4x_dp_audio_disable;
|
||||
|
||||
if ((IS_IVYBRIDGE(dev_priv) && port == PORT_A) ||
|
||||
(HAS_PCH_CPT(dev_priv) && port != PORT_A))
|
||||
|
|
|
|||
|
|
@ -274,7 +274,7 @@ static void g4x_enable_hdmi(struct intel_atomic_state *state,
|
|||
{
|
||||
g4x_hdmi_enable_port(encoder, pipe_config);
|
||||
|
||||
g4x_hdmi_audio_enable(encoder, pipe_config, conn_state);
|
||||
encoder->audio_enable(encoder, pipe_config, conn_state);
|
||||
}
|
||||
|
||||
static void ibx_enable_hdmi(struct intel_atomic_state *state,
|
||||
|
|
@ -323,7 +323,7 @@ static void ibx_enable_hdmi(struct intel_atomic_state *state,
|
|||
intel_de_posting_read(dev_priv, intel_hdmi->hdmi_reg);
|
||||
}
|
||||
|
||||
g4x_hdmi_audio_enable(encoder, pipe_config, conn_state);
|
||||
encoder->audio_enable(encoder, pipe_config, conn_state);
|
||||
}
|
||||
|
||||
static void cpt_enable_hdmi(struct intel_atomic_state *state,
|
||||
|
|
@ -374,7 +374,7 @@ static void cpt_enable_hdmi(struct intel_atomic_state *state,
|
|||
TRANS_CHICKEN1_HDMIUNIT_GC_DISABLE, 0);
|
||||
}
|
||||
|
||||
g4x_hdmi_audio_enable(encoder, pipe_config, conn_state);
|
||||
encoder->audio_enable(encoder, pipe_config, conn_state);
|
||||
}
|
||||
|
||||
static void vlv_enable_hdmi(struct intel_atomic_state *state,
|
||||
|
|
@ -382,7 +382,7 @@ static void vlv_enable_hdmi(struct intel_atomic_state *state,
|
|||
const struct intel_crtc_state *pipe_config,
|
||||
const struct drm_connector_state *conn_state)
|
||||
{
|
||||
g4x_hdmi_audio_enable(encoder, pipe_config, conn_state);
|
||||
encoder->audio_enable(encoder, pipe_config, conn_state);
|
||||
}
|
||||
|
||||
static void intel_disable_hdmi(struct intel_atomic_state *state,
|
||||
|
|
@ -449,7 +449,7 @@ static void g4x_disable_hdmi(struct intel_atomic_state *state,
|
|||
const struct intel_crtc_state *old_crtc_state,
|
||||
const struct drm_connector_state *old_conn_state)
|
||||
{
|
||||
g4x_hdmi_audio_disable(encoder, old_crtc_state, old_conn_state);
|
||||
encoder->audio_disable(encoder, old_crtc_state, old_conn_state);
|
||||
|
||||
intel_disable_hdmi(state, encoder, old_crtc_state, old_conn_state);
|
||||
}
|
||||
|
|
@ -459,7 +459,7 @@ static void pch_disable_hdmi(struct intel_atomic_state *state,
|
|||
const struct intel_crtc_state *old_crtc_state,
|
||||
const struct drm_connector_state *old_conn_state)
|
||||
{
|
||||
g4x_hdmi_audio_disable(encoder, old_crtc_state, old_conn_state);
|
||||
encoder->audio_disable(encoder, old_crtc_state, old_conn_state);
|
||||
}
|
||||
|
||||
static void pch_post_disable_hdmi(struct intel_atomic_state *state,
|
||||
|
|
@ -766,6 +766,8 @@ void g4x_hdmi_init(struct drm_i915_private *dev_priv,
|
|||
else
|
||||
intel_encoder->enable = g4x_enable_hdmi;
|
||||
}
|
||||
intel_encoder->audio_enable = g4x_hdmi_audio_enable;
|
||||
intel_encoder->audio_disable = g4x_hdmi_audio_disable;
|
||||
intel_encoder->shutdown = intel_hdmi_encoder_shutdown;
|
||||
|
||||
intel_encoder->type = INTEL_OUTPUT_HDMI;
|
||||
|
|
|
|||
|
|
@ -3359,7 +3359,7 @@ static void intel_enable_ddi(struct intel_atomic_state *state,
|
|||
|
||||
intel_hdcp_enable(state, encoder, crtc_state, conn_state);
|
||||
|
||||
intel_audio_codec_enable(encoder, crtc_state, conn_state);
|
||||
encoder->audio_enable(encoder, crtc_state, conn_state);
|
||||
}
|
||||
|
||||
static void intel_disable_ddi_dp(struct intel_atomic_state *state,
|
||||
|
|
@ -3403,7 +3403,7 @@ static void intel_disable_ddi(struct intel_atomic_state *state,
|
|||
const struct intel_crtc_state *old_crtc_state,
|
||||
const struct drm_connector_state *old_conn_state)
|
||||
{
|
||||
intel_audio_codec_disable(encoder, old_crtc_state, old_conn_state);
|
||||
encoder->audio_disable(encoder, old_crtc_state, old_conn_state);
|
||||
|
||||
intel_tc_port_link_cancel_reset_work(enc_to_dig_port(encoder));
|
||||
|
||||
|
|
@ -4936,6 +4936,8 @@ void intel_ddi_init(struct drm_i915_private *dev_priv,
|
|||
encoder->post_pll_disable = intel_ddi_post_pll_disable;
|
||||
encoder->post_disable = intel_ddi_post_disable;
|
||||
encoder->update_pipe = intel_ddi_update_pipe;
|
||||
encoder->audio_enable = intel_audio_codec_enable;
|
||||
encoder->audio_disable = intel_audio_codec_disable;
|
||||
encoder->get_hw_state = intel_ddi_get_hw_state;
|
||||
encoder->sync_state = intel_ddi_sync_state;
|
||||
encoder->initial_fastset_check = intel_ddi_initial_fastset_check;
|
||||
|
|
|
|||
|
|
@ -198,6 +198,12 @@ struct intel_encoder {
|
|||
struct intel_encoder *,
|
||||
const struct intel_crtc_state *,
|
||||
const struct drm_connector_state *);
|
||||
void (*audio_enable)(struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *crtc_state,
|
||||
const struct drm_connector_state *conn_state);
|
||||
void (*audio_disable)(struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *old_crtc_state,
|
||||
const struct drm_connector_state *old_conn_state);
|
||||
/* Read out the current hw state of this connector, returning true if
|
||||
* the encoder is active. If the encoder is enabled it also set the pipe
|
||||
* it is connected to in the pipe parameter. */
|
||||
|
|
|
|||
|
|
@ -918,7 +918,7 @@ static void intel_mst_disable_dp(struct intel_atomic_state *state,
|
|||
drm_dbg_kms(&i915->drm, "active links %d\n",
|
||||
intel_dp->active_mst_links);
|
||||
|
||||
intel_audio_codec_disable(encoder, old_crtc_state, old_conn_state);
|
||||
encoder->audio_disable(encoder, old_crtc_state, old_conn_state);
|
||||
|
||||
intel_hdcp_disable(intel_mst->connector);
|
||||
|
||||
|
|
@ -1166,7 +1166,7 @@ static void intel_mst_enable_dp(struct intel_atomic_state *state,
|
|||
|
||||
intel_hdcp_enable(state, encoder, pipe_config, conn_state);
|
||||
|
||||
intel_audio_codec_enable(encoder, pipe_config, conn_state);
|
||||
encoder->audio_enable(encoder, pipe_config, conn_state);
|
||||
}
|
||||
|
||||
static bool intel_dp_mst_enc_get_hw_state(struct intel_encoder *encoder,
|
||||
|
|
@ -1626,6 +1626,8 @@ intel_dp_create_fake_mst_encoder(struct intel_digital_port *dig_port, enum pipe
|
|||
intel_encoder->pre_pll_enable = intel_mst_pre_pll_enable_dp;
|
||||
intel_encoder->pre_enable = intel_mst_pre_enable_dp;
|
||||
intel_encoder->enable = intel_mst_enable_dp;
|
||||
intel_encoder->audio_enable = intel_audio_codec_enable;
|
||||
intel_encoder->audio_disable = intel_audio_codec_disable;
|
||||
intel_encoder->get_hw_state = intel_dp_mst_enc_get_hw_state;
|
||||
intel_encoder->get_config = intel_dp_mst_enc_get_config;
|
||||
intel_encoder->initial_fastset_check = intel_dp_mst_initial_fastset_check;
|
||||
|
|
|
|||
|
|
@ -1787,17 +1787,28 @@ static void intel_sdvo_get_config(struct intel_encoder *encoder,
|
|||
intel_sdvo_get_eld(intel_sdvo, pipe_config);
|
||||
}
|
||||
|
||||
static void intel_sdvo_disable_audio(struct intel_sdvo *intel_sdvo)
|
||||
static void intel_sdvo_disable_audio(struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *old_crtc_state,
|
||||
const struct drm_connector_state *old_conn_state)
|
||||
{
|
||||
struct intel_sdvo *intel_sdvo = to_sdvo(encoder);
|
||||
|
||||
if (!old_crtc_state->has_audio)
|
||||
return;
|
||||
|
||||
intel_sdvo_set_audio_state(intel_sdvo, 0);
|
||||
}
|
||||
|
||||
static void intel_sdvo_enable_audio(struct intel_sdvo *intel_sdvo,
|
||||
static void intel_sdvo_enable_audio(struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *crtc_state,
|
||||
const struct drm_connector_state *conn_state)
|
||||
{
|
||||
struct intel_sdvo *intel_sdvo = to_sdvo(encoder);
|
||||
const u8 *eld = crtc_state->eld;
|
||||
|
||||
if (!crtc_state->has_audio)
|
||||
return;
|
||||
|
||||
intel_sdvo_set_audio_state(intel_sdvo, 0);
|
||||
|
||||
intel_sdvo_write_infoframe(intel_sdvo, SDVO_HBUF_INDEX_ELD,
|
||||
|
|
@ -1818,8 +1829,7 @@ static void intel_disable_sdvo(struct intel_atomic_state *state,
|
|||
struct intel_crtc *crtc = to_intel_crtc(old_crtc_state->uapi.crtc);
|
||||
u32 temp;
|
||||
|
||||
if (old_crtc_state->has_audio)
|
||||
intel_sdvo_disable_audio(intel_sdvo);
|
||||
encoder->audio_disable(encoder, old_crtc_state, conn_state);
|
||||
|
||||
intel_sdvo_set_active_outputs(intel_sdvo, 0);
|
||||
if (0)
|
||||
|
|
@ -1913,8 +1923,7 @@ static void intel_enable_sdvo(struct intel_atomic_state *state,
|
|||
DRM_MODE_DPMS_ON);
|
||||
intel_sdvo_set_active_outputs(intel_sdvo, intel_sdvo_connector->output_flag);
|
||||
|
||||
if (pipe_config->has_audio)
|
||||
intel_sdvo_enable_audio(intel_sdvo, pipe_config, conn_state);
|
||||
encoder->audio_enable(encoder, pipe_config, conn_state);
|
||||
}
|
||||
|
||||
static enum drm_mode_status
|
||||
|
|
@ -3390,6 +3399,8 @@ bool intel_sdvo_init(struct drm_i915_private *dev_priv,
|
|||
}
|
||||
intel_encoder->pre_enable = intel_sdvo_pre_enable;
|
||||
intel_encoder->enable = intel_enable_sdvo;
|
||||
intel_encoder->audio_enable = intel_sdvo_enable_audio;
|
||||
intel_encoder->audio_disable = intel_sdvo_disable_audio;
|
||||
intel_encoder->get_hw_state = intel_sdvo_get_hw_state;
|
||||
intel_encoder->get_config = intel_sdvo_get_config;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user