Commit afd4429e authored by Ville Syrjälä's avatar Ville Syrjälä

drm/edid: Define more flags

Replace a bunch of hex constants with proper definitions.
Reviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220927170006.27855-3-ville.syrjala@linux.intel.com
parent 67d7469a
...@@ -2984,7 +2984,7 @@ is_rb(const struct detailed_timing *descriptor, void *data) ...@@ -2984,7 +2984,7 @@ is_rb(const struct detailed_timing *descriptor, void *data)
BUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.data.range.formula.cvt.flags) != 15); BUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.data.range.formula.cvt.flags) != 15);
if (descriptor->data.other_data.data.range.flags == DRM_EDID_CVT_SUPPORT_FLAG && if (descriptor->data.other_data.data.range.flags == DRM_EDID_CVT_SUPPORT_FLAG &&
descriptor->data.other_data.data.range.formula.cvt.flags & 0x10) descriptor->data.other_data.data.range.formula.cvt.flags & DRM_EDID_CVT_FLAGS_REDUCED_BLANKING)
*res = true; *res = true;
} }
...@@ -3012,7 +3012,7 @@ find_gtf2(const struct detailed_timing *descriptor, void *data) ...@@ -3012,7 +3012,7 @@ find_gtf2(const struct detailed_timing *descriptor, void *data)
BUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.data.range.flags) != 10); BUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.data.range.flags) != 10);
if (descriptor->data.other_data.data.range.flags == 0x02) if (descriptor->data.other_data.data.range.flags == DRM_EDID_SECONDARY_GTF_SUPPORT_FLAG)
*res = descriptor; *res = descriptor;
} }
...@@ -3415,7 +3415,7 @@ range_pixel_clock(const struct edid *edid, const u8 *t) ...@@ -3415,7 +3415,7 @@ range_pixel_clock(const struct edid *edid, const u8 *t)
return 0; return 0;
/* 1.4 with CVT support gives us real precision, yay */ /* 1.4 with CVT support gives us real precision, yay */
if (edid->revision >= 4 && t[10] == 0x04) if (edid->revision >= 4 && t[10] == DRM_EDID_CVT_SUPPORT_FLAG)
return (t[9] * 10000) - ((t[12] >> 2) * 250); return (t[9] * 10000) - ((t[12] >> 2) * 250);
/* 1.3 is pathetic, so fuzz up a bit */ /* 1.3 is pathetic, so fuzz up a bit */
...@@ -3441,7 +3441,7 @@ static bool mode_in_range(const struct drm_display_mode *mode, ...@@ -3441,7 +3441,7 @@ static bool mode_in_range(const struct drm_display_mode *mode,
return false; return false;
/* 1.4 max horizontal check */ /* 1.4 max horizontal check */
if (edid->revision >= 4 && t[10] == 0x04) if (edid->revision >= 4 && t[10] == DRM_EDID_CVT_SUPPORT_FLAG)
if (t[13] && mode->hdisplay > 8 * (t[13] + (256 * (t[12]&0x3)))) if (t[13] && mode->hdisplay > 8 * (t[13] + (256 * (t[12]&0x3))))
return false; return false;
...@@ -3581,13 +3581,13 @@ do_inferred_modes(const struct detailed_timing *timing, void *c) ...@@ -3581,13 +3581,13 @@ do_inferred_modes(const struct detailed_timing *timing, void *c)
return; /* GTF not defined yet */ return; /* GTF not defined yet */
switch (range->flags) { switch (range->flags) {
case 0x02: /* secondary gtf, XXX could do more */ case DRM_EDID_SECONDARY_GTF_SUPPORT_FLAG: /* XXX could do more */
case 0x00: /* default gtf */ case DRM_EDID_DEFAULT_GTF_SUPPORT_FLAG:
closure->modes += drm_gtf_modes_for_range(closure->connector, closure->modes += drm_gtf_modes_for_range(closure->connector,
closure->drm_edid, closure->drm_edid,
timing); timing);
break; break;
case 0x04: /* cvt, only in 1.4+ */ case DRM_EDID_CVT_SUPPORT_FLAG:
if (!version_greater(closure->drm_edid, 1, 3)) if (!version_greater(closure->drm_edid, 1, 3))
break; break;
...@@ -3595,7 +3595,7 @@ do_inferred_modes(const struct detailed_timing *timing, void *c) ...@@ -3595,7 +3595,7 @@ do_inferred_modes(const struct detailed_timing *timing, void *c)
closure->drm_edid, closure->drm_edid,
timing); timing);
break; break;
case 0x01: /* just the ranges, no formula */ case DRM_EDID_RANGE_LIMITS_ONLY_FLAG:
default: default:
break; break;
} }
...@@ -6402,7 +6402,7 @@ static int _drm_edid_connector_update(struct drm_connector *connector, ...@@ -6402,7 +6402,7 @@ static int _drm_edid_connector_update(struct drm_connector *connector,
num_modes += add_cea_modes(connector, drm_edid); num_modes += add_cea_modes(connector, drm_edid);
num_modes += add_alternate_cea_modes(connector, drm_edid); num_modes += add_alternate_cea_modes(connector, drm_edid);
num_modes += add_displayid_detailed_modes(connector, drm_edid); num_modes += add_displayid_detailed_modes(connector, drm_edid);
if (drm_edid->edid->features & DRM_EDID_FEATURE_DEFAULT_GTF) if (drm_edid->edid->features & DRM_EDID_FEATURE_CONTINUOUS_FREQ)
num_modes += add_inferred_modes(connector, drm_edid); num_modes += add_inferred_modes(connector, drm_edid);
if (quirks & (EDID_QUIRK_PREFER_LARGE_60 | EDID_QUIRK_PREFER_LARGE_75)) if (quirks & (EDID_QUIRK_PREFER_LARGE_60 | EDID_QUIRK_PREFER_LARGE_75))
......
...@@ -92,10 +92,13 @@ struct detailed_data_string { ...@@ -92,10 +92,13 @@ struct detailed_data_string {
u8 str[13]; u8 str[13];
} __attribute__((packed)); } __attribute__((packed));
#define DRM_EDID_DEFAULT_GTF_SUPPORT_FLAG 0x00 #define DRM_EDID_DEFAULT_GTF_SUPPORT_FLAG 0x00 /* 1.3 */
#define DRM_EDID_RANGE_LIMITS_ONLY_FLAG 0x01 #define DRM_EDID_RANGE_LIMITS_ONLY_FLAG 0x01 /* 1.4 */
#define DRM_EDID_SECONDARY_GTF_SUPPORT_FLAG 0x02 #define DRM_EDID_SECONDARY_GTF_SUPPORT_FLAG 0x02 /* 1.3 */
#define DRM_EDID_CVT_SUPPORT_FLAG 0x04 #define DRM_EDID_CVT_SUPPORT_FLAG 0x04 /* 1.4 */
#define DRM_EDID_CVT_FLAGS_STANDARD_BLANKING (1 << 3)
#define DRM_EDID_CVT_FLAGS_REDUCED_BLANKING (1 << 4)
struct detailed_data_monitor_range { struct detailed_data_monitor_range {
u8 min_vfreq; u8 min_vfreq;
...@@ -201,7 +204,8 @@ struct detailed_timing { ...@@ -201,7 +204,8 @@ struct detailed_timing {
#define DRM_EDID_DIGITAL_TYPE_DP (5 << 0) /* 1.4 */ #define DRM_EDID_DIGITAL_TYPE_DP (5 << 0) /* 1.4 */
#define DRM_EDID_DIGITAL_DFP_1_X (1 << 0) /* 1.3 */ #define DRM_EDID_DIGITAL_DFP_1_X (1 << 0) /* 1.3 */
#define DRM_EDID_FEATURE_DEFAULT_GTF (1 << 0) #define DRM_EDID_FEATURE_DEFAULT_GTF (1 << 0) /* 1.2 */
#define DRM_EDID_FEATURE_CONTINUOUS_FREQ (1 << 0) /* 1.4 */
#define DRM_EDID_FEATURE_PREFERRED_TIMING (1 << 1) #define DRM_EDID_FEATURE_PREFERRED_TIMING (1 << 1)
#define DRM_EDID_FEATURE_STANDARD_COLOR (1 << 2) #define DRM_EDID_FEATURE_STANDARD_COLOR (1 << 2)
/* If analog */ /* If analog */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment