diff mbox

[IGT,2/2] intel_opregion_decode: decipher bclm table

Message ID 21992fc9e380c1519a878a912c7d7c6788bc0dca.1381256177.git.jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jani Nikula Oct. 8, 2013, 6:18 p.m. UTC
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 tools/intel_opregion_decode.c |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/tools/intel_opregion_decode.c b/tools/intel_opregion_decode.c
index e5f79df..8a9ef20 100644
--- a/tools/intel_opregion_decode.c
+++ b/tools/intel_opregion_decode.c
@@ -258,8 +258,18 @@  static void decode_asle(const void *buffer)
 	printf("\tcblv:\t0x%08x\n", asle->cblv);
 
 	printf("\tbclm:\n");
-	for (i = 0; i < ARRAY_SIZE(asle->bclm); i++)
-		printf("\t\tbclm[%d]:\t0x%04x\n", i, asle->bclm[i]);
+	for (i = 0; i < ARRAY_SIZE(asle->bclm); i++) {
+		int valid = asle->bclm[i] & (1 << 15);
+		int percentage = (asle->bclm[i] & 0x7f00) >> 8;
+		int duty_cycle = asle->bclm[i] & 0xff;
+
+		printf("\t\tbclm[%d]:\t0x%04x", i, asle->bclm[i]);
+		if (valid)
+			printf(" (%3d%% -> 0x%02x)\n", percentage, duty_cycle);
+		else
+			printf("\n");
+
+	}
 
 	printf("\tcpfm:\t0x%08x\n", asle->cpfm);
 	printf("\tepfm:\t0x%08x\n", asle->epfm);