[igt-dev] [PATCH i-g-t 1/2] tools/intel_vbt_decode: fix mipi gpio element dumping for sequence v3

Jani Nikula jani.nikula at intel.com
Fri Mar 8 19:01:06 UTC 2019


The GPIO element is three bytes in sequence v3.

Signed-off-by: Jani Nikula <jani.nikula at intel.com>
---
 tools/intel_vbt_decode.c | 36 +++++++++++++++++++++++-------------
 1 file changed, 23 insertions(+), 13 deletions(-)

diff --git a/tools/intel_vbt_decode.c b/tools/intel_vbt_decode.c
index e6e06b1b5618..de4cc88a06dd 100644
--- a/tools/intel_vbt_decode.c
+++ b/tools/intel_vbt_decode.c
@@ -1151,7 +1151,7 @@ static void dump_mipi_config(struct context *context,
 	printf("\t\tPanel power cycle delay: %d\n", pps->panel_power_cycle_delay);
 }
 
-static const uint8_t *mipi_dump_send_packet(const uint8_t *data)
+static const uint8_t *mipi_dump_send_packet(const uint8_t *data, uint8_t seq_version)
 {
 	uint8_t flags, type;
 	uint16_t len, i;
@@ -1174,29 +1174,39 @@ static const uint8_t *mipi_dump_send_packet(const uint8_t *data)
 	return data;
 }
 
-static const uint8_t *mipi_dump_delay(const uint8_t *data)
+static const uint8_t *mipi_dump_delay(const uint8_t *data, uint8_t seq_version)
 {
 	printf("\t\tDelay: %u us\n", *((const uint32_t *)data));
 
 	return data + 4;
 }
 
-static const uint8_t *mipi_dump_gpio(const uint8_t *data)
+static const uint8_t *mipi_dump_gpio(const uint8_t *data, uint8_t seq_version)
 {
-	uint8_t index, flags;
+	uint8_t gpio_source, gpio_index = 0, gpio_number;
+	bool value;
 
-	index = *data++;
-	flags = *data++;
+	if (seq_version >= 3)
+		gpio_index = *data++;
 
-	printf("\t\tGPIO index %u, source %d, set %d\n",
-	       index,
-	       (flags >> 1) & 3,
-	       flags & 1);
+	gpio_number = *data++;
+
+	/* gpio source in sequence v2 only */
+	if (seq_version == 2)
+		gpio_source = (*data >> 1) & 3;
+	else
+		gpio_source = 0;
+
+	/* pull up/down */
+	value = *data++ & 1;
+
+	printf("\t\tGPIO index %u, number %u, source %u, set %d\n",
+	       gpio_index, gpio_number, gpio_source, value);
 
 	return data;
 }
 
-static const uint8_t *mipi_dump_i2c(const uint8_t *data)
+static const uint8_t *mipi_dump_i2c(const uint8_t *data, uint8_t seq_version)
 {
 	uint8_t flags, index, bus, offset, len, i;
 	uint16_t address;
@@ -1218,7 +1228,7 @@ static const uint8_t *mipi_dump_i2c(const uint8_t *data)
 	return data;
 }
 
-typedef const uint8_t * (*fn_mipi_elem_dump)(const uint8_t *data);
+typedef const uint8_t * (*fn_mipi_elem_dump)(const uint8_t *data, uint8_t seq_version);
 
 static const fn_mipi_elem_dump dump_elem[] = {
 	[MIPI_SEQ_ELEM_SEND_PKT] = mipi_dump_send_packet,
@@ -1279,7 +1289,7 @@ static const uint8_t *dump_sequence(const uint8_t *data, uint8_t seq_version)
 			operation_size = *data++;
 
 		if (mipi_elem_dump) {
-			data = mipi_elem_dump(data);
+			data = mipi_elem_dump(data, seq_version);
 		} else if (operation_size) {
 			/* We have size, skip. */
 			data += operation_size;
-- 
2.20.1



More information about the igt-dev mailing list