blob: 46eebdb7cfd44cdb8f634b451033f521b0907708 [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
Mengdong Lin92d31972014-03-03 11:04:39 -050040static int aud_reg_base = 0; /* base address of audio registers */
41static int disp_reg_base = 0; /* base address of display registers */
Wu Fengguang020abdb2010-04-19 13:13:06 +080042
Mengdong Lin1803f1e2014-02-28 16:18:11 -050043#define IS_HASWELL_PLUS(devid) (IS_HASWELL(devid) || IS_BROADWELL(devid))
44
Wu Fengguang020abdb2010-04-19 13:13:06 +080045#define BITSTO(n) (n >= sizeof(long) * 8 ? ~0 : (1UL << (n)) - 1)
46#define BITMASK(high, low) (BITSTO(high+1) & ~BITSTO(low))
47#define BITS(reg, high, low) (((reg) & (BITMASK(high, low))) >> (low))
48#define BIT(reg, n) BITS(reg, n, n)
49
50#define min_t(type, x, y) ({ \
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -040051 type __min1 = (x); \
52 type __min2 = (y); \
53 __min1 < __min2 ? __min1 : __min2; })
Wu Fengguang020abdb2010-04-19 13:13:06 +080054
55#define OPNAME(names, index) \
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -040056 names[min_t(unsigned int, index, ARRAY_SIZE(names) - 1)]
Wu Fengguang020abdb2010-04-19 13:13:06 +080057
Mengdong Lin92d31972014-03-03 11:04:39 -050058#define set_aud_reg_base(base) (aud_reg_base = (base))
59
60#define set_reg_base(base, audio_offset) \
61 do { \
62 disp_reg_base = (base); \
63 set_aud_reg_base((base) + (audio_offset)); \
64 } while (0)
65
Wu Fengguang020abdb2010-04-19 13:13:06 +080066#define dump_reg(reg, desc) \
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -040067 do { \
68 dword = INREG(reg); \
69 printf("%-21s 0x%08x %s\n", # reg, dword, desc); \
70 } while (0)
Wu Fengguang020abdb2010-04-19 13:13:06 +080071
Mengdong Lin92d31972014-03-03 11:04:39 -050072#define dump_disp_reg(reg, desc) \
73 do { \
74 dword = INREG(disp_reg_base + reg); \
75 printf("%-21s 0x%08x %s\n", # reg, dword, desc); \
76 } while (0)
77
78#define dump_aud_reg(reg, desc) \
79 do { \
80 dword = INREG(aud_reg_base + reg); \
81 printf("%-21s 0x%08x %s\n", # reg, dword, desc); \
82 } while (0)
83
84#define read_aud_reg(reg) INREG(aud_reg_base + (reg))
Wu Fengguang020abdb2010-04-19 13:13:06 +080085
Mengdong Linbae8a002014-03-03 13:23:50 -050086static int get_num_pipes(void)
87{
88 int num_pipes;
89
90 if (IS_VALLEYVIEW(devid))
91 num_pipes = 2; /* Valleyview is Gen 7 but only has 2 pipes */
92 else if (IS_G4X(devid) || IS_GEN5(devid))
93 num_pipes = 2;
94 else
95 num_pipes = 3;
96
97 return num_pipes;
98}
99
Mengdong Lindeba8682013-09-09 15:38:40 -0400100static const char * const pixel_clock[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800101 [0] = "25.2 / 1.001 MHz",
102 [1] = "25.2 MHz",
103 [2] = "27 MHz",
104 [3] = "27 * 1.001 MHz",
105 [4] = "54 MHz",
106 [5] = "54 * 1.001 MHz",
107 [6] = "74.25 / 1.001 MHz",
108 [7] = "74.25 MHz",
109 [8] = "148.5 / 1.001 MHz",
110 [9] = "148.5 MHz",
111 [10] = "Reserved",
112};
113
Mengdong Lindeba8682013-09-09 15:38:40 -0400114static const char * const power_state[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800115 [0] = "D0",
116 [1] = "D1",
117 [2] = "D2",
118 [3] = "D3",
119};
120
Mengdong Lindeba8682013-09-09 15:38:40 -0400121static const char * const stream_type[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800122 [0] = "default samples",
123 [1] = "one bit stream",
124 [2] = "DST stream",
125 [3] = "MLP stream",
126 [4] = "Reserved",
127};
128
Mengdong Lindeba8682013-09-09 15:38:40 -0400129static const char * const dip_port[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800130 [0] = "Reserved",
131 [1] = "Digital Port B",
132 [2] = "Digital Port C",
133 [3] = "Digital Port D",
134};
135
Mengdong Lindeba8682013-09-09 15:38:40 -0400136static const char * const dip_type[] = {
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400137 [0] = "Audio DIP Disabled",
138 [1] = "Audio DIP Enabled",
Wang Xingchaoc4077222012-08-15 16:13:38 +0800139};
140
Mengdong Lindeba8682013-09-09 15:38:40 -0400141static const char * const dip_gen1_state[] = {
142 [0] = "Generic 1 (ACP) DIP Disabled",
143 [1] = "Generic 1 (ACP) DIP Enabled",
144};
145
146static const char * const dip_gen2_state[] = {
147 [0] = "Generic 2 DIP Disabled",
148 [1] = "Generic 2 DIP Enabled",
149};
150
151static const char * const dip_index[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800152 [0] = "Audio DIP",
153 [1] = "ACP DIP",
154 [2] = "ISRC1 DIP",
155 [3] = "ISRC2 DIP",
156 [4] = "Reserved",
157};
158
Mengdong Lindeba8682013-09-09 15:38:40 -0400159static const char * const dip_trans[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800160 [0] = "disabled",
161 [1] = "reserved",
162 [2] = "send once",
163 [3] = "best effort",
164};
165
Mengdong Lindeba8682013-09-09 15:38:40 -0400166static const char * const video_dip_index[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800167 [0] = "AVI DIP",
168 [1] = "Vendor-specific DIP",
Wu Fengguangf3f84bb2011-11-12 11:12:55 +0800169 [2] = "Gamut Metadata DIP",
Wu Fengguang020abdb2010-04-19 13:13:06 +0800170 [3] = "Source Product Description DIP",
171};
172
Mengdong Lindeba8682013-09-09 15:38:40 -0400173static const char * const video_dip_trans[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800174 [0] = "send once",
175 [1] = "send every vsync",
176 [2] = "send at least every other vsync",
177 [3] = "reserved",
178};
179
Mengdong Lindeba8682013-09-09 15:38:40 -0400180static const char * const trans_to_port_sel[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800181 [0] = "no port",
182 [1] = "Digital Port B",
Wang Xingchaof9a24812012-08-15 16:13:37 +0800183 [2] = "Digital Port C",
184 [3] = "Digital Port D",
185 [4] = "reserved",
Alan Coopersmithc4610062012-01-06 14:37:19 -0800186 [5] = "reserved",
187 [6] = "reserved",
188 [7] = "reserved",
Wu Fengguang020abdb2010-04-19 13:13:06 +0800189};
190
Mengdong Lindeba8682013-09-09 15:38:40 -0400191static const char * const ddi_mode[] = {
Wang Xingchaoc4077222012-08-15 16:13:38 +0800192 [0] = "HDMI mode",
193 [1] = "DVI mode",
194 [2] = "DP SST mode",
195 [3] = "DP MST mode",
196 [4] = "DP FDI mode",
197 [5] = "reserved",
198 [6] = "reserved",
199 [7] = "reserved",
200};
201
Mengdong Lindeba8682013-09-09 15:38:40 -0400202static const char * const bits_per_color[] = {
203 [0] = "8 bpc",
204 [1] = "10 bpc",
205 [2] = "6 bpc",
206 [3] = "12 bpc",
207 [4] = "reserved",
208 [5] = "reserved",
209 [6] = "reserved",
210 [7] = "reserved",
211};
212
213static const char * const transcoder_select[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800214 [0] = "Transcoder A",
215 [1] = "Transcoder B",
216 [2] = "Transcoder C",
217 [3] = "reserved",
218};
219
Mengdong Lindeba8682013-09-09 15:38:40 -0400220static const char * const dp_port_width[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800221 [0] = "x1 mode",
222 [1] = "x2 mode",
Wu Fengguangcf4c12f2011-11-12 11:12:46 +0800223 [2] = "reserved",
224 [3] = "x4 mode",
Alan Coopersmithc4610062012-01-06 14:37:19 -0800225 [4] = "reserved",
226 [5] = "reserved",
227 [6] = "reserved",
228 [7] = "reserved",
Wu Fengguang020abdb2010-04-19 13:13:06 +0800229};
230
Mengdong Lindeba8682013-09-09 15:38:40 -0400231static const char * const sample_base_rate[] = {
232 [0] = "48 kHz",
233 [1] = "44.1 kHz",
234};
235
236static const char * const sample_base_rate_mult[] = {
237 [0] = "x1 (48 kHz, 44.1 kHz or less)",
238 [1] = "x2 (96 kHz, 88.2 kHz, 32 kHz)",
239 [2] = "x3 (144 kHz)",
240 [3] = "x4 (192 kHz, 176.4 kHz)",
241 [4] = "Reserved",
242};
243
244static const char * const sample_base_rate_divisor[] = {
245 [0] = "Divided by 1 (48 kHz, 44.1 kHz)",
246 [1] = "Divided by 2 (24 kHz, 22.05 kHz)",
247 [2] = "Divided by 3 (16 kHz, 32 kHz)",
248 [3] = "Divided by 4 (11.025 kHz)",
249 [4] = "Divided by 5 (9.6 kHz)",
250 [5] = "Divided by 6 (8 kHz)",
251 [6] = "Divided by 7",
252 [7] = "Divided by 8 (6 kHz)",
253};
254
255static const char * const connect_list_form[] = {
256 [0] = "Short Form",
257 [1] = "Long Form",
258};
259
260
261static const char * const bits_per_sample[] = {
Wu Fengguang12861a92011-11-12 11:12:47 +0800262 [0] = "reserved",
263 [1] = "16 bits",
264 [2] = "24 bits",
265 [3] = "32 bits",
266 [4] = "20 bits",
267 [5] = "reserved",
268};
269
Mengdong Lindeba8682013-09-09 15:38:40 -0400270static const char * const sdvo_hdmi_encoding[] = {
Wu Fengguangee949582011-11-12 11:12:53 +0800271 [0] = "SDVO",
272 [1] = "reserved",
273 [2] = "TMDS",
274 [3] = "reserved",
275};
Wu Fengguang12861a92011-11-12 11:12:47 +0800276
Mengdong Lindeba8682013-09-09 15:38:40 -0400277static const char * const n_index_value[] = {
Wu Fengguange64abe52012-01-17 07:19:24 +0800278 [0] = "HDMI",
279 [1] = "DisplayPort",
280};
281
Mengdong Lin85357202013-08-13 00:21:57 -0400282static const char * const immed_result_valid[] = {
283 [0] = "No immediate response is available",
284 [1] = "Immediate response is available",
285};
286
287static const char * const immed_cmd_busy[] = {
288 [0] = "Can accept an immediate command",
289 [1] = "Immediate command is available",
290};
291
Mengdong Linf075c3c2013-08-13 00:22:14 -0400292static const char * const vanilla_dp12_en[] = {
293 [0] = "DP 1.2 features are disabled",
294 [1] = "DP 1.2 features are enabled",
295};
296
297static const char * const vanilla_3_widgets_en[] = {
298 [0] = "2nd & 3rd pin/convertor widgets are disabled",
299 [1] = "All three pin/convertor widgets are enabled",
300};
301
302static const char * const block_audio[] = {
303 [0] = "Allow audio data to reach the port",
304 [1] = "Block audio data from reaching the port",
305};
306
307static const char * const dis_eld_valid_pulse_trans[] = {
308 [0] = "Enable ELD valid pulse transition when unsol is disabled",
309 [1] = "Disable ELD valid pulse transition when unsol is disabled",
310};
311
312static const char * const dis_pd_pulse_trans[] = {
313 [0] = "Enable Presense Detect pulse transition when unsol is disabled",
314 [1] = "Disable Presense Detect pulse transition when unsol is disabled",
315};
316
317static const char * const dis_ts_delta_err[] = {
318 [0] = "Enable timestamp delta error for 32/44 KHz",
319 [1] = "Disable timestamp delta error for 32/44 KHz",
320};
321
322static const char * const dis_ts_fix_dp_hbr[] = {
323 [0] = "Enable timestamp fix for DP HBR",
324 [1] = "Disable timestamp fix for DP HBR",
325};
326
327static const char * const pattern_gen_8_ch_en[] = {
328 [0] = "Disable 8-channel pattern generator",
329 [1] = "Enable 8-channel pattern generator",
330};
331
332static const char * const pattern_gen_2_ch_en[] = {
333 [0] = "Disable 2-channel pattern generator",
334 [1] = "Enable 2-channel pattern generator",
335};
336
337static const char * const fabric_32_44_dis[] = {
338 [0] = "Allow sample fabrication for 32/44 KHz",
339 [1] = "Disable sample fabrication for 32/44 KHz",
340};
341
342static const char * const epss_dis[] = {
343 [0] = "Allow audio EPSS",
344 [1] = "Disable audio EPSS",
345};
346
347static const char * const ts_test_mode[] = {
348 [0] = "Default time stamp mode",
349 [1] = "Audio time stamp test mode for audio only feature",
350};
351
352static const char * const en_mmio_program[] = {
353 [0] = "Programming by HD-Audio Azalia",
354 [1] = "Programming by MMIO debug registers",
355};
356
Mengdong Lin97e5cf62013-08-13 00:22:24 -0400357static const char * const audio_dp_dip_status[] = {
358 [0] = "audfc dp fifo full",
359 [1] = "audfc dp fifo empty",
360 [2] = "audfc dp fifo overrun",
361 [3] = "audfc dip fifo full",
362 [4] = "audfc dp fifo empty cd",
363 [5] = "audfb dp fifo full",
364 [6] = "audfb dp fifo empty",
365 [7] = "audfb dp fifo overrun",
366 [8] = "audfb dip fifo full",
367 [9] = "audfb dp fifo empty cd",
368 [10] = "audfa dp fifo full",
369 [11] = "audfa dp fifo empty",
370 [12] = "audfa dp fifo overrun",
371 [13] = "audfa dip fifo full",
372 [14] = "audfa dp fifo empty cd",
373 [15] = "Pipe c audio overflow",
374 [16] = "Pipe b audio overflow",
375 [17] = "Pipe a audio overflow",
376 [31] = 0,
377};
378
Mengdong Lined386662014-02-28 13:25:27 -0500379#undef TRANSCODER_A
380#undef TRANSCODER_B
381#undef TRANSCODER_C
382
383enum {
384 TRANSCODER_A = 0,
385 TRANSCODER_B,
386 TRANSCODER_C,
387};
388
389enum {
390 PIPE_A = 0,
391 PIPE_B,
392 PIPE_C,
393};
394
395enum {
396 PORT_A = 0,
397 PORT_B,
398 PORT_C,
399 PORT_D,
400 PORT_E,
401};
402
403enum {
404 CONVERTER_1 = 0,
405 CONVERTER_2,
406 CONVERTER_3,
407};
408
Wu Fengguang020abdb2010-04-19 13:13:06 +0800409static void do_self_tests(void)
410{
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400411 if (BIT(1, 0) != 1)
412 exit(1);
413 if (BIT(0x80000000, 31) != 1)
414 exit(2);
415 if (BITS(0xc0000000, 31, 30) != 3)
416 exit(3);
Wu Fengguang020abdb2010-04-19 13:13:06 +0800417}
418
419/*
420 * EagleLake registers
421 */
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800422#define AUD_CONFIG 0x62000
423#define AUD_DEBUG 0x62010
424#define AUD_VID_DID 0x62020
425#define AUD_RID 0x62024
426#define AUD_SUBN_CNT 0x62028
427#define AUD_FUNC_GRP 0x62040
428#define AUD_SUBN_CNT2 0x62044
429#define AUD_GRP_CAP 0x62048
430#define AUD_PWRST 0x6204c
431#define AUD_SUPPWR 0x62050
432#define AUD_SID 0x62054
433#define AUD_OUT_CWCAP 0x62070
434#define AUD_OUT_PCMSIZE 0x62074
435#define AUD_OUT_STR 0x62078
436#define AUD_OUT_DIG_CNVT 0x6207c
437#define AUD_OUT_CH_STR 0x62080
438#define AUD_OUT_STR_DESC 0x62084
439#define AUD_PINW_CAP 0x620a0
440#define AUD_PIN_CAP 0x620a4
441#define AUD_PINW_CONNLNG 0x620a8
442#define AUD_PINW_CONNLST 0x620ac
443#define AUD_PINW_CNTR 0x620b0
444#define AUD_PINW_UNSOLRESP 0x620b8
445#define AUD_CNTL_ST 0x620b4
446#define AUD_PINW_CONFIG 0x620bc
447#define AUD_HDMIW_STATUS 0x620d4
448#define AUD_HDMIW_HDMIEDID 0x6210c
449#define AUD_HDMIW_INFOFR 0x62118
450#define AUD_CONV_CHCNT 0x62120
451#define AUD_CTS_ENABLE 0x62128
452
453#define VIDEO_DIP_CTL 0x61170
454#define VIDEO_DIP_ENABLE (1<<31)
455#define VIDEO_DIP_ENABLE_AVI (1<<21)
456#define VIDEO_DIP_ENABLE_VENDOR (1<<22)
457#define VIDEO_DIP_ENABLE_SPD (1<<24)
458#define VIDEO_DIP_BUF_AVI (0<<19)
459#define VIDEO_DIP_BUF_VENDOR (1<<19)
460#define VIDEO_DIP_BUF_SPD (3<<19)
461#define VIDEO_DIP_TRANS_ONCE (0<<16)
462#define VIDEO_DIP_TRANS_1 (1<<16)
463#define VIDEO_DIP_TRANS_2 (2<<16)
464
465#define AUDIO_HOTPLUG_EN (1<<24)
466
467
Wu Fengguang020abdb2010-04-19 13:13:06 +0800468static void dump_eaglelake(void)
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800469{
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400470 uint32_t dword;
471 int i;
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800472
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400473 /* printf("%-18s %8s %s\n\n", "register name", "raw value", "description"); */
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800474
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400475 dump_reg(VIDEO_DIP_CTL, "Video DIP Control");
476 dump_reg(SDVOB, "Digital Display Port B Control Register");
477 dump_reg(SDVOC, "Digital Display Port C Control Register");
478 dump_reg(PORT_HOTPLUG_EN, "Hot Plug Detect Enable");
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800479
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400480 dump_reg(AUD_CONFIG, "Audio Configuration");
481 dump_reg(AUD_DEBUG, "Audio Debug");
482 dump_reg(AUD_VID_DID, "Audio Vendor ID / Device ID");
483 dump_reg(AUD_RID, "Audio Revision ID");
484 dump_reg(AUD_SUBN_CNT, "Audio Subordinate Node Count");
485 dump_reg(AUD_FUNC_GRP, "Audio Function Group Type");
486 dump_reg(AUD_SUBN_CNT2, "Audio Subordinate Node Count");
487 dump_reg(AUD_GRP_CAP, "Audio Function Group Capabilities");
488 dump_reg(AUD_PWRST, "Audio Power State");
489 dump_reg(AUD_SUPPWR, "Audio Supported Power States");
490 dump_reg(AUD_SID, "Audio Root Node Subsystem ID");
491 dump_reg(AUD_OUT_CWCAP, "Audio Output Converter Widget Capabilities");
492 dump_reg(AUD_OUT_PCMSIZE, "Audio PCM Size and Rates");
493 dump_reg(AUD_OUT_STR, "Audio Stream Formats");
494 dump_reg(AUD_OUT_DIG_CNVT, "Audio Digital Converter");
495 dump_reg(AUD_OUT_CH_STR, "Audio Channel ID and Stream ID");
496 dump_reg(AUD_OUT_STR_DESC, "Audio Stream Descriptor Format");
497 dump_reg(AUD_PINW_CAP, "Audio Pin Complex Widget Capabilities");
498 dump_reg(AUD_PIN_CAP, "Audio Pin Capabilities");
499 dump_reg(AUD_PINW_CONNLNG, "Audio Connection List Length");
500 dump_reg(AUD_PINW_CONNLST, "Audio Connection List Entry");
501 dump_reg(AUD_PINW_CNTR, "Audio Pin Widget Control");
502 dump_reg(AUD_PINW_UNSOLRESP, "Audio Unsolicited Response Enable");
503 dump_reg(AUD_CNTL_ST, "Audio Control State Register");
504 dump_reg(AUD_PINW_CONFIG, "Audio Configuration Default");
505 dump_reg(AUD_HDMIW_STATUS, "Audio HDMI Status");
506 dump_reg(AUD_HDMIW_HDMIEDID, "Audio HDMI Data EDID Block");
507 dump_reg(AUD_HDMIW_INFOFR, "Audio HDMI Widget Data Island Packet");
508 dump_reg(AUD_CONV_CHCNT, "Audio Converter Channel Count");
509 dump_reg(AUD_CTS_ENABLE, "Audio CTS Programming Enable");
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800510
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400511 printf("\nDetails:\n\n");
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800512
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400513 dword = INREG(AUD_VID_DID);
514 printf("AUD_VID_DID vendor id\t\t\t0x%x\n", dword >> 16);
515 printf("AUD_VID_DID device id\t\t\t0x%x\n", dword & 0xffff);
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800516
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400517 dword = INREG(AUD_RID);
518 printf("AUD_RID major revision\t\t\t0x%lx\n", BITS(dword, 23, 20));
519 printf("AUD_RID minor revision\t\t\t0x%lx\n", BITS(dword, 19, 16));
520 printf("AUD_RID revision id\t\t\t0x%lx\n", BITS(dword, 15, 8));
521 printf("AUD_RID stepping id\t\t\t0x%lx\n", BITS(dword, 7, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800522
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400523 dword = INREG(SDVOB);
524 printf("SDVOB enable\t\t\t\t%u\n", !!(dword & SDVO_ENABLE));
525 printf("SDVOB HDMI encoding\t\t\t%u\n", !!(dword & SDVO_ENCODING_HDMI));
526 printf("SDVOB SDVO encoding\t\t\t%u\n", !!(dword & SDVO_ENCODING_SDVO));
527 printf("SDVOB null packets\t\t\t%u\n", !!(dword & SDVO_NULL_PACKETS_DURING_VSYNC));
528 printf("SDVOB audio enabled\t\t\t%u\n", !!(dword & SDVO_AUDIO_ENABLE));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800529
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400530 dword = INREG(SDVOC);
531 printf("SDVOC enable\t\t\t\t%u\n", !!(dword & SDVO_ENABLE));
532 printf("SDVOC HDMI encoding\t\t\t%u\n", !!(dword & SDVO_ENCODING_HDMI));
533 printf("SDVOC SDVO encoding\t\t\t%u\n", !!(dword & SDVO_ENCODING_SDVO));
534 printf("SDVOC null packets\t\t\t%u\n", !!(dword & SDVO_NULL_PACKETS_DURING_VSYNC));
535 printf("SDVOC audio enabled\t\t\t%u\n", !!(dword & SDVO_AUDIO_ENABLE));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800536
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400537 dword = INREG(PORT_HOTPLUG_EN);
538 printf("PORT_HOTPLUG_EN DisplayPort/HDMI port B\t%ld\n", BIT(dword, 29)),
539 printf("PORT_HOTPLUG_EN DisplayPort/HDMI port C\t%ld\n", BIT(dword, 28)),
540 printf("PORT_HOTPLUG_EN DisplayPort port D\t%ld\n", BIT(dword, 27)),
541 printf("PORT_HOTPLUG_EN SDVOB\t\t\t%ld\n", BIT(dword, 26)),
542 printf("PORT_HOTPLUG_EN SDVOC\t\t\t%ld\n", BIT(dword, 25)),
543 printf("PORT_HOTPLUG_EN audio\t\t\t%ld\n", BIT(dword, 24)),
544 printf("PORT_HOTPLUG_EN TV\t\t\t%ld\n", BIT(dword, 23)),
545 printf("PORT_HOTPLUG_EN CRT\t\t\t%ld\n", BIT(dword, 9)),
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800546
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400547 dword = INREG(VIDEO_DIP_CTL);
548 printf("VIDEO_DIP_CTL enable graphics DIP\t%ld\n", BIT(dword, 31)),
549 printf("VIDEO_DIP_CTL port select\t\t[0x%lx] %s\n",
550 BITS(dword, 30, 29), dip_port[BITS(dword, 30, 29)]);
551 printf("VIDEO_DIP_CTL DIP buffer trans active\t%lu\n", BIT(dword, 28));
552 printf("VIDEO_DIP_CTL AVI DIP enabled\t\t%lu\n", BIT(dword, 21));
553 printf("VIDEO_DIP_CTL vendor DIP enabled\t%lu\n", BIT(dword, 22));
554 printf("VIDEO_DIP_CTL SPD DIP enabled\t\t%lu\n", BIT(dword, 24));
555 printf("VIDEO_DIP_CTL DIP buffer index\t\t[0x%lx] %s\n",
556 BITS(dword, 20, 19), video_dip_index[BITS(dword, 20, 19)]);
557 printf("VIDEO_DIP_CTL DIP trans freq\t\t[0x%lx] %s\n",
558 BITS(dword, 17, 16), video_dip_trans[BITS(dword, 17, 16)]);
559 printf("VIDEO_DIP_CTL DIP buffer size\t\t%lu\n", BITS(dword, 11, 8));
560 printf("VIDEO_DIP_CTL DIP address\t\t%lu\n", BITS(dword, 3, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800561
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400562 dword = INREG(AUD_CONFIG);
563 printf("AUD_CONFIG pixel clock\t\t\t[0x%lx] %s\n", BITS(dword, 19, 16),
564 OPNAME(pixel_clock, BITS(dword, 19, 16)));
565 printf("AUD_CONFIG fabrication enabled\t\t%lu\n", BITS(dword, 2, 2));
566 printf("AUD_CONFIG professional use allowed\t%lu\n", BIT(dword, 1));
567 printf("AUD_CONFIG fuse enabled\t\t\t%lu\n", BIT(dword, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800568
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400569 dword = INREG(AUD_DEBUG);
570 printf("AUD_DEBUG function reset\t\t%lu\n", BIT(dword, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800571
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400572 dword = INREG(AUD_SUBN_CNT);
573 printf("AUD_SUBN_CNT starting node number\t0x%lx\n", BITS(dword, 23, 16));
574 printf("AUD_SUBN_CNT total number of nodes\t0x%lx\n", BITS(dword, 7, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800575
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400576 dword = INREG(AUD_SUBN_CNT2);
577 printf("AUD_SUBN_CNT2 starting node number\t0x%lx\n", BITS(dword, 24, 16));
578 printf("AUD_SUBN_CNT2 total number of nodes\t0x%lx\n", BITS(dword, 7, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800579
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400580 dword = INREG(AUD_FUNC_GRP);
581 printf("AUD_FUNC_GRP unsol capable\t\t%lu\n", BIT(dword, 8));
582 printf("AUD_FUNC_GRP node type\t\t\t0x%lx\n", BITS(dword, 7, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800583
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400584 dword = INREG(AUD_GRP_CAP);
585 printf("AUD_GRP_CAP beep 0\t\t\t%lu\n", BIT(dword, 16));
586 printf("AUD_GRP_CAP input delay\t\t\t%lu\n", BITS(dword, 11, 8));
587 printf("AUD_GRP_CAP output delay\t\t%lu\n", BITS(dword, 3, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800588
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400589 dword = INREG(AUD_PWRST);
590 printf("AUD_PWRST device power state\t\t%s\n",
591 power_state[BITS(dword, 5, 4)]);
592 printf("AUD_PWRST device power state setting\t%s\n",
593 power_state[BITS(dword, 1, 0)]);
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800594
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400595 dword = INREG(AUD_SUPPWR);
596 printf("AUD_SUPPWR support D0\t\t\t%lu\n", BIT(dword, 0));
597 printf("AUD_SUPPWR support D1\t\t\t%lu\n", BIT(dword, 1));
598 printf("AUD_SUPPWR support D2\t\t\t%lu\n", BIT(dword, 2));
599 printf("AUD_SUPPWR support D3\t\t\t%lu\n", BIT(dword, 3));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800600
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400601 dword = INREG(AUD_OUT_CWCAP);
602 printf("AUD_OUT_CWCAP widget type\t\t0x%lx\n", BITS(dword, 23, 20));
603 printf("AUD_OUT_CWCAP sample delay\t\t0x%lx\n", BITS(dword, 19, 16));
604 printf("AUD_OUT_CWCAP channel count\t\t%lu\n",
605 BITS(dword, 15, 13) * 2 + BIT(dword, 0) + 1);
606 printf("AUD_OUT_CWCAP L-R swap\t\t\t%lu\n", BIT(dword, 11));
607 printf("AUD_OUT_CWCAP power control\t\t%lu\n", BIT(dword, 10));
608 printf("AUD_OUT_CWCAP digital\t\t\t%lu\n", BIT(dword, 9));
609 printf("AUD_OUT_CWCAP conn list\t\t\t%lu\n", BIT(dword, 8));
610 printf("AUD_OUT_CWCAP unsol\t\t\t%lu\n", BIT(dword, 7));
611 printf("AUD_OUT_CWCAP mute\t\t\t%lu\n", BIT(dword, 5));
612 printf("AUD_OUT_CWCAP format override\t\t%lu\n", BIT(dword, 4));
613 printf("AUD_OUT_CWCAP amp param override\t%lu\n", BIT(dword, 3));
614 printf("AUD_OUT_CWCAP out amp present\t\t%lu\n", BIT(dword, 2));
615 printf("AUD_OUT_CWCAP in amp present\t\t%lu\n", BIT(dword, 1));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800616
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400617 dword = INREG(AUD_OUT_DIG_CNVT);
618 printf("AUD_OUT_DIG_CNVT SPDIF category\t\t0x%lx\n", BITS(dword, 14, 8));
619 printf("AUD_OUT_DIG_CNVT SPDIF level\t\t%lu\n", BIT(dword, 7));
620 printf("AUD_OUT_DIG_CNVT professional\t\t%lu\n", BIT(dword, 6));
621 printf("AUD_OUT_DIG_CNVT non PCM\t\t%lu\n", BIT(dword, 5));
622 printf("AUD_OUT_DIG_CNVT copyright asserted\t%lu\n", BIT(dword, 4));
623 printf("AUD_OUT_DIG_CNVT filter preemphasis\t%lu\n", BIT(dword, 3));
624 printf("AUD_OUT_DIG_CNVT validity config\t%lu\n", BIT(dword, 2));
625 printf("AUD_OUT_DIG_CNVT validity flag\t\t%lu\n", BIT(dword, 1));
626 printf("AUD_OUT_DIG_CNVT digital enable\t\t%lu\n", BIT(dword, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800627
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400628 dword = INREG(AUD_OUT_CH_STR);
629 printf("AUD_OUT_CH_STR stream id\t\t0x%lx\n", BITS(dword, 7, 4));
630 printf("AUD_OUT_CH_STR lowest channel\t\t%lu\n", BITS(dword, 3, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800631
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400632 dword = INREG(AUD_OUT_STR_DESC);
633 printf("AUD_OUT_STR_DESC stream channels\t%lu\n", BITS(dword, 3, 0) + 1);
634 printf("AUD_OUT_STR_DESC Bits per Sample\t[%#lx] %s\n",
635 BITS(dword, 6, 4), OPNAME(bits_per_sample, BITS(dword, 6, 4)));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800636
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400637 dword = INREG(AUD_PINW_CAP);
638 printf("AUD_PINW_CAP widget type\t\t0x%lx\n", BITS(dword, 23, 20));
639 printf("AUD_PINW_CAP sample delay\t\t0x%lx\n", BITS(dword, 19, 16));
640 printf("AUD_PINW_CAP channel count\t\t%lu\n",
641 BITS(dword, 15, 13) * 2 + BIT(dword, 0) + 1);
642 printf("AUD_PINW_CAP HDCP\t\t\t%lu\n", BIT(dword, 12));
643 printf("AUD_PINW_CAP L-R swap\t\t\t%lu\n", BIT(dword, 11));
644 printf("AUD_PINW_CAP power control\t\t%lu\n", BIT(dword, 10));
645 printf("AUD_PINW_CAP digital\t\t\t%lu\n", BIT(dword, 9));
646 printf("AUD_PINW_CAP conn list\t\t\t%lu\n", BIT(dword, 8));
647 printf("AUD_PINW_CAP unsol\t\t\t%lu\n", BIT(dword, 7));
648 printf("AUD_PINW_CAP mute\t\t\t%lu\n", BIT(dword, 5));
649 printf("AUD_PINW_CAP format override\t\t%lu\n", BIT(dword, 4));
650 printf("AUD_PINW_CAP amp param override\t\t%lu\n", BIT(dword, 3));
651 printf("AUD_PINW_CAP out amp present\t\t%lu\n", BIT(dword, 2));
652 printf("AUD_PINW_CAP in amp present\t\t%lu\n", BIT(dword, 1));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800653
654
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400655 dword = INREG(AUD_PIN_CAP);
656 printf("AUD_PIN_CAP EAPD\t\t\t%lu\n", BIT(dword, 16));
657 printf("AUD_PIN_CAP HDMI\t\t\t%lu\n", BIT(dword, 7));
658 printf("AUD_PIN_CAP output\t\t\t%lu\n", BIT(dword, 4));
659 printf("AUD_PIN_CAP presence detect\t\t%lu\n", BIT(dword, 2));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800660
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400661 dword = INREG(AUD_PINW_CNTR);
662 printf("AUD_PINW_CNTR mute status\t\t%lu\n", BIT(dword, 8));
663 printf("AUD_PINW_CNTR out enable\t\t%lu\n", BIT(dword, 6));
664 printf("AUD_PINW_CNTR amp mute status\t\t%lu\n", BIT(dword, 8));
665 printf("AUD_PINW_CNTR amp mute status\t\t%lu\n", BIT(dword, 8));
666 printf("AUD_PINW_CNTR stream type\t\t[0x%lx] %s\n",
667 BITS(dword, 2, 0),
668 OPNAME(stream_type, BITS(dword, 2, 0)));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800669
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400670 dword = INREG(AUD_PINW_UNSOLRESP);
671 printf("AUD_PINW_UNSOLRESP enable unsol resp\t%lu\n", BIT(dword, 31));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800672
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400673 dword = INREG(AUD_CNTL_ST);
674 printf("AUD_CNTL_ST DIP audio enabled\t\t%lu\n", BIT(dword, 21));
675 printf("AUD_CNTL_ST DIP ACP enabled\t\t%lu\n", BIT(dword, 22));
676 printf("AUD_CNTL_ST DIP ISRCx enabled\t\t%lu\n", BIT(dword, 23));
677 printf("AUD_CNTL_ST DIP port select\t\t[0x%lx] %s\n",
678 BITS(dword, 30, 29), dip_port[BITS(dword, 30, 29)]);
679 printf("AUD_CNTL_ST DIP buffer index\t\t[0x%lx] %s\n",
680 BITS(dword, 20, 18), OPNAME(dip_index, BITS(dword, 20, 18)));
681 printf("AUD_CNTL_ST DIP trans freq\t\t[0x%lx] %s\n",
682 BITS(dword, 17, 16), dip_trans[BITS(dword, 17, 16)]);
683 printf("AUD_CNTL_ST DIP address\t\t\t%lu\n", BITS(dword, 3, 0));
684 printf("AUD_CNTL_ST CP ready\t\t\t%lu\n", BIT(dword, 15));
685 printf("AUD_CNTL_ST ELD valid\t\t\t%lu\n", BIT(dword, 14));
686 printf("AUD_CNTL_ST ELD ack\t\t\t%lu\n", BIT(dword, 4));
687 printf("AUD_CNTL_ST ELD bufsize\t\t\t%lu\n", BITS(dword, 13, 9));
688 printf("AUD_CNTL_ST ELD address\t\t\t%lu\n", BITS(dword, 8, 5));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800689
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400690 dword = INREG(AUD_HDMIW_STATUS);
691 printf("AUD_HDMIW_STATUS CDCLK/DOTCLK underrun\t%lu\n", BIT(dword, 31));
692 printf("AUD_HDMIW_STATUS CDCLK/DOTCLK overrun\t%lu\n", BIT(dword, 30));
693 printf("AUD_HDMIW_STATUS BCLK/CDCLK underrun\t%lu\n", BIT(dword, 29));
694 printf("AUD_HDMIW_STATUS BCLK/CDCLK overrun\t%lu\n", BIT(dword, 28));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800695
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400696 dword = INREG(AUD_CONV_CHCNT);
697 printf("AUD_CONV_CHCNT HDMI HBR enabled\t\t%lu\n", BITS(dword, 15, 14));
698 printf("AUD_CONV_CHCNT HDMI channel count\t%lu\n", BITS(dword, 11, 8) + 1);
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800699
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400700 printf("AUD_CONV_CHCNT HDMI channel mapping:\n");
701 for (i = 0; i < 8; i++) {
702 OUTREG(AUD_CONV_CHCNT, i);
703 dword = INREG(AUD_CONV_CHCNT);
704 printf("\t\t\t\t\t[0x%x] %u => %lu\n", dword, i, BITS(dword, 7, 4));
705 }
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800706
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400707 printf("AUD_HDMIW_HDMIEDID HDMI ELD:\n\t");
708 dword = INREG(AUD_CNTL_ST);
709 dword &= ~BITMASK(8, 5);
710 OUTREG(AUD_CNTL_ST, dword);
711 for (i = 0; i < BITS(dword, 14, 10) / 4; i++)
712 printf("%08x ", htonl(INREG(AUD_HDMIW_HDMIEDID)));
713 printf("\n");
Wu Fengguangf32aecb2011-11-12 11:12:50 +0800714
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400715 printf("AUD_HDMIW_INFOFR HDMI audio Infoframe:\n\t");
716 dword = INREG(AUD_CNTL_ST);
717 dword &= ~BITMASK(20, 18);
718 dword &= ~BITMASK(3, 0);
719 OUTREG(AUD_CNTL_ST, dword);
720 for (i = 0; i < 8; i++)
721 printf("%08x ", htonl(INREG(AUD_HDMIW_INFOFR)));
722 printf("\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +0800723}
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800724
Wu Fengguang020abdb2010-04-19 13:13:06 +0800725#undef AUD_RID
726#undef AUD_VID_DID
727#undef AUD_PWRST
728#undef AUD_OUT_CH_STR
729#undef AUD_HDMIW_STATUS
730
731/*
Wu Fengguang020abdb2010-04-19 13:13:06 +0800732 * CougarPoint registers
733 */
Wu Fengguang97d20312011-11-12 11:12:45 +0800734#define DP_CTL_B 0xE4100
Wu Fengguang020abdb2010-04-19 13:13:06 +0800735#define DP_CTL_C 0xE4200
736#define DP_AUX_CTL_C 0xE4210
737#define DP_AUX_TST_C 0xE4228
738#define SPORT_DDI_CRC_C 0xE4250
739#define SPORT_DDI_CRC_R 0xE4264
740#define DP_CTL_D 0xE4300
741#define DP_AUX_CTL_D 0xE4310
742#define DP_AUX_TST_D 0xE4328
743#define SPORT_DDI_CRC_CTL_D 0xE4350
744#define AUD_CONFIG_A 0xE5000
745#define AUD_MISC_CTRL_A 0xE5010
746#define AUD_VID_DID 0xE5020
747#define AUD_RID 0xE5024
748#define AUD_CTS_ENABLE_A 0xE5028
749#define AUD_PWRST 0xE504C
750#define AUD_HDMIW_HDMIEDID_A 0xE5050
751#define AUD_HDMIW_INFOFR_A 0xE5054
752#define AUD_PORT_EN_HD_CFG 0xE507C
753#define AUD_OUT_DIG_CNVT_A 0xE5080
754#define AUD_OUT_STR_DESC_A 0xE5084
755#define AUD_OUT_CH_STR 0xE5088
756#define AUD_PINW_CONNLNG_LIST 0xE50A8
Mengdong Lin86d15e02014-03-03 13:52:06 -0500757#define AUD_PINW_CONNLNG_SEL 0xE50AC
Wu Fengguang020abdb2010-04-19 13:13:06 +0800758#define AUD_CNTL_ST_A 0xE50B4
759#define AUD_CNTRL_ST2 0xE50C0
760#define AUD_CNTRL_ST3 0xE50C4
761#define AUD_HDMIW_STATUS 0xE50D4
762#define AUD_CONFIG_B 0xE5100
763#define AUD_MISC_CTRL_B 0xE5110
764#define AUD_CTS_ENABLE_B 0xE5128
765#define AUD_HDMIW_HDMIEDID_B 0xE5150
766#define AUD_HDMIW_INFOFR_B 0xE5154
767#define AUD_OUT_DIG_CNVT_B 0xE5180
768#define AUD_OUT_STR_DESC_B 0xE5184
769#define AUD_CNTL_ST_B 0xE51B4
770#define AUD_CONFIG_C 0xE5200
771#define AUD_MISC_CTRL_C 0xE5210
772#define AUD_CTS_ENABLE_C 0xE5228
773#define AUD_HDMIW_HDMIEDID_C 0xE5250
774#define AUD_HDMIW_INFOFR_C 0xE5254
775#define AUD_OUT_DIG_CNVT_C 0xE5280
776#define AUD_OUT_STR_DESC_C 0xE5284
777#define AUD_CNTL_ST_C 0xE52B4
778#define AUD_CONFIG_D 0xE5300
779#define AUD_MISC_CTRL_D 0xE5310
780#define AUD_CTS_ENABLE_D 0xE5328
781#define AUD_HDMIW_HDMIEDID_D 0xE5350
782#define AUD_HDMIW_INFOFR_D 0xE5354
783#define AUD_OUT_DIG_CNVT_D 0xE5380
784#define AUD_OUT_STR_DESC_D 0xE5384
785#define AUD_CNTL_ST_D 0xE53B4
786
Wu Fengguange321f132011-11-12 11:12:52 +0800787#define VIDEO_DIP_CTL_A 0xE0200
788#define VIDEO_DIP_CTL_B 0xE1200
789#define VIDEO_DIP_CTL_C 0xE2200
790#define VIDEO_DIP_CTL_D 0xE3200
791
Wu Fengguang020abdb2010-04-19 13:13:06 +0800792
793static void dump_cpt(void)
794{
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400795 uint32_t dword;
796 int i;
Wu Fengguang020abdb2010-04-19 13:13:06 +0800797
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400798 dump_reg(HDMIB, "sDVO/HDMI Port B Control");
799 dump_reg(HDMIC, "HDMI Port C Control");
800 dump_reg(HDMID, "HDMI Port D Control");
801 dump_reg(DP_CTL_B, "DisplayPort B Control");
802 dump_reg(DP_CTL_C, "DisplayPort C Control");
803 dump_reg(DP_CTL_D, "DisplayPort D Control");
804 dump_reg(TRANS_DP_CTL_A, "Transcoder A DisplayPort Control");
805 dump_reg(TRANS_DP_CTL_B, "Transcoder B DisplayPort Control");
806 dump_reg(TRANS_DP_CTL_C, "Transcoder C DisplayPort Control");
807 dump_reg(AUD_CONFIG_A, "Audio Configuration - Transcoder A");
808 dump_reg(AUD_CONFIG_B, "Audio Configuration - Transcoder B");
809 dump_reg(AUD_CONFIG_C, "Audio Configuration - Transcoder C");
810 dump_reg(AUD_CTS_ENABLE_A, "Audio CTS Programming Enable - Transcoder A");
811 dump_reg(AUD_CTS_ENABLE_B, "Audio CTS Programming Enable - Transcoder B");
812 dump_reg(AUD_CTS_ENABLE_C, "Audio CTS Programming Enable - Transcoder C");
813 dump_reg(AUD_MISC_CTRL_A, "Audio MISC Control for Transcoder A");
814 dump_reg(AUD_MISC_CTRL_B, "Audio MISC Control for Transcoder B");
815 dump_reg(AUD_MISC_CTRL_C, "Audio MISC Control for Transcoder C");
816 dump_reg(AUD_VID_DID, "Audio Vendor ID / Device ID");
817 dump_reg(AUD_RID, "Audio Revision ID");
818 dump_reg(AUD_PWRST, "Audio Power State (Function Group, Convertor, Pin Widget)");
819 dump_reg(AUD_PORT_EN_HD_CFG, "Audio Port Enable HDAudio Config");
820 dump_reg(AUD_OUT_DIG_CNVT_A, "Audio Digital Converter - Conv A");
821 dump_reg(AUD_OUT_DIG_CNVT_B, "Audio Digital Converter - Conv B");
822 dump_reg(AUD_OUT_DIG_CNVT_C, "Audio Digital Converter - Conv C");
823 dump_reg(AUD_OUT_CH_STR, "Audio Channel ID and Stream ID");
824 dump_reg(AUD_OUT_STR_DESC_A, "Audio Stream Descriptor Format - Conv A");
825 dump_reg(AUD_OUT_STR_DESC_B, "Audio Stream Descriptor Format - Conv B");
826 dump_reg(AUD_OUT_STR_DESC_C, "Audio Stream Descriptor Format - Conv C");
827 dump_reg(AUD_PINW_CONNLNG_LIST, "Audio Connection List");
828 dump_reg(AUD_PINW_CONNLNG_SEL, "Audio Connection Select");
829 dump_reg(AUD_CNTL_ST_A, "Audio Control State Register - Transcoder A");
830 dump_reg(AUD_CNTL_ST_B, "Audio Control State Register - Transcoder B");
831 dump_reg(AUD_CNTL_ST_C, "Audio Control State Register - Transcoder C");
832 dump_reg(AUD_CNTRL_ST2, "Audio Control State 2");
833 dump_reg(AUD_CNTRL_ST3, "Audio Control State 3");
834 dump_reg(AUD_HDMIW_STATUS, "Audio HDMI Status");
835 dump_reg(AUD_HDMIW_HDMIEDID_A, "HDMI Data EDID Block - Transcoder A");
836 dump_reg(AUD_HDMIW_HDMIEDID_B, "HDMI Data EDID Block - Transcoder B");
837 dump_reg(AUD_HDMIW_HDMIEDID_C, "HDMI Data EDID Block - Transcoder C");
838 dump_reg(AUD_HDMIW_INFOFR_A, "Audio Widget Data Island Packet - Transcoder A");
839 dump_reg(AUD_HDMIW_INFOFR_B, "Audio Widget Data Island Packet - Transcoder B");
840 dump_reg(AUD_HDMIW_INFOFR_C, "Audio Widget Data Island Packet - Transcoder C");
Wu Fengguang020abdb2010-04-19 13:13:06 +0800841
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400842 printf("\nDetails:\n\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +0800843
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400844 dword = INREG(VIDEO_DIP_CTL_A);
845 printf("VIDEO_DIP_CTL_A Enable_Graphics_DIP\t\t\t%ld\n", BIT(dword, 31)),
846 printf("VIDEO_DIP_CTL_A GCP_DIP_enable\t\t\t\t%ld\n", BIT(dword, 25)),
847 printf("VIDEO_DIP_CTL_A Video_DIP_type_enable AVI\t\t%lu\n", BIT(dword, 21));
848 printf("VIDEO_DIP_CTL_A Video_DIP_type_enable Vendor\t\t%lu\n", BIT(dword, 22));
849 printf("VIDEO_DIP_CTL_A Video_DIP_type_enable Gamut\t\t%lu\n", BIT(dword, 23));
850 printf("VIDEO_DIP_CTL_A Video_DIP_type_enable Source \t\t%lu\n", BIT(dword, 24));
851 printf("VIDEO_DIP_CTL_A Video_DIP_buffer_index\t\t\t[0x%lx] %s\n",
852 BITS(dword, 20, 19), video_dip_index[BITS(dword, 20, 19)]);
853 printf("VIDEO_DIP_CTL_A Video_DIP_frequency\t\t\t[0x%lx] %s\n",
854 BITS(dword, 17, 16), video_dip_trans[BITS(dword, 17, 16)]);
855 printf("VIDEO_DIP_CTL_A Video_DIP_buffer_size\t\t\t%lu\n", BITS(dword, 11, 8));
856 printf("VIDEO_DIP_CTL_A Video_DIP_access_address\t\t%lu\n", BITS(dword, 3, 0));
Wu Fengguange321f132011-11-12 11:12:52 +0800857
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400858 dword = INREG(VIDEO_DIP_CTL_B);
859 printf("VIDEO_DIP_CTL_B Enable_Graphics_DIP\t\t\t%ld\n", BIT(dword, 31)),
860 printf("VIDEO_DIP_CTL_B GCP_DIP_enable\t\t\t\t%ld\n", BIT(dword, 25)),
861 printf("VIDEO_DIP_CTL_B Video_DIP_type_enable AVI\t\t%lu\n", BIT(dword, 21));
862 printf("VIDEO_DIP_CTL_B Video_DIP_type_enable Vendor\t\t%lu\n", BIT(dword, 22));
863 printf("VIDEO_DIP_CTL_B Video_DIP_type_enable Gamut\t\t%lu\n", BIT(dword, 23));
864 printf("VIDEO_DIP_CTL_B Video_DIP_type_enable Source \t\t%lu\n", BIT(dword, 24));
865 printf("VIDEO_DIP_CTL_B Video_DIP_buffer_index\t\t\t[0x%lx] %s\n",
866 BITS(dword, 20, 19), video_dip_index[BITS(dword, 20, 19)]);
867 printf("VIDEO_DIP_CTL_B Video_DIP_frequency\t\t\t[0x%lx] %s\n",
868 BITS(dword, 17, 16), video_dip_trans[BITS(dword, 17, 16)]);
869 printf("VIDEO_DIP_CTL_B Video_DIP_buffer_size\t\t\t%lu\n", BITS(dword, 11, 8));
870 printf("VIDEO_DIP_CTL_B Video_DIP_access_address\t\t%lu\n", BITS(dword, 3, 0));
Wu Fengguange321f132011-11-12 11:12:52 +0800871
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400872 dword = INREG(VIDEO_DIP_CTL_C);
873 printf("VIDEO_DIP_CTL_C Enable_Graphics_DIP\t\t\t%ld\n", BIT(dword, 31)),
874 printf("VIDEO_DIP_CTL_C GCP_DIP_enable\t\t\t\t%ld\n", BIT(dword, 25)),
875 printf("VIDEO_DIP_CTL_C Video_DIP_type_enable AVI\t\t%lu\n", BIT(dword, 21));
876 printf("VIDEO_DIP_CTL_C Video_DIP_type_enable Vendor\t\t%lu\n", BIT(dword, 22));
877 printf("VIDEO_DIP_CTL_C Video_DIP_type_enable Gamut\t\t%lu\n", BIT(dword, 23));
878 printf("VIDEO_DIP_CTL_C Video_DIP_type_enable Source \t\t%lu\n", BIT(dword, 24));
879 printf("VIDEO_DIP_CTL_C Video_DIP_buffer_index\t\t\t[0x%lx] %s\n",
880 BITS(dword, 20, 19), video_dip_index[BITS(dword, 20, 19)]);
881 printf("VIDEO_DIP_CTL_C Video_DIP_frequency\t\t\t[0x%lx] %s\n",
882 BITS(dword, 17, 16), video_dip_trans[BITS(dword, 17, 16)]);
883 printf("VIDEO_DIP_CTL_C Video_DIP_buffer_size\t\t\t%lu\n", BITS(dword, 11, 8));
884 printf("VIDEO_DIP_CTL_C Video_DIP_access_address\t\t%lu\n", BITS(dword, 3, 0));
Wu Fengguange321f132011-11-12 11:12:52 +0800885
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400886 dword = INREG(AUD_VID_DID);
887 printf("AUD_VID_DID vendor id\t\t\t\t\t0x%x\n", dword >> 16);
888 printf("AUD_VID_DID device id\t\t\t\t\t0x%x\n", dword & 0xffff);
Wu Fengguang020abdb2010-04-19 13:13:06 +0800889
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400890 dword = INREG(AUD_RID);
891 printf("AUD_RID Major_Revision\t\t\t\t\t0x%lx\n", BITS(dword, 23, 20));
892 printf("AUD_RID Minor_Revision\t\t\t\t\t0x%lx\n", BITS(dword, 19, 16));
893 printf("AUD_RID Revision_Id\t\t\t\t\t0x%lx\n", BITS(dword, 15, 8));
894 printf("AUD_RID Stepping_Id\t\t\t\t\t0x%lx\n", BITS(dword, 7, 0));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800895
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400896 dword = INREG(HDMIB);
897 printf("HDMIB Port_Enable\t\t\t\t\t%u\n", !!(dword & SDVO_ENABLE));
898 printf("HDMIB Transcoder_Select\t\t\t\t\t[0x%lx] %s\n",
899 BITS(dword, 30, 29), transcoder_select[BITS(dword, 30, 29)]);
900 printf("HDMIB sDVO_Border_Enable\t\t\t\t%lu\n", BIT(dword, 7));
901 printf("HDMIB HDCP_Port_Select\t\t\t\t\t%lu\n", BIT(dword, 5));
902 printf("HDMIB SDVO_HPD_Interrupt_Enable\t\t\t\t%lu\n", BIT(dword, 23));
903 printf("HDMIB Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
904 printf("HDMIB Encoding\t\t\t\t\t\t[0x%lx] %s\n",
905 BITS(dword, 11, 10), sdvo_hdmi_encoding[BITS(dword, 11, 10)]);
906 printf("HDMIB HDMI_or_DVI_Select\t\t\t\t%s\n", BIT(dword, 9) ? "HDMI" : "DVI");
907 printf("HDMIB Audio_Output_Enable\t\t\t\t%u\n", !!(dword & SDVO_AUDIO_ENABLE));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800908
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400909 dword = INREG(HDMIC);
910 printf("HDMIC Port_Enable\t\t\t\t\t%u\n", !!(dword & SDVO_ENABLE));
911 printf("HDMIC Transcoder_Select\t\t\t\t\t[0x%lx] %s\n",
912 BITS(dword, 30, 29), transcoder_select[BITS(dword, 30, 29)]);
913 printf("HDMIC sDVO_Border_Enable\t\t\t\t%lu\n", BIT(dword, 7));
914 printf("HDMIC HDCP_Port_Select\t\t\t\t\t%lu\n", BIT(dword, 5));
915 printf("HDMIC SDVO_HPD_Interrupt_Enable\t\t\t\t%lu\n", BIT(dword, 23));
916 printf("HDMIC Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
917 printf("HDMIC Encoding\t\t\t\t\t\t[0x%lx] %s\n",
918 BITS(dword, 11, 10), sdvo_hdmi_encoding[BITS(dword, 11, 10)]);
919 printf("HDMIC HDMI_or_DVI_Select\t\t\t\t%s\n", BIT(dword, 9) ? "HDMI" : "DVI");
920 printf("HDMIC Audio_Output_Enable\t\t\t\t%u\n", !!(dword & SDVO_AUDIO_ENABLE));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800921
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400922 dword = INREG(HDMID);
923 printf("HDMID Port_Enable\t\t\t\t\t%u\n", !!(dword & SDVO_ENABLE));
924 printf("HDMID Transcoder_Select\t\t\t\t\t[0x%lx] %s\n",
925 BITS(dword, 30, 29), transcoder_select[BITS(dword, 30, 29)]);
926 printf("HDMID sDVO_Border_Enable\t\t\t\t%lu\n", BIT(dword, 7));
927 printf("HDMID HDCP_Port_Select\t\t\t\t\t%lu\n", BIT(dword, 5));
928 printf("HDMID SDVO_HPD_Interrupt_Enable\t\t\t\t%lu\n", BIT(dword, 23));
929 printf("HDMID Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
930 printf("HDMID Encoding\t\t\t\t\t\t[0x%lx] %s\n",
931 BITS(dword, 11, 10), sdvo_hdmi_encoding[BITS(dword, 11, 10)]);
932 printf("HDMID HDMI_or_DVI_Select\t\t\t\t%s\n", BIT(dword, 9) ? "HDMI" : "DVI");
933 printf("HDMID Audio_Output_Enable\t\t\t\t%u\n", !!(dword & SDVO_AUDIO_ENABLE));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800934
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400935 dword = INREG(DP_CTL_B);
936 printf("DP_CTL_B DisplayPort_Enable\t\t\t\t%lu\n", BIT(dword, 31));
937 printf("DP_CTL_B Port_Width_Selection\t\t\t\t[0x%lx] %s\n",
938 BITS(dword, 21, 19), dp_port_width[BITS(dword, 21, 19)]);
939 printf("DP_CTL_B Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
940 printf("DP_CTL_B HDCP_Port_Select\t\t\t\t%lu\n", BIT(dword, 5));
941 printf("DP_CTL_B Audio_Output_Enable\t\t\t\t%lu\n", BIT(dword, 6));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800942
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400943 dword = INREG(DP_CTL_C);
944 printf("DP_CTL_C DisplayPort_Enable\t\t\t\t%lu\n", BIT(dword, 31));
945 printf("DP_CTL_C Port_Width_Selection\t\t\t\t[0x%lx] %s\n",
946 BITS(dword, 21, 19), dp_port_width[BITS(dword, 21, 19)]);
947 printf("DP_CTL_C Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
948 printf("DP_CTL_C HDCP_Port_Select\t\t\t\t%lu\n", BIT(dword, 5));
949 printf("DP_CTL_C Audio_Output_Enable\t\t\t\t%lu\n", BIT(dword, 6));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800950
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400951 dword = INREG(DP_CTL_D);
952 printf("DP_CTL_D DisplayPort_Enable\t\t\t\t%lu\n", BIT(dword, 31));
953 printf("DP_CTL_D Port_Width_Selection\t\t\t\t[0x%lx] %s\n",
954 BITS(dword, 21, 19), dp_port_width[BITS(dword, 21, 19)]);
955 printf("DP_CTL_D Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
956 printf("DP_CTL_D HDCP_Port_Select\t\t\t\t%lu\n", BIT(dword, 5));
957 printf("DP_CTL_D Audio_Output_Enable\t\t\t\t%lu\n", BIT(dword, 6));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800958
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400959 dword = INREG(AUD_CONFIG_A);
960 printf("AUD_CONFIG_A N_index_value\t\t\t\t[0x%lx] %s\n", BIT(dword, 29),
961 n_index_value[BIT(dword, 29)]);
962 printf("AUD_CONFIG_A N_programming_enable\t\t\t%lu\n", BIT(dword, 28));
963 printf("AUD_CONFIG_A Upper_N_value\t\t\t\t0x%02lx\n", BITS(dword, 27, 20));
964 printf("AUD_CONFIG_A Lower_N_value\t\t\t\t0x%03lx\n", BITS(dword, 15, 4));
965 printf("AUD_CONFIG_A Pixel_Clock_HDMI\t\t\t\t[0x%lx] %s\n", BITS(dword, 19, 16),
966 OPNAME(pixel_clock, BITS(dword, 19, 16)));
967 printf("AUD_CONFIG_A Disable_NCTS\t\t\t\t%lu\n", BIT(dword, 3));
968 dword = INREG(AUD_CONFIG_B);
969 printf("AUD_CONFIG_B N_index_value\t\t\t\t[0x%lx] %s\n", BIT(dword, 29),
970 n_index_value[BIT(dword, 29)]);
971 printf("AUD_CONFIG_B N_programming_enable\t\t\t%lu\n", BIT(dword, 28));
972 printf("AUD_CONFIG_B Upper_N_value\t\t\t\t0x%02lx\n", BITS(dword, 27, 20));
973 printf("AUD_CONFIG_B Lower_N_value\t\t\t\t0x%03lx\n", BITS(dword, 15, 4));
974 printf("AUD_CONFIG_B Pixel_Clock_HDMI\t\t\t\t[0x%lx] %s\n", BITS(dword, 19, 16),
975 OPNAME(pixel_clock, BITS(dword, 19, 16)));
976 printf("AUD_CONFIG_B Disable_NCTS\t\t\t\t%lu\n", BIT(dword, 3));
977 dword = INREG(AUD_CONFIG_C);
978 printf("AUD_CONFIG_C N_index_value\t\t\t\t[0x%lx] %s\n", BIT(dword, 29),
979 n_index_value[BIT(dword, 29)]);
980 printf("AUD_CONFIG_C N_programming_enable\t\t\t%lu\n", BIT(dword, 28));
981 printf("AUD_CONFIG_C Upper_N_value\t\t\t\t0x%02lx\n", BITS(dword, 27, 20));
982 printf("AUD_CONFIG_C Lower_N_value\t\t\t\t0x%03lx\n", BITS(dword, 15, 4));
983 printf("AUD_CONFIG_C Pixel_Clock_HDMI\t\t\t\t[0x%lx] %s\n", BITS(dword, 19, 16),
984 OPNAME(pixel_clock, BITS(dword, 19, 16)));
985 printf("AUD_CONFIG_C Disable_NCTS\t\t\t\t%lu\n", BIT(dword, 3));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800986
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400987 dword = INREG(AUD_CTS_ENABLE_A);
988 printf("AUD_CTS_ENABLE_A Enable_CTS_or_M_programming\t\t%lu\n", BIT(dword, 20));
989 printf("AUD_CTS_ENABLE_A CTS_M value Index\t\t\t%s\n", BIT(dword, 21) ? "CTS" : "M");
990 printf("AUD_CTS_ENABLE_A CTS_programming\t\t\t%#lx\n", BITS(dword, 19, 0));
991 dword = INREG(AUD_CTS_ENABLE_B);
992 printf("AUD_CTS_ENABLE_B Enable_CTS_or_M_programming\t\t%lu\n", BIT(dword, 20));
993 printf("AUD_CTS_ENABLE_B CTS_M value Index\t\t\t%s\n", BIT(dword, 21) ? "CTS" : "M");
994 printf("AUD_CTS_ENABLE_B CTS_programming\t\t\t%#lx\n", BITS(dword, 19, 0));
995 dword = INREG(AUD_CTS_ENABLE_C);
996 printf("AUD_CTS_ENABLE_C Enable_CTS_or_M_programming\t\t%lu\n", BIT(dword, 20));
997 printf("AUD_CTS_ENABLE_C CTS_M value Index\t\t\t%s\n", BIT(dword, 21) ? "CTS" : "M");
998 printf("AUD_CTS_ENABLE_C CTS_programming\t\t\t%#lx\n", BITS(dword, 19, 0));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800999
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001000 dword = INREG(AUD_MISC_CTRL_A);
1001 printf("AUD_MISC_CTRL_A Sample_Fabrication_EN_bit\t\t%lu\n", BIT(dword, 2));
1002 printf("AUD_MISC_CTRL_A Sample_present_Disable\t\t\t%lu\n", BIT(dword, 8));
1003 printf("AUD_MISC_CTRL_A Output_Delay\t\t\t\t%lu\n", BITS(dword, 7, 4));
1004 printf("AUD_MISC_CTRL_A Pro_Allowed\t\t\t\t%lu\n", BIT(dword, 1));
1005 dword = INREG(AUD_MISC_CTRL_B);
1006 printf("AUD_MISC_CTRL_B Sample_Fabrication_EN_bit\t\t%lu\n", BIT(dword, 2));
1007 printf("AUD_MISC_CTRL_B Sample_present_Disable\t\t\t%lu\n", BIT(dword, 8));
1008 printf("AUD_MISC_CTRL_B Output_Delay\t\t\t\t%lu\n", BITS(dword, 7, 4));
1009 printf("AUD_MISC_CTRL_B Pro_Allowed\t\t\t\t%lu\n", BIT(dword, 1));
1010 dword = INREG(AUD_MISC_CTRL_C);
1011 printf("AUD_MISC_CTRL_C Sample_Fabrication_EN_bit\t\t%lu\n", BIT(dword, 2));
1012 printf("AUD_MISC_CTRL_C Sample_present_Disable\t\t\t%lu\n", BIT(dword, 8));
1013 printf("AUD_MISC_CTRL_C Output_Delay\t\t\t\t%lu\n", BITS(dword, 7, 4));
1014 printf("AUD_MISC_CTRL_C Pro_Allowed\t\t\t\t%lu\n", BIT(dword, 1));
Wu Fengguang020abdb2010-04-19 13:13:06 +08001015
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001016 dword = INREG(AUD_PWRST);
1017 printf("AUD_PWRST Func_Grp_Dev_PwrSt_Curr \t%s\n", power_state[BITS(dword, 27, 26)]);
1018 printf("AUD_PWRST Func_Grp_Dev_PwrSt_Set \t%s\n", power_state[BITS(dword, 25, 24)]);
1019 printf("AUD_PWRST ConvertorA_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 15, 14)]);
1020 printf("AUD_PWRST ConvertorA_Widget_Power_State_Requsted \t%s\n", power_state[BITS(dword, 13, 12)]);
1021 printf("AUD_PWRST ConvertorB_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 19, 18)]);
1022 printf("AUD_PWRST ConvertorB_Widget_Power_State_Requested \t%s\n", power_state[BITS(dword, 17, 16)]);
1023 printf("AUD_PWRST ConvC_Widget_PwrSt_Curr \t%s\n", power_state[BITS(dword, 23, 22)]);
1024 printf("AUD_PWRST ConvC_Widget_PwrSt_Req \t%s\n", power_state[BITS(dword, 21, 20)]);
1025 printf("AUD_PWRST PinB_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 3, 2)]);
1026 printf("AUD_PWRST PinB_Widget_Power_State_Set \t%s\n", power_state[BITS(dword, 1, 0)]);
1027 printf("AUD_PWRST PinC_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 7, 6)]);
1028 printf("AUD_PWRST PinC_Widget_Power_State_Set \t%s\n", power_state[BITS(dword, 5, 4)]);
1029 printf("AUD_PWRST PinD_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 11, 10)]);
1030 printf("AUD_PWRST PinD_Widget_Power_State_Set \t%s\n", power_state[BITS(dword, 9, 8)]);
Wu Fengguang020abdb2010-04-19 13:13:06 +08001031
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001032 dword = INREG(AUD_PORT_EN_HD_CFG);
1033 printf("AUD_PORT_EN_HD_CFG Convertor_A_Digen\t\t\t%lu\n", BIT(dword, 0));
1034 printf("AUD_PORT_EN_HD_CFG Convertor_B_Digen\t\t\t%lu\n", BIT(dword, 1));
1035 printf("AUD_PORT_EN_HD_CFG Convertor_C_Digen\t\t\t%lu\n", BIT(dword, 2));
1036 printf("AUD_PORT_EN_HD_CFG ConvertorA_Stream_ID\t\t%lu\n", BITS(dword, 7, 4));
1037 printf("AUD_PORT_EN_HD_CFG ConvertorB_Stream_ID\t\t%lu\n", BITS(dword, 11, 8));
1038 printf("AUD_PORT_EN_HD_CFG ConvertorC_Stream_ID\t\t%lu\n", BITS(dword, 15, 12));
1039 printf("AUD_PORT_EN_HD_CFG Port_B_Out_Enable\t\t\t%lu\n", BIT(dword, 16));
1040 printf("AUD_PORT_EN_HD_CFG Port_C_Out_Enable\t\t\t%lu\n", BIT(dword, 17));
1041 printf("AUD_PORT_EN_HD_CFG Port_D_Out_Enable\t\t\t%lu\n", BIT(dword, 18));
1042 printf("AUD_PORT_EN_HD_CFG Port_B_Amp_Mute_Status\t\t%lu\n", BIT(dword, 20));
1043 printf("AUD_PORT_EN_HD_CFG Port_C_Amp_Mute_Status\t\t%lu\n", BIT(dword, 21));
1044 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 +08001045
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001046 dword = INREG(AUD_OUT_DIG_CNVT_A);
1047 printf("AUD_OUT_DIG_CNVT_A V\t\t\t\t\t%lu\n", BIT(dword, 1));
1048 printf("AUD_OUT_DIG_CNVT_A VCFG\t\t\t\t%lu\n", BIT(dword, 2));
1049 printf("AUD_OUT_DIG_CNVT_A PRE\t\t\t\t\t%lu\n", BIT(dword, 3));
1050 printf("AUD_OUT_DIG_CNVT_A Copy\t\t\t\t%lu\n", BIT(dword, 4));
1051 printf("AUD_OUT_DIG_CNVT_A NonAudio\t\t\t\t%lu\n", BIT(dword, 5));
1052 printf("AUD_OUT_DIG_CNVT_A PRO\t\t\t\t\t%lu\n", BIT(dword, 6));
1053 printf("AUD_OUT_DIG_CNVT_A Level\t\t\t\t%lu\n", BIT(dword, 7));
1054 printf("AUD_OUT_DIG_CNVT_A Category_Code\t\t\t%lu\n", BITS(dword, 14, 8));
1055 printf("AUD_OUT_DIG_CNVT_A Lowest_Channel_Number\t\t%lu\n", BITS(dword, 19, 16));
1056 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 +08001057
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001058 dword = INREG(AUD_OUT_DIG_CNVT_B);
1059 printf("AUD_OUT_DIG_CNVT_B V\t\t\t\t\t%lu\n", BIT(dword, 1));
1060 printf("AUD_OUT_DIG_CNVT_B VCFG\t\t\t\t%lu\n", BIT(dword, 2));
1061 printf("AUD_OUT_DIG_CNVT_B PRE\t\t\t\t\t%lu\n", BIT(dword, 3));
1062 printf("AUD_OUT_DIG_CNVT_B Copy\t\t\t\t%lu\n", BIT(dword, 4));
1063 printf("AUD_OUT_DIG_CNVT_B NonAudio\t\t\t\t%lu\n", BIT(dword, 5));
1064 printf("AUD_OUT_DIG_CNVT_B PRO\t\t\t\t\t%lu\n", BIT(dword, 6));
1065 printf("AUD_OUT_DIG_CNVT_B Level\t\t\t\t%lu\n", BIT(dword, 7));
1066 printf("AUD_OUT_DIG_CNVT_B Category_Code\t\t\t%lu\n", BITS(dword, 14, 8));
1067 printf("AUD_OUT_DIG_CNVT_B Lowest_Channel_Number\t\t%lu\n", BITS(dword, 19, 16));
1068 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 +08001069
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001070 dword = INREG(AUD_OUT_DIG_CNVT_C);
1071 printf("AUD_OUT_DIG_CNVT_C V\t\t\t\t\t%lu\n", BIT(dword, 1));
1072 printf("AUD_OUT_DIG_CNVT_C VCFG\t\t\t\t%lu\n", BIT(dword, 2));
1073 printf("AUD_OUT_DIG_CNVT_C PRE\t\t\t\t\t%lu\n", BIT(dword, 3));
1074 printf("AUD_OUT_DIG_CNVT_C Copy\t\t\t\t%lu\n", BIT(dword, 4));
1075 printf("AUD_OUT_DIG_CNVT_C NonAudio\t\t\t\t%lu\n", BIT(dword, 5));
1076 printf("AUD_OUT_DIG_CNVT_C PRO\t\t\t\t\t%lu\n", BIT(dword, 6));
1077 printf("AUD_OUT_DIG_CNVT_C Level\t\t\t\t%lu\n", BIT(dword, 7));
1078 printf("AUD_OUT_DIG_CNVT_C Category_Code\t\t\t%lu\n", BITS(dword, 14, 8));
1079 printf("AUD_OUT_DIG_CNVT_C Lowest_Channel_Number\t\t%lu\n", BITS(dword, 19, 16));
1080 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 +08001081
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001082 printf("AUD_OUT_CH_STR Converter_Channel_MAP PORTB PORTC PORTD\n");
1083 for (i = 0; i < 8; i++) {
1084 OUTREG(AUD_OUT_CH_STR, i | (i << 8) | (i << 16));
1085 dword = INREG(AUD_OUT_CH_STR);
1086 printf("\t\t\t\t%lu\t%lu\t%lu\t%lu\n",
1087 1 + BITS(dword, 3, 0),
1088 1 + BITS(dword, 7, 4),
1089 1 + BITS(dword, 15, 12),
1090 1 + BITS(dword, 23, 20));
1091 }
Wu Fengguang020abdb2010-04-19 13:13:06 +08001092
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001093 dword = INREG(AUD_OUT_STR_DESC_A);
1094 printf("AUD_OUT_STR_DESC_A HBR_enable\t\t\t\t%lu\n", BITS(dword, 28, 27));
1095 printf("AUD_OUT_STR_DESC_A Convertor_Channel_Count\t\t%lu\n", BITS(dword, 20, 16) + 1);
1096 printf("AUD_OUT_STR_DESC_A Bits_per_Sample\t\t\t[%#lx] %s\n",
1097 BITS(dword, 6, 4), OPNAME(bits_per_sample, BITS(dword, 6, 4)));
1098 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 +08001099
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001100 dword = INREG(AUD_OUT_STR_DESC_B);
1101 printf("AUD_OUT_STR_DESC_B HBR_enable\t\t\t\t%lu\n", BITS(dword, 28, 27));
1102 printf("AUD_OUT_STR_DESC_B Convertor_Channel_Count\t\t%lu\n", BITS(dword, 20, 16) + 1);
1103 printf("AUD_OUT_STR_DESC_B Bits_per_Sample\t\t\t[%#lx] %s\n",
1104 BITS(dword, 6, 4), OPNAME(bits_per_sample, BITS(dword, 6, 4)));
1105 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 +08001106
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001107 dword = INREG(AUD_OUT_STR_DESC_C);
1108 printf("AUD_OUT_STR_DESC_C HBR_enable\t\t\t\t%lu\n", BITS(dword, 28, 27));
1109 printf("AUD_OUT_STR_DESC_C Convertor_Channel_Count\t\t%lu\n", BITS(dword, 20, 16) + 1);
1110 printf("AUD_OUT_STR_DESC_C Bits_per_Sample\t\t\t[%#lx] %s\n",
1111 BITS(dword, 6, 4), OPNAME(bits_per_sample, BITS(dword, 6, 4)));
1112 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 +08001113
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001114 dword = INREG(AUD_PINW_CONNLNG_SEL);
1115 printf("AUD_PINW_CONNLNG_SEL Connection_select_Control_B\t%#lx\n", BITS(dword, 7, 0));
1116 printf("AUD_PINW_CONNLNG_SEL Connection_select_Control_C\t%#lx\n", BITS(dword, 15, 8));
1117 printf("AUD_PINW_CONNLNG_SEL Connection_select_Control_D\t%#lx\n", BITS(dword, 23, 16));
Wu Fengguang020abdb2010-04-19 13:13:06 +08001118
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001119 dword = INREG(AUD_CNTL_ST_A);
1120 printf("AUD_CNTL_ST_A DIP_Port_Select\t\t\t\t[%#lx] %s\n",
1121 BITS(dword, 30, 29), dip_port[BITS(dword, 30, 29)]);
1122 printf("AUD_CNTL_ST_A DIP_type_enable_status Audio DIP\t\t%lu\n", BIT(dword, 21));
1123 printf("AUD_CNTL_ST_A DIP_type_enable_status ACP DIP\t\t%lu\n", BIT(dword, 22));
1124 printf("AUD_CNTL_ST_A DIP_type_enable_status Generic 2 DIP\t%lu\n", BIT(dword, 23));
1125 printf("AUD_CNTL_ST_A DIP_transmission_frequency\t\t[0x%lx] %s\n",
1126 BITS(dword, 17, 16), dip_trans[BITS(dword, 17, 16)]);
1127 printf("AUD_CNTL_ST_A ELD_ACK\t\t\t\t\t%lu\n", BIT(dword, 4));
1128 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 +08001129
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001130 dword = INREG(AUD_CNTL_ST_B);
1131 printf("AUD_CNTL_ST_B DIP_Port_Select\t\t\t\t[%#lx] %s\n",
1132 BITS(dword, 30, 29), dip_port[BITS(dword, 30, 29)]);
1133 printf("AUD_CNTL_ST_B DIP_type_enable_status Audio DIP\t\t%lu\n", BIT(dword, 21));
1134 printf("AUD_CNTL_ST_B DIP_type_enable_status ACP DIP\t\t%lu\n", BIT(dword, 22));
1135 printf("AUD_CNTL_ST_B DIP_type_enable_status Generic 2 DIP\t%lu\n", BIT(dword, 23));
1136 printf("AUD_CNTL_ST_B DIP_transmission_frequency\t\t[0x%lx] %s\n",
1137 BITS(dword, 17, 16), dip_trans[BITS(dword, 17, 16)]);
1138 printf("AUD_CNTL_ST_B ELD_ACK\t\t\t\t\t%lu\n", BIT(dword, 4));
1139 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 +08001140
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001141 dword = INREG(AUD_CNTL_ST_C);
1142 printf("AUD_CNTL_ST_C DIP_Port_Select\t\t\t\t[%#lx] %s\n",
1143 BITS(dword, 30, 29), dip_port[BITS(dword, 30, 29)]);
1144 printf("AUD_CNTL_ST_C DIP_type_enable_status Audio DIP\t\t%lu\n", BIT(dword, 21));
1145 printf("AUD_CNTL_ST_C DIP_type_enable_status ACP DIP\t\t%lu\n", BIT(dword, 22));
1146 printf("AUD_CNTL_ST_C DIP_type_enable_status Generic 2 DIP\t%lu\n", BIT(dword, 23));
1147 printf("AUD_CNTL_ST_C DIP_transmission_frequency\t\t[0x%lx] %s\n",
1148 BITS(dword, 17, 16), dip_trans[BITS(dword, 17, 16)]);
1149 printf("AUD_CNTL_ST_C ELD_ACK\t\t\t\t\t%lu\n", BIT(dword, 4));
1150 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 +08001151
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001152 dword = INREG(AUD_CNTRL_ST2);
1153 printf("AUD_CNTRL_ST2 CP_ReadyB\t\t\t\t%lu\n", BIT(dword, 1));
1154 printf("AUD_CNTRL_ST2 ELD_validB\t\t\t\t%lu\n", BIT(dword, 0));
1155 printf("AUD_CNTRL_ST2 CP_ReadyC\t\t\t\t%lu\n", BIT(dword, 5));
1156 printf("AUD_CNTRL_ST2 ELD_validC\t\t\t\t%lu\n", BIT(dword, 4));
1157 printf("AUD_CNTRL_ST2 CP_ReadyD\t\t\t\t%lu\n", BIT(dword, 9));
1158 printf("AUD_CNTRL_ST2 ELD_validD\t\t\t\t%lu\n", BIT(dword, 8));
Wu Fengguang020abdb2010-04-19 13:13:06 +08001159
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001160 dword = INREG(AUD_CNTRL_ST3);
1161 printf("AUD_CNTRL_ST3 TransA_DPT_Audio_Output_En\t\t%lu\n", BIT(dword, 3));
1162 printf("AUD_CNTRL_ST3 TransA_to_Port_Sel\t\t\t[%#lx] %s\n",
1163 BITS(dword, 2, 0), trans_to_port_sel[BITS(dword, 2, 0)]);
1164 printf("AUD_CNTRL_ST3 TransB_DPT_Audio_Output_En\t\t%lu\n", BIT(dword, 7));
1165 printf("AUD_CNTRL_ST3 TransB_to_Port_Sel\t\t\t[%#lx] %s\n",
1166 BITS(dword, 6, 4), trans_to_port_sel[BITS(dword, 6, 4)]);
1167 printf("AUD_CNTRL_ST3 TransC_DPT_Audio_Output_En\t\t%lu\n", BIT(dword, 11));
1168 printf("AUD_CNTRL_ST3 TransC_to_Port_Sel\t\t\t[%#lx] %s\n",
1169 BITS(dword, 10, 8), trans_to_port_sel[BITS(dword, 10, 8)]);
Wu Fengguang020abdb2010-04-19 13:13:06 +08001170
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001171 dword = INREG(AUD_HDMIW_STATUS);
1172 printf("AUD_HDMIW_STATUS Conv_A_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 27));
1173 printf("AUD_HDMIW_STATUS Conv_A_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n", BIT(dword, 26));
1174 printf("AUD_HDMIW_STATUS Conv_B_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 29));
1175 printf("AUD_HDMIW_STATUS Conv_B_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n", BIT(dword, 28));
1176 printf("AUD_HDMIW_STATUS Conv_C_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 31));
1177 printf("AUD_HDMIW_STATUS Conv_C_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n", BIT(dword, 30));
1178 printf("AUD_HDMIW_STATUS BCLK/CDCLK_FIFO_Overrun\t\t%lu\n", BIT(dword, 25));
1179 printf("AUD_HDMIW_STATUS Function_Reset\t\t\t%lu\n", BIT(dword, 24));
Wu Fengguang020abdb2010-04-19 13:13:06 +08001180
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001181 printf("AUD_HDMIW_HDMIEDID_A HDMI ELD:\n\t");
1182 dword = INREG(AUD_CNTL_ST_A);
1183 dword &= ~BITMASK(9, 5);
1184 OUTREG(AUD_CNTL_ST_A, dword);
1185 for (i = 0; i < BITS(dword, 14, 10) / 4; i++)
1186 printf("%08x ", htonl(INREG(AUD_HDMIW_HDMIEDID_A)));
1187 printf("\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +08001188
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001189 printf("AUD_HDMIW_HDMIEDID_B HDMI ELD:\n\t");
1190 dword = INREG(AUD_CNTL_ST_B);
1191 dword &= ~BITMASK(9, 5);
1192 OUTREG(AUD_CNTL_ST_B, dword);
1193 for (i = 0; i < BITS(dword, 14, 10) / 4; i++)
1194 printf("%08x ", htonl(INREG(AUD_HDMIW_HDMIEDID_B)));
1195 printf("\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +08001196
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001197 printf("AUD_HDMIW_HDMIEDID_C HDMI ELD:\n\t");
1198 dword = INREG(AUD_CNTL_ST_C);
1199 dword &= ~BITMASK(9, 5);
1200 OUTREG(AUD_CNTL_ST_C, dword);
1201 for (i = 0; i < BITS(dword, 14, 10) / 4; i++)
1202 printf("%08x ", htonl(INREG(AUD_HDMIW_HDMIEDID_C)));
1203 printf("\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +08001204
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001205 printf("AUD_HDMIW_INFOFR_A HDMI audio Infoframe:\n\t");
1206 dword = INREG(AUD_CNTL_ST_A);
1207 dword &= ~BITMASK(20, 18);
1208 dword &= ~BITMASK(3, 0);
1209 OUTREG(AUD_CNTL_ST_A, dword);
1210 for (i = 0; i < 8; i++)
1211 printf("%08x ", htonl(INREG(AUD_HDMIW_INFOFR_A)));
1212 printf("\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +08001213
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001214 printf("AUD_HDMIW_INFOFR_B HDMI audio Infoframe:\n\t");
1215 dword = INREG(AUD_CNTL_ST_B);
1216 dword &= ~BITMASK(20, 18);
1217 dword &= ~BITMASK(3, 0);
1218 OUTREG(AUD_CNTL_ST_B, dword);
1219 for (i = 0; i < 8; i++)
1220 printf("%08x ", htonl(INREG(AUD_HDMIW_INFOFR_B)));
1221 printf("\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +08001222
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001223 printf("AUD_HDMIW_INFOFR_C HDMI audio Infoframe:\n\t");
1224 dword = INREG(AUD_CNTL_ST_C);
1225 dword &= ~BITMASK(20, 18);
1226 dword &= ~BITMASK(3, 0);
1227 OUTREG(AUD_CNTL_ST_C, dword);
1228 for (i = 0; i < 8; i++)
1229 printf("%08x ", htonl(INREG(AUD_HDMIW_INFOFR_C)));
1230 printf("\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +08001231
1232}
1233
Mengdong Lin86d15e02014-03-03 13:52:06 -05001234/* Audio config registers of Ironlake */
Wang Xingchaoc4077222012-08-15 16:13:38 +08001235#undef AUD_CONFIG_A
Mengdong Lin86d15e02014-03-03 13:52:06 -05001236#undef AUD_CONFIG_B
Wang Xingchaoc4077222012-08-15 16:13:38 +08001237#undef AUD_MISC_CTRL_A
Mengdong Lin86d15e02014-03-03 13:52:06 -05001238#undef AUD_MISC_CTRL_B
Wang Xingchaoc4077222012-08-15 16:13:38 +08001239#undef AUD_VID_DID
1240#undef AUD_RID
1241#undef AUD_CTS_ENABLE_A
Mengdong Lin86d15e02014-03-03 13:52:06 -05001242#undef AUD_CTS_ENABLE_B
Wang Xingchaoc4077222012-08-15 16:13:38 +08001243#undef AUD_PWRST
1244#undef AUD_HDMIW_HDMIEDID_A
Mengdong Lin86d15e02014-03-03 13:52:06 -05001245#undef AUD_HDMIW_HDMIEDID_B
Wang Xingchaoc4077222012-08-15 16:13:38 +08001246#undef AUD_HDMIW_INFOFR_A
Mengdong Lin86d15e02014-03-03 13:52:06 -05001247#undef AUD_HDMIW_INFOFR_B
Wang Xingchaoc4077222012-08-15 16:13:38 +08001248#undef AUD_PORT_EN_HD_CFG
1249#undef AUD_OUT_DIG_CNVT_A
Mengdong Lin86d15e02014-03-03 13:52:06 -05001250#undef AUD_OUT_DIG_CNVT_B
Wang Xingchaoc4077222012-08-15 16:13:38 +08001251#undef AUD_OUT_STR_DESC_A
Mengdong Lin86d15e02014-03-03 13:52:06 -05001252#undef AUD_OUT_STR_DESC_B
Wang Xingchaoc4077222012-08-15 16:13:38 +08001253#undef AUD_OUT_CH_STR
1254#undef AUD_PINW_CONNLNG_LIST
Mengdong Lindeba8682013-09-09 15:38:40 -04001255#undef AUD_PINW_CONNLNG_SEL
Wang Xingchaoc4077222012-08-15 16:13:38 +08001256#undef AUD_CNTL_ST_A
Wang Xingchaoc4077222012-08-15 16:13:38 +08001257#undef AUD_CNTL_ST_B
Mengdong Lin86d15e02014-03-03 13:52:06 -05001258#undef AUD_CNTL_ST2
1259#undef AUD_HDMIW_STATUS
Wang Xingchaoc4077222012-08-15 16:13:38 +08001260
Mengdong Lin86d15e02014-03-03 13:52:06 -05001261#define PIPE_OFS 0x100
Wang Xingchaoc4077222012-08-15 16:13:38 +08001262
Mengdong Lin86d15e02014-03-03 13:52:06 -05001263#define AUD_CONFIG_A 0x0
1264#define AUD_CONFIG_B (AUD_CONFIG_A + PIPE_OFS)
1265#define AUD_MISC_CTRL_A 0x010
1266#define AUD_MISC_CTRL_B (AUD_MISC_CTRL_A + PIPE_OFS)
1267#define AUD_VID_DID 0x020
1268#define AUD_RID 0x024
1269#define AUD_CTS_ENABLE_A 0x028
1270#define AUD_CTS_ENABLE_B (AUD_CTS_ENABLE_A + PIPE_OFS)
1271#define AUD_PWRST 0x04C
1272#define AUD_HDMIW_HDMIEDID_A 0x050
1273#define AUD_HDMIW_HDMIEDID_B (AUD_HDMIW_HDMIEDID_A + PIPE_OFS)
1274#define AUD_HDMIW_INFOFR_A 0x054
1275#define AUD_HDMIW_INFOFR_B (AUD_HDMIW_INFOFR_A + PIPE_OFS)
1276#define AUD_PORT_EN_HD_CFG 0x07c
1277#define AUD_OUT_DIG_CNVT_A 0x080
1278#define AUD_OUT_DIG_CNVT_B (AUD_OUT_DIG_CNVT_A + PIPE_OFS)
1279#define AUD_OUT_STR_DESC_A 0x084
1280#define AUD_OUT_STR_DESC_B (AUD_OUT_STR_DESC_A + PIPE_OFS)
1281#define AUD_OUT_CH_STR 0x088
1282#define AUD_PINW_CONNLNG_LIST 0x0a8
1283#define AUD_PINW_CONNLNG_SEL 0x0aC
1284#define AUD_CNTL_ST_A 0x0b4
1285#define AUD_CNTL_ST_B (AUD_CNTL_ST_A + PIPE_OFS)
1286#define AUD_CNTL_ST2 0x0c0
1287#define AUD_HDMIW_STATUS 0x0d4
Wang Xingchaoc4077222012-08-15 16:13:38 +08001288
Mengdong Lin86d15e02014-03-03 13:52:06 -05001289/* Audio config registers of Haswell+ */
1290#define AUD_TCA_CONFIG AUD_CONFIG_A
1291#define AUD_TCB_CONFIG (AUD_TCA_CONFIG + PIPE_OFS)
1292#define AUD_TCC_CONFIG (AUD_TCA_CONFIG + PIPE_OFS * 2)
1293#define AUD_C1_MISC_CTRL AUD_MISC_CTRL_A
1294#define AUD_C2_MISC_CTRL (AUD_MISC_CTRL_A + PIPE_OFS)
1295#define AUD_C3_MISC_CTRL (AUD_MISC_CTRL_A + PIPE_OFS * 2)
1296#define AUD_TCA_M_CTS_ENABLE AUD_CTS_ENABLE_A
1297#define AUD_TCB_M_CTS_ENABLE (AUD_TCA_M_CTS_ENABLE + PIPE_OFS)
1298#define AUD_TCC_M_CTS_ENABLE (AUD_TCA_M_CTS_ENABLE + PIPE_OFS * 2)
1299#define AUD_TCA_EDID_DATA AUD_HDMIW_HDMIEDID_A
1300#define AUD_TCB_EDID_DATA (AUD_TCA_EDID_DATA + PIPE_OFS)
1301#define AUD_TCC_EDID_DATA (AUD_TCA_EDID_DATA + PIPE_OFS * 2)
1302#define AUD_TCA_INFOFR AUD_HDMIW_INFOFR_A
1303#define AUD_TCB_INFOFR (AUD_TCA_INFOFR + PIPE_OFS)
1304#define AUD_TCC_INFOFR (AUD_TCA_INFOFR + PIPE_OFS * 2)
1305#define AUD_PIPE_CONV_CFG AUD_PORT_EN_HD_CFG
1306#define AUD_C1_DIG_CNVT AUD_OUT_DIG_CNVT_A
1307#define AUD_C2_DIG_CNVT (AUD_C1_DIG_CNVT + PIPE_OFS)
1308#define AUD_C3_DIG_CNVT (AUD_C1_DIG_CNVT + PIPE_OFS * 2)
1309#define AUD_C1_STR_DESC AUD_OUT_STR_DESC_A
1310#define AUD_C2_STR_DESC (AUD_C1_STR_DESC + PIPE_OFS)
1311#define AUD_C3_STR_DESC (AUD_C1_STR_DESC + PIPE_OFS * 2)
1312#define AUD_OUT_CHAN_MAP AUD_OUT_CH_STR
1313#define AUD_TCA_PIN_PIPE_CONN_ENTRY_LNGTH AUD_PINW_CONNLNG_LIST
1314#define AUD_TCB_PIN_PIPE_CONN_ENTRY_LNGTH (AUD_TCA_PIN_PIPE_CONN_ENTRY_LNGTH + PIPE_OFS)
1315#define AUD_TCC_PIN_PIPE_CONN_ENTRY_LNGTH (AUD_TCA_PIN_PIPE_CONN_ENTRY_LNGTH + PIPE_OFS * 2)
1316#define AUD_PIPE_CONN_SEL_CTRL AUD_PINW_CONNLNG_SEL
1317#define AUD_TCA_DIP_ELD_CTRL_ST AUD_CNTL_ST_A
1318#define AUD_TCB_DIP_ELD_CTRL_ST (AUD_TCA_DIP_ELD_CTRL_ST + PIPE_OFS)
1319#define AUD_TCC_DIP_ELD_CTRL_ST (AUD_TCA_DIP_ELD_CTRL_ST + PIPE_OFS * 2)
1320#define AUD_PIN_ELD_CP_VLD AUD_CNTL_ST2
1321#define AUD_HDMI_FIFO_STATUS AUD_HDMIW_STATUS
1322#define AUD_ICOI 0xf00
1323#define AUD_IRII 0xf04
1324#define AUD_ICS 0xf08
1325#define AUD_CHICKENBIT_REG 0xf10
1326#define AUD_DP_DIP_STATUS 0xf20
1327#define AUD_TCA_M_CTS 0xf44
1328#define AUD_TCB_M_CTS 0xf54
1329#define AUD_TCC_M_CTS 0xf64
Wang Xingchaoc4077222012-08-15 16:13:38 +08001330
Mengdong Lin86d15e02014-03-03 13:52:06 -05001331/* Common functions to dump audio registers */
Mengdong Lindeba8682013-09-09 15:38:40 -04001332#define MAX_PREFIX_SIZE 128
1333
Mengdong Lin86d15e02014-03-03 13:52:06 -05001334static void dump_aud_config(int index)
Mengdong Lindeba8682013-09-09 15:38:40 -04001335{
1336 uint32_t dword;
1337 char prefix[MAX_PREFIX_SIZE];
1338
Mengdong Lin86d15e02014-03-03 13:52:06 -05001339 if (!IS_HASWELL_PLUS(devid)) {
1340 dword = INREG(aud_reg_base + AUD_CONFIG_A + (index - PIPE_A) * 0x100);
1341 sprintf(prefix, "AUD_CONFIG_%c ", 'A' + index - PIPE_A);
1342 } else {
1343 dword = INREG(aud_reg_base + AUD_TCA_CONFIG + (index - TRANSCODER_A) * 0x100);
1344 sprintf(prefix, "AUD_TC%c_CONFIG", 'A' + index - TRANSCODER_A);
1345 }
Mengdong Lindeba8682013-09-09 15:38:40 -04001346
Mengdong Linfa8c7502014-03-04 10:13:09 -05001347 printf("%s Disable_NCTS\t\t\t\t%lu\n", prefix, BIT(dword, 3));
1348 printf("%s Lower_N_value\t\t\t\t0x%03lx\n", prefix, BITS(dword, 15, 4));
Mengdong Lindeba8682013-09-09 15:38:40 -04001349 printf("%s Pixel_Clock_HDMI\t\t\t[0x%lx] %s\n", prefix, BITS(dword, 19, 16),
1350 OPNAME(pixel_clock, BITS(dword, 19, 16)));
Mengdong Linfa8c7502014-03-04 10:13:09 -05001351 printf("%s Upper_N_value\t\t\t\t0x%02lx\n", prefix, BITS(dword, 27, 20));
1352 printf("%s N_programming_enable\t\t\t%lu\n", prefix, BIT(dword, 28));
1353 printf("%s N_index_value\t\t\t\t[0x%lx] %s\n", prefix, BIT(dword, 29),
Mengdong Lindeba8682013-09-09 15:38:40 -04001354 OPNAME(n_index_value, BIT(dword, 29)));
1355}
1356
Mengdong Lin86d15e02014-03-03 13:52:06 -05001357static void dump_aud_misc_control(int index)
Mengdong Lindeba8682013-09-09 15:38:40 -04001358{
1359 uint32_t dword;
1360 char prefix[MAX_PREFIX_SIZE];
1361
Mengdong Lin86d15e02014-03-03 13:52:06 -05001362 if (!IS_HASWELL_PLUS(devid)) {
1363 dword = INREG(aud_reg_base + AUD_MISC_CTRL_A + (index - PIPE_A) * 0x100);
1364 sprintf(prefix, "AUD_MISC_CTRL_%c ", 'A' + index - PIPE_A);
1365 } else {
1366 dword = INREG(aud_reg_base + AUD_C1_MISC_CTRL + (index - CONVERTER_1) * 0x100);
1367 sprintf(prefix, "AUD_C%c_MISC_CTRL", '1' + index - CONVERTER_1);
1368 }
Mengdong Lindeba8682013-09-09 15:38:40 -04001369
Mengdong Linfa8c7502014-03-04 10:13:09 -05001370 printf("%s Pro_Allowed\t\t\t\t%lu\n", prefix, BIT(dword, 1));
Mengdong Lindeba8682013-09-09 15:38:40 -04001371 printf("%s Sample_Fabrication_EN_bit\t\t%lu\n", prefix, BIT(dword, 2));
Mengdong Linfa8c7502014-03-04 10:13:09 -05001372 printf("%s Output_Delay\t\t\t\t%lu\n", prefix, BITS(dword, 7, 4));
1373 printf("%s Sample_present_Disable\t\t%lu\n", prefix, BIT(dword, 8));
Mengdong Lindeba8682013-09-09 15:38:40 -04001374}
1375
1376static void dump_aud_vendor_device_id(void)
1377{
1378 uint32_t dword;
1379
Mengdong Lin86d15e02014-03-03 13:52:06 -05001380 dword = INREG(aud_reg_base + AUD_VID_DID);
Mengdong Lindeba8682013-09-09 15:38:40 -04001381 printf("AUD_VID_DID device id\t\t\t\t\t0x%lx\n", BITS(dword, 15, 0));
1382 printf("AUD_VID_DID vendor id\t\t\t\t\t0x%lx\n", BITS(dword, 31, 16));
1383}
1384
1385static void dump_aud_revision_id(void)
1386{
1387 uint32_t dword;
1388
Mengdong Lin86d15e02014-03-03 13:52:06 -05001389 dword = INREG(aud_reg_base + AUD_RID);
Mengdong Lindeba8682013-09-09 15:38:40 -04001390 printf("AUD_RID Stepping_Id\t\t\t\t\t0x%lx\n", BITS(dword, 7, 0));
1391 printf("AUD_RID Revision_Id\t\t\t\t\t0x%lx\n", BITS(dword, 15, 8));
1392 printf("AUD_RID Minor_Revision\t\t\t\t\t0x%lx\n", BITS(dword, 19, 16));
1393 printf("AUD_RID Major_Revision\t\t\t\t\t0x%lx\n", BITS(dword, 23, 20));
1394}
1395
Mengdong Lin86d15e02014-03-03 13:52:06 -05001396static void dump_aud_m_cts_enable(int index)
Mengdong Lindeba8682013-09-09 15:38:40 -04001397{
1398 uint32_t dword;
1399 char prefix[MAX_PREFIX_SIZE];
1400
Mengdong Lin86d15e02014-03-03 13:52:06 -05001401 if (!IS_HASWELL_PLUS(devid)) {
1402 dword = INREG(aud_reg_base + AUD_CTS_ENABLE_A + (index - PIPE_A) * 0x100);
1403 sprintf(prefix, "AUD_CTS_ENABLE_%c ", 'A' + index - PIPE_A);
1404 } else {
1405 dword = INREG(aud_reg_base + AUD_TCA_M_CTS_ENABLE + (index - TRANSCODER_A) * 0x100);
1406 sprintf(prefix, "AUD_TC%c_M_CTS_ENABLE", 'A' + index - TRANSCODER_A);
1407 }
Mengdong Lindeba8682013-09-09 15:38:40 -04001408
Mengdong Linfa8c7502014-03-04 10:13:09 -05001409 printf("%s CTS_programming\t\t\t%#lx\n", prefix, BITS(dword, 19, 0));
Mengdong Lindeba8682013-09-09 15:38:40 -04001410 printf("%s Enable_CTS_or_M_programming\t%lu\n", prefix, BIT(dword, 20));
Mengdong Linfa8c7502014-03-04 10:13:09 -05001411 printf("%s CTS_M value Index\t\t\t%s\n", prefix, BIT(dword, 21) ? "CTS" : "M");
Mengdong Lindeba8682013-09-09 15:38:40 -04001412}
1413
1414static void dump_aud_power_state(void)
1415{
1416 uint32_t dword;
Mengdong Lin86d15e02014-03-03 13:52:06 -05001417 int num_pipes;
Mengdong Lindeba8682013-09-09 15:38:40 -04001418
Mengdong Lin86d15e02014-03-03 13:52:06 -05001419 dword = INREG(aud_reg_base + AUD_PWRST);
Mengdong Linfa8c7502014-03-04 10:13:09 -05001420 printf("AUD_PWRST PinB_Widget_Power_State_Set \t%s\n", power_state[BITS(dword, 1, 0)]);
1421 printf("AUD_PWRST PinB_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 3, 2)]);
1422 printf("AUD_PWRST PinC_Widget_Power_State_Set \t%s\n", power_state[BITS(dword, 5, 4)]);
1423 printf("AUD_PWRST PinC_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 7, 6)]);
1424 printf("AUD_PWRST PinD_Widget_Power_State_Set \t%s\n", power_state[BITS(dword, 9, 8)]);
1425 printf("AUD_PWRST PinD_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 11, 10)]);
Mengdong Lin86d15e02014-03-03 13:52:06 -05001426
1427 if (!IS_HASWELL_PLUS(devid)) {
1428 printf("AUD_PWRST ConvertorA_Widget_Power_State_Requsted \t%s\n", power_state[BITS(dword, 13, 12)]);
1429 printf("AUD_PWRST ConvertorA_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 15, 14)]);
1430 printf("AUD_PWRST ConvertorB_Widget_Power_State_Requested \t%s\n", power_state[BITS(dword, 17, 16)]);
1431 printf("AUD_PWRST ConvertorB_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 19, 18)]);
1432 } else {
1433 printf("AUD_PWRST Convertor1_Widget_Power_State_Requsted \t%s\n", power_state[BITS(dword, 13, 12)]);
1434 printf("AUD_PWRST Convertor1_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 15, 14)]);
1435 printf("AUD_PWRST Convertor2_Widget_Power_State_Requested \t%s\n", power_state[BITS(dword, 17, 16)]);
1436 printf("AUD_PWRST Convertor2_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 19, 18)]);
1437 }
1438
1439 num_pipes = get_num_pipes();
1440 if (num_pipes == 2) {
1441 printf("AUD_PWRST Func_Grp_Dev_PwrSt_Set \t%s\n", power_state[BITS(dword, 21, 20)]);
1442 printf("AUD_PWRST Func_Grp_Dev_PwrSt_Curr \t%s\n", power_state[BITS(dword, 23, 22)]);
1443 } else { /* 3 pipes */
1444 if (!IS_HASWELL_PLUS(devid)) {
1445 printf("AUD_PWRST ConvertorC_Widget_Power_State_Requested \t%s\n", power_state[BITS(dword, 21, 20)]);
1446 printf("AUD_PWRST ConvertorC_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 23, 22)]);
1447 } else {
1448 printf("AUD_PWRST Convertor3_Widget_Power_State_Requested \t%s\n", power_state[BITS(dword, 21, 20)]);
1449 printf("AUD_PWRST Convertor3_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 23, 22)]);
1450 }
1451 printf("AUD_PWRST Func_Grp_Dev_PwrSt_Set \t%s\n", power_state[BITS(dword, 25, 24)]);
1452 printf("AUD_PWRST Func_Grp_Dev_PwrSt_Curr \t%s\n", power_state[BITS(dword, 27, 26)]);
1453 }
Mengdong Lindeba8682013-09-09 15:38:40 -04001454}
1455
Mengdong Lin86d15e02014-03-03 13:52:06 -05001456static void dump_aud_edid_data(int index)
Mengdong Lindeba8682013-09-09 15:38:40 -04001457{
1458 uint32_t dword;
1459 int i;
Mengdong Lin86d15e02014-03-03 13:52:06 -05001460 int offset;
1461 int aud_ctrl_st, edid_data;
Mengdong Lindeba8682013-09-09 15:38:40 -04001462
Mengdong Lin86d15e02014-03-03 13:52:06 -05001463 if (IS_HASWELL_PLUS(devid)) {
1464 offset = (index - TRANSCODER_A) * 0x100;
1465 aud_ctrl_st = aud_reg_base + AUD_TCA_DIP_ELD_CTRL_ST + offset;
1466 edid_data = aud_reg_base + AUD_TCA_EDID_DATA + offset;
1467 printf("AUD_TC%c_EDID_DATA ELD:\n\t", 'A' + index - TRANSCODER_A);
1468 } else {
1469 offset = (index - PIPE_A) * 0x100;
1470 aud_ctrl_st = aud_reg_base + AUD_CNTL_ST_A + offset;
1471 edid_data = aud_reg_base + AUD_HDMIW_HDMIEDID_A + offset;
1472 printf("AUD_HDMIW_HDMIEDID_%c HDMI ELD:\n\t", 'A' + index - PIPE_A);
1473 }
1474
1475 dword = INREG(aud_ctrl_st);
Mengdong Lindeba8682013-09-09 15:38:40 -04001476 dword &= ~BITMASK(9, 5);
Mengdong Lin86d15e02014-03-03 13:52:06 -05001477 OUTREG(aud_ctrl_st, dword);
Mengdong Lindeba8682013-09-09 15:38:40 -04001478 for (i = 0; i < BITS(dword, 14, 10) / 4; i++)
Mengdong Lin86d15e02014-03-03 13:52:06 -05001479 printf("%08x ", htonl(INREG(edid_data)));
Mengdong Lindeba8682013-09-09 15:38:40 -04001480 printf("\n");
1481}
1482
Mengdong Lin86d15e02014-03-03 13:52:06 -05001483static void dump_aud_infoframe(int index)
Mengdong Lindeba8682013-09-09 15:38:40 -04001484{
1485 uint32_t dword;
1486 int i;
Mengdong Lin86d15e02014-03-03 13:52:06 -05001487 int offset;
1488 int aud_ctrl_st, info_frm;
Mengdong Lindeba8682013-09-09 15:38:40 -04001489
Mengdong Lin86d15e02014-03-03 13:52:06 -05001490 if (IS_HASWELL_PLUS(devid)) {
1491 offset = (index - TRANSCODER_A) * 0x100;
1492 aud_ctrl_st = aud_reg_base + AUD_TCA_DIP_ELD_CTRL_ST + offset;
1493 info_frm = aud_reg_base + AUD_TCA_INFOFR + offset;
1494 printf("AUD_TC%c_INFOFR audio Infoframe:\n\t", 'A' + index - TRANSCODER_A);
1495 } else {
1496 offset = (index - PIPE_A) * 0x100;
1497 aud_ctrl_st = aud_reg_base + AUD_CNTL_ST_A + offset;
1498 info_frm = aud_reg_base + AUD_HDMIW_INFOFR_A + offset;
1499 printf("AUD_HDMIW_INFOFR_%c HDMI audio Infoframe:\n\t", 'A' + index - PIPE_A);
1500 }
1501
1502 dword = INREG(aud_ctrl_st);
Mengdong Lindeba8682013-09-09 15:38:40 -04001503 dword &= ~BITMASK(20, 18);
1504 dword &= ~BITMASK(3, 0);
Mengdong Lin86d15e02014-03-03 13:52:06 -05001505 OUTREG(aud_ctrl_st, dword);
Mengdong Lindeba8682013-09-09 15:38:40 -04001506 for (i = 0; i < 8; i++)
Mengdong Lin86d15e02014-03-03 13:52:06 -05001507 printf("%08x ", htonl(INREG(info_frm)));
Mengdong Lindeba8682013-09-09 15:38:40 -04001508 printf("\n");
1509}
1510
Mengdong Lin86d15e02014-03-03 13:52:06 -05001511static void dump_aud_port_en_hd_cfg(void)
1512{
1513 uint32_t dword;
1514 int num_pipes = get_num_pipes();
1515
1516 dword = INREG(aud_reg_base + AUD_PORT_EN_HD_CFG);
1517 if (num_pipes == 2) {
1518 printf("AUD_PORT_EN_HD_CFG Convertor_A_Digen\t\t\t%lu\n", BIT(dword, 0));
1519 printf("AUD_PORT_EN_HD_CFG Convertor_B_Digen\t\t\t%lu\n", BIT(dword, 1));
1520 printf("AUD_PORT_EN_HD_CFG Convertor_A_Stream_ID\t\t%lu\n", BITS(dword, 7, 4));
1521 printf("AUD_PORT_EN_HD_CFG Convertor_B_Stream_ID\t\t%lu\n", BITS(dword, 11, 8));
1522
1523 printf("AUD_PORT_EN_HD_CFG Port_B_Out_Enable\t\t\t%lu\n", BIT(dword, 12));
1524 printf("AUD_PORT_EN_HD_CFG Port_C_Out_Enable\t\t\t%lu\n", BIT(dword, 13));
1525 printf("AUD_PORT_EN_HD_CFG Port_D_Out_Enable\t\t\t%lu\n", BIT(dword, 14));
1526 printf("AUD_PORT_EN_HD_CFG Port_B_Amp_Mute_Status\t\t%lu\n", BIT(dword, 16));
1527 printf("AUD_PORT_EN_HD_CFG Port_C_Amp_Mute_Status\t\t%lu\n", BIT(dword, 17));
1528 printf("AUD_PORT_EN_HD_CFG Port_D_Amp_Mute_Status\t\t%lu\n", BIT(dword, 18));
1529 } else { /* three pipes */
1530 printf("AUD_PORT_EN_HD_CFG Convertor_A_Digen\t\t\t%lu\n", BIT(dword, 0));
1531 printf("AUD_PORT_EN_HD_CFG Convertor_B_Digen\t\t\t%lu\n", BIT(dword, 1));
1532 printf("AUD_PORT_EN_HD_CFG Convertor_C_Digen\t\t\t%lu\n", BIT(dword, 2));
1533 printf("AUD_PORT_EN_HD_CFG Convertor_A_Stream_ID\t\t%lu\n", BITS(dword, 7, 4));
1534 printf("AUD_PORT_EN_HD_CFG Convertor_B_Stream_ID\t\t%lu\n", BITS(dword, 11, 8));
1535 printf("AUD_PORT_EN_HD_CFG Convertor_C_Stream_ID\t\t%lu\n", BITS(dword, 15, 12));
1536
1537 printf("AUD_PORT_EN_HD_CFG Port_B_Out_Enable\t\t\t%lu\n", BIT(dword, 16));
1538 printf("AUD_PORT_EN_HD_CFG Port_C_Out_Enable\t\t\t%lu\n", BIT(dword, 17));
1539 printf("AUD_PORT_EN_HD_CFG Port_D_Out_Enable\t\t\t%lu\n", BIT(dword, 18));
1540 printf("AUD_PORT_EN_HD_CFG Port_B_Amp_Mute_Status\t\t%lu\n", BIT(dword, 20));
1541 printf("AUD_PORT_EN_HD_CFG Port_C_Amp_Mute_Status\t\t%lu\n", BIT(dword, 21));
1542 printf("AUD_PORT_EN_HD_CFG Port_D_Amp_Mute_Status\t\t%lu\n", BIT(dword, 22));
1543 }
1544}
1545
Mengdong Lindeba8682013-09-09 15:38:40 -04001546static void dump_aud_pipe_conv_cfg(void)
1547{
1548 uint32_t dword;
1549
Mengdong Lin86d15e02014-03-03 13:52:06 -05001550 dword = INREG(aud_reg_base + AUD_PIPE_CONV_CFG);
Mengdong Linfa8c7502014-03-04 10:13:09 -05001551 printf("AUD_PIPE_CONV_CFG Convertor_1_Digen\t\t\t%lu\n", BIT(dword, 0));
1552 printf("AUD_PIPE_CONV_CFG Convertor_2_Digen\t\t\t%lu\n", BIT(dword, 1));
1553 printf("AUD_PIPE_CONV_CFG Convertor_3_Digen\t\t\t%lu\n", BIT(dword, 2));
1554 printf("AUD_PIPE_CONV_CFG Convertor_1_Stream_ID\t\t%lu\n", BITS(dword, 7, 4));
1555 printf("AUD_PIPE_CONV_CFG Convertor_2_Stream_ID\t\t%lu\n", BITS(dword, 11, 8));
1556 printf("AUD_PIPE_CONV_CFG Convertor_3_Stream_ID\t\t%lu\n", BITS(dword, 15, 12));
1557
1558 printf("AUD_PIPE_CONV_CFG Port_B_Out_Enable\t\t\t%lu\n", BIT(dword, 16));
1559 printf("AUD_PIPE_CONV_CFG Port_C_Out_Enable\t\t\t%lu\n", BIT(dword, 17));
1560 printf("AUD_PIPE_CONV_CFG Port_D_Out_Enable\t\t\t%lu\n", BIT(dword, 18));
Mengdong Lindeba8682013-09-09 15:38:40 -04001561 printf("AUD_PIPE_CONV_CFG Port_B_Amp_Mute_Status\t\t%lu\n", BIT(dword, 20));
1562 printf("AUD_PIPE_CONV_CFG Port_C_Amp_Mute_Status\t\t%lu\n", BIT(dword, 21));
1563 printf("AUD_PIPE_CONV_CFG Port_D_Amp_Mute_Status\t\t%lu\n", BIT(dword, 22));
1564}
1565
Mengdong Lin86d15e02014-03-03 13:52:06 -05001566static void dump_aud_dig_cnvt(int index)
Mengdong Lindeba8682013-09-09 15:38:40 -04001567{
1568 uint32_t dword;
1569 char prefix[MAX_PREFIX_SIZE];
1570
Mengdong Lin86d15e02014-03-03 13:52:06 -05001571 if (!IS_HASWELL_PLUS(devid)) {
1572 dword = INREG(aud_reg_base + AUD_OUT_DIG_CNVT_A + (index - PIPE_A) * 0x100);
1573 sprintf(prefix, "AUD_OUT_DIG_CNVT_%c", 'A' + index - PIPE_A);
1574 } else {
1575 dword = INREG(aud_reg_base + AUD_C1_DIG_CNVT + (index - CONVERTER_1) * 0x100);
1576 sprintf(prefix, "AUD_C%c_DIG_CNVT ", '1' + index - CONVERTER_1);
1577 }
Mengdong Lindeba8682013-09-09 15:38:40 -04001578
Mengdong Linfa8c7502014-03-04 10:13:09 -05001579 printf("%s V\t\t\t\t\t%lu\n", prefix, BIT(dword, 1));
1580 printf("%s VCFG\t\t\t\t%lu\n", prefix, BIT(dword, 2));
1581 printf("%s PRE\t\t\t\t\t%lu\n", prefix, BIT(dword, 3));
1582 printf("%s Copy\t\t\t\t%lu\n", prefix, BIT(dword, 4));
1583 printf("%s NonAudio\t\t\t\t%lu\n", prefix, BIT(dword, 5));
1584 printf("%s PRO\t\t\t\t\t%lu\n", prefix, BIT(dword, 6));
1585 printf("%s Level\t\t\t\t%lu\n", prefix, BIT(dword, 7));
1586 printf("%s Category_Code\t\t\t%lu\n", prefix, BITS(dword, 14, 8));
1587 printf("%s Lowest_Channel_Number\t\t%lu\n", prefix, BITS(dword, 19, 16));
1588 printf("%s Stream_ID\t\t\t\t%lu\n", prefix, BITS(dword, 23, 20));
Mengdong Lindeba8682013-09-09 15:38:40 -04001589}
1590
Mengdong Lin86d15e02014-03-03 13:52:06 -05001591static void dump_aud_str_desc(int index)
Mengdong Lindeba8682013-09-09 15:38:40 -04001592{
1593 uint32_t dword;
1594 char prefix[MAX_PREFIX_SIZE];
1595 uint32_t rate;
1596
Mengdong Lin86d15e02014-03-03 13:52:06 -05001597 if (!IS_HASWELL_PLUS(devid)) {
1598 dword = INREG(aud_reg_base + AUD_OUT_STR_DESC_A + (index - PIPE_A) * 0x100);
1599 sprintf(prefix, "AUD_OUT_STR_DESC_%c", 'A' + index - PIPE_A);
1600 } else {
1601 dword = INREG(aud_reg_base + AUD_C1_STR_DESC + (index - CONVERTER_1) * 0x100);
1602 sprintf(prefix, "AUD_C%c_STR_DESC ", '1' + index - CONVERTER_1);
1603 }
Mengdong Lindeba8682013-09-09 15:38:40 -04001604
Mengdong Linfa8c7502014-03-04 10:13:09 -05001605 printf("%s Number_of_Channels_in_a_Stream\t%lu\n", prefix, BITS(dword, 3, 0) + 1);
1606 printf("%s Bits_per_Sample\t\t\t[%#lx] %s\n", prefix, BITS(dword, 6, 4),
Mengdong Lindeba8682013-09-09 15:38:40 -04001607 OPNAME(bits_per_sample, BITS(dword, 6, 4)));
1608
Mengdong Linfa8c7502014-03-04 10:13:09 -05001609 printf("%s Sample_Base_Rate_Divisor\t\t[%#lx] %s\n", prefix, BITS(dword, 10, 8),
Mengdong Lindeba8682013-09-09 15:38:40 -04001610 OPNAME(sample_base_rate_divisor, BITS(dword, 10, 8)));
Mengdong Linfa8c7502014-03-04 10:13:09 -05001611 printf("%s Sample_Base_Rate_Mult\t\t[%#lx] %s\n", prefix, BITS(dword, 13, 11),
Mengdong Lindeba8682013-09-09 15:38:40 -04001612 OPNAME(sample_base_rate_mult, BITS(dword, 13, 11)));
Mengdong Linfa8c7502014-03-04 10:13:09 -05001613 printf("%s Sample_Base_Rate\t\t\t[%#lx] %s\t", prefix, BIT(dword, 14),
Mengdong Lindeba8682013-09-09 15:38:40 -04001614 OPNAME(sample_base_rate, BIT(dword, 14)));
1615 rate = (BIT(dword, 14) ? 44100 : 48000) * (BITS(dword, 13, 11) + 1)
1616 /(BITS(dword, 10, 8) + 1);
1617 printf("=> Sample Rate %d Hz\n", rate);
1618
Mengdong Linfa8c7502014-03-04 10:13:09 -05001619 printf("%s Convertor_Channel_Count\t\t%lu\n", prefix, BITS(dword, 20, 16) + 1);
Mengdong Lin86d15e02014-03-03 13:52:06 -05001620
1621 if (!IS_HASWELL_PLUS(devid))
1622 printf("%s HBR_enable\t\t\t\t%lu\n", prefix, BITS(dword, 28, 27));
Mengdong Lindeba8682013-09-09 15:38:40 -04001623}
1624
Mengdong Lin86d15e02014-03-03 13:52:06 -05001625#define dump_aud_out_ch_str dump_aud_out_chan_map
Mengdong Lindeba8682013-09-09 15:38:40 -04001626static void dump_aud_out_chan_map(void)
1627{
1628 uint32_t dword;
1629 int i;
1630
1631 printf("AUD_OUT_CHAN_MAP Converter_Channel_MAP PORTB PORTC PORTD\n");
1632 for (i = 0; i < 8; i++) {
Mengdong Lin86d15e02014-03-03 13:52:06 -05001633 OUTREG(aud_reg_base + AUD_OUT_CHAN_MAP, i | (i << 8) | (i << 16));
1634 dword = INREG(aud_reg_base + AUD_OUT_CHAN_MAP);
Mengdong Lindeba8682013-09-09 15:38:40 -04001635 printf("\t\t\t\t%lu\t%lu\t%lu\t%lu\n",
1636 1 + BITS(dword, 3, 0),
1637 1 + BITS(dword, 7, 4),
1638 1 + BITS(dword, 15, 12),
1639 1 + BITS(dword, 23, 20));
1640 }
1641}
1642
Mengdong Lin86d15e02014-03-03 13:52:06 -05001643static void dump_aud_connect_list(void)
Mengdong Lindeba8682013-09-09 15:38:40 -04001644{
1645 uint32_t dword;
1646 char prefix[MAX_PREFIX_SIZE];
1647
Mengdong Lin86d15e02014-03-03 13:52:06 -05001648 dword = INREG(aud_reg_base + AUD_PINW_CONNLNG_LIST);
1649 sprintf(prefix, "AUD_PINW_CONNLNG_LIST");
Mengdong Lindeba8682013-09-09 15:38:40 -04001650
Mengdong Linfa8c7502014-03-04 10:13:09 -05001651 printf("%s Connect_List_Length\t\t%lu\n", prefix, BITS(dword, 6, 0));
1652 printf("%s Form \t\t\t\t[%#lx] %s\n", prefix, BIT(dword, 7),
Mengdong Lindeba8682013-09-09 15:38:40 -04001653 OPNAME(connect_list_form, BIT(dword, 7)));
Mengdong Lin86d15e02014-03-03 13:52:06 -05001654 printf("%s Connect_List_Entry\t\t%lu, %lu\n", prefix, BITS(dword, 15, 8), BITS(dword, 23, 16));
Mengdong Lindeba8682013-09-09 15:38:40 -04001655}
1656
Mengdong Lin86d15e02014-03-03 13:52:06 -05001657static void dump_aud_connect_select(void)
Mengdong Lindeba8682013-09-09 15:38:40 -04001658{
1659 uint32_t dword;
Mengdong Lin86d15e02014-03-03 13:52:06 -05001660 char prefix[MAX_PREFIX_SIZE];
Mengdong Lindeba8682013-09-09 15:38:40 -04001661
Mengdong Lin86d15e02014-03-03 13:52:06 -05001662 if (IS_HASWELL_PLUS(devid)) {
1663 dword = INREG(aud_reg_base + AUD_PIPE_CONN_SEL_CTRL);
1664 sprintf(prefix, "AUD_PIPE_CONN_SEL_CTRL");
1665
1666 } else {
1667 dword = INREG(aud_reg_base + AUD_PINW_CONNLNG_SEL);
1668 sprintf(prefix, "AUD_PINW_CONNLNG_SEL ");
1669 }
1670
1671 printf("%s Connection_select_Port_B\t%#lx\n", prefix, BITS(dword, 7, 0));
1672 printf("%s Connection_select_Port_C\t%#lx\n", prefix, BITS(dword, 15, 8));
1673 printf("%s Connection_select_Port_D\t%#lx\n", prefix, BITS(dword, 23, 16));
Mengdong Lindeba8682013-09-09 15:38:40 -04001674}
1675
Mengdong Lin86d15e02014-03-03 13:52:06 -05001676static void dump_aud_ctrl_state(int index)
Mengdong Lindeba8682013-09-09 15:38:40 -04001677{
1678 uint32_t dword;
Mengdong Lin86d15e02014-03-03 13:52:06 -05001679 int offset;
Mengdong Lindeba8682013-09-09 15:38:40 -04001680
Mengdong Lin86d15e02014-03-03 13:52:06 -05001681 if (IS_HASWELL_PLUS(devid)) {
1682 offset = (index - TRANSCODER_A) * 0x100;
1683 dword = INREG(aud_reg_base + AUD_TCA_DIP_ELD_CTRL_ST + offset);
1684 printf("Audio DIP and ELD control state for Transcoder %c\n", 'A' + index - TRANSCODER_A);
1685 } else {
1686 offset = (index - PIPE_A) * 0x100;
1687 dword = INREG(aud_reg_base + AUD_CNTL_ST_A + offset);
1688 printf("Audio control state - Pipe %c\n", 'A' + index - PIPE_A);
1689 }
Mengdong Lindeba8682013-09-09 15:38:40 -04001690
Mengdong Linfa8c7502014-03-04 10:13:09 -05001691 printf("\tELD_ACK\t\t\t\t\t\t%lu\n", BIT(dword, 4));
1692 printf("\tELD_buffer_size\t\t\t\t\t%lu\n", BITS(dword, 14, 10));
1693 printf("\tDIP_transmission_frequency\t\t\t[0x%lx] %s\n", BITS(dword, 17, 16),
Mengdong Lindeba8682013-09-09 15:38:40 -04001694 dip_trans[BITS(dword, 17, 16)]);
Mengdong Linfa8c7502014-03-04 10:13:09 -05001695 printf("\tDIP Buffer Index \t\t\t\t[0x%lx] %s\n", BITS(dword, 20, 18),
Mengdong Lindeba8682013-09-09 15:38:40 -04001696 dip_index[BITS(dword, 20, 18)]);
1697 printf("\tAudio DIP type enable status\t\t\t[0x%04lx] %s, %s, %s\n", BITS(dword, 24, 21),
1698 dip_type[BIT(dword, 21)], dip_gen1_state[BIT(dword, 22)], dip_gen2_state[BIT(dword, 23)]);
Mengdong Linfa8c7502014-03-04 10:13:09 -05001699 printf("\tAudio DIP port select\t\t\t\t[0x%lx] %s\n", BITS(dword, 30, 29),
Mengdong Lindeba8682013-09-09 15:38:40 -04001700 dip_port[BITS(dword, 30, 29)]);
1701 printf("\n");
1702}
1703
Mengdong Lin86d15e02014-03-03 13:52:06 -05001704static void dump_aud_ctrl_state2(void)
1705{
1706 uint32_t dword;
1707
1708 dword = INREG(aud_reg_base + AUD_CNTL_ST2);
1709 printf("AUD_CNTL_ST2 ELD_validB\t\t\t\t%lu\n", BIT(dword, 0));
1710 printf("AUD_CNTL_ST2 CP_ReadyB\t\t\t\t\t%lu\n", BIT(dword, 1));
1711 printf("AUD_CNTL_ST2 ELD_validC\t\t\t\t%lu\n", BIT(dword, 4));
1712 printf("AUD_CNTL_ST2 CP_ReadyC\t\t\t\t\t%lu\n", BIT(dword, 5));
1713 printf("AUD_CNTL_ST2 ELD_validD\t\t\t\t%lu\n", BIT(dword, 8));
1714 printf("AUD_CNTL_ST2 CP_ReadyD\t\t\t\t\t%lu\n", BIT(dword, 9));
1715}
1716
1717/* for hsw+ */
Mengdong Lindeba8682013-09-09 15:38:40 -04001718static void dump_aud_eld_cp_vld(void)
1719{
1720 uint32_t dword;
1721
Mengdong Lin86d15e02014-03-03 13:52:06 -05001722 dword = INREG(aud_reg_base + AUD_PIN_ELD_CP_VLD);
Mengdong Lindeba8682013-09-09 15:38:40 -04001723 printf("AUD_PIN_ELD_CP_VLD Transcoder_A ELD_valid\t\t%lu\n", BIT(dword, 0));
1724 printf("AUD_PIN_ELD_CP_VLD Transcoder_A CP_Ready \t\t%lu\n", BIT(dword, 1));
1725 printf("AUD_PIN_ELD_CP_VLD Transcoder_A Out_enable\t\t%lu\n", BIT(dword, 2));
1726 printf("AUD_PIN_ELD_CP_VLD Transcoder_A Inactive\t\t%lu\n", BIT(dword, 3));
1727 printf("AUD_PIN_ELD_CP_VLD Transcoder_B ELD_valid\t\t%lu\n", BIT(dword, 4));
1728 printf("AUD_PIN_ELD_CP_VLD Transcoder_B CP_Ready\t\t%lu\n", BIT(dword, 5));
1729 printf("AUD_PIN_ELD_CP_VLD Transcoder_B OUT_enable\t\t%lu\n", BIT(dword, 6));
1730 printf("AUD_PIN_ELD_CP_VLD Transcoder_B Inactive\t\t%lu\n", BIT(dword, 7));
1731 printf("AUD_PIN_ELD_CP_VLD Transcoder_C ELD_valid\t\t%lu\n", BIT(dword, 8));
1732 printf("AUD_PIN_ELD_CP_VLD Transcoder_C CP_Ready\t\t%lu\n", BIT(dword, 9));
1733 printf("AUD_PIN_ELD_CP_VLD Transcoder_C OUT_enable\t\t%lu\n", BIT(dword, 10));
1734 printf("AUD_PIN_ELD_CP_VLD Transcoder_C Inactive\t\t%lu\n", BIT(dword, 11));
1735}
1736
Mengdong Lin86d15e02014-03-03 13:52:06 -05001737static void dump_aud_hdmi_status(void)
Mengdong Lindeba8682013-09-09 15:38:40 -04001738{
1739 uint32_t dword;
1740
Mengdong Lin86d15e02014-03-03 13:52:06 -05001741 dword = INREG(aud_reg_base + AUD_HDMIW_STATUS);
1742 printf("AUD_HDMIW_STATUS Function_Reset\t\t\t%lu\n", BIT(dword, 24));
1743 printf("AUD_HDMIW_STATUS BCLK/CDCLK_FIFO_Overrun\t\t%lu\n", BIT(dword, 25));
1744 printf("AUD_HDMIW_STATUS Conv_A_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n", BIT(dword, 28));
1745 printf("AUD_HDMIW_STATUS Conv_A_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 29));
1746 printf("AUD_HDMIW_STATUS Conv_B_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n", BIT(dword, 30));
1747 printf("AUD_HDMIW_STATUS Conv_B_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 31));
1748}
1749
1750/*
Mengdong Lin449509d2014-03-03 17:03:02 -05001751 * Display registers of Ironlake and Valleyview
Mengdong Lin86d15e02014-03-03 13:52:06 -05001752 */
1753#undef DP_CTL_B
1754#undef DP_CTL_C
1755#undef DP_CTL_D
1756
1757#define DP_CTL_B 0x4100
1758#define DP_CTL_C 0x4200
1759#define DP_CTL_D 0x4300
1760
Mengdong Lin449509d2014-03-03 17:03:02 -05001761/* ILK HDMI port ctrl */
Mengdong Lin86d15e02014-03-03 13:52:06 -05001762#define HDMI_CTL_B 0x1140
1763#define HDMI_CTL_C 0x1150
1764#define HDMI_CTL_D 0x1160
1765
Mengdong Lin449509d2014-03-03 17:03:02 -05001766/* VLV HDMI port ctrl */
1767#define SDVO_HDMI_CTL_B 0x1140
1768#define SDVO_HDMI_CTL_C 0x1160
1769
Mengdong Lin86d15e02014-03-03 13:52:06 -05001770static void dump_dp_port_ctrl(int port)
1771{
1772 uint32_t dword;
1773 int port_ctrl;
1774 char prefix[MAX_PREFIX_SIZE];
1775
1776 sprintf(prefix, "DP_%c", 'B' + port - PORT_B);
1777
1778 port_ctrl = disp_reg_base + DP_CTL_B + (port - PORT_B) * 0x100;
1779 dword = INREG(port_ctrl);
1780 printf("%s DisplayPort_Enable\t\t\t\t\t%lu\n", prefix, BIT(dword, 31));
1781 printf("%s Transcoder_Select\t\t\t\t\t%s\n", prefix, BIT(dword, 30) ? "Transcoder B" : "Transcoder A");
1782 printf("%s Port_Width_Selection\t\t\t\t[0x%lx] %s\n", prefix, BITS(dword, 21, 19),
1783 dp_port_width[BITS(dword, 21, 19)]);
1784 printf("%s Port_Detected\t\t\t\t\t%lu\n", prefix, BIT(dword, 2));
1785 printf("%s HDCP_Port_Select\t\t\t\t\t%lu\n", prefix, BIT(dword, 5));
1786 printf("%s Audio_Output_Enable\t\t\t\t%lu\n", prefix, BIT(dword, 6));
1787}
1788
1789static void dump_hdmi_port_ctrl(int port)
1790{
1791 uint32_t dword;
1792 int port_ctrl;
1793 char prefix[MAX_PREFIX_SIZE];
1794
Mengdong Lin449509d2014-03-03 17:03:02 -05001795 if (IS_VALLEYVIEW(devid)) {
1796 sprintf(prefix, "SDVO/HDMI%c", 'B' + port - PORT_B);
1797 port_ctrl = disp_reg_base + SDVO_HDMI_CTL_B + (port - PORT_B) * 0x20;
1798 } else {
1799 sprintf(prefix, "HDMI%c ", 'B' + port - PORT_B);
1800 port_ctrl = disp_reg_base + HDMI_CTL_B + (port - PORT_B) * 0x10;
1801 }
Mengdong Lin86d15e02014-03-03 13:52:06 -05001802
Mengdong Lin86d15e02014-03-03 13:52:06 -05001803 dword = INREG(port_ctrl);
1804 printf("%s HDMI_Enable\t\t\t\t\t%u\n", prefix, !!(dword & SDVO_ENABLE));
1805 printf("%s Transcoder_Select\t\t\t\t%s\n", prefix, BIT(dword, 30) ? "Transcoder B" : "Transcoder A");
1806 printf("%s HDCP_Port_Select\t\t\t\t%lu\n", prefix, BIT(dword, 5));
1807 if (port == PORT_B) /* TODO: check spec, not found in Ibx b-spec, and only for port B? */
1808 printf("%s SDVO Hot Plug Interrupt Detect Enable\t%lu\n", prefix, BIT(dword, 23));
1809 printf("%s Digital_Port_Detected\t\t\t%lu\n", prefix, BIT(dword, 2));
1810 printf("%s Encoding\t\t\t\t\t[0x%lx] %s\n", prefix, BITS(dword, 11, 10),
1811 sdvo_hdmi_encoding[BITS(dword, 11, 10)]);
1812 printf("%s Null_packets_enabled_during_Vsync\t\t%u\n", prefix, !!(dword & SDVO_NULL_PACKETS_DURING_VSYNC));
1813 printf("%s Audio_Output_Enable\t\t\t\t%u\n", prefix, !!(dword & SDVO_AUDIO_ENABLE));
1814}
1815
1816static void dump_ironlake(void)
1817{
1818 uint32_t dword;
1819
Mengdong Lin449509d2014-03-03 17:03:02 -05001820 if (!IS_VALLEYVIEW(devid))
1821 set_reg_base(0xe0000, 0x2000); /* ironlake */
1822 else
1823 set_reg_base(0x60000 + VLV_DISPLAY_BASE, 0x2000);
Mengdong Lin86d15e02014-03-03 13:52:06 -05001824
Mengdong Lin449509d2014-03-03 17:03:02 -05001825 if (!IS_VALLEYVIEW(devid)) {
1826 dump_disp_reg(HDMI_CTL_B, "sDVO/HDMI Port B Control");
1827 dump_disp_reg(HDMI_CTL_C, "HDMI Port C Control");
1828 dump_disp_reg(HDMI_CTL_D, "HDMI Port D Control");
1829 } else {
1830 dump_disp_reg(SDVO_HDMI_CTL_B, "sDVO/HDMI Port B Control");
1831 dump_disp_reg(SDVO_HDMI_CTL_C, "sDVO/HDMI Port C Control");
1832 }
1833
Mengdong Lin86d15e02014-03-03 13:52:06 -05001834 dump_disp_reg(DP_CTL_B, "DisplayPort B Control Register");
1835 dump_disp_reg(DP_CTL_C, "DisplayPort C Control Register");
Mengdong Lin449509d2014-03-03 17:03:02 -05001836 if (!IS_VALLEYVIEW(devid))
1837 dump_disp_reg(DP_CTL_D, "DisplayPort D Control Register");
Mengdong Lin86d15e02014-03-03 13:52:06 -05001838
1839 dump_aud_reg(AUD_CONFIG_A, "Audio Configuration - Transcoder A");
1840 dump_aud_reg(AUD_CONFIG_B, "Audio Configuration - Transcoder B");
1841 dump_aud_reg(AUD_CTS_ENABLE_A, "Audio CTS Programming Enable - Transcoder A");
1842 dump_aud_reg(AUD_CTS_ENABLE_B, "Audio CTS Programming Enable - Transcoder B");
1843 dump_aud_reg(AUD_MISC_CTRL_A, "Audio MISC Control for Transcoder A");
1844 dump_aud_reg(AUD_MISC_CTRL_B, "Audio MISC Control for Transcoder B");
1845 dump_aud_reg(AUD_VID_DID, "Audio Vendor ID / Device ID");
1846 dump_aud_reg(AUD_RID, "Audio Revision ID");
1847 dump_aud_reg(AUD_PWRST, "Audio Power State (Function Group, Convertor, Pin Widget)");
1848 dump_aud_reg(AUD_PORT_EN_HD_CFG, "Audio Port Enable HDAudio Config");
1849 dump_aud_reg(AUD_OUT_DIG_CNVT_A, "Audio Digital Converter - Conv A");
1850 dump_aud_reg(AUD_OUT_DIG_CNVT_B, "Audio Digital Converter - Conv B");
1851 dump_aud_reg(AUD_OUT_CH_STR, "Audio Channel ID and Stream ID");
1852 dump_aud_reg(AUD_OUT_STR_DESC_A, "Audio Stream Descriptor Format - Conv A");
1853 dump_aud_reg(AUD_OUT_STR_DESC_B, "Audio Stream Descriptor Format - Conv B");
1854 dump_aud_reg(AUD_PINW_CONNLNG_LIST, "Audio Connection List");
1855 dump_aud_reg(AUD_PINW_CONNLNG_SEL, "Audio Connection Select");
1856 dump_aud_reg(AUD_CNTL_ST_A, "Audio Control State Register - Transcoder A");
1857 dump_aud_reg(AUD_CNTL_ST_B, "Audio Control State Register - Transcoder B");
1858 dump_aud_reg(AUD_CNTL_ST2, "Audio Control State 2");
1859 dump_aud_reg(AUD_HDMIW_STATUS, "Audio HDMI Status");
1860 dump_aud_reg(AUD_HDMIW_HDMIEDID_A, "HDMI Data EDID Block - Transcoder A");
1861 dump_aud_reg(AUD_HDMIW_HDMIEDID_B, "HDMI Data EDID Block - Transcoder B");
1862 dump_aud_reg(AUD_HDMIW_INFOFR_A, "Audio Widget Data Island Packet - Transcoder A");
1863 dump_aud_reg(AUD_HDMIW_INFOFR_B, "Audio Widget Data Island Packet - Transcoder B");
1864
1865 printf("\nDetails:\n\n");
1866
1867 dump_aud_vendor_device_id();
1868 dump_aud_revision_id();
1869
1870 dump_hdmi_port_ctrl(PORT_B);
1871 dump_hdmi_port_ctrl(PORT_C);
Mengdong Lin449509d2014-03-03 17:03:02 -05001872 if (!IS_VALLEYVIEW(devid))
1873 dump_hdmi_port_ctrl(PORT_D);
Mengdong Lin86d15e02014-03-03 13:52:06 -05001874
1875 dump_dp_port_ctrl(PORT_B);
1876 dump_dp_port_ctrl(PORT_C);
Mengdong Lin449509d2014-03-03 17:03:02 -05001877 if (!IS_VALLEYVIEW(devid))
1878 dump_dp_port_ctrl(PORT_D);
Mengdong Lin86d15e02014-03-03 13:52:06 -05001879
1880 dump_aud_config(PIPE_A);
1881 dump_aud_config(PIPE_B);
1882
1883 dump_aud_m_cts_enable(PIPE_A);
1884 dump_aud_m_cts_enable(PIPE_B);
1885
1886 dump_aud_misc_control(PIPE_A);
1887 dump_aud_misc_control(PIPE_B);
1888
1889 dump_aud_power_state();
1890 dump_aud_port_en_hd_cfg();
1891
1892 dump_aud_dig_cnvt(PIPE_A);
1893 dump_aud_dig_cnvt(PIPE_B);
1894
1895 dump_aud_out_ch_str();
1896
1897 dump_aud_str_desc(PIPE_A);
1898 dump_aud_str_desc(PIPE_B);
1899
1900 dump_aud_connect_list();
1901 dump_aud_connect_select();
1902
1903 dump_aud_ctrl_state(PIPE_A);
1904 dump_aud_ctrl_state(PIPE_B);
1905 dump_aud_ctrl_state2();
1906
1907 dump_aud_hdmi_status();
1908
1909 dump_aud_edid_data(PIPE_A);
1910 dump_aud_edid_data(PIPE_B);
1911
1912 dump_aud_infoframe(PIPE_A);
1913 dump_aud_infoframe(PIPE_B);
1914}
1915
1916#undef VIDEO_DIP_CTL_A
1917#undef VIDEO_DIP_CTL_B
1918#undef VIDEO_DIP_CTL_C
1919#undef VIDEO_DIP_CTL_D
1920#undef VIDEO_DIP_DATA
1921
1922/*
1923 * Haswell+ display registers
1924 */
1925
1926/* DisplayPort Transport Control */
1927#define DP_TP_CTL_A 0x64040
1928#define DP_TP_CTL_B 0x64140
1929#define DP_TP_CTL_C 0x64240
1930#define DP_TP_CTL_D 0x64340
1931#define DP_TP_CTL_E 0x64440
1932
1933/* DisplayPort Transport Status */
1934#define DP_TP_ST_A 0x64044
1935#define DP_TP_ST_B 0x64144
1936#define DP_TP_ST_C 0x64244
1937#define DP_TP_ST_D 0x64344
1938#define DP_TP_ST_E 0x64444
1939
1940/* DDI Buffer Control */
1941#define DDI_BUF_CTL_A 0x64000
1942#define DDI_BUF_CTL_B 0x64100
1943#define DDI_BUF_CTL_C 0x64200
1944#define DDI_BUF_CTL_D 0x64300
1945#define DDI_BUF_CTL_E 0x64400
1946
1947/* DDI Buffer Translation */
1948#define DDI_BUF_TRANS_A 0x64e00
1949#define DDI_BUF_TRANS_B 0x64e60
1950#define DDI_BUF_TRANS_C 0x64ec0
1951#define DDI_BUF_TRANS_D 0x64f20
1952#define DDI_BUF_TRANS_E 0x64f80
1953
1954/* DDI Aux Channel */
1955#define DDI_AUX_CHANNEL_CTRL 0x64010
1956#define DDI_AUX_DATA 0x64014
1957#define DDI_AUX_TST 0x64028
1958
1959/* DDI CRC Control */
1960#define DDI_CRC_CTL_A 0x64050
1961#define DDI_CRC_CTL_B 0x64150
1962#define DDI_CRC_CTL_C 0x64250
1963#define DDI_CRC_CTL_D 0x64350
1964#define DDI_CRC_CTL_E 0x64450
1965
1966/* Pipe DDI Function Control */
1967#define PIPE_DDI_FUNC_CTL_A 0x60400
1968#define PIPE_DDI_FUNC_CTL_B 0x61400
1969#define PIPE_DDI_FUNC_CTL_C 0x62400
1970#define PIPE_DDI_FUNC_CTL_EDP 0x6F400
1971
1972/* Pipe Configuration */
1973#define PIPE_CONF_A 0x70008
1974#define PIPE_CONF_B 0x71008
1975#define PIPE_CONF_C 0x72008
1976#define PIPE_CONF_EDP 0x7F008
1977
1978/* Video DIP Control */
1979#define VIDEO_DIP_CTL_A 0x60200
1980#define VIDEO_DIP_CTL_B 0x61200
1981#define VIDEO_DIP_CTL_C 0x62200
1982#define VIDEO_DIP_CTL_D 0x63200
1983
1984#define VIDEO_DIP_DATA 0x60220
1985#define VIDEO_DIP_ECC 0x60240
1986
1987static void dump_ddi_buf_ctl(int port)
1988{
1989 uint32_t dword;
1990
1991 dword = INREG(DDI_BUF_CTL_A + (port - PORT_A) * 0x100);
1992 printf("DDI %c Buffer control\n", 'A' + port - PORT_A);
1993
1994 printf("\tDP port width\t\t\t\t\t[0x%lx] %s\n", BITS(dword, 3, 1),
1995 OPNAME(dp_port_width, BITS(dword, 3, 1)));
1996 printf("\tDDI Buffer Enable\t\t\t\t%ld\n", BIT(dword, 31));
1997}
1998
1999static void dump_ddi_func_ctl(int pipe)
2000{
2001 uint32_t dword;
2002
2003 dword = INREG(PIPE_DDI_FUNC_CTL_A + (pipe - PIPE_A) * 0x1000);
2004 printf("Pipe %c DDI Function Control\n", 'A' + pipe - PIPE_A);
2005
2006 printf("\tBITS per color\t\t\t\t\t[0x%lx] %s\n", BITS(dword, 22, 20),
2007 OPNAME(bits_per_color, BITS(dword, 22, 20)));
2008 printf("\tPIPE DDI Mode\t\t\t\t\t[0x%lx] %s\n", BITS(dword, 26, 24),
2009 OPNAME(ddi_mode, BITS(dword, 26, 24)));
2010 printf("\tPIPE DDI selection\t\t\t\t[0x%lx] %s\n", BITS(dword, 30, 28),
2011 OPNAME(trans_to_port_sel, BITS(dword, 30, 28)));
2012 printf("\tPIPE DDI Function Enable\t\t\t[0x%lx]\n", BIT(dword, 31));
2013}
2014
2015static void dump_aud_connect_list_entry_length(int transcoder)
2016{
2017 uint32_t dword;
2018 char prefix[MAX_PREFIX_SIZE];
2019
2020 dword = INREG(aud_reg_base + AUD_TCA_PIN_PIPE_CONN_ENTRY_LNGTH + (transcoder - TRANSCODER_A) * 0x100);
2021 sprintf(prefix, "AUD_TC%c_PIN_PIPE_CONN_ENTRY_LNGTH", 'A' + transcoder - TRANSCODER_A);
2022
2023 printf("%s Connect_List_Length\t%lu\n", prefix, BITS(dword, 6, 0));
2024 printf("%s Form \t\t[%#lx] %s\n", prefix, BIT(dword, 7),
2025 OPNAME(connect_list_form, BIT(dword, 7)));
2026 printf("%s Connect_List_Entry\t%lu\n", prefix, BITS(dword, 15, 8));
2027}
2028
2029static void dump_aud_connect_select_ctrl(void)
2030{
2031 uint32_t dword;
2032
2033 dword = INREG(aud_reg_base + AUD_PIPE_CONN_SEL_CTRL);
2034 printf("AUD_PIPE_CONN_SEL_CTRL Connection_select_Port_B\t%#lx\n", BITS(dword, 7, 0));
2035 printf("AUD_PIPE_CONN_SEL_CTRL Connection_select_Port_C\t%#lx\n", BITS(dword, 15, 8));
2036 printf("AUD_PIPE_CONN_SEL_CTRL Connection_select_Port_D\t%#lx\n", BITS(dword, 23, 16));
2037}
2038
2039static void dump_aud_dip_eld_ctrl_st(int transcoder)
2040{
2041 uint32_t dword;
2042 int offset = (transcoder - TRANSCODER_A) * 0x100;
2043
2044 dword = INREG(aud_reg_base + AUD_TCA_DIP_ELD_CTRL_ST + offset);
2045 printf("Audio DIP and ELD control state for Transcoder %c\n", 'A' + transcoder - TRANSCODER_A);
2046
2047 printf("\tELD_ACK\t\t\t\t\t\t%lu\n", BIT(dword, 4));
2048 printf("\tELD_buffer_size\t\t\t\t\t%lu\n", BITS(dword, 14, 10));
2049 printf("\tDIP_transmission_frequency\t\t\t[0x%lx] %s\n", BITS(dword, 17, 16),
2050 dip_trans[BITS(dword, 17, 16)]);
2051 printf("\tDIP Buffer Index \t\t\t\t[0x%lx] %s\n", BITS(dword, 20, 18),
2052 dip_index[BITS(dword, 20, 18)]);
2053 printf("\tAudio DIP type enable status\t\t\t[0x%04lx] %s, %s, %s\n", BITS(dword, 24, 21),
2054 dip_type[BIT(dword, 21)], dip_gen1_state[BIT(dword, 22)], dip_gen2_state[BIT(dword, 23)]);
2055 printf("\tAudio DIP port select\t\t\t\t[0x%lx] %s\n", BITS(dword, 30, 29),
2056 dip_port[BITS(dword, 30, 29)]);
2057 printf("\n");
2058}
2059
2060static void dump_aud_hdmi_fifo_status(void)
2061{
2062 uint32_t dword;
2063
2064 dword = INREG(aud_reg_base + AUD_HDMI_FIFO_STATUS);
Mengdong Lindeba8682013-09-09 15:38:40 -04002065 printf("AUD_HDMI_FIFO_STATUS Function_Reset\t\t\t%lu\n", BIT(dword, 24));
2066 printf("AUD_HDMI_FIFO_STATUS Conv_1_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n", BIT(dword, 26));
2067 printf("AUD_HDMI_FIFO_STATUS Conv_1_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 27));
2068 printf("AUD_HDMI_FIFO_STATUS Conv_2_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n", BIT(dword, 28));
2069 printf("AUD_HDMI_FIFO_STATUS Conv_2_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 29));
2070 printf("AUD_HDMI_FIFO_STATUS Conv_3_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n", BIT(dword, 30));
2071 printf("AUD_HDMI_FIFO_STATUS Conv_3_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 31));
2072}
Wang Xingchaoc4077222012-08-15 16:13:38 +08002073
Mengdong Linf075c3c2013-08-13 00:22:14 -04002074static void parse_bdw_audio_chicken_bit_reg(uint32_t dword)
2075{
2076 printf("\t");
Mengdong Linfa8c7502014-03-04 10:13:09 -05002077 printf("%s\n\t", OPNAME(vanilla_dp12_en, BIT(dword, 31)));
2078 printf("%s\n\t", OPNAME(vanilla_3_widgets_en, BIT(dword, 30)));
2079 printf("%s\n\t", OPNAME(block_audio, BIT(dword, 10)));
Mengdong Linf075c3c2013-08-13 00:22:14 -04002080 printf("%s\n\t", OPNAME(dis_eld_valid_pulse_trans, BIT(dword, 9)));
Mengdong Linfa8c7502014-03-04 10:13:09 -05002081 printf("%s\n\t", OPNAME(dis_pd_pulse_trans, BIT(dword, 8)));
2082 printf("%s\n\t", OPNAME(dis_ts_delta_err, BIT(dword, 7)));
2083 printf("%s\n\t", OPNAME(dis_ts_fix_dp_hbr, BIT(dword, 6)));
2084 printf("%s\n\t", OPNAME(pattern_gen_8_ch_en, BIT(dword, 5)));
2085 printf("%s\n\t", OPNAME(pattern_gen_2_ch_en, BIT(dword, 4)));
2086 printf("%s\n\t", OPNAME(fabric_32_44_dis, BIT(dword, 3)));
2087 printf("%s\n\t", OPNAME(epss_dis, BIT(dword, 2)));
2088 printf("%s\n\t", OPNAME(ts_test_mode, BIT(dword, 1)));
2089 printf("%s\n", OPNAME(en_mmio_program, BIT(dword, 0)));
Mengdong Linf075c3c2013-08-13 00:22:14 -04002090}
2091
Mengdong Lin69cc00b2013-07-17 13:29:17 -04002092/* Dump audio registers for Haswell and its successors (eg. Broadwell).
2093 * Their register layout are same in the north display engine.
2094 */
2095static void dump_hsw_plus(void)
Wang Xingchaoc4077222012-08-15 16:13:38 +08002096{
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04002097 uint32_t dword;
Mengdong Lin97e5cf62013-08-13 00:22:24 -04002098 int i;
Wang Xingchaoc4077222012-08-15 16:13:38 +08002099
Mengdong Lin86d15e02014-03-03 13:52:06 -05002100 set_aud_reg_base(0x65000);
2101
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04002102 /* HSW DDI Buffer */
Mengdong Linfa8c7502014-03-04 10:13:09 -05002103 dump_reg(DDI_BUF_CTL_A, "DDI Buffer Controler A");
2104 dump_reg(DDI_BUF_CTL_B, "DDI Buffer Controler B");
2105 dump_reg(DDI_BUF_CTL_C, "DDI Buffer Controler C");
2106 dump_reg(DDI_BUF_CTL_D, "DDI Buffer Controler D");
2107 dump_reg(DDI_BUF_CTL_E, "DDI Buffer Controler E");
Wang Xingchaoc4077222012-08-15 16:13:38 +08002108
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04002109 /* HSW Pipe Function */
Mengdong Linfa8c7502014-03-04 10:13:09 -05002110 dump_reg(PIPE_CONF_A, "PIPE Configuration A");
2111 dump_reg(PIPE_CONF_B, "PIPE Configuration B");
2112 dump_reg(PIPE_CONF_C, "PIPE Configuration C");
2113 dump_reg(PIPE_CONF_EDP, "PIPE Configuration EDP");
Wang Xingchaoc4077222012-08-15 16:13:38 +08002114
Mengdong Linfa8c7502014-03-04 10:13:09 -05002115 dump_reg(PIPE_DDI_FUNC_CTL_A, "PIPE DDI Function Control A");
2116 dump_reg(PIPE_DDI_FUNC_CTL_B, "PIPE DDI Function Control B");
2117 dump_reg(PIPE_DDI_FUNC_CTL_C, "PIPE DDI Function Control C");
2118 dump_reg(PIPE_DDI_FUNC_CTL_EDP, "PIPE DDI Function Control EDP");
Wang Xingchaoc4077222012-08-15 16:13:38 +08002119
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04002120 /* HSW Display port */
Mengdong Linfa8c7502014-03-04 10:13:09 -05002121 dump_reg(DP_TP_CTL_A, "DisplayPort Transport A Control");
2122 dump_reg(DP_TP_CTL_B, "DisplayPort Transport B Control");
2123 dump_reg(DP_TP_CTL_C, "DisplayPort Transport C Control");
2124 dump_reg(DP_TP_CTL_D, "DisplayPort Transport D Control");
2125 dump_reg(DP_TP_CTL_E, "DisplayPort Transport E Control");
Wang Xingchaoc4077222012-08-15 16:13:38 +08002126
Mengdong Linfa8c7502014-03-04 10:13:09 -05002127 dump_reg(DP_TP_ST_A, "DisplayPort Transport A Status");
2128 dump_reg(DP_TP_ST_B, "DisplayPort Transport B Status");
2129 dump_reg(DP_TP_ST_C, "DisplayPort Transport C Status");
2130 dump_reg(DP_TP_ST_D, "DisplayPort Transport D Status");
2131 dump_reg(DP_TP_ST_E, "DisplayPort Transport E Status");
Wang Xingchaoc4077222012-08-15 16:13:38 +08002132
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04002133 /* HSW North Display Audio */
Mengdong Lin86d15e02014-03-03 13:52:06 -05002134 dump_aud_reg(AUD_TCA_CONFIG, "Audio Configuration - Transcoder A");
2135 dump_aud_reg(AUD_TCB_CONFIG, "Audio Configuration - Transcoder B");
2136 dump_aud_reg(AUD_TCC_CONFIG, "Audio Configuration - Transcoder C");
2137 dump_aud_reg(AUD_C1_MISC_CTRL, "Audio Converter 1 MISC Control");
2138 dump_aud_reg(AUD_C2_MISC_CTRL, "Audio Converter 2 MISC Control");
2139 dump_aud_reg(AUD_C3_MISC_CTRL, "Audio Converter 3 MISC Control");
2140 dump_aud_reg(AUD_VID_DID, "Audio Vendor ID / Device ID");
2141 dump_aud_reg(AUD_RID, "Audio Revision ID");
2142 dump_aud_reg(AUD_TCA_M_CTS_ENABLE, "Audio M & CTS Programming Enable - Transcoder A");
2143 dump_aud_reg(AUD_TCB_M_CTS_ENABLE, "Audio M & CTS Programming Enable - Transcoder B");
2144 dump_aud_reg(AUD_TCC_M_CTS_ENABLE, "Audio M & CTS Programming Enable - Transcoder C");
2145 dump_aud_reg(AUD_PWRST, "Audio Power State (Function Group, Convertor, Pin Widget)");
2146 dump_aud_reg(AUD_TCA_EDID_DATA, "Audio EDID Data Block - Transcoder A");
2147 dump_aud_reg(AUD_TCB_EDID_DATA, "Audio EDID Data Block - Transcoder B");
2148 dump_aud_reg(AUD_TCC_EDID_DATA, "Audio EDID Data Block - Transcoder C");
2149 dump_aud_reg(AUD_TCA_INFOFR, "Audio Widget Data Island Packet - Transcoder A");
2150 dump_aud_reg(AUD_TCB_INFOFR, "Audio Widget Data Island Packet - Transcoder B");
2151 dump_aud_reg(AUD_TCC_INFOFR, "Audio Widget Data Island Packet - Transcoder C");
2152 dump_aud_reg(AUD_PIPE_CONV_CFG, "Audio Pipe and Converter Configs");
2153 dump_aud_reg(AUD_C1_DIG_CNVT, "Audio Digital Converter - Converter 1");
2154 dump_aud_reg(AUD_C2_DIG_CNVT, "Audio Digital Converter - Converter 2");
2155 dump_aud_reg(AUD_C3_DIG_CNVT, "Audio Digital Converter - Converter 3");
2156 dump_aud_reg(AUD_C1_STR_DESC, "Audio Stream Descriptor Format - Converter 1");
2157 dump_aud_reg(AUD_C2_STR_DESC, "Audio Stream Descriptor Format - Converter 2");
2158 dump_aud_reg(AUD_C3_STR_DESC, "Audio Stream Descriptor Format - Converter 3");
2159 dump_aud_reg(AUD_OUT_CHAN_MAP, "Audio Output Channel Mapping");
2160 dump_aud_reg(AUD_TCA_PIN_PIPE_CONN_ENTRY_LNGTH, "Audio Connection List entry and Length - Transcoder A");
2161 dump_aud_reg(AUD_TCB_PIN_PIPE_CONN_ENTRY_LNGTH, "Audio Connection List entry and Length - Transcoder B");
2162 dump_aud_reg(AUD_TCC_PIN_PIPE_CONN_ENTRY_LNGTH, "Audio Connection List entry and Length - Transcoder C");
2163 dump_aud_reg(AUD_PIPE_CONN_SEL_CTRL, "Audio Pipe Connection Select Control");
2164 dump_aud_reg(AUD_TCA_DIP_ELD_CTRL_ST, "Audio DIP and ELD control state - Transcoder A");
2165 dump_aud_reg(AUD_TCB_DIP_ELD_CTRL_ST, "Audio DIP and ELD control state - Transcoder B");
2166 dump_aud_reg(AUD_TCC_DIP_ELD_CTRL_ST, "Audio DIP and ELD control state - Transcoder C");
2167 dump_aud_reg(AUD_PIN_ELD_CP_VLD, "Audio pin ELD valid and CP ready status");
2168 dump_aud_reg(AUD_HDMI_FIFO_STATUS, "Audio HDMI FIFO Status");
Wang Xingchaoc4077222012-08-15 16:13:38 +08002169
Mengdong Lin85357202013-08-13 00:21:57 -04002170 /* Audio debug registers */
Mengdong Lin86d15e02014-03-03 13:52:06 -05002171 dump_aud_reg(AUD_ICOI, "Audio Immediate Command Output Interface");
2172 dump_aud_reg(AUD_IRII, "Audio Immediate Response Input Interface");
2173 dump_aud_reg(AUD_ICS, "Audio Immediate Command Status");
2174 dump_aud_reg(AUD_CHICKENBIT_REG, "Audio Chicken Bit Register");
2175 dump_aud_reg(AUD_DP_DIP_STATUS, "Audio DP and DIP FIFO Debug Status");
2176 dump_aud_reg(AUD_TCA_M_CTS, "Audio M CTS Read Back Transcoder A");
2177 dump_aud_reg(AUD_TCB_M_CTS, "Audio M CTS Read Back Transcoder B");
2178 dump_aud_reg(AUD_TCC_M_CTS, "Audio M CTS Read Back Transcoder C");
Mengdong Lin85357202013-08-13 00:21:57 -04002179
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04002180 printf("\nDetails:\n\n");
Wang Xingchaoc4077222012-08-15 16:13:38 +08002181
Mengdong Lindeba8682013-09-09 15:38:40 -04002182 dump_ddi_buf_ctl(PORT_A);
2183 dump_ddi_buf_ctl(PORT_B);
2184 dump_ddi_buf_ctl(PORT_C);
2185 dump_ddi_buf_ctl(PORT_D);
2186 dump_ddi_buf_ctl(PORT_E);
Wang Xingchaoc4077222012-08-15 16:13:38 +08002187
Mengdong Lindeba8682013-09-09 15:38:40 -04002188 dump_ddi_func_ctl(PIPE_A);
2189 dump_ddi_func_ctl(PIPE_B);
2190 dump_ddi_func_ctl(PIPE_C);
Wang Xingchaoc4077222012-08-15 16:13:38 +08002191
Mengdong Lindeba8682013-09-09 15:38:40 -04002192 /* audio configuration - details */
Mengdong Lin86d15e02014-03-03 13:52:06 -05002193 dump_aud_config(TRANSCODER_A);
2194 dump_aud_config(TRANSCODER_B);
2195 dump_aud_config(TRANSCODER_C);
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04002196
Mengdong Lindeba8682013-09-09 15:38:40 -04002197 dump_aud_misc_control(CONVERTER_1);
2198 dump_aud_misc_control(CONVERTER_2);
2199 dump_aud_misc_control(CONVERTER_3);
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04002200
Mengdong Lindeba8682013-09-09 15:38:40 -04002201 dump_aud_vendor_device_id();
2202 dump_aud_revision_id();
Wang Xingchaoc4077222012-08-15 16:13:38 +08002203
Mengdong Lindeba8682013-09-09 15:38:40 -04002204 dump_aud_m_cts_enable(TRANSCODER_A);
2205 dump_aud_m_cts_enable(TRANSCODER_B);
2206 dump_aud_m_cts_enable(TRANSCODER_C);
Wang Xingchaoc4077222012-08-15 16:13:38 +08002207
Mengdong Lindeba8682013-09-09 15:38:40 -04002208 dump_aud_power_state();
Wang Xingchaoc4077222012-08-15 16:13:38 +08002209
Mengdong Lindeba8682013-09-09 15:38:40 -04002210 dump_aud_edid_data(TRANSCODER_A);
2211 dump_aud_edid_data(TRANSCODER_B);
2212 dump_aud_edid_data(TRANSCODER_C);
Wang Xingchaoc4077222012-08-15 16:13:38 +08002213
Mengdong Lindeba8682013-09-09 15:38:40 -04002214 dump_aud_infoframe(TRANSCODER_A);
2215 dump_aud_infoframe(TRANSCODER_B);
2216 dump_aud_infoframe(TRANSCODER_C);
Wang Xingchaoc4077222012-08-15 16:13:38 +08002217
Mengdong Lindeba8682013-09-09 15:38:40 -04002218 dump_aud_pipe_conv_cfg();
Wang Xingchaoc4077222012-08-15 16:13:38 +08002219
Mengdong Lindeba8682013-09-09 15:38:40 -04002220 dump_aud_dig_cnvt(CONVERTER_1);
2221 dump_aud_dig_cnvt(CONVERTER_2);
2222 dump_aud_dig_cnvt(CONVERTER_3);
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04002223
Mengdong Lindeba8682013-09-09 15:38:40 -04002224 dump_aud_str_desc(CONVERTER_1);
2225 dump_aud_str_desc(CONVERTER_2);
2226 dump_aud_str_desc(CONVERTER_3);
Wang Xingchaoc4077222012-08-15 16:13:38 +08002227
Mengdong Lindeba8682013-09-09 15:38:40 -04002228 dump_aud_out_chan_map();
Wang Xingchaoc4077222012-08-15 16:13:38 +08002229
Mengdong Lindeba8682013-09-09 15:38:40 -04002230 dump_aud_connect_list_entry_length(TRANSCODER_A);
2231 dump_aud_connect_list_entry_length(TRANSCODER_B);
2232 dump_aud_connect_list_entry_length(TRANSCODER_C);
2233 dump_aud_connect_select_ctrl();
Wang Xingchaoc4077222012-08-15 16:13:38 +08002234
Mengdong Lindeba8682013-09-09 15:38:40 -04002235 dump_aud_dip_eld_ctrl_st(TRANSCODER_A);
2236 dump_aud_dip_eld_ctrl_st(TRANSCODER_B);
2237 dump_aud_dip_eld_ctrl_st(TRANSCODER_C);
Wang Xingchaoc4077222012-08-15 16:13:38 +08002238
Mengdong Lindeba8682013-09-09 15:38:40 -04002239 dump_aud_eld_cp_vld();
Mengdong Lin86d15e02014-03-03 13:52:06 -05002240 dump_aud_hdmi_fifo_status();
Mengdong Lin85357202013-08-13 00:21:57 -04002241
Mengdong Lin86d15e02014-03-03 13:52:06 -05002242 dword = read_aud_reg(AUD_ICS);
Mengdong Lin85357202013-08-13 00:21:57 -04002243 printf("IRV [%1lx] %s\t", BIT(dword, 1),
2244 OPNAME(immed_result_valid, BIT(dword, 1)));
2245 printf("ICB [%1lx] %s\n", BIT(dword, 1),
2246 OPNAME(immed_cmd_busy, BIT(dword, 0)));
Mengdong Linf075c3c2013-08-13 00:22:14 -04002247
Mengdong Lin86d15e02014-03-03 13:52:06 -05002248 dword = read_aud_reg(AUD_CHICKENBIT_REG);
Mengdong Linf075c3c2013-08-13 00:22:14 -04002249 printf("AUD_CHICKENBIT_REG Audio Chicken Bits: %08x\n", dword);
2250 if (IS_BROADWELL(devid))
2251 parse_bdw_audio_chicken_bit_reg(dword);
2252
Mengdong Lin86d15e02014-03-03 13:52:06 -05002253 dword = read_aud_reg(AUD_DP_DIP_STATUS);
Mengdong Lin97e5cf62013-08-13 00:22:24 -04002254 printf("AUD_DP_DIP_STATUS Audio DP & DIP FIFO Status: %08x\n\t", dword);
2255 for (i = 31; i >= 0; i--)
2256 if (BIT(dword, i))
2257 printf("%s\n\t", audio_dp_dip_status[i]);
2258 printf("\n");
Wang Xingchaoc4077222012-08-15 16:13:38 +08002259}
2260
Wu Fengguang020abdb2010-04-19 13:13:06 +08002261int main(int argc, char **argv)
2262{
2263 struct pci_device *pci_dev;
2264
2265 pci_dev = intel_get_pci_device();
2266 devid = pci_dev->device_id; /* XXX not true when mapping! */
2267
2268 do_self_tests();
2269
2270 if (argc == 2)
2271 intel_map_file(argv[1]);
2272 else
2273 intel_get_mmio(pci_dev);
2274
Mengdong Lin449509d2014-03-03 17:03:02 -05002275 if (IS_VALLEYVIEW(devid)) {
2276 printf("Valleyview audio registers:\n\n");
2277 dump_ironlake();
2278 } else if (IS_BROADWELL(devid) || IS_HASWELL(devid)) {
Mengdong Lin69cc00b2013-07-17 13:29:17 -04002279 printf("%s audio registers:\n\n",
2280 IS_BROADWELL(devid) ? "Broadwell" : "Haswell");
2281 dump_hsw_plus();
2282 } else if (IS_GEN6(devid) || IS_GEN7(devid)
2283 || getenv("HAS_PCH_SPLIT")) {
Wu Fengguang6fcb5cd2011-11-12 11:12:49 +08002284 printf("%s audio registers:\n\n",
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04002285 IS_GEN6(devid) ? "SandyBridge" : "IvyBridge");
Wu Fengguang020abdb2010-04-19 13:13:06 +08002286 intel_check_pch();
2287 dump_cpt();
Wu Fengguang6fcb5cd2011-11-12 11:12:49 +08002288 } else if (IS_GEN5(devid)) {
2289 printf("Ironlake audio registers:\n\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +08002290 dump_ironlake();
Wu Fengguang6fcb5cd2011-11-12 11:12:49 +08002291 } else if (IS_G4X(devid)) {
2292 printf("G45 audio registers:\n\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +08002293 dump_eaglelake();
Wu Fengguang6fcb5cd2011-11-12 11:12:49 +08002294 }
Wu Fengguang020abdb2010-04-19 13:13:06 +08002295
2296 return 0;
Wu Fengguang9e9c9f22009-11-06 11:06:22 +08002297}