All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: jani.nikula@intel.com
Subject: [PATCH i-g-t 2/8] tools/intel_vbt_decode: update dvo port name dumping
Date: Thu, 19 Oct 2017 18:22:53 +0300	[thread overview]
Message-ID: <20171019152259.31615-3-jani.nikula@intel.com> (raw)
In-Reply-To: <20171019152259.31615-1-jani.nikula@intel.com>

Add names for new ports, throw out unused macros.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 tools/intel_bios.h       | 12 ------------
 tools/intel_vbt_decode.c | 47 +++++++++++++++++++++++++----------------------
 2 files changed, 25 insertions(+), 34 deletions(-)

diff --git a/tools/intel_bios.h b/tools/intel_bios.h
index 4e06ef74e459..f0475b5cfcc3 100644
--- a/tools/intel_bios.h
+++ b/tools/intel_bios.h
@@ -42,18 +42,6 @@
 #define DEVICE_TYPE_DVI			0x68d2
 #define DEVICE_TYPE_MIPI		0x7cc2
 
-#define DEVICE_PORT_DVOA	0x00	/* none on 845+ */
-#define DEVICE_PORT_DVOB	0x01
-#define DEVICE_PORT_DVOC	0x02
-
-#define DEVICE_PORT_NONE	0
-#define DEVICE_PORT_HDMIB	1
-#define DEVICE_PORT_HDMIC	2
-#define DEVICE_PORT_HDMID	3
-#define DEVICE_PORT_DPB		7
-#define DEVICE_PORT_DPC		8
-#define DEVICE_PORT_DPD		9
-
 struct legacy_child_device_config {
 	uint16_t handle;
 	uint16_t device_type;	/* See DEVICE_TYPE_* above */
diff --git a/tools/intel_vbt_decode.c b/tools/intel_vbt_decode.c
index 499dcb065745..4865f0bab25f 100644
--- a/tools/intel_vbt_decode.c
+++ b/tools/intel_vbt_decode.c
@@ -356,29 +356,32 @@ static const char *child_device_handle(unsigned char handle)
 	return "unknown";
 }
 
-static const struct {
-	unsigned short type;
-	const char *name;
-} efp_ports[] = {
-	{ DEVICE_PORT_NONE, "N/A" },
-	{ DEVICE_PORT_HDMIB, "HDMI-B" },
-	{ DEVICE_PORT_HDMIC, "HDMI-C" },
-	{ DEVICE_PORT_HDMID, "HDMI-D" },
-	{ DEVICE_PORT_DPB, "DP-B" },
-	{ DEVICE_PORT_DPC, "DP-C" },
-	{ DEVICE_PORT_DPD, "DP-D" },
+static const char *dvo_port_names[] = {
+	[DVO_PORT_HDMIA] = "HDMI-A",
+	[DVO_PORT_HDMIB] = "HDMI-B",
+	[DVO_PORT_HDMIC] = "HDMI-C",
+	[DVO_PORT_HDMID] = "HDMI-D",
+	[DVO_PORT_LVDS] = "LVDS",
+	[DVO_PORT_TV] = "TV",
+	[DVO_PORT_CRT] = "CRT",
+	[DVO_PORT_DPB] = "DP-B",
+	[DVO_PORT_DPC] = "DP-C",
+	[DVO_PORT_DPD] = "DP-D",
+	[DVO_PORT_DPA] = "DP-A",
+	[DVO_PORT_DPE] = "DP-E",
+	[DVO_PORT_HDMIE] = "HDMI-E",
+	[DVO_PORT_MIPIA] = "MIPI-A",
+	[DVO_PORT_MIPIB] = "MIPI-B",
+	[DVO_PORT_MIPIC] = "MIPI-C",
+	[DVO_PORT_MIPID] = "MIPI-D",
 };
-static const int num_efp_ports = sizeof(efp_ports) / sizeof(efp_ports[0]);
 
-static const char *efp_port(uint8_t type)
+static const char *dvo_port(uint8_t type)
 {
-	int i;
-
-	for (i = 0; i < num_efp_ports; i++)
-		if (efp_ports[i].type == type)
-			return efp_ports[i].name;
-
-	return "unknown";
+	if (type < ARRAY_SIZE(dvo_port_names) && dvo_port_names[type])
+		return dvo_port_names[type];
+	else
+		return "unknown";
 }
 
 static void dump_child_device(struct context *context,
@@ -418,9 +421,9 @@ static void dump_child_device(struct context *context,
 		printf("\t\tCompression enable: %s\n", YESNO(efp->compression_enable));
 		printf("\t\tEdidless EFP: %s\n", YESNO(efp->edidless_efp));
 		printf("\t\tCompression structure index: 0x%02x)\n", efp->compression_structure_index);
-		printf("\t\tSlave DDI port: 0x%02x (%s)\n", efp->slave_port, efp_port(efp->slave_port));
+		printf("\t\tSlave DDI port: 0x%02x (%s)\n", efp->slave_port, dvo_port(efp->slave_port));
 		printf("\t\tAIM offset: %d\n", child->addin_offset);
-		printf("\t\tPort: 0x%02x (%s)\n", efp->dvo_port, efp_port(efp->dvo_port));
+		printf("\t\tPort: 0x%02x (%s)\n", efp->dvo_port, dvo_port(efp->dvo_port));
 		printf("\t\tAIM I2C pin: 0x%02x\n", efp->i2c_pin);
 		printf("\t\tAIM Slave address: 0x%02x\n", efp->slave_addr);
 		printf("\t\tDDC pin: 0x%02x\n", efp->ddc_pin);
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2017-10-19 15:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-19 15:22 [PATCH i-g-t 0/8] tools/intel_vbt_decode: refactoring and cleanups Jani Nikula
2017-10-19 15:22 ` [PATCH i-g-t 1/8] tools/intel_vbt_decode: make a copy of child devices before dumping Jani Nikula
2017-10-19 15:22 ` Jani Nikula [this message]
2017-10-19 15:22 ` [PATCH i-g-t 3/8] tools/intel_vbt_decode: use %.*s instead of duplicating a string Jani Nikula
2017-10-19 15:22 ` [PATCH i-g-t 4/8] tools/intel_vbt_decode: abstract DSI bridge type dump Jani Nikula
2017-10-19 15:22 ` [PATCH i-g-t 5/8] tools/intel_vbt_decode: unify child device printing across versions Jani Nikula
2017-10-19 17:24   ` Ville Syrjälä
2017-10-20 10:56     ` Jani Nikula
2017-10-20 11:33       ` Ville Syrjälä
2017-10-20 13:17         ` Jani Nikula
2017-10-20 13:49           ` Ville Syrjälä
2017-10-19 15:22 ` [PATCH i-g-t 6/8] tools/intel_vbt_decode: unify legacy child device block dumping Jani Nikula
2017-10-19 15:22 ` [PATCH i-g-t 7/8] tools/intel_vbt_decode: dump more child device data for version < 152 Jani Nikula
2017-10-19 15:22 ` [PATCH i-g-t 8/8] tools/intel_vbt_decode: abstract child devices printing more Jani Nikula
2017-10-19 16:52 ` ✗ Fi.CI.BAT: failure for tools/intel_vbt_decode: refactoring and cleanups Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171019152259.31615-3-jani.nikula@intel.com \
    --to=jani.nikula@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.