diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2011-12-07 17:32:24 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2011-12-19 13:40:26 -0500 |
commit | 69d2ae574b3a4b35e4970d8dec0bd598cfbe68a8 (patch) | |
tree | 5210cb06b6e421c24cf03391ccdd7e32c57937de /drivers | |
parent | ebcb796fa63a67ea2b7e8c023257ec6fe2813dc2 (diff) |
drm/radeon/kms: support for audio on Evergreen
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/radeon/evergreen.c | 14 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/evergreen_reg.h | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/r600_audio.c | 22 |
3 files changed, 41 insertions, 3 deletions
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index e4c384b9511..a7da8d43716 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -3069,6 +3069,12 @@ static int evergreen_startup(struct radeon_device *rdev) | |||
3069 | if (r) | 3069 | if (r) |
3070 | return r; | 3070 | return r; |
3071 | 3071 | ||
3072 | r = r600_audio_init(rdev); | ||
3073 | if (r) { | ||
3074 | DRM_ERROR("radeon: audio init failed\n"); | ||
3075 | return r; | ||
3076 | } | ||
3077 | |||
3072 | return 0; | 3078 | return 0; |
3073 | } | 3079 | } |
3074 | 3080 | ||
@@ -3100,12 +3106,19 @@ int evergreen_resume(struct radeon_device *rdev) | |||
3100 | return r; | 3106 | return r; |
3101 | } | 3107 | } |
3102 | 3108 | ||
3109 | r = r600_audio_init(rdev); | ||
3110 | if (r) { | ||
3111 | DRM_ERROR("radeon: audio resume failed\n"); | ||
3112 | return r; | ||
3113 | } | ||
3114 | |||
3103 | return r; | 3115 | return r; |
3104 | 3116 | ||
3105 | } | 3117 | } |
3106 | 3118 | ||
3107 | int evergreen_suspend(struct radeon_device *rdev) | 3119 | int evergreen_suspend(struct radeon_device *rdev) |
3108 | { | 3120 | { |
3121 | r600_audio_fini(rdev); | ||
3109 | /* FIXME: we should wait for ring to be empty */ | 3122 | /* FIXME: we should wait for ring to be empty */ |
3110 | r700_cp_stop(rdev); | 3123 | r700_cp_stop(rdev); |
3111 | rdev->cp.ready = false; | 3124 | rdev->cp.ready = false; |
@@ -3225,6 +3238,7 @@ int evergreen_init(struct radeon_device *rdev) | |||
3225 | 3238 | ||
3226 | void evergreen_fini(struct radeon_device *rdev) | 3239 | void evergreen_fini(struct radeon_device *rdev) |
3227 | { | 3240 | { |
3241 | r600_audio_fini(rdev); | ||
3228 | r600_blit_fini(rdev); | 3242 | r600_blit_fini(rdev); |
3229 | r700_cp_fini(rdev); | 3243 | r700_cp_fini(rdev); |
3230 | r600_irq_fini(rdev); | 3244 | r600_irq_fini(rdev); |
diff --git a/drivers/gpu/drm/radeon/evergreen_reg.h b/drivers/gpu/drm/radeon/evergreen_reg.h index c781c92c345..01cff84ba71 100644 --- a/drivers/gpu/drm/radeon/evergreen_reg.h +++ b/drivers/gpu/drm/radeon/evergreen_reg.h | |||
@@ -35,6 +35,14 @@ | |||
35 | #define EVERGREEN_P1PLL_SS_CNTL 0x414 | 35 | #define EVERGREEN_P1PLL_SS_CNTL 0x414 |
36 | #define EVERGREEN_P2PLL_SS_CNTL 0x454 | 36 | #define EVERGREEN_P2PLL_SS_CNTL 0x454 |
37 | # define EVERGREEN_PxPLL_SS_EN (1 << 12) | 37 | # define EVERGREEN_PxPLL_SS_EN (1 << 12) |
38 | |||
39 | #define EVERGREEN_AUDIO_PLL1_MUL 0x5b0 | ||
40 | #define EVERGREEN_AUDIO_PLL1_DIV 0x5b4 | ||
41 | #define EVERGREEN_AUDIO_PLL1_UNK 0x5bc | ||
42 | |||
43 | #define EVERGREEN_AUDIO_ENABLE 0x5e78 | ||
44 | #define EVERGREEN_AUDIO_VENDOR_ID 0x5ec0 | ||
45 | |||
38 | /* GRPH blocks at 0x6800, 0x7400, 0x10000, 0x10c00, 0x11800, 0x12400 */ | 46 | /* GRPH blocks at 0x6800, 0x7400, 0x10000, 0x10c00, 0x11800, 0x12400 */ |
39 | #define EVERGREEN_GRPH_ENABLE 0x6800 | 47 | #define EVERGREEN_GRPH_ENABLE 0x6800 |
40 | #define EVERGREEN_GRPH_CONTROL 0x6804 | 48 | #define EVERGREEN_GRPH_CONTROL 0x6804 |
diff --git a/drivers/gpu/drm/radeon/r600_audio.c b/drivers/gpu/drm/radeon/r600_audio.c index fa3bb537893..ba66f3093d4 100644 --- a/drivers/gpu/drm/radeon/r600_audio.c +++ b/drivers/gpu/drm/radeon/r600_audio.c | |||
@@ -36,7 +36,7 @@ | |||
36 | */ | 36 | */ |
37 | static int r600_audio_chipset_supported(struct radeon_device *rdev) | 37 | static int r600_audio_chipset_supported(struct radeon_device *rdev) |
38 | { | 38 | { |
39 | return (rdev->family >= CHIP_R600 && !ASIC_IS_DCE4(rdev)) | 39 | return (rdev->family >= CHIP_R600 && !ASIC_IS_DCE5(rdev)) |
40 | || rdev->family == CHIP_RS600 | 40 | || rdev->family == CHIP_RS600 |
41 | || rdev->family == CHIP_RS690 | 41 | || rdev->family == CHIP_RS690 |
42 | || rdev->family == CHIP_RS740; | 42 | || rdev->family == CHIP_RS740; |
@@ -161,8 +161,18 @@ static void r600_audio_update_hdmi(unsigned long param) | |||
161 | */ | 161 | */ |
162 | static void r600_audio_engine_enable(struct radeon_device *rdev, bool enable) | 162 | static void r600_audio_engine_enable(struct radeon_device *rdev, bool enable) |
163 | { | 163 | { |
164 | u32 value = 0; | ||
164 | DRM_INFO("%s audio support\n", enable ? "Enabling" : "Disabling"); | 165 | DRM_INFO("%s audio support\n", enable ? "Enabling" : "Disabling"); |
165 | WREG32_P(R600_AUDIO_ENABLE, enable ? 0x81000000 : 0x0, ~0x81000000); | 166 | if (ASIC_IS_DCE4(rdev)) { |
167 | if (enable) { | ||
168 | value |= 0x81000000; /* Required to enable audio */ | ||
169 | value |= 0x0e1000f0; /* fglrx sets that too */ | ||
170 | } | ||
171 | WREG32(EVERGREEN_AUDIO_ENABLE, value); | ||
172 | } else { | ||
173 | WREG32_P(R600_AUDIO_ENABLE, | ||
174 | enable ? 0x81000000 : 0x0, ~0x81000000); | ||
175 | } | ||
166 | rdev->audio_enabled = enable; | 176 | rdev->audio_enabled = enable; |
167 | } | 177 | } |
168 | 178 | ||
@@ -249,7 +259,13 @@ void r600_audio_set_clock(struct drm_encoder *encoder, int clock) | |||
249 | } | 259 | } |
250 | 260 | ||
251 | if (ASIC_IS_DCE4(rdev)) { | 261 | if (ASIC_IS_DCE4(rdev)) { |
252 | /* TODO */ | 262 | /* TODO: other PLLs? */ |
263 | WREG32(EVERGREEN_AUDIO_PLL1_MUL, base_rate * 10); | ||
264 | WREG32(EVERGREEN_AUDIO_PLL1_DIV, clock * 10); | ||
265 | WREG32(EVERGREEN_AUDIO_PLL1_UNK, 0x00000071); | ||
266 | |||
267 | /* Some magic trigger or src sel? */ | ||
268 | WREG32_P(0x5ac, 0x01, ~0x77); | ||
253 | } else { | 269 | } else { |
254 | switch (dig->dig_encoder) { | 270 | switch (dig->dig_encoder) { |
255 | case 0: | 271 | case 0: |