drm/radeon: Setup HDMI_CONTROL for hdmi deep color gcp's (v2)
authorAlex Deucher <alexander.deucher@amd.com>
Wed, 28 May 2014 23:14:36 +0000 (19:14 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 2 Jun 2014 22:37:33 +0000 (18:37 -0400)
Program HDMI_CONTROL to send general control packets
for hdmi deep color mode signalling at every video
frame if bpc > 8.

This is only supported on evergreen / DCE-4 and later.

v2: rebase

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/radeon/evergreen_hdmi.c
drivers/gpu/drm/radeon/evergreend.h

index 8579721e8971aa85f0d2d06c92b21fae7b2bbddc..b760ef52fdcda5b0d0006b1d01df5a9b1d83629d 100644 (file)
@@ -298,6 +298,7 @@ void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode
        struct hdmi_avi_infoframe frame;
        uint32_t offset;
        ssize_t err;
+       uint32_t val;
        int bpc = 8;
 
        if (!dig || !dig->afmt)
@@ -330,6 +331,35 @@ void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode
 
        WREG32(AFMT_AUDIO_CRC_CONTROL + offset, 0x1000);
 
+       val = RREG32(HDMI_CONTROL + offset);
+       val &= ~HDMI_DEEP_COLOR_ENABLE;
+       val &= ~HDMI_DEEP_COLOR_DEPTH_MASK;
+
+       switch (bpc) {
+               case 0:
+               case 6:
+               case 8:
+               case 16:
+               default:
+                       DRM_DEBUG("%s: Disabling hdmi deep color for %d bpc.\n",
+                                        drm_get_connector_name(connector), bpc);
+                       break;
+               case 10:
+                       val |= HDMI_DEEP_COLOR_ENABLE;
+                       val |= HDMI_DEEP_COLOR_DEPTH(HDMI_30BIT_DEEP_COLOR);
+                       DRM_DEBUG("%s: Enabling hdmi deep color 30 for 10 bpc.\n",
+                                        drm_get_connector_name(connector));
+                       break;
+               case 12:
+                       val |= HDMI_DEEP_COLOR_ENABLE;
+                       val |= HDMI_DEEP_COLOR_DEPTH(HDMI_36BIT_DEEP_COLOR);
+                       DRM_DEBUG("%s: Enabling hdmi deep color 36 for 12 bpc.\n",
+                                        drm_get_connector_name(connector));
+                       break;
+       }
+
+       WREG32(HDMI_CONTROL + offset, val);
+
        WREG32(HDMI_VBI_PACKET_CONTROL + offset,
               HDMI_NULL_SEND | /* send null packets when required */
               HDMI_GC_SEND | /* send general control packets */
index f9c7963b3ee6b38730cdf6d422c2b612f0d1c904..b066d6711b8df54c698650b159b49be26fd31fd7 100644 (file)
 #       define HDMI_ERROR_ACK                (1 << 8)
 #       define HDMI_ERROR_MASK               (1 << 9)
 #       define HDMI_DEEP_COLOR_ENABLE        (1 << 24)
-#       define HDMI_DEEP_COLOR_DEPTH         (((x) & 3) << 28)
+#       define HDMI_DEEP_COLOR_DEPTH(x)      (((x) & 3) << 28)
 #       define HDMI_24BIT_DEEP_COLOR         0
 #       define HDMI_30BIT_DEEP_COLOR         1
 #       define HDMI_36BIT_DEEP_COLOR         2
+#       define HDMI_DEEP_COLOR_DEPTH_MASK    (3 << 28)
 #define HDMI_STATUS                          0x7034
 #       define HDMI_ACTIVE_AVMUTE            (1 << 0)
 #       define HDMI_AUDIO_PACKET_ERROR       (1 << 16)