summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHung-Te Lin <hungte@chromium.org>2019-08-13 12:06:27 +0800
committerJulius Werner <jwerner@chromium.org>2019-08-15 03:04:08 +0000
commit6673e8ec6aa2eb558116a8ca000c3151ecb9eda2 (patch)
treefdc745b636f17005e85e1f66cd28ad259e62aebb
parente366ba14eb99c58b074dd9c31460e8165f0ecc0d (diff)
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>
-rw-r--r--src/include/edid.h1
-rw-r--r--src/lib/edid.c31
2 files changed, 16 insertions, 16 deletions
diff --git a/src/include/edid.h b/src/include/edid.h
index e5f7d98926..a97b99b579 100644
--- a/src/include/edid.h
+++ b/src/include/edid.h
@@ -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 {
diff --git a/src/lib/edid.c b/src/lib/edid.c
index 3b81b5c30a..964dce260e 100644
--- a/src/lib/edid.c
+++ b/src/lib/edid.c
@@ -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;
-
- if (isupper(extra_info.manuf_name[0]) &&
- isupper(extra_info.manuf_name[1]) &&
- isupper(extra_info.manuf_name[2]))
- return extra_info.manuf_name;
-
- return NULL;
+ 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(output[0]) &&
+ isupper(output[1]) &&
+ isupper(output[2]))
+ return 1;
+
+ 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)));