aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/i915/intel_sdvo.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index bdda08e33c3..06bc46ee22f 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -724,6 +724,7 @@ static void intel_sdvo_get_dtd_from_mode(struct intel_sdvo_dtd *dtd,
724 uint16_t width, height; 724 uint16_t width, height;
725 uint16_t h_blank_len, h_sync_len, v_blank_len, v_sync_len; 725 uint16_t h_blank_len, h_sync_len, v_blank_len, v_sync_len;
726 uint16_t h_sync_offset, v_sync_offset; 726 uint16_t h_sync_offset, v_sync_offset;
727 int mode_clock;
727 728
728 width = mode->crtc_hdisplay; 729 width = mode->crtc_hdisplay;
729 height = mode->crtc_vdisplay; 730 height = mode->crtc_vdisplay;
@@ -738,7 +739,11 @@ static void intel_sdvo_get_dtd_from_mode(struct intel_sdvo_dtd *dtd,
738 h_sync_offset = mode->crtc_hsync_start - mode->crtc_hblank_start; 739 h_sync_offset = mode->crtc_hsync_start - mode->crtc_hblank_start;
739 v_sync_offset = mode->crtc_vsync_start - mode->crtc_vblank_start; 740 v_sync_offset = mode->crtc_vsync_start - mode->crtc_vblank_start;
740 741
741 dtd->part1.clock = mode->clock / 10; 742 mode_clock = mode->clock;
743 mode_clock /= intel_mode_get_pixel_multiplier(mode) ?: 1;
744 mode_clock /= 10;
745 dtd->part1.clock = mode_clock;
746
742 dtd->part1.h_active = width & 0xff; 747 dtd->part1.h_active = width & 0xff;
743 dtd->part1.h_blank = h_blank_len & 0xff; 748 dtd->part1.h_blank = h_blank_len & 0xff;
744 dtd->part1.h_high = (((width >> 8) & 0xf) << 4) | 749 dtd->part1.h_high = (((width >> 8) & 0xf) << 4) |
@@ -990,7 +995,7 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder,
990 struct intel_sdvo *intel_sdvo = to_intel_sdvo(encoder); 995 struct intel_sdvo *intel_sdvo = to_intel_sdvo(encoder);
991 u32 sdvox; 996 u32 sdvox;
992 struct intel_sdvo_in_out_map in_out; 997 struct intel_sdvo_in_out_map in_out;
993 struct intel_sdvo_dtd input_dtd; 998 struct intel_sdvo_dtd input_dtd, output_dtd;
994 int pixel_multiplier = intel_mode_get_pixel_multiplier(adjusted_mode); 999 int pixel_multiplier = intel_mode_get_pixel_multiplier(adjusted_mode);
995 int rate; 1000 int rate;
996 1001
@@ -1015,20 +1020,13 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder,
1015 intel_sdvo->attached_output)) 1020 intel_sdvo->attached_output))
1016 return; 1021 return;
1017 1022
1018 /* We have tried to get input timing in mode_fixup, and filled into 1023 /* lvds has a special fixed output timing. */
1019 * adjusted_mode. 1024 if (intel_sdvo->is_lvds)
1020 */ 1025 intel_sdvo_get_dtd_from_mode(&output_dtd,
1021 if (intel_sdvo->is_tv || intel_sdvo->is_lvds) { 1026 intel_sdvo->sdvo_lvds_fixed_mode);
1022 input_dtd = intel_sdvo->input_dtd; 1027 else
1023 } else { 1028 intel_sdvo_get_dtd_from_mode(&output_dtd, mode);
1024 /* Set the output timing to the screen */ 1029 (void) intel_sdvo_set_output_timing(intel_sdvo, &output_dtd);
1025 if (!intel_sdvo_set_target_output(intel_sdvo,
1026 intel_sdvo->attached_output))
1027 return;
1028
1029 intel_sdvo_get_dtd_from_mode(&input_dtd, adjusted_mode);
1030 (void) intel_sdvo_set_output_timing(intel_sdvo, &input_dtd);
1031 }
1032 1030
1033 /* Set the input timing to the screen. Assume always input 0. */ 1031 /* Set the input timing to the screen. Assume always input 0. */
1034 if (!intel_sdvo_set_target_input(intel_sdvo)) 1032 if (!intel_sdvo_set_target_input(intel_sdvo))
@@ -1046,6 +1044,10 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder,
1046 !intel_sdvo_set_tv_format(intel_sdvo)) 1044 !intel_sdvo_set_tv_format(intel_sdvo))
1047 return; 1045 return;
1048 1046
1047 /* We have tried to get input timing in mode_fixup, and filled into
1048 * adjusted_mode.
1049 */
1050 intel_sdvo_get_dtd_from_mode(&input_dtd, adjusted_mode);
1049 (void) intel_sdvo_set_input_timing(intel_sdvo, &input_dtd); 1051 (void) intel_sdvo_set_input_timing(intel_sdvo, &input_dtd);
1050 1052
1051 switch (pixel_multiplier) { 1053 switch (pixel_multiplier) {