blob: b74d293effe2e55d5cc54da1f1186b3fca7160b8 [file] [log] [blame]
Wu Fengguang9e9c9f22009-11-06 11:06:22 +08001/*
2 * Copyright © 2009 Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
22 *
23 * Authors:
24 * Zhenyu Wang <zhenyu.z.wang@intel.com>
25 * Wu Fengguang <fengguang.wu@intel.com>
26 *
27 */
28
Wu Fengguang020abdb2010-04-19 13:13:06 +080029#define _GNU_SOURCE
Wu Fengguang9e9c9f22009-11-06 11:06:22 +080030#include <unistd.h>
Wu Fengguang020abdb2010-04-19 13:13:06 +080031#include <stdlib.h>
32#include <stdio.h>
33#include <string.h>
34#include <err.h>
Wu Fengguang9e9c9f22009-11-06 11:06:22 +080035#include <arpa/inet.h>
36#include "intel_gpu_tools.h"
37
Wu Fengguang020abdb2010-04-19 13:13:06 +080038static uint32_t devid;
39
40
41#define BITSTO(n) (n >= sizeof(long) * 8 ? ~0 : (1UL << (n)) - 1)
42#define BITMASK(high, low) (BITSTO(high+1) & ~BITSTO(low))
43#define BITS(reg, high, low) (((reg) & (BITMASK(high, low))) >> (low))
44#define BIT(reg, n) BITS(reg, n, n)
45
46#define min_t(type, x, y) ({ \
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -040047 type __min1 = (x); \
48 type __min2 = (y); \
49 __min1 < __min2 ? __min1 : __min2; })
Wu Fengguang020abdb2010-04-19 13:13:06 +080050
51#define OPNAME(names, index) \
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -040052 names[min_t(unsigned int, index, ARRAY_SIZE(names) - 1)]
Wu Fengguang020abdb2010-04-19 13:13:06 +080053
54#define dump_reg(reg, desc) \
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -040055 do { \
56 dword = INREG(reg); \
57 printf("%-21s 0x%08x %s\n", # reg, dword, desc); \
58 } while (0)
Wu Fengguang020abdb2010-04-19 13:13:06 +080059
60
Mengdong Lindeba8682013-09-09 15:38:40 -040061static const char * const pixel_clock[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +080062 [0] = "25.2 / 1.001 MHz",
63 [1] = "25.2 MHz",
64 [2] = "27 MHz",
65 [3] = "27 * 1.001 MHz",
66 [4] = "54 MHz",
67 [5] = "54 * 1.001 MHz",
68 [6] = "74.25 / 1.001 MHz",
69 [7] = "74.25 MHz",
70 [8] = "148.5 / 1.001 MHz",
71 [9] = "148.5 MHz",
72 [10] = "Reserved",
73};
74
Mengdong Lindeba8682013-09-09 15:38:40 -040075static const char * const power_state[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +080076 [0] = "D0",
77 [1] = "D1",
78 [2] = "D2",
79 [3] = "D3",
80};
81
Mengdong Lindeba8682013-09-09 15:38:40 -040082static const char * const stream_type[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +080083 [0] = "default samples",
84 [1] = "one bit stream",
85 [2] = "DST stream",
86 [3] = "MLP stream",
87 [4] = "Reserved",
88};
89
Mengdong Lindeba8682013-09-09 15:38:40 -040090static const char * const dip_port[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +080091 [0] = "Reserved",
92 [1] = "Digital Port B",
93 [2] = "Digital Port C",
94 [3] = "Digital Port D",
95};
96
Mengdong Lindeba8682013-09-09 15:38:40 -040097static const char * const dip_type[] = {
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -040098 [0] = "Audio DIP Disabled",
99 [1] = "Audio DIP Enabled",
Wang Xingchaoc4077222012-08-15 16:13:38 +0800100};
101
Mengdong Lindeba8682013-09-09 15:38:40 -0400102static const char * const dip_gen1_state[] = {
103 [0] = "Generic 1 (ACP) DIP Disabled",
104 [1] = "Generic 1 (ACP) DIP Enabled",
105};
106
107static const char * const dip_gen2_state[] = {
108 [0] = "Generic 2 DIP Disabled",
109 [1] = "Generic 2 DIP Enabled",
110};
111
112static const char * const dip_index[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800113 [0] = "Audio DIP",
114 [1] = "ACP DIP",
115 [2] = "ISRC1 DIP",
116 [3] = "ISRC2 DIP",
117 [4] = "Reserved",
118};
119
Mengdong Lindeba8682013-09-09 15:38:40 -0400120static const char * const dip_trans[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800121 [0] = "disabled",
122 [1] = "reserved",
123 [2] = "send once",
124 [3] = "best effort",
125};
126
Mengdong Lindeba8682013-09-09 15:38:40 -0400127static const char * const video_dip_index[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800128 [0] = "AVI DIP",
129 [1] = "Vendor-specific DIP",
Wu Fengguangf3f84bb2011-11-12 11:12:55 +0800130 [2] = "Gamut Metadata DIP",
Wu Fengguang020abdb2010-04-19 13:13:06 +0800131 [3] = "Source Product Description DIP",
132};
133
Mengdong Lindeba8682013-09-09 15:38:40 -0400134static const char * const video_dip_trans[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800135 [0] = "send once",
136 [1] = "send every vsync",
137 [2] = "send at least every other vsync",
138 [3] = "reserved",
139};
140
Mengdong Lindeba8682013-09-09 15:38:40 -0400141static const char * const trans_to_port_sel[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800142 [0] = "no port",
143 [1] = "Digital Port B",
Wang Xingchaof9a24812012-08-15 16:13:37 +0800144 [2] = "Digital Port C",
145 [3] = "Digital Port D",
146 [4] = "reserved",
Alan Coopersmithc4610062012-01-06 14:37:19 -0800147 [5] = "reserved",
148 [6] = "reserved",
149 [7] = "reserved",
Wu Fengguang020abdb2010-04-19 13:13:06 +0800150};
151
Mengdong Lindeba8682013-09-09 15:38:40 -0400152static const char * const ddi_mode[] = {
Wang Xingchaoc4077222012-08-15 16:13:38 +0800153 [0] = "HDMI mode",
154 [1] = "DVI mode",
155 [2] = "DP SST mode",
156 [3] = "DP MST mode",
157 [4] = "DP FDI mode",
158 [5] = "reserved",
159 [6] = "reserved",
160 [7] = "reserved",
161};
162
Mengdong Lindeba8682013-09-09 15:38:40 -0400163static const char * const bits_per_color[] = {
164 [0] = "8 bpc",
165 [1] = "10 bpc",
166 [2] = "6 bpc",
167 [3] = "12 bpc",
168 [4] = "reserved",
169 [5] = "reserved",
170 [6] = "reserved",
171 [7] = "reserved",
172};
173
174static const char * const transcoder_select[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800175 [0] = "Transcoder A",
176 [1] = "Transcoder B",
177 [2] = "Transcoder C",
178 [3] = "reserved",
179};
180
Mengdong Lindeba8682013-09-09 15:38:40 -0400181static const char * const dp_port_width[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800182 [0] = "x1 mode",
183 [1] = "x2 mode",
Wu Fengguangcf4c12f2011-11-12 11:12:46 +0800184 [2] = "reserved",
185 [3] = "x4 mode",
Alan Coopersmithc4610062012-01-06 14:37:19 -0800186 [4] = "reserved",
187 [5] = "reserved",
188 [6] = "reserved",
189 [7] = "reserved",
Wu Fengguang020abdb2010-04-19 13:13:06 +0800190};
191
Mengdong Lindeba8682013-09-09 15:38:40 -0400192static const char * const sample_base_rate[] = {
193 [0] = "48 kHz",
194 [1] = "44.1 kHz",
195};
196
197static const char * const sample_base_rate_mult[] = {
198 [0] = "x1 (48 kHz, 44.1 kHz or less)",
199 [1] = "x2 (96 kHz, 88.2 kHz, 32 kHz)",
200 [2] = "x3 (144 kHz)",
201 [3] = "x4 (192 kHz, 176.4 kHz)",
202 [4] = "Reserved",
203};
204
205static const char * const sample_base_rate_divisor[] = {
206 [0] = "Divided by 1 (48 kHz, 44.1 kHz)",
207 [1] = "Divided by 2 (24 kHz, 22.05 kHz)",
208 [2] = "Divided by 3 (16 kHz, 32 kHz)",
209 [3] = "Divided by 4 (11.025 kHz)",
210 [4] = "Divided by 5 (9.6 kHz)",
211 [5] = "Divided by 6 (8 kHz)",
212 [6] = "Divided by 7",
213 [7] = "Divided by 8 (6 kHz)",
214};
215
216static const char * const connect_list_form[] = {
217 [0] = "Short Form",
218 [1] = "Long Form",
219};
220
221
222static const char * const bits_per_sample[] = {
Wu Fengguang12861a92011-11-12 11:12:47 +0800223 [0] = "reserved",
224 [1] = "16 bits",
225 [2] = "24 bits",
226 [3] = "32 bits",
227 [4] = "20 bits",
228 [5] = "reserved",
229};
230
Mengdong Lindeba8682013-09-09 15:38:40 -0400231static const char * const sdvo_hdmi_encoding[] = {
Wu Fengguangee949582011-11-12 11:12:53 +0800232 [0] = "SDVO",
233 [1] = "reserved",
234 [2] = "TMDS",
235 [3] = "reserved",
236};
Wu Fengguang12861a92011-11-12 11:12:47 +0800237
Mengdong Lindeba8682013-09-09 15:38:40 -0400238static const char * const n_index_value[] = {
Wu Fengguange64abe52012-01-17 07:19:24 +0800239 [0] = "HDMI",
240 [1] = "DisplayPort",
241};
242
Wu Fengguang020abdb2010-04-19 13:13:06 +0800243static void do_self_tests(void)
244{
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400245 if (BIT(1, 0) != 1)
246 exit(1);
247 if (BIT(0x80000000, 31) != 1)
248 exit(2);
249 if (BITS(0xc0000000, 31, 30) != 3)
250 exit(3);
Wu Fengguang020abdb2010-04-19 13:13:06 +0800251}
252
253/*
254 * EagleLake registers
255 */
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800256#define AUD_CONFIG 0x62000
257#define AUD_DEBUG 0x62010
258#define AUD_VID_DID 0x62020
259#define AUD_RID 0x62024
260#define AUD_SUBN_CNT 0x62028
261#define AUD_FUNC_GRP 0x62040
262#define AUD_SUBN_CNT2 0x62044
263#define AUD_GRP_CAP 0x62048
264#define AUD_PWRST 0x6204c
265#define AUD_SUPPWR 0x62050
266#define AUD_SID 0x62054
267#define AUD_OUT_CWCAP 0x62070
268#define AUD_OUT_PCMSIZE 0x62074
269#define AUD_OUT_STR 0x62078
270#define AUD_OUT_DIG_CNVT 0x6207c
271#define AUD_OUT_CH_STR 0x62080
272#define AUD_OUT_STR_DESC 0x62084
273#define AUD_PINW_CAP 0x620a0
274#define AUD_PIN_CAP 0x620a4
275#define AUD_PINW_CONNLNG 0x620a8
276#define AUD_PINW_CONNLST 0x620ac
277#define AUD_PINW_CNTR 0x620b0
278#define AUD_PINW_UNSOLRESP 0x620b8
279#define AUD_CNTL_ST 0x620b4
280#define AUD_PINW_CONFIG 0x620bc
281#define AUD_HDMIW_STATUS 0x620d4
282#define AUD_HDMIW_HDMIEDID 0x6210c
283#define AUD_HDMIW_INFOFR 0x62118
284#define AUD_CONV_CHCNT 0x62120
285#define AUD_CTS_ENABLE 0x62128
286
287#define VIDEO_DIP_CTL 0x61170
288#define VIDEO_DIP_ENABLE (1<<31)
289#define VIDEO_DIP_ENABLE_AVI (1<<21)
290#define VIDEO_DIP_ENABLE_VENDOR (1<<22)
291#define VIDEO_DIP_ENABLE_SPD (1<<24)
292#define VIDEO_DIP_BUF_AVI (0<<19)
293#define VIDEO_DIP_BUF_VENDOR (1<<19)
294#define VIDEO_DIP_BUF_SPD (3<<19)
295#define VIDEO_DIP_TRANS_ONCE (0<<16)
296#define VIDEO_DIP_TRANS_1 (1<<16)
297#define VIDEO_DIP_TRANS_2 (2<<16)
298
299#define AUDIO_HOTPLUG_EN (1<<24)
300
301
Wu Fengguang020abdb2010-04-19 13:13:06 +0800302static void dump_eaglelake(void)
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800303{
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400304 uint32_t dword;
305 int i;
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800306
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400307 /* printf("%-18s %8s %s\n\n", "register name", "raw value", "description"); */
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800308
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400309 dump_reg(VIDEO_DIP_CTL, "Video DIP Control");
310 dump_reg(SDVOB, "Digital Display Port B Control Register");
311 dump_reg(SDVOC, "Digital Display Port C Control Register");
312 dump_reg(PORT_HOTPLUG_EN, "Hot Plug Detect Enable");
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800313
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400314 dump_reg(AUD_CONFIG, "Audio Configuration");
315 dump_reg(AUD_DEBUG, "Audio Debug");
316 dump_reg(AUD_VID_DID, "Audio Vendor ID / Device ID");
317 dump_reg(AUD_RID, "Audio Revision ID");
318 dump_reg(AUD_SUBN_CNT, "Audio Subordinate Node Count");
319 dump_reg(AUD_FUNC_GRP, "Audio Function Group Type");
320 dump_reg(AUD_SUBN_CNT2, "Audio Subordinate Node Count");
321 dump_reg(AUD_GRP_CAP, "Audio Function Group Capabilities");
322 dump_reg(AUD_PWRST, "Audio Power State");
323 dump_reg(AUD_SUPPWR, "Audio Supported Power States");
324 dump_reg(AUD_SID, "Audio Root Node Subsystem ID");
325 dump_reg(AUD_OUT_CWCAP, "Audio Output Converter Widget Capabilities");
326 dump_reg(AUD_OUT_PCMSIZE, "Audio PCM Size and Rates");
327 dump_reg(AUD_OUT_STR, "Audio Stream Formats");
328 dump_reg(AUD_OUT_DIG_CNVT, "Audio Digital Converter");
329 dump_reg(AUD_OUT_CH_STR, "Audio Channel ID and Stream ID");
330 dump_reg(AUD_OUT_STR_DESC, "Audio Stream Descriptor Format");
331 dump_reg(AUD_PINW_CAP, "Audio Pin Complex Widget Capabilities");
332 dump_reg(AUD_PIN_CAP, "Audio Pin Capabilities");
333 dump_reg(AUD_PINW_CONNLNG, "Audio Connection List Length");
334 dump_reg(AUD_PINW_CONNLST, "Audio Connection List Entry");
335 dump_reg(AUD_PINW_CNTR, "Audio Pin Widget Control");
336 dump_reg(AUD_PINW_UNSOLRESP, "Audio Unsolicited Response Enable");
337 dump_reg(AUD_CNTL_ST, "Audio Control State Register");
338 dump_reg(AUD_PINW_CONFIG, "Audio Configuration Default");
339 dump_reg(AUD_HDMIW_STATUS, "Audio HDMI Status");
340 dump_reg(AUD_HDMIW_HDMIEDID, "Audio HDMI Data EDID Block");
341 dump_reg(AUD_HDMIW_INFOFR, "Audio HDMI Widget Data Island Packet");
342 dump_reg(AUD_CONV_CHCNT, "Audio Converter Channel Count");
343 dump_reg(AUD_CTS_ENABLE, "Audio CTS Programming Enable");
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800344
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400345 printf("\nDetails:\n\n");
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800346
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400347 dword = INREG(AUD_VID_DID);
348 printf("AUD_VID_DID vendor id\t\t\t0x%x\n", dword >> 16);
349 printf("AUD_VID_DID device id\t\t\t0x%x\n", dword & 0xffff);
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800350
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400351 dword = INREG(AUD_RID);
352 printf("AUD_RID major revision\t\t\t0x%lx\n", BITS(dword, 23, 20));
353 printf("AUD_RID minor revision\t\t\t0x%lx\n", BITS(dword, 19, 16));
354 printf("AUD_RID revision id\t\t\t0x%lx\n", BITS(dword, 15, 8));
355 printf("AUD_RID stepping id\t\t\t0x%lx\n", BITS(dword, 7, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800356
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400357 dword = INREG(SDVOB);
358 printf("SDVOB enable\t\t\t\t%u\n", !!(dword & SDVO_ENABLE));
359 printf("SDVOB HDMI encoding\t\t\t%u\n", !!(dword & SDVO_ENCODING_HDMI));
360 printf("SDVOB SDVO encoding\t\t\t%u\n", !!(dword & SDVO_ENCODING_SDVO));
361 printf("SDVOB null packets\t\t\t%u\n", !!(dword & SDVO_NULL_PACKETS_DURING_VSYNC));
362 printf("SDVOB audio enabled\t\t\t%u\n", !!(dword & SDVO_AUDIO_ENABLE));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800363
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400364 dword = INREG(SDVOC);
365 printf("SDVOC enable\t\t\t\t%u\n", !!(dword & SDVO_ENABLE));
366 printf("SDVOC HDMI encoding\t\t\t%u\n", !!(dword & SDVO_ENCODING_HDMI));
367 printf("SDVOC SDVO encoding\t\t\t%u\n", !!(dword & SDVO_ENCODING_SDVO));
368 printf("SDVOC null packets\t\t\t%u\n", !!(dword & SDVO_NULL_PACKETS_DURING_VSYNC));
369 printf("SDVOC audio enabled\t\t\t%u\n", !!(dword & SDVO_AUDIO_ENABLE));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800370
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400371 dword = INREG(PORT_HOTPLUG_EN);
372 printf("PORT_HOTPLUG_EN DisplayPort/HDMI port B\t%ld\n", BIT(dword, 29)),
373 printf("PORT_HOTPLUG_EN DisplayPort/HDMI port C\t%ld\n", BIT(dword, 28)),
374 printf("PORT_HOTPLUG_EN DisplayPort port D\t%ld\n", BIT(dword, 27)),
375 printf("PORT_HOTPLUG_EN SDVOB\t\t\t%ld\n", BIT(dword, 26)),
376 printf("PORT_HOTPLUG_EN SDVOC\t\t\t%ld\n", BIT(dword, 25)),
377 printf("PORT_HOTPLUG_EN audio\t\t\t%ld\n", BIT(dword, 24)),
378 printf("PORT_HOTPLUG_EN TV\t\t\t%ld\n", BIT(dword, 23)),
379 printf("PORT_HOTPLUG_EN CRT\t\t\t%ld\n", BIT(dword, 9)),
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800380
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400381 dword = INREG(VIDEO_DIP_CTL);
382 printf("VIDEO_DIP_CTL enable graphics DIP\t%ld\n", BIT(dword, 31)),
383 printf("VIDEO_DIP_CTL port select\t\t[0x%lx] %s\n",
384 BITS(dword, 30, 29), dip_port[BITS(dword, 30, 29)]);
385 printf("VIDEO_DIP_CTL DIP buffer trans active\t%lu\n", BIT(dword, 28));
386 printf("VIDEO_DIP_CTL AVI DIP enabled\t\t%lu\n", BIT(dword, 21));
387 printf("VIDEO_DIP_CTL vendor DIP enabled\t%lu\n", BIT(dword, 22));
388 printf("VIDEO_DIP_CTL SPD DIP enabled\t\t%lu\n", BIT(dword, 24));
389 printf("VIDEO_DIP_CTL DIP buffer index\t\t[0x%lx] %s\n",
390 BITS(dword, 20, 19), video_dip_index[BITS(dword, 20, 19)]);
391 printf("VIDEO_DIP_CTL DIP trans freq\t\t[0x%lx] %s\n",
392 BITS(dword, 17, 16), video_dip_trans[BITS(dword, 17, 16)]);
393 printf("VIDEO_DIP_CTL DIP buffer size\t\t%lu\n", BITS(dword, 11, 8));
394 printf("VIDEO_DIP_CTL DIP address\t\t%lu\n", BITS(dword, 3, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800395
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400396 dword = INREG(AUD_CONFIG);
397 printf("AUD_CONFIG pixel clock\t\t\t[0x%lx] %s\n", BITS(dword, 19, 16),
398 OPNAME(pixel_clock, BITS(dword, 19, 16)));
399 printf("AUD_CONFIG fabrication enabled\t\t%lu\n", BITS(dword, 2, 2));
400 printf("AUD_CONFIG professional use allowed\t%lu\n", BIT(dword, 1));
401 printf("AUD_CONFIG fuse enabled\t\t\t%lu\n", BIT(dword, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800402
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400403 dword = INREG(AUD_DEBUG);
404 printf("AUD_DEBUG function reset\t\t%lu\n", BIT(dword, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800405
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400406 dword = INREG(AUD_SUBN_CNT);
407 printf("AUD_SUBN_CNT starting node number\t0x%lx\n", BITS(dword, 23, 16));
408 printf("AUD_SUBN_CNT total number of nodes\t0x%lx\n", BITS(dword, 7, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800409
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400410 dword = INREG(AUD_SUBN_CNT2);
411 printf("AUD_SUBN_CNT2 starting node number\t0x%lx\n", BITS(dword, 24, 16));
412 printf("AUD_SUBN_CNT2 total number of nodes\t0x%lx\n", BITS(dword, 7, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800413
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400414 dword = INREG(AUD_FUNC_GRP);
415 printf("AUD_FUNC_GRP unsol capable\t\t%lu\n", BIT(dword, 8));
416 printf("AUD_FUNC_GRP node type\t\t\t0x%lx\n", BITS(dword, 7, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800417
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400418 dword = INREG(AUD_GRP_CAP);
419 printf("AUD_GRP_CAP beep 0\t\t\t%lu\n", BIT(dword, 16));
420 printf("AUD_GRP_CAP input delay\t\t\t%lu\n", BITS(dword, 11, 8));
421 printf("AUD_GRP_CAP output delay\t\t%lu\n", BITS(dword, 3, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800422
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400423 dword = INREG(AUD_PWRST);
424 printf("AUD_PWRST device power state\t\t%s\n",
425 power_state[BITS(dword, 5, 4)]);
426 printf("AUD_PWRST device power state setting\t%s\n",
427 power_state[BITS(dword, 1, 0)]);
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800428
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400429 dword = INREG(AUD_SUPPWR);
430 printf("AUD_SUPPWR support D0\t\t\t%lu\n", BIT(dword, 0));
431 printf("AUD_SUPPWR support D1\t\t\t%lu\n", BIT(dword, 1));
432 printf("AUD_SUPPWR support D2\t\t\t%lu\n", BIT(dword, 2));
433 printf("AUD_SUPPWR support D3\t\t\t%lu\n", BIT(dword, 3));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800434
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400435 dword = INREG(AUD_OUT_CWCAP);
436 printf("AUD_OUT_CWCAP widget type\t\t0x%lx\n", BITS(dword, 23, 20));
437 printf("AUD_OUT_CWCAP sample delay\t\t0x%lx\n", BITS(dword, 19, 16));
438 printf("AUD_OUT_CWCAP channel count\t\t%lu\n",
439 BITS(dword, 15, 13) * 2 + BIT(dword, 0) + 1);
440 printf("AUD_OUT_CWCAP L-R swap\t\t\t%lu\n", BIT(dword, 11));
441 printf("AUD_OUT_CWCAP power control\t\t%lu\n", BIT(dword, 10));
442 printf("AUD_OUT_CWCAP digital\t\t\t%lu\n", BIT(dword, 9));
443 printf("AUD_OUT_CWCAP conn list\t\t\t%lu\n", BIT(dword, 8));
444 printf("AUD_OUT_CWCAP unsol\t\t\t%lu\n", BIT(dword, 7));
445 printf("AUD_OUT_CWCAP mute\t\t\t%lu\n", BIT(dword, 5));
446 printf("AUD_OUT_CWCAP format override\t\t%lu\n", BIT(dword, 4));
447 printf("AUD_OUT_CWCAP amp param override\t%lu\n", BIT(dword, 3));
448 printf("AUD_OUT_CWCAP out amp present\t\t%lu\n", BIT(dword, 2));
449 printf("AUD_OUT_CWCAP in amp present\t\t%lu\n", BIT(dword, 1));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800450
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400451 dword = INREG(AUD_OUT_DIG_CNVT);
452 printf("AUD_OUT_DIG_CNVT SPDIF category\t\t0x%lx\n", BITS(dword, 14, 8));
453 printf("AUD_OUT_DIG_CNVT SPDIF level\t\t%lu\n", BIT(dword, 7));
454 printf("AUD_OUT_DIG_CNVT professional\t\t%lu\n", BIT(dword, 6));
455 printf("AUD_OUT_DIG_CNVT non PCM\t\t%lu\n", BIT(dword, 5));
456 printf("AUD_OUT_DIG_CNVT copyright asserted\t%lu\n", BIT(dword, 4));
457 printf("AUD_OUT_DIG_CNVT filter preemphasis\t%lu\n", BIT(dword, 3));
458 printf("AUD_OUT_DIG_CNVT validity config\t%lu\n", BIT(dword, 2));
459 printf("AUD_OUT_DIG_CNVT validity flag\t\t%lu\n", BIT(dword, 1));
460 printf("AUD_OUT_DIG_CNVT digital enable\t\t%lu\n", BIT(dword, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800461
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400462 dword = INREG(AUD_OUT_CH_STR);
463 printf("AUD_OUT_CH_STR stream id\t\t0x%lx\n", BITS(dword, 7, 4));
464 printf("AUD_OUT_CH_STR lowest channel\t\t%lu\n", BITS(dword, 3, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800465
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400466 dword = INREG(AUD_OUT_STR_DESC);
467 printf("AUD_OUT_STR_DESC stream channels\t%lu\n", BITS(dword, 3, 0) + 1);
468 printf("AUD_OUT_STR_DESC Bits per Sample\t[%#lx] %s\n",
469 BITS(dword, 6, 4), OPNAME(bits_per_sample, BITS(dword, 6, 4)));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800470
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400471 dword = INREG(AUD_PINW_CAP);
472 printf("AUD_PINW_CAP widget type\t\t0x%lx\n", BITS(dword, 23, 20));
473 printf("AUD_PINW_CAP sample delay\t\t0x%lx\n", BITS(dword, 19, 16));
474 printf("AUD_PINW_CAP channel count\t\t%lu\n",
475 BITS(dword, 15, 13) * 2 + BIT(dword, 0) + 1);
476 printf("AUD_PINW_CAP HDCP\t\t\t%lu\n", BIT(dword, 12));
477 printf("AUD_PINW_CAP L-R swap\t\t\t%lu\n", BIT(dword, 11));
478 printf("AUD_PINW_CAP power control\t\t%lu\n", BIT(dword, 10));
479 printf("AUD_PINW_CAP digital\t\t\t%lu\n", BIT(dword, 9));
480 printf("AUD_PINW_CAP conn list\t\t\t%lu\n", BIT(dword, 8));
481 printf("AUD_PINW_CAP unsol\t\t\t%lu\n", BIT(dword, 7));
482 printf("AUD_PINW_CAP mute\t\t\t%lu\n", BIT(dword, 5));
483 printf("AUD_PINW_CAP format override\t\t%lu\n", BIT(dword, 4));
484 printf("AUD_PINW_CAP amp param override\t\t%lu\n", BIT(dword, 3));
485 printf("AUD_PINW_CAP out amp present\t\t%lu\n", BIT(dword, 2));
486 printf("AUD_PINW_CAP in amp present\t\t%lu\n", BIT(dword, 1));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800487
488
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400489 dword = INREG(AUD_PIN_CAP);
490 printf("AUD_PIN_CAP EAPD\t\t\t%lu\n", BIT(dword, 16));
491 printf("AUD_PIN_CAP HDMI\t\t\t%lu\n", BIT(dword, 7));
492 printf("AUD_PIN_CAP output\t\t\t%lu\n", BIT(dword, 4));
493 printf("AUD_PIN_CAP presence detect\t\t%lu\n", BIT(dword, 2));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800494
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400495 dword = INREG(AUD_PINW_CNTR);
496 printf("AUD_PINW_CNTR mute status\t\t%lu\n", BIT(dword, 8));
497 printf("AUD_PINW_CNTR out enable\t\t%lu\n", BIT(dword, 6));
498 printf("AUD_PINW_CNTR amp mute status\t\t%lu\n", BIT(dword, 8));
499 printf("AUD_PINW_CNTR amp mute status\t\t%lu\n", BIT(dword, 8));
500 printf("AUD_PINW_CNTR stream type\t\t[0x%lx] %s\n",
501 BITS(dword, 2, 0),
502 OPNAME(stream_type, BITS(dword, 2, 0)));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800503
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400504 dword = INREG(AUD_PINW_UNSOLRESP);
505 printf("AUD_PINW_UNSOLRESP enable unsol resp\t%lu\n", BIT(dword, 31));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800506
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400507 dword = INREG(AUD_CNTL_ST);
508 printf("AUD_CNTL_ST DIP audio enabled\t\t%lu\n", BIT(dword, 21));
509 printf("AUD_CNTL_ST DIP ACP enabled\t\t%lu\n", BIT(dword, 22));
510 printf("AUD_CNTL_ST DIP ISRCx enabled\t\t%lu\n", BIT(dword, 23));
511 printf("AUD_CNTL_ST DIP port select\t\t[0x%lx] %s\n",
512 BITS(dword, 30, 29), dip_port[BITS(dword, 30, 29)]);
513 printf("AUD_CNTL_ST DIP buffer index\t\t[0x%lx] %s\n",
514 BITS(dword, 20, 18), OPNAME(dip_index, BITS(dword, 20, 18)));
515 printf("AUD_CNTL_ST DIP trans freq\t\t[0x%lx] %s\n",
516 BITS(dword, 17, 16), dip_trans[BITS(dword, 17, 16)]);
517 printf("AUD_CNTL_ST DIP address\t\t\t%lu\n", BITS(dword, 3, 0));
518 printf("AUD_CNTL_ST CP ready\t\t\t%lu\n", BIT(dword, 15));
519 printf("AUD_CNTL_ST ELD valid\t\t\t%lu\n", BIT(dword, 14));
520 printf("AUD_CNTL_ST ELD ack\t\t\t%lu\n", BIT(dword, 4));
521 printf("AUD_CNTL_ST ELD bufsize\t\t\t%lu\n", BITS(dword, 13, 9));
522 printf("AUD_CNTL_ST ELD address\t\t\t%lu\n", BITS(dword, 8, 5));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800523
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400524 dword = INREG(AUD_HDMIW_STATUS);
525 printf("AUD_HDMIW_STATUS CDCLK/DOTCLK underrun\t%lu\n", BIT(dword, 31));
526 printf("AUD_HDMIW_STATUS CDCLK/DOTCLK overrun\t%lu\n", BIT(dword, 30));
527 printf("AUD_HDMIW_STATUS BCLK/CDCLK underrun\t%lu\n", BIT(dword, 29));
528 printf("AUD_HDMIW_STATUS BCLK/CDCLK overrun\t%lu\n", BIT(dword, 28));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800529
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400530 dword = INREG(AUD_CONV_CHCNT);
531 printf("AUD_CONV_CHCNT HDMI HBR enabled\t\t%lu\n", BITS(dword, 15, 14));
532 printf("AUD_CONV_CHCNT HDMI channel count\t%lu\n", BITS(dword, 11, 8) + 1);
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800533
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400534 printf("AUD_CONV_CHCNT HDMI channel mapping:\n");
535 for (i = 0; i < 8; i++) {
536 OUTREG(AUD_CONV_CHCNT, i);
537 dword = INREG(AUD_CONV_CHCNT);
538 printf("\t\t\t\t\t[0x%x] %u => %lu\n", dword, i, BITS(dword, 7, 4));
539 }
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800540
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400541 printf("AUD_HDMIW_HDMIEDID HDMI ELD:\n\t");
542 dword = INREG(AUD_CNTL_ST);
543 dword &= ~BITMASK(8, 5);
544 OUTREG(AUD_CNTL_ST, dword);
545 for (i = 0; i < BITS(dword, 14, 10) / 4; i++)
546 printf("%08x ", htonl(INREG(AUD_HDMIW_HDMIEDID)));
547 printf("\n");
Wu Fengguangf32aecb2011-11-12 11:12:50 +0800548
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400549 printf("AUD_HDMIW_INFOFR HDMI audio Infoframe:\n\t");
550 dword = INREG(AUD_CNTL_ST);
551 dword &= ~BITMASK(20, 18);
552 dword &= ~BITMASK(3, 0);
553 OUTREG(AUD_CNTL_ST, dword);
554 for (i = 0; i < 8; i++)
555 printf("%08x ", htonl(INREG(AUD_HDMIW_INFOFR)));
556 printf("\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +0800557}
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800558
Wu Fengguang020abdb2010-04-19 13:13:06 +0800559#undef AUD_RID
560#undef AUD_VID_DID
561#undef AUD_PWRST
562#undef AUD_OUT_CH_STR
563#undef AUD_HDMIW_STATUS
564
565/*
566 * IronLake registers
567 */
568#define AUD_CONFIG_A 0xE2000
569#define AUD_CONFIG_B 0xE2100
570#define AUD_CTS_ENABLE_A 0xE2028
571#define AUD_CTS_ENABLE_B 0xE2128
572#define AUD_MISC_CTRL_A 0xE2010
573#define AUD_MISC_CTRL_B 0xE2110
574#define AUD_VID_DID 0xE2020
575#define AUD_RID 0xE2024
576#define AUD_PWRST 0xE204C
577#define AUD_PORT_EN_HD_CFG 0xE207C
578#define AUD_OUT_DIG_CNVT_A 0xE2080
579#define AUD_OUT_DIG_CNVT_B 0xE2180
580#define AUD_OUT_CH_STR 0xE2088
581#define AUD_OUT_STR_DESC_A 0xE2084
582#define AUD_OUT_STR_DESC_B 0xE2184
583#define AUD_PINW_CONNLNG_LIST 0xE20A8
584#define AUD_PINW_CONNLNG_SEL 0xE20AC
585#define AUD_CNTL_ST_A 0xE20B4
586#define AUD_CNTL_ST_B 0xE21B4
587#define AUD_CNTL_ST2 0xE20C0
588#define AUD_HDMIW_STATUS 0xE20D4
589#define AUD_HDMIW_HDMIEDID_A 0xE2050
590#define AUD_HDMIW_HDMIEDID_B 0xE2150
591#define AUD_HDMIW_INFOFR_A 0xE2054
592#define AUD_HDMIW_INFOFR_B 0xE2154
593
594static void dump_ironlake(void)
595{
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400596 uint32_t dword;
597 int i;
Wu Fengguang020abdb2010-04-19 13:13:06 +0800598
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400599 dump_reg(HDMIB, "sDVO/HDMI Port B Control");
600 dump_reg(HDMIC, "HDMI Port C Control");
601 dump_reg(HDMID, "HDMI Port D Control");
602 dump_reg(PCH_DP_B, "DisplayPort B Control Register");
603 dump_reg(PCH_DP_C, "DisplayPort C Control Register");
604 dump_reg(PCH_DP_D, "DisplayPort D Control Register");
605 dump_reg(AUD_CONFIG_A, "Audio Configuration - Transcoder A");
606 dump_reg(AUD_CONFIG_B, "Audio Configuration - Transcoder B");
607 dump_reg(AUD_CTS_ENABLE_A, "Audio CTS Programming Enable - Transcoder A");
608 dump_reg(AUD_CTS_ENABLE_B, "Audio CTS Programming Enable - Transcoder B");
609 dump_reg(AUD_MISC_CTRL_A, "Audio MISC Control for Transcoder A");
610 dump_reg(AUD_MISC_CTRL_B, "Audio MISC Control for Transcoder B");
611 dump_reg(AUD_VID_DID, "Audio Vendor ID / Device ID");
612 dump_reg(AUD_RID, "Audio Revision ID");
613 dump_reg(AUD_PWRST, "Audio Power State (Function Group, Convertor, Pin Widget)");
614 dump_reg(AUD_PORT_EN_HD_CFG, "Audio Port Enable HDAudio Config");
615 dump_reg(AUD_OUT_DIG_CNVT_A, "Audio Digital Converter - Conv A");
616 dump_reg(AUD_OUT_DIG_CNVT_B, "Audio Digital Converter - Conv B");
617 dump_reg(AUD_OUT_CH_STR, "Audio Channel ID and Stream ID");
618 dump_reg(AUD_OUT_STR_DESC_A, "Audio Stream Descriptor Format - Conv A");
619 dump_reg(AUD_OUT_STR_DESC_B, "Audio Stream Descriptor Format - Conv B");
620 dump_reg(AUD_PINW_CONNLNG_LIST, "Audio Connection List");
621 dump_reg(AUD_PINW_CONNLNG_SEL, "Audio Connection Select");
622 dump_reg(AUD_CNTL_ST_A, "Audio Control State Register - Transcoder A");
623 dump_reg(AUD_CNTL_ST_B, "Audio Control State Register - Transcoder B");
624 dump_reg(AUD_CNTL_ST2, "Audio Control State 2");
625 dump_reg(AUD_HDMIW_STATUS, "Audio HDMI Status");
626 dump_reg(AUD_HDMIW_HDMIEDID_A, "HDMI Data EDID Block - Transcoder A");
627 dump_reg(AUD_HDMIW_HDMIEDID_B, "HDMI Data EDID Block - Transcoder B");
628 dump_reg(AUD_HDMIW_INFOFR_A, "Audio Widget Data Island Packet - Transcoder A");
629 dump_reg(AUD_HDMIW_INFOFR_B, "Audio Widget Data Island Packet - Transcoder B");
Wu Fengguang020abdb2010-04-19 13:13:06 +0800630
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400631 printf("\nDetails:\n\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +0800632
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400633 dword = INREG(AUD_VID_DID);
634 printf("AUD_VID_DID vendor id\t\t\t\t\t0x%x\n", dword >> 16);
635 printf("AUD_VID_DID device id\t\t\t\t\t0x%x\n", dword & 0xffff);
Wu Fengguang020abdb2010-04-19 13:13:06 +0800636
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400637 dword = INREG(AUD_RID);
638 printf("AUD_RID Major_Revision\t\t\t\t\t0x%lx\n", BITS(dword, 23, 20));
639 printf("AUD_RID Minor_Revision\t\t\t\t\t0x%lx\n", BITS(dword, 19, 16));
640 printf("AUD_RID Revision_Id\t\t\t\t\t0x%lx\n", BITS(dword, 15, 8));
641 printf("AUD_RID Stepping_Id\t\t\t\t\t0x%lx\n", BITS(dword, 7, 0));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800642
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400643 dword = INREG(HDMIB);
644 printf("HDMIB HDMIB_Enable\t\t\t\t\t%u\n", !!(dword & SDVO_ENABLE));
645 printf("HDMIB Transcoder_Select\t\t\t\t\t%s\n", BIT(dword, 30) ? "Transcoder B" : "Transcoder A");
646 printf("HDMIB HDCP_Port_Select\t\t\t\t\t%lu\n", BIT(dword, 5));
647 printf("HDMIB SDVOB Hot Plug Interrupt Detect Enable\t\t%lu\n", BIT(dword, 23));
648 printf("HDMIB Digital_Port_B_Detected\t\t\t\t%lu\n", BIT(dword, 2));
649 printf("HDMIB Encoding\t\t\t\t\t\t[0x%lx] %s\n",
650 BITS(dword, 11, 10), sdvo_hdmi_encoding[BITS(dword, 11, 10)]);
651 printf("HDMIB Null_packets_enabled_during_Vsync\t\t\t%u\n", !!(dword & SDVO_NULL_PACKETS_DURING_VSYNC));
652 printf("HDMIB Audio_Output_Enable\t\t\t\t%u\n", !!(dword & SDVO_AUDIO_ENABLE));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800653
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400654 dword = INREG(HDMIC);
655 printf("HDMIC HDMIC_Enable\t\t\t\t\t%u\n", !!(dword & SDVO_ENABLE));
656 printf("HDMIC Transcoder_Select\t\t\t\t\t%s\n", BIT(dword, 30) ? "Transcoder B" : "Transcoder A");
657 printf("HDMIC HDCP_Port_Select\t\t\t\t\t%lu\n", BIT(dword, 5));
658 printf("HDMIC Digital_Port_C_Detected\t\t\t\t%lu\n", BIT(dword, 2));
659 printf("HDMIC Encoding\t\t\t\t\t\t[0x%lx] %s\n",
660 BITS(dword, 11, 10), sdvo_hdmi_encoding[BITS(dword, 11, 10)]);
661 printf("HDMIC Null_packets_enabled_during_Vsync\t\t\t%u\n", !!(dword & SDVO_NULL_PACKETS_DURING_VSYNC));
662 printf("HDMIC Audio_Output_Enable\t\t\t\t%u\n", !!(dword & SDVO_AUDIO_ENABLE));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800663
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400664 dword = INREG(HDMID);
665 printf("HDMID HDMID_Enable\t\t\t\t\t%u\n", !!(dword & SDVO_ENABLE));
666 printf("HDMID Transcoder_Select\t\t\t\t\t%s\n", BIT(dword, 30) ? "Transcoder B" : "Transcoder A");
667 printf("HDMID HDCP_Port_Select\t\t\t\t\t%lu\n", BIT(dword, 5));
668 printf("HDMID Digital_Port_D_Detected\t\t\t\t%lu\n", BIT(dword, 2));
669 printf("HDMID Encoding\t\t\t\t\t\t[0x%lx] %s\n",
670 BITS(dword, 11, 10), sdvo_hdmi_encoding[BITS(dword, 11, 10)]);
671 printf("HDMID Null_packets_enabled_during_Vsync\t\t\t%u\n", !!(dword & SDVO_NULL_PACKETS_DURING_VSYNC));
672 printf("HDMID Audio_Output_Enable\t\t\t\t%u\n", !!(dword & SDVO_AUDIO_ENABLE));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800673
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400674 dword = INREG(PCH_DP_B);
675 printf("PCH_DP_B DisplayPort_Enable\t\t\t\t%lu\n", BIT(dword, 31));
676 printf("PCH_DP_B Transcoder_Select\t\t\t\t%s\n", BIT(dword, 30) ? "Transcoder B" : "Transcoder A");
677 printf("PCH_DP_B Port_Width_Selection\t\t\t\t[0x%lx] %s\n",
678 BITS(dword, 21, 19), dp_port_width[BITS(dword, 21, 19)]);
679 printf("PCH_DP_B Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
680 printf("PCH_DP_B HDCP_Port_Select\t\t\t\t%lu\n", BIT(dword, 5));
681 printf("PCH_DP_B Audio_Output_Enable\t\t\t\t%lu\n", BIT(dword, 6));
Wu Fengguangb5ca6b42011-11-12 11:12:48 +0800682
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400683 dword = INREG(PCH_DP_C);
684 printf("PCH_DP_C DisplayPort_Enable\t\t\t\t%lu\n", BIT(dword, 31));
685 printf("PCH_DP_C Transcoder_Select\t\t\t\t%s\n", BIT(dword, 30) ? "Transcoder B" : "Transcoder A");
686 printf("PCH_DP_C Port_Width_Selection\t\t\t\t[0x%lx] %s\n",
687 BITS(dword, 21, 19), dp_port_width[BITS(dword, 21, 19)]);
688 printf("PCH_DP_C Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
689 printf("PCH_DP_C HDCP_Port_Select\t\t\t\t%lu\n", BIT(dword, 5));
690 printf("PCH_DP_C Audio_Output_Enable\t\t\t\t%lu\n", BIT(dword, 6));
Wu Fengguangb5ca6b42011-11-12 11:12:48 +0800691
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400692 dword = INREG(PCH_DP_D);
693 printf("PCH_DP_D DisplayPort_Enable\t\t\t\t%lu\n", BIT(dword, 31));
694 printf("PCH_DP_D Transcoder_Select\t\t\t\t%s\n", BIT(dword, 30) ? "Transcoder B" : "Transcoder A");
695 printf("PCH_DP_D Port_Width_Selection\t\t\t\t[0x%lx] %s\n",
696 BITS(dword, 21, 19), dp_port_width[BITS(dword, 21, 19)]);
697 printf("PCH_DP_D Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
698 printf("PCH_DP_D HDCP_Port_Select\t\t\t\t%lu\n", BIT(dword, 5));
699 printf("PCH_DP_D Audio_Output_Enable\t\t\t\t%lu\n", BIT(dword, 6));
Wu Fengguangb5ca6b42011-11-12 11:12:48 +0800700
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400701 dword = INREG(AUD_CONFIG_A);
702 printf("AUD_CONFIG_A N_index_value\t\t\t\t[0x%lx] %s\n", BIT(dword, 29),
703 n_index_value[BIT(dword, 29)]);
704 printf("AUD_CONFIG_A N_programming_enable\t\t\t%lu\n", BIT(dword, 28));
705 printf("AUD_CONFIG_A Upper_N_value\t\t\t\t0x%02lx\n", BITS(dword, 27, 20));
706 printf("AUD_CONFIG_A Lower_N_value\t\t\t\t0x%03lx\n", BITS(dword, 15, 4));
707 printf("AUD_CONFIG_A Pixel_Clock\t\t\t\t[0x%lx] %s\n", BITS(dword, 19, 16),
708 OPNAME(pixel_clock, BITS(dword, 19, 16)));
709 printf("AUD_CONFIG_A Disable_NCTS\t\t\t\t%lu\n", BIT(dword, 3));
710 dword = INREG(AUD_CONFIG_B);
711 printf("AUD_CONFIG_B N_index_value\t\t\t\t[0x%lx] %s\n", BIT(dword, 29),
712 n_index_value[BIT(dword, 29)]);
713 printf("AUD_CONFIG_B N_programming_enable\t\t\t%lu\n", BIT(dword, 28));
714 printf("AUD_CONFIG_B Upper_N_value\t\t\t\t0x%02lx\n", BITS(dword, 27, 20));
715 printf("AUD_CONFIG_B Lower_N_value\t\t\t\t0x%03lx\n", BITS(dword, 15, 4));
716 printf("AUD_CONFIG_B Pixel_Clock\t\t\t\t[0x%lx] %s\n", BITS(dword, 19, 16),
717 OPNAME(pixel_clock, BITS(dword, 19, 16)));
718 printf("AUD_CONFIG_B Disable_NCTS\t\t\t\t%lu\n", BIT(dword, 3));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800719
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400720 dword = INREG(AUD_CTS_ENABLE_A);
721 printf("AUD_CTS_ENABLE_A Enable_CTS_or_M_programming\t\t%lu\n", BIT(dword, 20));
722 printf("AUD_CTS_ENABLE_A CTS/M value Index\t\t\t%s\n", BIT(dword, 21) ? "CTS" : "M");
723 printf("AUD_CTS_ENABLE_A CTS_programming\t\t\t%#lx\n", BITS(dword, 19, 0));
724 dword = INREG(AUD_CTS_ENABLE_B);
725 printf("AUD_CTS_ENABLE_B Enable_CTS_or_M_programming\t\t%lu\n", BIT(dword, 20));
726 printf("AUD_CTS_ENABLE_B CTS/M value Index\t\t\t%s\n", BIT(dword, 21) ? "CTS" : "M");
727 printf("AUD_CTS_ENABLE_B CTS_programming\t\t\t%#lx\n", BITS(dword, 19, 0));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800728
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400729 dword = INREG(AUD_MISC_CTRL_A);
730 printf("AUD_MISC_CTRL_A Sample_Fabrication_EN_bit\t\t%lu\n", BIT(dword, 2));
731 printf("AUD_MISC_CTRL_A Sample_present_Disable\t\t\t%lu\n", BIT(dword, 8));
732 printf("AUD_MISC_CTRL_A Output_Delay\t\t\t\t%lu\n", BITS(dword, 7, 4));
733 printf("AUD_MISC_CTRL_A Pro_Allowed\t\t\t\t%lu\n", BIT(dword, 1));
734 dword = INREG(AUD_MISC_CTRL_B);
735 printf("AUD_MISC_CTRL_B Sample_Fabrication_EN_bit\t\t%lu\n", BIT(dword, 2));
736 printf("AUD_MISC_CTRL_B Sample_present_Disable\t\t\t%lu\n", BIT(dword, 8));
737 printf("AUD_MISC_CTRL_B Output_Delay\t\t\t\t%lu\n", BITS(dword, 7, 4));
738 printf("AUD_MISC_CTRL_B Pro_Allowed\t\t\t\t%lu\n", BIT(dword, 1));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800739
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400740 dword = INREG(AUD_PWRST);
741 printf("AUD_PWRST Function_Group_Device_Power_State_Current\t%s\n", power_state[BITS(dword, 23, 22)]);
742 printf("AUD_PWRST Function_Group_Device_Power_State_Set \t%s\n", power_state[BITS(dword, 21, 20)]);
743 printf("AUD_PWRST ConvertorB_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 19, 18)]);
744 printf("AUD_PWRST ConvertorB_Widget_Power_State_Requested \t%s\n", power_state[BITS(dword, 17, 16)]);
745 printf("AUD_PWRST ConvertorA_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 15, 14)]);
746 printf("AUD_PWRST ConvertorA_Widget_Power_State_Requsted \t%s\n", power_state[BITS(dword, 13, 12)]);
747 printf("AUD_PWRST PinD_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 11, 10)]);
748 printf("AUD_PWRST PinD_Widget_Power_State_Set \t%s\n", power_state[BITS(dword, 9, 8)]);
749 printf("AUD_PWRST PinC_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 7, 6)]);
750 printf("AUD_PWRST PinC_Widget_Power_State_Set \t%s\n", power_state[BITS(dword, 5, 4)]);
751 printf("AUD_PWRST PinB_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 3, 2)]);
752 printf("AUD_PWRST PinB_Widget_Power_State_Set \t%s\n", power_state[BITS(dword, 1, 0)]);
Wu Fengguang020abdb2010-04-19 13:13:06 +0800753
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400754 dword = INREG(AUD_PORT_EN_HD_CFG);
755 printf("AUD_PORT_EN_HD_CFG Convertor_A_Digen\t\t\t%lu\n", BIT(dword, 0));
756 printf("AUD_PORT_EN_HD_CFG Convertor_B_Digen\t\t\t%lu\n", BIT(dword, 1));
757 printf("AUD_PORT_EN_HD_CFG ConvertorA_Stream_ID\t\t%lu\n", BITS(dword, 7, 4));
758 printf("AUD_PORT_EN_HD_CFG ConvertorB_Stream_ID\t\t%lu\n", BITS(dword, 11, 8));
759 printf("AUD_PORT_EN_HD_CFG Port_B_Out_Enable\t\t\t%lu\n", BIT(dword, 12));
760 printf("AUD_PORT_EN_HD_CFG Port_C_Out_Enable\t\t\t%lu\n", BIT(dword, 13));
761 printf("AUD_PORT_EN_HD_CFG Port_D_Out_Enable\t\t\t%lu\n", BIT(dword, 14));
762 printf("AUD_PORT_EN_HD_CFG Port_B_Amp_Mute_Status\t\t%lu\n", BIT(dword, 16));
763 printf("AUD_PORT_EN_HD_CFG Port_C_Amp_Mute_Status\t\t%lu\n", BIT(dword, 17));
764 printf("AUD_PORT_EN_HD_CFG Port_D_Amp_Mute_Status\t\t%lu\n", BIT(dword, 18));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800765
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400766 dword = INREG(AUD_OUT_DIG_CNVT_A);
767 printf("AUD_OUT_DIG_CNVT_A V\t\t\t\t\t%lu\n", BIT(dword, 1));
768 printf("AUD_OUT_DIG_CNVT_A VCFG\t\t\t\t%lu\n", BIT(dword, 2));
769 printf("AUD_OUT_DIG_CNVT_A PRE\t\t\t\t\t%lu\n", BIT(dword, 3));
770 printf("AUD_OUT_DIG_CNVT_A Copy\t\t\t\t%lu\n", BIT(dword, 4));
771 printf("AUD_OUT_DIG_CNVT_A NonAudio\t\t\t\t%lu\n", BIT(dword, 5));
772 printf("AUD_OUT_DIG_CNVT_A PRO\t\t\t\t\t%lu\n", BIT(dword, 6));
773 printf("AUD_OUT_DIG_CNVT_A Level\t\t\t\t%lu\n", BIT(dword, 7));
774 printf("AUD_OUT_DIG_CNVT_A Category_Code\t\t\t%lu\n", BITS(dword, 14, 8));
775 printf("AUD_OUT_DIG_CNVT_A Lowest_Channel_Number\t\t%lu\n", BITS(dword, 19, 16));
776 printf("AUD_OUT_DIG_CNVT_A Stream_ID\t\t\t\t%lu\n", BITS(dword, 23, 20));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800777
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400778 dword = INREG(AUD_OUT_DIG_CNVT_B);
779 printf("AUD_OUT_DIG_CNVT_B V\t\t\t\t\t%lu\n", BIT(dword, 1));
780 printf("AUD_OUT_DIG_CNVT_B VCFG\t\t\t\t%lu\n", BIT(dword, 2));
781 printf("AUD_OUT_DIG_CNVT_B PRE\t\t\t\t\t%lu\n", BIT(dword, 3));
782 printf("AUD_OUT_DIG_CNVT_B Copy\t\t\t\t%lu\n", BIT(dword, 4));
783 printf("AUD_OUT_DIG_CNVT_B NonAudio\t\t\t\t%lu\n", BIT(dword, 5));
784 printf("AUD_OUT_DIG_CNVT_B PRO\t\t\t\t\t%lu\n", BIT(dword, 6));
785 printf("AUD_OUT_DIG_CNVT_B Level\t\t\t\t%lu\n", BIT(dword, 7));
786 printf("AUD_OUT_DIG_CNVT_B Category_Code\t\t\t%lu\n", BITS(dword, 14, 8));
787 printf("AUD_OUT_DIG_CNVT_B Lowest_Channel_Number\t\t%lu\n", BITS(dword, 19, 16));
788 printf("AUD_OUT_DIG_CNVT_B Stream_ID\t\t\t\t%lu\n", BITS(dword, 23, 20));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800789
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400790 printf("AUD_OUT_CH_STR Converter_Channel_MAP PORTB PORTC PORTD\n");
791 for (i = 0; i < 8; i++) {
792 OUTREG(AUD_OUT_CH_STR, i | (i << 8) | (i << 16));
793 dword = INREG(AUD_OUT_CH_STR);
794 printf("\t\t\t\t%lu\t%lu\t%lu\t%lu\n",
795 1 + BITS(dword, 3, 0),
796 1 + BITS(dword, 7, 4),
797 1 + BITS(dword, 15, 12),
798 1 + BITS(dword, 23, 20));
799 }
Wu Fengguang020abdb2010-04-19 13:13:06 +0800800
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400801 dword = INREG(AUD_OUT_STR_DESC_A);
802 printf("AUD_OUT_STR_DESC_A HBR_enable\t\t\t\t%lu\n", BITS(dword, 28, 27));
803 printf("AUD_OUT_STR_DESC_A Convertor_Channel_Count\t\t%lu\n", BITS(dword, 20, 16) + 1);
804 printf("AUD_OUT_STR_DESC_A Bits_per_Sample\t\t\t[%#lx] %s\n",
805 BITS(dword, 6, 4), OPNAME(bits_per_sample, BITS(dword, 6, 4)));
806 printf("AUD_OUT_STR_DESC_A Number_of_Channels_in_a_Stream\t%lu\n", 1 + BITS(dword, 3, 0));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800807
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400808 dword = INREG(AUD_OUT_STR_DESC_B);
809 printf("AUD_OUT_STR_DESC_B HBR_enable\t\t\t\t%lu\n", BITS(dword, 28, 27));
810 printf("AUD_OUT_STR_DESC_B Convertor_Channel_Count\t\t%lu\n", BITS(dword, 20, 16) + 1);
811 printf("AUD_OUT_STR_DESC_B Bits_per_Sample\t\t\t[%#lx] %s\n",
812 BITS(dword, 6, 4), OPNAME(bits_per_sample, BITS(dword, 6, 4)));
813 printf("AUD_OUT_STR_DESC_B Number_of_Channels_in_a_Stream\t%lu\n", 1 + BITS(dword, 3, 0));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800814
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400815 dword = INREG(AUD_PINW_CONNLNG_SEL);
816 printf("AUD_PINW_CONNLNG_SEL Connection_select_Control_B\t%lu\n", BITS(dword, 7, 0));
817 printf("AUD_PINW_CONNLNG_SEL Connection_select_Control_C\t%lu\n", BITS(dword, 15, 8));
818 printf("AUD_PINW_CONNLNG_SEL Connection_select_Control_D\t%lu\n", BITS(dword, 23, 16));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800819
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400820 dword = INREG(AUD_CNTL_ST_A);
821 printf("AUD_CNTL_ST_A DIP_Port_Select\t\t\t\t[%#lx] %s\n",
822 BITS(dword, 30, 29), dip_port[BITS(dword, 30, 29)]);
823 printf("AUD_CNTL_ST_A DIP_type_enable_status Audio DIP\t\t%lu\n", BIT(dword, 21));
824 printf("AUD_CNTL_ST_A DIP_type_enable_status ACP DIP\t\t%lu\n", BIT(dword, 22));
825 printf("AUD_CNTL_ST_A DIP_type_enable_status Generic 2 DIP\t%lu\n", BIT(dword, 23));
826 printf("AUD_CNTL_ST_A DIP_transmission_frequency\t\t[0x%lx] %s\n",
827 BITS(dword, 17, 16), dip_trans[BITS(dword, 17, 16)]);
828 printf("AUD_CNTL_ST_A ELD_ACK\t\t\t\t\t%lu\n", BIT(dword, 4));
829 printf("AUD_CNTL_ST_A ELD_buffer_size\t\t\t\t%lu\n", BITS(dword, 14, 10));
830 printf("AUD_CNTL_ST_A ELD_access_address\t\t\t%lu\n", BITS(dword, 9, 5));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800831
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400832 dword = INREG(AUD_CNTL_ST_B);
833 printf("AUD_CNTL_ST_B DIP_Port_Select\t\t\t\t[%#lx] %s\n",
834 BITS(dword, 30, 29), dip_port[BITS(dword, 30, 29)]);
835 printf("AUD_CNTL_ST_B DIP_type_enable_status Audio DIP\t\t%lu\n", BIT(dword, 21));
836 printf("AUD_CNTL_ST_B DIP_type_enable_status ACP DIP\t\t%lu\n", BIT(dword, 22));
837 printf("AUD_CNTL_ST_B DIP_type_enable_status Generic 2 DIP\t%lu\n", BIT(dword, 23));
838 printf("AUD_CNTL_ST_B DIP_transmission_frequency\t\t[0x%lx] %s\n",
839 BITS(dword, 17, 16), dip_trans[BITS(dword, 17, 16)]);
840 printf("AUD_CNTL_ST_B ELD_ACK\t\t\t\t\t%lu\n", BIT(dword, 4));
841 printf("AUD_CNTL_ST_B ELD_buffer_size\t\t\t\t%lu\n", BITS(dword, 14, 10));
842 printf("AUD_CNTL_ST_B ELD_access_address\t\t\t%lu\n", BITS(dword, 9, 5));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800843
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400844 dword = INREG(AUD_CNTL_ST2);
845 printf("AUD_CNTL_ST2 CP_ReadyB\t\t\t\t\t%lu\n", BIT(dword, 1));
846 printf("AUD_CNTL_ST2 ELD_validB\t\t\t\t%lu\n", BIT(dword, 0));
847 printf("AUD_CNTL_ST2 CP_ReadyC\t\t\t\t\t%lu\n", BIT(dword, 5));
848 printf("AUD_CNTL_ST2 ELD_validC\t\t\t\t%lu\n", BIT(dword, 4));
849 printf("AUD_CNTL_ST2 CP_ReadyD\t\t\t\t\t%lu\n", BIT(dword, 9));
850 printf("AUD_CNTL_ST2 ELD_validD\t\t\t\t%lu\n", BIT(dword, 8));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800851
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400852 dword = INREG(AUD_HDMIW_STATUS);
853 printf("AUD_HDMIW_STATUS Conv_B_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 31));
854 printf("AUD_HDMIW_STATUS Conv_B_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n", BIT(dword, 30));
855 printf("AUD_HDMIW_STATUS Conv_A_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 29));
856 printf("AUD_HDMIW_STATUS Conv_A_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n", BIT(dword, 28));
857 printf("AUD_HDMIW_STATUS BCLK/CDCLK_FIFO_Overrun\t\t%lu\n", BIT(dword, 25));
858 printf("AUD_HDMIW_STATUS Function_Reset\t\t\t%lu\n", BIT(dword, 29));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800859
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400860 printf("AUD_HDMIW_HDMIEDID_A HDMI ELD:\n\t");
861 dword = INREG(AUD_CNTL_ST_A);
862 dword &= ~BITMASK(9, 5);
863 OUTREG(AUD_CNTL_ST_A, dword);
864 for (i = 0; i < BITS(dword, 14, 10) / 4; i++)
865 printf("%08x ", htonl(INREG(AUD_HDMIW_HDMIEDID_A)));
866 printf("\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +0800867
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400868 printf("AUD_HDMIW_HDMIEDID_B HDMI ELD:\n\t");
869 dword = INREG(AUD_CNTL_ST_B);
870 dword &= ~BITMASK(9, 5);
871 OUTREG(AUD_CNTL_ST_B, dword);
872 for (i = 0; i < BITS(dword, 14, 10) / 4; i++)
873 printf("%08x ", htonl(INREG(AUD_HDMIW_HDMIEDID_B)));
874 printf("\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +0800875
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400876 printf("AUD_HDMIW_INFOFR_A HDMI audio Infoframe:\n\t");
877 dword = INREG(AUD_CNTL_ST_A);
878 dword &= ~BITMASK(20, 18);
879 dword &= ~BITMASK(3, 0);
880 OUTREG(AUD_CNTL_ST_A, dword);
881 for (i = 0; i < 8; i++)
882 printf("%08x ", htonl(INREG(AUD_HDMIW_INFOFR_A)));
883 printf("\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +0800884
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400885 printf("AUD_HDMIW_INFOFR_B HDMI audio Infoframe:\n\t");
886 dword = INREG(AUD_CNTL_ST_B);
887 dword &= ~BITMASK(20, 18);
888 dword &= ~BITMASK(3, 0);
889 OUTREG(AUD_CNTL_ST_B, dword);
890 for (i = 0; i < 8; i++)
891 printf("%08x ", htonl(INREG(AUD_HDMIW_INFOFR_B)));
892 printf("\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +0800893
894}
895
896
897#undef AUD_CONFIG_A
898#undef AUD_MISC_CTRL_A
899#undef AUD_VID_DID
900#undef AUD_RID
901#undef AUD_CTS_ENABLE_A
902#undef AUD_PWRST
903#undef AUD_HDMIW_HDMIEDID_A
904#undef AUD_HDMIW_INFOFR_A
905#undef AUD_PORT_EN_HD_CFG
906#undef AUD_OUT_DIG_CNVT_A
907#undef AUD_OUT_STR_DESC_A
908#undef AUD_OUT_CH_STR
909#undef AUD_PINW_CONNLNG_LIST
910#undef AUD_CNTL_ST_A
911#undef AUD_HDMIW_STATUS
912#undef AUD_CONFIG_B
913#undef AUD_MISC_CTRL_B
914#undef AUD_CTS_ENABLE_B
915#undef AUD_HDMIW_HDMIEDID_B
916#undef AUD_HDMIW_INFOFR_B
917#undef AUD_OUT_DIG_CNVT_B
918#undef AUD_OUT_STR_DESC_B
919#undef AUD_CNTL_ST_B
920
921/*
922 * CougarPoint registers
923 */
Wu Fengguang97d20312011-11-12 11:12:45 +0800924#define DP_CTL_B 0xE4100
Wu Fengguang020abdb2010-04-19 13:13:06 +0800925#define DP_CTL_C 0xE4200
926#define DP_AUX_CTL_C 0xE4210
927#define DP_AUX_TST_C 0xE4228
928#define SPORT_DDI_CRC_C 0xE4250
929#define SPORT_DDI_CRC_R 0xE4264
930#define DP_CTL_D 0xE4300
931#define DP_AUX_CTL_D 0xE4310
932#define DP_AUX_TST_D 0xE4328
933#define SPORT_DDI_CRC_CTL_D 0xE4350
934#define AUD_CONFIG_A 0xE5000
935#define AUD_MISC_CTRL_A 0xE5010
936#define AUD_VID_DID 0xE5020
937#define AUD_RID 0xE5024
938#define AUD_CTS_ENABLE_A 0xE5028
939#define AUD_PWRST 0xE504C
940#define AUD_HDMIW_HDMIEDID_A 0xE5050
941#define AUD_HDMIW_INFOFR_A 0xE5054
942#define AUD_PORT_EN_HD_CFG 0xE507C
943#define AUD_OUT_DIG_CNVT_A 0xE5080
944#define AUD_OUT_STR_DESC_A 0xE5084
945#define AUD_OUT_CH_STR 0xE5088
946#define AUD_PINW_CONNLNG_LIST 0xE50A8
947#define AUD_PINW_CONNLNG_SELA 0xE50AC
948#define AUD_CNTL_ST_A 0xE50B4
949#define AUD_CNTRL_ST2 0xE50C0
950#define AUD_CNTRL_ST3 0xE50C4
951#define AUD_HDMIW_STATUS 0xE50D4
952#define AUD_CONFIG_B 0xE5100
953#define AUD_MISC_CTRL_B 0xE5110
954#define AUD_CTS_ENABLE_B 0xE5128
955#define AUD_HDMIW_HDMIEDID_B 0xE5150
956#define AUD_HDMIW_INFOFR_B 0xE5154
957#define AUD_OUT_DIG_CNVT_B 0xE5180
958#define AUD_OUT_STR_DESC_B 0xE5184
959#define AUD_CNTL_ST_B 0xE51B4
960#define AUD_CONFIG_C 0xE5200
961#define AUD_MISC_CTRL_C 0xE5210
962#define AUD_CTS_ENABLE_C 0xE5228
963#define AUD_HDMIW_HDMIEDID_C 0xE5250
964#define AUD_HDMIW_INFOFR_C 0xE5254
965#define AUD_OUT_DIG_CNVT_C 0xE5280
966#define AUD_OUT_STR_DESC_C 0xE5284
967#define AUD_CNTL_ST_C 0xE52B4
968#define AUD_CONFIG_D 0xE5300
969#define AUD_MISC_CTRL_D 0xE5310
970#define AUD_CTS_ENABLE_D 0xE5328
971#define AUD_HDMIW_HDMIEDID_D 0xE5350
972#define AUD_HDMIW_INFOFR_D 0xE5354
973#define AUD_OUT_DIG_CNVT_D 0xE5380
974#define AUD_OUT_STR_DESC_D 0xE5384
975#define AUD_CNTL_ST_D 0xE53B4
976
Wu Fengguange321f132011-11-12 11:12:52 +0800977#define VIDEO_DIP_CTL_A 0xE0200
978#define VIDEO_DIP_CTL_B 0xE1200
979#define VIDEO_DIP_CTL_C 0xE2200
980#define VIDEO_DIP_CTL_D 0xE3200
981
Wu Fengguang020abdb2010-04-19 13:13:06 +0800982
983static void dump_cpt(void)
984{
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400985 uint32_t dword;
986 int i;
Wu Fengguang020abdb2010-04-19 13:13:06 +0800987
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400988 dump_reg(HDMIB, "sDVO/HDMI Port B Control");
989 dump_reg(HDMIC, "HDMI Port C Control");
990 dump_reg(HDMID, "HDMI Port D Control");
991 dump_reg(DP_CTL_B, "DisplayPort B Control");
992 dump_reg(DP_CTL_C, "DisplayPort C Control");
993 dump_reg(DP_CTL_D, "DisplayPort D Control");
994 dump_reg(TRANS_DP_CTL_A, "Transcoder A DisplayPort Control");
995 dump_reg(TRANS_DP_CTL_B, "Transcoder B DisplayPort Control");
996 dump_reg(TRANS_DP_CTL_C, "Transcoder C DisplayPort Control");
997 dump_reg(AUD_CONFIG_A, "Audio Configuration - Transcoder A");
998 dump_reg(AUD_CONFIG_B, "Audio Configuration - Transcoder B");
999 dump_reg(AUD_CONFIG_C, "Audio Configuration - Transcoder C");
1000 dump_reg(AUD_CTS_ENABLE_A, "Audio CTS Programming Enable - Transcoder A");
1001 dump_reg(AUD_CTS_ENABLE_B, "Audio CTS Programming Enable - Transcoder B");
1002 dump_reg(AUD_CTS_ENABLE_C, "Audio CTS Programming Enable - Transcoder C");
1003 dump_reg(AUD_MISC_CTRL_A, "Audio MISC Control for Transcoder A");
1004 dump_reg(AUD_MISC_CTRL_B, "Audio MISC Control for Transcoder B");
1005 dump_reg(AUD_MISC_CTRL_C, "Audio MISC Control for Transcoder C");
1006 dump_reg(AUD_VID_DID, "Audio Vendor ID / Device ID");
1007 dump_reg(AUD_RID, "Audio Revision ID");
1008 dump_reg(AUD_PWRST, "Audio Power State (Function Group, Convertor, Pin Widget)");
1009 dump_reg(AUD_PORT_EN_HD_CFG, "Audio Port Enable HDAudio Config");
1010 dump_reg(AUD_OUT_DIG_CNVT_A, "Audio Digital Converter - Conv A");
1011 dump_reg(AUD_OUT_DIG_CNVT_B, "Audio Digital Converter - Conv B");
1012 dump_reg(AUD_OUT_DIG_CNVT_C, "Audio Digital Converter - Conv C");
1013 dump_reg(AUD_OUT_CH_STR, "Audio Channel ID and Stream ID");
1014 dump_reg(AUD_OUT_STR_DESC_A, "Audio Stream Descriptor Format - Conv A");
1015 dump_reg(AUD_OUT_STR_DESC_B, "Audio Stream Descriptor Format - Conv B");
1016 dump_reg(AUD_OUT_STR_DESC_C, "Audio Stream Descriptor Format - Conv C");
1017 dump_reg(AUD_PINW_CONNLNG_LIST, "Audio Connection List");
1018 dump_reg(AUD_PINW_CONNLNG_SEL, "Audio Connection Select");
1019 dump_reg(AUD_CNTL_ST_A, "Audio Control State Register - Transcoder A");
1020 dump_reg(AUD_CNTL_ST_B, "Audio Control State Register - Transcoder B");
1021 dump_reg(AUD_CNTL_ST_C, "Audio Control State Register - Transcoder C");
1022 dump_reg(AUD_CNTRL_ST2, "Audio Control State 2");
1023 dump_reg(AUD_CNTRL_ST3, "Audio Control State 3");
1024 dump_reg(AUD_HDMIW_STATUS, "Audio HDMI Status");
1025 dump_reg(AUD_HDMIW_HDMIEDID_A, "HDMI Data EDID Block - Transcoder A");
1026 dump_reg(AUD_HDMIW_HDMIEDID_B, "HDMI Data EDID Block - Transcoder B");
1027 dump_reg(AUD_HDMIW_HDMIEDID_C, "HDMI Data EDID Block - Transcoder C");
1028 dump_reg(AUD_HDMIW_INFOFR_A, "Audio Widget Data Island Packet - Transcoder A");
1029 dump_reg(AUD_HDMIW_INFOFR_B, "Audio Widget Data Island Packet - Transcoder B");
1030 dump_reg(AUD_HDMIW_INFOFR_C, "Audio Widget Data Island Packet - Transcoder C");
Wu Fengguang020abdb2010-04-19 13:13:06 +08001031
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001032 printf("\nDetails:\n\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +08001033
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001034 dword = INREG(VIDEO_DIP_CTL_A);
1035 printf("VIDEO_DIP_CTL_A Enable_Graphics_DIP\t\t\t%ld\n", BIT(dword, 31)),
1036 printf("VIDEO_DIP_CTL_A GCP_DIP_enable\t\t\t\t%ld\n", BIT(dword, 25)),
1037 printf("VIDEO_DIP_CTL_A Video_DIP_type_enable AVI\t\t%lu\n", BIT(dword, 21));
1038 printf("VIDEO_DIP_CTL_A Video_DIP_type_enable Vendor\t\t%lu\n", BIT(dword, 22));
1039 printf("VIDEO_DIP_CTL_A Video_DIP_type_enable Gamut\t\t%lu\n", BIT(dword, 23));
1040 printf("VIDEO_DIP_CTL_A Video_DIP_type_enable Source \t\t%lu\n", BIT(dword, 24));
1041 printf("VIDEO_DIP_CTL_A Video_DIP_buffer_index\t\t\t[0x%lx] %s\n",
1042 BITS(dword, 20, 19), video_dip_index[BITS(dword, 20, 19)]);
1043 printf("VIDEO_DIP_CTL_A Video_DIP_frequency\t\t\t[0x%lx] %s\n",
1044 BITS(dword, 17, 16), video_dip_trans[BITS(dword, 17, 16)]);
1045 printf("VIDEO_DIP_CTL_A Video_DIP_buffer_size\t\t\t%lu\n", BITS(dword, 11, 8));
1046 printf("VIDEO_DIP_CTL_A Video_DIP_access_address\t\t%lu\n", BITS(dword, 3, 0));
Wu Fengguange321f132011-11-12 11:12:52 +08001047
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001048 dword = INREG(VIDEO_DIP_CTL_B);
1049 printf("VIDEO_DIP_CTL_B Enable_Graphics_DIP\t\t\t%ld\n", BIT(dword, 31)),
1050 printf("VIDEO_DIP_CTL_B GCP_DIP_enable\t\t\t\t%ld\n", BIT(dword, 25)),
1051 printf("VIDEO_DIP_CTL_B Video_DIP_type_enable AVI\t\t%lu\n", BIT(dword, 21));
1052 printf("VIDEO_DIP_CTL_B Video_DIP_type_enable Vendor\t\t%lu\n", BIT(dword, 22));
1053 printf("VIDEO_DIP_CTL_B Video_DIP_type_enable Gamut\t\t%lu\n", BIT(dword, 23));
1054 printf("VIDEO_DIP_CTL_B Video_DIP_type_enable Source \t\t%lu\n", BIT(dword, 24));
1055 printf("VIDEO_DIP_CTL_B Video_DIP_buffer_index\t\t\t[0x%lx] %s\n",
1056 BITS(dword, 20, 19), video_dip_index[BITS(dword, 20, 19)]);
1057 printf("VIDEO_DIP_CTL_B Video_DIP_frequency\t\t\t[0x%lx] %s\n",
1058 BITS(dword, 17, 16), video_dip_trans[BITS(dword, 17, 16)]);
1059 printf("VIDEO_DIP_CTL_B Video_DIP_buffer_size\t\t\t%lu\n", BITS(dword, 11, 8));
1060 printf("VIDEO_DIP_CTL_B Video_DIP_access_address\t\t%lu\n", BITS(dword, 3, 0));
Wu Fengguange321f132011-11-12 11:12:52 +08001061
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001062 dword = INREG(VIDEO_DIP_CTL_C);
1063 printf("VIDEO_DIP_CTL_C Enable_Graphics_DIP\t\t\t%ld\n", BIT(dword, 31)),
1064 printf("VIDEO_DIP_CTL_C GCP_DIP_enable\t\t\t\t%ld\n", BIT(dword, 25)),
1065 printf("VIDEO_DIP_CTL_C Video_DIP_type_enable AVI\t\t%lu\n", BIT(dword, 21));
1066 printf("VIDEO_DIP_CTL_C Video_DIP_type_enable Vendor\t\t%lu\n", BIT(dword, 22));
1067 printf("VIDEO_DIP_CTL_C Video_DIP_type_enable Gamut\t\t%lu\n", BIT(dword, 23));
1068 printf("VIDEO_DIP_CTL_C Video_DIP_type_enable Source \t\t%lu\n", BIT(dword, 24));
1069 printf("VIDEO_DIP_CTL_C Video_DIP_buffer_index\t\t\t[0x%lx] %s\n",
1070 BITS(dword, 20, 19), video_dip_index[BITS(dword, 20, 19)]);
1071 printf("VIDEO_DIP_CTL_C Video_DIP_frequency\t\t\t[0x%lx] %s\n",
1072 BITS(dword, 17, 16), video_dip_trans[BITS(dword, 17, 16)]);
1073 printf("VIDEO_DIP_CTL_C Video_DIP_buffer_size\t\t\t%lu\n", BITS(dword, 11, 8));
1074 printf("VIDEO_DIP_CTL_C Video_DIP_access_address\t\t%lu\n", BITS(dword, 3, 0));
Wu Fengguange321f132011-11-12 11:12:52 +08001075
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001076 dword = INREG(AUD_VID_DID);
1077 printf("AUD_VID_DID vendor id\t\t\t\t\t0x%x\n", dword >> 16);
1078 printf("AUD_VID_DID device id\t\t\t\t\t0x%x\n", dword & 0xffff);
Wu Fengguang020abdb2010-04-19 13:13:06 +08001079
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001080 dword = INREG(AUD_RID);
1081 printf("AUD_RID Major_Revision\t\t\t\t\t0x%lx\n", BITS(dword, 23, 20));
1082 printf("AUD_RID Minor_Revision\t\t\t\t\t0x%lx\n", BITS(dword, 19, 16));
1083 printf("AUD_RID Revision_Id\t\t\t\t\t0x%lx\n", BITS(dword, 15, 8));
1084 printf("AUD_RID Stepping_Id\t\t\t\t\t0x%lx\n", BITS(dword, 7, 0));
Wu Fengguang020abdb2010-04-19 13:13:06 +08001085
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001086 dword = INREG(HDMIB);
1087 printf("HDMIB Port_Enable\t\t\t\t\t%u\n", !!(dword & SDVO_ENABLE));
1088 printf("HDMIB Transcoder_Select\t\t\t\t\t[0x%lx] %s\n",
1089 BITS(dword, 30, 29), transcoder_select[BITS(dword, 30, 29)]);
1090 printf("HDMIB sDVO_Border_Enable\t\t\t\t%lu\n", BIT(dword, 7));
1091 printf("HDMIB HDCP_Port_Select\t\t\t\t\t%lu\n", BIT(dword, 5));
1092 printf("HDMIB SDVO_HPD_Interrupt_Enable\t\t\t\t%lu\n", BIT(dword, 23));
1093 printf("HDMIB Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
1094 printf("HDMIB Encoding\t\t\t\t\t\t[0x%lx] %s\n",
1095 BITS(dword, 11, 10), sdvo_hdmi_encoding[BITS(dword, 11, 10)]);
1096 printf("HDMIB HDMI_or_DVI_Select\t\t\t\t%s\n", BIT(dword, 9) ? "HDMI" : "DVI");
1097 printf("HDMIB Audio_Output_Enable\t\t\t\t%u\n", !!(dword & SDVO_AUDIO_ENABLE));
Wu Fengguang020abdb2010-04-19 13:13:06 +08001098
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001099 dword = INREG(HDMIC);
1100 printf("HDMIC Port_Enable\t\t\t\t\t%u\n", !!(dword & SDVO_ENABLE));
1101 printf("HDMIC Transcoder_Select\t\t\t\t\t[0x%lx] %s\n",
1102 BITS(dword, 30, 29), transcoder_select[BITS(dword, 30, 29)]);
1103 printf("HDMIC sDVO_Border_Enable\t\t\t\t%lu\n", BIT(dword, 7));
1104 printf("HDMIC HDCP_Port_Select\t\t\t\t\t%lu\n", BIT(dword, 5));
1105 printf("HDMIC SDVO_HPD_Interrupt_Enable\t\t\t\t%lu\n", BIT(dword, 23));
1106 printf("HDMIC Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
1107 printf("HDMIC Encoding\t\t\t\t\t\t[0x%lx] %s\n",
1108 BITS(dword, 11, 10), sdvo_hdmi_encoding[BITS(dword, 11, 10)]);
1109 printf("HDMIC HDMI_or_DVI_Select\t\t\t\t%s\n", BIT(dword, 9) ? "HDMI" : "DVI");
1110 printf("HDMIC Audio_Output_Enable\t\t\t\t%u\n", !!(dword & SDVO_AUDIO_ENABLE));
Wu Fengguang020abdb2010-04-19 13:13:06 +08001111
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001112 dword = INREG(HDMID);
1113 printf("HDMID Port_Enable\t\t\t\t\t%u\n", !!(dword & SDVO_ENABLE));
1114 printf("HDMID Transcoder_Select\t\t\t\t\t[0x%lx] %s\n",
1115 BITS(dword, 30, 29), transcoder_select[BITS(dword, 30, 29)]);
1116 printf("HDMID sDVO_Border_Enable\t\t\t\t%lu\n", BIT(dword, 7));
1117 printf("HDMID HDCP_Port_Select\t\t\t\t\t%lu\n", BIT(dword, 5));
1118 printf("HDMID SDVO_HPD_Interrupt_Enable\t\t\t\t%lu\n", BIT(dword, 23));
1119 printf("HDMID Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
1120 printf("HDMID Encoding\t\t\t\t\t\t[0x%lx] %s\n",
1121 BITS(dword, 11, 10), sdvo_hdmi_encoding[BITS(dword, 11, 10)]);
1122 printf("HDMID HDMI_or_DVI_Select\t\t\t\t%s\n", BIT(dword, 9) ? "HDMI" : "DVI");
1123 printf("HDMID Audio_Output_Enable\t\t\t\t%u\n", !!(dword & SDVO_AUDIO_ENABLE));
Wu Fengguang020abdb2010-04-19 13:13:06 +08001124
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001125 dword = INREG(DP_CTL_B);
1126 printf("DP_CTL_B DisplayPort_Enable\t\t\t\t%lu\n", BIT(dword, 31));
1127 printf("DP_CTL_B Port_Width_Selection\t\t\t\t[0x%lx] %s\n",
1128 BITS(dword, 21, 19), dp_port_width[BITS(dword, 21, 19)]);
1129 printf("DP_CTL_B Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
1130 printf("DP_CTL_B HDCP_Port_Select\t\t\t\t%lu\n", BIT(dword, 5));
1131 printf("DP_CTL_B Audio_Output_Enable\t\t\t\t%lu\n", BIT(dword, 6));
Wu Fengguang020abdb2010-04-19 13:13:06 +08001132
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001133 dword = INREG(DP_CTL_C);
1134 printf("DP_CTL_C DisplayPort_Enable\t\t\t\t%lu\n", BIT(dword, 31));
1135 printf("DP_CTL_C Port_Width_Selection\t\t\t\t[0x%lx] %s\n",
1136 BITS(dword, 21, 19), dp_port_width[BITS(dword, 21, 19)]);
1137 printf("DP_CTL_C Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
1138 printf("DP_CTL_C HDCP_Port_Select\t\t\t\t%lu\n", BIT(dword, 5));
1139 printf("DP_CTL_C Audio_Output_Enable\t\t\t\t%lu\n", BIT(dword, 6));
Wu Fengguang020abdb2010-04-19 13:13:06 +08001140
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001141 dword = INREG(DP_CTL_D);
1142 printf("DP_CTL_D DisplayPort_Enable\t\t\t\t%lu\n", BIT(dword, 31));
1143 printf("DP_CTL_D Port_Width_Selection\t\t\t\t[0x%lx] %s\n",
1144 BITS(dword, 21, 19), dp_port_width[BITS(dword, 21, 19)]);
1145 printf("DP_CTL_D Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
1146 printf("DP_CTL_D HDCP_Port_Select\t\t\t\t%lu\n", BIT(dword, 5));
1147 printf("DP_CTL_D Audio_Output_Enable\t\t\t\t%lu\n", BIT(dword, 6));
Wu Fengguang020abdb2010-04-19 13:13:06 +08001148
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001149 dword = INREG(AUD_CONFIG_A);
1150 printf("AUD_CONFIG_A N_index_value\t\t\t\t[0x%lx] %s\n", BIT(dword, 29),
1151 n_index_value[BIT(dword, 29)]);
1152 printf("AUD_CONFIG_A N_programming_enable\t\t\t%lu\n", BIT(dword, 28));
1153 printf("AUD_CONFIG_A Upper_N_value\t\t\t\t0x%02lx\n", BITS(dword, 27, 20));
1154 printf("AUD_CONFIG_A Lower_N_value\t\t\t\t0x%03lx\n", BITS(dword, 15, 4));
1155 printf("AUD_CONFIG_A Pixel_Clock_HDMI\t\t\t\t[0x%lx] %s\n", BITS(dword, 19, 16),
1156 OPNAME(pixel_clock, BITS(dword, 19, 16)));
1157 printf("AUD_CONFIG_A Disable_NCTS\t\t\t\t%lu\n", BIT(dword, 3));
1158 dword = INREG(AUD_CONFIG_B);
1159 printf("AUD_CONFIG_B N_index_value\t\t\t\t[0x%lx] %s\n", BIT(dword, 29),
1160 n_index_value[BIT(dword, 29)]);
1161 printf("AUD_CONFIG_B N_programming_enable\t\t\t%lu\n", BIT(dword, 28));
1162 printf("AUD_CONFIG_B Upper_N_value\t\t\t\t0x%02lx\n", BITS(dword, 27, 20));
1163 printf("AUD_CONFIG_B Lower_N_value\t\t\t\t0x%03lx\n", BITS(dword, 15, 4));
1164 printf("AUD_CONFIG_B Pixel_Clock_HDMI\t\t\t\t[0x%lx] %s\n", BITS(dword, 19, 16),
1165 OPNAME(pixel_clock, BITS(dword, 19, 16)));
1166 printf("AUD_CONFIG_B Disable_NCTS\t\t\t\t%lu\n", BIT(dword, 3));
1167 dword = INREG(AUD_CONFIG_C);
1168 printf("AUD_CONFIG_C N_index_value\t\t\t\t[0x%lx] %s\n", BIT(dword, 29),
1169 n_index_value[BIT(dword, 29)]);
1170 printf("AUD_CONFIG_C N_programming_enable\t\t\t%lu\n", BIT(dword, 28));
1171 printf("AUD_CONFIG_C Upper_N_value\t\t\t\t0x%02lx\n", BITS(dword, 27, 20));
1172 printf("AUD_CONFIG_C Lower_N_value\t\t\t\t0x%03lx\n", BITS(dword, 15, 4));
1173 printf("AUD_CONFIG_C Pixel_Clock_HDMI\t\t\t\t[0x%lx] %s\n", BITS(dword, 19, 16),
1174 OPNAME(pixel_clock, BITS(dword, 19, 16)));
1175 printf("AUD_CONFIG_C Disable_NCTS\t\t\t\t%lu\n", BIT(dword, 3));
Wu Fengguang020abdb2010-04-19 13:13:06 +08001176
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001177 dword = INREG(AUD_CTS_ENABLE_A);
1178 printf("AUD_CTS_ENABLE_A Enable_CTS_or_M_programming\t\t%lu\n", BIT(dword, 20));
1179 printf("AUD_CTS_ENABLE_A CTS_M value Index\t\t\t%s\n", BIT(dword, 21) ? "CTS" : "M");
1180 printf("AUD_CTS_ENABLE_A CTS_programming\t\t\t%#lx\n", BITS(dword, 19, 0));
1181 dword = INREG(AUD_CTS_ENABLE_B);
1182 printf("AUD_CTS_ENABLE_B Enable_CTS_or_M_programming\t\t%lu\n", BIT(dword, 20));
1183 printf("AUD_CTS_ENABLE_B CTS_M value Index\t\t\t%s\n", BIT(dword, 21) ? "CTS" : "M");
1184 printf("AUD_CTS_ENABLE_B CTS_programming\t\t\t%#lx\n", BITS(dword, 19, 0));
1185 dword = INREG(AUD_CTS_ENABLE_C);
1186 printf("AUD_CTS_ENABLE_C Enable_CTS_or_M_programming\t\t%lu\n", BIT(dword, 20));
1187 printf("AUD_CTS_ENABLE_C CTS_M value Index\t\t\t%s\n", BIT(dword, 21) ? "CTS" : "M");
1188 printf("AUD_CTS_ENABLE_C CTS_programming\t\t\t%#lx\n", BITS(dword, 19, 0));
Wu Fengguang020abdb2010-04-19 13:13:06 +08001189
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001190 dword = INREG(AUD_MISC_CTRL_A);
1191 printf("AUD_MISC_CTRL_A Sample_Fabrication_EN_bit\t\t%lu\n", BIT(dword, 2));
1192 printf("AUD_MISC_CTRL_A Sample_present_Disable\t\t\t%lu\n", BIT(dword, 8));
1193 printf("AUD_MISC_CTRL_A Output_Delay\t\t\t\t%lu\n", BITS(dword, 7, 4));
1194 printf("AUD_MISC_CTRL_A Pro_Allowed\t\t\t\t%lu\n", BIT(dword, 1));
1195 dword = INREG(AUD_MISC_CTRL_B);
1196 printf("AUD_MISC_CTRL_B Sample_Fabrication_EN_bit\t\t%lu\n", BIT(dword, 2));
1197 printf("AUD_MISC_CTRL_B Sample_present_Disable\t\t\t%lu\n", BIT(dword, 8));
1198 printf("AUD_MISC_CTRL_B Output_Delay\t\t\t\t%lu\n", BITS(dword, 7, 4));
1199 printf("AUD_MISC_CTRL_B Pro_Allowed\t\t\t\t%lu\n", BIT(dword, 1));
1200 dword = INREG(AUD_MISC_CTRL_C);
1201 printf("AUD_MISC_CTRL_C Sample_Fabrication_EN_bit\t\t%lu\n", BIT(dword, 2));
1202 printf("AUD_MISC_CTRL_C Sample_present_Disable\t\t\t%lu\n", BIT(dword, 8));
1203 printf("AUD_MISC_CTRL_C Output_Delay\t\t\t\t%lu\n", BITS(dword, 7, 4));
1204 printf("AUD_MISC_CTRL_C Pro_Allowed\t\t\t\t%lu\n", BIT(dword, 1));
Wu Fengguang020abdb2010-04-19 13:13:06 +08001205
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001206 dword = INREG(AUD_PWRST);
1207 printf("AUD_PWRST Func_Grp_Dev_PwrSt_Curr \t%s\n", power_state[BITS(dword, 27, 26)]);
1208 printf("AUD_PWRST Func_Grp_Dev_PwrSt_Set \t%s\n", power_state[BITS(dword, 25, 24)]);
1209 printf("AUD_PWRST ConvertorA_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 15, 14)]);
1210 printf("AUD_PWRST ConvertorA_Widget_Power_State_Requsted \t%s\n", power_state[BITS(dword, 13, 12)]);
1211 printf("AUD_PWRST ConvertorB_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 19, 18)]);
1212 printf("AUD_PWRST ConvertorB_Widget_Power_State_Requested \t%s\n", power_state[BITS(dword, 17, 16)]);
1213 printf("AUD_PWRST ConvC_Widget_PwrSt_Curr \t%s\n", power_state[BITS(dword, 23, 22)]);
1214 printf("AUD_PWRST ConvC_Widget_PwrSt_Req \t%s\n", power_state[BITS(dword, 21, 20)]);
1215 printf("AUD_PWRST PinB_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 3, 2)]);
1216 printf("AUD_PWRST PinB_Widget_Power_State_Set \t%s\n", power_state[BITS(dword, 1, 0)]);
1217 printf("AUD_PWRST PinC_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 7, 6)]);
1218 printf("AUD_PWRST PinC_Widget_Power_State_Set \t%s\n", power_state[BITS(dword, 5, 4)]);
1219 printf("AUD_PWRST PinD_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 11, 10)]);
1220 printf("AUD_PWRST PinD_Widget_Power_State_Set \t%s\n", power_state[BITS(dword, 9, 8)]);
Wu Fengguang020abdb2010-04-19 13:13:06 +08001221
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001222 dword = INREG(AUD_PORT_EN_HD_CFG);
1223 printf("AUD_PORT_EN_HD_CFG Convertor_A_Digen\t\t\t%lu\n", BIT(dword, 0));
1224 printf("AUD_PORT_EN_HD_CFG Convertor_B_Digen\t\t\t%lu\n", BIT(dword, 1));
1225 printf("AUD_PORT_EN_HD_CFG Convertor_C_Digen\t\t\t%lu\n", BIT(dword, 2));
1226 printf("AUD_PORT_EN_HD_CFG ConvertorA_Stream_ID\t\t%lu\n", BITS(dword, 7, 4));
1227 printf("AUD_PORT_EN_HD_CFG ConvertorB_Stream_ID\t\t%lu\n", BITS(dword, 11, 8));
1228 printf("AUD_PORT_EN_HD_CFG ConvertorC_Stream_ID\t\t%lu\n", BITS(dword, 15, 12));
1229 printf("AUD_PORT_EN_HD_CFG Port_B_Out_Enable\t\t\t%lu\n", BIT(dword, 16));
1230 printf("AUD_PORT_EN_HD_CFG Port_C_Out_Enable\t\t\t%lu\n", BIT(dword, 17));
1231 printf("AUD_PORT_EN_HD_CFG Port_D_Out_Enable\t\t\t%lu\n", BIT(dword, 18));
1232 printf("AUD_PORT_EN_HD_CFG Port_B_Amp_Mute_Status\t\t%lu\n", BIT(dword, 20));
1233 printf("AUD_PORT_EN_HD_CFG Port_C_Amp_Mute_Status\t\t%lu\n", BIT(dword, 21));
1234 printf("AUD_PORT_EN_HD_CFG Port_D_Amp_Mute_Status\t\t%lu\n", BIT(dword, 22));
Wu Fengguang020abdb2010-04-19 13:13:06 +08001235
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001236 dword = INREG(AUD_OUT_DIG_CNVT_A);
1237 printf("AUD_OUT_DIG_CNVT_A V\t\t\t\t\t%lu\n", BIT(dword, 1));
1238 printf("AUD_OUT_DIG_CNVT_A VCFG\t\t\t\t%lu\n", BIT(dword, 2));
1239 printf("AUD_OUT_DIG_CNVT_A PRE\t\t\t\t\t%lu\n", BIT(dword, 3));
1240 printf("AUD_OUT_DIG_CNVT_A Copy\t\t\t\t%lu\n", BIT(dword, 4));
1241 printf("AUD_OUT_DIG_CNVT_A NonAudio\t\t\t\t%lu\n", BIT(dword, 5));
1242 printf("AUD_OUT_DIG_CNVT_A PRO\t\t\t\t\t%lu\n", BIT(dword, 6));
1243 printf("AUD_OUT_DIG_CNVT_A Level\t\t\t\t%lu\n", BIT(dword, 7));
1244 printf("AUD_OUT_DIG_CNVT_A Category_Code\t\t\t%lu\n", BITS(dword, 14, 8));
1245 printf("AUD_OUT_DIG_CNVT_A Lowest_Channel_Number\t\t%lu\n", BITS(dword, 19, 16));
1246 printf("AUD_OUT_DIG_CNVT_A Stream_ID\t\t\t\t%lu\n", BITS(dword, 23, 20));
Wu Fengguang020abdb2010-04-19 13:13:06 +08001247
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001248 dword = INREG(AUD_OUT_DIG_CNVT_B);
1249 printf("AUD_OUT_DIG_CNVT_B V\t\t\t\t\t%lu\n", BIT(dword, 1));
1250 printf("AUD_OUT_DIG_CNVT_B VCFG\t\t\t\t%lu\n", BIT(dword, 2));
1251 printf("AUD_OUT_DIG_CNVT_B PRE\t\t\t\t\t%lu\n", BIT(dword, 3));
1252 printf("AUD_OUT_DIG_CNVT_B Copy\t\t\t\t%lu\n", BIT(dword, 4));
1253 printf("AUD_OUT_DIG_CNVT_B NonAudio\t\t\t\t%lu\n", BIT(dword, 5));
1254 printf("AUD_OUT_DIG_CNVT_B PRO\t\t\t\t\t%lu\n", BIT(dword, 6));
1255 printf("AUD_OUT_DIG_CNVT_B Level\t\t\t\t%lu\n", BIT(dword, 7));
1256 printf("AUD_OUT_DIG_CNVT_B Category_Code\t\t\t%lu\n", BITS(dword, 14, 8));
1257 printf("AUD_OUT_DIG_CNVT_B Lowest_Channel_Number\t\t%lu\n", BITS(dword, 19, 16));
1258 printf("AUD_OUT_DIG_CNVT_B Stream_ID\t\t\t\t%lu\n", BITS(dword, 23, 20));
Wu Fengguang020abdb2010-04-19 13:13:06 +08001259
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001260 dword = INREG(AUD_OUT_DIG_CNVT_C);
1261 printf("AUD_OUT_DIG_CNVT_C V\t\t\t\t\t%lu\n", BIT(dword, 1));
1262 printf("AUD_OUT_DIG_CNVT_C VCFG\t\t\t\t%lu\n", BIT(dword, 2));
1263 printf("AUD_OUT_DIG_CNVT_C PRE\t\t\t\t\t%lu\n", BIT(dword, 3));
1264 printf("AUD_OUT_DIG_CNVT_C Copy\t\t\t\t%lu\n", BIT(dword, 4));
1265 printf("AUD_OUT_DIG_CNVT_C NonAudio\t\t\t\t%lu\n", BIT(dword, 5));
1266 printf("AUD_OUT_DIG_CNVT_C PRO\t\t\t\t\t%lu\n", BIT(dword, 6));
1267 printf("AUD_OUT_DIG_CNVT_C Level\t\t\t\t%lu\n", BIT(dword, 7));
1268 printf("AUD_OUT_DIG_CNVT_C Category_Code\t\t\t%lu\n", BITS(dword, 14, 8));
1269 printf("AUD_OUT_DIG_CNVT_C Lowest_Channel_Number\t\t%lu\n", BITS(dword, 19, 16));
1270 printf("AUD_OUT_DIG_CNVT_C Stream_ID\t\t\t\t%lu\n", BITS(dword, 23, 20));
Wu Fengguang020abdb2010-04-19 13:13:06 +08001271
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001272 printf("AUD_OUT_CH_STR Converter_Channel_MAP PORTB PORTC PORTD\n");
1273 for (i = 0; i < 8; i++) {
1274 OUTREG(AUD_OUT_CH_STR, i | (i << 8) | (i << 16));
1275 dword = INREG(AUD_OUT_CH_STR);
1276 printf("\t\t\t\t%lu\t%lu\t%lu\t%lu\n",
1277 1 + BITS(dword, 3, 0),
1278 1 + BITS(dword, 7, 4),
1279 1 + BITS(dword, 15, 12),
1280 1 + BITS(dword, 23, 20));
1281 }
Wu Fengguang020abdb2010-04-19 13:13:06 +08001282
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001283 dword = INREG(AUD_OUT_STR_DESC_A);
1284 printf("AUD_OUT_STR_DESC_A HBR_enable\t\t\t\t%lu\n", BITS(dword, 28, 27));
1285 printf("AUD_OUT_STR_DESC_A Convertor_Channel_Count\t\t%lu\n", BITS(dword, 20, 16) + 1);
1286 printf("AUD_OUT_STR_DESC_A Bits_per_Sample\t\t\t[%#lx] %s\n",
1287 BITS(dword, 6, 4), OPNAME(bits_per_sample, BITS(dword, 6, 4)));
1288 printf("AUD_OUT_STR_DESC_A Number_of_Channels_in_a_Stream\t%lu\n", 1 + BITS(dword, 3, 0));
Wu Fengguang020abdb2010-04-19 13:13:06 +08001289
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001290 dword = INREG(AUD_OUT_STR_DESC_B);
1291 printf("AUD_OUT_STR_DESC_B HBR_enable\t\t\t\t%lu\n", BITS(dword, 28, 27));
1292 printf("AUD_OUT_STR_DESC_B Convertor_Channel_Count\t\t%lu\n", BITS(dword, 20, 16) + 1);
1293 printf("AUD_OUT_STR_DESC_B Bits_per_Sample\t\t\t[%#lx] %s\n",
1294 BITS(dword, 6, 4), OPNAME(bits_per_sample, BITS(dword, 6, 4)));
1295 printf("AUD_OUT_STR_DESC_B Number_of_Channels_in_a_Stream\t%lu\n", 1 + BITS(dword, 3, 0));
Wu Fengguang020abdb2010-04-19 13:13:06 +08001296
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001297 dword = INREG(AUD_OUT_STR_DESC_C);
1298 printf("AUD_OUT_STR_DESC_C HBR_enable\t\t\t\t%lu\n", BITS(dword, 28, 27));
1299 printf("AUD_OUT_STR_DESC_C Convertor_Channel_Count\t\t%lu\n", BITS(dword, 20, 16) + 1);
1300 printf("AUD_OUT_STR_DESC_C Bits_per_Sample\t\t\t[%#lx] %s\n",
1301 BITS(dword, 6, 4), OPNAME(bits_per_sample, BITS(dword, 6, 4)));
1302 printf("AUD_OUT_STR_DESC_C Number_of_Channels_in_a_Stream\t%lu\n", 1 + BITS(dword, 3, 0));
Wu Fengguang020abdb2010-04-19 13:13:06 +08001303
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001304 dword = INREG(AUD_PINW_CONNLNG_SEL);
1305 printf("AUD_PINW_CONNLNG_SEL Connection_select_Control_B\t%#lx\n", BITS(dword, 7, 0));
1306 printf("AUD_PINW_CONNLNG_SEL Connection_select_Control_C\t%#lx\n", BITS(dword, 15, 8));
1307 printf("AUD_PINW_CONNLNG_SEL Connection_select_Control_D\t%#lx\n", BITS(dword, 23, 16));
Wu Fengguang020abdb2010-04-19 13:13:06 +08001308
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001309 dword = INREG(AUD_CNTL_ST_A);
1310 printf("AUD_CNTL_ST_A DIP_Port_Select\t\t\t\t[%#lx] %s\n",
1311 BITS(dword, 30, 29), dip_port[BITS(dword, 30, 29)]);
1312 printf("AUD_CNTL_ST_A DIP_type_enable_status Audio DIP\t\t%lu\n", BIT(dword, 21));
1313 printf("AUD_CNTL_ST_A DIP_type_enable_status ACP DIP\t\t%lu\n", BIT(dword, 22));
1314 printf("AUD_CNTL_ST_A DIP_type_enable_status Generic 2 DIP\t%lu\n", BIT(dword, 23));
1315 printf("AUD_CNTL_ST_A DIP_transmission_frequency\t\t[0x%lx] %s\n",
1316 BITS(dword, 17, 16), dip_trans[BITS(dword, 17, 16)]);
1317 printf("AUD_CNTL_ST_A ELD_ACK\t\t\t\t\t%lu\n", BIT(dword, 4));
1318 printf("AUD_CNTL_ST_A ELD_buffer_size\t\t\t\t%lu\n", BITS(dword, 14, 10));
Wu Fengguang020abdb2010-04-19 13:13:06 +08001319
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001320 dword = INREG(AUD_CNTL_ST_B);
1321 printf("AUD_CNTL_ST_B DIP_Port_Select\t\t\t\t[%#lx] %s\n",
1322 BITS(dword, 30, 29), dip_port[BITS(dword, 30, 29)]);
1323 printf("AUD_CNTL_ST_B DIP_type_enable_status Audio DIP\t\t%lu\n", BIT(dword, 21));
1324 printf("AUD_CNTL_ST_B DIP_type_enable_status ACP DIP\t\t%lu\n", BIT(dword, 22));
1325 printf("AUD_CNTL_ST_B DIP_type_enable_status Generic 2 DIP\t%lu\n", BIT(dword, 23));
1326 printf("AUD_CNTL_ST_B DIP_transmission_frequency\t\t[0x%lx] %s\n",
1327 BITS(dword, 17, 16), dip_trans[BITS(dword, 17, 16)]);
1328 printf("AUD_CNTL_ST_B ELD_ACK\t\t\t\t\t%lu\n", BIT(dword, 4));
1329 printf("AUD_CNTL_ST_B ELD_buffer_size\t\t\t\t%lu\n", BITS(dword, 14, 10));
Wu Fengguang020abdb2010-04-19 13:13:06 +08001330
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001331 dword = INREG(AUD_CNTL_ST_C);
1332 printf("AUD_CNTL_ST_C DIP_Port_Select\t\t\t\t[%#lx] %s\n",
1333 BITS(dword, 30, 29), dip_port[BITS(dword, 30, 29)]);
1334 printf("AUD_CNTL_ST_C DIP_type_enable_status Audio DIP\t\t%lu\n", BIT(dword, 21));
1335 printf("AUD_CNTL_ST_C DIP_type_enable_status ACP DIP\t\t%lu\n", BIT(dword, 22));
1336 printf("AUD_CNTL_ST_C DIP_type_enable_status Generic 2 DIP\t%lu\n", BIT(dword, 23));
1337 printf("AUD_CNTL_ST_C DIP_transmission_frequency\t\t[0x%lx] %s\n",
1338 BITS(dword, 17, 16), dip_trans[BITS(dword, 17, 16)]);
1339 printf("AUD_CNTL_ST_C ELD_ACK\t\t\t\t\t%lu\n", BIT(dword, 4));
1340 printf("AUD_CNTL_ST_C ELD_buffer_size\t\t\t\t%lu\n", BITS(dword, 14, 10));
Wu Fengguang020abdb2010-04-19 13:13:06 +08001341
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001342 dword = INREG(AUD_CNTRL_ST2);
1343 printf("AUD_CNTRL_ST2 CP_ReadyB\t\t\t\t%lu\n", BIT(dword, 1));
1344 printf("AUD_CNTRL_ST2 ELD_validB\t\t\t\t%lu\n", BIT(dword, 0));
1345 printf("AUD_CNTRL_ST2 CP_ReadyC\t\t\t\t%lu\n", BIT(dword, 5));
1346 printf("AUD_CNTRL_ST2 ELD_validC\t\t\t\t%lu\n", BIT(dword, 4));
1347 printf("AUD_CNTRL_ST2 CP_ReadyD\t\t\t\t%lu\n", BIT(dword, 9));
1348 printf("AUD_CNTRL_ST2 ELD_validD\t\t\t\t%lu\n", BIT(dword, 8));
Wu Fengguang020abdb2010-04-19 13:13:06 +08001349
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001350 dword = INREG(AUD_CNTRL_ST3);
1351 printf("AUD_CNTRL_ST3 TransA_DPT_Audio_Output_En\t\t%lu\n", BIT(dword, 3));
1352 printf("AUD_CNTRL_ST3 TransA_to_Port_Sel\t\t\t[%#lx] %s\n",
1353 BITS(dword, 2, 0), trans_to_port_sel[BITS(dword, 2, 0)]);
1354 printf("AUD_CNTRL_ST3 TransB_DPT_Audio_Output_En\t\t%lu\n", BIT(dword, 7));
1355 printf("AUD_CNTRL_ST3 TransB_to_Port_Sel\t\t\t[%#lx] %s\n",
1356 BITS(dword, 6, 4), trans_to_port_sel[BITS(dword, 6, 4)]);
1357 printf("AUD_CNTRL_ST3 TransC_DPT_Audio_Output_En\t\t%lu\n", BIT(dword, 11));
1358 printf("AUD_CNTRL_ST3 TransC_to_Port_Sel\t\t\t[%#lx] %s\n",
1359 BITS(dword, 10, 8), trans_to_port_sel[BITS(dword, 10, 8)]);
Wu Fengguang020abdb2010-04-19 13:13:06 +08001360
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001361 dword = INREG(AUD_HDMIW_STATUS);
1362 printf("AUD_HDMIW_STATUS Conv_A_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 27));
1363 printf("AUD_HDMIW_STATUS Conv_A_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n", BIT(dword, 26));
1364 printf("AUD_HDMIW_STATUS Conv_B_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 29));
1365 printf("AUD_HDMIW_STATUS Conv_B_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n", BIT(dword, 28));
1366 printf("AUD_HDMIW_STATUS Conv_C_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 31));
1367 printf("AUD_HDMIW_STATUS Conv_C_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n", BIT(dword, 30));
1368 printf("AUD_HDMIW_STATUS BCLK/CDCLK_FIFO_Overrun\t\t%lu\n", BIT(dword, 25));
1369 printf("AUD_HDMIW_STATUS Function_Reset\t\t\t%lu\n", BIT(dword, 24));
Wu Fengguang020abdb2010-04-19 13:13:06 +08001370
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001371 printf("AUD_HDMIW_HDMIEDID_A HDMI ELD:\n\t");
1372 dword = INREG(AUD_CNTL_ST_A);
1373 dword &= ~BITMASK(9, 5);
1374 OUTREG(AUD_CNTL_ST_A, dword);
1375 for (i = 0; i < BITS(dword, 14, 10) / 4; i++)
1376 printf("%08x ", htonl(INREG(AUD_HDMIW_HDMIEDID_A)));
1377 printf("\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +08001378
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001379 printf("AUD_HDMIW_HDMIEDID_B HDMI ELD:\n\t");
1380 dword = INREG(AUD_CNTL_ST_B);
1381 dword &= ~BITMASK(9, 5);
1382 OUTREG(AUD_CNTL_ST_B, dword);
1383 for (i = 0; i < BITS(dword, 14, 10) / 4; i++)
1384 printf("%08x ", htonl(INREG(AUD_HDMIW_HDMIEDID_B)));
1385 printf("\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +08001386
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001387 printf("AUD_HDMIW_HDMIEDID_C HDMI ELD:\n\t");
1388 dword = INREG(AUD_CNTL_ST_C);
1389 dword &= ~BITMASK(9, 5);
1390 OUTREG(AUD_CNTL_ST_C, dword);
1391 for (i = 0; i < BITS(dword, 14, 10) / 4; i++)
1392 printf("%08x ", htonl(INREG(AUD_HDMIW_HDMIEDID_C)));
1393 printf("\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +08001394
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001395 printf("AUD_HDMIW_INFOFR_A HDMI audio Infoframe:\n\t");
1396 dword = INREG(AUD_CNTL_ST_A);
1397 dword &= ~BITMASK(20, 18);
1398 dword &= ~BITMASK(3, 0);
1399 OUTREG(AUD_CNTL_ST_A, dword);
1400 for (i = 0; i < 8; i++)
1401 printf("%08x ", htonl(INREG(AUD_HDMIW_INFOFR_A)));
1402 printf("\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +08001403
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001404 printf("AUD_HDMIW_INFOFR_B HDMI audio Infoframe:\n\t");
1405 dword = INREG(AUD_CNTL_ST_B);
1406 dword &= ~BITMASK(20, 18);
1407 dword &= ~BITMASK(3, 0);
1408 OUTREG(AUD_CNTL_ST_B, dword);
1409 for (i = 0; i < 8; i++)
1410 printf("%08x ", htonl(INREG(AUD_HDMIW_INFOFR_B)));
1411 printf("\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +08001412
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001413 printf("AUD_HDMIW_INFOFR_C HDMI audio Infoframe:\n\t");
1414 dword = INREG(AUD_CNTL_ST_C);
1415 dword &= ~BITMASK(20, 18);
1416 dword &= ~BITMASK(3, 0);
1417 OUTREG(AUD_CNTL_ST_C, dword);
1418 for (i = 0; i < 8; i++)
1419 printf("%08x ", htonl(INREG(AUD_HDMIW_INFOFR_C)));
1420 printf("\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +08001421
1422}
1423
Wang Xingchaoc4077222012-08-15 16:13:38 +08001424#undef AUD_CONFIG_A
1425#undef AUD_MISC_CTRL_A
1426#undef AUD_VID_DID
1427#undef AUD_RID
1428#undef AUD_CTS_ENABLE_A
1429#undef AUD_PWRST
1430#undef AUD_HDMIW_HDMIEDID_A
1431#undef AUD_HDMIW_INFOFR_A
1432#undef AUD_PORT_EN_HD_CFG
1433#undef AUD_OUT_DIG_CNVT_A
1434#undef AUD_OUT_STR_DESC_A
1435#undef AUD_OUT_CH_STR
1436#undef AUD_PINW_CONNLNG_LIST
Mengdong Lindeba8682013-09-09 15:38:40 -04001437#undef AUD_PINW_CONNLNG_SEL
Wang Xingchaoc4077222012-08-15 16:13:38 +08001438#undef AUD_CNTL_ST_A
1439#undef AUD_HDMIW_STATUS
1440#undef AUD_CONFIG_B
1441#undef AUD_MISC_CTRL_B
1442#undef AUD_CTS_ENABLE_B
1443#undef AUD_HDMIW_HDMIEDID_B
1444#undef AUD_HDMIW_INFOFR_B
1445#undef AUD_OUT_DIG_CNVT_B
1446#undef AUD_OUT_STR_DESC_B
1447#undef AUD_CNTL_ST_B
1448#undef AUD_CONFIG_C
1449#undef AUD_MISC_CTRL_C
1450#undef AUD_CTS_ENABLE_C
1451#undef AUD_HDMIW_HDMIEDID_C
1452#undef AUD_HDMIW_INFOFR_C
1453#undef AUD_OUT_DIG_CNVT_C
1454#undef AUD_OUT_STR_DESC_C
1455
1456#undef VIDEO_DIP_CTL_A
1457#undef VIDEO_DIP_CTL_B
1458#undef VIDEO_DIP_CTL_C
1459#undef VIDEO_DIP_CTL_D
1460#undef VIDEO_DIP_DATA
1461
1462/*
1463 * Haswell registers
1464 */
1465
1466/* DisplayPort Transport Control */
1467#define DP_TP_CTL_A 0x64040
1468#define DP_TP_CTL_B 0x64140
1469#define DP_TP_CTL_C 0x64240
1470#define DP_TP_CTL_D 0x64340
1471#define DP_TP_CTL_E 0x64440
1472
1473/* DisplayPort Transport Status */
1474#define DP_TP_ST_A 0x64044
1475#define DP_TP_ST_B 0x64144
1476#define DP_TP_ST_C 0x64244
1477#define DP_TP_ST_D 0x64344
1478#define DP_TP_ST_E 0x64444
1479
Wang Xingchaoc4077222012-08-15 16:13:38 +08001480/* DDI Buffer Control */
1481#define DDI_BUF_CTL_A 0x64000
1482#define DDI_BUF_CTL_B 0x64100
1483#define DDI_BUF_CTL_C 0x64200
1484#define DDI_BUF_CTL_D 0x64300
1485#define DDI_BUF_CTL_E 0x64400
1486
1487/* DDI Buffer Translation */
1488#define DDI_BUF_TRANS_A 0x64e00
1489#define DDI_BUF_TRANS_B 0x64e60
1490#define DDI_BUF_TRANS_C 0x64ec0
1491#define DDI_BUF_TRANS_D 0x64f20
1492#define DDI_BUF_TRANS_E 0x64f80
1493
1494/* DDI Aux Channel */
1495#define DDI_AUX_CHANNEL_CTRL 0x64010
1496#define DDI_AUX_DATA 0x64014
1497#define DDI_AUX_TST 0x64028
1498
1499/* DDI CRC Control */
1500#define DDI_CRC_CTL_A 0x64050
1501#define DDI_CRC_CTL_B 0x64150
1502#define DDI_CRC_CTL_C 0x64250
1503#define DDI_CRC_CTL_D 0x64350
1504#define DDI_CRC_CTL_E 0x64450
1505
1506/* Pipe DDI Function Control */
1507#define PIPE_DDI_FUNC_CTL_A 0x60400
1508#define PIPE_DDI_FUNC_CTL_B 0x61400
1509#define PIPE_DDI_FUNC_CTL_C 0x62400
1510#define PIPE_DDI_FUNC_CTL_EDP 0x6F400
1511
1512/* Pipe Configuration */
1513#define PIPE_CONF_A 0x70008
1514#define PIPE_CONF_B 0x71008
1515#define PIPE_CONF_C 0x72008
1516#define PIPE_CONF_EDP 0x7F008
1517
1518/* Audio registers */
Mengdong Lindeba8682013-09-09 15:38:40 -04001519#define AUD_TCA_CONFIG 0x65000
1520#define AUD_TCB_CONFIG 0x65100
1521#define AUD_TCC_CONFIG 0x65200
1522#define AUD_C1_MISC_CTRL 0x65010
1523#define AUD_C2_MISC_CTRL 0x65110
1524#define AUD_C3_MISC_CTRL 0x65210
1525#define AUD_VID_DID 0x65020
1526#define AUD_RID 0x65024
1527#define AUD_TCA_M_CTS_ENABLE 0x65028
1528#define AUD_TCB_M_CTS_ENABLE 0x65128
1529#define AUD_TCC_M_CTS_ENABLE 0x65228
1530#define AUD_PWRST 0x6504C
1531#define AUD_TCA_EDID_DATA 0x65050
1532#define AUD_TCB_EDID_DATA 0x65150
1533#define AUD_TCC_EDID_DATA 0x65250
1534#define AUD_TCA_INFOFR 0x65054
1535#define AUD_TCB_INFOFR 0x65154
1536#define AUD_TCC_INFOFR 0x65254
1537#define AUD_PIPE_CONV_CFG 0x6507C
1538#define AUD_C1_DIG_CNVT 0x65080
1539#define AUD_C2_DIG_CNVT 0x65180
1540#define AUD_C3_DIG_CNVT 0x65280
1541#define AUD_C1_STR_DESC 0x65084
1542#define AUD_C2_STR_DESC 0x65184
1543#define AUD_C3_STR_DESC 0x65284
1544#define AUD_OUT_CHAN_MAP 0x65088
1545#define AUD_TCA_PIN_PIPE_CONN_ENTRY_LNGTH 0x650A8
1546#define AUD_TCB_PIN_PIPE_CONN_ENTRY_LNGTH 0x651A8
1547#define AUD_TCC_PIN_PIPE_CONN_ENTRY_LNGTH 0x652A8
Wang Xingchaoc4077222012-08-15 16:13:38 +08001548#define AUD_PIPE_CONN_SEL_CTRL 0x650AC
Mengdong Lindeba8682013-09-09 15:38:40 -04001549#define AUD_TCA_DIP_ELD_CTRL_ST 0x650b4
1550#define AUD_TCB_DIP_ELD_CTRL_ST 0x651b4
1551#define AUD_TCC_DIP_ELD_CTRL_ST 0x652b4
1552#define AUD_PIN_ELD_CP_VLD 0x650C0
1553#define AUD_HDMI_FIFO_STATUS 0x650D4
Wang Xingchaoc4077222012-08-15 16:13:38 +08001554
1555/* Video DIP Control */
1556#define VIDEO_DIP_CTL_A 0x60200
1557#define VIDEO_DIP_CTL_B 0x61200
1558#define VIDEO_DIP_CTL_C 0x62200
1559#define VIDEO_DIP_CTL_D 0x63200
1560
1561#define VIDEO_DIP_DATA 0x60220
1562#define VIDEO_DIP_ECC 0x60240
1563
1564#define AUD_DP_DIP_STATUS 0x65f20
1565
Mengdong Lindeba8682013-09-09 15:38:40 -04001566#define MAX_PREFIX_SIZE 128
1567
1568#undef TRANSCODER_A
1569#undef TRANSCODER_B
1570#undef TRANSCODER_C
1571enum {
1572 TRANSCODER_A = 0,
1573 TRANSCODER_B,
1574 TRANSCODER_C,
1575};
1576
1577enum {
1578 PIPE_A = 0,
1579 PIPE_B,
1580 PIPE_C,
1581};
1582
1583enum {
1584 PORT_A = 0,
1585 PORT_B,
1586 PORT_C,
1587 PORT_D,
1588 PORT_E,
1589};
1590
1591enum {
1592 CONVERTER_1 = 0,
1593 CONVERTER_2,
1594 CONVERTER_3,
1595};
1596
1597static void dump_ddi_buf_ctl(int port)
1598{
1599 uint32_t dword;
1600
1601 dword = INREG(DDI_BUF_CTL_A + (port - PORT_A) * 0x100);
1602 printf("DDI %c Buffer control\n", 'A' + port - PORT_A);
1603 printf("\tDP port width\t\t\t\t\t[0x%lx] %s\n", BITS(dword, 3, 1),
1604 OPNAME(dp_port_width, BITS(dword, 3, 1)));
1605 printf("\tDDI Buffer Enable\t\t\t\t%ld\n", BIT(dword, 31));
1606}
1607
1608static void dump_ddi_func_ctl(int pipe)
1609{
1610 uint32_t dword;
1611
1612 dword = INREG(PIPE_DDI_FUNC_CTL_A + (pipe - PIPE_A) * 0x1000);
1613 printf("Pipe %c DDI Function Control\n", 'A' + pipe - PIPE_A);
1614 printf("\tBITS per color\t\t\t\t\t[0x%lx] %s\n", BITS(dword, 22, 20),
1615 OPNAME(bits_per_color, BITS(dword, 22, 20)));
1616 printf("\tPIPE DDI Mode\t\t\t\t\t[0x%lx] %s\n", BITS(dword, 26, 24),
1617 OPNAME(ddi_mode, BITS(dword, 26, 24)));
1618 printf("\tPIPE DDI selection\t\t\t\t[0x%lx] %s\n", BITS(dword, 30, 28),
1619 OPNAME(trans_to_port_sel, BITS(dword, 30, 28)));
1620 printf("\tPIPE DDI Function Enable\t\t\t[0x%lx]\n", BIT(dword, 31));
1621}
1622
1623static void dump_aud_transcoder_config(int transcoder)
1624{
1625 uint32_t dword;
1626 char prefix[MAX_PREFIX_SIZE];
1627
1628 dword = INREG(AUD_TCA_CONFIG + (transcoder - TRANSCODER_A) * 0x100);
1629 sprintf(prefix, "AUD_TC%c_CONFIG", 'A' + transcoder - TRANSCODER_A);
1630
1631 printf("%s Disable_NCTS\t\t\t\t%lu\n", prefix, BIT(dword, 3));
1632 printf("%s Lower_N_value\t\t\t\t0x%03lx\n", prefix, BITS(dword, 15, 4));
1633 printf("%s Pixel_Clock_HDMI\t\t\t[0x%lx] %s\n", prefix, BITS(dword, 19, 16),
1634 OPNAME(pixel_clock, BITS(dword, 19, 16)));
1635 printf("%s Upper_N_value\t\t\t\t0x%02lx\n", prefix, BITS(dword, 27, 20));
1636 printf("%s N_programming_enable\t\t\t%lu\n", prefix, BIT(dword, 28));
1637 printf("%s N_index_value\t\t\t\t[0x%lx] %s\n", prefix, BIT(dword, 29),
1638 OPNAME(n_index_value, BIT(dword, 29)));
1639}
1640
1641static void dump_aud_misc_control(int converter)
1642{
1643 uint32_t dword;
1644 char prefix[MAX_PREFIX_SIZE];
1645
1646 dword = INREG(AUD_C1_MISC_CTRL + (converter - CONVERTER_1) * 0x100);
1647 sprintf(prefix, "AUD_C%c_MISC_CTRL", '1' + converter - CONVERTER_1);
1648
1649 printf("%s Pro_Allowed\t\t\t\t%lu\n", prefix, BIT(dword, 1));
1650 printf("%s Sample_Fabrication_EN_bit\t\t%lu\n", prefix, BIT(dword, 2));
1651 printf("%s Output_Delay\t\t\t\t%lu\n", prefix, BITS(dword, 7, 4));
1652 printf("%s Sample_present_Disable\t\t%lu\n", prefix, BIT(dword, 8));
1653}
1654
1655static void dump_aud_vendor_device_id(void)
1656{
1657 uint32_t dword;
1658
1659 dword = INREG(AUD_VID_DID);
1660 printf("AUD_VID_DID device id\t\t\t\t\t0x%lx\n", BITS(dword, 15, 0));
1661 printf("AUD_VID_DID vendor id\t\t\t\t\t0x%lx\n", BITS(dword, 31, 16));
1662}
1663
1664static void dump_aud_revision_id(void)
1665{
1666 uint32_t dword;
1667
1668 dword = INREG(AUD_RID);
1669 printf("AUD_RID Stepping_Id\t\t\t\t\t0x%lx\n", BITS(dword, 7, 0));
1670 printf("AUD_RID Revision_Id\t\t\t\t\t0x%lx\n", BITS(dword, 15, 8));
1671 printf("AUD_RID Minor_Revision\t\t\t\t\t0x%lx\n", BITS(dword, 19, 16));
1672 printf("AUD_RID Major_Revision\t\t\t\t\t0x%lx\n", BITS(dword, 23, 20));
1673}
1674
1675static void dump_aud_m_cts_enable(int transcoder)
1676{
1677 uint32_t dword;
1678 char prefix[MAX_PREFIX_SIZE];
1679
1680 dword = INREG(AUD_TCA_M_CTS_ENABLE + (transcoder - TRANSCODER_A) * 0x100);
1681 sprintf(prefix, "AUD_TC%c_M_CTS_ENABLE", 'A' + transcoder - TRANSCODER_A);
1682
1683 printf("%s CTS_programming\t\t\t%#lx\n", prefix, BITS(dword, 19, 0));
1684 printf("%s Enable_CTS_or_M_programming\t%lu\n", prefix, BIT(dword, 20));
1685 printf("%s CTS_M value Index\t\t\t%s\n", prefix, BIT(dword, 21) ? "CTS" : "M");
1686}
1687
1688static void dump_aud_power_state(void)
1689{
1690 uint32_t dword;
1691
1692 dword = INREG(AUD_PWRST);
1693 printf("AUD_PWRST PinB_Widget_Power_State_Set \t%s\n", power_state[BITS(dword, 1, 0)]);
1694 printf("AUD_PWRST PinB_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 3, 2)]);
1695 printf("AUD_PWRST PinC_Widget_Power_State_Set \t%s\n", power_state[BITS(dword, 5, 4)]);
1696 printf("AUD_PWRST PinC_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 7, 6)]);
1697 printf("AUD_PWRST PinD_Widget_Power_State_Set \t%s\n", power_state[BITS(dword, 9, 8)]);
1698 printf("AUD_PWRST PinD_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 11, 10)]);
1699 printf("AUD_PWRST Convertor1_Widget_Power_State_Requsted \t%s\n", power_state[BITS(dword, 13, 12)]);
1700 printf("AUD_PWRST Convertor1_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 15, 14)]);
1701 printf("AUD_PWRST Convertor2_Widget_Power_State_Requested \t%s\n", power_state[BITS(dword, 17, 16)]);
1702 printf("AUD_PWRST Convertor2_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 19, 18)]);
1703 printf("AUD_PWRST Convertor3_Widget_Power_State_Requested \t%s\n", power_state[BITS(dword, 21, 20)]);
1704 printf("AUD_PWRST Convertor3_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 23, 22)]);
1705 printf("AUD_PWRST Func_Grp_Dev_PwrSt_Set \t%s\n", power_state[BITS(dword, 25, 24)]);
1706 printf("AUD_PWRST Func_Grp_Dev_PwrSt_Curr \t%s\n", power_state[BITS(dword, 27, 26)]);
1707}
1708
1709static void dump_aud_edid_data(int transcoder)
1710{
1711 uint32_t dword;
1712 int i;
1713 int offset = (transcoder - TRANSCODER_A) * 0x100;
1714
1715 printf("AUD_TC%c_EDID_DATA ELD:\n\t", 'A' + transcoder - TRANSCODER_A);
1716 dword = INREG(AUD_TCA_DIP_ELD_CTRL_ST + offset);
1717 dword &= ~BITMASK(9, 5);
1718 OUTREG(AUD_TCA_DIP_ELD_CTRL_ST + offset, dword);
1719 for (i = 0; i < BITS(dword, 14, 10) / 4; i++)
1720 printf("%08x ", htonl(INREG(AUD_TCA_EDID_DATA + offset)));
1721 printf("\n");
1722}
1723
1724static void dump_aud_infoframe(int transcoder)
1725{
1726 uint32_t dword;
1727 int i;
1728 int offset = (transcoder - TRANSCODER_A) * 0x100;
1729
1730 printf("AUD_TC%c_INFOFR audio Infoframe:\n\t", 'A' + transcoder - TRANSCODER_A);
1731 dword = INREG(AUD_TCA_DIP_ELD_CTRL_ST + offset);
1732 dword &= ~BITMASK(20, 18);
1733 dword &= ~BITMASK(3, 0);
1734 OUTREG(AUD_TCA_DIP_ELD_CTRL_ST + offset, dword);
1735 for (i = 0; i < 8; i++)
1736 printf("%08x ", htonl(INREG(AUD_TCA_INFOFR + offset)));
1737 printf("\n");
1738}
1739
1740static void dump_aud_pipe_conv_cfg(void)
1741{
1742 uint32_t dword;
1743
1744 dword = INREG(AUD_PIPE_CONV_CFG);
1745 printf("AUD_PIPE_CONV_CFG Convertor_1_Digen\t\t\t%lu\n", BIT(dword, 0));
1746 printf("AUD_PIPE_CONV_CFG Convertor_2_Digen\t\t\t%lu\n", BIT(dword, 1));
1747 printf("AUD_PIPE_CONV_CFG Convertor_3_Digen\t\t\t%lu\n", BIT(dword, 2));
1748 printf("AUD_PIPE_CONV_CFG Convertor_1_Stream_ID\t\t%lu\n", BITS(dword, 7, 4));
1749 printf("AUD_PIPE_CONV_CFG Convertor_2_Stream_ID\t\t%lu\n", BITS(dword, 11, 8));
1750 printf("AUD_PIPE_CONV_CFG Convertor_3_Stream_ID\t\t%lu\n", BITS(dword, 15, 12));
1751 printf("AUD_PIPE_CONV_CFG Port_B_Out_Enable\t\t\t%lu\n", BIT(dword, 16));
1752 printf("AUD_PIPE_CONV_CFG Port_C_Out_Enable\t\t\t%lu\n", BIT(dword, 17));
1753 printf("AUD_PIPE_CONV_CFG Port_D_Out_Enable\t\t\t%lu\n", BIT(dword, 18));
1754 printf("AUD_PIPE_CONV_CFG Port_B_Amp_Mute_Status\t\t%lu\n", BIT(dword, 20));
1755 printf("AUD_PIPE_CONV_CFG Port_C_Amp_Mute_Status\t\t%lu\n", BIT(dword, 21));
1756 printf("AUD_PIPE_CONV_CFG Port_D_Amp_Mute_Status\t\t%lu\n", BIT(dword, 22));
1757}
1758
1759static void dump_aud_dig_cnvt(int converter)
1760{
1761 uint32_t dword;
1762 char prefix[MAX_PREFIX_SIZE];
1763
1764 dword = INREG(AUD_C1_DIG_CNVT + (converter - CONVERTER_1) * 0x100);
1765 sprintf(prefix, "AUD_C%c_DIG_CNVT", '1' + converter - CONVERTER_1);
1766
1767 printf("%s V\t\t\t\t\t%lu\n", prefix, BIT(dword, 1));
1768 printf("%s VCFG\t\t\t\t\t%lu\n", prefix, BIT(dword, 2));
1769 printf("%s PRE\t\t\t\t\t%lu\n", prefix, BIT(dword, 3));
1770 printf("%s Copy\t\t\t\t\t%lu\n", prefix, BIT(dword, 4));
1771 printf("%s NonAudio\t\t\t\t%lu\n", prefix, BIT(dword, 5));
1772 printf("%s PRO\t\t\t\t\t%lu\n", prefix, BIT(dword, 6));
1773 printf("%s Level\t\t\t\t\t%lu\n", prefix, BIT(dword, 7));
1774 printf("%s Category_Code\t\t\t\t%lu\n", prefix, BITS(dword, 14, 8));
1775 printf("%s Lowest_Channel_Number\t\t\t%lu\n", prefix, BITS(dword, 19, 16));
1776 printf("%s Stream_ID\t\t\t\t%lu\n", prefix, BITS(dword, 23, 20));
1777}
1778
1779static void dump_aud_str_desc(int converter)
1780{
1781 uint32_t dword;
1782 char prefix[MAX_PREFIX_SIZE];
1783 uint32_t rate;
1784
1785 dword = INREG(AUD_C1_STR_DESC + (converter - CONVERTER_1) * 0x100);
1786 sprintf(prefix, "AUD_C%c_STR_DESC", '1' + converter - CONVERTER_1);
1787
1788 printf("%s Number_of_Channels_in_a_Stream\t\t%lu\n", prefix, 1 + BITS(dword, 3, 0));
1789 printf("%s Bits_per_Sample\t\t\t[%#lx] %s\n", prefix, BITS(dword, 6, 4),
1790 OPNAME(bits_per_sample, BITS(dword, 6, 4)));
1791
1792 printf("%s Sample_Base_Rate_Divisor\t\t[%#lx] %s\n", prefix, BITS(dword, 10, 8),
1793 OPNAME(sample_base_rate_divisor, BITS(dword, 10, 8)));
1794 printf("%s Sample_Base_Rate_Mult\t\t\t[%#lx] %s\n", prefix, BITS(dword, 13, 11),
1795 OPNAME(sample_base_rate_mult, BITS(dword, 13, 11)));
1796 printf("%s Sample_Base_Rate\t\t\t[%#lx] %s\t", prefix, BIT(dword, 14),
1797 OPNAME(sample_base_rate, BIT(dword, 14)));
1798 rate = (BIT(dword, 14) ? 44100 : 48000) * (BITS(dword, 13, 11) + 1)
1799 /(BITS(dword, 10, 8) + 1);
1800 printf("=> Sample Rate %d Hz\n", rate);
1801
1802 printf("%s Convertor_Channel_Count\t\t%lu\n", prefix, BITS(dword, 20, 16) + 1);
1803}
1804
1805static void dump_aud_out_chan_map(void)
1806{
1807 uint32_t dword;
1808 int i;
1809
1810 printf("AUD_OUT_CHAN_MAP Converter_Channel_MAP PORTB PORTC PORTD\n");
1811 for (i = 0; i < 8; i++) {
1812 OUTREG(AUD_OUT_CHAN_MAP, i | (i << 8) | (i << 16));
1813 dword = INREG(AUD_OUT_CHAN_MAP);
1814 printf("\t\t\t\t%lu\t%lu\t%lu\t%lu\n",
1815 1 + BITS(dword, 3, 0),
1816 1 + BITS(dword, 7, 4),
1817 1 + BITS(dword, 15, 12),
1818 1 + BITS(dword, 23, 20));
1819 }
1820}
1821
1822static void dump_aud_connect_list_entry_length(int transcoder)
1823{
1824 uint32_t dword;
1825 char prefix[MAX_PREFIX_SIZE];
1826
1827 dword = INREG(AUD_TCA_PIN_PIPE_CONN_ENTRY_LNGTH + (transcoder - TRANSCODER_A) * 0x100);
1828 sprintf(prefix, "AUD_TC%c_PIN_PIPE_CONN_ENTRY_LNGTH", 'A' + transcoder - TRANSCODER_A);
1829
1830 printf("%s Connect_List_Length\t%lu\n", prefix, BITS(dword, 6, 0));
1831 printf("%s Form \t\t[%#lx] %s\n", prefix, BIT(dword, 7),
1832 OPNAME(connect_list_form, BIT(dword, 7)));
1833 printf("%s Connect_List_Entry\t%lu\n", prefix, BITS(dword, 15, 8));
1834}
1835
1836static void dump_aud_connect_select_ctrl(void)
1837{
1838 uint32_t dword;
1839
1840 dword = INREG(AUD_PIPE_CONN_SEL_CTRL);
1841 printf("AUD_PIPE_CONN_SEL_CTRL Connection_select_Port_B\t%#lx\n", BITS(dword, 7, 0));
1842 printf("AUD_PIPE_CONN_SEL_CTRL Connection_select_Port_C\t%#lx\n", BITS(dword, 15, 8));
1843 printf("AUD_PIPE_CONN_SEL_CTRL Connection_select_Port_D\t%#lx\n", BITS(dword, 23, 16));
1844}
1845
1846static void dump_aud_dip_eld_ctrl_st(int transcoder)
1847{
1848 uint32_t dword;
1849 int offset = (transcoder - TRANSCODER_A) * 0x100;
1850
1851 dword = INREG(AUD_TCA_DIP_ELD_CTRL_ST + offset);
1852 printf("Audio DIP and ELD control state for Transcoder %c\n", 'A' + transcoder - TRANSCODER_A);
1853
1854 printf("\tELD_ACK\t\t\t\t\t\t%lu\n", BIT(dword, 4));
1855 printf("\tELD_buffer_size\t\t\t\t\t%lu\n", BITS(dword, 14, 10));
1856 printf("\tDIP_transmission_frequency\t\t\t[0x%lx] %s\n", BITS(dword, 17, 16),
1857 dip_trans[BITS(dword, 17, 16)]);
1858 printf("\tDIP Buffer Index \t\t\t\t[0x%lx] %s\n", BITS(dword, 20, 18),
1859 dip_index[BITS(dword, 20, 18)]);
1860 printf("\tAudio DIP type enable status\t\t\t[0x%04lx] %s, %s, %s\n", BITS(dword, 24, 21),
1861 dip_type[BIT(dword, 21)], dip_gen1_state[BIT(dword, 22)], dip_gen2_state[BIT(dword, 23)]);
1862 printf("\tAudio DIP port select\t\t\t\t[0x%lx] %s\n", BITS(dword, 30, 29),
1863 dip_port[BITS(dword, 30, 29)]);
1864 printf("\n");
1865}
1866
1867static void dump_aud_eld_cp_vld(void)
1868{
1869 uint32_t dword;
1870
1871 dword = INREG(AUD_PIN_ELD_CP_VLD);
1872 printf("AUD_PIN_ELD_CP_VLD Transcoder_A ELD_valid\t\t%lu\n", BIT(dword, 0));
1873 printf("AUD_PIN_ELD_CP_VLD Transcoder_A CP_Ready \t\t%lu\n", BIT(dword, 1));
1874 printf("AUD_PIN_ELD_CP_VLD Transcoder_A Out_enable\t\t%lu\n", BIT(dword, 2));
1875 printf("AUD_PIN_ELD_CP_VLD Transcoder_A Inactive\t\t%lu\n", BIT(dword, 3));
1876 printf("AUD_PIN_ELD_CP_VLD Transcoder_B ELD_valid\t\t%lu\n", BIT(dword, 4));
1877 printf("AUD_PIN_ELD_CP_VLD Transcoder_B CP_Ready\t\t%lu\n", BIT(dword, 5));
1878 printf("AUD_PIN_ELD_CP_VLD Transcoder_B OUT_enable\t\t%lu\n", BIT(dword, 6));
1879 printf("AUD_PIN_ELD_CP_VLD Transcoder_B Inactive\t\t%lu\n", BIT(dword, 7));
1880 printf("AUD_PIN_ELD_CP_VLD Transcoder_C ELD_valid\t\t%lu\n", BIT(dword, 8));
1881 printf("AUD_PIN_ELD_CP_VLD Transcoder_C CP_Ready\t\t%lu\n", BIT(dword, 9));
1882 printf("AUD_PIN_ELD_CP_VLD Transcoder_C OUT_enable\t\t%lu\n", BIT(dword, 10));
1883 printf("AUD_PIN_ELD_CP_VLD Transcoder_C Inactive\t\t%lu\n", BIT(dword, 11));
1884}
1885
1886static void dump_hdmi_fifo_status(void)
1887{
1888 uint32_t dword;
1889
1890 dword = INREG(AUD_HDMI_FIFO_STATUS);
1891 printf("AUD_HDMI_FIFO_STATUS Function_Reset\t\t\t%lu\n", BIT(dword, 24));
1892 printf("AUD_HDMI_FIFO_STATUS Conv_1_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n", BIT(dword, 26));
1893 printf("AUD_HDMI_FIFO_STATUS Conv_1_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 27));
1894 printf("AUD_HDMI_FIFO_STATUS Conv_2_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n", BIT(dword, 28));
1895 printf("AUD_HDMI_FIFO_STATUS Conv_2_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 29));
1896 printf("AUD_HDMI_FIFO_STATUS Conv_3_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n", BIT(dword, 30));
1897 printf("AUD_HDMI_FIFO_STATUS Conv_3_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 31));
1898}
Wang Xingchaoc4077222012-08-15 16:13:38 +08001899
1900static void dump_hsw(void)
1901{
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001902 uint32_t dword;
Wang Xingchaoc4077222012-08-15 16:13:38 +08001903
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001904 /* HSW DDI Buffer */
1905 dump_reg(DDI_BUF_CTL_A, "DDI Buffer Controler A");
1906 dump_reg(DDI_BUF_CTL_B, "DDI Buffer Controler B");
1907 dump_reg(DDI_BUF_CTL_C, "DDI Buffer Controler C");
1908 dump_reg(DDI_BUF_CTL_D, "DDI Buffer Controler D");
1909 dump_reg(DDI_BUF_CTL_E, "DDI Buffer Controler E");
Wang Xingchaoc4077222012-08-15 16:13:38 +08001910
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001911 /* HSW Pipe Function */
1912 dump_reg(PIPE_CONF_A, "PIPE Configuration A");
1913 dump_reg(PIPE_CONF_B, "PIPE Configuration B");
1914 dump_reg(PIPE_CONF_C, "PIPE Configuration C");
1915 dump_reg(PIPE_CONF_EDP, "PIPE Configuration EDP");
Wang Xingchaoc4077222012-08-15 16:13:38 +08001916
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001917 dump_reg(PIPE_DDI_FUNC_CTL_A, "PIPE DDI Function Control A");
1918 dump_reg(PIPE_DDI_FUNC_CTL_B, "PIPE DDI Function Control B");
1919 dump_reg(PIPE_DDI_FUNC_CTL_C, "PIPE DDI Function Control C");
1920 dump_reg(PIPE_DDI_FUNC_CTL_EDP, "PIPE DDI Function Control EDP");
Wang Xingchaoc4077222012-08-15 16:13:38 +08001921
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001922 /* HSW Display port */
1923 dump_reg(DP_TP_CTL_A, "DisplayPort Transport A Control");
1924 dump_reg(DP_TP_CTL_B, "DisplayPort Transport B Control");
1925 dump_reg(DP_TP_CTL_C, "DisplayPort Transport C Control");
1926 dump_reg(DP_TP_CTL_D, "DisplayPort Transport D Control");
1927 dump_reg(DP_TP_CTL_E, "DisplayPort Transport E Control");
Wang Xingchaoc4077222012-08-15 16:13:38 +08001928
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001929 dump_reg(DP_TP_ST_A, "DisplayPort Transport A Status");
1930 dump_reg(DP_TP_ST_B, "DisplayPort Transport B Status");
1931 dump_reg(DP_TP_ST_C, "DisplayPort Transport C Status");
1932 dump_reg(DP_TP_ST_D, "DisplayPort Transport D Status");
1933 dump_reg(DP_TP_ST_E, "DisplayPort Transport E Status");
Wang Xingchaoc4077222012-08-15 16:13:38 +08001934
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001935 /* HSW North Display Audio */
Mengdong Lindeba8682013-09-09 15:38:40 -04001936 dump_reg(AUD_TCA_CONFIG, "Audio Configuration - Transcoder A");
1937 dump_reg(AUD_TCB_CONFIG, "Audio Configuration - Transcoder B");
1938 dump_reg(AUD_TCC_CONFIG, "Audio Configuration - Transcoder C");
1939 dump_reg(AUD_C1_MISC_CTRL, "Audio Converter 1 MISC Control");
1940 dump_reg(AUD_C2_MISC_CTRL, "Audio Converter 2 MISC Control");
1941 dump_reg(AUD_C3_MISC_CTRL, "Audio Converter 3 MISC Control");
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001942 dump_reg(AUD_VID_DID, "Audio Vendor ID / Device ID");
Mengdong Lindeba8682013-09-09 15:38:40 -04001943 dump_reg(AUD_RID, "Audio Revision ID");
1944 dump_reg(AUD_TCA_M_CTS_ENABLE, "Audio M & CTS Programming Enable - Transcoder A");
1945 dump_reg(AUD_TCB_M_CTS_ENABLE, "Audio M & CTS Programming Enable - Transcoder B");
1946 dump_reg(AUD_TCC_M_CTS_ENABLE, "Audio M & CTS Programming Enable - Transcoder C");
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001947 dump_reg(AUD_PWRST, "Audio Power State (Function Group, Convertor, Pin Widget)");
Mengdong Lindeba8682013-09-09 15:38:40 -04001948 dump_reg(AUD_TCA_EDID_DATA, "Audio EDID Data Block - Transcoder A");
1949 dump_reg(AUD_TCB_EDID_DATA, "Audio EDID Data Block - Transcoder B");
1950 dump_reg(AUD_TCC_EDID_DATA, "Audio EDID Data Block - Transcoder C");
1951 dump_reg(AUD_TCA_INFOFR, "Audio Widget Data Island Packet - Transcoder A");
1952 dump_reg(AUD_TCB_INFOFR, "Audio Widget Data Island Packet - Transcoder B");
1953 dump_reg(AUD_TCC_INFOFR, "Audio Widget Data Island Packet - Transcoder C");
1954 dump_reg(AUD_PIPE_CONV_CFG, "Audio Pipe and Converter Configs");
1955 dump_reg(AUD_C1_DIG_CNVT, "Audio Digital Converter - Converter 1");
1956 dump_reg(AUD_C2_DIG_CNVT, "Audio Digital Converter - Converter 2");
1957 dump_reg(AUD_C3_DIG_CNVT, "Audio Digital Converter - Converter 3");
1958 dump_reg(AUD_C1_STR_DESC, "Audio Stream Descriptor Format - Converter 1");
1959 dump_reg(AUD_C2_STR_DESC, "Audio Stream Descriptor Format - Converter 2");
1960 dump_reg(AUD_C3_STR_DESC, "Audio Stream Descriptor Format - Converter 3");
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001961 dump_reg(AUD_OUT_CHAN_MAP, "Audio Output Channel Mapping");
Mengdong Lindeba8682013-09-09 15:38:40 -04001962 dump_reg(AUD_TCA_PIN_PIPE_CONN_ENTRY_LNGTH, "Audio Connection List entry and Length - Transcoder A");
1963 dump_reg(AUD_TCB_PIN_PIPE_CONN_ENTRY_LNGTH, "Audio Connection List entry and Length - Transcoder B");
1964 dump_reg(AUD_TCC_PIN_PIPE_CONN_ENTRY_LNGTH, "Audio Connection List entry and Length - Transcoder C");
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001965 dump_reg(AUD_PIPE_CONN_SEL_CTRL, "Audio Pipe Connection Select Control");
Mengdong Lindeba8682013-09-09 15:38:40 -04001966 dump_reg(AUD_TCA_DIP_ELD_CTRL_ST, "Audio DIP and ELD control state - Transcoder A");
1967 dump_reg(AUD_TCB_DIP_ELD_CTRL_ST, "Audio DIP and ELD control state - Transcoder B");
1968 dump_reg(AUD_TCC_DIP_ELD_CTRL_ST, "Audio DIP and ELD control state - Transcoder C");
1969 dump_reg(AUD_PIN_ELD_CP_VLD, "Audio pin ELD valid and CP ready status");
1970 dump_reg(AUD_HDMI_FIFO_STATUS, "Audio HDMI FIFO Status");
Wang Xingchaoc4077222012-08-15 16:13:38 +08001971
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001972 printf("\nDetails:\n\n");
Wang Xingchaoc4077222012-08-15 16:13:38 +08001973
Mengdong Lindeba8682013-09-09 15:38:40 -04001974 dump_ddi_buf_ctl(PORT_A);
1975 dump_ddi_buf_ctl(PORT_B);
1976 dump_ddi_buf_ctl(PORT_C);
1977 dump_ddi_buf_ctl(PORT_D);
1978 dump_ddi_buf_ctl(PORT_E);
Wang Xingchaoc4077222012-08-15 16:13:38 +08001979
Mengdong Lindeba8682013-09-09 15:38:40 -04001980 dump_ddi_func_ctl(PIPE_A);
1981 dump_ddi_func_ctl(PIPE_B);
1982 dump_ddi_func_ctl(PIPE_C);
Wang Xingchaoc4077222012-08-15 16:13:38 +08001983
Mengdong Lindeba8682013-09-09 15:38:40 -04001984 /* audio configuration - details */
1985 dump_aud_transcoder_config(TRANSCODER_A);
1986 dump_aud_transcoder_config(TRANSCODER_B);
1987 dump_aud_transcoder_config(TRANSCODER_C);
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001988
Mengdong Lindeba8682013-09-09 15:38:40 -04001989 dump_aud_misc_control(CONVERTER_1);
1990 dump_aud_misc_control(CONVERTER_2);
1991 dump_aud_misc_control(CONVERTER_3);
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001992
Mengdong Lindeba8682013-09-09 15:38:40 -04001993 dump_aud_vendor_device_id();
1994 dump_aud_revision_id();
Wang Xingchaoc4077222012-08-15 16:13:38 +08001995
Mengdong Lindeba8682013-09-09 15:38:40 -04001996 dump_aud_m_cts_enable(TRANSCODER_A);
1997 dump_aud_m_cts_enable(TRANSCODER_B);
1998 dump_aud_m_cts_enable(TRANSCODER_C);
Wang Xingchaoc4077222012-08-15 16:13:38 +08001999
Mengdong Lindeba8682013-09-09 15:38:40 -04002000 dump_aud_power_state();
Wang Xingchaoc4077222012-08-15 16:13:38 +08002001
Mengdong Lindeba8682013-09-09 15:38:40 -04002002 dump_aud_edid_data(TRANSCODER_A);
2003 dump_aud_edid_data(TRANSCODER_B);
2004 dump_aud_edid_data(TRANSCODER_C);
Wang Xingchaoc4077222012-08-15 16:13:38 +08002005
Mengdong Lindeba8682013-09-09 15:38:40 -04002006 dump_aud_infoframe(TRANSCODER_A);
2007 dump_aud_infoframe(TRANSCODER_B);
2008 dump_aud_infoframe(TRANSCODER_C);
Wang Xingchaoc4077222012-08-15 16:13:38 +08002009
Mengdong Lindeba8682013-09-09 15:38:40 -04002010 dump_aud_pipe_conv_cfg();
Wang Xingchaoc4077222012-08-15 16:13:38 +08002011
Mengdong Lindeba8682013-09-09 15:38:40 -04002012 dump_aud_dig_cnvt(CONVERTER_1);
2013 dump_aud_dig_cnvt(CONVERTER_2);
2014 dump_aud_dig_cnvt(CONVERTER_3);
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04002015
Mengdong Lindeba8682013-09-09 15:38:40 -04002016 dump_aud_str_desc(CONVERTER_1);
2017 dump_aud_str_desc(CONVERTER_2);
2018 dump_aud_str_desc(CONVERTER_3);
Wang Xingchaoc4077222012-08-15 16:13:38 +08002019
Mengdong Lindeba8682013-09-09 15:38:40 -04002020 dump_aud_out_chan_map();
Wang Xingchaoc4077222012-08-15 16:13:38 +08002021
Mengdong Lindeba8682013-09-09 15:38:40 -04002022 dump_aud_connect_list_entry_length(TRANSCODER_A);
2023 dump_aud_connect_list_entry_length(TRANSCODER_B);
2024 dump_aud_connect_list_entry_length(TRANSCODER_C);
2025 dump_aud_connect_select_ctrl();
Wang Xingchaoc4077222012-08-15 16:13:38 +08002026
Mengdong Lindeba8682013-09-09 15:38:40 -04002027 dump_aud_dip_eld_ctrl_st(TRANSCODER_A);
2028 dump_aud_dip_eld_ctrl_st(TRANSCODER_B);
2029 dump_aud_dip_eld_ctrl_st(TRANSCODER_C);
Wang Xingchaoc4077222012-08-15 16:13:38 +08002030
Mengdong Lindeba8682013-09-09 15:38:40 -04002031 dump_aud_eld_cp_vld();
2032 dump_hdmi_fifo_status();
Wang Xingchaoc4077222012-08-15 16:13:38 +08002033}
2034
Wu Fengguang020abdb2010-04-19 13:13:06 +08002035int main(int argc, char **argv)
2036{
2037 struct pci_device *pci_dev;
2038
2039 pci_dev = intel_get_pci_device();
2040 devid = pci_dev->device_id; /* XXX not true when mapping! */
2041
2042 do_self_tests();
2043
2044 if (argc == 2)
2045 intel_map_file(argv[1]);
2046 else
2047 intel_get_mmio(pci_dev);
2048
Wu Fengguang63e3c372011-11-12 11:12:44 +08002049 if (IS_GEN6(devid) || IS_GEN7(devid) || getenv("HAS_PCH_SPLIT")) {
Wang Xingchaoc4077222012-08-15 16:13:38 +08002050 if (IS_HASWELL(devid)) {
2051 printf("Haswell audio registers:\n\n");
2052 dump_hsw();
2053 return 0;
2054 }
Wu Fengguang6fcb5cd2011-11-12 11:12:49 +08002055 printf("%s audio registers:\n\n",
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04002056 IS_GEN6(devid) ? "SandyBridge" : "IvyBridge");
Wu Fengguang020abdb2010-04-19 13:13:06 +08002057 intel_check_pch();
2058 dump_cpt();
Wu Fengguang6fcb5cd2011-11-12 11:12:49 +08002059 } else if (IS_GEN5(devid)) {
2060 printf("Ironlake audio registers:\n\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +08002061 dump_ironlake();
Wu Fengguang6fcb5cd2011-11-12 11:12:49 +08002062 } else if (IS_G4X(devid)) {
2063 printf("G45 audio registers:\n\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +08002064 dump_eaglelake();
Wu Fengguang6fcb5cd2011-11-12 11:12:49 +08002065 }
Wu Fengguang020abdb2010-04-19 13:13:06 +08002066
2067 return 0;
Wu Fengguang9e9c9f22009-11-06 11:06:22 +08002068}