Commit 6f945693 authored by Slava Grigorev's avatar Slava Grigorev Committed by Alex Deucher

radeon/audio: applied audio_dpms() and audio_mode_set() calls

Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarSlava Grigorev <slava.grigorev@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 6e72376d
...@@ -1616,6 +1616,7 @@ radeon_atom_encoder_dpms_dig(struct drm_encoder *encoder, int mode) ...@@ -1616,6 +1616,7 @@ radeon_atom_encoder_dpms_dig(struct drm_encoder *encoder, int mode)
struct radeon_connector *radeon_connector = NULL; struct radeon_connector *radeon_connector = NULL;
struct radeon_connector_atom_dig *radeon_dig_connector = NULL; struct radeon_connector_atom_dig *radeon_dig_connector = NULL;
bool travis_quirk = false; bool travis_quirk = false;
int encoder_mode;
if (connector) { if (connector) {
radeon_connector = to_radeon_connector(connector); radeon_connector = to_radeon_connector(connector);
...@@ -1711,6 +1712,11 @@ radeon_atom_encoder_dpms_dig(struct drm_encoder *encoder, int mode) ...@@ -1711,6 +1712,11 @@ radeon_atom_encoder_dpms_dig(struct drm_encoder *encoder, int mode)
} }
break; break;
} }
encoder_mode = atombios_get_encoder_mode(encoder);
if (radeon_audio != 0 &&
(encoder_mode == ATOM_ENCODER_MODE_HDMI || ENCODER_MODE_IS_DP(encoder_mode)))
radeon_audio_dpms(encoder, mode);
} }
static void static void
...@@ -2124,6 +2130,7 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder, ...@@ -2124,6 +2130,7 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder,
struct drm_device *dev = encoder->dev; struct drm_device *dev = encoder->dev;
struct radeon_device *rdev = dev->dev_private; struct radeon_device *rdev = dev->dev_private;
struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
int encoder_mode;
radeon_encoder->pixel_clock = adjusted_mode->clock; radeon_encoder->pixel_clock = adjusted_mode->clock;
...@@ -2150,6 +2157,10 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder, ...@@ -2150,6 +2157,10 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder,
case ENCODER_OBJECT_ID_INTERNAL_UNIPHY3: case ENCODER_OBJECT_ID_INTERNAL_UNIPHY3:
case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA: case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA:
/* handled in dpms */ /* handled in dpms */
encoder_mode = atombios_get_encoder_mode(encoder);
if (radeon_audio != 0 &&
(encoder_mode == ATOM_ENCODER_MODE_HDMI || ENCODER_MODE_IS_DP(encoder_mode)))
radeon_audio_mode_set(encoder, adjusted_mode);
break; break;
case ENCODER_OBJECT_ID_INTERNAL_DDI: case ENCODER_OBJECT_ID_INTERNAL_DDI:
case ENCODER_OBJECT_ID_INTERNAL_DVO1: case ENCODER_OBJECT_ID_INTERNAL_DVO1:
...@@ -2171,12 +2182,6 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder, ...@@ -2171,12 +2182,6 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder,
} }
atombios_apply_encoder_quirks(encoder, adjusted_mode); atombios_apply_encoder_quirks(encoder, adjusted_mode);
if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_HDMI) {
if (rdev->asic->display.hdmi_enable)
radeon_hdmi_enable(rdev, encoder, true);
radeon_audio_mode_set(encoder, adjusted_mode);
}
} }
static bool static bool
...@@ -2442,10 +2447,6 @@ static void radeon_atom_encoder_disable(struct drm_encoder *encoder) ...@@ -2442,10 +2447,6 @@ static void radeon_atom_encoder_disable(struct drm_encoder *encoder)
disable_done: disable_done:
if (radeon_encoder_is_digital(encoder)) { if (radeon_encoder_is_digital(encoder)) {
if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_HDMI) {
if (rdev->asic->display.hdmi_enable)
radeon_hdmi_enable(rdev, encoder, false);
}
dig = radeon_encoder->enc_priv; dig = radeon_encoder->enc_priv;
dig->dig_encoder = -1; dig->dig_encoder = -1;
} }
......
...@@ -638,7 +638,6 @@ static struct radeon_asic rs600_asic = { ...@@ -638,7 +638,6 @@ static struct radeon_asic rs600_asic = {
.wait_for_vblank = &avivo_wait_for_vblank, .wait_for_vblank = &avivo_wait_for_vblank,
.set_backlight_level = &atombios_set_backlight_level, .set_backlight_level = &atombios_set_backlight_level,
.get_backlight_level = &atombios_get_backlight_level, .get_backlight_level = &atombios_get_backlight_level,
.hdmi_enable = &r600_hdmi_enable,
}, },
.copy = { .copy = {
.blit = &r100_copy_blit, .blit = &r100_copy_blit,
...@@ -705,7 +704,6 @@ static struct radeon_asic rs690_asic = { ...@@ -705,7 +704,6 @@ static struct radeon_asic rs690_asic = {
.wait_for_vblank = &avivo_wait_for_vblank, .wait_for_vblank = &avivo_wait_for_vblank,
.set_backlight_level = &atombios_set_backlight_level, .set_backlight_level = &atombios_set_backlight_level,
.get_backlight_level = &atombios_get_backlight_level, .get_backlight_level = &atombios_get_backlight_level,
.hdmi_enable = &r600_hdmi_enable,
}, },
.copy = { .copy = {
.blit = &r100_copy_blit, .blit = &r100_copy_blit,
...@@ -933,7 +931,6 @@ static struct radeon_asic r600_asic = { ...@@ -933,7 +931,6 @@ static struct radeon_asic r600_asic = {
.wait_for_vblank = &avivo_wait_for_vblank, .wait_for_vblank = &avivo_wait_for_vblank,
.set_backlight_level = &atombios_set_backlight_level, .set_backlight_level = &atombios_set_backlight_level,
.get_backlight_level = &atombios_get_backlight_level, .get_backlight_level = &atombios_get_backlight_level,
.hdmi_enable = &r600_hdmi_enable,
}, },
.copy = { .copy = {
.blit = &r600_copy_cpdma, .blit = &r600_copy_cpdma,
...@@ -1018,7 +1015,6 @@ static struct radeon_asic rv6xx_asic = { ...@@ -1018,7 +1015,6 @@ static struct radeon_asic rv6xx_asic = {
.wait_for_vblank = &avivo_wait_for_vblank, .wait_for_vblank = &avivo_wait_for_vblank,
.set_backlight_level = &atombios_set_backlight_level, .set_backlight_level = &atombios_set_backlight_level,
.get_backlight_level = &atombios_get_backlight_level, .get_backlight_level = &atombios_get_backlight_level,
.hdmi_enable = &r600_hdmi_enable,
}, },
.copy = { .copy = {
.blit = &r600_copy_cpdma, .blit = &r600_copy_cpdma,
...@@ -1108,7 +1104,6 @@ static struct radeon_asic rs780_asic = { ...@@ -1108,7 +1104,6 @@ static struct radeon_asic rs780_asic = {
.wait_for_vblank = &avivo_wait_for_vblank, .wait_for_vblank = &avivo_wait_for_vblank,
.set_backlight_level = &atombios_set_backlight_level, .set_backlight_level = &atombios_set_backlight_level,
.get_backlight_level = &atombios_get_backlight_level, .get_backlight_level = &atombios_get_backlight_level,
.hdmi_enable = &r600_hdmi_enable,
}, },
.copy = { .copy = {
.blit = &r600_copy_cpdma, .blit = &r600_copy_cpdma,
...@@ -1211,7 +1206,6 @@ static struct radeon_asic rv770_asic = { ...@@ -1211,7 +1206,6 @@ static struct radeon_asic rv770_asic = {
.wait_for_vblank = &avivo_wait_for_vblank, .wait_for_vblank = &avivo_wait_for_vblank,
.set_backlight_level = &atombios_set_backlight_level, .set_backlight_level = &atombios_set_backlight_level,
.get_backlight_level = &atombios_get_backlight_level, .get_backlight_level = &atombios_get_backlight_level,
.hdmi_enable = &r600_hdmi_enable,
}, },
.copy = { .copy = {
.blit = &r600_copy_cpdma, .blit = &r600_copy_cpdma,
...@@ -1328,7 +1322,6 @@ static struct radeon_asic evergreen_asic = { ...@@ -1328,7 +1322,6 @@ static struct radeon_asic evergreen_asic = {
.wait_for_vblank = &dce4_wait_for_vblank, .wait_for_vblank = &dce4_wait_for_vblank,
.set_backlight_level = &atombios_set_backlight_level, .set_backlight_level = &atombios_set_backlight_level,
.get_backlight_level = &atombios_get_backlight_level, .get_backlight_level = &atombios_get_backlight_level,
.hdmi_enable = &evergreen_hdmi_enable,
}, },
.copy = { .copy = {
.blit = &r600_copy_cpdma, .blit = &r600_copy_cpdma,
...@@ -1419,7 +1412,6 @@ static struct radeon_asic sumo_asic = { ...@@ -1419,7 +1412,6 @@ static struct radeon_asic sumo_asic = {
.wait_for_vblank = &dce4_wait_for_vblank, .wait_for_vblank = &dce4_wait_for_vblank,
.set_backlight_level = &atombios_set_backlight_level, .set_backlight_level = &atombios_set_backlight_level,
.get_backlight_level = &atombios_get_backlight_level, .get_backlight_level = &atombios_get_backlight_level,
.hdmi_enable = &evergreen_hdmi_enable,
}, },
.copy = { .copy = {
.blit = &r600_copy_cpdma, .blit = &r600_copy_cpdma,
...@@ -1509,7 +1501,6 @@ static struct radeon_asic btc_asic = { ...@@ -1509,7 +1501,6 @@ static struct radeon_asic btc_asic = {
.wait_for_vblank = &dce4_wait_for_vblank, .wait_for_vblank = &dce4_wait_for_vblank,
.set_backlight_level = &atombios_set_backlight_level, .set_backlight_level = &atombios_set_backlight_level,
.get_backlight_level = &atombios_get_backlight_level, .get_backlight_level = &atombios_get_backlight_level,
.hdmi_enable = &evergreen_hdmi_enable,
}, },
.copy = { .copy = {
.blit = &r600_copy_cpdma, .blit = &r600_copy_cpdma,
...@@ -1654,7 +1645,6 @@ static struct radeon_asic cayman_asic = { ...@@ -1654,7 +1645,6 @@ static struct radeon_asic cayman_asic = {
.wait_for_vblank = &dce4_wait_for_vblank, .wait_for_vblank = &dce4_wait_for_vblank,
.set_backlight_level = &atombios_set_backlight_level, .set_backlight_level = &atombios_set_backlight_level,
.get_backlight_level = &atombios_get_backlight_level, .get_backlight_level = &atombios_get_backlight_level,
.hdmi_enable = &evergreen_hdmi_enable,
}, },
.copy = { .copy = {
.blit = &r600_copy_cpdma, .blit = &r600_copy_cpdma,
...@@ -1756,7 +1746,6 @@ static struct radeon_asic trinity_asic = { ...@@ -1756,7 +1746,6 @@ static struct radeon_asic trinity_asic = {
.wait_for_vblank = &dce4_wait_for_vblank, .wait_for_vblank = &dce4_wait_for_vblank,
.set_backlight_level = &atombios_set_backlight_level, .set_backlight_level = &atombios_set_backlight_level,
.get_backlight_level = &atombios_get_backlight_level, .get_backlight_level = &atombios_get_backlight_level,
.hdmi_enable = &evergreen_hdmi_enable,
}, },
.copy = { .copy = {
.blit = &r600_copy_cpdma, .blit = &r600_copy_cpdma,
...@@ -1888,7 +1877,6 @@ static struct radeon_asic si_asic = { ...@@ -1888,7 +1877,6 @@ static struct radeon_asic si_asic = {
.wait_for_vblank = &dce4_wait_for_vblank, .wait_for_vblank = &dce4_wait_for_vblank,
.set_backlight_level = &atombios_set_backlight_level, .set_backlight_level = &atombios_set_backlight_level,
.get_backlight_level = &atombios_get_backlight_level, .get_backlight_level = &atombios_get_backlight_level,
.hdmi_enable = &evergreen_hdmi_enable,
}, },
.copy = { .copy = {
.blit = &r600_copy_cpdma, .blit = &r600_copy_cpdma,
...@@ -2054,7 +2042,6 @@ static struct radeon_asic ci_asic = { ...@@ -2054,7 +2042,6 @@ static struct radeon_asic ci_asic = {
.wait_for_vblank = &dce4_wait_for_vblank, .wait_for_vblank = &dce4_wait_for_vblank,
.set_backlight_level = &atombios_set_backlight_level, .set_backlight_level = &atombios_set_backlight_level,
.get_backlight_level = &atombios_get_backlight_level, .get_backlight_level = &atombios_get_backlight_level,
.hdmi_enable = &evergreen_hdmi_enable,
}, },
.copy = { .copy = {
.blit = &cik_copy_cpdma, .blit = &cik_copy_cpdma,
...@@ -2164,7 +2151,6 @@ static struct radeon_asic kv_asic = { ...@@ -2164,7 +2151,6 @@ static struct radeon_asic kv_asic = {
.wait_for_vblank = &dce4_wait_for_vblank, .wait_for_vblank = &dce4_wait_for_vblank,
.set_backlight_level = &atombios_set_backlight_level, .set_backlight_level = &atombios_set_backlight_level,
.get_backlight_level = &atombios_get_backlight_level, .get_backlight_level = &atombios_get_backlight_level,
.hdmi_enable = &evergreen_hdmi_enable,
}, },
.copy = { .copy = {
.blit = &cik_copy_cpdma, .blit = &cik_copy_cpdma,
......
...@@ -398,7 +398,6 @@ void r600_hdmi_update_ACR(struct drm_encoder *encoder, uint32_t clock); ...@@ -398,7 +398,6 @@ void r600_hdmi_update_ACR(struct drm_encoder *encoder, uint32_t clock);
void r600_hdmi_audio_workaround(struct drm_encoder *encoder); void r600_hdmi_audio_workaround(struct drm_encoder *encoder);
int r600_hdmi_buffer_status_changed(struct drm_encoder *encoder); int r600_hdmi_buffer_status_changed(struct drm_encoder *encoder);
void r600_hdmi_update_audio_settings(struct drm_encoder *encoder); void r600_hdmi_update_audio_settings(struct drm_encoder *encoder);
void r600_hdmi_enable(struct drm_encoder *encoder, bool enable);
int r600_mc_wait_for_idle(struct radeon_device *rdev); int r600_mc_wait_for_idle(struct radeon_device *rdev);
u32 r600_get_xclk(struct radeon_device *rdev); u32 r600_get_xclk(struct radeon_device *rdev);
uint64_t r600_get_gpu_clock_counter(struct radeon_device *rdev); uint64_t r600_get_gpu_clock_counter(struct radeon_device *rdev);
...@@ -536,7 +535,6 @@ struct radeon_fence *evergreen_copy_dma(struct radeon_device *rdev, ...@@ -536,7 +535,6 @@ struct radeon_fence *evergreen_copy_dma(struct radeon_device *rdev,
uint64_t src_offset, uint64_t dst_offset, uint64_t src_offset, uint64_t dst_offset,
unsigned num_gpu_pages, unsigned num_gpu_pages,
struct reservation_object *resv); struct reservation_object *resv);
void evergreen_hdmi_enable(struct drm_encoder *encoder, bool enable);
int evergreen_get_temp(struct radeon_device *rdev); int evergreen_get_temp(struct radeon_device *rdev);
int sumo_get_temp(struct radeon_device *rdev); int sumo_get_temp(struct radeon_device *rdev);
int tn_get_temp(struct radeon_device *rdev); int tn_get_temp(struct radeon_device *rdev);
......
...@@ -97,6 +97,8 @@ void dce3_2_set_mute(struct drm_encoder *encoder, u32 offset, bool mute); ...@@ -97,6 +97,8 @@ void dce3_2_set_mute(struct drm_encoder *encoder, u32 offset, bool mute);
void dce4_set_mute(struct drm_encoder *encoder, u32 offset, bool mute); void dce4_set_mute(struct drm_encoder *encoder, u32 offset, bool mute);
static void radeon_audio_hdmi_mode_set(struct drm_encoder *encoder, static void radeon_audio_hdmi_mode_set(struct drm_encoder *encoder,
struct drm_display_mode *mode); struct drm_display_mode *mode);
void r600_hdmi_enable(struct drm_encoder *encoder, bool enable);
void evergreen_hdmi_enable(struct drm_encoder *encoder, bool enable);
static const u32 pin_offsets[7] = static const u32 pin_offsets[7] =
{ {
...@@ -153,6 +155,7 @@ static struct radeon_audio_funcs r600_hdmi_funcs = { ...@@ -153,6 +155,7 @@ static struct radeon_audio_funcs r600_hdmi_funcs = {
.set_audio_packet = r600_set_audio_packet, .set_audio_packet = r600_set_audio_packet,
.set_mute = r600_set_mute, .set_mute = r600_set_mute,
.mode_set = radeon_audio_hdmi_mode_set, .mode_set = radeon_audio_hdmi_mode_set,
.dpms = r600_hdmi_enable,
}; };
static struct radeon_audio_funcs dce32_hdmi_funcs = { static struct radeon_audio_funcs dce32_hdmi_funcs = {
...@@ -166,6 +169,7 @@ static struct radeon_audio_funcs dce32_hdmi_funcs = { ...@@ -166,6 +169,7 @@ static struct radeon_audio_funcs dce32_hdmi_funcs = {
.set_audio_packet = dce3_2_set_audio_packet, .set_audio_packet = dce3_2_set_audio_packet,
.set_mute = dce3_2_set_mute, .set_mute = dce3_2_set_mute,
.mode_set = radeon_audio_hdmi_mode_set, .mode_set = radeon_audio_hdmi_mode_set,
.dpms = r600_hdmi_enable,
}; };
static struct radeon_audio_funcs dce32_dp_funcs = { static struct radeon_audio_funcs dce32_dp_funcs = {
...@@ -189,6 +193,7 @@ static struct radeon_audio_funcs dce4_hdmi_funcs = { ...@@ -189,6 +193,7 @@ static struct radeon_audio_funcs dce4_hdmi_funcs = {
.set_audio_packet = dce4_set_audio_packet, .set_audio_packet = dce4_set_audio_packet,
.set_mute = dce4_set_mute, .set_mute = dce4_set_mute,
.mode_set = radeon_audio_hdmi_mode_set, .mode_set = radeon_audio_hdmi_mode_set,
.dpms = evergreen_hdmi_enable,
}; };
static struct radeon_audio_funcs dce4_dp_funcs = { static struct radeon_audio_funcs dce4_dp_funcs = {
...@@ -214,6 +219,7 @@ static struct radeon_audio_funcs dce6_hdmi_funcs = { ...@@ -214,6 +219,7 @@ static struct radeon_audio_funcs dce6_hdmi_funcs = {
.set_audio_packet = dce4_set_audio_packet, .set_audio_packet = dce4_set_audio_packet,
.set_mute = dce4_set_mute, .set_mute = dce4_set_mute,
.mode_set = radeon_audio_hdmi_mode_set, .mode_set = radeon_audio_hdmi_mode_set,
.dpms = evergreen_hdmi_enable,
}; };
static struct radeon_audio_funcs dce6_dp_funcs = { static struct radeon_audio_funcs dce6_dp_funcs = {
...@@ -705,3 +711,11 @@ void radeon_audio_mode_set(struct drm_encoder *encoder, ...@@ -705,3 +711,11 @@ void radeon_audio_mode_set(struct drm_encoder *encoder,
if (radeon_encoder->audio && radeon_encoder->audio->mode_set) if (radeon_encoder->audio && radeon_encoder->audio->mode_set)
radeon_encoder->audio->mode_set(encoder, mode); radeon_encoder->audio->mode_set(encoder, mode);
} }
void radeon_audio_dpms(struct drm_encoder *encoder, int mode)
{
struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
if (radeon_encoder->audio && radeon_encoder->audio->dpms)
radeon_encoder->audio->dpms(encoder, mode == DRM_MODE_DPMS_ON);
}
...@@ -63,6 +63,7 @@ struct radeon_audio_funcs ...@@ -63,6 +63,7 @@ struct radeon_audio_funcs
void (*set_mute)(struct drm_encoder *encoder, u32 offset, bool mute); void (*set_mute)(struct drm_encoder *encoder, u32 offset, bool mute);
void (*mode_set)(struct drm_encoder *encoder, void (*mode_set)(struct drm_encoder *encoder,
struct drm_display_mode *mode); struct drm_display_mode *mode);
void (*dpms)(struct drm_encoder *encoder, bool mode);
}; };
int radeon_audio_init(struct radeon_device *rdev); int radeon_audio_init(struct radeon_device *rdev);
...@@ -78,5 +79,6 @@ void radeon_audio_enable(struct radeon_device *rdev, ...@@ -78,5 +79,6 @@ void radeon_audio_enable(struct radeon_device *rdev,
void radeon_audio_fini(struct radeon_device *rdev); void radeon_audio_fini(struct radeon_device *rdev);
void radeon_audio_mode_set(struct drm_encoder *encoder, void radeon_audio_mode_set(struct drm_encoder *encoder,
struct drm_display_mode *mode); struct drm_display_mode *mode);
void radeon_audio_dpms(struct drm_encoder *encoder, int mode);
#endif #endif
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