Merge branch 'omap-boards' into omap-for-linus
[pandora-kernel.git] / drivers / gpu / drm / radeon / radeon_legacy_encoders.c
index cf389ce..0274abe 100644 (file)
@@ -228,16 +228,8 @@ static bool radeon_legacy_mode_fixup(struct drm_encoder *encoder,
        drm_mode_set_crtcinfo(adjusted_mode, 0);
 
        /* get the native mode for LVDS */
-       if (radeon_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT)) {
-               struct drm_display_mode *native_mode = &radeon_encoder->native_mode;
-               int mode_id = adjusted_mode->base.id;
-               *adjusted_mode = *native_mode;
-               adjusted_mode->hdisplay = mode->hdisplay;
-               adjusted_mode->vdisplay = mode->vdisplay;
-               adjusted_mode->crtc_hdisplay = mode->hdisplay;
-               adjusted_mode->crtc_vdisplay = mode->vdisplay;
-               adjusted_mode->base.id = mode_id;
-       }
+       if (radeon_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT))
+               radeon_panel_mode_fixup(encoder, adjusted_mode);
 
        return true;
 }
@@ -830,8 +822,8 @@ static void radeon_legacy_tv_dac_dpms(struct drm_encoder *encoder, int mode)
                                crtc2_gen_cntl &= ~RADEON_CRTC2_CRT2_ON;
 
                        if (rdev->family == CHIP_R420 ||
-                                       rdev->family == CHIP_R423 ||
-                                       rdev->family == CHIP_RV410)
+                           rdev->family == CHIP_R423 ||
+                           rdev->family == CHIP_RV410)
                                tv_dac_cntl |= (R420_TV_DAC_RDACPD |
                                                R420_TV_DAC_GDACPD |
                                                R420_TV_DAC_BDACPD |
@@ -907,35 +899,43 @@ static void radeon_legacy_tv_dac_mode_set(struct drm_encoder *encoder,
        if (rdev->family != CHIP_R200) {
                tv_dac_cntl = RREG32(RADEON_TV_DAC_CNTL);
                if (rdev->family == CHIP_R420 ||
-                               rdev->family == CHIP_R423 ||
-                               rdev->family == CHIP_RV410) {
+                   rdev->family == CHIP_R423 ||
+                   rdev->family == CHIP_RV410) {
                        tv_dac_cntl &= ~(RADEON_TV_DAC_STD_MASK |
-                                       RADEON_TV_DAC_BGADJ_MASK |
-                                       R420_TV_DAC_DACADJ_MASK |
-                                       R420_TV_DAC_RDACPD |
-                                       R420_TV_DAC_GDACPD |
-                                       R420_TV_DAC_BDACPD |
-                                       R420_TV_DAC_TVENABLE);
+                                        RADEON_TV_DAC_BGADJ_MASK |
+                                        R420_TV_DAC_DACADJ_MASK |
+                                        R420_TV_DAC_RDACPD |
+                                        R420_TV_DAC_GDACPD |
+                                        R420_TV_DAC_BDACPD |
+                                        R420_TV_DAC_TVENABLE);
                } else {
                        tv_dac_cntl &= ~(RADEON_TV_DAC_STD_MASK |
-                                       RADEON_TV_DAC_BGADJ_MASK |
-                                       RADEON_TV_DAC_DACADJ_MASK |
-                                       RADEON_TV_DAC_RDACPD |
-                                       RADEON_TV_DAC_GDACPD |
-                                       RADEON_TV_DAC_BDACPD);
+                                        RADEON_TV_DAC_BGADJ_MASK |
+                                        RADEON_TV_DAC_DACADJ_MASK |
+                                        RADEON_TV_DAC_RDACPD |
+                                        RADEON_TV_DAC_GDACPD |
+                                        RADEON_TV_DAC_BDACPD);
                }
 
-               /*  FIXME TV */
-               if (tv_dac) {
-                       struct radeon_encoder_tv_dac *tv_dac = radeon_encoder->enc_priv;
-                       tv_dac_cntl |= (RADEON_TV_DAC_NBLANK |
-                                       RADEON_TV_DAC_NHOLD |
-                                       RADEON_TV_DAC_STD_PS2 |
-                                       tv_dac->ps2_tvdac_adj);
+               tv_dac_cntl |= RADEON_TV_DAC_NBLANK | RADEON_TV_DAC_NHOLD;
+
+               if (is_tv) {
+                       if (tv_dac->tv_std == TV_STD_NTSC ||
+                           tv_dac->tv_std == TV_STD_NTSC_J ||
+                           tv_dac->tv_std == TV_STD_PAL_M ||
+                           tv_dac->tv_std == TV_STD_PAL_60)
+                               tv_dac_cntl |= tv_dac->ntsc_tvdac_adj;
+                       else
+                               tv_dac_cntl |= tv_dac->pal_tvdac_adj;
+
+                       if (tv_dac->tv_std == TV_STD_NTSC ||
+                           tv_dac->tv_std == TV_STD_NTSC_J)
+                               tv_dac_cntl |= RADEON_TV_DAC_STD_NTSC;
+                       else
+                               tv_dac_cntl |= RADEON_TV_DAC_STD_PAL;
                } else
-                       tv_dac_cntl |= (RADEON_TV_DAC_NBLANK |
-                                       RADEON_TV_DAC_NHOLD |
-                                       RADEON_TV_DAC_STD_PS2);
+                       tv_dac_cntl |= (RADEON_TV_DAC_STD_PS2 |
+                                       tv_dac->ps2_tvdac_adj);
 
                WREG32(RADEON_TV_DAC_CNTL, tv_dac_cntl);
        }