drm/amd/display: move stream encoder audio setup to link_hwss
authorWenjing Liu <wenjing.liu@amd.com>
Thu, 20 Oct 2022 15:46:33 +0000 (11:46 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 24 Oct 2022 18:35:34 +0000 (14:35 -0400)
Unify stream encoder audio setup interface.

Tested-by: Mark Broadworth <mark.broadworth@amd.com>
Reviewed-by: Charlene Liu <Charlene.Liu@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Wenjing Liu <wenjing.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
drivers/gpu/drm/amd/display/dc/inc/link_hwss.h
drivers/gpu/drm/amd/display/dc/link/link_hwss_dio.c
drivers/gpu/drm/amd/display/dc/link/link_hwss_dio.h
drivers/gpu/drm/amd/display/dc/link/link_hwss_dpia.c
drivers/gpu/drm/amd/display/dc/link/link_hwss_hpo_dp.c

index a34bc631be00815150604aed31d749f8c58c87a5..c5380ce7065358d233d88a677fb4cd001bafa127 100644 (file)
@@ -1455,6 +1455,9 @@ static enum dc_status apply_single_controller_ctx_to_hw(
        unsigned int event_triggers = 0;
        struct pipe_ctx *odm_pipe = pipe_ctx->next_odm_pipe;
        struct dce_hwseq *hws = dc->hwseq;
+       const struct link_hwss *link_hwss = get_link_hwss(
+                       link, &pipe_ctx->link_res);
+
 
        if (hws->funcs.disable_stream_gating) {
                hws->funcs.disable_stream_gating(dc, pipe_ctx);
@@ -1465,23 +1468,8 @@ static enum dc_status apply_single_controller_ctx_to_hw(
 
                build_audio_output(context, pipe_ctx, &audio_output);
 
-               if (dc_is_dp_signal(pipe_ctx->stream->signal))
-                       if (is_dp_128b_132b_signal(pipe_ctx))
-                               pipe_ctx->stream_res.hpo_dp_stream_enc->funcs->dp_audio_setup(
-                                               pipe_ctx->stream_res.hpo_dp_stream_enc,
-                                               pipe_ctx->stream_res.audio->inst,
-                                               &pipe_ctx->stream->audio_info);
-                       else
-                               pipe_ctx->stream_res.stream_enc->funcs->dp_audio_setup(
-                                               pipe_ctx->stream_res.stream_enc,
-                                               pipe_ctx->stream_res.audio->inst,
-                                               &pipe_ctx->stream->audio_info);
-               else
-                       pipe_ctx->stream_res.stream_enc->funcs->hdmi_audio_setup(
-                                       pipe_ctx->stream_res.stream_enc,
-                                       pipe_ctx->stream_res.audio->inst,
-                                       &pipe_ctx->stream->audio_info,
-                                       &audio_output.crtc_info);
+               link_hwss->setup_audio_output(pipe_ctx, &audio_output,
+                               pipe_ctx->stream_res.audio->inst);
 
                pipe_ctx->stream_res.audio->funcs->az_configure(
                                pipe_ctx->stream_res.audio,
index 7a2c8bc280d50d8d9d3651a1a774eba535890842..0f69946cce9f64bf272018b52073daa5acdba761 100644 (file)
@@ -38,6 +38,7 @@ struct link_resource;
 struct pipe_ctx;
 struct encoder_set_dp_phy_pattern_param;
 struct link_mst_stream_allocation_table;
+struct audio_output;
 
 struct link_hwss_ext {
        /* function pointers below may require to check for NULL if caller
@@ -79,6 +80,8 @@ struct link_hwss {
        void (*disable_link_output)(struct dc_link *link,
                        const struct link_resource *link_res,
                        enum signal_type signal);
+       void (*setup_audio_output)(struct pipe_ctx *pipe_ctx,
+                       struct audio_output *audio_output, uint32_t audio_inst);
        void (*enable_audio_packet)(struct pipe_ctx *pipe_ctx);
        void (*disable_audio_packet)(struct pipe_ctx *pipe_ctx);
 };
index fcc3ce2b8fbf81fc39796c533cb30f8974635fce..33148b753c03b485f887213da6583f088d097b7e 100644 (file)
@@ -170,6 +170,22 @@ static void update_dio_stream_allocation_table(struct dc_link *link,
        link_enc->funcs->update_mst_stream_allocation_table(link_enc, table);
 }
 
+void setup_dio_audio_output(struct pipe_ctx *pipe_ctx,
+               struct audio_output *audio_output, uint32_t audio_inst)
+{
+       if (dc_is_dp_signal(pipe_ctx->stream->signal))
+               pipe_ctx->stream_res.stream_enc->funcs->dp_audio_setup(
+                               pipe_ctx->stream_res.stream_enc,
+                               audio_inst,
+                               &pipe_ctx->stream->audio_info);
+       else
+               pipe_ctx->stream_res.stream_enc->funcs->hdmi_audio_setup(
+                               pipe_ctx->stream_res.stream_enc,
+                               audio_inst,
+                               &pipe_ctx->stream->audio_info,
+                               &audio_output->crtc_info);
+}
+
 void enable_dio_audio_packet(struct pipe_ctx *pipe_ctx)
 {
        if (dc_is_dp_signal(pipe_ctx->stream->signal))
@@ -208,6 +224,7 @@ static const struct link_hwss dio_link_hwss = {
        .reset_stream_encoder = reset_dio_stream_encoder,
        .setup_stream_attribute = setup_dio_stream_attribute,
        .disable_link_output = disable_dio_link_output,
+       .setup_audio_output = setup_dio_audio_output,
        .enable_audio_packet = enable_dio_audio_packet,
        .disable_audio_packet = disable_dio_audio_packet,
        .ext = {
index 006830376e7def0cc99218f3bf9adca6eedaf56c..9a108c3d7831563a83d72fb9af96441f3aa60bd5 100644 (file)
@@ -50,6 +50,8 @@ void set_dio_dp_lane_settings(struct dc_link *link,
                const struct link_resource *link_res,
                const struct dc_link_settings *link_settings,
                const struct dc_lane_settings lane_settings[LANE_COUNT_DP_MAX]);
+void setup_dio_audio_output(struct pipe_ctx *pipe_ctx,
+               struct audio_output *audio_output, uint32_t audio_inst);
 void enable_dio_audio_packet(struct pipe_ctx *pipe_ctx);
 void disable_dio_audio_packet(struct pipe_ctx *pipe_ctx);
 
index f81949221e0d0471d12ca4c44f67df8b95b06525..861f3cd5b3560cdc6c289e397037b99ac00ece65 100644 (file)
@@ -57,6 +57,7 @@ static const struct link_hwss dpia_link_hwss = {
        .reset_stream_encoder = reset_dio_stream_encoder,
        .setup_stream_attribute = setup_dio_stream_attribute,
        .disable_link_output = disable_dio_link_output,
+       .setup_audio_output = setup_dio_audio_output,
        .enable_audio_packet = enable_dio_audio_packet,
        .disable_audio_packet = disable_dio_audio_packet,
        .ext = {
index 668a66832579d00c9fa269257cce0d9138de9c18..2f46e1ac4ce0e934e941539797e994aeb8a7d9cc 100644 (file)
@@ -262,6 +262,15 @@ static void update_hpo_dp_stream_allocation_table(struct dc_link *link,
                        table);
 }
 
+static void setup_hpo_dp_audio_output(struct pipe_ctx *pipe_ctx,
+               struct audio_output *audio_output, uint32_t audio_inst)
+{
+       pipe_ctx->stream_res.hpo_dp_stream_enc->funcs->dp_audio_setup(
+                       pipe_ctx->stream_res.hpo_dp_stream_enc,
+                       audio_inst,
+                       &pipe_ctx->stream->audio_info);
+}
+
 static void enable_hpo_dp_audio_packet(struct pipe_ctx *pipe_ctx)
 {
        pipe_ctx->stream_res.hpo_dp_stream_enc->funcs->dp_audio_enable(
@@ -280,6 +289,7 @@ static const struct link_hwss hpo_dp_link_hwss = {
        .reset_stream_encoder = reset_hpo_dp_stream_encoder,
        .setup_stream_attribute = setup_hpo_dp_stream_attribute,
        .disable_link_output = disable_hpo_dp_link_output,
+       .setup_audio_output = setup_hpo_dp_audio_output,
        .enable_audio_packet = enable_hpo_dp_audio_packet,
        .disable_audio_packet = disable_hpo_dp_audio_packet,
        .ext = {