[Bug,101900] No HDMI HBR audio on Polaris (no TrueHD, no Atmos, no Neo:X, no HD Master audio) and static noise in sound when LPCM
diff mbox

Message ID bug-101900-502-GKkKQb5eTL@http.bugs.freedesktop.org/
State New
Headers show

Commit Message

bugzilla-daemon@freedesktop.org Jan. 12, 2018, 11:48 a.m. UTC
https://bugs.freedesktop.org/show_bug.cgi?id=101900

--- Comment #21 from Direx <direx@betriebsdirektor.de> ---
Alex, thanks a lot for taking a look at this. I also think that everything is
already in place and just a tiny piece is missing or going wrong (with a big
impact though). I'd like to help you sort that out.

(In reply to Alex Deucher from comment #20)
> Can you add some debugging output to dce_aud_az_configure() to see why it
> may not be getting enabled in your case?  Specifically see if
> is_audio_format_supported() is failing for HBR formats and why and see if
> set_high_bit_rate_capable() is getting enabled.

OK, I've hacked my kernel (4.15-rc7) like this (sorry for the noobish print
debugging):

                                AZALIA_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR0 +
format_index,

But as far as I understand this code is only run once when initializing the
GPU, not when playing back audio. Below is my dmesg output, please let me know
if this is useful or if you need additional information. I had only attached
one dislplay for this capture (my AVR). It looks like TrueHD and DTS-HD are
properly marked as "supported".


[   17.027288] fbcon: amdgpudrmfb (fb0) is primary device
[   17.050864] [drm] {3840x2160, 4400x2250@594000Khz}
[   17.050976] hbrlog: audio codec is supported
[   17.050977] hbrlog: audio codec is supported
[   17.050977] hbrlog: audio codec unsupported
[   17.050977] hbrlog: audio codec unsupported
[   17.050978] hbrlog: audio codec unsupported
[   17.050978] hbrlog: audio codec unsupported
[   17.050978] hbrlog: audio codec is supported
[   17.050978] hbrlog: audio codec unsupported
[   17.050979] hbrlog: audio codec is supported
[   17.050979] hbrlog: DTS-HD detected
[   17.050979] hbrlog: TrueHD/MLP detected
[   17.050979] hbrlog: DST detected
[   17.050979] hbrlog: vendor_specific
[   17.050980] hbrlog: audio codec is supported
[   17.050980] hbrlog: DTS-HD detected
[   17.050980] hbrlog: TrueHD/MLP detected
[   17.050980] hbrlog: DST detected
[   17.050980] hbrlog: vendor_specific
[   17.050980] hbrlog: audio codec is supported
[   17.050980] hbrlog: TrueHD/MLP detected
[   17.050981] hbrlog: DST detected
[   17.050981] hbrlog: vendor_specific
[   17.050981] hbrlog: WMAPRO unsupported
[   17.050981] hbrlog: HBR capable is enabled
[   17.067921] Console: switching to colour frame buffer device 480x135
[   17.078529] amdgpu 0000:01:00.0: fb0: amdgpudrmfb frame buffer device
[   17.104099] amdgpu 0000:01:00.0: kfd not supported on this ASIC
[   17.104114] [drm] Initialized amdgpu 3.23.0 20150101 for 0000:01:00.0 on
minor 0
[   17.194239] IPv6: ADDRCONF(NETDEV_UP): enp3s0: link is not ready
[   17.302047] r8169 0000:03:00.0 enp3s0: link down
[   17.302049] r8169 0000:03:00.0 enp3s0: link down
[   17.302087] IPv6: ADDRCONF(NETDEV_UP): enp3s0: link is not ready
[   17.968392] [drm] {1920x1080, 2200x1125@148500Khz}
[   18.001320] hbrlog: audio codec is supported
[   18.001320] hbrlog: audio codec is supported
[   18.001321] hbrlog: audio codec unsupported
[   18.001321] hbrlog: audio codec unsupported
[   18.001322] hbrlog: audio codec unsupported
[   18.001322] hbrlog: audio codec unsupported
[   18.001322] hbrlog: audio codec is supported
[   18.001323] hbrlog: audio codec unsupported
[   18.001323] hbrlog: audio codec is supported
[   18.001323] hbrlog: DTS-HD detected
[   18.001324] hbrlog: TrueHD/MLP detected
[   18.001324] hbrlog: DST detected
[   18.001324] hbrlog: vendor_specific
[   18.001325] hbrlog: audio codec is supported
[   18.001325] hbrlog: DTS-HD detected
[   18.001325] hbrlog: TrueHD/MLP detected
[   18.001325] hbrlog: DST detected
[   18.001325] hbrlog: vendor_specific
[   18.001326] hbrlog: audio codec is supported
[   18.001326] hbrlog: TrueHD/MLP detected
[   18.001326] hbrlog: DST detected
[   18.001326] hbrlog: vendor_specific
[   18.001327] hbrlog: WMAPRO unsupported
[   18.001327] hbrlog: HBR capable is enabled
[   19.580261] r8169 0000:03:00.0 enp3s0: link up
[   19.580266] IPv6: ADDRCONF(NETDEV_CHANGE): enp3s0: link becomes ready

