[coreboot-gerrit] New patch to review for coreboot: lib/edid.c: Reformat code

Paul Menzel (paulepanter@users.sourceforge.net) gerrit at coreboot.org
Tue Nov 29 22:05:33 CET 2016


Paul Menzel (paulepanter at users.sourceforge.net) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17643

-gerrit

commit 7ea91cbd7d44f10b4117d7fc1cc8f1e8b5cde1b5
Author: Paul Menzel <paulepanter at users.sourceforge.net>
Date:   Tue Nov 29 20:55:14 2016 +0100

    lib/edid.c: Reformat code
    
    Run the file through GNU indent 2.2.11 (switch `-linux`), so that the
    file follows the coreboot coding style.
    
    Change-Id: I3c0a3d707abf99e05314eae1120d5be1447193f3
    Signed-off-by: Paul Menzel <paulepanter at users.sourceforge.net>
---
 src/lib/edid.c | 995 +++++++++++++++++++++++++++++++++------------------------
 1 file changed, 583 insertions(+), 412 deletions(-)

diff --git a/src/lib/edid.c b/src/lib/edid.c
index d1b9c9f..23b6503 100644
--- a/src/lib/edid.c
+++ b/src/lib/edid.c
@@ -100,7 +100,8 @@ static struct lb_framebuffer edid_fb;
 static char *manufacturer_name(unsigned char *x)
 {
 	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[1] =
+	    ((x[0] & 0x03) << 3) + ((x[1] & 0xE0) >> 5) + '@';
 	extra_info.manuf_name[2] = (x[1] & 0x1F) + '@';
 	extra_info.manuf_name[3] = 0;
 
@@ -112,8 +113,7 @@ static char *manufacturer_name(unsigned char *x)
 	return NULL;
 }
 
