Skip to contentSkip to conversation

drm/radeon/audio: don't hardcode CRTC id

PATCH In review Rafał Miłecki 3 participants 4 messages Jun 4, 2012 – Jun 5, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/radeon/audio: don't hardcode CRTC id

This is based on info released by AMD, should allow using audio in much more cases.

---
 drivers/gpu/drm/radeon/r600_audio.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/r600_audio.c +3 -2
index 7c4fa77..7479a5c 100644
@@ -192,6 +192,7 @@ void r600_audio_set_clock(struct drm_encoder *encoder, int clock)
 	struct radeon_device *rdev = dev->dev_private;
 	struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
 	struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
+	struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc);
 	int base_rate = 48000;
 
 	switch (radeon_encoder->encoder_id) {
@@ -217,8 +218,8 @@ void r600_audio_set_clock(struct drm_encoder *encoder, int clock)
 		WREG32(EVERGREEN_AUDIO_PLL1_DIV, clock * 10);
 		WREG32(EVERGREEN_AUDIO_PLL1_UNK, 0x00000071);
 
-		/* Some magic trigger or src sel? */
-		WREG32_P(0x5ac, 0x01, ~0x77);
+		/* Select DTO source */
+		WREG32(0x5ac, radeon_crtc->crtc_id);
 	} else {
 		switch (dig->dig_encoder) {
 		case 0:
Signature · 6 lines
1.7.7

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Rafał Miłecki

This is based on info released by AMD, should allow using audio in much more cases.

Quoted 26 lines

---
 drivers/gpu/drm/radeon/r600_audio.c |    5 +++--

 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/r600_audio.c +3 -2
index 7c4fa77..7479a5c 100644
@@ -192,6 +192,7 @@ void r600_audio_set_clock(struct drm_encoder *encoder, int clock)
        struct radeon_device *rdev = dev->dev_private;
        struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
        struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
+       struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc);
        int base_rate = 48000;
 
        switch (radeon_encoder->encoder_id) {
@@ -217,8 +218,8 @@ void r600_audio_set_clock(struct drm_encoder *encoder, int clock)
                WREG32(EVERGREEN_AUDIO_PLL1_DIV, clock * 10);
                WREG32(EVERGREEN_AUDIO_PLL1_UNK, 0x00000071);
 
-               /* Some magic trigger or src sel? */
-               WREG32_P(0x5ac, 0x01, ~0x77);
+               /* Select DTO source */
+               WREG32(0x5ac, radeon_crtc->crtc_id);
        } else {
                switch (dig->dig_encoder) {
Quoted 4 lines

               case 0:
--
1.7.7

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

Reviewed-by
#2 lore raw
Quoted 7 lines · Alex Deucher
Quoted 5 lines · Rafał Miłecki

This is based on info released by AMD, should allow using audio in much more cases.

Not sure if the definition is available on older kernels, but try to replace "0x5ac" with something more meaningfully if possible. Otherwise also:

Quoted 21 lines
Quoted 21 lines
---
  drivers/gpu/drm/radeon/r600_audio.c |    5 +++--
  1 files changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/r600_audio.c +1 -0
index 7c4fa77..7479a5c 100644
@@ -192,6 +192,7 @@ void r600_audio_set_clock(struct drm_encoder *encoder, int clock)
        struct radeon_device *rdev = dev->dev_private;
        struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
        struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
+       struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc);
        int base_rate = 48000;
 
        switch (radeon_encoder->encoder_id) {
@@ -217,8 +218,8 @@ void r600_audio_set_clock(struct drm_encoder *encoder, int clock)
                WREG32(EVERGREEN_AUDIO_PLL1_DIV, clock * 10);
                WREG32(EVERGREEN_AUDIO_PLL1_UNK, 0x00000071);
 
Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/radeon/r600_audio.c +2 -3
-               /* Some magic trigger or src sel? */
-               WREG32_P(0x5ac, 0x01, ~0x77);
+               /* Select DTO source */
+               WREG32(0x5ac, radeon_crtc->crtc_id);
        } else {
                switch (dig->dig_encoder) {
                case 0:
--

1.7.7

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw

2012/6/5 Christian König <[email protected]>:

Quoted 7 lines · Alex Deucher
Quoted 6 lines · Rafał Miłecki
Quoted 4 lines

This is based on info released by AMD, should allow using audio in much more cases.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

Not sure if the definition is available on older kernels, but try to replace "0x5ac" with something more meaningfully if possible. Otherwise also:

Not available for old kernels unfortunately. This part of code will require rewriting anyway, DTO is slightly more complicated in programming than I though. For example on some newer cards re-writing current value seems to change something (fixes playback speed for me).

I'll keep in mind using defines in the future. Promise ;)

Signature · 5 lines
Rafał
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel