blob: 3ed291800e4026d7cb4db5d7203659272b6430d1 [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 Lin8fe0c502014-03-13 16:38:02 -0400100static const char * const cts_m_value_index[] = {
101 [0] = "CTS",
102 [1] = "M",
103};
104
Mengdong Lindeba8682013-09-09 15:38:40 -0400105static const char * const pixel_clock[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800106 [0] = "25.2 / 1.001 MHz",
107 [1] = "25.2 MHz",
108 [2] = "27 MHz",
109 [3] = "27 * 1.001 MHz",
110 [4] = "54 MHz",
111 [5] = "54 * 1.001 MHz",
112 [6] = "74.25 / 1.001 MHz",
113 [7] = "74.25 MHz",
114 [8] = "148.5 / 1.001 MHz",
115 [9] = "148.5 MHz",
116 [10] = "Reserved",
117};
118
Mengdong Lindeba8682013-09-09 15:38:40 -0400119static const char * const power_state[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800120 [0] = "D0",
121 [1] = "D1",
122 [2] = "D2",
123 [3] = "D3",
124};
125
Mengdong Lindeba8682013-09-09 15:38:40 -0400126static const char * const stream_type[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800127 [0] = "default samples",
128 [1] = "one bit stream",
129 [2] = "DST stream",
130 [3] = "MLP stream",
131 [4] = "Reserved",
132};
133
Mengdong Lindeba8682013-09-09 15:38:40 -0400134static const char * const dip_port[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800135 [0] = "Reserved",
136 [1] = "Digital Port B",
137 [2] = "Digital Port C",
138 [3] = "Digital Port D",
139};
140
Mengdong Lindeba8682013-09-09 15:38:40 -0400141static const char * const dip_type[] = {
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400142 [0] = "Audio DIP Disabled",
143 [1] = "Audio DIP Enabled",
Wang Xingchaoc4077222012-08-15 16:13:38 +0800144};
145
Mengdong Lindeba8682013-09-09 15:38:40 -0400146static const char * const dip_gen1_state[] = {
147 [0] = "Generic 1 (ACP) DIP Disabled",
148 [1] = "Generic 1 (ACP) DIP Enabled",
149};
150
151static const char * const dip_gen2_state[] = {
152 [0] = "Generic 2 DIP Disabled",
153 [1] = "Generic 2 DIP Enabled",
154};
155
156static const char * const dip_index[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800157 [0] = "Audio DIP",
158 [1] = "ACP DIP",
159 [2] = "ISRC1 DIP",
160 [3] = "ISRC2 DIP",
161 [4] = "Reserved",
162};
163
Mengdong Lindeba8682013-09-09 15:38:40 -0400164static const char * const dip_trans[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800165 [0] = "disabled",
166 [1] = "reserved",
167 [2] = "send once",
168 [3] = "best effort",
169};
170
Mengdong Lindeba8682013-09-09 15:38:40 -0400171static const char * const video_dip_index[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800172 [0] = "AVI DIP",
173 [1] = "Vendor-specific DIP",
Wu Fengguangf3f84bb2011-11-12 11:12:55 +0800174 [2] = "Gamut Metadata DIP",
Wu Fengguang020abdb2010-04-19 13:13:06 +0800175 [3] = "Source Product Description DIP",
176};
177
Mengdong Lindeba8682013-09-09 15:38:40 -0400178static const char * const video_dip_trans[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800179 [0] = "send once",
180 [1] = "send every vsync",
181 [2] = "send at least every other vsync",
182 [3] = "reserved",
183};
184
Mengdong Lindeba8682013-09-09 15:38:40 -0400185static const char * const trans_to_port_sel[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800186 [0] = "no port",
187 [1] = "Digital Port B",
Wang Xingchaof9a24812012-08-15 16:13:37 +0800188 [2] = "Digital Port C",
189 [3] = "Digital Port D",
190 [4] = "reserved",
Alan Coopersmithc4610062012-01-06 14:37:19 -0800191 [5] = "reserved",
192 [6] = "reserved",
193 [7] = "reserved",
Wu Fengguang020abdb2010-04-19 13:13:06 +0800194};
195
Mengdong Lindeba8682013-09-09 15:38:40 -0400196static const char * const ddi_mode[] = {
Wang Xingchaoc4077222012-08-15 16:13:38 +0800197 [0] = "HDMI mode",
198 [1] = "DVI mode",
199 [2] = "DP SST mode",
200 [3] = "DP MST mode",
201 [4] = "DP FDI mode",
202 [5] = "reserved",
203 [6] = "reserved",
204 [7] = "reserved",
205};
206
Mengdong Lindeba8682013-09-09 15:38:40 -0400207static const char * const bits_per_color[] = {
208 [0] = "8 bpc",
209 [1] = "10 bpc",
210 [2] = "6 bpc",
211 [3] = "12 bpc",
212 [4] = "reserved",
213 [5] = "reserved",
214 [6] = "reserved",
215 [7] = "reserved",
216};
217
218static const char * const transcoder_select[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800219 [0] = "Transcoder A",
220 [1] = "Transcoder B",
221 [2] = "Transcoder C",
222 [3] = "reserved",
223};
224
Mengdong Lindeba8682013-09-09 15:38:40 -0400225static const char * const dp_port_width[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800226 [0] = "x1 mode",
227 [1] = "x2 mode",
Wu Fengguangcf4c12f2011-11-12 11:12:46 +0800228 [2] = "reserved",
229 [3] = "x4 mode",
Alan Coopersmithc4610062012-01-06 14:37:19 -0800230 [4] = "reserved",
231 [5] = "reserved",
232 [6] = "reserved",
233 [7] = "reserved",
Wu Fengguang020abdb2010-04-19 13:13:06 +0800234};
235
Mengdong Lindeba8682013-09-09 15:38:40 -0400236static const char * const sample_base_rate[] = {
237 [0] = "48 kHz",
238 [1] = "44.1 kHz",
239};
240
241static const char * const sample_base_rate_mult[] = {
242 [0] = "x1 (48 kHz, 44.1 kHz or less)",
243 [1] = "x2 (96 kHz, 88.2 kHz, 32 kHz)",
244 [2] = "x3 (144 kHz)",
245 [3] = "x4 (192 kHz, 176.4 kHz)",
246 [4] = "Reserved",
247};
248
249static const char * const sample_base_rate_divisor[] = {
250 [0] = "Divided by 1 (48 kHz, 44.1 kHz)",
251 [1] = "Divided by 2 (24 kHz, 22.05 kHz)",
252 [2] = "Divided by 3 (16 kHz, 32 kHz)",
253 [3] = "Divided by 4 (11.025 kHz)",
254 [4] = "Divided by 5 (9.6 kHz)",
255 [5] = "Divided by 6 (8 kHz)",
256 [6] = "Divided by 7",
257 [7] = "Divided by 8 (6 kHz)",
258};
259
260static const char * const connect_list_form[] = {
261 [0] = "Short Form",
262 [1] = "Long Form",
263};
264
265
266static const char * const bits_per_sample[] = {
Wu Fengguang12861a92011-11-12 11:12:47 +0800267 [0] = "reserved",
268 [1] = "16 bits",
269 [2] = "24 bits",
270 [3] = "32 bits",
271 [4] = "20 bits",
272 [5] = "reserved",
273};
274
Mengdong Lindeba8682013-09-09 15:38:40 -0400275static const char * const sdvo_hdmi_encoding[] = {
Wu Fengguangee949582011-11-12 11:12:53 +0800276 [0] = "SDVO",
277 [1] = "reserved",
278 [2] = "TMDS",
279 [3] = "reserved",
280};
Wu Fengguang12861a92011-11-12 11:12:47 +0800281
Mengdong Lindeba8682013-09-09 15:38:40 -0400282static const char * const n_index_value[] = {
Wu Fengguange64abe52012-01-17 07:19:24 +0800283 [0] = "HDMI",
284 [1] = "DisplayPort",
285};
286
Mengdong Lin85357202013-08-13 00:21:57 -0400287static const char * const immed_result_valid[] = {
288 [0] = "No immediate response is available",
289 [1] = "Immediate response is available",
290};
291
292static const char * const immed_cmd_busy[] = {
293 [0] = "Can accept an immediate command",
294 [1] = "Immediate command is available",
295};
296
Mengdong Linf075c3c2013-08-13 00:22:14 -0400297static const char * const vanilla_dp12_en[] = {
298 [0] = "DP 1.2 features are disabled",
299 [1] = "DP 1.2 features are enabled",
300};
301
302static const char * const vanilla_3_widgets_en[] = {
303 [0] = "2nd & 3rd pin/convertor widgets are disabled",
304 [1] = "All three pin/convertor widgets are enabled",
305};
306
307static const char * const block_audio[] = {
308 [0] = "Allow audio data to reach the port",
309 [1] = "Block audio data from reaching the port",
310};
311
312static const char * const dis_eld_valid_pulse_trans[] = {
313 [0] = "Enable ELD valid pulse transition when unsol is disabled",
314 [1] = "Disable ELD valid pulse transition when unsol is disabled",
315};
316
317static const char * const dis_pd_pulse_trans[] = {
318 [0] = "Enable Presense Detect pulse transition when unsol is disabled",
319 [1] = "Disable Presense Detect pulse transition when unsol is disabled",
320};
321
322static const char * const dis_ts_delta_err[] = {
323 [0] = "Enable timestamp delta error for 32/44 KHz",
324 [1] = "Disable timestamp delta error for 32/44 KHz",
325};
326
327static const char * const dis_ts_fix_dp_hbr[] = {
328 [0] = "Enable timestamp fix for DP HBR",
329 [1] = "Disable timestamp fix for DP HBR",
330};
331
332static const char * const pattern_gen_8_ch_en[] = {
333 [0] = "Disable 8-channel pattern generator",
334 [1] = "Enable 8-channel pattern generator",
335};
336
337static const char * const pattern_gen_2_ch_en[] = {
338 [0] = "Disable 2-channel pattern generator",
339 [1] = "Enable 2-channel pattern generator",
340};
341
342static const char * const fabric_32_44_dis[] = {
343 [0] = "Allow sample fabrication for 32/44 KHz",
344 [1] = "Disable sample fabrication for 32/44 KHz",
345};
346
347static const char * const epss_dis[] = {
348 [0] = "Allow audio EPSS",
349 [1] = "Disable audio EPSS",
350};
351
352static const char * const ts_test_mode[] = {
353 [0] = "Default time stamp mode",
354 [1] = "Audio time stamp test mode for audio only feature",
355};
356
357static const char * const en_mmio_program[] = {
358 [0] = "Programming by HD-Audio Azalia",
359 [1] = "Programming by MMIO debug registers",
360};
361
Mengdong Lin97e5cf62013-08-13 00:22:24 -0400362static const char * const audio_dp_dip_status[] = {
363 [0] = "audfc dp fifo full",
364 [1] = "audfc dp fifo empty",
365 [2] = "audfc dp fifo overrun",
366 [3] = "audfc dip fifo full",
367 [4] = "audfc dp fifo empty cd",
368 [5] = "audfb dp fifo full",
369 [6] = "audfb dp fifo empty",
370 [7] = "audfb dp fifo overrun",
371 [8] = "audfb dip fifo full",
372 [9] = "audfb dp fifo empty cd",
373 [10] = "audfa dp fifo full",
374 [11] = "audfa dp fifo empty",
375 [12] = "audfa dp fifo overrun",
376 [13] = "audfa dip fifo full",
377 [14] = "audfa dp fifo empty cd",
378 [15] = "Pipe c audio overflow",
379 [16] = "Pipe b audio overflow",
380 [17] = "Pipe a audio overflow",
381 [31] = 0,
382};
383
Mengdong Lined386662014-02-28 13:25:27 -0500384#undef TRANSCODER_A
385#undef TRANSCODER_B
386#undef TRANSCODER_C
387
388enum {
389 TRANSCODER_A = 0,
390 TRANSCODER_B,
391 TRANSCODER_C,
392};
393
394enum {
395 PIPE_A = 0,
396 PIPE_B,
397 PIPE_C,
398};
399
400enum {
401 PORT_A = 0,
402 PORT_B,
403 PORT_C,
404 PORT_D,
405 PORT_E,
406};
407
408enum {
409 CONVERTER_1 = 0,
410 CONVERTER_2,
411 CONVERTER_3,
412};
413
Wu Fengguang020abdb2010-04-19 13:13:06 +0800414static void do_self_tests(void)
415{
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400416 if (BIT(1, 0) != 1)
417 exit(1);
418 if (BIT(0x80000000, 31) != 1)
419 exit(2);
420 if (BITS(0xc0000000, 31, 30) != 3)
421 exit(3);
Wu Fengguang020abdb2010-04-19 13:13:06 +0800422}
423
424/*
425 * EagleLake registers
426 */
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800427#define AUD_CONFIG 0x62000
428#define AUD_DEBUG 0x62010
429#define AUD_VID_DID 0x62020
430#define AUD_RID 0x62024
431#define AUD_SUBN_CNT 0x62028
432#define AUD_FUNC_GRP 0x62040
433#define AUD_SUBN_CNT2 0x62044
434#define AUD_GRP_CAP 0x62048
435#define AUD_PWRST 0x6204c
436#define AUD_SUPPWR 0x62050
437#define AUD_SID 0x62054
438#define AUD_OUT_CWCAP 0x62070
439#define AUD_OUT_PCMSIZE 0x62074
440#define AUD_OUT_STR 0x62078
441#define AUD_OUT_DIG_CNVT 0x6207c
442#define AUD_OUT_CH_STR 0x62080
443#define AUD_OUT_STR_DESC 0x62084
444#define AUD_PINW_CAP 0x620a0
445#define AUD_PIN_CAP 0x620a4
446#define AUD_PINW_CONNLNG 0x620a8
447#define AUD_PINW_CONNLST 0x620ac
448#define AUD_PINW_CNTR 0x620b0
449#define AUD_PINW_UNSOLRESP 0x620b8
450#define AUD_CNTL_ST 0x620b4
451#define AUD_PINW_CONFIG 0x620bc
452#define AUD_HDMIW_STATUS 0x620d4
453#define AUD_HDMIW_HDMIEDID 0x6210c
454#define AUD_HDMIW_INFOFR 0x62118
455#define AUD_CONV_CHCNT 0x62120
456#define AUD_CTS_ENABLE 0x62128
457
458#define VIDEO_DIP_CTL 0x61170
459#define VIDEO_DIP_ENABLE (1<<31)
460#define VIDEO_DIP_ENABLE_AVI (1<<21)
461#define VIDEO_DIP_ENABLE_VENDOR (1<<22)
462#define VIDEO_DIP_ENABLE_SPD (1<<24)
463#define VIDEO_DIP_BUF_AVI (0<<19)
464#define VIDEO_DIP_BUF_VENDOR (1<<19)
465#define VIDEO_DIP_BUF_SPD (3<<19)
466#define VIDEO_DIP_TRANS_ONCE (0<<16)
467#define VIDEO_DIP_TRANS_1 (1<<16)
468#define VIDEO_DIP_TRANS_2 (2<<16)
469
470#define AUDIO_HOTPLUG_EN (1<<24)
471
472
Wu Fengguang020abdb2010-04-19 13:13:06 +0800473static void dump_eaglelake(void)
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800474{
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400475 uint32_t dword;
476 int i;
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800477
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400478 /* printf("%-18s %8s %s\n\n", "register name", "raw value", "description"); */
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800479
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400480 dump_reg(VIDEO_DIP_CTL, "Video DIP Control");
481 dump_reg(SDVOB, "Digital Display Port B Control Register");
482 dump_reg(SDVOC, "Digital Display Port C Control Register");
483 dump_reg(PORT_HOTPLUG_EN, "Hot Plug Detect Enable");
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800484
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400485 dump_reg(AUD_CONFIG, "Audio Configuration");
486 dump_reg(AUD_DEBUG, "Audio Debug");
487 dump_reg(AUD_VID_DID, "Audio Vendor ID / Device ID");
488 dump_reg(AUD_RID, "Audio Revision ID");
489 dump_reg(AUD_SUBN_CNT, "Audio Subordinate Node Count");
490 dump_reg(AUD_FUNC_GRP, "Audio Function Group Type");
491 dump_reg(AUD_SUBN_CNT2, "Audio Subordinate Node Count");
492 dump_reg(AUD_GRP_CAP, "Audio Function Group Capabilities");
493 dump_reg(AUD_PWRST, "Audio Power State");
494 dump_reg(AUD_SUPPWR, "Audio Supported Power States");
495 dump_reg(AUD_SID, "Audio Root Node Subsystem ID");
496 dump_reg(AUD_OUT_CWCAP, "Audio Output Converter Widget Capabilities");
497 dump_reg(AUD_OUT_PCMSIZE, "Audio PCM Size and Rates");
498 dump_reg(AUD_OUT_STR, "Audio Stream Formats");
499 dump_reg(AUD_OUT_DIG_CNVT, "Audio Digital Converter");
500 dump_reg(AUD_OUT_CH_STR, "Audio Channel ID and Stream ID");
501 dump_reg(AUD_OUT_STR_DESC, "Audio Stream Descriptor Format");
502 dump_reg(AUD_PINW_CAP, "Audio Pin Complex Widget Capabilities");
503 dump_reg(AUD_PIN_CAP, "Audio Pin Capabilities");
504 dump_reg(AUD_PINW_CONNLNG, "Audio Connection List Length");
505 dump_reg(AUD_PINW_CONNLST, "Audio Connection List Entry");
506 dump_reg(AUD_PINW_CNTR, "Audio Pin Widget Control");
507 dump_reg(AUD_PINW_UNSOLRESP, "Audio Unsolicited Response Enable");
508 dump_reg(AUD_CNTL_ST, "Audio Control State Register");
509 dump_reg(AUD_PINW_CONFIG, "Audio Configuration Default");
510 dump_reg(AUD_HDMIW_STATUS, "Audio HDMI Status");
511 dump_reg(AUD_HDMIW_HDMIEDID, "Audio HDMI Data EDID Block");
512 dump_reg(AUD_HDMIW_INFOFR, "Audio HDMI Widget Data Island Packet");
513 dump_reg(AUD_CONV_CHCNT, "Audio Converter Channel Count");
514 dump_reg(AUD_CTS_ENABLE, "Audio CTS Programming Enable");
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800515
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400516 printf("\nDetails:\n\n");
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800517
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400518 dword = INREG(AUD_VID_DID);
519 printf("AUD_VID_DID vendor id\t\t\t0x%x\n", dword >> 16);
520 printf("AUD_VID_DID device id\t\t\t0x%x\n", dword & 0xffff);
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800521
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400522 dword = INREG(AUD_RID);
523 printf("AUD_RID major revision\t\t\t0x%lx\n", BITS(dword, 23, 20));
524 printf("AUD_RID minor revision\t\t\t0x%lx\n", BITS(dword, 19, 16));
525 printf("AUD_RID revision id\t\t\t0x%lx\n", BITS(dword, 15, 8));
526 printf("AUD_RID stepping id\t\t\t0x%lx\n", BITS(dword, 7, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800527
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400528 dword = INREG(SDVOB);
529 printf("SDVOB enable\t\t\t\t%u\n", !!(dword & SDVO_ENABLE));
530 printf("SDVOB HDMI encoding\t\t\t%u\n", !!(dword & SDVO_ENCODING_HDMI));
531 printf("SDVOB SDVO encoding\t\t\t%u\n", !!(dword & SDVO_ENCODING_SDVO));
532 printf("SDVOB null packets\t\t\t%u\n", !!(dword & SDVO_NULL_PACKETS_DURING_VSYNC));
533 printf("SDVOB audio enabled\t\t\t%u\n", !!(dword & SDVO_AUDIO_ENABLE));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800534
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400535 dword = INREG(SDVOC);
536 printf("SDVOC enable\t\t\t\t%u\n", !!(dword & SDVO_ENABLE));
537 printf("SDVOC HDMI encoding\t\t\t%u\n", !!(dword & SDVO_ENCODING_HDMI));
538 printf("SDVOC SDVO encoding\t\t\t%u\n", !!(dword & SDVO_ENCODING_SDVO));
539 printf("SDVOC null packets\t\t\t%u\n", !!(dword & SDVO_NULL_PACKETS_DURING_VSYNC));
540 printf("SDVOC audio enabled\t\t\t%u\n", !!(dword & SDVO_AUDIO_ENABLE));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800541
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400542 dword = INREG(PORT_HOTPLUG_EN);
543 printf("PORT_HOTPLUG_EN DisplayPort/HDMI port B\t%ld\n", BIT(dword, 29)),
544 printf("PORT_HOTPLUG_EN DisplayPort/HDMI port C\t%ld\n", BIT(dword, 28)),
545 printf("PORT_HOTPLUG_EN DisplayPort port D\t%ld\n", BIT(dword, 27)),
546 printf("PORT_HOTPLUG_EN SDVOB\t\t\t%ld\n", BIT(dword, 26)),
547 printf("PORT_HOTPLUG_EN SDVOC\t\t\t%ld\n", BIT(dword, 25)),
548 printf("PORT_HOTPLUG_EN audio\t\t\t%ld\n", BIT(dword, 24)),
549 printf("PORT_HOTPLUG_EN TV\t\t\t%ld\n", BIT(dword, 23)),
550 printf("PORT_HOTPLUG_EN CRT\t\t\t%ld\n", BIT(dword, 9)),
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800551
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400552 dword = INREG(VIDEO_DIP_CTL);
553 printf("VIDEO_DIP_CTL enable graphics DIP\t%ld\n", BIT(dword, 31)),
554 printf("VIDEO_DIP_CTL port select\t\t[0x%lx] %s\n",
555 BITS(dword, 30, 29), dip_port[BITS(dword, 30, 29)]);
556 printf("VIDEO_DIP_CTL DIP buffer trans active\t%lu\n", BIT(dword, 28));
557 printf("VIDEO_DIP_CTL AVI DIP enabled\t\t%lu\n", BIT(dword, 21));
558 printf("VIDEO_DIP_CTL vendor DIP enabled\t%lu\n", BIT(dword, 22));
559 printf("VIDEO_DIP_CTL SPD DIP enabled\t\t%lu\n", BIT(dword, 24));
560 printf("VIDEO_DIP_CTL DIP buffer index\t\t[0x%lx] %s\n",
561 BITS(dword, 20, 19), video_dip_index[BITS(dword, 20, 19)]);
562 printf("VIDEO_DIP_CTL DIP trans freq\t\t[0x%lx] %s\n",
563 BITS(dword, 17, 16), video_dip_trans[BITS(dword, 17, 16)]);
564 printf("VIDEO_DIP_CTL DIP buffer size\t\t%lu\n", BITS(dword, 11, 8));
565 printf("VIDEO_DIP_CTL DIP address\t\t%lu\n", BITS(dword, 3, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800566
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400567 dword = INREG(AUD_CONFIG);
568 printf("AUD_CONFIG pixel clock\t\t\t[0x%lx] %s\n", BITS(dword, 19, 16),
569 OPNAME(pixel_clock, BITS(dword, 19, 16)));
570 printf("AUD_CONFIG fabrication enabled\t\t%lu\n", BITS(dword, 2, 2));
571 printf("AUD_CONFIG professional use allowed\t%lu\n", BIT(dword, 1));
572 printf("AUD_CONFIG fuse enabled\t\t\t%lu\n", BIT(dword, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800573
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400574 dword = INREG(AUD_DEBUG);
575 printf("AUD_DEBUG function reset\t\t%lu\n", BIT(dword, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800576
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400577 dword = INREG(AUD_SUBN_CNT);
578 printf("AUD_SUBN_CNT starting node number\t0x%lx\n", BITS(dword, 23, 16));
579 printf("AUD_SUBN_CNT total number of nodes\t0x%lx\n", BITS(dword, 7, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800580
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400581 dword = INREG(AUD_SUBN_CNT2);
582 printf("AUD_SUBN_CNT2 starting node number\t0x%lx\n", BITS(dword, 24, 16));
583 printf("AUD_SUBN_CNT2 total number of nodes\t0x%lx\n", BITS(dword, 7, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800584
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400585 dword = INREG(AUD_FUNC_GRP);
586 printf("AUD_FUNC_GRP unsol capable\t\t%lu\n", BIT(dword, 8));
587 printf("AUD_FUNC_GRP node type\t\t\t0x%lx\n", BITS(dword, 7, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800588
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400589 dword = INREG(AUD_GRP_CAP);
590 printf("AUD_GRP_CAP beep 0\t\t\t%lu\n", BIT(dword, 16));
591 printf("AUD_GRP_CAP input delay\t\t\t%lu\n", BITS(dword, 11, 8));
592 printf("AUD_GRP_CAP output delay\t\t%lu\n", BITS(dword, 3, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800593
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400594 dword = INREG(AUD_PWRST);
595 printf("AUD_PWRST device power state\t\t%s\n",
596 power_state[BITS(dword, 5, 4)]);
597 printf("AUD_PWRST device power state setting\t%s\n",
598 power_state[BITS(dword, 1, 0)]);
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800599
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400600 dword = INREG(AUD_SUPPWR);
601 printf("AUD_SUPPWR support D0\t\t\t%lu\n", BIT(dword, 0));
602 printf("AUD_SUPPWR support D1\t\t\t%lu\n", BIT(dword, 1));
603 printf("AUD_SUPPWR support D2\t\t\t%lu\n", BIT(dword, 2));
604 printf("AUD_SUPPWR support D3\t\t\t%lu\n", BIT(dword, 3));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800605
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400606 dword = INREG(AUD_OUT_CWCAP);
607 printf("AUD_OUT_CWCAP widget type\t\t0x%lx\n", BITS(dword, 23, 20));
608 printf("AUD_OUT_CWCAP sample delay\t\t0x%lx\n", BITS(dword, 19, 16));
609 printf("AUD_OUT_CWCAP channel count\t\t%lu\n",
610 BITS(dword, 15, 13) * 2 + BIT(dword, 0) + 1);
611 printf("AUD_OUT_CWCAP L-R swap\t\t\t%lu\n", BIT(dword, 11));
612 printf("AUD_OUT_CWCAP power control\t\t%lu\n", BIT(dword, 10));
613 printf("AUD_OUT_CWCAP digital\t\t\t%lu\n", BIT(dword, 9));
614 printf("AUD_OUT_CWCAP conn list\t\t\t%lu\n", BIT(dword, 8));
615 printf("AUD_OUT_CWCAP unsol\t\t\t%lu\n", BIT(dword, 7));
616 printf("AUD_OUT_CWCAP mute\t\t\t%lu\n", BIT(dword, 5));
617 printf("AUD_OUT_CWCAP format override\t\t%lu\n", BIT(dword, 4));
618 printf("AUD_OUT_CWCAP amp param override\t%lu\n", BIT(dword, 3));
619 printf("AUD_OUT_CWCAP out amp present\t\t%lu\n", BIT(dword, 2));
620 printf("AUD_OUT_CWCAP in amp present\t\t%lu\n", BIT(dword, 1));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800621
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400622 dword = INREG(AUD_OUT_DIG_CNVT);
623 printf("AUD_OUT_DIG_CNVT SPDIF category\t\t0x%lx\n", BITS(dword, 14, 8));
624 printf("AUD_OUT_DIG_CNVT SPDIF level\t\t%lu\n", BIT(dword, 7));
625 printf("AUD_OUT_DIG_CNVT professional\t\t%lu\n", BIT(dword, 6));
626 printf("AUD_OUT_DIG_CNVT non PCM\t\t%lu\n", BIT(dword, 5));
627 printf("AUD_OUT_DIG_CNVT copyright asserted\t%lu\n", BIT(dword, 4));
628 printf("AUD_OUT_DIG_CNVT filter preemphasis\t%lu\n", BIT(dword, 3));
629 printf("AUD_OUT_DIG_CNVT validity config\t%lu\n", BIT(dword, 2));
630 printf("AUD_OUT_DIG_CNVT validity flag\t\t%lu\n", BIT(dword, 1));
631 printf("AUD_OUT_DIG_CNVT digital enable\t\t%lu\n", BIT(dword, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800632
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400633 dword = INREG(AUD_OUT_CH_STR);
634 printf("AUD_OUT_CH_STR stream id\t\t0x%lx\n", BITS(dword, 7, 4));
635 printf("AUD_OUT_CH_STR lowest channel\t\t%lu\n", BITS(dword, 3, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800636
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400637 dword = INREG(AUD_OUT_STR_DESC);
638 printf("AUD_OUT_STR_DESC stream channels\t%lu\n", BITS(dword, 3, 0) + 1);
639 printf("AUD_OUT_STR_DESC Bits per Sample\t[%#lx] %s\n",
640 BITS(dword, 6, 4), OPNAME(bits_per_sample, BITS(dword, 6, 4)));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800641
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400642 dword = INREG(AUD_PINW_CAP);
643 printf("AUD_PINW_CAP widget type\t\t0x%lx\n", BITS(dword, 23, 20));
644 printf("AUD_PINW_CAP sample delay\t\t0x%lx\n", BITS(dword, 19, 16));
645 printf("AUD_PINW_CAP channel count\t\t%lu\n",
646 BITS(dword, 15, 13) * 2 + BIT(dword, 0) + 1);
647 printf("AUD_PINW_CAP HDCP\t\t\t%lu\n", BIT(dword, 12));
648 printf("AUD_PINW_CAP L-R swap\t\t\t%lu\n", BIT(dword, 11));
649 printf("AUD_PINW_CAP power control\t\t%lu\n", BIT(dword, 10));
650 printf("AUD_PINW_CAP digital\t\t\t%lu\n", BIT(dword, 9));
651 printf("AUD_PINW_CAP conn list\t\t\t%lu\n", BIT(dword, 8));
652 printf("AUD_PINW_CAP unsol\t\t\t%lu\n", BIT(dword, 7));
653 printf("AUD_PINW_CAP mute\t\t\t%lu\n", BIT(dword, 5));
654 printf("AUD_PINW_CAP format override\t\t%lu\n", BIT(dword, 4));
655 printf("AUD_PINW_CAP amp param override\t\t%lu\n", BIT(dword, 3));
656 printf("AUD_PINW_CAP out amp present\t\t%lu\n", BIT(dword, 2));
657 printf("AUD_PINW_CAP in amp present\t\t%lu\n", BIT(dword, 1));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800658
659
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400660 dword = INREG(AUD_PIN_CAP);
661 printf("AUD_PIN_CAP EAPD\t\t\t%lu\n", BIT(dword, 16));
662 printf("AUD_PIN_CAP HDMI\t\t\t%lu\n", BIT(dword, 7));
663 printf("AUD_PIN_CAP output\t\t\t%lu\n", BIT(dword, 4));
664 printf("AUD_PIN_CAP presence detect\t\t%lu\n", BIT(dword, 2));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800665
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400666 dword = INREG(AUD_PINW_CNTR);
667 printf("AUD_PINW_CNTR mute status\t\t%lu\n", BIT(dword, 8));
668 printf("AUD_PINW_CNTR out enable\t\t%lu\n", BIT(dword, 6));
669 printf("AUD_PINW_CNTR amp mute status\t\t%lu\n", BIT(dword, 8));
670 printf("AUD_PINW_CNTR amp mute status\t\t%lu\n", BIT(dword, 8));
671 printf("AUD_PINW_CNTR stream type\t\t[0x%lx] %s\n",
672 BITS(dword, 2, 0),
673 OPNAME(stream_type, BITS(dword, 2, 0)));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800674
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400675 dword = INREG(AUD_PINW_UNSOLRESP);
676 printf("AUD_PINW_UNSOLRESP enable unsol resp\t%lu\n", BIT(dword, 31));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800677
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400678 dword = INREG(AUD_CNTL_ST);
679 printf("AUD_CNTL_ST DIP audio enabled\t\t%lu\n", BIT(dword, 21));
680 printf("AUD_CNTL_ST DIP ACP enabled\t\t%lu\n", BIT(dword, 22));
681 printf("AUD_CNTL_ST DIP ISRCx enabled\t\t%lu\n", BIT(dword, 23));
682 printf("AUD_CNTL_ST DIP port select\t\t[0x%lx] %s\n",
683 BITS(dword, 30, 29), dip_port[BITS(dword, 30, 29)]);
684 printf("AUD_CNTL_ST DIP buffer index\t\t[0x%lx] %s\n",
685 BITS(dword, 20, 18), OPNAME(dip_index, BITS(dword, 20, 18)));
686 printf("AUD_CNTL_ST DIP trans freq\t\t[0x%lx] %s\n",
687 BITS(dword, 17, 16), dip_trans[BITS(dword, 17, 16)]);
688 printf("AUD_CNTL_ST DIP address\t\t\t%lu\n", BITS(dword, 3, 0));
689 printf("AUD_CNTL_ST CP ready\t\t\t%lu\n", BIT(dword, 15));
690 printf("AUD_CNTL_ST ELD valid\t\t\t%lu\n", BIT(dword, 14));
691 printf("AUD_CNTL_ST ELD ack\t\t\t%lu\n", BIT(dword, 4));
692 printf("AUD_CNTL_ST ELD bufsize\t\t\t%lu\n", BITS(dword, 13, 9));
693 printf("AUD_CNTL_ST ELD address\t\t\t%lu\n", BITS(dword, 8, 5));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800694
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400695 dword = INREG(AUD_HDMIW_STATUS);
696 printf("AUD_HDMIW_STATUS CDCLK/DOTCLK underrun\t%lu\n", BIT(dword, 31));
697 printf("AUD_HDMIW_STATUS CDCLK/DOTCLK overrun\t%lu\n", BIT(dword, 30));
698 printf("AUD_HDMIW_STATUS BCLK/CDCLK underrun\t%lu\n", BIT(dword, 29));
699 printf("AUD_HDMIW_STATUS BCLK/CDCLK overrun\t%lu\n", BIT(dword, 28));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800700
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400701 dword = INREG(AUD_CONV_CHCNT);
702 printf("AUD_CONV_CHCNT HDMI HBR enabled\t\t%lu\n", BITS(dword, 15, 14));
703 printf("AUD_CONV_CHCNT HDMI channel count\t%lu\n", BITS(dword, 11, 8) + 1);
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800704
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400705 printf("AUD_CONV_CHCNT HDMI channel mapping:\n");
706 for (i = 0; i < 8; i++) {
707 OUTREG(AUD_CONV_CHCNT, i);
708 dword = INREG(AUD_CONV_CHCNT);
709 printf("\t\t\t\t\t[0x%x] %u => %lu\n", dword, i, BITS(dword, 7, 4));
710 }
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800711
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400712 printf("AUD_HDMIW_HDMIEDID HDMI ELD:\n\t");
713 dword = INREG(AUD_CNTL_ST);
714 dword &= ~BITMASK(8, 5);
715 OUTREG(AUD_CNTL_ST, dword);
716 for (i = 0; i < BITS(dword, 14, 10) / 4; i++)
717 printf("%08x ", htonl(INREG(AUD_HDMIW_HDMIEDID)));
718 printf("\n");
Wu Fengguangf32aecb2011-11-12 11:12:50 +0800719
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400720 printf("AUD_HDMIW_INFOFR HDMI audio Infoframe:\n\t");
721 dword = INREG(AUD_CNTL_ST);
722 dword &= ~BITMASK(20, 18);
723 dword &= ~BITMASK(3, 0);
724 OUTREG(AUD_CNTL_ST, dword);
725 for (i = 0; i < 8; i++)
726 printf("%08x ", htonl(INREG(AUD_HDMIW_INFOFR)));
727 printf("\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +0800728}
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800729
Wu Fengguang020abdb2010-04-19 13:13:06 +0800730#undef AUD_RID
731#undef AUD_VID_DID
732#undef AUD_PWRST
733#undef AUD_OUT_CH_STR
734#undef AUD_HDMIW_STATUS
735
736/*
Wu Fengguang020abdb2010-04-19 13:13:06 +0800737 * CougarPoint registers
738 */
Wu Fengguang97d20312011-11-12 11:12:45 +0800739#define DP_CTL_B 0xE4100
Wu Fengguang020abdb2010-04-19 13:13:06 +0800740#define DP_CTL_C 0xE4200
741#define DP_AUX_CTL_C 0xE4210
742#define DP_AUX_TST_C 0xE4228
743#define SPORT_DDI_CRC_C 0xE4250
744#define SPORT_DDI_CRC_R 0xE4264
745#define DP_CTL_D 0xE4300
746#define DP_AUX_CTL_D 0xE4310
747#define DP_AUX_TST_D 0xE4328
748#define SPORT_DDI_CRC_CTL_D 0xE4350
749#define AUD_CONFIG_A 0xE5000
750#define AUD_MISC_CTRL_A 0xE5010
751#define AUD_VID_DID 0xE5020
752#define AUD_RID 0xE5024
753#define AUD_CTS_ENABLE_A 0xE5028
754#define AUD_PWRST 0xE504C
755#define AUD_HDMIW_HDMIEDID_A 0xE5050
756#define AUD_HDMIW_INFOFR_A 0xE5054
757#define AUD_PORT_EN_HD_CFG 0xE507C
758#define AUD_OUT_DIG_CNVT_A 0xE5080
759#define AUD_OUT_STR_DESC_A 0xE5084
760#define AUD_OUT_CH_STR 0xE5088
761#define AUD_PINW_CONNLNG_LIST 0xE50A8
Mengdong Lin86d15e02014-03-03 13:52:06 -0500762#define AUD_PINW_CONNLNG_SEL 0xE50AC
Wu Fengguang020abdb2010-04-19 13:13:06 +0800763#define AUD_CNTL_ST_A 0xE50B4
764#define AUD_CNTRL_ST2 0xE50C0
765#define AUD_CNTRL_ST3 0xE50C4
766#define AUD_HDMIW_STATUS 0xE50D4
767#define AUD_CONFIG_B 0xE5100
768#define AUD_MISC_CTRL_B 0xE5110
769#define AUD_CTS_ENABLE_B 0xE5128
770#define AUD_HDMIW_HDMIEDID_B 0xE5150
771#define AUD_HDMIW_INFOFR_B 0xE5154
772#define AUD_OUT_DIG_CNVT_B 0xE5180
773#define AUD_OUT_STR_DESC_B 0xE5184
774#define AUD_CNTL_ST_B 0xE51B4
775#define AUD_CONFIG_C 0xE5200
776#define AUD_MISC_CTRL_C 0xE5210
777#define AUD_CTS_ENABLE_C 0xE5228
778#define AUD_HDMIW_HDMIEDID_C 0xE5250
779#define AUD_HDMIW_INFOFR_C 0xE5254
780#define AUD_OUT_DIG_CNVT_C 0xE5280
781#define AUD_OUT_STR_DESC_C 0xE5284
782#define AUD_CNTL_ST_C 0xE52B4
783#define AUD_CONFIG_D 0xE5300
784#define AUD_MISC_CTRL_D 0xE5310
785#define AUD_CTS_ENABLE_D 0xE5328
786#define AUD_HDMIW_HDMIEDID_D 0xE5350
787#define AUD_HDMIW_INFOFR_D 0xE5354
788#define AUD_OUT_DIG_CNVT_D 0xE5380
789#define AUD_OUT_STR_DESC_D 0xE5384
790#define AUD_CNTL_ST_D 0xE53B4
791
Wu Fengguange321f132011-11-12 11:12:52 +0800792#define VIDEO_DIP_CTL_A 0xE0200
793#define VIDEO_DIP_CTL_B 0xE1200
794#define VIDEO_DIP_CTL_C 0xE2200
795#define VIDEO_DIP_CTL_D 0xE3200
796
Wu Fengguang020abdb2010-04-19 13:13:06 +0800797
798static void dump_cpt(void)
799{
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400800 uint32_t dword;
801 int i;
Wu Fengguang020abdb2010-04-19 13:13:06 +0800802
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400803 dump_reg(HDMIB, "sDVO/HDMI Port B Control");
804 dump_reg(HDMIC, "HDMI Port C Control");
805 dump_reg(HDMID, "HDMI Port D Control");
806 dump_reg(DP_CTL_B, "DisplayPort B Control");
807 dump_reg(DP_CTL_C, "DisplayPort C Control");
808 dump_reg(DP_CTL_D, "DisplayPort D Control");
809 dump_reg(TRANS_DP_CTL_A, "Transcoder A DisplayPort Control");
810 dump_reg(TRANS_DP_CTL_B, "Transcoder B DisplayPort Control");
811 dump_reg(TRANS_DP_CTL_C, "Transcoder C DisplayPort Control");
812 dump_reg(AUD_CONFIG_A, "Audio Configuration - Transcoder A");
813 dump_reg(AUD_CONFIG_B, "Audio Configuration - Transcoder B");
814 dump_reg(AUD_CONFIG_C, "Audio Configuration - Transcoder C");
815 dump_reg(AUD_CTS_ENABLE_A, "Audio CTS Programming Enable - Transcoder A");
816 dump_reg(AUD_CTS_ENABLE_B, "Audio CTS Programming Enable - Transcoder B");
817 dump_reg(AUD_CTS_ENABLE_C, "Audio CTS Programming Enable - Transcoder C");
818 dump_reg(AUD_MISC_CTRL_A, "Audio MISC Control for Transcoder A");
819 dump_reg(AUD_MISC_CTRL_B, "Audio MISC Control for Transcoder B");
820 dump_reg(AUD_MISC_CTRL_C, "Audio MISC Control for Transcoder C");
821 dump_reg(AUD_VID_DID, "Audio Vendor ID / Device ID");
822 dump_reg(AUD_RID, "Audio Revision ID");
823 dump_reg(AUD_PWRST, "Audio Power State (Function Group, Convertor, Pin Widget)");
824 dump_reg(AUD_PORT_EN_HD_CFG, "Audio Port Enable HDAudio Config");
825 dump_reg(AUD_OUT_DIG_CNVT_A, "Audio Digital Converter - Conv A");
826 dump_reg(AUD_OUT_DIG_CNVT_B, "Audio Digital Converter - Conv B");
827 dump_reg(AUD_OUT_DIG_CNVT_C, "Audio Digital Converter - Conv C");
828 dump_reg(AUD_OUT_CH_STR, "Audio Channel ID and Stream ID");
829 dump_reg(AUD_OUT_STR_DESC_A, "Audio Stream Descriptor Format - Conv A");
830 dump_reg(AUD_OUT_STR_DESC_B, "Audio Stream Descriptor Format - Conv B");
831 dump_reg(AUD_OUT_STR_DESC_C, "Audio Stream Descriptor Format - Conv C");
832 dump_reg(AUD_PINW_CONNLNG_LIST, "Audio Connection List");
833 dump_reg(AUD_PINW_CONNLNG_SEL, "Audio Connection Select");
834 dump_reg(AUD_CNTL_ST_A, "Audio Control State Register - Transcoder A");
835 dump_reg(AUD_CNTL_ST_B, "Audio Control State Register - Transcoder B");
836 dump_reg(AUD_CNTL_ST_C, "Audio Control State Register - Transcoder C");
837 dump_reg(AUD_CNTRL_ST2, "Audio Control State 2");
838 dump_reg(AUD_CNTRL_ST3, "Audio Control State 3");
839 dump_reg(AUD_HDMIW_STATUS, "Audio HDMI Status");
840 dump_reg(AUD_HDMIW_HDMIEDID_A, "HDMI Data EDID Block - Transcoder A");
841 dump_reg(AUD_HDMIW_HDMIEDID_B, "HDMI Data EDID Block - Transcoder B");
842 dump_reg(AUD_HDMIW_HDMIEDID_C, "HDMI Data EDID Block - Transcoder C");
843 dump_reg(AUD_HDMIW_INFOFR_A, "Audio Widget Data Island Packet - Transcoder A");
844 dump_reg(AUD_HDMIW_INFOFR_B, "Audio Widget Data Island Packet - Transcoder B");
845 dump_reg(AUD_HDMIW_INFOFR_C, "Audio Widget Data Island Packet - Transcoder C");
Wu Fengguang020abdb2010-04-19 13:13:06 +0800846
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400847 printf("\nDetails:\n\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +0800848
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400849 dword = INREG(VIDEO_DIP_CTL_A);
850 printf("VIDEO_DIP_CTL_A Enable_Graphics_DIP\t\t\t%ld\n", BIT(dword, 31)),
851 printf("VIDEO_DIP_CTL_A GCP_DIP_enable\t\t\t\t%ld\n", BIT(dword, 25)),
852 printf("VIDEO_DIP_CTL_A Video_DIP_type_enable AVI\t\t%lu\n", BIT(dword, 21));
853 printf("VIDEO_DIP_CTL_A Video_DIP_type_enable Vendor\t\t%lu\n", BIT(dword, 22));
854 printf("VIDEO_DIP_CTL_A Video_DIP_type_enable Gamut\t\t%lu\n", BIT(dword, 23));
855 printf("VIDEO_DIP_CTL_A Video_DIP_type_enable Source \t\t%lu\n", BIT(dword, 24));
856 printf("VIDEO_DIP_CTL_A Video_DIP_buffer_index\t\t\t[0x%lx] %s\n",
857 BITS(dword, 20, 19), video_dip_index[BITS(dword, 20, 19)]);
858 printf("VIDEO_DIP_CTL_A Video_DIP_frequency\t\t\t[0x%lx] %s\n",
859 BITS(dword, 17, 16), video_dip_trans[BITS(dword, 17, 16)]);
860 printf("VIDEO_DIP_CTL_A Video_DIP_buffer_size\t\t\t%lu\n", BITS(dword, 11, 8));
861 printf("VIDEO_DIP_CTL_A Video_DIP_access_address\t\t%lu\n", BITS(dword, 3, 0));
Wu Fengguange321f132011-11-12 11:12:52 +0800862
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400863 dword = INREG(VIDEO_DIP_CTL_B);
864 printf("VIDEO_DIP_CTL_B Enable_Graphics_DIP\t\t\t%ld\n", BIT(dword, 31)),
865 printf("VIDEO_DIP_CTL_B GCP_DIP_enable\t\t\t\t%ld\n", BIT(dword, 25)),
866 printf("VIDEO_DIP_CTL_B Video_DIP_type_enable AVI\t\t%lu\n", BIT(dword, 21));
867 printf("VIDEO_DIP_CTL_B Video_DIP_type_enable Vendor\t\t%lu\n", BIT(dword, 22));
868 printf("VIDEO_DIP_CTL_B Video_DIP_type_enable Gamut\t\t%lu\n", BIT(dword, 23));
869 printf("VIDEO_DIP_CTL_B Video_DIP_type_enable Source \t\t%lu\n", BIT(dword, 24));
870 printf("VIDEO_DIP_CTL_B Video_DIP_buffer_index\t\t\t[0x%lx] %s\n",
871 BITS(dword, 20, 19), video_dip_index[BITS(dword, 20, 19)]);
872 printf("VIDEO_DIP_CTL_B Video_DIP_frequency\t\t\t[0x%lx] %s\n",
873 BITS(dword, 17, 16), video_dip_trans[BITS(dword, 17, 16)]);
874 printf("VIDEO_DIP_CTL_B Video_DIP_buffer_size\t\t\t%lu\n", BITS(dword, 11, 8));
875 printf("VIDEO_DIP_CTL_B Video_DIP_access_address\t\t%lu\n", BITS(dword, 3, 0));
Wu Fengguange321f132011-11-12 11:12:52 +0800876
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400877 dword = INREG(VIDEO_DIP_CTL_C);
878 printf("VIDEO_DIP_CTL_C Enable_Graphics_DIP\t\t\t%ld\n", BIT(dword, 31)),
879 printf("VIDEO_DIP_CTL_C GCP_DIP_enable\t\t\t\t%ld\n", BIT(dword, 25)),
880 printf("VIDEO_DIP_CTL_C Video_DIP_type_enable AVI\t\t%lu\n", BIT(dword, 21));
881 printf("VIDEO_DIP_CTL_C Video_DIP_type_enable Vendor\t\t%lu\n", BIT(dword, 22));
882 printf("VIDEO_DIP_CTL_C Video_DIP_type_enable Gamut\t\t%lu\n", BIT(dword, 23));
883 printf("VIDEO_DIP_CTL_C Video_DIP_type_enable Source \t\t%lu\n", BIT(dword, 24));
884 printf("VIDEO_DIP_CTL_C Video_DIP_buffer_index\t\t\t[0x%lx] %s\n",
885 BITS(dword, 20, 19), video_dip_index[BITS(dword, 20, 19)]);
886 printf("VIDEO_DIP_CTL_C Video_DIP_frequency\t\t\t[0x%lx] %s\n",
887 BITS(dword, 17, 16), video_dip_trans[BITS(dword, 17, 16)]);
888 printf("VIDEO_DIP_CTL_C Video_DIP_buffer_size\t\t\t%lu\n", BITS(dword, 11, 8));
889 printf("VIDEO_DIP_CTL_C Video_DIP_access_address\t\t%lu\n", BITS(dword, 3, 0));
Wu Fengguange321f132011-11-12 11:12:52 +0800890
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400891 dword = INREG(AUD_VID_DID);
892 printf("AUD_VID_DID vendor id\t\t\t\t\t0x%x\n", dword >> 16);
893 printf("AUD_VID_DID device id\t\t\t\t\t0x%x\n", dword & 0xffff);
Wu Fengguang020abdb2010-04-19 13:13:06 +0800894
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400895 dword = INREG(AUD_RID);
896 printf("AUD_RID Major_Revision\t\t\t\t\t0x%lx\n", BITS(dword, 23, 20));
897 printf("AUD_RID Minor_Revision\t\t\t\t\t0x%lx\n", BITS(dword, 19, 16));
898 printf("AUD_RID Revision_Id\t\t\t\t\t0x%lx\n", BITS(dword, 15, 8));
899 printf("AUD_RID Stepping_Id\t\t\t\t\t0x%lx\n", BITS(dword, 7, 0));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800900
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400901 dword = INREG(HDMIB);
902 printf("HDMIB Port_Enable\t\t\t\t\t%u\n", !!(dword & SDVO_ENABLE));
903 printf("HDMIB Transcoder_Select\t\t\t\t\t[0x%lx] %s\n",
904 BITS(dword, 30, 29), transcoder_select[BITS(dword, 30, 29)]);
905 printf("HDMIB sDVO_Border_Enable\t\t\t\t%lu\n", BIT(dword, 7));
906 printf("HDMIB HDCP_Port_Select\t\t\t\t\t%lu\n", BIT(dword, 5));
907 printf("HDMIB SDVO_HPD_Interrupt_Enable\t\t\t\t%lu\n", BIT(dword, 23));
908 printf("HDMIB Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
909 printf("HDMIB Encoding\t\t\t\t\t\t[0x%lx] %s\n",
910 BITS(dword, 11, 10), sdvo_hdmi_encoding[BITS(dword, 11, 10)]);
911 printf("HDMIB HDMI_or_DVI_Select\t\t\t\t%s\n", BIT(dword, 9) ? "HDMI" : "DVI");
912 printf("HDMIB Audio_Output_Enable\t\t\t\t%u\n", !!(dword & SDVO_AUDIO_ENABLE));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800913
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400914 dword = INREG(HDMIC);
915 printf("HDMIC Port_Enable\t\t\t\t\t%u\n", !!(dword & SDVO_ENABLE));
916 printf("HDMIC Transcoder_Select\t\t\t\t\t[0x%lx] %s\n",
917 BITS(dword, 30, 29), transcoder_select[BITS(dword, 30, 29)]);
918 printf("HDMIC sDVO_Border_Enable\t\t\t\t%lu\n", BIT(dword, 7));
919 printf("HDMIC HDCP_Port_Select\t\t\t\t\t%lu\n", BIT(dword, 5));
920 printf("HDMIC SDVO_HPD_Interrupt_Enable\t\t\t\t%lu\n", BIT(dword, 23));
921 printf("HDMIC Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
922 printf("HDMIC Encoding\t\t\t\t\t\t[0x%lx] %s\n",
923 BITS(dword, 11, 10), sdvo_hdmi_encoding[BITS(dword, 11, 10)]);
924 printf("HDMIC HDMI_or_DVI_Select\t\t\t\t%s\n", BIT(dword, 9) ? "HDMI" : "DVI");
925 printf("HDMIC Audio_Output_Enable\t\t\t\t%u\n", !!(dword & SDVO_AUDIO_ENABLE));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800926
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400927 dword = INREG(HDMID);
928 printf("HDMID Port_Enable\t\t\t\t\t%u\n", !!(dword & SDVO_ENABLE));
929 printf("HDMID Transcoder_Select\t\t\t\t\t[0x%lx] %s\n",
930 BITS(dword, 30, 29), transcoder_select[BITS(dword, 30, 29)]);
931 printf("HDMID sDVO_Border_Enable\t\t\t\t%lu\n", BIT(dword, 7));
932 printf("HDMID HDCP_Port_Select\t\t\t\t\t%lu\n", BIT(dword, 5));
933 printf("HDMID SDVO_HPD_Interrupt_Enable\t\t\t\t%lu\n", BIT(dword, 23));
934 printf("HDMID Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
935 printf("HDMID Encoding\t\t\t\t\t\t[0x%lx] %s\n",
936 BITS(dword, 11, 10), sdvo_hdmi_encoding[BITS(dword, 11, 10)]);
937 printf("HDMID HDMI_or_DVI_Select\t\t\t\t%s\n", BIT(dword, 9) ? "HDMI" : "DVI");
938 printf("HDMID Audio_Output_Enable\t\t\t\t%u\n", !!(dword & SDVO_AUDIO_ENABLE));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800939
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400940 dword = INREG(DP_CTL_B);
941 printf("DP_CTL_B DisplayPort_Enable\t\t\t\t%lu\n", BIT(dword, 31));
942 printf("DP_CTL_B Port_Width_Selection\t\t\t\t[0x%lx] %s\n",
943 BITS(dword, 21, 19), dp_port_width[BITS(dword, 21, 19)]);
944 printf("DP_CTL_B Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
945 printf("DP_CTL_B HDCP_Port_Select\t\t\t\t%lu\n", BIT(dword, 5));
946 printf("DP_CTL_B Audio_Output_Enable\t\t\t\t%lu\n", BIT(dword, 6));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800947
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400948 dword = INREG(DP_CTL_C);
949 printf("DP_CTL_C DisplayPort_Enable\t\t\t\t%lu\n", BIT(dword, 31));
950 printf("DP_CTL_C Port_Width_Selection\t\t\t\t[0x%lx] %s\n",
951 BITS(dword, 21, 19), dp_port_width[BITS(dword, 21, 19)]);
952 printf("DP_CTL_C Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
953 printf("DP_CTL_C HDCP_Port_Select\t\t\t\t%lu\n", BIT(dword, 5));
954 printf("DP_CTL_C Audio_Output_Enable\t\t\t\t%lu\n", BIT(dword, 6));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800955
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400956 dword = INREG(DP_CTL_D);
957 printf("DP_CTL_D DisplayPort_Enable\t\t\t\t%lu\n", BIT(dword, 31));
958 printf("DP_CTL_D Port_Width_Selection\t\t\t\t[0x%lx] %s\n",
959 BITS(dword, 21, 19), dp_port_width[BITS(dword, 21, 19)]);
960 printf("DP_CTL_D Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
961 printf("DP_CTL_D HDCP_Port_Select\t\t\t\t%lu\n", BIT(dword, 5));
962 printf("DP_CTL_D Audio_Output_Enable\t\t\t\t%lu\n", BIT(dword, 6));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800963
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400964 dword = INREG(AUD_CONFIG_A);
965 printf("AUD_CONFIG_A N_index_value\t\t\t\t[0x%lx] %s\n", BIT(dword, 29),
966 n_index_value[BIT(dword, 29)]);
967 printf("AUD_CONFIG_A N_programming_enable\t\t\t%lu\n", BIT(dword, 28));
968 printf("AUD_CONFIG_A Upper_N_value\t\t\t\t0x%02lx\n", BITS(dword, 27, 20));
969 printf("AUD_CONFIG_A Lower_N_value\t\t\t\t0x%03lx\n", BITS(dword, 15, 4));
970 printf("AUD_CONFIG_A Pixel_Clock_HDMI\t\t\t\t[0x%lx] %s\n", BITS(dword, 19, 16),
971 OPNAME(pixel_clock, BITS(dword, 19, 16)));
972 printf("AUD_CONFIG_A Disable_NCTS\t\t\t\t%lu\n", BIT(dword, 3));
973 dword = INREG(AUD_CONFIG_B);
974 printf("AUD_CONFIG_B N_index_value\t\t\t\t[0x%lx] %s\n", BIT(dword, 29),
975 n_index_value[BIT(dword, 29)]);
976 printf("AUD_CONFIG_B N_programming_enable\t\t\t%lu\n", BIT(dword, 28));
977 printf("AUD_CONFIG_B Upper_N_value\t\t\t\t0x%02lx\n", BITS(dword, 27, 20));
978 printf("AUD_CONFIG_B Lower_N_value\t\t\t\t0x%03lx\n", BITS(dword, 15, 4));
979 printf("AUD_CONFIG_B Pixel_Clock_HDMI\t\t\t\t[0x%lx] %s\n", BITS(dword, 19, 16),
980 OPNAME(pixel_clock, BITS(dword, 19, 16)));
981 printf("AUD_CONFIG_B Disable_NCTS\t\t\t\t%lu\n", BIT(dword, 3));
982 dword = INREG(AUD_CONFIG_C);
983 printf("AUD_CONFIG_C N_index_value\t\t\t\t[0x%lx] %s\n", BIT(dword, 29),
984 n_index_value[BIT(dword, 29)]);
985 printf("AUD_CONFIG_C N_programming_enable\t\t\t%lu\n", BIT(dword, 28));
986 printf("AUD_CONFIG_C Upper_N_value\t\t\t\t0x%02lx\n", BITS(dword, 27, 20));
987 printf("AUD_CONFIG_C Lower_N_value\t\t\t\t0x%03lx\n", BITS(dword, 15, 4));
988 printf("AUD_CONFIG_C Pixel_Clock_HDMI\t\t\t\t[0x%lx] %s\n", BITS(dword, 19, 16),
989 OPNAME(pixel_clock, BITS(dword, 19, 16)));
990 printf("AUD_CONFIG_C Disable_NCTS\t\t\t\t%lu\n", BIT(dword, 3));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800991
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400992 dword = INREG(AUD_CTS_ENABLE_A);
993 printf("AUD_CTS_ENABLE_A Enable_CTS_or_M_programming\t\t%lu\n", BIT(dword, 20));
994 printf("AUD_CTS_ENABLE_A CTS_M value Index\t\t\t%s\n", BIT(dword, 21) ? "CTS" : "M");
995 printf("AUD_CTS_ENABLE_A CTS_programming\t\t\t%#lx\n", BITS(dword, 19, 0));
996 dword = INREG(AUD_CTS_ENABLE_B);
997 printf("AUD_CTS_ENABLE_B Enable_CTS_or_M_programming\t\t%lu\n", BIT(dword, 20));
998 printf("AUD_CTS_ENABLE_B CTS_M value Index\t\t\t%s\n", BIT(dword, 21) ? "CTS" : "M");
999 printf("AUD_CTS_ENABLE_B CTS_programming\t\t\t%#lx\n", BITS(dword, 19, 0));
1000 dword = INREG(AUD_CTS_ENABLE_C);
1001 printf("AUD_CTS_ENABLE_C Enable_CTS_or_M_programming\t\t%lu\n", BIT(dword, 20));
1002 printf("AUD_CTS_ENABLE_C CTS_M value Index\t\t\t%s\n", BIT(dword, 21) ? "CTS" : "M");
1003 printf("AUD_CTS_ENABLE_C CTS_programming\t\t\t%#lx\n", BITS(dword, 19, 0));
Wu Fengguang020abdb2010-04-19 13:13:06 +08001004
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001005 dword = INREG(AUD_MISC_CTRL_A);
1006 printf("AUD_MISC_CTRL_A Sample_Fabrication_EN_bit\t\t%lu\n", BIT(dword, 2));
1007 printf("AUD_MISC_CTRL_A Sample_present_Disable\t\t\t%lu\n", BIT(dword, 8));
1008 printf("AUD_MISC_CTRL_A Output_Delay\t\t\t\t%lu\n", BITS(dword, 7, 4));
1009 printf("AUD_MISC_CTRL_A Pro_Allowed\t\t\t\t%lu\n", BIT(dword, 1));
1010 dword = INREG(AUD_MISC_CTRL_B);
1011 printf("AUD_MISC_CTRL_B Sample_Fabrication_EN_bit\t\t%lu\n", BIT(dword, 2));
1012 printf("AUD_MISC_CTRL_B Sample_present_Disable\t\t\t%lu\n", BIT(dword, 8));
1013 printf("AUD_MISC_CTRL_B Output_Delay\t\t\t\t%lu\n", BITS(dword, 7, 4));
1014 printf("AUD_MISC_CTRL_B Pro_Allowed\t\t\t\t%lu\n", BIT(dword, 1));
1015 dword = INREG(AUD_MISC_CTRL_C);
1016 printf("AUD_MISC_CTRL_C Sample_Fabrication_EN_bit\t\t%lu\n", BIT(dword, 2));
1017 printf("AUD_MISC_CTRL_C Sample_present_Disable\t\t\t%lu\n", BIT(dword, 8));
1018 printf("AUD_MISC_CTRL_C Output_Delay\t\t\t\t%lu\n", BITS(dword, 7, 4));
1019 printf("AUD_MISC_CTRL_C Pro_Allowed\t\t\t\t%lu\n", BIT(dword, 1));
Wu Fengguang020abdb2010-04-19 13:13:06 +08001020
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001021 dword = INREG(AUD_PWRST);
1022 printf("AUD_PWRST Func_Grp_Dev_PwrSt_Curr \t%s\n", power_state[BITS(dword, 27, 26)]);
1023 printf("AUD_PWRST Func_Grp_Dev_PwrSt_Set \t%s\n", power_state[BITS(dword, 25, 24)]);
1024 printf("AUD_PWRST ConvertorA_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 15, 14)]);
1025 printf("AUD_PWRST ConvertorA_Widget_Power_State_Requsted \t%s\n", power_state[BITS(dword, 13, 12)]);
1026 printf("AUD_PWRST ConvertorB_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 19, 18)]);
1027 printf("AUD_PWRST ConvertorB_Widget_Power_State_Requested \t%s\n", power_state[BITS(dword, 17, 16)]);
1028 printf("AUD_PWRST ConvC_Widget_PwrSt_Curr \t%s\n", power_state[BITS(dword, 23, 22)]);
1029 printf("AUD_PWRST ConvC_Widget_PwrSt_Req \t%s\n", power_state[BITS(dword, 21, 20)]);
1030 printf("AUD_PWRST PinB_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 3, 2)]);
1031 printf("AUD_PWRST PinB_Widget_Power_State_Set \t%s\n", power_state[BITS(dword, 1, 0)]);
1032 printf("AUD_PWRST PinC_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 7, 6)]);
1033 printf("AUD_PWRST PinC_Widget_Power_State_Set \t%s\n", power_state[BITS(dword, 5, 4)]);
1034 printf("AUD_PWRST PinD_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 11, 10)]);
1035 printf("AUD_PWRST PinD_Widget_Power_State_Set \t%s\n", power_state[BITS(dword, 9, 8)]);
Wu Fengguang020abdb2010-04-19 13:13:06 +08001036
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001037 dword = INREG(AUD_PORT_EN_HD_CFG);
1038 printf("AUD_PORT_EN_HD_CFG Convertor_A_Digen\t\t\t%lu\n", BIT(dword, 0));
1039 printf("AUD_PORT_EN_HD_CFG Convertor_B_Digen\t\t\t%lu\n", BIT(dword, 1));
1040 printf("AUD_PORT_EN_HD_CFG Convertor_C_Digen\t\t\t%lu\n", BIT(dword, 2));
1041 printf("AUD_PORT_EN_HD_CFG ConvertorA_Stream_ID\t\t%lu\n", BITS(dword, 7, 4));
1042 printf("AUD_PORT_EN_HD_CFG ConvertorB_Stream_ID\t\t%lu\n", BITS(dword, 11, 8));
1043 printf("AUD_PORT_EN_HD_CFG ConvertorC_Stream_ID\t\t%lu\n", BITS(dword, 15, 12));
1044 printf("AUD_PORT_EN_HD_CFG Port_B_Out_Enable\t\t\t%lu\n", BIT(dword, 16));
1045 printf("AUD_PORT_EN_HD_CFG Port_C_Out_Enable\t\t\t%lu\n", BIT(dword, 17));
1046 printf("AUD_PORT_EN_HD_CFG Port_D_Out_Enable\t\t\t%lu\n", BIT(dword, 18));
1047 printf("AUD_PORT_EN_HD_CFG Port_B_Amp_Mute_Status\t\t%lu\n", BIT(dword, 20));
1048 printf("AUD_PORT_EN_HD_CFG Port_C_Amp_Mute_Status\t\t%lu\n", BIT(dword, 21));
1049 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 +08001050
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001051 dword = INREG(AUD_OUT_DIG_CNVT_A);
1052 printf("AUD_OUT_DIG_CNVT_A V\t\t\t\t\t%lu\n", BIT(dword, 1));
1053 printf("AUD_OUT_DIG_CNVT_A VCFG\t\t\t\t%lu\n", BIT(dword, 2));
1054 printf("AUD_OUT_DIG_CNVT_A PRE\t\t\t\t\t%lu\n", BIT(dword, 3));
1055 printf("AUD_OUT_DIG_CNVT_A Copy\t\t\t\t%lu\n", BIT(dword, 4));
1056 printf("AUD_OUT_DIG_CNVT_A NonAudio\t\t\t\t%lu\n", BIT(dword, 5));
1057 printf("AUD_OUT_DIG_CNVT_A PRO\t\t\t\t\t%lu\n", BIT(dword, 6));
1058 printf("AUD_OUT_DIG_CNVT_A Level\t\t\t\t%lu\n", BIT(dword, 7));
1059 printf("AUD_OUT_DIG_CNVT_A Category_Code\t\t\t%lu\n", BITS(dword, 14, 8));
1060 printf("AUD_OUT_DIG_CNVT_A Lowest_Channel_Number\t\t%lu\n", BITS(dword, 19, 16));
1061 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 +08001062
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001063 dword = INREG(AUD_OUT_DIG_CNVT_B);
1064 printf("AUD_OUT_DIG_CNVT_B V\t\t\t\t\t%lu\n", BIT(dword, 1));
1065 printf("AUD_OUT_DIG_CNVT_B VCFG\t\t\t\t%lu\n", BIT(dword, 2));
1066 printf("AUD_OUT_DIG_CNVT_B PRE\t\t\t\t\t%lu\n", BIT(dword, 3));
1067 printf("AUD_OUT_DIG_CNVT_B Copy\t\t\t\t%lu\n", BIT(dword, 4));
1068 printf("AUD_OUT_DIG_CNVT_B NonAudio\t\t\t\t%lu\n", BIT(dword, 5));
1069 printf("AUD_OUT_DIG_CNVT_B PRO\t\t\t\t\t%lu\n", BIT(dword, 6));
1070 printf("AUD_OUT_DIG_CNVT_B Level\t\t\t\t%lu\n", BIT(dword, 7));
1071 printf("AUD_OUT_DIG_CNVT_B Category_Code\t\t\t%lu\n", BITS(dword, 14, 8));
1072 printf("AUD_OUT_DIG_CNVT_B Lowest_Channel_Number\t\t%lu\n", BITS(dword, 19, 16));
1073 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 +08001074
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001075 dword = INREG(AUD_OUT_DIG_CNVT_C);
1076 printf("AUD_OUT_DIG_CNVT_C V\t\t\t\t\t%lu\n", BIT(dword, 1));
1077 printf("AUD_OUT_DIG_CNVT_C VCFG\t\t\t\t%lu\n", BIT(dword, 2));
1078 printf("AUD_OUT_DIG_CNVT_C PRE\t\t\t\t\t%lu\n", BIT(dword, 3));
1079 printf("AUD_OUT_DIG_CNVT_C Copy\t\t\t\t%lu\n", BIT(dword, 4));
1080 printf("AUD_OUT_DIG_CNVT_C NonAudio\t\t\t\t%lu\n", BIT(dword, 5));
1081 printf("AUD_OUT_DIG_CNVT_C PRO\t\t\t\t\t%lu\n", BIT(dword, 6));
1082 printf("AUD_OUT_DIG_CNVT_C Level\t\t\t\t%lu\n", BIT(dword, 7));
1083 printf("AUD_OUT_DIG_CNVT_C Category_Code\t\t\t%lu\n", BITS(dword, 14, 8));
1084 printf("AUD_OUT_DIG_CNVT_C Lowest_Channel_Number\t\t%lu\n", BITS(dword, 19, 16));
1085 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 +08001086
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001087 printf("AUD_OUT_CH_STR Converter_Channel_MAP PORTB PORTC PORTD\n");
1088 for (i = 0; i < 8; i++) {
1089 OUTREG(AUD_OUT_CH_STR, i | (i << 8) | (i << 16));
1090 dword = INREG(AUD_OUT_CH_STR);
1091 printf("\t\t\t\t%lu\t%lu\t%lu\t%lu\n",
1092 1 + BITS(dword, 3, 0),
1093 1 + BITS(dword, 7, 4),
1094 1 + BITS(dword, 15, 12),
1095 1 + BITS(dword, 23, 20));
1096 }
Wu Fengguang020abdb2010-04-19 13:13:06 +08001097
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001098 dword = INREG(AUD_OUT_STR_DESC_A);
1099 printf("AUD_OUT_STR_DESC_A HBR_enable\t\t\t\t%lu\n", BITS(dword, 28, 27));
1100 printf("AUD_OUT_STR_DESC_A Convertor_Channel_Count\t\t%lu\n", BITS(dword, 20, 16) + 1);
1101 printf("AUD_OUT_STR_DESC_A Bits_per_Sample\t\t\t[%#lx] %s\n",
1102 BITS(dword, 6, 4), OPNAME(bits_per_sample, BITS(dword, 6, 4)));
1103 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 +08001104
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001105 dword = INREG(AUD_OUT_STR_DESC_B);
1106 printf("AUD_OUT_STR_DESC_B HBR_enable\t\t\t\t%lu\n", BITS(dword, 28, 27));
1107 printf("AUD_OUT_STR_DESC_B Convertor_Channel_Count\t\t%lu\n", BITS(dword, 20, 16) + 1);
1108 printf("AUD_OUT_STR_DESC_B Bits_per_Sample\t\t\t[%#lx] %s\n",
1109 BITS(dword, 6, 4), OPNAME(bits_per_sample, BITS(dword, 6, 4)));
1110 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 +08001111
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001112 dword = INREG(AUD_OUT_STR_DESC_C);
1113 printf("AUD_OUT_STR_DESC_C HBR_enable\t\t\t\t%lu\n", BITS(dword, 28, 27));
1114 printf("AUD_OUT_STR_DESC_C Convertor_Channel_Count\t\t%lu\n", BITS(dword, 20, 16) + 1);
1115 printf("AUD_OUT_STR_DESC_C Bits_per_Sample\t\t\t[%#lx] %s\n",
1116 BITS(dword, 6, 4), OPNAME(bits_per_sample, BITS(dword, 6, 4)));
1117 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 +08001118
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001119 dword = INREG(AUD_PINW_CONNLNG_SEL);
1120 printf("AUD_PINW_CONNLNG_SEL Connection_select_Control_B\t%#lx\n", BITS(dword, 7, 0));
1121 printf("AUD_PINW_CONNLNG_SEL Connection_select_Control_C\t%#lx\n", BITS(dword, 15, 8));
1122 printf("AUD_PINW_CONNLNG_SEL Connection_select_Control_D\t%#lx\n", BITS(dword, 23, 16));
Wu Fengguang020abdb2010-04-19 13:13:06 +08001123
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001124 dword = INREG(AUD_CNTL_ST_A);
1125 printf("AUD_CNTL_ST_A DIP_Port_Select\t\t\t\t[%#lx] %s\n",
1126 BITS(dword, 30, 29), dip_port[BITS(dword, 30, 29)]);
1127 printf("AUD_CNTL_ST_A DIP_type_enable_status Audio DIP\t\t%lu\n", BIT(dword, 21));
1128 printf("AUD_CNTL_ST_A DIP_type_enable_status ACP DIP\t\t%lu\n", BIT(dword, 22));
1129 printf("AUD_CNTL_ST_A DIP_type_enable_status Generic 2 DIP\t%lu\n", BIT(dword, 23));
1130 printf("AUD_CNTL_ST_A DIP_transmission_frequency\t\t[0x%lx] %s\n",
1131 BITS(dword, 17, 16), dip_trans[BITS(dword, 17, 16)]);
1132 printf("AUD_CNTL_ST_A ELD_ACK\t\t\t\t\t%lu\n", BIT(dword, 4));
1133 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 +08001134
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001135 dword = INREG(AUD_CNTL_ST_B);
1136 printf("AUD_CNTL_ST_B DIP_Port_Select\t\t\t\t[%#lx] %s\n",
1137 BITS(dword, 30, 29), dip_port[BITS(dword, 30, 29)]);
1138 printf("AUD_CNTL_ST_B DIP_type_enable_status Audio DIP\t\t%lu\n", BIT(dword, 21));
1139 printf("AUD_CNTL_ST_B DIP_type_enable_status ACP DIP\t\t%lu\n", BIT(dword, 22));
1140 printf("AUD_CNTL_ST_B DIP_type_enable_status Generic 2 DIP\t%lu\n", BIT(dword, 23));
1141 printf("AUD_CNTL_ST_B DIP_transmission_frequency\t\t[0x%lx] %s\n",
1142 BITS(dword, 17, 16), dip_trans[BITS(dword, 17, 16)]);
1143 printf("AUD_CNTL_ST_B ELD_ACK\t\t\t\t\t%lu\n", BIT(dword, 4));
1144 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 +08001145
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001146 dword = INREG(AUD_CNTL_ST_C);
1147 printf("AUD_CNTL_ST_C DIP_Port_Select\t\t\t\t[%#lx] %s\n",
1148 BITS(dword, 30, 29), dip_port[BITS(dword, 30, 29)]);
1149 printf("AUD_CNTL_ST_C DIP_type_enable_status Audio DIP\t\t%lu\n", BIT(dword, 21));
1150 printf("AUD_CNTL_ST_C DIP_type_enable_status ACP DIP\t\t%lu\n", BIT(dword, 22));
1151 printf("AUD_CNTL_ST_C DIP_type_enable_status Generic 2 DIP\t%lu\n", BIT(dword, 23));
1152 printf("AUD_CNTL_ST_C DIP_transmission_frequency\t\t[0x%lx] %s\n",
1153 BITS(dword, 17, 16), dip_trans[BITS(dword, 17, 16)]);
1154 printf("AUD_CNTL_ST_C ELD_ACK\t\t\t\t\t%lu\n", BIT(dword, 4));
1155 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 +08001156
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001157 dword = INREG(AUD_CNTRL_ST2);
1158 printf("AUD_CNTRL_ST2 CP_ReadyB\t\t\t\t%lu\n", BIT(dword, 1));
1159 printf("AUD_CNTRL_ST2 ELD_validB\t\t\t\t%lu\n", BIT(dword, 0));
1160 printf("AUD_CNTRL_ST2 CP_ReadyC\t\t\t\t%lu\n", BIT(dword, 5));
1161 printf("AUD_CNTRL_ST2 ELD_validC\t\t\t\t%lu\n", BIT(dword, 4));
1162 printf("AUD_CNTRL_ST2 CP_ReadyD\t\t\t\t%lu\n", BIT(dword, 9));
1163 printf("AUD_CNTRL_ST2 ELD_validD\t\t\t\t%lu\n", BIT(dword, 8));
Wu Fengguang020abdb2010-04-19 13:13:06 +08001164
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001165 dword = INREG(AUD_CNTRL_ST3);
1166 printf("AUD_CNTRL_ST3 TransA_DPT_Audio_Output_En\t\t%lu\n", BIT(dword, 3));
1167 printf("AUD_CNTRL_ST3 TransA_to_Port_Sel\t\t\t[%#lx] %s\n",
1168 BITS(dword, 2, 0), trans_to_port_sel[BITS(dword, 2, 0)]);
1169 printf("AUD_CNTRL_ST3 TransB_DPT_Audio_Output_En\t\t%lu\n", BIT(dword, 7));
1170 printf("AUD_CNTRL_ST3 TransB_to_Port_Sel\t\t\t[%#lx] %s\n",
1171 BITS(dword, 6, 4), trans_to_port_sel[BITS(dword, 6, 4)]);
1172 printf("AUD_CNTRL_ST3 TransC_DPT_Audio_Output_En\t\t%lu\n", BIT(dword, 11));
1173 printf("AUD_CNTRL_ST3 TransC_to_Port_Sel\t\t\t[%#lx] %s\n",
1174 BITS(dword, 10, 8), trans_to_port_sel[BITS(dword, 10, 8)]);
Wu Fengguang020abdb2010-04-19 13:13:06 +08001175
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001176 dword = INREG(AUD_HDMIW_STATUS);
1177 printf("AUD_HDMIW_STATUS Conv_A_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 27));
1178 printf("AUD_HDMIW_STATUS Conv_A_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n", BIT(dword, 26));
1179 printf("AUD_HDMIW_STATUS Conv_B_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 29));
1180 printf("AUD_HDMIW_STATUS Conv_B_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n", BIT(dword, 28));
1181 printf("AUD_HDMIW_STATUS Conv_C_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 31));
1182 printf("AUD_HDMIW_STATUS Conv_C_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n", BIT(dword, 30));
1183 printf("AUD_HDMIW_STATUS BCLK/CDCLK_FIFO_Overrun\t\t%lu\n", BIT(dword, 25));
1184 printf("AUD_HDMIW_STATUS Function_Reset\t\t\t%lu\n", BIT(dword, 24));
Wu Fengguang020abdb2010-04-19 13:13:06 +08001185
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001186 printf("AUD_HDMIW_HDMIEDID_A HDMI ELD:\n\t");
1187 dword = INREG(AUD_CNTL_ST_A);
1188 dword &= ~BITMASK(9, 5);
1189 OUTREG(AUD_CNTL_ST_A, dword);
1190 for (i = 0; i < BITS(dword, 14, 10) / 4; i++)
1191 printf("%08x ", htonl(INREG(AUD_HDMIW_HDMIEDID_A)));
1192 printf("\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +08001193
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001194 printf("AUD_HDMIW_HDMIEDID_B HDMI ELD:\n\t");
1195 dword = INREG(AUD_CNTL_ST_B);
1196 dword &= ~BITMASK(9, 5);
1197 OUTREG(AUD_CNTL_ST_B, dword);
1198 for (i = 0; i < BITS(dword, 14, 10) / 4; i++)
1199 printf("%08x ", htonl(INREG(AUD_HDMIW_HDMIEDID_B)));
1200 printf("\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +08001201
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001202 printf("AUD_HDMIW_HDMIEDID_C HDMI ELD:\n\t");
1203 dword = INREG(AUD_CNTL_ST_C);
1204 dword &= ~BITMASK(9, 5);
1205 OUTREG(AUD_CNTL_ST_C, dword);
1206 for (i = 0; i < BITS(dword, 14, 10) / 4; i++)
1207 printf("%08x ", htonl(INREG(AUD_HDMIW_HDMIEDID_C)));
1208 printf("\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +08001209
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001210 printf("AUD_HDMIW_INFOFR_A HDMI audio Infoframe:\n\t");
1211 dword = INREG(AUD_CNTL_ST_A);
1212 dword &= ~BITMASK(20, 18);
1213 dword &= ~BITMASK(3, 0);
1214 OUTREG(AUD_CNTL_ST_A, dword);
1215 for (i = 0; i < 8; i++)
1216 printf("%08x ", htonl(INREG(AUD_HDMIW_INFOFR_A)));
1217 printf("\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +08001218
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001219 printf("AUD_HDMIW_INFOFR_B HDMI audio Infoframe:\n\t");
1220 dword = INREG(AUD_CNTL_ST_B);
1221 dword &= ~BITMASK(20, 18);
1222 dword &= ~BITMASK(3, 0);
1223 OUTREG(AUD_CNTL_ST_B, dword);
1224 for (i = 0; i < 8; i++)
1225 printf("%08x ", htonl(INREG(AUD_HDMIW_INFOFR_B)));
1226 printf("\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +08001227
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001228 printf("AUD_HDMIW_INFOFR_C HDMI audio Infoframe:\n\t");
1229 dword = INREG(AUD_CNTL_ST_C);
1230 dword &= ~BITMASK(20, 18);
1231 dword &= ~BITMASK(3, 0);
1232 OUTREG(AUD_CNTL_ST_C, dword);
1233 for (i = 0; i < 8; i++)
1234 printf("%08x ", htonl(INREG(AUD_HDMIW_INFOFR_C)));
1235 printf("\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +08001236
1237}
1238
Mengdong Lin86d15e02014-03-03 13:52:06 -05001239/* Audio config registers of Ironlake */
Wang Xingchaoc4077222012-08-15 16:13:38 +08001240#undef AUD_CONFIG_A
Mengdong Lin86d15e02014-03-03 13:52:06 -05001241#undef AUD_CONFIG_B
Wang Xingchaoc4077222012-08-15 16:13:38 +08001242#undef AUD_MISC_CTRL_A
Mengdong Lin86d15e02014-03-03 13:52:06 -05001243#undef AUD_MISC_CTRL_B
Wang Xingchaoc4077222012-08-15 16:13:38 +08001244#undef AUD_VID_DID
1245#undef AUD_RID
1246#undef AUD_CTS_ENABLE_A
Mengdong Lin86d15e02014-03-03 13:52:06 -05001247#undef AUD_CTS_ENABLE_B
Wang Xingchaoc4077222012-08-15 16:13:38 +08001248#undef AUD_PWRST
1249#undef AUD_HDMIW_HDMIEDID_A
Mengdong Lin86d15e02014-03-03 13:52:06 -05001250#undef AUD_HDMIW_HDMIEDID_B
Wang Xingchaoc4077222012-08-15 16:13:38 +08001251#undef AUD_HDMIW_INFOFR_A
Mengdong Lin86d15e02014-03-03 13:52:06 -05001252#undef AUD_HDMIW_INFOFR_B
Wang Xingchaoc4077222012-08-15 16:13:38 +08001253#undef AUD_PORT_EN_HD_CFG
1254#undef AUD_OUT_DIG_CNVT_A
Mengdong Lin86d15e02014-03-03 13:52:06 -05001255#undef AUD_OUT_DIG_CNVT_B
Wang Xingchaoc4077222012-08-15 16:13:38 +08001256#undef AUD_OUT_STR_DESC_A
Mengdong Lin86d15e02014-03-03 13:52:06 -05001257#undef AUD_OUT_STR_DESC_B
Wang Xingchaoc4077222012-08-15 16:13:38 +08001258#undef AUD_OUT_CH_STR
1259#undef AUD_PINW_CONNLNG_LIST
Mengdong Lindeba8682013-09-09 15:38:40 -04001260#undef AUD_PINW_CONNLNG_SEL
Wang Xingchaoc4077222012-08-15 16:13:38 +08001261#undef AUD_CNTL_ST_A
Wang Xingchaoc4077222012-08-15 16:13:38 +08001262#undef AUD_CNTL_ST_B
Mengdong Lin86d15e02014-03-03 13:52:06 -05001263#undef AUD_CNTL_ST2
1264#undef AUD_HDMIW_STATUS
Wang Xingchaoc4077222012-08-15 16:13:38 +08001265
Mengdong Lin86d15e02014-03-03 13:52:06 -05001266#define PIPE_OFS 0x100
Wang Xingchaoc4077222012-08-15 16:13:38 +08001267
Mengdong Lin86d15e02014-03-03 13:52:06 -05001268#define AUD_CONFIG_A 0x0
1269#define AUD_CONFIG_B (AUD_CONFIG_A + PIPE_OFS)
1270#define AUD_MISC_CTRL_A 0x010
1271#define AUD_MISC_CTRL_B (AUD_MISC_CTRL_A + PIPE_OFS)
1272#define AUD_VID_DID 0x020
1273#define AUD_RID 0x024
1274#define AUD_CTS_ENABLE_A 0x028
1275#define AUD_CTS_ENABLE_B (AUD_CTS_ENABLE_A + PIPE_OFS)
1276#define AUD_PWRST 0x04C
1277#define AUD_HDMIW_HDMIEDID_A 0x050
1278#define AUD_HDMIW_HDMIEDID_B (AUD_HDMIW_HDMIEDID_A + PIPE_OFS)
1279#define AUD_HDMIW_INFOFR_A 0x054
1280#define AUD_HDMIW_INFOFR_B (AUD_HDMIW_INFOFR_A + PIPE_OFS)
1281#define AUD_PORT_EN_HD_CFG 0x07c
1282#define AUD_OUT_DIG_CNVT_A 0x080
1283#define AUD_OUT_DIG_CNVT_B (AUD_OUT_DIG_CNVT_A + PIPE_OFS)
1284#define AUD_OUT_STR_DESC_A 0x084
1285#define AUD_OUT_STR_DESC_B (AUD_OUT_STR_DESC_A + PIPE_OFS)
1286#define AUD_OUT_CH_STR 0x088
1287#define AUD_PINW_CONNLNG_LIST 0x0a8
1288#define AUD_PINW_CONNLNG_SEL 0x0aC
1289#define AUD_CNTL_ST_A 0x0b4
1290#define AUD_CNTL_ST_B (AUD_CNTL_ST_A + PIPE_OFS)
1291#define AUD_CNTL_ST2 0x0c0
1292#define AUD_HDMIW_STATUS 0x0d4
Wang Xingchaoc4077222012-08-15 16:13:38 +08001293
Mengdong Lin86d15e02014-03-03 13:52:06 -05001294/* Audio config registers of Haswell+ */
1295#define AUD_TCA_CONFIG AUD_CONFIG_A
1296#define AUD_TCB_CONFIG (AUD_TCA_CONFIG + PIPE_OFS)
1297#define AUD_TCC_CONFIG (AUD_TCA_CONFIG + PIPE_OFS * 2)
1298#define AUD_C1_MISC_CTRL AUD_MISC_CTRL_A
1299#define AUD_C2_MISC_CTRL (AUD_MISC_CTRL_A + PIPE_OFS)
1300#define AUD_C3_MISC_CTRL (AUD_MISC_CTRL_A + PIPE_OFS * 2)
1301#define AUD_TCA_M_CTS_ENABLE AUD_CTS_ENABLE_A
1302#define AUD_TCB_M_CTS_ENABLE (AUD_TCA_M_CTS_ENABLE + PIPE_OFS)
1303#define AUD_TCC_M_CTS_ENABLE (AUD_TCA_M_CTS_ENABLE + PIPE_OFS * 2)
1304#define AUD_TCA_EDID_DATA AUD_HDMIW_HDMIEDID_A
1305#define AUD_TCB_EDID_DATA (AUD_TCA_EDID_DATA + PIPE_OFS)
1306#define AUD_TCC_EDID_DATA (AUD_TCA_EDID_DATA + PIPE_OFS * 2)
1307#define AUD_TCA_INFOFR AUD_HDMIW_INFOFR_A
1308#define AUD_TCB_INFOFR (AUD_TCA_INFOFR + PIPE_OFS)
1309#define AUD_TCC_INFOFR (AUD_TCA_INFOFR + PIPE_OFS * 2)
1310#define AUD_PIPE_CONV_CFG AUD_PORT_EN_HD_CFG
1311#define AUD_C1_DIG_CNVT AUD_OUT_DIG_CNVT_A
1312#define AUD_C2_DIG_CNVT (AUD_C1_DIG_CNVT + PIPE_OFS)
1313#define AUD_C3_DIG_CNVT (AUD_C1_DIG_CNVT + PIPE_OFS * 2)
1314#define AUD_C1_STR_DESC AUD_OUT_STR_DESC_A
1315#define AUD_C2_STR_DESC (AUD_C1_STR_DESC + PIPE_OFS)
1316#define AUD_C3_STR_DESC (AUD_C1_STR_DESC + PIPE_OFS * 2)
1317#define AUD_OUT_CHAN_MAP AUD_OUT_CH_STR
1318#define AUD_TCA_PIN_PIPE_CONN_ENTRY_LNGTH AUD_PINW_CONNLNG_LIST
1319#define AUD_TCB_PIN_PIPE_CONN_ENTRY_LNGTH (AUD_TCA_PIN_PIPE_CONN_ENTRY_LNGTH + PIPE_OFS)
1320#define AUD_TCC_PIN_PIPE_CONN_ENTRY_LNGTH (AUD_TCA_PIN_PIPE_CONN_ENTRY_LNGTH + PIPE_OFS * 2)
1321#define AUD_PIPE_CONN_SEL_CTRL AUD_PINW_CONNLNG_SEL
1322#define AUD_TCA_DIP_ELD_CTRL_ST AUD_CNTL_ST_A
1323#define AUD_TCB_DIP_ELD_CTRL_ST (AUD_TCA_DIP_ELD_CTRL_ST + PIPE_OFS)
1324#define AUD_TCC_DIP_ELD_CTRL_ST (AUD_TCA_DIP_ELD_CTRL_ST + PIPE_OFS * 2)
1325#define AUD_PIN_ELD_CP_VLD AUD_CNTL_ST2
1326#define AUD_HDMI_FIFO_STATUS AUD_HDMIW_STATUS
1327#define AUD_ICOI 0xf00
1328#define AUD_IRII 0xf04
1329#define AUD_ICS 0xf08
1330#define AUD_CHICKENBIT_REG 0xf10
1331#define AUD_DP_DIP_STATUS 0xf20
1332#define AUD_TCA_M_CTS 0xf44
1333#define AUD_TCB_M_CTS 0xf54
1334#define AUD_TCC_M_CTS 0xf64
Wang Xingchaoc4077222012-08-15 16:13:38 +08001335
Mengdong Lin86d15e02014-03-03 13:52:06 -05001336/* Common functions to dump audio registers */
Mengdong Lindeba8682013-09-09 15:38:40 -04001337#define MAX_PREFIX_SIZE 128
1338
Mengdong Lin86d15e02014-03-03 13:52:06 -05001339static void dump_aud_config(int index)
Mengdong Lindeba8682013-09-09 15:38:40 -04001340{
1341 uint32_t dword;
1342 char prefix[MAX_PREFIX_SIZE];
1343
Mengdong Lin86d15e02014-03-03 13:52:06 -05001344 if (!IS_HASWELL_PLUS(devid)) {
1345 dword = INREG(aud_reg_base + AUD_CONFIG_A + (index - PIPE_A) * 0x100);
1346 sprintf(prefix, "AUD_CONFIG_%c ", 'A' + index - PIPE_A);
1347 } else {
1348 dword = INREG(aud_reg_base + AUD_TCA_CONFIG + (index - TRANSCODER_A) * 0x100);
1349 sprintf(prefix, "AUD_TC%c_CONFIG", 'A' + index - TRANSCODER_A);
1350 }
Mengdong Lindeba8682013-09-09 15:38:40 -04001351
Mengdong Linfa8c7502014-03-04 10:13:09 -05001352 printf("%s Disable_NCTS\t\t\t\t%lu\n", prefix, BIT(dword, 3));
1353 printf("%s Lower_N_value\t\t\t\t0x%03lx\n", prefix, BITS(dword, 15, 4));
Mengdong Lindeba8682013-09-09 15:38:40 -04001354 printf("%s Pixel_Clock_HDMI\t\t\t[0x%lx] %s\n", prefix, BITS(dword, 19, 16),
1355 OPNAME(pixel_clock, BITS(dword, 19, 16)));
Mengdong Linfa8c7502014-03-04 10:13:09 -05001356 printf("%s Upper_N_value\t\t\t\t0x%02lx\n", prefix, BITS(dword, 27, 20));
1357 printf("%s N_programming_enable\t\t\t%lu\n", prefix, BIT(dword, 28));
1358 printf("%s N_index_value\t\t\t\t[0x%lx] %s\n", prefix, BIT(dword, 29),
Mengdong Lindeba8682013-09-09 15:38:40 -04001359 OPNAME(n_index_value, BIT(dword, 29)));
1360}
1361
Mengdong Lin86d15e02014-03-03 13:52:06 -05001362static void dump_aud_misc_control(int index)
Mengdong Lindeba8682013-09-09 15:38:40 -04001363{
1364 uint32_t dword;
1365 char prefix[MAX_PREFIX_SIZE];
1366
Mengdong Lin86d15e02014-03-03 13:52:06 -05001367 if (!IS_HASWELL_PLUS(devid)) {
1368 dword = INREG(aud_reg_base + AUD_MISC_CTRL_A + (index - PIPE_A) * 0x100);
1369 sprintf(prefix, "AUD_MISC_CTRL_%c ", 'A' + index - PIPE_A);
1370 } else {
1371 dword = INREG(aud_reg_base + AUD_C1_MISC_CTRL + (index - CONVERTER_1) * 0x100);
1372 sprintf(prefix, "AUD_C%c_MISC_CTRL", '1' + index - CONVERTER_1);
1373 }
Mengdong Lindeba8682013-09-09 15:38:40 -04001374
Mengdong Linfa8c7502014-03-04 10:13:09 -05001375 printf("%s Pro_Allowed\t\t\t\t%lu\n", prefix, BIT(dword, 1));
Mengdong Lindeba8682013-09-09 15:38:40 -04001376 printf("%s Sample_Fabrication_EN_bit\t\t%lu\n", prefix, BIT(dword, 2));
Mengdong Linfa8c7502014-03-04 10:13:09 -05001377 printf("%s Output_Delay\t\t\t\t%lu\n", prefix, BITS(dword, 7, 4));
1378 printf("%s Sample_present_Disable\t\t%lu\n", prefix, BIT(dword, 8));
Mengdong Lindeba8682013-09-09 15:38:40 -04001379}
1380
1381static void dump_aud_vendor_device_id(void)
1382{
1383 uint32_t dword;
1384
Mengdong Lin86d15e02014-03-03 13:52:06 -05001385 dword = INREG(aud_reg_base + AUD_VID_DID);
Mengdong Lindeba8682013-09-09 15:38:40 -04001386 printf("AUD_VID_DID device id\t\t\t\t\t0x%lx\n", BITS(dword, 15, 0));
1387 printf("AUD_VID_DID vendor id\t\t\t\t\t0x%lx\n", BITS(dword, 31, 16));
1388}
1389
1390static void dump_aud_revision_id(void)
1391{
1392 uint32_t dword;
1393
Mengdong Lin86d15e02014-03-03 13:52:06 -05001394 dword = INREG(aud_reg_base + AUD_RID);
Mengdong Lindeba8682013-09-09 15:38:40 -04001395 printf("AUD_RID Stepping_Id\t\t\t\t\t0x%lx\n", BITS(dword, 7, 0));
1396 printf("AUD_RID Revision_Id\t\t\t\t\t0x%lx\n", BITS(dword, 15, 8));
1397 printf("AUD_RID Minor_Revision\t\t\t\t\t0x%lx\n", BITS(dword, 19, 16));
1398 printf("AUD_RID Major_Revision\t\t\t\t\t0x%lx\n", BITS(dword, 23, 20));
1399}
1400
Mengdong Lin86d15e02014-03-03 13:52:06 -05001401static void dump_aud_m_cts_enable(int index)
Mengdong Lindeba8682013-09-09 15:38:40 -04001402{
1403 uint32_t dword;
1404 char prefix[MAX_PREFIX_SIZE];
1405
Mengdong Lin86d15e02014-03-03 13:52:06 -05001406 if (!IS_HASWELL_PLUS(devid)) {
1407 dword = INREG(aud_reg_base + AUD_CTS_ENABLE_A + (index - PIPE_A) * 0x100);
1408 sprintf(prefix, "AUD_CTS_ENABLE_%c ", 'A' + index - PIPE_A);
1409 } else {
1410 dword = INREG(aud_reg_base + AUD_TCA_M_CTS_ENABLE + (index - TRANSCODER_A) * 0x100);
1411 sprintf(prefix, "AUD_TC%c_M_CTS_ENABLE", 'A' + index - TRANSCODER_A);
1412 }
Mengdong Lindeba8682013-09-09 15:38:40 -04001413
Mengdong Linfa8c7502014-03-04 10:13:09 -05001414 printf("%s CTS_programming\t\t\t%#lx\n", prefix, BITS(dword, 19, 0));
Mengdong Lindeba8682013-09-09 15:38:40 -04001415 printf("%s Enable_CTS_or_M_programming\t%lu\n", prefix, BIT(dword, 20));
Mengdong Lin8fe0c502014-03-13 16:38:02 -04001416 printf("%s CTS_M value Index\t\t\t[0x%lx] %s\n",prefix, BIT(dword, 21),
1417 OPNAME(cts_m_value_index, BIT(dword, 21)));
Mengdong Lindeba8682013-09-09 15:38:40 -04001418}
1419
1420static void dump_aud_power_state(void)
1421{
1422 uint32_t dword;
Mengdong Lin86d15e02014-03-03 13:52:06 -05001423 int num_pipes;
Mengdong Lindeba8682013-09-09 15:38:40 -04001424
Mengdong Lin86d15e02014-03-03 13:52:06 -05001425 dword = INREG(aud_reg_base + AUD_PWRST);
Mengdong Linfa8c7502014-03-04 10:13:09 -05001426 printf("AUD_PWRST PinB_Widget_Power_State_Set \t%s\n", power_state[BITS(dword, 1, 0)]);
1427 printf("AUD_PWRST PinB_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 3, 2)]);
1428 printf("AUD_PWRST PinC_Widget_Power_State_Set \t%s\n", power_state[BITS(dword, 5, 4)]);
1429 printf("AUD_PWRST PinC_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 7, 6)]);
1430 printf("AUD_PWRST PinD_Widget_Power_State_Set \t%s\n", power_state[BITS(dword, 9, 8)]);
1431 printf("AUD_PWRST PinD_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 11, 10)]);
Mengdong Lin86d15e02014-03-03 13:52:06 -05001432
1433 if (!IS_HASWELL_PLUS(devid)) {
1434 printf("AUD_PWRST ConvertorA_Widget_Power_State_Requsted \t%s\n", power_state[BITS(dword, 13, 12)]);
1435 printf("AUD_PWRST ConvertorA_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 15, 14)]);
1436 printf("AUD_PWRST ConvertorB_Widget_Power_State_Requested \t%s\n", power_state[BITS(dword, 17, 16)]);
1437 printf("AUD_PWRST ConvertorB_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 19, 18)]);
1438 } else {
1439 printf("AUD_PWRST Convertor1_Widget_Power_State_Requsted \t%s\n", power_state[BITS(dword, 13, 12)]);
1440 printf("AUD_PWRST Convertor1_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 15, 14)]);
1441 printf("AUD_PWRST Convertor2_Widget_Power_State_Requested \t%s\n", power_state[BITS(dword, 17, 16)]);
1442 printf("AUD_PWRST Convertor2_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 19, 18)]);
1443 }
1444
1445 num_pipes = get_num_pipes();
1446 if (num_pipes == 2) {
1447 printf("AUD_PWRST Func_Grp_Dev_PwrSt_Set \t%s\n", power_state[BITS(dword, 21, 20)]);
1448 printf("AUD_PWRST Func_Grp_Dev_PwrSt_Curr \t%s\n", power_state[BITS(dword, 23, 22)]);
1449 } else { /* 3 pipes */
1450 if (!IS_HASWELL_PLUS(devid)) {
1451 printf("AUD_PWRST ConvertorC_Widget_Power_State_Requested \t%s\n", power_state[BITS(dword, 21, 20)]);
1452 printf("AUD_PWRST ConvertorC_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 23, 22)]);
1453 } else {
1454 printf("AUD_PWRST Convertor3_Widget_Power_State_Requested \t%s\n", power_state[BITS(dword, 21, 20)]);
1455 printf("AUD_PWRST Convertor3_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 23, 22)]);
1456 }
1457 printf("AUD_PWRST Func_Grp_Dev_PwrSt_Set \t%s\n", power_state[BITS(dword, 25, 24)]);
1458 printf("AUD_PWRST Func_Grp_Dev_PwrSt_Curr \t%s\n", power_state[BITS(dword, 27, 26)]);
1459 }
Mengdong Lindeba8682013-09-09 15:38:40 -04001460}
1461
Mengdong Lin86d15e02014-03-03 13:52:06 -05001462static void dump_aud_edid_data(int index)
Mengdong Lindeba8682013-09-09 15:38:40 -04001463{
1464 uint32_t dword;
1465 int i;
Mengdong Lin86d15e02014-03-03 13:52:06 -05001466 int offset;
1467 int aud_ctrl_st, edid_data;
Mengdong Lindeba8682013-09-09 15:38:40 -04001468
Mengdong Lin86d15e02014-03-03 13:52:06 -05001469 if (IS_HASWELL_PLUS(devid)) {
1470 offset = (index - TRANSCODER_A) * 0x100;
1471 aud_ctrl_st = aud_reg_base + AUD_TCA_DIP_ELD_CTRL_ST + offset;
1472 edid_data = aud_reg_base + AUD_TCA_EDID_DATA + offset;
1473 printf("AUD_TC%c_EDID_DATA ELD:\n\t", 'A' + index - TRANSCODER_A);
1474 } else {
1475 offset = (index - PIPE_A) * 0x100;
1476 aud_ctrl_st = aud_reg_base + AUD_CNTL_ST_A + offset;
1477 edid_data = aud_reg_base + AUD_HDMIW_HDMIEDID_A + offset;
1478 printf("AUD_HDMIW_HDMIEDID_%c HDMI ELD:\n\t", 'A' + index - PIPE_A);
1479 }
1480
1481 dword = INREG(aud_ctrl_st);
Mengdong Lindeba8682013-09-09 15:38:40 -04001482 dword &= ~BITMASK(9, 5);
Mengdong Lin86d15e02014-03-03 13:52:06 -05001483 OUTREG(aud_ctrl_st, dword);
Mengdong Lindeba8682013-09-09 15:38:40 -04001484 for (i = 0; i < BITS(dword, 14, 10) / 4; i++)
Mengdong Lin86d15e02014-03-03 13:52:06 -05001485 printf("%08x ", htonl(INREG(edid_data)));
Mengdong Lindeba8682013-09-09 15:38:40 -04001486 printf("\n");
1487}
1488
Mengdong Lin86d15e02014-03-03 13:52:06 -05001489static void dump_aud_infoframe(int index)
Mengdong Lindeba8682013-09-09 15:38:40 -04001490{
1491 uint32_t dword;
1492 int i;
Mengdong Lin86d15e02014-03-03 13:52:06 -05001493 int offset;
1494 int aud_ctrl_st, info_frm;
Mengdong Lindeba8682013-09-09 15:38:40 -04001495
Mengdong Lin86d15e02014-03-03 13:52:06 -05001496 if (IS_HASWELL_PLUS(devid)) {
1497 offset = (index - TRANSCODER_A) * 0x100;
1498 aud_ctrl_st = aud_reg_base + AUD_TCA_DIP_ELD_CTRL_ST + offset;
1499 info_frm = aud_reg_base + AUD_TCA_INFOFR + offset;
1500 printf("AUD_TC%c_INFOFR audio Infoframe:\n\t", 'A' + index - TRANSCODER_A);
1501 } else {
1502 offset = (index - PIPE_A) * 0x100;
1503 aud_ctrl_st = aud_reg_base + AUD_CNTL_ST_A + offset;
1504 info_frm = aud_reg_base + AUD_HDMIW_INFOFR_A + offset;
1505 printf("AUD_HDMIW_INFOFR_%c HDMI audio Infoframe:\n\t", 'A' + index - PIPE_A);
1506 }
1507
1508 dword = INREG(aud_ctrl_st);
Mengdong Lindeba8682013-09-09 15:38:40 -04001509 dword &= ~BITMASK(20, 18);
1510 dword &= ~BITMASK(3, 0);
Mengdong Lin86d15e02014-03-03 13:52:06 -05001511 OUTREG(aud_ctrl_st, dword);
Mengdong Lindeba8682013-09-09 15:38:40 -04001512 for (i = 0; i < 8; i++)
Mengdong Lin86d15e02014-03-03 13:52:06 -05001513 printf("%08x ", htonl(INREG(info_frm)));
Mengdong Lindeba8682013-09-09 15:38:40 -04001514 printf("\n");
1515}
1516
Mengdong Lin86d15e02014-03-03 13:52:06 -05001517static void dump_aud_port_en_hd_cfg(void)
1518{
1519 uint32_t dword;
1520 int num_pipes = get_num_pipes();
1521
1522 dword = INREG(aud_reg_base + AUD_PORT_EN_HD_CFG);
1523 if (num_pipes == 2) {
1524 printf("AUD_PORT_EN_HD_CFG Convertor_A_Digen\t\t\t%lu\n", BIT(dword, 0));
1525 printf("AUD_PORT_EN_HD_CFG Convertor_B_Digen\t\t\t%lu\n", BIT(dword, 1));
1526 printf("AUD_PORT_EN_HD_CFG Convertor_A_Stream_ID\t\t%lu\n", BITS(dword, 7, 4));
1527 printf("AUD_PORT_EN_HD_CFG Convertor_B_Stream_ID\t\t%lu\n", BITS(dword, 11, 8));
1528
1529 printf("AUD_PORT_EN_HD_CFG Port_B_Out_Enable\t\t\t%lu\n", BIT(dword, 12));
1530 printf("AUD_PORT_EN_HD_CFG Port_C_Out_Enable\t\t\t%lu\n", BIT(dword, 13));
1531 printf("AUD_PORT_EN_HD_CFG Port_D_Out_Enable\t\t\t%lu\n", BIT(dword, 14));
1532 printf("AUD_PORT_EN_HD_CFG Port_B_Amp_Mute_Status\t\t%lu\n", BIT(dword, 16));
1533 printf("AUD_PORT_EN_HD_CFG Port_C_Amp_Mute_Status\t\t%lu\n", BIT(dword, 17));
1534 printf("AUD_PORT_EN_HD_CFG Port_D_Amp_Mute_Status\t\t%lu\n", BIT(dword, 18));
1535 } else { /* three pipes */
1536 printf("AUD_PORT_EN_HD_CFG Convertor_A_Digen\t\t\t%lu\n", BIT(dword, 0));
1537 printf("AUD_PORT_EN_HD_CFG Convertor_B_Digen\t\t\t%lu\n", BIT(dword, 1));
1538 printf("AUD_PORT_EN_HD_CFG Convertor_C_Digen\t\t\t%lu\n", BIT(dword, 2));
1539 printf("AUD_PORT_EN_HD_CFG Convertor_A_Stream_ID\t\t%lu\n", BITS(dword, 7, 4));
1540 printf("AUD_PORT_EN_HD_CFG Convertor_B_Stream_ID\t\t%lu\n", BITS(dword, 11, 8));
1541 printf("AUD_PORT_EN_HD_CFG Convertor_C_Stream_ID\t\t%lu\n", BITS(dword, 15, 12));
1542
1543 printf("AUD_PORT_EN_HD_CFG Port_B_Out_Enable\t\t\t%lu\n", BIT(dword, 16));
1544 printf("AUD_PORT_EN_HD_CFG Port_C_Out_Enable\t\t\t%lu\n", BIT(dword, 17));
1545 printf("AUD_PORT_EN_HD_CFG Port_D_Out_Enable\t\t\t%lu\n", BIT(dword, 18));
1546 printf("AUD_PORT_EN_HD_CFG Port_B_Amp_Mute_Status\t\t%lu\n", BIT(dword, 20));
1547 printf("AUD_PORT_EN_HD_CFG Port_C_Amp_Mute_Status\t\t%lu\n", BIT(dword, 21));
1548 printf("AUD_PORT_EN_HD_CFG Port_D_Amp_Mute_Status\t\t%lu\n", BIT(dword, 22));
1549 }
1550}
1551
Mengdong Lindeba8682013-09-09 15:38:40 -04001552static void dump_aud_pipe_conv_cfg(void)
1553{
1554 uint32_t dword;
1555
Mengdong Lin86d15e02014-03-03 13:52:06 -05001556 dword = INREG(aud_reg_base + AUD_PIPE_CONV_CFG);
Mengdong Linfa8c7502014-03-04 10:13:09 -05001557 printf("AUD_PIPE_CONV_CFG Convertor_1_Digen\t\t\t%lu\n", BIT(dword, 0));
1558 printf("AUD_PIPE_CONV_CFG Convertor_2_Digen\t\t\t%lu\n", BIT(dword, 1));
1559 printf("AUD_PIPE_CONV_CFG Convertor_3_Digen\t\t\t%lu\n", BIT(dword, 2));
1560 printf("AUD_PIPE_CONV_CFG Convertor_1_Stream_ID\t\t%lu\n", BITS(dword, 7, 4));
1561 printf("AUD_PIPE_CONV_CFG Convertor_2_Stream_ID\t\t%lu\n", BITS(dword, 11, 8));
1562 printf("AUD_PIPE_CONV_CFG Convertor_3_Stream_ID\t\t%lu\n", BITS(dword, 15, 12));
1563
1564 printf("AUD_PIPE_CONV_CFG Port_B_Out_Enable\t\t\t%lu\n", BIT(dword, 16));
1565 printf("AUD_PIPE_CONV_CFG Port_C_Out_Enable\t\t\t%lu\n", BIT(dword, 17));
1566 printf("AUD_PIPE_CONV_CFG Port_D_Out_Enable\t\t\t%lu\n", BIT(dword, 18));
Mengdong Lindeba8682013-09-09 15:38:40 -04001567 printf("AUD_PIPE_CONV_CFG Port_B_Amp_Mute_Status\t\t%lu\n", BIT(dword, 20));
1568 printf("AUD_PIPE_CONV_CFG Port_C_Amp_Mute_Status\t\t%lu\n", BIT(dword, 21));
1569 printf("AUD_PIPE_CONV_CFG Port_D_Amp_Mute_Status\t\t%lu\n", BIT(dword, 22));
1570}
1571
Mengdong Lin86d15e02014-03-03 13:52:06 -05001572static void dump_aud_dig_cnvt(int index)
Mengdong Lindeba8682013-09-09 15:38:40 -04001573{
1574 uint32_t dword;
1575 char prefix[MAX_PREFIX_SIZE];
1576
Mengdong Lin86d15e02014-03-03 13:52:06 -05001577 if (!IS_HASWELL_PLUS(devid)) {
1578 dword = INREG(aud_reg_base + AUD_OUT_DIG_CNVT_A + (index - PIPE_A) * 0x100);
1579 sprintf(prefix, "AUD_OUT_DIG_CNVT_%c", 'A' + index - PIPE_A);
1580 } else {
1581 dword = INREG(aud_reg_base + AUD_C1_DIG_CNVT + (index - CONVERTER_1) * 0x100);
1582 sprintf(prefix, "AUD_C%c_DIG_CNVT ", '1' + index - CONVERTER_1);
1583 }
Mengdong Lindeba8682013-09-09 15:38:40 -04001584
Mengdong Linfa8c7502014-03-04 10:13:09 -05001585 printf("%s V\t\t\t\t\t%lu\n", prefix, BIT(dword, 1));
1586 printf("%s VCFG\t\t\t\t%lu\n", prefix, BIT(dword, 2));
1587 printf("%s PRE\t\t\t\t\t%lu\n", prefix, BIT(dword, 3));
1588 printf("%s Copy\t\t\t\t%lu\n", prefix, BIT(dword, 4));
1589 printf("%s NonAudio\t\t\t\t%lu\n", prefix, BIT(dword, 5));
1590 printf("%s PRO\t\t\t\t\t%lu\n", prefix, BIT(dword, 6));
1591 printf("%s Level\t\t\t\t%lu\n", prefix, BIT(dword, 7));
1592 printf("%s Category_Code\t\t\t%lu\n", prefix, BITS(dword, 14, 8));
1593 printf("%s Lowest_Channel_Number\t\t%lu\n", prefix, BITS(dword, 19, 16));
1594 printf("%s Stream_ID\t\t\t\t%lu\n", prefix, BITS(dword, 23, 20));
Mengdong Lindeba8682013-09-09 15:38:40 -04001595}
1596
Mengdong Lin86d15e02014-03-03 13:52:06 -05001597static void dump_aud_str_desc(int index)
Mengdong Lindeba8682013-09-09 15:38:40 -04001598{
1599 uint32_t dword;
1600 char prefix[MAX_PREFIX_SIZE];
1601 uint32_t rate;
1602
Mengdong Lin86d15e02014-03-03 13:52:06 -05001603 if (!IS_HASWELL_PLUS(devid)) {
1604 dword = INREG(aud_reg_base + AUD_OUT_STR_DESC_A + (index - PIPE_A) * 0x100);
1605 sprintf(prefix, "AUD_OUT_STR_DESC_%c", 'A' + index - PIPE_A);
1606 } else {
1607 dword = INREG(aud_reg_base + AUD_C1_STR_DESC + (index - CONVERTER_1) * 0x100);
1608 sprintf(prefix, "AUD_C%c_STR_DESC ", '1' + index - CONVERTER_1);
1609 }
Mengdong Lindeba8682013-09-09 15:38:40 -04001610
Mengdong Linfa8c7502014-03-04 10:13:09 -05001611 printf("%s Number_of_Channels_in_a_Stream\t%lu\n", prefix, BITS(dword, 3, 0) + 1);
1612 printf("%s Bits_per_Sample\t\t\t[%#lx] %s\n", prefix, BITS(dword, 6, 4),
Mengdong Lindeba8682013-09-09 15:38:40 -04001613 OPNAME(bits_per_sample, BITS(dword, 6, 4)));
1614
Mengdong Linfa8c7502014-03-04 10:13:09 -05001615 printf("%s Sample_Base_Rate_Divisor\t\t[%#lx] %s\n", prefix, BITS(dword, 10, 8),
Mengdong Lindeba8682013-09-09 15:38:40 -04001616 OPNAME(sample_base_rate_divisor, BITS(dword, 10, 8)));
Mengdong Linfa8c7502014-03-04 10:13:09 -05001617 printf("%s Sample_Base_Rate_Mult\t\t[%#lx] %s\n", prefix, BITS(dword, 13, 11),
Mengdong Lindeba8682013-09-09 15:38:40 -04001618 OPNAME(sample_base_rate_mult, BITS(dword, 13, 11)));
Mengdong Linfa8c7502014-03-04 10:13:09 -05001619 printf("%s Sample_Base_Rate\t\t\t[%#lx] %s\t", prefix, BIT(dword, 14),
Mengdong Lindeba8682013-09-09 15:38:40 -04001620 OPNAME(sample_base_rate, BIT(dword, 14)));
1621 rate = (BIT(dword, 14) ? 44100 : 48000) * (BITS(dword, 13, 11) + 1)
1622 /(BITS(dword, 10, 8) + 1);
1623 printf("=> Sample Rate %d Hz\n", rate);
1624
Mengdong Linfa8c7502014-03-04 10:13:09 -05001625 printf("%s Convertor_Channel_Count\t\t%lu\n", prefix, BITS(dword, 20, 16) + 1);
Mengdong Lin86d15e02014-03-03 13:52:06 -05001626
1627 if (!IS_HASWELL_PLUS(devid))
1628 printf("%s HBR_enable\t\t\t\t%lu\n", prefix, BITS(dword, 28, 27));
Mengdong Lindeba8682013-09-09 15:38:40 -04001629}
1630
Mengdong Lin86d15e02014-03-03 13:52:06 -05001631#define dump_aud_out_ch_str dump_aud_out_chan_map
Mengdong Lindeba8682013-09-09 15:38:40 -04001632static void dump_aud_out_chan_map(void)
1633{
1634 uint32_t dword;
1635 int i;
1636
1637 printf("AUD_OUT_CHAN_MAP Converter_Channel_MAP PORTB PORTC PORTD\n");
1638 for (i = 0; i < 8; i++) {
Mengdong Lin86d15e02014-03-03 13:52:06 -05001639 OUTREG(aud_reg_base + AUD_OUT_CHAN_MAP, i | (i << 8) | (i << 16));
1640 dword = INREG(aud_reg_base + AUD_OUT_CHAN_MAP);
Mengdong Lindeba8682013-09-09 15:38:40 -04001641 printf("\t\t\t\t%lu\t%lu\t%lu\t%lu\n",
1642 1 + BITS(dword, 3, 0),
1643 1 + BITS(dword, 7, 4),
1644 1 + BITS(dword, 15, 12),
1645 1 + BITS(dword, 23, 20));
1646 }
1647}
1648
Mengdong Lin86d15e02014-03-03 13:52:06 -05001649static void dump_aud_connect_list(void)
Mengdong Lindeba8682013-09-09 15:38:40 -04001650{
1651 uint32_t dword;
1652 char prefix[MAX_PREFIX_SIZE];
1653
Mengdong Lin86d15e02014-03-03 13:52:06 -05001654 dword = INREG(aud_reg_base + AUD_PINW_CONNLNG_LIST);
1655 sprintf(prefix, "AUD_PINW_CONNLNG_LIST");
Mengdong Lindeba8682013-09-09 15:38:40 -04001656
Mengdong Linfa8c7502014-03-04 10:13:09 -05001657 printf("%s Connect_List_Length\t\t%lu\n", prefix, BITS(dword, 6, 0));
1658 printf("%s Form \t\t\t\t[%#lx] %s\n", prefix, BIT(dword, 7),
Mengdong Lindeba8682013-09-09 15:38:40 -04001659 OPNAME(connect_list_form, BIT(dword, 7)));
Mengdong Lin86d15e02014-03-03 13:52:06 -05001660 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 -04001661}
1662
Mengdong Lin86d15e02014-03-03 13:52:06 -05001663static void dump_aud_connect_select(void)
Mengdong Lindeba8682013-09-09 15:38:40 -04001664{
1665 uint32_t dword;
Mengdong Lin86d15e02014-03-03 13:52:06 -05001666 char prefix[MAX_PREFIX_SIZE];
Mengdong Lindeba8682013-09-09 15:38:40 -04001667
Mengdong Lin86d15e02014-03-03 13:52:06 -05001668 if (IS_HASWELL_PLUS(devid)) {
1669 dword = INREG(aud_reg_base + AUD_PIPE_CONN_SEL_CTRL);
1670 sprintf(prefix, "AUD_PIPE_CONN_SEL_CTRL");
1671
1672 } else {
1673 dword = INREG(aud_reg_base + AUD_PINW_CONNLNG_SEL);
1674 sprintf(prefix, "AUD_PINW_CONNLNG_SEL ");
1675 }
1676
1677 printf("%s Connection_select_Port_B\t%#lx\n", prefix, BITS(dword, 7, 0));
1678 printf("%s Connection_select_Port_C\t%#lx\n", prefix, BITS(dword, 15, 8));
1679 printf("%s Connection_select_Port_D\t%#lx\n", prefix, BITS(dword, 23, 16));
Mengdong Lindeba8682013-09-09 15:38:40 -04001680}
1681
Mengdong Lin86d15e02014-03-03 13:52:06 -05001682static void dump_aud_ctrl_state(int index)
Mengdong Lindeba8682013-09-09 15:38:40 -04001683{
1684 uint32_t dword;
Mengdong Lin86d15e02014-03-03 13:52:06 -05001685 int offset;
Mengdong Lindeba8682013-09-09 15:38:40 -04001686
Mengdong Lin86d15e02014-03-03 13:52:06 -05001687 if (IS_HASWELL_PLUS(devid)) {
1688 offset = (index - TRANSCODER_A) * 0x100;
1689 dword = INREG(aud_reg_base + AUD_TCA_DIP_ELD_CTRL_ST + offset);
1690 printf("Audio DIP and ELD control state for Transcoder %c\n", 'A' + index - TRANSCODER_A);
1691 } else {
1692 offset = (index - PIPE_A) * 0x100;
1693 dword = INREG(aud_reg_base + AUD_CNTL_ST_A + offset);
1694 printf("Audio control state - Pipe %c\n", 'A' + index - PIPE_A);
1695 }
Mengdong Lindeba8682013-09-09 15:38:40 -04001696
Mengdong Linfa8c7502014-03-04 10:13:09 -05001697 printf("\tELD_ACK\t\t\t\t\t\t%lu\n", BIT(dword, 4));
1698 printf("\tELD_buffer_size\t\t\t\t\t%lu\n", BITS(dword, 14, 10));
1699 printf("\tDIP_transmission_frequency\t\t\t[0x%lx] %s\n", BITS(dword, 17, 16),
Mengdong Lindeba8682013-09-09 15:38:40 -04001700 dip_trans[BITS(dword, 17, 16)]);
Mengdong Linfa8c7502014-03-04 10:13:09 -05001701 printf("\tDIP Buffer Index \t\t\t\t[0x%lx] %s\n", BITS(dword, 20, 18),
Mengdong Lindeba8682013-09-09 15:38:40 -04001702 dip_index[BITS(dword, 20, 18)]);
1703 printf("\tAudio DIP type enable status\t\t\t[0x%04lx] %s, %s, %s\n", BITS(dword, 24, 21),
1704 dip_type[BIT(dword, 21)], dip_gen1_state[BIT(dword, 22)], dip_gen2_state[BIT(dword, 23)]);
Mengdong Linfa8c7502014-03-04 10:13:09 -05001705 printf("\tAudio DIP port select\t\t\t\t[0x%lx] %s\n", BITS(dword, 30, 29),
Mengdong Lindeba8682013-09-09 15:38:40 -04001706 dip_port[BITS(dword, 30, 29)]);
1707 printf("\n");
1708}
1709
Mengdong Lin86d15e02014-03-03 13:52:06 -05001710static void dump_aud_ctrl_state2(void)
1711{
1712 uint32_t dword;
1713
1714 dword = INREG(aud_reg_base + AUD_CNTL_ST2);
1715 printf("AUD_CNTL_ST2 ELD_validB\t\t\t\t%lu\n", BIT(dword, 0));
1716 printf("AUD_CNTL_ST2 CP_ReadyB\t\t\t\t\t%lu\n", BIT(dword, 1));
1717 printf("AUD_CNTL_ST2 ELD_validC\t\t\t\t%lu\n", BIT(dword, 4));
1718 printf("AUD_CNTL_ST2 CP_ReadyC\t\t\t\t\t%lu\n", BIT(dword, 5));
1719 printf("AUD_CNTL_ST2 ELD_validD\t\t\t\t%lu\n", BIT(dword, 8));
1720 printf("AUD_CNTL_ST2 CP_ReadyD\t\t\t\t\t%lu\n", BIT(dword, 9));
1721}
1722
1723/* for hsw+ */
Mengdong Lindeba8682013-09-09 15:38:40 -04001724static void dump_aud_eld_cp_vld(void)
1725{
1726 uint32_t dword;
1727
Mengdong Lin86d15e02014-03-03 13:52:06 -05001728 dword = INREG(aud_reg_base + AUD_PIN_ELD_CP_VLD);
Mengdong Lindeba8682013-09-09 15:38:40 -04001729 printf("AUD_PIN_ELD_CP_VLD Transcoder_A ELD_valid\t\t%lu\n", BIT(dword, 0));
1730 printf("AUD_PIN_ELD_CP_VLD Transcoder_A CP_Ready \t\t%lu\n", BIT(dword, 1));
1731 printf("AUD_PIN_ELD_CP_VLD Transcoder_A Out_enable\t\t%lu\n", BIT(dword, 2));
1732 printf("AUD_PIN_ELD_CP_VLD Transcoder_A Inactive\t\t%lu\n", BIT(dword, 3));
1733 printf("AUD_PIN_ELD_CP_VLD Transcoder_B ELD_valid\t\t%lu\n", BIT(dword, 4));
1734 printf("AUD_PIN_ELD_CP_VLD Transcoder_B CP_Ready\t\t%lu\n", BIT(dword, 5));
1735 printf("AUD_PIN_ELD_CP_VLD Transcoder_B OUT_enable\t\t%lu\n", BIT(dword, 6));
1736 printf("AUD_PIN_ELD_CP_VLD Transcoder_B Inactive\t\t%lu\n", BIT(dword, 7));
1737 printf("AUD_PIN_ELD_CP_VLD Transcoder_C ELD_valid\t\t%lu\n", BIT(dword, 8));
1738 printf("AUD_PIN_ELD_CP_VLD Transcoder_C CP_Ready\t\t%lu\n", BIT(dword, 9));
1739 printf("AUD_PIN_ELD_CP_VLD Transcoder_C OUT_enable\t\t%lu\n", BIT(dword, 10));
1740 printf("AUD_PIN_ELD_CP_VLD Transcoder_C Inactive\t\t%lu\n", BIT(dword, 11));
1741}
1742
Mengdong Lin86d15e02014-03-03 13:52:06 -05001743static void dump_aud_hdmi_status(void)
Mengdong Lindeba8682013-09-09 15:38:40 -04001744{
1745 uint32_t dword;
1746
Mengdong Lin86d15e02014-03-03 13:52:06 -05001747 dword = INREG(aud_reg_base + AUD_HDMIW_STATUS);
1748 printf("AUD_HDMIW_STATUS Function_Reset\t\t\t%lu\n", BIT(dword, 24));
1749 printf("AUD_HDMIW_STATUS BCLK/CDCLK_FIFO_Overrun\t\t%lu\n", BIT(dword, 25));
1750 printf("AUD_HDMIW_STATUS Conv_A_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n", BIT(dword, 28));
1751 printf("AUD_HDMIW_STATUS Conv_A_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 29));
1752 printf("AUD_HDMIW_STATUS Conv_B_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n", BIT(dword, 30));
1753 printf("AUD_HDMIW_STATUS Conv_B_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 31));
1754}
1755
1756/*
Mengdong Lin449509d2014-03-03 17:03:02 -05001757 * Display registers of Ironlake and Valleyview
Mengdong Lin86d15e02014-03-03 13:52:06 -05001758 */
1759#undef DP_CTL_B
1760#undef DP_CTL_C
1761#undef DP_CTL_D
1762
1763#define DP_CTL_B 0x4100
1764#define DP_CTL_C 0x4200
1765#define DP_CTL_D 0x4300
1766
Mengdong Lin449509d2014-03-03 17:03:02 -05001767/* ILK HDMI port ctrl */
Mengdong Lin86d15e02014-03-03 13:52:06 -05001768#define HDMI_CTL_B 0x1140
1769#define HDMI_CTL_C 0x1150
1770#define HDMI_CTL_D 0x1160
1771
Mengdong Lin449509d2014-03-03 17:03:02 -05001772/* VLV HDMI port ctrl */
1773#define SDVO_HDMI_CTL_B 0x1140
1774#define SDVO_HDMI_CTL_C 0x1160
1775
Mengdong Lin86d15e02014-03-03 13:52:06 -05001776static void dump_dp_port_ctrl(int port)
1777{
1778 uint32_t dword;
1779 int port_ctrl;
1780 char prefix[MAX_PREFIX_SIZE];
1781
1782 sprintf(prefix, "DP_%c", 'B' + port - PORT_B);
1783
1784 port_ctrl = disp_reg_base + DP_CTL_B + (port - PORT_B) * 0x100;
1785 dword = INREG(port_ctrl);
1786 printf("%s DisplayPort_Enable\t\t\t\t\t%lu\n", prefix, BIT(dword, 31));
1787 printf("%s Transcoder_Select\t\t\t\t\t%s\n", prefix, BIT(dword, 30) ? "Transcoder B" : "Transcoder A");
1788 printf("%s Port_Width_Selection\t\t\t\t[0x%lx] %s\n", prefix, BITS(dword, 21, 19),
1789 dp_port_width[BITS(dword, 21, 19)]);
1790 printf("%s Port_Detected\t\t\t\t\t%lu\n", prefix, BIT(dword, 2));
1791 printf("%s HDCP_Port_Select\t\t\t\t\t%lu\n", prefix, BIT(dword, 5));
1792 printf("%s Audio_Output_Enable\t\t\t\t%lu\n", prefix, BIT(dword, 6));
1793}
1794
1795static void dump_hdmi_port_ctrl(int port)
1796{
1797 uint32_t dword;
1798 int port_ctrl;
1799 char prefix[MAX_PREFIX_SIZE];
1800
Mengdong Lin449509d2014-03-03 17:03:02 -05001801 if (IS_VALLEYVIEW(devid)) {
1802 sprintf(prefix, "SDVO/HDMI%c", 'B' + port - PORT_B);
1803 port_ctrl = disp_reg_base + SDVO_HDMI_CTL_B + (port - PORT_B) * 0x20;
1804 } else {
1805 sprintf(prefix, "HDMI%c ", 'B' + port - PORT_B);
1806 port_ctrl = disp_reg_base + HDMI_CTL_B + (port - PORT_B) * 0x10;
1807 }
Mengdong Lin86d15e02014-03-03 13:52:06 -05001808
Mengdong Lin86d15e02014-03-03 13:52:06 -05001809 dword = INREG(port_ctrl);
1810 printf("%s HDMI_Enable\t\t\t\t\t%u\n", prefix, !!(dword & SDVO_ENABLE));
1811 printf("%s Transcoder_Select\t\t\t\t%s\n", prefix, BIT(dword, 30) ? "Transcoder B" : "Transcoder A");
1812 printf("%s HDCP_Port_Select\t\t\t\t%lu\n", prefix, BIT(dword, 5));
1813 if (port == PORT_B) /* TODO: check spec, not found in Ibx b-spec, and only for port B? */
1814 printf("%s SDVO Hot Plug Interrupt Detect Enable\t%lu\n", prefix, BIT(dword, 23));
1815 printf("%s Digital_Port_Detected\t\t\t%lu\n", prefix, BIT(dword, 2));
1816 printf("%s Encoding\t\t\t\t\t[0x%lx] %s\n", prefix, BITS(dword, 11, 10),
1817 sdvo_hdmi_encoding[BITS(dword, 11, 10)]);
1818 printf("%s Null_packets_enabled_during_Vsync\t\t%u\n", prefix, !!(dword & SDVO_NULL_PACKETS_DURING_VSYNC));
1819 printf("%s Audio_Output_Enable\t\t\t\t%u\n", prefix, !!(dword & SDVO_AUDIO_ENABLE));
1820}
1821
1822static void dump_ironlake(void)
1823{
1824 uint32_t dword;
1825
Mengdong Lin449509d2014-03-03 17:03:02 -05001826 if (!IS_VALLEYVIEW(devid))
1827 set_reg_base(0xe0000, 0x2000); /* ironlake */
1828 else
1829 set_reg_base(0x60000 + VLV_DISPLAY_BASE, 0x2000);
Mengdong Lin86d15e02014-03-03 13:52:06 -05001830
Mengdong Lin449509d2014-03-03 17:03:02 -05001831 if (!IS_VALLEYVIEW(devid)) {
1832 dump_disp_reg(HDMI_CTL_B, "sDVO/HDMI Port B Control");
1833 dump_disp_reg(HDMI_CTL_C, "HDMI Port C Control");
1834 dump_disp_reg(HDMI_CTL_D, "HDMI Port D Control");
1835 } else {
1836 dump_disp_reg(SDVO_HDMI_CTL_B, "sDVO/HDMI Port B Control");
1837 dump_disp_reg(SDVO_HDMI_CTL_C, "sDVO/HDMI Port C Control");
1838 }
1839
Mengdong Lin86d15e02014-03-03 13:52:06 -05001840 dump_disp_reg(DP_CTL_B, "DisplayPort B Control Register");
1841 dump_disp_reg(DP_CTL_C, "DisplayPort C Control Register");
Mengdong Lin449509d2014-03-03 17:03:02 -05001842 if (!IS_VALLEYVIEW(devid))
1843 dump_disp_reg(DP_CTL_D, "DisplayPort D Control Register");
Mengdong Lin86d15e02014-03-03 13:52:06 -05001844
1845 dump_aud_reg(AUD_CONFIG_A, "Audio Configuration - Transcoder A");
1846 dump_aud_reg(AUD_CONFIG_B, "Audio Configuration - Transcoder B");
1847 dump_aud_reg(AUD_CTS_ENABLE_A, "Audio CTS Programming Enable - Transcoder A");
1848 dump_aud_reg(AUD_CTS_ENABLE_B, "Audio CTS Programming Enable - Transcoder B");
1849 dump_aud_reg(AUD_MISC_CTRL_A, "Audio MISC Control for Transcoder A");
1850 dump_aud_reg(AUD_MISC_CTRL_B, "Audio MISC Control for Transcoder B");
1851 dump_aud_reg(AUD_VID_DID, "Audio Vendor ID / Device ID");
1852 dump_aud_reg(AUD_RID, "Audio Revision ID");
1853 dump_aud_reg(AUD_PWRST, "Audio Power State (Function Group, Convertor, Pin Widget)");
1854 dump_aud_reg(AUD_PORT_EN_HD_CFG, "Audio Port Enable HDAudio Config");
1855 dump_aud_reg(AUD_OUT_DIG_CNVT_A, "Audio Digital Converter - Conv A");
1856 dump_aud_reg(AUD_OUT_DIG_CNVT_B, "Audio Digital Converter - Conv B");
1857 dump_aud_reg(AUD_OUT_CH_STR, "Audio Channel ID and Stream ID");
1858 dump_aud_reg(AUD_OUT_STR_DESC_A, "Audio Stream Descriptor Format - Conv A");
1859 dump_aud_reg(AUD_OUT_STR_DESC_B, "Audio Stream Descriptor Format - Conv B");
1860 dump_aud_reg(AUD_PINW_CONNLNG_LIST, "Audio Connection List");
1861 dump_aud_reg(AUD_PINW_CONNLNG_SEL, "Audio Connection Select");
1862 dump_aud_reg(AUD_CNTL_ST_A, "Audio Control State Register - Transcoder A");
1863 dump_aud_reg(AUD_CNTL_ST_B, "Audio Control State Register - Transcoder B");
1864 dump_aud_reg(AUD_CNTL_ST2, "Audio Control State 2");
1865 dump_aud_reg(AUD_HDMIW_STATUS, "Audio HDMI Status");
1866 dump_aud_reg(AUD_HDMIW_HDMIEDID_A, "HDMI Data EDID Block - Transcoder A");
1867 dump_aud_reg(AUD_HDMIW_HDMIEDID_B, "HDMI Data EDID Block - Transcoder B");
1868 dump_aud_reg(AUD_HDMIW_INFOFR_A, "Audio Widget Data Island Packet - Transcoder A");
1869 dump_aud_reg(AUD_HDMIW_INFOFR_B, "Audio Widget Data Island Packet - Transcoder B");
1870
1871 printf("\nDetails:\n\n");
1872
1873 dump_aud_vendor_device_id();
1874 dump_aud_revision_id();
1875
1876 dump_hdmi_port_ctrl(PORT_B);
1877 dump_hdmi_port_ctrl(PORT_C);
Mengdong Lin449509d2014-03-03 17:03:02 -05001878 if (!IS_VALLEYVIEW(devid))
1879 dump_hdmi_port_ctrl(PORT_D);
Mengdong Lin86d15e02014-03-03 13:52:06 -05001880
1881 dump_dp_port_ctrl(PORT_B);
1882 dump_dp_port_ctrl(PORT_C);
Mengdong Lin449509d2014-03-03 17:03:02 -05001883 if (!IS_VALLEYVIEW(devid))
1884 dump_dp_port_ctrl(PORT_D);
Mengdong Lin86d15e02014-03-03 13:52:06 -05001885
1886 dump_aud_config(PIPE_A);
1887 dump_aud_config(PIPE_B);
1888
1889 dump_aud_m_cts_enable(PIPE_A);
1890 dump_aud_m_cts_enable(PIPE_B);
1891
1892 dump_aud_misc_control(PIPE_A);
1893 dump_aud_misc_control(PIPE_B);
1894
1895 dump_aud_power_state();
1896 dump_aud_port_en_hd_cfg();
1897
1898 dump_aud_dig_cnvt(PIPE_A);
1899 dump_aud_dig_cnvt(PIPE_B);
1900
1901 dump_aud_out_ch_str();
1902
1903 dump_aud_str_desc(PIPE_A);
1904 dump_aud_str_desc(PIPE_B);
1905
1906 dump_aud_connect_list();
1907 dump_aud_connect_select();
1908
1909 dump_aud_ctrl_state(PIPE_A);
1910 dump_aud_ctrl_state(PIPE_B);
1911 dump_aud_ctrl_state2();
1912
1913 dump_aud_hdmi_status();
1914
1915 dump_aud_edid_data(PIPE_A);
1916 dump_aud_edid_data(PIPE_B);
1917
1918 dump_aud_infoframe(PIPE_A);
1919 dump_aud_infoframe(PIPE_B);
1920}
1921
1922#undef VIDEO_DIP_CTL_A
1923#undef VIDEO_DIP_CTL_B
1924#undef VIDEO_DIP_CTL_C
1925#undef VIDEO_DIP_CTL_D
1926#undef VIDEO_DIP_DATA
1927
1928/*
1929 * Haswell+ display registers
1930 */
1931
1932/* DisplayPort Transport Control */
1933#define DP_TP_CTL_A 0x64040
1934#define DP_TP_CTL_B 0x64140
1935#define DP_TP_CTL_C 0x64240
1936#define DP_TP_CTL_D 0x64340
1937#define DP_TP_CTL_E 0x64440
1938
1939/* DisplayPort Transport Status */
1940#define DP_TP_ST_A 0x64044
1941#define DP_TP_ST_B 0x64144
1942#define DP_TP_ST_C 0x64244
1943#define DP_TP_ST_D 0x64344
1944#define DP_TP_ST_E 0x64444
1945
1946/* DDI Buffer Control */
1947#define DDI_BUF_CTL_A 0x64000
1948#define DDI_BUF_CTL_B 0x64100
1949#define DDI_BUF_CTL_C 0x64200
1950#define DDI_BUF_CTL_D 0x64300
1951#define DDI_BUF_CTL_E 0x64400
1952
1953/* DDI Buffer Translation */
1954#define DDI_BUF_TRANS_A 0x64e00
1955#define DDI_BUF_TRANS_B 0x64e60
1956#define DDI_BUF_TRANS_C 0x64ec0
1957#define DDI_BUF_TRANS_D 0x64f20
1958#define DDI_BUF_TRANS_E 0x64f80
1959
1960/* DDI Aux Channel */
1961#define DDI_AUX_CHANNEL_CTRL 0x64010
1962#define DDI_AUX_DATA 0x64014
1963#define DDI_AUX_TST 0x64028
1964
1965/* DDI CRC Control */
1966#define DDI_CRC_CTL_A 0x64050
1967#define DDI_CRC_CTL_B 0x64150
1968#define DDI_CRC_CTL_C 0x64250
1969#define DDI_CRC_CTL_D 0x64350
1970#define DDI_CRC_CTL_E 0x64450
1971
1972/* Pipe DDI Function Control */
1973#define PIPE_DDI_FUNC_CTL_A 0x60400
1974#define PIPE_DDI_FUNC_CTL_B 0x61400
1975#define PIPE_DDI_FUNC_CTL_C 0x62400
1976#define PIPE_DDI_FUNC_CTL_EDP 0x6F400
1977
1978/* Pipe Configuration */
1979#define PIPE_CONF_A 0x70008
1980#define PIPE_CONF_B 0x71008
1981#define PIPE_CONF_C 0x72008
1982#define PIPE_CONF_EDP 0x7F008
1983
1984/* Video DIP Control */
1985#define VIDEO_DIP_CTL_A 0x60200
1986#define VIDEO_DIP_CTL_B 0x61200
1987#define VIDEO_DIP_CTL_C 0x62200
1988#define VIDEO_DIP_CTL_D 0x63200
1989
1990#define VIDEO_DIP_DATA 0x60220
1991#define VIDEO_DIP_ECC 0x60240
1992
1993static void dump_ddi_buf_ctl(int port)
1994{
1995 uint32_t dword;
1996
1997 dword = INREG(DDI_BUF_CTL_A + (port - PORT_A) * 0x100);
1998 printf("DDI %c Buffer control\n", 'A' + port - PORT_A);
1999
2000 printf("\tDP port width\t\t\t\t\t[0x%lx] %s\n", BITS(dword, 3, 1),
2001 OPNAME(dp_port_width, BITS(dword, 3, 1)));
2002 printf("\tDDI Buffer Enable\t\t\t\t%ld\n", BIT(dword, 31));
2003}
2004
2005static void dump_ddi_func_ctl(int pipe)
2006{
2007 uint32_t dword;
2008
2009 dword = INREG(PIPE_DDI_FUNC_CTL_A + (pipe - PIPE_A) * 0x1000);
2010 printf("Pipe %c DDI Function Control\n", 'A' + pipe - PIPE_A);
2011
2012 printf("\tBITS per color\t\t\t\t\t[0x%lx] %s\n", BITS(dword, 22, 20),
2013 OPNAME(bits_per_color, BITS(dword, 22, 20)));
2014 printf("\tPIPE DDI Mode\t\t\t\t\t[0x%lx] %s\n", BITS(dword, 26, 24),
2015 OPNAME(ddi_mode, BITS(dword, 26, 24)));
2016 printf("\tPIPE DDI selection\t\t\t\t[0x%lx] %s\n", BITS(dword, 30, 28),
2017 OPNAME(trans_to_port_sel, BITS(dword, 30, 28)));
2018 printf("\tPIPE DDI Function Enable\t\t\t[0x%lx]\n", BIT(dword, 31));
2019}
2020
2021static void dump_aud_connect_list_entry_length(int transcoder)
2022{
2023 uint32_t dword;
2024 char prefix[MAX_PREFIX_SIZE];
2025
2026 dword = INREG(aud_reg_base + AUD_TCA_PIN_PIPE_CONN_ENTRY_LNGTH + (transcoder - TRANSCODER_A) * 0x100);
2027 sprintf(prefix, "AUD_TC%c_PIN_PIPE_CONN_ENTRY_LNGTH", 'A' + transcoder - TRANSCODER_A);
2028
2029 printf("%s Connect_List_Length\t%lu\n", prefix, BITS(dword, 6, 0));
2030 printf("%s Form \t\t[%#lx] %s\n", prefix, BIT(dword, 7),
2031 OPNAME(connect_list_form, BIT(dword, 7)));
2032 printf("%s Connect_List_Entry\t%lu\n", prefix, BITS(dword, 15, 8));
2033}
2034
2035static void dump_aud_connect_select_ctrl(void)
2036{
2037 uint32_t dword;
2038
2039 dword = INREG(aud_reg_base + AUD_PIPE_CONN_SEL_CTRL);
2040 printf("AUD_PIPE_CONN_SEL_CTRL Connection_select_Port_B\t%#lx\n", BITS(dword, 7, 0));
2041 printf("AUD_PIPE_CONN_SEL_CTRL Connection_select_Port_C\t%#lx\n", BITS(dword, 15, 8));
2042 printf("AUD_PIPE_CONN_SEL_CTRL Connection_select_Port_D\t%#lx\n", BITS(dword, 23, 16));
2043}
2044
2045static void dump_aud_dip_eld_ctrl_st(int transcoder)
2046{
2047 uint32_t dword;
2048 int offset = (transcoder - TRANSCODER_A) * 0x100;
2049
2050 dword = INREG(aud_reg_base + AUD_TCA_DIP_ELD_CTRL_ST + offset);
2051 printf("Audio DIP and ELD control state for Transcoder %c\n", 'A' + transcoder - TRANSCODER_A);
2052
2053 printf("\tELD_ACK\t\t\t\t\t\t%lu\n", BIT(dword, 4));
2054 printf("\tELD_buffer_size\t\t\t\t\t%lu\n", BITS(dword, 14, 10));
2055 printf("\tDIP_transmission_frequency\t\t\t[0x%lx] %s\n", BITS(dword, 17, 16),
2056 dip_trans[BITS(dword, 17, 16)]);
2057 printf("\tDIP Buffer Index \t\t\t\t[0x%lx] %s\n", BITS(dword, 20, 18),
2058 dip_index[BITS(dword, 20, 18)]);
2059 printf("\tAudio DIP type enable status\t\t\t[0x%04lx] %s, %s, %s\n", BITS(dword, 24, 21),
2060 dip_type[BIT(dword, 21)], dip_gen1_state[BIT(dword, 22)], dip_gen2_state[BIT(dword, 23)]);
2061 printf("\tAudio DIP port select\t\t\t\t[0x%lx] %s\n", BITS(dword, 30, 29),
2062 dip_port[BITS(dword, 30, 29)]);
2063 printf("\n");
2064}
2065
2066static void dump_aud_hdmi_fifo_status(void)
2067{
2068 uint32_t dword;
2069
2070 dword = INREG(aud_reg_base + AUD_HDMI_FIFO_STATUS);
Mengdong Lindeba8682013-09-09 15:38:40 -04002071 printf("AUD_HDMI_FIFO_STATUS Function_Reset\t\t\t%lu\n", BIT(dword, 24));
2072 printf("AUD_HDMI_FIFO_STATUS Conv_1_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n", BIT(dword, 26));
2073 printf("AUD_HDMI_FIFO_STATUS Conv_1_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 27));
2074 printf("AUD_HDMI_FIFO_STATUS Conv_2_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n", BIT(dword, 28));
2075 printf("AUD_HDMI_FIFO_STATUS Conv_2_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 29));
2076 printf("AUD_HDMI_FIFO_STATUS Conv_3_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n", BIT(dword, 30));
2077 printf("AUD_HDMI_FIFO_STATUS Conv_3_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 31));
2078}
Wang Xingchaoc4077222012-08-15 16:13:38 +08002079
Mengdong Linf075c3c2013-08-13 00:22:14 -04002080static void parse_bdw_audio_chicken_bit_reg(uint32_t dword)
2081{
2082 printf("\t");
Mengdong Linfa8c7502014-03-04 10:13:09 -05002083 printf("%s\n\t", OPNAME(vanilla_dp12_en, BIT(dword, 31)));
2084 printf("%s\n\t", OPNAME(vanilla_3_widgets_en, BIT(dword, 30)));
2085 printf("%s\n\t", OPNAME(block_audio, BIT(dword, 10)));
Mengdong Linf075c3c2013-08-13 00:22:14 -04002086 printf("%s\n\t", OPNAME(dis_eld_valid_pulse_trans, BIT(dword, 9)));
Mengdong Linfa8c7502014-03-04 10:13:09 -05002087 printf("%s\n\t", OPNAME(dis_pd_pulse_trans, BIT(dword, 8)));
2088 printf("%s\n\t", OPNAME(dis_ts_delta_err, BIT(dword, 7)));
2089 printf("%s\n\t", OPNAME(dis_ts_fix_dp_hbr, BIT(dword, 6)));
2090 printf("%s\n\t", OPNAME(pattern_gen_8_ch_en, BIT(dword, 5)));
2091 printf("%s\n\t", OPNAME(pattern_gen_2_ch_en, BIT(dword, 4)));
2092 printf("%s\n\t", OPNAME(fabric_32_44_dis, BIT(dword, 3)));
2093 printf("%s\n\t", OPNAME(epss_dis, BIT(dword, 2)));
2094 printf("%s\n\t", OPNAME(ts_test_mode, BIT(dword, 1)));
2095 printf("%s\n", OPNAME(en_mmio_program, BIT(dword, 0)));
Mengdong Linf075c3c2013-08-13 00:22:14 -04002096}
2097
Mengdong Lin69cc00b2013-07-17 13:29:17 -04002098/* Dump audio registers for Haswell and its successors (eg. Broadwell).
2099 * Their register layout are same in the north display engine.
2100 */
2101static void dump_hsw_plus(void)
Wang Xingchaoc4077222012-08-15 16:13:38 +08002102{
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04002103 uint32_t dword;
Mengdong Lin97e5cf62013-08-13 00:22:24 -04002104 int i;
Wang Xingchaoc4077222012-08-15 16:13:38 +08002105
Mengdong Lin86d15e02014-03-03 13:52:06 -05002106 set_aud_reg_base(0x65000);
2107
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04002108 /* HSW DDI Buffer */
Mengdong Linfa8c7502014-03-04 10:13:09 -05002109 dump_reg(DDI_BUF_CTL_A, "DDI Buffer Controler A");
2110 dump_reg(DDI_BUF_CTL_B, "DDI Buffer Controler B");
2111 dump_reg(DDI_BUF_CTL_C, "DDI Buffer Controler C");
2112 dump_reg(DDI_BUF_CTL_D, "DDI Buffer Controler D");
2113 dump_reg(DDI_BUF_CTL_E, "DDI Buffer Controler E");
Wang Xingchaoc4077222012-08-15 16:13:38 +08002114
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04002115 /* HSW Pipe Function */
Mengdong Linfa8c7502014-03-04 10:13:09 -05002116 dump_reg(PIPE_CONF_A, "PIPE Configuration A");
2117 dump_reg(PIPE_CONF_B, "PIPE Configuration B");
2118 dump_reg(PIPE_CONF_C, "PIPE Configuration C");
2119 dump_reg(PIPE_CONF_EDP, "PIPE Configuration EDP");
Wang Xingchaoc4077222012-08-15 16:13:38 +08002120
Mengdong Linfa8c7502014-03-04 10:13:09 -05002121 dump_reg(PIPE_DDI_FUNC_CTL_A, "PIPE DDI Function Control A");
2122 dump_reg(PIPE_DDI_FUNC_CTL_B, "PIPE DDI Function Control B");
2123 dump_reg(PIPE_DDI_FUNC_CTL_C, "PIPE DDI Function Control C");
2124 dump_reg(PIPE_DDI_FUNC_CTL_EDP, "PIPE DDI Function Control EDP");
Wang Xingchaoc4077222012-08-15 16:13:38 +08002125
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04002126 /* HSW Display port */
Mengdong Linfa8c7502014-03-04 10:13:09 -05002127 dump_reg(DP_TP_CTL_A, "DisplayPort Transport A Control");
2128 dump_reg(DP_TP_CTL_B, "DisplayPort Transport B Control");
2129 dump_reg(DP_TP_CTL_C, "DisplayPort Transport C Control");
2130 dump_reg(DP_TP_CTL_D, "DisplayPort Transport D Control");
2131 dump_reg(DP_TP_CTL_E, "DisplayPort Transport E Control");
Wang Xingchaoc4077222012-08-15 16:13:38 +08002132
Mengdong Linfa8c7502014-03-04 10:13:09 -05002133 dump_reg(DP_TP_ST_A, "DisplayPort Transport A Status");
2134 dump_reg(DP_TP_ST_B, "DisplayPort Transport B Status");
2135 dump_reg(DP_TP_ST_C, "DisplayPort Transport C Status");
2136 dump_reg(DP_TP_ST_D, "DisplayPort Transport D Status");
2137 dump_reg(DP_TP_ST_E, "DisplayPort Transport E Status");
Wang Xingchaoc4077222012-08-15 16:13:38 +08002138
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04002139 /* HSW North Display Audio */
Mengdong Lin86d15e02014-03-03 13:52:06 -05002140 dump_aud_reg(AUD_TCA_CONFIG, "Audio Configuration - Transcoder A");
2141 dump_aud_reg(AUD_TCB_CONFIG, "Audio Configuration - Transcoder B");
2142 dump_aud_reg(AUD_TCC_CONFIG, "Audio Configuration - Transcoder C");
2143 dump_aud_reg(AUD_C1_MISC_CTRL, "Audio Converter 1 MISC Control");
2144 dump_aud_reg(AUD_C2_MISC_CTRL, "Audio Converter 2 MISC Control");
2145 dump_aud_reg(AUD_C3_MISC_CTRL, "Audio Converter 3 MISC Control");
2146 dump_aud_reg(AUD_VID_DID, "Audio Vendor ID / Device ID");
2147 dump_aud_reg(AUD_RID, "Audio Revision ID");
2148 dump_aud_reg(AUD_TCA_M_CTS_ENABLE, "Audio M & CTS Programming Enable - Transcoder A");
2149 dump_aud_reg(AUD_TCB_M_CTS_ENABLE, "Audio M & CTS Programming Enable - Transcoder B");
2150 dump_aud_reg(AUD_TCC_M_CTS_ENABLE, "Audio M & CTS Programming Enable - Transcoder C");
2151 dump_aud_reg(AUD_PWRST, "Audio Power State (Function Group, Convertor, Pin Widget)");
2152 dump_aud_reg(AUD_TCA_EDID_DATA, "Audio EDID Data Block - Transcoder A");
2153 dump_aud_reg(AUD_TCB_EDID_DATA, "Audio EDID Data Block - Transcoder B");
2154 dump_aud_reg(AUD_TCC_EDID_DATA, "Audio EDID Data Block - Transcoder C");
2155 dump_aud_reg(AUD_TCA_INFOFR, "Audio Widget Data Island Packet - Transcoder A");
2156 dump_aud_reg(AUD_TCB_INFOFR, "Audio Widget Data Island Packet - Transcoder B");
2157 dump_aud_reg(AUD_TCC_INFOFR, "Audio Widget Data Island Packet - Transcoder C");
2158 dump_aud_reg(AUD_PIPE_CONV_CFG, "Audio Pipe and Converter Configs");
2159 dump_aud_reg(AUD_C1_DIG_CNVT, "Audio Digital Converter - Converter 1");
2160 dump_aud_reg(AUD_C2_DIG_CNVT, "Audio Digital Converter - Converter 2");
2161 dump_aud_reg(AUD_C3_DIG_CNVT, "Audio Digital Converter - Converter 3");
2162 dump_aud_reg(AUD_C1_STR_DESC, "Audio Stream Descriptor Format - Converter 1");
2163 dump_aud_reg(AUD_C2_STR_DESC, "Audio Stream Descriptor Format - Converter 2");
2164 dump_aud_reg(AUD_C3_STR_DESC, "Audio Stream Descriptor Format - Converter 3");
2165 dump_aud_reg(AUD_OUT_CHAN_MAP, "Audio Output Channel Mapping");
2166 dump_aud_reg(AUD_TCA_PIN_PIPE_CONN_ENTRY_LNGTH, "Audio Connection List entry and Length - Transcoder A");
2167 dump_aud_reg(AUD_TCB_PIN_PIPE_CONN_ENTRY_LNGTH, "Audio Connection List entry and Length - Transcoder B");
2168 dump_aud_reg(AUD_TCC_PIN_PIPE_CONN_ENTRY_LNGTH, "Audio Connection List entry and Length - Transcoder C");
2169 dump_aud_reg(AUD_PIPE_CONN_SEL_CTRL, "Audio Pipe Connection Select Control");
2170 dump_aud_reg(AUD_TCA_DIP_ELD_CTRL_ST, "Audio DIP and ELD control state - Transcoder A");
2171 dump_aud_reg(AUD_TCB_DIP_ELD_CTRL_ST, "Audio DIP and ELD control state - Transcoder B");
2172 dump_aud_reg(AUD_TCC_DIP_ELD_CTRL_ST, "Audio DIP and ELD control state - Transcoder C");
2173 dump_aud_reg(AUD_PIN_ELD_CP_VLD, "Audio pin ELD valid and CP ready status");
2174 dump_aud_reg(AUD_HDMI_FIFO_STATUS, "Audio HDMI FIFO Status");
Wang Xingchaoc4077222012-08-15 16:13:38 +08002175
Mengdong Lin85357202013-08-13 00:21:57 -04002176 /* Audio debug registers */
Mengdong Lin86d15e02014-03-03 13:52:06 -05002177 dump_aud_reg(AUD_ICOI, "Audio Immediate Command Output Interface");
2178 dump_aud_reg(AUD_IRII, "Audio Immediate Response Input Interface");
2179 dump_aud_reg(AUD_ICS, "Audio Immediate Command Status");
2180 dump_aud_reg(AUD_CHICKENBIT_REG, "Audio Chicken Bit Register");
2181 dump_aud_reg(AUD_DP_DIP_STATUS, "Audio DP and DIP FIFO Debug Status");
2182 dump_aud_reg(AUD_TCA_M_CTS, "Audio M CTS Read Back Transcoder A");
2183 dump_aud_reg(AUD_TCB_M_CTS, "Audio M CTS Read Back Transcoder B");
2184 dump_aud_reg(AUD_TCC_M_CTS, "Audio M CTS Read Back Transcoder C");
Mengdong Lin85357202013-08-13 00:21:57 -04002185
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04002186 printf("\nDetails:\n\n");
Wang Xingchaoc4077222012-08-15 16:13:38 +08002187
Mengdong Lindeba8682013-09-09 15:38:40 -04002188 dump_ddi_buf_ctl(PORT_A);
2189 dump_ddi_buf_ctl(PORT_B);
2190 dump_ddi_buf_ctl(PORT_C);
2191 dump_ddi_buf_ctl(PORT_D);
2192 dump_ddi_buf_ctl(PORT_E);
Wang Xingchaoc4077222012-08-15 16:13:38 +08002193
Mengdong Lindeba8682013-09-09 15:38:40 -04002194 dump_ddi_func_ctl(PIPE_A);
2195 dump_ddi_func_ctl(PIPE_B);
2196 dump_ddi_func_ctl(PIPE_C);
Wang Xingchaoc4077222012-08-15 16:13:38 +08002197
Mengdong Lindeba8682013-09-09 15:38:40 -04002198 /* audio configuration - details */
Mengdong Lin86d15e02014-03-03 13:52:06 -05002199 dump_aud_config(TRANSCODER_A);
2200 dump_aud_config(TRANSCODER_B);
2201 dump_aud_config(TRANSCODER_C);
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04002202
Mengdong Lindeba8682013-09-09 15:38:40 -04002203 dump_aud_misc_control(CONVERTER_1);
2204 dump_aud_misc_control(CONVERTER_2);
2205 dump_aud_misc_control(CONVERTER_3);
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04002206
Mengdong Lindeba8682013-09-09 15:38:40 -04002207 dump_aud_vendor_device_id();
2208 dump_aud_revision_id();
Wang Xingchaoc4077222012-08-15 16:13:38 +08002209
Mengdong Lindeba8682013-09-09 15:38:40 -04002210 dump_aud_m_cts_enable(TRANSCODER_A);
2211 dump_aud_m_cts_enable(TRANSCODER_B);
2212 dump_aud_m_cts_enable(TRANSCODER_C);
Wang Xingchaoc4077222012-08-15 16:13:38 +08002213
Mengdong Lindeba8682013-09-09 15:38:40 -04002214 dump_aud_power_state();
Wang Xingchaoc4077222012-08-15 16:13:38 +08002215
Mengdong Lindeba8682013-09-09 15:38:40 -04002216 dump_aud_edid_data(TRANSCODER_A);
2217 dump_aud_edid_data(TRANSCODER_B);
2218 dump_aud_edid_data(TRANSCODER_C);
Wang Xingchaoc4077222012-08-15 16:13:38 +08002219
Mengdong Lindeba8682013-09-09 15:38:40 -04002220 dump_aud_infoframe(TRANSCODER_A);
2221 dump_aud_infoframe(TRANSCODER_B);
2222 dump_aud_infoframe(TRANSCODER_C);
Wang Xingchaoc4077222012-08-15 16:13:38 +08002223
Mengdong Lindeba8682013-09-09 15:38:40 -04002224 dump_aud_pipe_conv_cfg();
Wang Xingchaoc4077222012-08-15 16:13:38 +08002225
Mengdong Lindeba8682013-09-09 15:38:40 -04002226 dump_aud_dig_cnvt(CONVERTER_1);
2227 dump_aud_dig_cnvt(CONVERTER_2);
2228 dump_aud_dig_cnvt(CONVERTER_3);
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04002229
Mengdong Lindeba8682013-09-09 15:38:40 -04002230 dump_aud_str_desc(CONVERTER_1);
2231 dump_aud_str_desc(CONVERTER_2);
2232 dump_aud_str_desc(CONVERTER_3);
Wang Xingchaoc4077222012-08-15 16:13:38 +08002233
Mengdong Lindeba8682013-09-09 15:38:40 -04002234 dump_aud_out_chan_map();
Wang Xingchaoc4077222012-08-15 16:13:38 +08002235
Mengdong Lindeba8682013-09-09 15:38:40 -04002236 dump_aud_connect_list_entry_length(TRANSCODER_A);
2237 dump_aud_connect_list_entry_length(TRANSCODER_B);
2238 dump_aud_connect_list_entry_length(TRANSCODER_C);
2239 dump_aud_connect_select_ctrl();
Wang Xingchaoc4077222012-08-15 16:13:38 +08002240
Mengdong Lindeba8682013-09-09 15:38:40 -04002241 dump_aud_dip_eld_ctrl_st(TRANSCODER_A);
2242 dump_aud_dip_eld_ctrl_st(TRANSCODER_B);
2243 dump_aud_dip_eld_ctrl_st(TRANSCODER_C);
Wang Xingchaoc4077222012-08-15 16:13:38 +08002244
Mengdong Lindeba8682013-09-09 15:38:40 -04002245 dump_aud_eld_cp_vld();
Mengdong Lin86d15e02014-03-03 13:52:06 -05002246 dump_aud_hdmi_fifo_status();
Mengdong Lin85357202013-08-13 00:21:57 -04002247
Mengdong Lin86d15e02014-03-03 13:52:06 -05002248 dword = read_aud_reg(AUD_ICS);
Mengdong Lin85357202013-08-13 00:21:57 -04002249 printf("IRV [%1lx] %s\t", BIT(dword, 1),
2250 OPNAME(immed_result_valid, BIT(dword, 1)));
2251 printf("ICB [%1lx] %s\n", BIT(dword, 1),
2252 OPNAME(immed_cmd_busy, BIT(dword, 0)));
Mengdong Linf075c3c2013-08-13 00:22:14 -04002253
Mengdong Lin86d15e02014-03-03 13:52:06 -05002254 dword = read_aud_reg(AUD_CHICKENBIT_REG);
Mengdong Linf075c3c2013-08-13 00:22:14 -04002255 printf("AUD_CHICKENBIT_REG Audio Chicken Bits: %08x\n", dword);
2256 if (IS_BROADWELL(devid))
2257 parse_bdw_audio_chicken_bit_reg(dword);
2258
Mengdong Lin86d15e02014-03-03 13:52:06 -05002259 dword = read_aud_reg(AUD_DP_DIP_STATUS);
Mengdong Lin97e5cf62013-08-13 00:22:24 -04002260 printf("AUD_DP_DIP_STATUS Audio DP & DIP FIFO Status: %08x\n\t", dword);
2261 for (i = 31; i >= 0; i--)
2262 if (BIT(dword, i))
2263 printf("%s\n\t", audio_dp_dip_status[i]);
2264 printf("\n");
Wang Xingchaoc4077222012-08-15 16:13:38 +08002265}
2266
Wu Fengguang020abdb2010-04-19 13:13:06 +08002267int main(int argc, char **argv)
2268{
2269 struct pci_device *pci_dev;
2270
2271 pci_dev = intel_get_pci_device();
2272 devid = pci_dev->device_id; /* XXX not true when mapping! */
2273
2274 do_self_tests();
2275
2276 if (argc == 2)
2277 intel_map_file(argv[1]);
2278 else
2279 intel_get_mmio(pci_dev);
2280
Mengdong Lin449509d2014-03-03 17:03:02 -05002281 if (IS_VALLEYVIEW(devid)) {
2282 printf("Valleyview audio registers:\n\n");
2283 dump_ironlake();
2284 } else if (IS_BROADWELL(devid) || IS_HASWELL(devid)) {
Mengdong Lin69cc00b2013-07-17 13:29:17 -04002285 printf("%s audio registers:\n\n",
2286 IS_BROADWELL(devid) ? "Broadwell" : "Haswell");
2287 dump_hsw_plus();
2288 } else if (IS_GEN6(devid) || IS_GEN7(devid)
2289 || getenv("HAS_PCH_SPLIT")) {
Wu Fengguang6fcb5cd2011-11-12 11:12:49 +08002290 printf("%s audio registers:\n\n",
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04002291 IS_GEN6(devid) ? "SandyBridge" : "IvyBridge");
Wu Fengguang020abdb2010-04-19 13:13:06 +08002292 intel_check_pch();
2293 dump_cpt();
Wu Fengguang6fcb5cd2011-11-12 11:12:49 +08002294 } else if (IS_GEN5(devid)) {
2295 printf("Ironlake audio registers:\n\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +08002296 dump_ironlake();
Wu Fengguang6fcb5cd2011-11-12 11:12:49 +08002297 } else if (IS_G4X(devid)) {
2298 printf("G45 audio registers:\n\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +08002299 dump_eaglelake();
Wu Fengguang6fcb5cd2011-11-12 11:12:49 +08002300 }
Wu Fengguang020abdb2010-04-19 13:13:06 +08002301
2302 return 0;
Wu Fengguang9e9c9f22009-11-06 11:06:22 +08002303}