Patch
diff mbox

diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c
b/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c
index 0df9ecb2710c..1c9e5b0a3f39 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c
@@ -291,7 +291,12 @@  static void set_high_bit_rate_capable(
        struct audio *audio,
        bool capable)
 {
-       uint32_t value = 0;
+    if (capable)
+        printk(KERN_WARNING "hbrlog: HBR capable is enabled");
+    else
+        printk(KERN_WARNING "hbrlog: HBR cabable is disabled");
+
+    uint32_t value = 0;

        /* set high bit rate audio capable*/
        value = AZ_REG_READ(AZALIA_F0_CODEC_PIN_CONTROL_RESPONSE_HBR);
@@ -499,6 +504,9 @@  void dce_aud_az_configure(
                /* check if supported */
                if (is_audio_format_supported(
                                audio_info, audio_format_code, &index)) {
+
+            printk(KERN_WARNING "hbrlog: audio codec is supported");
+
                        const struct audio_mode *audio_mode =
                                        &audio_info->modes[index];
                        union audio_sample_rates sample_rates =
@@ -527,9 +535,13 @@  void dce_aud_az_configure(
                                break;
                        case AUDIO_FORMAT_CODE_DOLBYDIGITALPLUS:
                        case AUDIO_FORMAT_CODE_DTS_HD:
+                printk(KERN_WARNING "hbrlog: DTS-HD detected");
                        case AUDIO_FORMAT_CODE_MAT_MLP:
-                       case AUDIO_FORMAT_CODE_DST:
+                printk(KERN_WARNING "hbrlog: TrueHD/MLP detected");
+            case AUDIO_FORMAT_CODE_DST:
+                printk(KERN_WARNING "hbrlog: DST detected");
                        case AUDIO_FORMAT_CODE_WMAPRO:
+                printk(KERN_WARNING "hbrlog: vendor_specific");
                                byte2 = audio_mode->vendor_specific;
                                break;
                        default:
@@ -551,7 +563,35 @@  void dce_aud_az_configure(
                                        byte2,
                                       
AZALIA_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR0,
                                        DESCRIPTOR_BYTE_2);
-               } /* if */
+               } else {
+            /* unsupported audio codec */
+                       switch (audio_format_code) {
+                       case AUDIO_FORMAT_CODE_LINEARPCM:
+                printk(KERN_WARNING "hbrlog: PCM unsupported");
+                               break;
+                       case AUDIO_FORMAT_CODE_AC3:
+                printk(KERN_WARNING "hbrlog: AC3 unsupported");
+                               break;
+                       case AUDIO_FORMAT_CODE_DOLBYDIGITALPLUS:
+                printk(KERN_WARNING "hbrlog: DD+ unsupported");
+                break;
+            case AUDIO_FORMAT_CODE_DTS_HD:
+                printk(KERN_WARNING "hbrlog: DTS-HD unsupported");
+                break;
+                       case AUDIO_FORMAT_CODE_MAT_MLP:
+                printk(KERN_WARNING "hbrlog: TrueHD/MLP unsupported");
+                break;
+            case AUDIO_FORMAT_CODE_DST:
+                printk(KERN_WARNING "hbrlog: DST unsupported");
+                break;
+                       case AUDIO_FORMAT_CODE_WMAPRO:
+                printk(KERN_WARNING "hbrlog: WMAPRO unsupported");
+                               break;
+                       default:
+                printk(KERN_WARNING "hbrlog: audio codec unsupported");
+                               break;
+                       }
+        }

                AZ_REG_WRITE(