lib: edid: Move manufacturer name from private extra to public info

When debugging usually we want to print out a full identifier for panel,
that should be manufacturer and part number. Previously the edid only
contains ascii_string (which is usually the part number) but we should
export manufacturer name as well.

Change-Id: I0020fdd5b9f9331b25825876e0de4dc7e26b0464
Signed-off-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/34852
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
Hung-Te Lin 2019-08-13 12:06:27 +08:00 committed by Julius Werner
parent e366ba14eb
commit 6673e8ec6a
2 changed files with 14 additions and 14 deletions

View File

@ -95,6 +95,7 @@ struct edid {
int hdmi_monitor_detected;
char ascii_string[EDID_ASCII_STRING_LENGTH + 1];
char manufacturer_name[3 + 1];
};
enum edid_status {

View File

@ -72,7 +72,6 @@ struct edid_context {
/* Stuff that isn't used anywhere but is nice to pretty-print while
we're decoding everything else. */
static struct {
char manuf_name[4];
unsigned int model;
unsigned int serial;
unsigned int year;
@ -94,20 +93,20 @@ static struct {
static struct edid tmp_edid;
static char *manufacturer_name(unsigned char *x)
static int manufacturer_name(unsigned char *x, char *output)
{
extra_info.manuf_name[0] = ((x[0] & 0x7C) >> 2) + '@';
extra_info.manuf_name[1] = ((x[0] & 0x03) << 3) + ((x[1] & 0xE0) >> 5)
+ '@';
extra_info.manuf_name[2] = (x[1] & 0x1F) + '@';
extra_info.manuf_name[3] = 0;
output[0] = ((x[0] & 0x7C) >> 2) + '@';
output[1] = ((x[0] & 0x03) << 3) + ((x[1] & 0xE0) >> 5) + '@';
output[2] = (x[1] & 0x1F) + '@';
output[3] = 0;
if (isupper(extra_info.manuf_name[0]) &&
isupper(extra_info.manuf_name[1]) &&
isupper(extra_info.manuf_name[2]))
return extra_info.manuf_name;
if (isupper(output[0]) &&
isupper(output[1]) &&
isupper(output[2]))
return 1;
return NULL;
memset(output, 0, 4);
return 0;
}
static int
@ -1154,7 +1153,7 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
return EDID_ABSENT;
}
if (manufacturer_name(edid + 0x08))
if (manufacturer_name(edid + 0x08, out->manufacturer_name))
c.manufacturer_name_well_formed = 1;
extra_info.model = (unsigned short)(edid[0x0A] + (edid[0x0B] << 8));
@ -1162,7 +1161,7 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
+ (edid[0x0E] << 16) + (edid[0x0F] << 24));
printk(BIOS_SPEW, "Manufacturer: %s Model %x Serial Number %u\n",
extra_info.manuf_name,
out->manufacturer_name,
(unsigned short)(edid[0x0A] + (edid[0x0B] << 8)),
(unsigned int)(edid[0x0C] + (edid[0x0D] << 8)
+ (edid[0x0E] << 16) + (edid[0x0F] << 24)));