aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/drm_edid.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index aa70da86ef2c..ba68ff94d3b3 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -2930,11 +2930,15 @@ cea_mode_alternate_timings(u8 vic, struct drm_display_mode *mode)
2930static u8 drm_match_cea_mode_clock_tolerance(const struct drm_display_mode *to_match, 2930static u8 drm_match_cea_mode_clock_tolerance(const struct drm_display_mode *to_match,
2931 unsigned int clock_tolerance) 2931 unsigned int clock_tolerance)
2932{ 2932{
2933 unsigned int match_flags = DRM_MODE_MATCH_TIMINGS | DRM_MODE_MATCH_FLAGS;
2933 u8 vic; 2934 u8 vic;
2934 2935
2935 if (!to_match->clock) 2936 if (!to_match->clock)
2936 return 0; 2937 return 0;
2937 2938
2939 if (to_match->picture_aspect_ratio)
2940 match_flags |= DRM_MODE_MATCH_ASPECT_RATIO;
2941
2938 for (vic = 1; vic < ARRAY_SIZE(edid_cea_modes); vic++) { 2942 for (vic = 1; vic < ARRAY_SIZE(edid_cea_modes); vic++) {
2939 struct drm_display_mode cea_mode = edid_cea_modes[vic]; 2943 struct drm_display_mode cea_mode = edid_cea_modes[vic];
2940 unsigned int clock1, clock2; 2944 unsigned int clock1, clock2;
@@ -2948,7 +2952,7 @@ static u8 drm_match_cea_mode_clock_tolerance(const struct drm_display_mode *to_m
2948 continue; 2952 continue;
2949 2953
2950 do { 2954 do {
2951 if (drm_mode_equal_no_clocks_no_stereo(to_match, &cea_mode)) 2955 if (drm_mode_match(to_match, &cea_mode, match_flags))
2952 return vic; 2956 return vic;
2953 } while (cea_mode_alternate_timings(vic, &cea_mode)); 2957 } while (cea_mode_alternate_timings(vic, &cea_mode));
2954 } 2958 }
@@ -2965,11 +2969,15 @@ static u8 drm_match_cea_mode_clock_tolerance(const struct drm_display_mode *to_m
2965 */ 2969 */
2966u8 drm_match_cea_mode(const struct drm_display_mode *to_match) 2970u8 drm_match_cea_mode(const struct drm_display_mode *to_match)
2967{ 2971{
2972 unsigned int match_flags = DRM_MODE_MATCH_TIMINGS | DRM_MODE_MATCH_FLAGS;
2968 u8 vic; 2973 u8 vic;
2969 2974
2970 if (!to_match->clock) 2975 if (!to_match->clock)
2971 return 0; 2976 return 0;
2972 2977
2978 if (to_match->picture_aspect_ratio)
2979 match_flags |= DRM_MODE_MATCH_ASPECT_RATIO;
2980
2973 for (vic = 1; vic < ARRAY_SIZE(edid_cea_modes); vic++) { 2981 for (vic = 1; vic < ARRAY_SIZE(edid_cea_modes); vic++) {
2974 struct drm_display_mode cea_mode = edid_cea_modes[vic]; 2982 struct drm_display_mode cea_mode = edid_cea_modes[vic];
2975 unsigned int clock1, clock2; 2983 unsigned int clock1, clock2;
@@ -2983,7 +2991,7 @@ u8 drm_match_cea_mode(const struct drm_display_mode *to_match)
2983 continue; 2991 continue;
2984 2992
2985 do { 2993 do {
2986 if (drm_mode_equal_no_clocks_no_stereo(to_match, &cea_mode)) 2994 if (drm_mode_match(to_match, &cea_mode, match_flags))
2987 return vic; 2995 return vic;
2988 } while (cea_mode_alternate_timings(vic, &cea_mode)); 2996 } while (cea_mode_alternate_timings(vic, &cea_mode));
2989 } 2997 }
@@ -3030,6 +3038,7 @@ hdmi_mode_alternate_clock(const struct drm_display_mode *hdmi_mode)
3030static u8 drm_match_hdmi_mode_clock_tolerance(const struct drm_display_mode *to_match, 3038static u8 drm_match_hdmi_mode_clock_tolerance(const struct drm_display_mode *to_match,
3031 unsigned int clock_tolerance) 3039 unsigned int clock_tolerance)
3032{ 3040{
3041 unsigned int match_flags = DRM_MODE_MATCH_TIMINGS | DRM_MODE_MATCH_FLAGS;
3033 u8 vic; 3042 u8 vic;
3034 3043
3035 if (!to_match->clock) 3044 if (!to_match->clock)
@@ -3047,7 +3056,7 @@ static u8 drm_match_hdmi_mode_clock_tolerance(const struct drm_display_mode *to_
3047 abs(to_match->clock - clock2) > clock_tolerance) 3056 abs(to_match->clock - clock2) > clock_tolerance)
3048 continue; 3057 continue;
3049 3058
3050 if (drm_mode_equal_no_clocks_no_stereo(to_match, hdmi_mode)) 3059 if (drm_mode_match(to_match, hdmi_mode, match_flags))
3051 return vic; 3060 return vic;
3052 } 3061 }
3053 3062
@@ -3064,6 +3073,7 @@ static u8 drm_match_hdmi_mode_clock_tolerance(const struct drm_display_mode *to_
3064 */ 3073 */
3065static u8 drm_match_hdmi_mode(const struct drm_display_mode *to_match) 3074static u8 drm_match_hdmi_mode(const struct drm_display_mode *to_match)
3066{ 3075{
3076 unsigned int match_flags = DRM_MODE_MATCH_TIMINGS | DRM_MODE_MATCH_FLAGS;
3067 u8 vic; 3077 u8 vic;
3068 3078
3069 if (!to_match->clock) 3079 if (!to_match->clock)
@@ -3079,7 +3089,7 @@ static u8 drm_match_hdmi_mode(const struct drm_display_mode *to_match)
3079 3089
3080 if ((KHZ2PICOS(to_match->clock) == KHZ2PICOS(clock1) || 3090 if ((KHZ2PICOS(to_match->clock) == KHZ2PICOS(clock1) ||
3081 KHZ2PICOS(to_match->clock) == KHZ2PICOS(clock2)) && 3091 KHZ2PICOS(to_match->clock) == KHZ2PICOS(clock2)) &&
3082 drm_mode_equal_no_clocks_no_stereo(to_match, hdmi_mode)) 3092 drm_mode_match(to_match, hdmi_mode, match_flags))
3083 return vic; 3093 return vic;
3084 } 3094 }
3085 return 0; 3095 return 0;