-static int
-detailed_cvt_descriptor(unsigned char *x, int first)
+static int detailed_cvt_descriptor(unsigned char *x, int first)
 {
 	const unsigned char empty[3] = { 0, 0, 0 };
 	const char *names[] = { "50", "60", "75", "85" };
@@ -131,13 +131,17 @@ detailed_cvt_descriptor(unsigned char *x, int first)
 
 	switch (x[1] & 0x0c) {
 	case 0x00:
-		width = (height * 4) / 3; break;
+		width = (height * 4) / 3;
+		break;
 	case 0x04:
-		width = (height * 16) / 9; break;
+		width = (height * 16) / 9;
+		break;
 	case 0x08:
-		width = (height * 16) / 10; break;
+		width = (height * 16) / 10;
+		break;
 	case 0x0c:
-		width = (height * 15) / 9; break;
+		width = (height * 15) / 9;
+		break;
 	}
 
 	if (x[1] & 0x03)
@@ -147,23 +151,20 @@ detailed_cvt_descriptor(unsigned char *x, int first)
 	if (!(x[2] & 0x1f))
 		valid = 0;
 
-	fifty	= (x[2] & 0x10);
-	sixty	= (x[2] & 0x08);
+	fifty = (x[2] & 0x10);
+	sixty = (x[2] & 0x08);
 	seventyfive = (x[2] & 0x04);
-	eightyfive  = (x[2] & 0x02);
-	reduced	= (x[2] & 0x01);
+	eightyfive = (x[2] & 0x02);
+	reduced = (x[2] & 0x01);
 
 	if (!valid) {
 		printk(BIOS_SPEW, "    (broken)\n");
 	} else {
-		printk(BIOS_SPEW, "    %dx%d @ ( %s%s%s%s%s) Hz (%s%s preferred)\n",
-		       width, height,
-		       fifty ? "50 " : "",
-		       sixty ? "60 " : "",
-		       seventyfive ? "75 " : "",
-		       eightyfive ? "85 " : "",
-		       reduced ? "60RB " : "",
-		       names[(x[2] & 0x60) >> 5],
+		printk(BIOS_SPEW,
+		       "    %dx%d @ ( %s%s%s%s%s) Hz (%s%s preferred)\n", width,
+		       height, fifty ? "50 " : "", sixty ? "60 " : "",
+		       seventyfive ? "75 " : "", eightyfive ? "85 " : "",
+		       reduced ? "60RB " : "", names[(x[2] & 0x60) >> 5],
 		       (((x[2] & 0x60) == 0x20) && reduced) ? "RB" : "");
 	}
 
@@ -173,8 +174,7 @@ detailed_cvt_descriptor(unsigned char *x, int first)
 /* extract a CP437 string from a detailed subblock, checking for termination (if
  * less than len of bytes) with LF and padded with SP.
  */
-static char *
-extract_string(unsigned char *x, int *valid_termination, int len)
+static char *extract_string(unsigned char *x, int *valid_termination, int len)
 {
 	static char ret[128];
 	int i, seen_newline = 0;
@@ -219,13 +219,15 @@ detailed_block(struct edid *result_edid, unsigned char *x, int in_extension,
 		/* Monitor descriptor block, not detailed timing descriptor. */
 		if (x[2] != 0) {
 			/* 1.3, 3.10.3 */
-			printk(BIOS_SPEW, "Monitor descriptor block has byte 2 nonzero (0x%02x)\n",
+			printk(BIOS_SPEW,
+			       "Monitor descriptor block has byte 2 nonzero (0x%02x)\n",
 			       x[2]);
 			c->has_valid_descriptor_pad = 0;
 		}
 		if (x[3] != 0xfd && x[4] != 0x00) {
 			/* 1.3, 3.10.3 */
-			printk(BIOS_SPEW, "Monitor descriptor block has byte 4 nonzero (0x%02x)\n",
+			printk(BIOS_SPEW,
+			       "Monitor descriptor block has byte 4 nonzero (0x%02x)\n",
 			       x[4]);
 			c->has_valid_descriptor_pad = 0;
 		}
@@ -237,7 +239,8 @@ detailed_block(struct edid *result_edid, unsigned char *x, int in_extension,
 			 * 0x0f seems to be common in laptop panels.
 			 * 0x0e is used by EPI: http://www.epi-standard.org/
 			 */
-			printk(BIOS_SPEW, "Manufacturer-specified data, tag %d\n", x[3]);
+			printk(BIOS_SPEW,
+			       "Manufacturer-specified data, tag %d\n", x[3]);
 			return 1;
 		}
 		switch (x[3]) {
@@ -252,18 +255,22 @@ detailed_block(struct edid *result_edid, unsigned char *x, int in_extension,
 			printk(BIOS_SPEW, "Established timings III\n");
 			return 1;
 		case 0xF8:
-		{
-			int valid_cvt = 1; /* just this block */
-			printk(BIOS_SPEW, "CVT 3-byte code descriptor:\n");
-			if (x[5] != 0x01) {
-				c->has_valid_cvt = 0;
-				return 0;
+			{
+				int valid_cvt = 1;	/* just this block */
+				printk(BIOS_SPEW,
+				       "CVT 3-byte code descriptor:\n");
+				if (x[5] != 0x01) {
+					c->has_valid_cvt = 0;
+					return 0;
+				}
+				for (i = 0; i < 4; i++)
+					valid_cvt &=
+					    detailed_cvt_descriptor(x + 6 +
+								    (i * 3),
+								    (i == 0));
+				c->has_valid_cvt &= valid_cvt;
+				return 1;
 			}
-			for (i = 0; i < 4; i++)
-				valid_cvt &= detailed_cvt_descriptor(x + 6 + (i * 3), (i == 0));
-			c->has_valid_cvt &= valid_cvt;
-			return 1;
-		}
 		case 0xF9:
 			/* TODO */
 			printk(BIOS_SPEW, "Color management data\n");
@@ -283,165 +290,209 @@ detailed_block(struct edid *result_edid, unsigned char *x, int in_extension,
 					      13));
 			return 1;
 		case 0xFD:
-		{
-			int h_max_offset = 0, h_min_offset = 0;
-			int v_max_offset = 0, v_min_offset = 0;
-			int is_cvt = 0;
-			c->has_range_descriptor = 1;
-			extra_info.range_class = "";
-			/*
-			 * XXX todo: implement feature flags, vtd blocks
-			 * XXX check: ranges are well-formed; block termination if no vtd
-			 */
-			if (c->claims_one_point_four) {
-				if (x[4] & 0x02) {
-					v_max_offset = 255;
-					if (x[4] & 0x01) {
-						v_min_offset = 255;
+			{
+				int h_max_offset = 0, h_min_offset = 0;
+				int v_max_offset = 0, v_min_offset = 0;
+				int is_cvt = 0;
+				c->has_range_descriptor = 1;
+				extra_info.range_class = "";
+				/*
+				 * XXX todo: implement feature flags, vtd blocks
+				 * XXX check: ranges are well-formed; block termination if no vtd
+				 */
+				if (c->claims_one_point_four) {
+					if (x[4] & 0x02) {
+						v_max_offset = 255;
+						if (x[4] & 0x01) {
+							v_min_offset = 255;
+						}
 					}
-				}
-				if (x[4] & 0x04) {
-					h_max_offset = 255;
-					if (x[4] & 0x03) {
-						h_min_offset = 255;
+					if (x[4] & 0x04) {
+						h_max_offset = 255;
+						if (x[4] & 0x03) {
+							h_min_offset = 255;
+						}
 					}
+				} else if (x[4]) {
+					c->has_valid_range_descriptor = 0;
 				}
-			} else if (x[4]) {
-				c->has_valid_range_descriptor = 0;
-			}
 
-			/*
-			 * despite the values, this is not a bitfield.
-			 */
-			switch (x[10]) {
-			case 0x00: /* default gtf */
-				extra_info.range_class = "GTF";
-				break;
-			case 0x01: /* range limits only */
-				extra_info.range_class = "bare limits";
-				if (!c->claims_one_point_four)
-					c->has_valid_range_descriptor = 0;
-				break;
-			case 0x02: /* secondary gtf curve */
-				extra_info.range_class = "GTF with icing";
-				break;
-			case 0x04: /* cvt */
-				extra_info.range_class = "CVT";
-				is_cvt = 1;
-				if (!c->claims_one_point_four)
+				/*
+				 * despite the values, this is not a bitfield.
+				 */
+				switch (x[10]) {
+				case 0x00:	/* default gtf */
+					extra_info.range_class = "GTF";
+					break;
+				case 0x01:	/* range limits only */
+					extra_info.range_class = "bare limits";
+					if (!c->claims_one_point_four)
+						c->has_valid_range_descriptor =
+						    0;
+					break;
+				case 0x02:	/* secondary gtf curve */
+					extra_info.range_class =
+					    "GTF with icing";
+					break;
+				case 0x04:	/* cvt */
+					extra_info.range_class = "CVT";
+					is_cvt = 1;
+					if (!c->claims_one_point_four)
+						c->has_valid_range_descriptor =
+						    0;
+					break;
+				default:	/* invalid */
 					c->has_valid_range_descriptor = 0;
-				break;
-			default: /* invalid */
-				c->has_valid_range_descriptor = 0;
-				extra_info.range_class = "invalid";
-				break;
-			}
-
-			if (x[5] + v_min_offset > x[6] + v_max_offset)
-				c->has_valid_range_descriptor = 0;
-			if (x[7] + h_min_offset > x[8] + h_max_offset)
-				c->has_valid_range_descriptor = 0;
-			printk(BIOS_SPEW, "Monitor ranges (%s): %d-%dHz V, %d-%dkHz H",
-			       extra_info.range_class,
-			       x[5] + v_min_offset, x[6] + v_max_offset,
-			       x[7] + h_min_offset, x[8] + h_max_offset);
-			if (x[9])
-				printk(BIOS_SPEW, ", max dotclock %dMHz\n", x[9] * 10);
-			else {
-				if (c->claims_one_point_four)
-					c->has_valid_max_dotclock = 0;
-				printk(BIOS_SPEW, "\n");
-			}
-
-			if (is_cvt) {
-				int max_h_pixels = 0;
-
-				printk(BIOS_SPEW, "CVT version %d.%d\n", x[11] & 0xf0 >> 4, x[11] & 0x0f);
-
-				if (x[12] & 0xfc) {
-					int raw_offset = (x[12] & 0xfc) >> 2;
-					printk(BIOS_SPEW, "Real max dotclock: %dKHz\n",
-					       (x[9] * 10000) - (raw_offset * 250));
-					if (raw_offset >= 40)
-						c->warning_excessive_dotclock_correction = 1;
+					extra_info.range_class = "invalid";
+					break;
 				}
 
-				max_h_pixels = x[12] & 0x03;
-				max_h_pixels <<= 8;
-				max_h_pixels |= x[13];
-				max_h_pixels *= 8;
-				if (max_h_pixels)
-					printk(BIOS_SPEW, "Max active pixels per line: %d\n", max_h_pixels);
-
-				printk(BIOS_SPEW, "Supported aspect ratios: %s %s %s %s %s\n",
-				       x[14] & 0x80 ? "4:3" : "",
-				       x[14] & 0x40 ? "16:9" : "",
-				       x[14] & 0x20 ? "16:10" : "",
-				       x[14] & 0x10 ? "5:4" : "",
-				       x[14] & 0x08 ? "15:9" : "");
-				if (x[14] & 0x07)
+				if (x[5] + v_min_offset > x[6] + v_max_offset)
 					c->has_valid_range_descriptor = 0;
-
-				printk(BIOS_SPEW, "Preferred aspect ratio: ");
-				switch((x[15] & 0xe0) >> 5) {
-				case 0x00: printk(BIOS_SPEW, "4:3"); break;
-				case 0x01: printk(BIOS_SPEW, "16:9"); break;
-				case 0x02: printk(BIOS_SPEW, "16:10"); break;
-				case 0x03: printk(BIOS_SPEW, "5:4"); break;
-				case 0x04: printk(BIOS_SPEW, "15:9"); break;
-				default: printk(BIOS_SPEW, "(broken)"); break;
+				if (x[7] + h_min_offset > x[8] + h_max_offset)
+					c->has_valid_range_descriptor = 0;
+				printk(BIOS_SPEW,
+				       "Monitor ranges (%s): %d-%dHz V, %d-%dkHz H",
+				       extra_info.range_class,
+				       x[5] + v_min_offset, x[6] + v_max_offset,
+				       x[7] + h_min_offset,
+				       x[8] + h_max_offset);
+				if (x[9])
+					printk(BIOS_SPEW,
+					       ", max dotclock %dMHz\n",
+					       x[9] * 10);
+				else {
+					if (c->claims_one_point_four)
+						c->has_valid_max_dotclock = 0;
+					printk(BIOS_SPEW, "\n");
 				}
-				printk(BIOS_SPEW, "\n");
 
-				if (x[15] & 0x04)
-					printk(BIOS_SPEW, "Supports CVT standard blanking\n");
-				if (x[15] & 0x10)
-					printk(BIOS_SPEW, "Supports CVT reduced blanking\n");
+				if (is_cvt) {
+					int max_h_pixels = 0;
+
+					printk(BIOS_SPEW, "CVT version %d.%d\n",
+					       x[11] & 0xf0 >> 4, x[11] & 0x0f);
+
+					if (x[12] & 0xfc) {
+						int raw_offset =
+						    (x[12] & 0xfc) >> 2;
+						printk(BIOS_SPEW,
+						       "Real max dotclock: %dKHz\n",
+						       (x[9] * 10000) -
+						       (raw_offset * 250));
+						if (raw_offset >= 40)
+							c->warning_excessive_dotclock_correction = 1;
+					}
 
-				if (x[15] & 0x07)
-					c->has_valid_range_descriptor = 0;
+					max_h_pixels = x[12] & 0x03;
+					max_h_pixels <<= 8;
+					max_h_pixels |= x[13];
+					max_h_pixels *= 8;
+					if (max_h_pixels)
+						printk(BIOS_SPEW,
+						       "Max active pixels per line: %d\n",
+						       max_h_pixels);
+
+					printk(BIOS_SPEW,
+					       "Supported aspect ratios: %s %s %s %s %s\n",
+					       x[14] & 0x80 ? "4:3" : "",
+					       x[14] & 0x40 ? "16:9" : "",
+					       x[14] & 0x20 ? "16:10" : "",
+					       x[14] & 0x10 ? "5:4" : "",
+					       x[14] & 0x08 ? "15:9" : "");
+					if (x[14] & 0x07)
+						c->has_valid_range_descriptor =
+						    0;
+
+					printk(BIOS_SPEW,
+					       "Preferred aspect ratio: ");
+					switch ((x[15] & 0xe0) >> 5) {
+					case 0x00:
+						printk(BIOS_SPEW, "4:3");
+						break;
+					case 0x01:
+						printk(BIOS_SPEW, "16:9");
+						break;
+					case 0x02:
+						printk(BIOS_SPEW, "16:10");
+						break;
+					case 0x03:
+						printk(BIOS_SPEW, "5:4");
+						break;
+					case 0x04:
+						printk(BIOS_SPEW, "15:9");
+						break;
+					default:
+						printk(BIOS_SPEW, "(broken)");
+						break;
+					}
+					printk(BIOS_SPEW, "\n");
 
-				if (x[16] & 0xf0) {
-					printk(BIOS_SPEW, "Supported display scaling:\n");
-					if (x[16] & 0x80)
-						printk(BIOS_SPEW, "    Horizontal shrink\n");
-					if (x[16] & 0x40)
-						printk(BIOS_SPEW, "    Horizontal stretch\n");
-					if (x[16] & 0x20)
-						printk(BIOS_SPEW, "    Vertical shrink\n");
-					if (x[16] & 0x10)
-						printk(BIOS_SPEW, "    Vertical stretch\n");
-				}
+					if (x[15] & 0x04)
+						printk(BIOS_SPEW,
+						       "Supports CVT standard blanking\n");
+					if (x[15] & 0x10)
+						printk(BIOS_SPEW,
+						       "Supports CVT reduced blanking\n");
+
+					if (x[15] & 0x07)
+						c->has_valid_range_descriptor =
+						    0;
+
+					if (x[16] & 0xf0) {
+						printk(BIOS_SPEW,
+						       "Supported display scaling:\n");
+						if (x[16] & 0x80)
+							printk(BIOS_SPEW,
+							       "    Horizontal shrink\n");
+						if (x[16] & 0x40)
+							printk(BIOS_SPEW,
+							       "    Horizontal stretch\n");
+						if (x[16] & 0x20)
+							printk(BIOS_SPEW,
+							       "    Vertical shrink\n");
+						if (x[16] & 0x10)
+							printk(BIOS_SPEW,
+							       "    Vertical stretch\n");
+					}
 
-				if (x[16] & 0x0f)
-					c->has_valid_range_descriptor = 0;
+					if (x[16] & 0x0f)
+						c->has_valid_range_descriptor =
+						    0;
 
-				if (x[17])
-					printk(BIOS_SPEW, "Preferred vertical refresh: %d Hz\n", x[17]);
-				else
-					c->warning_zero_preferred_refresh = 1;
-			}
+					if (x[17])
+						printk(BIOS_SPEW,
+						       "Preferred vertical refresh: %d Hz\n",
+						       x[17]);
+					else
+						c->warning_zero_preferred_refresh = 1;
+				}
 
-			/*
-			 * Slightly weird to return a global, but I've never seen any
-			 * EDID block wth two range descriptors, so it's harmless.
-			 */
-			return 1;
-		}
+				/*
+				 * Slightly weird to return a global, but I've never seen any
+				 * EDID block wth two range descriptors, so it's harmless.
+				 */
+				return 1;
+			}
 		case 0xFE:
 			/*
 			 * TODO: Two of these in a row, in the third and fourth slots,
 			 * seems to be specified by SPWG: http://www.spwg.org/
 			 */
 			printk(BIOS_SPEW, "ASCII string: %s\n",
-			       extract_string(x + 5, &c->has_valid_string_termination, 13));
+			       extract_string(x + 5,
+					      &c->has_valid_string_termination,
+					      13));
 			return 1;
 		case 0xFF:
 			printk(BIOS_SPEW, "Serial number: %s\n",
-			       extract_string(x + 5, &c->has_valid_string_termination, 13));
+			       extract_string(x + 5,
+					      &c->has_valid_string_termination,
+					      13));
 			return 1;
 		default:
-			printk(BIOS_SPEW, "Unknown monitor description type %d\n", x[3]);
+			printk(BIOS_SPEW,
+			       "Unknown monitor description type %d\n", x[3]);
 			return 0;
 		}
 	}
@@ -453,18 +504,18 @@ detailed_block(struct edid *result_edid, unsigned char *x, int in_extension,
 	/* Edid contains pixel clock in terms of 10KHz */
 	out->mode.pixel_clock = (x[0] + (x[1] << 8)) * 10;
 	/*
-	  LVDS supports following pixel clocks
-	  25000...112000 kHz: single channel
-	  80000...224000 kHz: dual channel
-	  There is some overlap in theoretically supported
-	  pixel clock between single-channel and dual-channel.
-	  In practice with current panels all panels
-	  <= 75200 kHz: single channel
-	  >= 97750 kHz: dual channel
-	  We have no samples between those values, so put a
-	  threshold at 95000 kHz. If we get anything over
-	  95000 kHz with single channel, we can make this
-	  more sofisticated but it's currently not needed.
+	   LVDS supports following pixel clocks
+	   25000...112000 kHz: single channel
+	   80000...224000 kHz: dual channel
+	   There is some overlap in theoretically supported
+	   pixel clock between single-channel and dual-channel.
+	   In practice with current panels all panels
+	   <= 75200 kHz: single channel
+	   >= 97750 kHz: dual channel
+	   We have no samples between those values, so put a
+	   threshold at 95000 kHz. If we get anything over
+	   95000 kHz with single channel, we can make this
+	   more sofisticated but it's currently not needed.
 	 */
 	out->mode.lvds_dual_channel = (out->mode.pixel_clock >= 95000);
 	extra_info.x_mm = (x[12] + ((x[14] & 0xF0) << 4));
@@ -530,24 +581,22 @@ detailed_block(struct edid *result_edid, unsigned char *x, int in_extension,
 		break;
 	}
 
-	printk(BIOS_SPEW, "Detailed mode (IN HEX): Clock %d KHz, %x mm x %x mm\n"
+	printk(BIOS_SPEW,
+	       "Detailed mode (IN HEX): Clock %d KHz, %x mm x %x mm\n"
 	       "               %04x %04x %04x %04x hborder %x\n"
 	       "               %04x %04x %04x %04x vborder %x\n"
-	       "               %chsync %cvsync%s%s %s\n",
-	       out->mode.pixel_clock,
-	       extra_info.x_mm,
-	       extra_info.y_mm,
-	       out->mode.ha, out->mode.ha + out->mode.hso,
+	       "               %chsync %cvsync%s%s %s\n", out->mode.pixel_clock,
+	       extra_info.x_mm, extra_info.y_mm, out->mode.ha,
+	       out->mode.ha + out->mode.hso,
 	       out->mode.ha + out->mode.hso + out->mode.hspw,
-	       out->mode.ha + out->mode.hbl, out->mode.hborder,
-	       out->mode.va, out->mode.va + out->mode.vso,
+	       out->mode.ha + out->mode.hbl, out->mode.hborder, out->mode.va,
+	       out->mode.va + out->mode.vso,
 	       out->mode.va + out->mode.vso + out->mode.vspw,
 	       out->mode.va + out->mode.vbl, out->mode.vborder,
-	       out->mode.phsync, out->mode.pvsync,
-	       extra_info.syncmethod, x[17] & 0x80 ?" interlaced" : "",
-	       extra_info.stereo);
+	       out->mode.phsync, out->mode.pvsync, extra_info.syncmethod,
+	       x[17] & 0x80 ? " interlaced" : "", extra_info.stereo);
 
-	if (! c->did_detailed_timing) {
+	if (!c->did_detailed_timing) {
 		printk(BIOS_SPEW, "Did detailed timing\n");
 		c->did_detailed_timing = 1;
 		*result_edid = *out;
@@ -556,8 +605,7 @@ detailed_block(struct edid *result_edid, unsigned char *x, int in_extension,
 	return 1;
 }
 
-static int
-do_checksum(unsigned char *x)
+static int do_checksum(unsigned char *x)
 {
 	int valid = 0;
 	printk(BIOS_SPEW, "Checksum: 0x%hhx", x[0x7f]);
@@ -567,7 +615,8 @@ do_checksum(unsigned char *x)
 		for (i = 0; i < 128; i++)
 			sum += x[i];
 		if (sum) {
-			printk(BIOS_SPEW, " (should be 0x%hhx)", (unsigned char)(x[0x7f] - sum));
+			printk(BIOS_SPEW, " (should be 0x%hhx)",
+			       (unsigned char)(x[0x7f] - sum));
 		} else {
 			valid = 1;
 			printk(BIOS_SPEW, " (valid)");
@@ -579,32 +628,46 @@ do_checksum(unsigned char *x)
 
 /* CEA extension */
 
-static const char *
-audio_format(unsigned char x)
+static const char *audio_format(unsigned char x)
 {
 	switch (x) {
-	case 0: return "RESERVED";
-	case 1: return "Linear PCM";
-	case 2: return "AC-3";
-	case 3: return "MPEG 1 (Layers 1 & 2)";
-	case 4: return "MPEG 1 Layer 3 (MP3)";
-	case 5: return "MPEG2 (multichannel)";
-	case 6: return "AAC";
-	case 7: return "DTS";
-	case 8: return "ATRAC";
-	case 9: return "One Bit Audio";
-	case 10: return "Dolby Digital+";
-	case 11: return "DTS-HD";
-	case 12: return "MAT (MLP)";
-	case 13: return "DST";
-	case 14: return "WMA Pro";
-	case 15: return "RESERVED";
+	case 0:
+		return "RESERVED";
+	case 1:
+		return "Linear PCM";
+	case 2:
+		return "AC-3";
+	case 3:
+		return "MPEG 1 (Layers 1 & 2)";
+	case 4:
+		return "MPEG 1 Layer 3 (MP3)";
+	case 5:
+		return "MPEG2 (multichannel)";
+	case 6:
+		return "AAC";
+	case 7:
+		return "DTS";
+	case 8:
+		return "ATRAC";
+	case 9:
+		return "One Bit Audio";
+	case 10:
+		return "Dolby Digital+";
+	case 11:
+		return "DTS-HD";
+	case 12:
+		return "MAT (MLP)";
+	case 13:
+		return "DST";
+	case 14:
+		return "WMA Pro";
+	case 15:
+		return "RESERVED";
 	}
-	return "BROKEN"; /* can't happen */
+	return "BROKEN";	/* can't happen */
 }
 
-static void
-cea_audio_block(unsigned char *x)
+static void cea_audio_block(unsigned char *x)
 {
 	int i, format;
 	int length = x[0] & 0x1f;
@@ -617,40 +680,41 @@ cea_audio_block(unsigned char *x)
 
 	for (i = 1; i < length; i += 3) {
 		format = (x[i] & 0x78) >> 3;
-		printk(BIOS_SPEW, "    %s, max channels %d\n", audio_format(format),
-		       x[i] & 0x07);
-		printk(BIOS_SPEW, "    Supported sample rates (kHz):%s%s%s%s%s%s%s\n",
-		       (x[i+1] & 0x40) ? " 192" : "",
-		       (x[i+1] & 0x20) ? " 176.4" : "",
-		       (x[i+1] & 0x10) ? " 96" : "",
-		       (x[i+1] & 0x08) ? " 88.2" : "",
-		       (x[i+1] & 0x04) ? " 48" : "",
-		       (x[i+1] & 0x02) ? " 44.1" : "",
-		       (x[i+1] & 0x01) ? " 32" : "");
+		printk(BIOS_SPEW, "    %s, max channels %d\n",
+		       audio_format(format), x[i] & 0x07);
+		printk(BIOS_SPEW,
+		       "    Supported sample rates (kHz):%s%s%s%s%s%s%s\n",
+		       (x[i + 1] & 0x40) ? " 192" : "",
+		       (x[i + 1] & 0x20) ? " 176.4" : "",
+		       (x[i + 1] & 0x10) ? " 96" : "",
+		       (x[i + 1] & 0x08) ? " 88.2" : "",
+		       (x[i + 1] & 0x04) ? " 48" : "",
+		       (x[i + 1] & 0x02) ? " 44.1" : "",
+		       (x[i + 1] & 0x01) ? " 32" : "");
 		if (format == 1) {
-			printk(BIOS_SPEW, "    Supported sample sizes (bits):%s%s%s\n",
+			printk(BIOS_SPEW,
+			       "    Supported sample sizes (bits):%s%s%s\n",
 			       (x[2] & 0x04) ? " 24" : "",
 			       (x[2] & 0x02) ? " 20" : "",
 			       (x[2] & 0x01) ? " 16" : "");
 		} else if (format <= 8) {
-			printk(BIOS_SPEW, "    Maximum bit rate: %d kHz\n", x[2] * 8);
+			printk(BIOS_SPEW, "    Maximum bit rate: %d kHz\n",
+			       x[2] * 8);
 		}
 	}
 }
 
-static void
-cea_video_block(unsigned char *x)
+static void cea_video_block(unsigned char *x)
 {
 	int i;
 	int length = x[0] & 0x1f;
 
 	for (i = 1; i < length; i++)
-		printk(BIOS_SPEW,"    VIC %02d %s\n", x[i] & 0x7f,
+		printk(BIOS_SPEW, "    VIC %02d %s\n", x[i] & 0x7f,
 		       x[i] & 0x80 ? "(native)" : "");
 }
 
-static void
-cea_hdmi_block(struct edid *out, unsigned char *x)
+static void cea_hdmi_block(struct edid *out, unsigned char *x)
 {
 	int length = x[0] & 0x1f;
 
@@ -691,8 +755,10 @@ cea_hdmi_block(struct edid *out, unsigned char *x)
 		}
 
 		if (x[8] & 0x40) {
-			printk(BIOS_SPEW, "    Interlaced video latency: %d\n", x[9 + b]);
-			printk(BIOS_SPEW, "    Interlaced audio latency: %d\n", x[10 + b]);
+			printk(BIOS_SPEW, "    Interlaced video latency: %d\n",
+			       x[9 + b]);
+			printk(BIOS_SPEW, "    Interlaced audio latency: %d\n",
+			       x[10 + b]);
 			b += 2;
 		}
 
@@ -703,24 +769,30 @@ cea_hdmi_block(struct edid *out, unsigned char *x)
 			if (x[9 + b] & 0x80)
 				printk(BIOS_SPEW, "      3D present\n");
 			if ((x[9 + b] & 0x60) == 0x20) {
-				printk(BIOS_SPEW, "      All advertised VICs are 3D-capable\n");
+				printk(BIOS_SPEW,
+				       "      All advertised VICs are 3D-capable\n");
 				formats = 1;
 			}
 			if ((x[9 + b] & 0x60) == 0x40) {
-				printk(BIOS_SPEW, "      3D-capable-VIC mask present\n");
+				printk(BIOS_SPEW,
+				       "      3D-capable-VIC mask present\n");
 				formats = 1;
 				mask = 1;
 			}
 			switch (x[9 + b] & 0x18) {
-			case 0x00: break;
+			case 0x00:
+				break;
 			case 0x08:
-				printk(BIOS_SPEW, "      Base EDID image size is aspect ratio\n");
+				printk(BIOS_SPEW,
+				       "      Base EDID image size is aspect ratio\n");
 				break;
 			case 0x10:
-				printk(BIOS_SPEW, "      Base EDID image size is in units of 1cm\n");
+				printk(BIOS_SPEW,
+				       "      Base EDID image size is in units of 1cm\n");
 				break;
 			case 0x18:
-				printk(BIOS_SPEW, "      Base EDID image size is in units of 5cm\n");
+				printk(BIOS_SPEW,
+				       "      Base EDID image size is in units of 5cm\n");
 				break;
 			}
 			len_xx = (x[10 + b] & 0xe0) >> 5;
@@ -728,7 +800,8 @@ cea_hdmi_block(struct edid *out, unsigned char *x)
 			b += 2;
 
 			if (len_xx) {
-				printk(BIOS_SPEW, "      Skipping %d bytes that HDMI refuses to publicly"
+				printk(BIOS_SPEW,
+				       "      Skipping %d bytes that HDMI refuses to publicly"
 				       " document\n", len_xx);
 				b += len_xx;
 			}
@@ -736,23 +809,29 @@ cea_hdmi_block(struct edid *out, unsigned char *x)
 			if (len_3d) {
 				if (formats) {
 					if (x[9 + b] & 0x01)
-						printk(BIOS_SPEW, "      Side-by-side 3D supported\n");
+						printk(BIOS_SPEW,
+						       "      Side-by-side 3D supported\n");
 					if (x[10 + b] & 0x40)
-						printk(BIOS_SPEW, "      Top-and-bottom 3D supported\n");
+						printk(BIOS_SPEW,
+						       "      Top-and-bottom 3D supported\n");
 					if (x[10 + b] & 0x01)
-						printk(BIOS_SPEW, "      Frame-packing 3D supported\n");
+						printk(BIOS_SPEW,
+						       "      Frame-packing 3D supported\n");
 					b += 2;
 				}
 				if (mask) {
 					int i;
-					printk(BIOS_SPEW, "      3D VIC indices:");
+					printk(BIOS_SPEW,
+					       "      3D VIC indices:");
 					/* worst bit ordering ever */
 					for (i = 0; i < 8; i++)
 						if (x[10 + b] & (1 << i))
-							printk(BIOS_SPEW, " %d", i);
+							printk(BIOS_SPEW, " %d",
+							       i);
 					for (i = 0; i < 8; i++)
 						if (x[9 + b] & (1 << i))
-							printk(BIOS_SPEW, " %d", i + 8);
+							printk(BIOS_SPEW, " %d",
+							       i + 8);
 					printk(BIOS_SPEW, "\n");
 					b += 2;
 				}
@@ -769,8 +848,7 @@ cea_hdmi_block(struct edid *out, unsigned char *x)
 	}
 }
 
-static void
-cea_block(struct edid *out, unsigned char *x)
+static void cea_block(struct edid *out, unsigned char *x)
 {
 	unsigned int oui;
 
@@ -786,7 +864,8 @@ cea_block(struct edid *out, unsigned char *x)
 	case 0x03:
 		/* yes really, endianness lols */
 		oui = (x[3] << 16) + (x[2] << 8) + x[1];
-		printk(BIOS_SPEW, "  Vendor-specific data block, OUI %06x", oui);
+		printk(BIOS_SPEW, "  Vendor-specific data block, OUI %06x",
+		       oui);
 		if (oui == 0x000c03)
 			cea_hdmi_block(out, x);
 		else
@@ -808,7 +887,8 @@ cea_block(struct edid *out, unsigned char *x)
 			printk(BIOS_SPEW, "vendor-specific video data block\n");
 			break;
 		case 0x02:
-			printk(BIOS_SPEW, "VESA video display device information data block\n");
+			printk(BIOS_SPEW,
+			       "VESA video display device information data block\n");
 			break;
 		case 0x03:
 			printk(BIOS_SPEW, "VESA video data block\n");
@@ -830,34 +910,37 @@ cea_block(struct edid *out, unsigned char *x)
 			break;
 		default:
 			if (x[1] >= 6 && x[1] <= 15)
-				printk(BIOS_SPEW, "Reserved video block (%02x)\n", x[1]);
+				printk(BIOS_SPEW,
+				       "Reserved video block (%02x)\n", x[1]);
 			else if (x[1] >= 19 && x[1] <= 31)
-				printk(BIOS_SPEW, "Reserved audio block (%02x)\n", x[1]);
+				printk(BIOS_SPEW,
+				       "Reserved audio block (%02x)\n", x[1]);
 			else
 				printk(BIOS_SPEW, "Unknown (%02x)\n", x[1]);
 			break;
 		}
 		break;
 	default:
-	{
-		int tag = (*x & 0xe0) >> 5;
-		int length = *x & 0x1f;
-		printk(BIOS_SPEW,
-		       "  Unknown tag %d, length %d (raw %02x)\n", tag, length, *x);
-		break;
-	}
+		{
+			int tag = (*x & 0xe0) >> 5;
+			int length = *x & 0x1f;
+			printk(BIOS_SPEW,
+			       "  Unknown tag %d, length %d (raw %02x)\n", tag,
+			       length, *x);
+			break;
+		}
 	}
 }
 
-static int
-parse_cea(struct edid *out, unsigned char *x, struct edid_context *c)
+static int parse_cea(struct edid *out, unsigned char *x, struct edid_context *c)
 {
 	int ret = 0;
 	int version = x[1];
 	int offset = x[2];
 	unsigned char *detailed;
 
-	if (version >= 1) do {
+	if (version >= 1)
+		do {
 			if (version == 1 && x[3] != 0)
 				ret = 1;
 
@@ -865,12 +948,15 @@ parse_cea(struct edid *out, unsigned char *x, struct edid_context *c)
 				break;
 
 			if (version < 3) {
-				printk(BIOS_SPEW, "%d 8-byte timing descriptors\n", (offset - 4) / 8);
+				printk(BIOS_SPEW,
+				       "%d 8-byte timing descriptors\n",
+				       (offset - 4) / 8);
 				if (offset - 4 > 0)
 					/* do stuff */ ;
 			} else if (version == 3) {
 				int i;
-				printk(BIOS_SPEW, "%d bytes of CEA data\n", offset - 4);
+				printk(BIOS_SPEW, "%d bytes of CEA data\n",
+				       offset - 4);
 				for (i = 4; i < offset; i += (x[i] & 0x1f) + 1) {
 					cea_block(out, x + i);
 				}
@@ -878,17 +964,23 @@ parse_cea(struct edid *out, unsigned char *x, struct edid_context *c)
 
 			if (version >= 2) {
 				if (x[3] & 0x80)
-					printk(BIOS_SPEW, "Underscans PC formats by default\n");
+					printk(BIOS_SPEW,
+					       "Underscans PC formats by default\n");
 				if (x[3] & 0x40)
-					printk(BIOS_SPEW, "Basic audio support\n");
+					printk(BIOS_SPEW,
+					       "Basic audio support\n");
 				if (x[3] & 0x20)
-					printk(BIOS_SPEW, "Supports YCbCr 4:4:4\n");
+					printk(BIOS_SPEW,
+					       "Supports YCbCr 4:4:4\n");
 				if (x[3] & 0x10)
-					printk(BIOS_SPEW, "Supports YCbCr 4:2:2\n");
-				printk(BIOS_SPEW, "%d native detailed modes\n", x[3] & 0x0f);
+					printk(BIOS_SPEW,
+					       "Supports YCbCr 4:2:2\n");
+				printk(BIOS_SPEW, "%d native detailed modes\n",
+				       x[3] & 0x0f);
 			}
 
-			for (detailed = x + offset; detailed + 18 < x + 127; detailed += 18)
+			for (detailed = x + offset; detailed + 18 < x + 127;
+			     detailed += 18)
 				if (detailed[0])
 					detailed_block(out, detailed, 1, c);
 		} while (0);
@@ -899,8 +991,7 @@ parse_cea(struct edid *out, unsigned char *x, struct edid_context *c)
 
 /* generic extension code */
 
-static void
-extension_version(struct edid *out, unsigned char *x)
+static void extension_version(struct edid *out, unsigned char *x)
 {
 	printk(BIOS_SPEW, "Extension version: %d\n", x[1]);
 }
@@ -911,18 +1002,29 @@ parse_extension(struct edid *out, unsigned char *x, struct edid_context *c)
 	int conformant_extension = 0;
 	printk(BIOS_SPEW, "\n");
 
-	switch(x[0]) {
+	switch (x[0]) {
 	case 0x02:
 		printk(BIOS_SPEW, "CEA extension block\n");
 		extension_version(out, x);
 		conformant_extension = parse_cea(out, x, c);
 		break;
-	case 0x10: printk(BIOS_SPEW, "VTB extension block\n"); break;
-	case 0x40: printk(BIOS_SPEW, "DI extension block\n"); break;
-	case 0x50: printk(BIOS_SPEW, "LS extension block\n"); break;
-	case 0x60: printk(BIOS_SPEW, "DPVL extension block\n"); break;
-	case 0xF0: printk(BIOS_SPEW, "Block map\n"); break;
-	case 0xFF: printk(BIOS_SPEW, "Manufacturer-specific extension block\n");
+	case 0x10:
+		printk(BIOS_SPEW, "VTB extension block\n");
+		break;
+	case 0x40:
+		printk(BIOS_SPEW, "DI extension block\n");
+		break;
+	case 0x50:
+		printk(BIOS_SPEW, "LS extension block\n");
+		break;
+	case 0x60:
+		printk(BIOS_SPEW, "DPVL extension block\n");
+		break;
+	case 0xF0:
+		printk(BIOS_SPEW, "Block map\n");
+		break;
+	case 0xFF:
+		printk(BIOS_SPEW, "Manufacturer-specific extension block\n");
 	default:
 		printk(BIOS_SPEW, "Unknown extension block\n");
 		break;
@@ -937,26 +1039,28 @@ static const struct {
 	int x, y, refresh;
 } established_timings[] = {
 	/* 0x23 bit 7 - 0 */
-	{720, 400, 70},
-	{720, 400, 88},
-	{640, 480, 60},
-	{640, 480, 67},
-	{640, 480, 72},
-	{640, 480, 75},
-	{800, 600, 56},
-	{800, 600, 60},
-	/* 0x24 bit 7 - 0 */
-	{800, 600, 72},
-	{800, 600, 75},
-	{832, 624, 75},
-	{1280, 768, 87},
-	{1024, 768, 60},
-	{1024, 768, 70},
-	{1024, 768, 75},
-	{1280, 1024, 75},
-	/* 0x25 bit 7*/
-	{1152, 870, 75},
-};
+	{
+	720, 400, 70}, {
+	720, 400, 88}, {
+	640, 480, 60}, {
+	640, 480, 67}, {
+	640, 480, 72}, {
+	640, 480, 75}, {
+	800, 600, 56}, {
+	800, 600, 60},
+	    /* 0x24 bit 7 - 0 */
+	{
+	800, 600, 72}, {
+	800, 600, 75}, {
+	832, 624, 75}, {
+	1280, 768, 87}, {
+	1024, 768, 60}, {
+	1024, 768, 70}, {
+	1024, 768, 75}, {
+	1280, 1024, 75},
+	    /* 0x25 bit 7 */
+	{
+1152, 870, 75},};
 
 static void print_subsection(const char *name, unsigned char *edid, int start,
 			     int end)
@@ -976,7 +1080,7 @@ static void dump_breakdown(unsigned char *edid)
 	printk(BIOS_SPEW, "Extracted contents:\n");
 	print_subsection("header", edid, 0, 7);
 	print_subsection("serial number", edid, 8, 17);
-	print_subsection("version", edid,18, 19);
+	print_subsection("version", edid, 18, 19);
 	print_subsection("basic params", edid, 20, 24);
 	print_subsection("chroma info", edid, 25, 34);
 	print_subsection("established", edid, 35, 37);
@@ -1000,25 +1104,31 @@ static void dump_breakdown(unsigned char *edid)
  */
 static struct edid_mode known_modes[NUM_KNOWN_MODES] = {
 	[EDID_MODE_640x480_60Hz] = {
-		.name = "640x480 at 60Hz", .pixel_clock = 25200, .refresh = 60,
-		.ha = 640, .hbl = 160, .hso = 16, .hspw = 96,
-		.va = 480, .vbl = 45, .vso = 10, .vspw = 2,
-		.phsync = '-', .pvsync = '-' },
+				    .name = "640x480 at 60Hz",.pixel_clock =
+				    25200,.refresh = 60,
+				    .ha = 640,.hbl = 160,.hso = 16,.hspw = 96,
+				    .va = 480,.vbl = 45,.vso = 10,.vspw = 2,
+				    .phsync = '-',.pvsync = '-'},
 	[EDID_MODE_720x480_60Hz] = {
-		.name = "720x480 at 60Hz", .pixel_clock = 27000, .refresh = 60,
-		.ha = 720, .hbl = 138, .hso = 16, .hspw = 62,
-		.va = 480, .vbl = 45, .vso = 9, .vspw = 6,
-		.phsync = '-', .pvsync = '-' },
+				    .name = "720x480 at 60Hz",.pixel_clock =
+				    27000,.refresh = 60,
+				    .ha = 720,.hbl = 138,.hso = 16,.hspw = 62,
+				    .va = 480,.vbl = 45,.vso = 9,.vspw = 6,
+				    .phsync = '-',.pvsync = '-'},
 	[EDID_MODE_1280x720_60Hz] = {
-		.name = "1280x720 at 60Hz", .pixel_clock = 74250, .refresh = 60,
-		.ha = 1280, .hbl = 370, .hso = 110, .hspw = 40,
-		.va = 720, .vbl = 30, .vso = 5, .vspw = 20,
-		.phsync = '+', .pvsync = '+' },
+				     .name = "1280x720 at 60Hz",.pixel_clock =
+				     74250,.refresh = 60,
+				     .ha = 1280,.hbl = 370,.hso = 110,.hspw =
+				     40,
+				     .va = 720,.vbl = 30,.vso = 5,.vspw = 20,
+				     .phsync = '+',.pvsync = '+'},
 	[EDID_MODE_1920x1080_60Hz] = {
-		.name = "1920x1080 at 60Hz", .pixel_clock = 148500, .refresh = 60,
-		.ha = 1920, .hbl = 280, .hso = 88, .hspw = 44,
-		.va = 1080, .vbl = 45, .vso = 4, .vspw = 5,
-		.phsync = '+', .pvsync = '+' },
+				      .name = "1920x1080 at 60Hz",.pixel_clock =
+				      148500,.refresh = 60,
+				      .ha = 1920,.hbl = 280,.hso = 88,.hspw =
+				      44,
+				      .va = 1080,.vbl = 45,.vso = 4,.vspw = 5,
+				      .phsync = '+',.pvsync = '+'},
 };
 
 int set_display_mode(struct edid *edid, enum edid_modes mode)
@@ -1048,15 +1158,15 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
 {
 	int analog, i, j;
 	struct edid_context c = {
-	    .has_valid_cvt = 1,
-	    .has_valid_dummy_block = 1,
-	    .has_valid_descriptor_ordering = 1,
-	    .has_valid_detailed_blocks = 1,
-	    .has_valid_descriptor_pad = 1,
-	    .has_valid_range_descriptor = 1,
-	    .has_valid_max_dotclock = 1,
-	    .has_valid_string_termination = 1,
-	    .conformant = 1,
+		.has_valid_cvt = 1,
+		.has_valid_dummy_block = 1,
+		.has_valid_descriptor_ordering = 1,
+		.has_valid_detailed_blocks = 1,
+		.has_valid_descriptor_pad = 1,
+		.has_valid_range_descriptor = 1,
+		.has_valid_max_dotclock = 1,
+		.has_valid_string_termination = 1,
+		.conformant = 1,
 	};
 
 	dump_breakdown(edid);
@@ -1073,7 +1183,8 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
 
 	extra_info.model = (unsigned short)(edid[0x0A] + (edid[0x0B] << 8));
 	extra_info.serial = (unsigned int)(edid[0x0C] + (edid[0x0D] << 8)
-				     + (edid[0x0E] << 16) + (edid[0x0F] << 24));
+					   + (edid[0x0E] << 16) +
+					   (edid[0x0F] << 24));
 
 	printk(BIOS_SPEW, "Manufacturer: %s Model %x Serial Number %u\n",
 	       extra_info.manuf_name,
@@ -1087,15 +1198,17 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
 		if (edid[0x11] > 0x0f) {
 			if (edid[0x10] == 0xff) {
 				c.has_valid_year = 1;
-				printk(BIOS_SPEW, "Made week %hhd of model year %hhd\n", edid[0x10],
-				       edid[0x11]);
+				printk(BIOS_SPEW,
+				       "Made week %hhd of model year %hhd\n",
+				       edid[0x10], edid[0x11]);
 				extra_info.week = edid[0x10];
 				extra_info.year = edid[0x11];
 			} else {
 				/* we know it's at least 2013, when this code was written */
 				if (edid[0x11] + 90 <= 2013) {
 					c.has_valid_year = 1;
-					printk(BIOS_SPEW, "Made week %hhd of %d\n",
+					printk(BIOS_SPEW,
+					       "Made week %hhd of %d\n",
 					       edid[0x10], edid[0x11] + 1990);
 					extra_info.week = edid[0x10];
 					extra_info.year = edid[0x11] + 1990;
@@ -1110,7 +1223,8 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
 
 	if (edid[0x12] == 1) {
 		if (edid[0x13] > 4) {
-			printk(BIOS_SPEW, "Claims > 1.4, assuming 1.4 conformance\n");
+			printk(BIOS_SPEW,
+			       "Claims > 1.4, assuming 1.4 conformance\n");
 			edid[0x13] = 4;
 		}
 		switch (edid[0x13]) {
@@ -1138,23 +1252,39 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
 			else if ((edid[0x14] & 0x70) == 0x70)
 				c.nonconformant_digital_display = 1;
 			else
-				printk(BIOS_SPEW, "%d bits per primary color channel\n",
+				printk(BIOS_SPEW,
+				       "%d bits per primary color channel\n",
 				       ((edid[0x14] & 0x70) >> 3) + 4);
-			out->panel_bits_per_color = ((edid[0x14] & 0x70) >> 3) + 4;
-			out->panel_bits_per_pixel = 3*out->panel_bits_per_color;
+			out->panel_bits_per_color =
+			    ((edid[0x14] & 0x70) >> 3) + 4;
+			out->panel_bits_per_pixel =
+			    3 * out->panel_bits_per_color;
 
 			switch (edid[0x14] & 0x0f) {
-			case 0x00: printk(BIOS_SPEW, "Digital interface is not defined\n"); break;
-			case 0x01: printk(BIOS_SPEW, "DVI interface\n"); break;
-			case 0x02: printk(BIOS_SPEW, "HDMI-a interface\n"); break;
-			case 0x03: printk(BIOS_SPEW, "HDMI-b interface\n"); break;
-			case 0x04: printk(BIOS_SPEW, "MDDI interface\n"); break;
-			case 0x05: printk(BIOS_SPEW, "DisplayPort interface\n"); break;
+			case 0x00:
+				printk(BIOS_SPEW,
+				       "Digital interface is not defined\n");
+				break;
+			case 0x01:
+				printk(BIOS_SPEW, "DVI interface\n");
+				break;
+			case 0x02:
+				printk(BIOS_SPEW, "HDMI-a interface\n");
+				break;
+			case 0x03:
+				printk(BIOS_SPEW, "HDMI-b interface\n");
+				break;
+			case 0x04:
+				printk(BIOS_SPEW, "MDDI interface\n");
+				break;
+			case 0x05:
+				printk(BIOS_SPEW, "DisplayPort interface\n");
+				break;
 			default:
-				   c.nonconformant_digital_display = 1;
+				c.nonconformant_digital_display = 1;
 			}
 			extra_info.type = edid[0x14] & 0x0f;
-		} else 	if (c.claims_one_point_two) {
+		} else if (c.claims_one_point_two) {
 			conformance_mask = 0x7E;
 			if (edid[0x14] & 0x01) {
 				printk(BIOS_SPEW, "DFP 1.x compatible TMDS\n");
@@ -1163,7 +1293,8 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
 			conformance_mask = 0x7F;
 
 		if (!c.nonconformant_digital_display)
-			c.nonconformant_digital_display = edid[0x14] & conformance_mask;
+			c.nonconformant_digital_display =
+			    edid[0x14] & conformance_mask;
 		extra_info.nonconformant = c.nonconformant_digital_display;
 	} else {
 		analog = 1;
@@ -1175,14 +1306,15 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
 		printk(BIOS_SPEW, "Analog display, Input voltage level: %s V\n",
 		       voltage == 3 ? "0.7/0.7" :
 		       voltage == 2 ? "1.0/0.4" :
-		       voltage == 1 ? "0.714/0.286" :
-		       "0.7/0.3");
+		       voltage == 1 ? "0.714/0.286" : "0.7/0.3");
 
 		if (c.claims_one_point_four) {
 			if (edid[0x14] & 0x10)
-				printk(BIOS_SPEW, "Blank-to-black setup/pedestal\n");
+				printk(BIOS_SPEW,
+				       "Blank-to-black setup/pedestal\n");
 			else
-				printk(BIOS_SPEW, "Blank level equals black level\n");
+				printk(BIOS_SPEW,
+				       "Blank level equals black level\n");
 		} else if (edid[0x14] & 0x10) {
 			/*
 			 * XXX this is just the X text.  1.3 says "if set, display expects
@@ -1192,24 +1324,26 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
 			printk(BIOS_SPEW, "Configurable signal levels\n");
 		}
 
-		printk(BIOS_SPEW, "Sync: %s%s%s%s\n", sync & 0x08 ? "Separate " : "",
+		printk(BIOS_SPEW, "Sync: %s%s%s%s\n",
+		       sync & 0x08 ? "Separate " : "",
 		       sync & 0x04 ? "Composite " : "",
 		       sync & 0x02 ? "SyncOnGreen " : "",
 		       sync & 0x01 ? "Serration " : "");
 	}
 
-
 	if (edid[0x15] && edid[0x16]) {
 		printk(BIOS_SPEW, "Maximum image size: %d cm x %d cm\n",
 		       edid[0x15], edid[0x16]);
 	} else if (c.claims_one_point_four && (edid[0x15] || edid[0x16])) {
-		if (edid[0x15]) { /* edid[0x15] != 0 && edid[0x16] == 0 */
-			unsigned int ratio = 100000/(edid[0x15] + 99);
-			printk(BIOS_SPEW, "Aspect ratio is %u.%03u (landscape)\n",
+		if (edid[0x15]) {	/* edid[0x15] != 0 && edid[0x16] == 0 */
+			unsigned int ratio = 100000 / (edid[0x15] + 99);
+			printk(BIOS_SPEW,
+			       "Aspect ratio is %u.%03u (landscape)\n",
 			       ratio / 1000, ratio % 1000);
-		} else { /* edid[0x15] == 0 && edid[0x16] != 0 */
-			unsigned int ratio = 100000/(edid[0x16] + 99);
-			printk(BIOS_SPEW, "Aspect ratio is %u.%03u (portrait)\n",
+		} else {	/* edid[0x15] == 0 && edid[0x16] != 0 */
+			unsigned int ratio = 100000 / (edid[0x16] + 99);
+			printk(BIOS_SPEW,
+			       "Aspect ratio is %u.%03u (portrait)\n",
 			       ratio / 1000, ratio % 1000);
 		}
 	} else {
@@ -1219,27 +1353,39 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
 
 	if (edid[0x17] == 0xff) {
 		if (c.claims_one_point_four)
-			printk(BIOS_SPEW, "Gamma is defined in an extension block\n");
+			printk(BIOS_SPEW,
+			       "Gamma is defined in an extension block\n");
 		else
 			/* XXX Technically 1.3 doesn't say this... */
 			printk(BIOS_SPEW, "Gamma: 1.0\n");
-	} else printk(BIOS_SPEW, "Gamma: %d%%\n", ((edid[0x17] + 100)));
+	} else
+		printk(BIOS_SPEW, "Gamma: %d%%\n", ((edid[0x17] + 100)));
 	printk(BIOS_SPEW, "Check DPMS levels\n");
 	if (edid[0x18] & 0xE0) {
 		printk(BIOS_SPEW, "DPMS levels:");
-		if (edid[0x18] & 0x80) printk(BIOS_SPEW, " Standby");
-		if (edid[0x18] & 0x40) printk(BIOS_SPEW, " Suspend");
-		if (edid[0x18] & 0x20) printk(BIOS_SPEW, " Off");
+		if (edid[0x18] & 0x80)
+			printk(BIOS_SPEW, " Standby");
+		if (edid[0x18] & 0x40)
+			printk(BIOS_SPEW, " Suspend");
+		if (edid[0x18] & 0x20)
+			printk(BIOS_SPEW, " Off");
 		printk(BIOS_SPEW, "\n");
 	}
 
 	/* FIXME: this is from 1.4 spec, check earlier */
 	if (analog) {
 		switch (edid[0x18] & 0x18) {
-			case 0x00: printk(BIOS_SPEW, "Monochrome or grayscale display\n"); break;
-			case 0x08: printk(BIOS_SPEW, "RGB color display\n"); break;
-			case 0x10: printk(BIOS_SPEW, "Non-RGB color display\n"); break;
-			case 0x18: printk(BIOS_SPEW, "Undefined display color type\n");
+		case 0x00:
+			printk(BIOS_SPEW, "Monochrome or grayscale display\n");
+			break;
+		case 0x08:
+			printk(BIOS_SPEW, "RGB color display\n");
+			break;
+		case 0x10:
+			printk(BIOS_SPEW, "Non-RGB color display\n");
+			break;
+		case 0x18:
+			printk(BIOS_SPEW, "Undefined display color type\n");
 		}
 	} else {
 		printk(BIOS_SPEW, "Supported color formats: RGB 4:4:4");
@@ -1251,13 +1397,16 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
 	}
 
 	if (edid[0x18] & 0x04)
-		printk(BIOS_SPEW, "Default (sRGB) color space is primary color space\n");
+		printk(BIOS_SPEW,
+		       "Default (sRGB) color space is primary color space\n");
 	if (edid[0x18] & 0x02) {
-		printk(BIOS_SPEW, "First detailed timing is preferred timing\n");
+		printk(BIOS_SPEW,
+		       "First detailed timing is preferred timing\n");
 		c.has_preferred_timing = 1;
 	}
 	if (edid[0x18] & 0x01)
-		printk(BIOS_SPEW, "Supports GTF timings within operating range\n");
+		printk(BIOS_SPEW,
+		       "Supports GTF timings within operating range\n");
 
 	/* XXX color section */
 
@@ -1267,13 +1416,18 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
 	 */
 	for (i = 0; i < 17; i++) {
 		if (edid[0x23 + i / 8] & (1 << (7 - i % 8))) {
-			printk(BIOS_SPEW, "  %dx%d@%dHz\n", established_timings[i].x,
-			       established_timings[i].y, established_timings[i].refresh);
+			printk(BIOS_SPEW, "  %dx%d@%dHz\n",
+			       established_timings[i].x,
+			       established_timings[i].y,
+			       established_timings[i].refresh);
 
 			for (j = 0; j < NUM_KNOWN_MODES; j++) {
-				if (known_modes[j].ha == established_timings[i].x &&
-				    known_modes[j].va == established_timings[i].y &&
-				    known_modes[j].refresh ==  established_timings[i].refresh)
+				if (known_modes[j].ha ==
+				    established_timings[i].x
+				    && known_modes[j].va ==
+				    established_timings[i].y
+				    && known_modes[j].refresh ==
+				    established_timings[i].refresh)
 					out->mode_is_supported[j] = 1;
 			}
 		}
@@ -1289,7 +1443,8 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
 			continue;
 
 		if (b1 == 0) {
-			printk(BIOS_SPEW, "non-conformant standard timing (0 horiz)\n");
+			printk(BIOS_SPEW,
+			       "non-conformant standard timing (0 horiz)\n");
 			continue;
 		}
 		x = (b1 + 31) * 8;
@@ -1315,7 +1470,7 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
 		printk(BIOS_SPEW, "  %dx%d@%dHz\n", x, y, refresh);
 		for (j = 0; j < NUM_KNOWN_MODES; j++) {
 			if (known_modes[j].ha == x && known_modes[j].va == y &&
-					known_modes[j].refresh == refresh)
+			    known_modes[j].refresh == refresh)
 				out->mode_is_supported[j] = 1;
 		}
 	}
@@ -1323,10 +1478,9 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
 	/* detailed timings */
 	printk(BIOS_SPEW, "Detailed timings\n");
 	for (i = 0; i < 4; i++) {
-		c.has_valid_detailed_blocks &= detailed_block(
-				out, edid + 0x36 + i * 18, 0, &c);
-		if (i == 0 && c.has_preferred_timing && !c.did_detailed_timing)
-		{
+		c.has_valid_detailed_blocks &=
+		    detailed_block(out, edid + 0x36 + i * 18, 0, &c);
+		if (i == 0 && c.has_preferred_timing && !c.did_detailed_timing) {
 			/* not really accurate... */
 			c.has_preferred_timing = 0;
 		}
@@ -1350,32 +1504,33 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
 	 * by v1.3 and we are unlikely to use any EDID 2.0 panels, we ignore
 	 * that case now and can fix it when we need to use a real 2.0 panel.
 	 */
-	for(i = 128; i < size; i += 128)
-		c.nonconformant_extension +=
-				parse_extension(out, &edid[i], &c);
+	for (i = 128; i < size; i += 128)
+		c.nonconformant_extension += parse_extension(out, &edid[i], &c);
 
 	if (c.claims_one_point_four) {
 		if (c.nonconformant_digital_display ||
 		    !c.has_valid_string_termination ||
-		    !c.has_valid_descriptor_pad ||
-		    !c.has_preferred_timing)
+		    !c.has_valid_descriptor_pad || !c.has_preferred_timing)
 			c.conformant = 0;
 		if (!c.conformant)
-			printk(BIOS_ERR, "EDID block does NOT conform to EDID 1.4!\n");
+			printk(BIOS_ERR,
+			       "EDID block does NOT conform to EDID 1.4!\n");
 		if (c.nonconformant_digital_display)
-			printk(BIOS_ERR, "\tDigital display field contains garbage: %x\n",
+			printk(BIOS_ERR,
+			       "\tDigital display field contains garbage: %x\n",
 			       c.nonconformant_digital_display);
 		if (!c.has_valid_string_termination)
-			printk(BIOS_ERR, "\tDetailed block string not properly terminated\n");
+			printk(BIOS_ERR,
+			       "\tDetailed block string not properly terminated\n");
 		if (!c.has_valid_descriptor_pad)
-			printk(BIOS_ERR, "\tInvalid descriptor block padding\n");
+			printk(BIOS_ERR,
+			       "\tInvalid descriptor block padding\n");
 		if (!c.has_preferred_timing)
 			printk(BIOS_ERR, "\tMissing preferred timing\n");
 	} else if (c.claims_one_point_three) {
 		if (c.nonconformant_digital_display ||
 		    !c.has_valid_string_termination ||
-		    !c.has_valid_descriptor_pad ||
-		    !c.has_preferred_timing) {
+		    !c.has_valid_descriptor_pad || !c.has_preferred_timing) {
 			c.conformant = 0;
 		}
 		/**
@@ -1386,13 +1541,15 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
 		 * messages.
 		 */
 		if (!c.conformant)
-			printk(BIOS_ERR, "EDID block does NOT conform to EDID 1.3!\n");
+			printk(BIOS_ERR,
+			       "EDID block does NOT conform to EDID 1.3!\n");
 		else if (!c.has_name_descriptor || !c.has_range_descriptor)
 			printk(BIOS_WARNING, "WARNING: EDID block does NOT "
 			       "fully conform to EDID 1.3.\n");
 
 		if (c.nonconformant_digital_display)
-			printk(BIOS_ERR, "\tDigital display field contains garbage: %x\n",
+			printk(BIOS_ERR,
+			       "\tDigital display field contains garbage: %x\n",
 			       c.nonconformant_digital_display);
 		if (!c.has_name_descriptor)
 			printk(BIOS_ERR, "\tMissing name descriptor\n");
@@ -1400,28 +1557,35 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
 			printk(BIOS_ERR, "\tMissing preferred timing\n");
 		if (!c.has_range_descriptor)
 			printk(BIOS_ERR, "\tMissing monitor ranges\n");
-		if (!c.has_valid_descriptor_pad) /* Might be more than just 1.3 */
-			printk(BIOS_ERR, "\tInvalid descriptor block padding\n");
-		if (!c.has_valid_string_termination) /* Likewise */
-			printk(BIOS_ERR, "\tDetailed block string not properly terminated\n");
+		if (!c.has_valid_descriptor_pad)	/* Might be more than just 1.3 */
+			printk(BIOS_ERR,
+			       "\tInvalid descriptor block padding\n");
+		if (!c.has_valid_string_termination)	/* Likewise */
+			printk(BIOS_ERR,
+			       "\tDetailed block string not properly terminated\n");
 	} else if (c.claims_one_point_two) {
 		if (c.nonconformant_digital_display ||
 		    !c.has_valid_string_termination)
 			c.conformant = 0;
 		if (!c.conformant)
-			printk(BIOS_ERR, "EDID block does NOT conform to EDID 1.2!\n");
+			printk(BIOS_ERR,
+			       "EDID block does NOT conform to EDID 1.2!\n");
 		if (c.nonconformant_digital_display)
-			printk(BIOS_ERR, "\tDigital display field contains garbage: %x\n",
+			printk(BIOS_ERR,
+			       "\tDigital display field contains garbage: %x\n",
 			       c.nonconformant_digital_display);
 		if (!c.has_valid_string_termination)
-			printk(BIOS_ERR, "\tDetailed block string not properly terminated\n");
+			printk(BIOS_ERR,
+			       "\tDetailed block string not properly terminated\n");
 	} else if (c.claims_one_point_oh) {
 		if (c.seen_non_detailed_descriptor)
 			c.conformant = 0;
 		if (!c.conformant)
-			printk(BIOS_ERR, "EDID block does NOT conform to EDID 1.0!\n");
+			printk(BIOS_ERR,
+			       "EDID block does NOT conform to EDID 1.0!\n");
 		if (c.seen_non_detailed_descriptor)
-			printk(BIOS_ERR, "\tHas descriptor blocks other than detailed timings\n");
+			printk(BIOS_ERR,
+			       "\tHas descriptor blocks other than detailed timings\n");
 	}
 
 	if (c.nonconformant_extension ||
@@ -1433,12 +1597,12 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
 	    !c.has_valid_dummy_block ||
 	    !c.has_valid_extension_count ||
 	    !c.has_valid_descriptor_ordering ||
-	    !c.has_valid_range_descriptor ||
-	    !c.manufacturer_name_well_formed) {
+	    !c.has_valid_range_descriptor || !c.manufacturer_name_well_formed) {
 		c.conformant = 0;
 		printk(BIOS_ERR, "EDID block does not conform at all!\n");
 		if (c.nonconformant_extension)
-			printk(BIOS_ERR, "\tHas %d nonconformant extension block(s)\n",
+			printk(BIOS_ERR,
+			       "\tHas %d nonconformant extension block(s)\n",
 			       c.nonconformant_extension);
 		if (!c.has_valid_checksum)
 			printk(BIOS_ERR, "\tBlock has broken checksum\n");
@@ -1449,19 +1613,25 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
 		if (!c.has_valid_week)
 			printk(BIOS_ERR, "\tBad week of manufacture\n");
 		if (!c.has_valid_detailed_blocks)
-			printk(BIOS_ERR, "\tDetailed blocks filled with garbage\n");
+			printk(BIOS_ERR,
+			       "\tDetailed blocks filled with garbage\n");
 		if (!c.has_valid_dummy_block)
 			printk(BIOS_ERR, "\tDummy block filled with garbage\n");
 		if (!c.has_valid_extension_count)
-			printk(BIOS_ERR, "\tImpossible extension block count\n");
+			printk(BIOS_ERR,
+			       "\tImpossible extension block count\n");
 		if (!c.manufacturer_name_well_formed)
-			printk(BIOS_ERR, "\tManufacturer name field contains garbage\n");
+			printk(BIOS_ERR,
+			       "\tManufacturer name field contains garbage\n");
 		if (!c.has_valid_descriptor_ordering)
-			printk(BIOS_ERR, "\tInvalid detailed timing descriptor ordering\n");
+			printk(BIOS_ERR,
+			       "\tInvalid detailed timing descriptor ordering\n");
 		if (!c.has_valid_range_descriptor)
-			printk(BIOS_ERR, "\tRange descriptor contains garbage\n");
+			printk(BIOS_ERR,
+			       "\tRange descriptor contains garbage\n");
 		if (!c.has_valid_max_dotclock)
-			printk(BIOS_ERR, "\tEDID 1.4 block does not set max dotclock\n");
+			printk(BIOS_ERR,
+			       "\tEDID 1.4 block does not set max dotclock\n");
 	}
 
 	if (c.warning_excessive_dotclock_correction)
@@ -1538,7 +1708,8 @@ void edid_set_framebuffer_bits_per_pixel(struct edid *edid, int fb_bpp,
 
 	edid->framebuffer_bits_per_pixel = fb_bpp;
 	edid->bytes_per_line = ALIGN_UP(edid->mode.ha *
-		div_round_up(fb_bpp, 8), row_byte_alignment);
+					div_round_up(fb_bpp, 8),
+					row_byte_alignment);
 	edid->x_resolution = edid->bytes_per_line / (fb_bpp / 8);
 	edid->y_resolution = edid->mode.va;
 }
@@ -1567,7 +1738,7 @@ void set_vbe_mode_info_valid(const struct edid *edid, uintptr_t fb_addr)
 	edid_fb.bits_per_pixel = edid->framebuffer_bits_per_pixel;
 	edid_fb.reserved_mask_pos = 0;
 	edid_fb.reserved_mask_size = 0;
-	switch(edid->framebuffer_bits_per_pixel){
+	switch (edid->framebuffer_bits_per_pixel) {
 	case 32:
 	case 24:
 		/* packed into 4-byte words */



More information about the coreboot-gerrit mailing list