diff options
author | Slava Grigorev <slava.grigorev@amd.com> | 2014-12-02 11:20:48 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2015-01-22 10:42:06 -0500 |
commit | 87654f87af2a06f325cc1a1a6e6a6a27f8837bf3 (patch) | |
tree | d973cd687c2e120ea9ae55c7f9e765f8df0c17bf /drivers/gpu/drm/radeon/radeon_audio.c | |
parent | 00a9d4bcf8983a5aefcabf5de26b3cb7f805121c (diff) |
radeon/audio: consolidate write_latency_fields() functions
Signed-off-by: Slava Grigorev <slava.grigorev@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_audio.c')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_audio.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_audio.c b/drivers/gpu/drm/radeon/radeon_audio.c index 22f12e8e1b14..a95eee14c4bf 100644 --- a/drivers/gpu/drm/radeon/radeon_audio.c +++ b/drivers/gpu/drm/radeon/radeon_audio.c | |||
@@ -53,6 +53,10 @@ void dce6_afmt_hdmi_write_speaker_allocation(struct drm_encoder *encoder, | |||
53 | u8 *sadb, int sad_count); | 53 | u8 *sadb, int sad_count); |
54 | void dce6_afmt_dp_write_speaker_allocation(struct drm_encoder *encoder, | 54 | void dce6_afmt_dp_write_speaker_allocation(struct drm_encoder *encoder, |
55 | u8 *sadb, int sad_count); | 55 | u8 *sadb, int sad_count); |
56 | void dce4_afmt_write_latency_fields(struct drm_encoder *encoder, | ||
57 | struct drm_connector *connector, struct drm_display_mode *mode); | ||
58 | void dce6_afmt_write_latency_fields(struct drm_encoder *encoder, | ||
59 | struct drm_connector *connector, struct drm_display_mode *mode); | ||
56 | 60 | ||
57 | static const u32 pin_offsets[7] = | 61 | static const u32 pin_offsets[7] = |
58 | { | 62 | { |
@@ -104,21 +108,25 @@ static struct radeon_audio_funcs dce32_dp_funcs = { | |||
104 | static struct radeon_audio_funcs dce4_hdmi_funcs = { | 108 | static struct radeon_audio_funcs dce4_hdmi_funcs = { |
105 | .write_sad_regs = evergreen_hdmi_write_sad_regs, | 109 | .write_sad_regs = evergreen_hdmi_write_sad_regs, |
106 | .write_speaker_allocation = dce4_afmt_hdmi_write_speaker_allocation, | 110 | .write_speaker_allocation = dce4_afmt_hdmi_write_speaker_allocation, |
111 | .write_latency_fields = dce4_afmt_write_latency_fields, | ||
107 | }; | 112 | }; |
108 | 113 | ||
109 | static struct radeon_audio_funcs dce4_dp_funcs = { | 114 | static struct radeon_audio_funcs dce4_dp_funcs = { |
110 | .write_sad_regs = evergreen_hdmi_write_sad_regs, | 115 | .write_sad_regs = evergreen_hdmi_write_sad_regs, |
111 | .write_speaker_allocation = dce4_afmt_dp_write_speaker_allocation, | 116 | .write_speaker_allocation = dce4_afmt_dp_write_speaker_allocation, |
117 | .write_latency_fields = dce4_afmt_write_latency_fields, | ||
112 | }; | 118 | }; |
113 | 119 | ||
114 | static struct radeon_audio_funcs dce6_hdmi_funcs = { | 120 | static struct radeon_audio_funcs dce6_hdmi_funcs = { |
115 | .write_sad_regs = dce6_afmt_write_sad_regs, | 121 | .write_sad_regs = dce6_afmt_write_sad_regs, |
116 | .write_speaker_allocation = dce6_afmt_hdmi_write_speaker_allocation, | 122 | .write_speaker_allocation = dce6_afmt_hdmi_write_speaker_allocation, |
123 | .write_latency_fields = dce6_afmt_write_latency_fields, | ||
117 | }; | 124 | }; |
118 | 125 | ||
119 | static struct radeon_audio_funcs dce6_dp_funcs = { | 126 | static struct radeon_audio_funcs dce6_dp_funcs = { |
120 | .write_sad_regs = dce6_afmt_write_sad_regs, | 127 | .write_sad_regs = dce6_afmt_write_sad_regs, |
121 | .write_speaker_allocation = dce6_afmt_dp_write_speaker_allocation, | 128 | .write_speaker_allocation = dce6_afmt_dp_write_speaker_allocation, |
129 | .write_latency_fields = dce6_afmt_write_latency_fields, | ||
122 | }; | 130 | }; |
123 | 131 | ||
124 | static void radeon_audio_interface_init(struct radeon_device *rdev) | 132 | static void radeon_audio_interface_init(struct radeon_device *rdev) |
@@ -307,3 +315,29 @@ void radeon_audio_write_speaker_allocation(struct drm_encoder *encoder) | |||
307 | 315 | ||
308 | kfree(sadb); | 316 | kfree(sadb); |
309 | } | 317 | } |
318 | |||
319 | void radeon_audio_write_latency_fields(struct drm_encoder *encoder, | ||
320 | struct drm_display_mode *mode) | ||
321 | { | ||
322 | struct radeon_encoder *radeon_encoder; | ||
323 | struct drm_connector *connector; | ||
324 | struct radeon_connector *radeon_connector = 0; | ||
325 | |||
326 | list_for_each_entry(connector, | ||
327 | &encoder->dev->mode_config.connector_list, head) { | ||
328 | if (connector->encoder == encoder) { | ||
329 | radeon_connector = to_radeon_connector(connector); | ||
330 | break; | ||
331 | } | ||
332 | } | ||
333 | |||
334 | if (!radeon_connector) { | ||
335 | DRM_ERROR("Couldn't find encoder's connector\n"); | ||
336 | return; | ||
337 | } | ||
338 | |||
339 | radeon_encoder = to_radeon_encoder(encoder); | ||
340 | |||
341 | if (radeon_encoder->audio && radeon_encoder->audio->write_latency_fields) | ||
342 | radeon_encoder->audio->write_latency_fields(encoder, connector, mode); | ||
343 | } | ||