drm/i915/skl: Program the DDI buffer translation tables
authorDamien Lespiau <damien.lespiau@intel.com>
Tue, 3 Dec 2013 13:56:25 +0000 (13:56 +0000)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 24 Sep 2014 12:45:43 +0000 (14:45 +0200)
A couple of things have changed compared to Broadwell:
  - Entry 9 is used for eDP
  - No more FDI

v2: Update the translation values to latest specs.
v3: Rebase on top of the BDW HDMI translation patch
v4: Remove the low voltage edp tables,
    Rebase on top of the patch not writing the HDMI entry on eDP/FDI
    DDIs (Satheesh, Paulo).
v5: Apply the / 2 fix for the number of HDMI entries (Satheesh)
v6: Rebase on top of Jani's clean up for the DDI_BUF_TRANS tables
v7: Restore the commit message that was mangled by error

Reviewed-by: Thomas Wood <thomas.wood@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_ddi.c

index b63d4fa204a32b540529b9e49d72cb7108839190..ba1103f23e2f93473775a3616afc6fdfcebea500 100644 (file)
@@ -127,6 +127,32 @@ static const struct ddi_buf_trans bdw_ddi_translations_hdmi[] = {
        { 0x80FFFFFF, 0x001B0002 },     /* 9:   1000    1000    0       */
 };
 
+static const struct ddi_buf_trans skl_ddi_translations_dp[] = {
+       { 0x00000018, 0x000000a0 },
+       { 0x00004014, 0x00000098 },
+       { 0x00006012, 0x00000088 },
+       { 0x00008010, 0x00000080 },
+       { 0x00000018, 0x00000098 },
+       { 0x00004014, 0x00000088 },
+       { 0x00006012, 0x00000080 },
+       { 0x00000018, 0x00000088 },
+       { 0x00004014, 0x00000080 },
+};
+
+static const struct ddi_buf_trans skl_ddi_translations_hdmi[] = {
+                                       /* Idx  NT mV   T mV    db  */
+       { 0x00000018, 0x000000a0 },     /* 0:   400     400     0   */
+       { 0x00004014, 0x00000098 },     /* 1:   400     600     3.5 */
+       { 0x00006012, 0x00000088 },     /* 2:   400     800     6   */
+       { 0x00000018, 0x0000003c },     /* 3:   450     450     0   */
+       { 0x00000018, 0x00000098 },     /* 4:   600     600     0   */
+       { 0x00003015, 0x00000088 },     /* 5:   600     800     2.5 */
+       { 0x00005013, 0x00000080 },     /* 6:   600     1000    4.5 */
+       { 0x00000018, 0x00000088 },     /* 7:   800     800     0   */
+       { 0x00000096, 0x00000080 },     /* 8:   800     1000    2   */
+       { 0x00000018, 0x00000080 },     /* 9:   1200    1200    0   */
+};
+
 enum port intel_ddi_get_encoder_port(struct intel_encoder *intel_encoder)
 {
        struct drm_encoder *encoder = &intel_encoder->base;
@@ -169,7 +195,14 @@ static void intel_prepare_ddi_buffers(struct drm_device *dev, enum port port)
        const struct ddi_buf_trans *ddi_translations_hdmi;
        const struct ddi_buf_trans *ddi_translations;
 
-       if (IS_BROADWELL(dev)) {
+       if (IS_SKYLAKE(dev)) {
+               ddi_translations_fdi = NULL;
+               ddi_translations_dp = skl_ddi_translations_dp;
+               ddi_translations_edp = skl_ddi_translations_dp;
+               ddi_translations_hdmi = skl_ddi_translations_hdmi;
+               n_hdmi_entries = ARRAY_SIZE(skl_ddi_translations_hdmi);
+               hdmi_800mV_0dB = 7;
+       } else if (IS_BROADWELL(dev)) {
                ddi_translations_fdi = bdw_ddi_translations_fdi;
                ddi_translations_dp = bdw_ddi_translations_dp;
                ddi_translations_edp = bdw_ddi_translations_edp;
@@ -208,7 +241,10 @@ static void intel_prepare_ddi_buffers(struct drm_device *dev, enum port port)
                        ddi_translations = ddi_translations_dp;
                break;
        case PORT_E:
-               ddi_translations = ddi_translations_fdi;
+               if (ddi_translations_fdi)
+                       ddi_translations = ddi_translations_fdi;
+               else
+                       ddi_translations = ddi_translations_dp;
                break;
        default:
                BUG();