Commit 3ab4cc65 authored by Charlene Liu's avatar Charlene Liu Committed by Alex Deucher

drm/amd/display: HDMI 2.x audio bandwidth check

Add HDMI 2.x audio bandwidth check
Signed-off-by: default avatarCharlene Liu <charlene.liu@amd.com>
Reviewed-by: default avatarChris Park <Chris.Park@amd.com>
Acked-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 5e1e89ee
...@@ -2811,3 +2811,51 @@ unsigned int resource_pixel_format_to_bpp(enum surface_pixel_format format) ...@@ -2811,3 +2811,51 @@ unsigned int resource_pixel_format_to_bpp(enum surface_pixel_format format)
return -1; return -1;
} }
} }
static unsigned int get_max_audio_sample_rate(struct audio_mode *modes)
{
if (modes) {
if (modes->sample_rates.rate.RATE_192)
return 192000;
if (modes->sample_rates.rate.RATE_176_4)
return 176400;
if (modes->sample_rates.rate.RATE_96)
return 96000;
if (modes->sample_rates.rate.RATE_88_2)
return 88200;
if (modes->sample_rates.rate.RATE_48)
return 48000;
if (modes->sample_rates.rate.RATE_44_1)
return 44100;
if (modes->sample_rates.rate.RATE_32)
return 32000;
}
/*original logic when no audio info*/
return 441000;
}
void get_audio_check(struct audio_info *aud_modes,
struct audio_check *audio_chk)
{
unsigned int i;
unsigned int max_sample_rate = 0;
if (aud_modes) {
audio_chk->audio_packet_type = 0x2;/*audio sample packet AP = .25 for layout0, 1 for layout1*/
audio_chk->max_audiosample_rate = 0;
for (i = 0; i < aud_modes->mode_count; i++) {
max_sample_rate = get_max_audio_sample_rate(&aud_modes->modes[i]);
if (audio_chk->max_audiosample_rate < max_sample_rate)
audio_chk->max_audiosample_rate = max_sample_rate;
/*dts takes the same as type 2: AP = 0.25*/
}
/*check which one take more bandwidth*/
if (audio_chk->max_audiosample_rate > 192000)
audio_chk->audio_packet_type = 0x9;/*AP =1*/
audio_chk->acat = 0;/*not support*/
}
}
...@@ -598,7 +598,11 @@ struct audio_info { ...@@ -598,7 +598,11 @@ struct audio_info {
/* this field must be last in this struct */ /* this field must be last in this struct */
struct audio_mode modes[DC_MAX_AUDIO_DESC_COUNT]; struct audio_mode modes[DC_MAX_AUDIO_DESC_COUNT];
}; };
struct audio_check {
unsigned int audio_packet_type;
unsigned int max_audiosample_rate;
unsigned int acat;
};
enum dc_infoframe_type { enum dc_infoframe_type {
DC_HDMI_INFOFRAME_TYPE_VENDOR = 0x81, DC_HDMI_INFOFRAME_TYPE_VENDOR = 0x81,
DC_HDMI_INFOFRAME_TYPE_AVI = 0x82, DC_HDMI_INFOFRAME_TYPE_AVI = 0x82,
......
...@@ -278,6 +278,7 @@ struct _vcs_dpi_display_output_params_st { ...@@ -278,6 +278,7 @@ struct _vcs_dpi_display_output_params_st {
int output_type; int output_type;
int output_format; int output_format;
int dsc_slices; int dsc_slices;
int max_audio_sample_rate;
struct writeback_st wb; struct writeback_st wb;
}; };
......
...@@ -454,7 +454,7 @@ static void fetch_pipe_params(struct display_mode_lib *mode_lib) ...@@ -454,7 +454,7 @@ static void fetch_pipe_params(struct display_mode_lib *mode_lib)
dout->dp_lanes; dout->dp_lanes;
/* TODO: Needs to be set based on dout->audio.audio_sample_rate_khz/sample_layout */ /* TODO: Needs to be set based on dout->audio.audio_sample_rate_khz/sample_layout */
mode_lib->vba.AudioSampleRate[mode_lib->vba.NumberOfActivePlanes] = mode_lib->vba.AudioSampleRate[mode_lib->vba.NumberOfActivePlanes] =
44.1 * 1000; dout->max_audio_sample_rate;
mode_lib->vba.AudioSampleLayout[mode_lib->vba.NumberOfActivePlanes] = mode_lib->vba.AudioSampleLayout[mode_lib->vba.NumberOfActivePlanes] =
1; 1;
mode_lib->vba.DRAMClockChangeLatencyOverride = 0.0; mode_lib->vba.DRAMClockChangeLatencyOverride = 0.0;
......
...@@ -177,4 +177,6 @@ void update_audio_usage( ...@@ -177,4 +177,6 @@ void update_audio_usage(
unsigned int resource_pixel_format_to_bpp(enum surface_pixel_format format); unsigned int resource_pixel_format_to_bpp(enum surface_pixel_format format);
void get_audio_check(struct audio_info *aud_modes,
struct audio_check *aud_chk);
#endif /* DRIVERS_GPU_DRM_AMD_DC_DEV_DC_INC_RESOURCE_H_ */ #endif /* DRIVERS_GPU_DRM_AMD_DC_DEV_DC_INC_RESOURCE_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment