Subversion Repositories Kolibri OS

Rev

Rev 2004 | Rev 3031 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2004 Rev 2160
Line 126... Line 126...
126
static const u8 edid_header[] = {
126
static const u8 edid_header[] = {
127
	0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00
127
	0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00
128
};
128
};
Line 129... Line 129...
129
 
129
 
-
 
130
 /*
-
 
131
 * Sanity check the header of the base EDID block.  Return 8 if the header
-
 
132
 * is perfect, down to 0 if it's totally wrong.
-
 
133
 */
-
 
134
int drm_edid_header_is_valid(const u8 *raw_edid)
-
 
135
{
-
 
136
	int i, score = 0;
-
 
137
 
-
 
138
	for (i = 0; i < sizeof(edid_header); i++)
-
 
139
		if (raw_edid[i] == edid_header[i])
-
 
140
			score++;
-
 
141
 
-
 
142
	return score;
-
 
143
}
-
 
144
EXPORT_SYMBOL(drm_edid_header_is_valid);
-
 
145
 
-
 
146
 
130
/*
147
/*
131
 * Sanity check the EDID block (base or extension).  Return 0 if the block
148
 * Sanity check the EDID block (base or extension).  Return 0 if the block
132
 * doesn't check out, or 1 if it's valid.
149
 * doesn't check out, or 1 if it's valid.
133
 */
150
 */
134
static bool
151
static bool
Line 137... Line 154...
137
	int i;
154
	int i;
138
	u8 csum = 0;
155
	u8 csum = 0;
139
	struct edid *edid = (struct edid *)raw_edid;
156
	struct edid *edid = (struct edid *)raw_edid;
Line 140... Line 157...
140
 
157
 
141
	if (raw_edid[0] == 0x00) {
-
 
142
		int score = 0;
-
 
143
 
-
 
144
	for (i = 0; i < sizeof(edid_header); i++)
158
	if (raw_edid[0] == 0x00) {
145
		if (raw_edid[i] == edid_header[i])
-
 
146
			score++;
-
 
147
 
159
		int score = drm_edid_header_is_valid(raw_edid);
148
	if (score == 8) ;
160
	if (score == 8) ;
149
	else if (score >= 6) {
161
	else if (score >= 6) {
150
		DRM_DEBUG("Fixing EDID header, your hardware may be failing\n");
162
		DRM_DEBUG("Fixing EDID header, your hardware may be failing\n");
151
		memcpy(raw_edid, edid_header, sizeof(edid_header));
163
		memcpy(raw_edid, edid_header, sizeof(edid_header));
Line 184... Line 196...
184
 
196
 
185
bad:
197
bad:
186
	if (raw_edid) {
198
	if (raw_edid) {
187
		printk(KERN_ERR "Raw EDID:\n");
199
		printk(KERN_ERR "Raw EDID:\n");
188
//       print_hex_dump_bytes(KERN_ERR, DUMP_PREFIX_NONE, raw_edid, EDID_LENGTH);
-
 
189
		printk(KERN_ERR "\n");
200
//		print_hex_dump_bytes(KERN_ERR, DUMP_PREFIX_NONE, raw_edid, EDID_LENGTH);
190
	}
201
	}
191
	return 0;
202
	return 0;
Line 192... Line 203...
192
}
203
}
Line 1447... Line 1458...
1447
 * color spaces.
1458
 * color spaces.
1448
 */
1459
 */
1449
static void drm_add_display_info(struct edid *edid,
1460
static void drm_add_display_info(struct edid *edid,
1450
				 struct drm_display_info *info)
1461
				 struct drm_display_info *info)
1451
{
1462
{
-
 
1463
	u8 *edid_ext;
-
 
1464
 
1452
	info->width_mm = edid->width_cm * 10;
1465
	info->width_mm = edid->width_cm * 10;
1453
	info->height_mm = edid->height_cm * 10;
1466
	info->height_mm = edid->height_cm * 10;
Line 1454... Line 1467...
1454
 
1467
 
1455
	/* driver figures it out in this case */
1468
	/* driver figures it out in this case */
Line 1491... Line 1504...
1491
	info->color_formats = DRM_COLOR_FORMAT_RGB444;
1504
	info->color_formats = DRM_COLOR_FORMAT_RGB444;
1492
	if (info->color_formats & DRM_EDID_FEATURE_RGB_YCRCB444)
1505
	if (info->color_formats & DRM_EDID_FEATURE_RGB_YCRCB444)
1493
		info->color_formats = DRM_COLOR_FORMAT_YCRCB444;
1506
		info->color_formats = DRM_COLOR_FORMAT_YCRCB444;
1494
	if (info->color_formats & DRM_EDID_FEATURE_RGB_YCRCB422)
1507
	if (info->color_formats & DRM_EDID_FEATURE_RGB_YCRCB422)
1495
		info->color_formats = DRM_COLOR_FORMAT_YCRCB422;
1508
		info->color_formats = DRM_COLOR_FORMAT_YCRCB422;
-
 
1509
 
-
 
1510
	/* Get data from CEA blocks if present */
-
 
1511
	edid_ext = drm_find_cea_extension(edid);
-
 
1512
	if (!edid_ext)
-
 
1513
		return;
-
 
1514
 
-
 
1515
	info->cea_rev = edid_ext[1];
1496
}
1516
}
Line 1497... Line 1517...
1497
 
1517
 
1498
/**
1518
/**
1499
 * drm_add_edid_modes - add modes from EDID data, if available
1519
 * drm_add_edid_modes - add modes from EDID data, if available