blob: 26023743307bef38d18b81b657cd519557ca1419 [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>
Daniel Vetterc03c6ce2014-03-22 21:34:29 +010036#include "intel_io.h"
Daniel Vetter6cfcd712014-03-22 20:07:35 +010037#include "intel_reg.h"
38#include "intel_chipset.h"
39#include "drmtest.h"
Wu Fengguang9e9c9f22009-11-06 11:06:22 +080040
Wu Fengguang020abdb2010-04-19 13:13:06 +080041static uint32_t devid;
42
Mengdong Lin92d31972014-03-03 11:04:39 -050043static int aud_reg_base = 0; /* base address of audio registers */
44static int disp_reg_base = 0; /* base address of display registers */
Wu Fengguang020abdb2010-04-19 13:13:06 +080045
Mengdong Lin1803f1e2014-02-28 16:18:11 -050046#define IS_HASWELL_PLUS(devid) (IS_HASWELL(devid) || IS_BROADWELL(devid))
47
Wu Fengguang020abdb2010-04-19 13:13:06 +080048#define BITSTO(n) (n >= sizeof(long) * 8 ? ~0 : (1UL << (n)) - 1)
49#define BITMASK(high, low) (BITSTO(high+1) & ~BITSTO(low))
50#define BITS(reg, high, low) (((reg) & (BITMASK(high, low))) >> (low))
51#define BIT(reg, n) BITS(reg, n, n)
52
53#define min_t(type, x, y) ({ \
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -040054 type __min1 = (x); \
55 type __min2 = (y); \
56 __min1 < __min2 ? __min1 : __min2; })
Wu Fengguang020abdb2010-04-19 13:13:06 +080057
58#define OPNAME(names, index) \
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -040059 names[min_t(unsigned int, index, ARRAY_SIZE(names) - 1)]
Wu Fengguang020abdb2010-04-19 13:13:06 +080060
Mengdong Lin92d31972014-03-03 11:04:39 -050061#define set_aud_reg_base(base) (aud_reg_base = (base))
62
63#define set_reg_base(base, audio_offset) \
64 do { \
65 disp_reg_base = (base); \
66 set_aud_reg_base((base) + (audio_offset)); \
67 } while (0)
68
Wu Fengguang020abdb2010-04-19 13:13:06 +080069#define dump_reg(reg, desc) \
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -040070 do { \
71 dword = INREG(reg); \
72 printf("%-21s 0x%08x %s\n", # reg, dword, desc); \
73 } while (0)
Wu Fengguang020abdb2010-04-19 13:13:06 +080074
Mengdong Lin92d31972014-03-03 11:04:39 -050075#define dump_disp_reg(reg, desc) \
76 do { \
77 dword = INREG(disp_reg_base + reg); \
78 printf("%-21s 0x%08x %s\n", # reg, dword, desc); \
79 } while (0)
80
81#define dump_aud_reg(reg, desc) \
82 do { \
83 dword = INREG(aud_reg_base + reg); \
84 printf("%-21s 0x%08x %s\n", # reg, dword, desc); \
85 } while (0)
86
87#define read_aud_reg(reg) INREG(aud_reg_base + (reg))
Wu Fengguang020abdb2010-04-19 13:13:06 +080088
Mengdong Linbae8a002014-03-03 13:23:50 -050089static int get_num_pipes(void)
90{
91 int num_pipes;
92
93 if (IS_VALLEYVIEW(devid))
94 num_pipes = 2; /* Valleyview is Gen 7 but only has 2 pipes */
95 else if (IS_G4X(devid) || IS_GEN5(devid))
96 num_pipes = 2;
97 else
98 num_pipes = 3;
99
100 return num_pipes;
101}
102
Mengdong Lin8fe0c502014-03-13 16:38:02 -0400103static const char * const cts_m_value_index[] = {
104 [0] = "CTS",
105 [1] = "M",
106};
107
Mengdong Lindeba8682013-09-09 15:38:40 -0400108static const char * const pixel_clock[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800109 [0] = "25.2 / 1.001 MHz",
110 [1] = "25.2 MHz",
111 [2] = "27 MHz",
112 [3] = "27 * 1.001 MHz",
113 [4] = "54 MHz",
114 [5] = "54 * 1.001 MHz",
115 [6] = "74.25 / 1.001 MHz",
116 [7] = "74.25 MHz",
117 [8] = "148.5 / 1.001 MHz",
118 [9] = "148.5 MHz",
119 [10] = "Reserved",
120};
121
Mengdong Lindeba8682013-09-09 15:38:40 -0400122static const char * const power_state[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800123 [0] = "D0",
124 [1] = "D1",
125 [2] = "D2",
126 [3] = "D3",
127};
128
Mengdong Lindeba8682013-09-09 15:38:40 -0400129static const char * const stream_type[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800130 [0] = "default samples",
131 [1] = "one bit stream",
132 [2] = "DST stream",
133 [3] = "MLP stream",
134 [4] = "Reserved",
135};
136
Mengdong Lindeba8682013-09-09 15:38:40 -0400137static const char * const dip_port[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800138 [0] = "Reserved",
139 [1] = "Digital Port B",
140 [2] = "Digital Port C",
141 [3] = "Digital Port D",
142};
143
Mengdong Lindeba8682013-09-09 15:38:40 -0400144static const char * const dip_type[] = {
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400145 [0] = "Audio DIP Disabled",
146 [1] = "Audio DIP Enabled",
Wang Xingchaoc4077222012-08-15 16:13:38 +0800147};
148
Mengdong Lindeba8682013-09-09 15:38:40 -0400149static const char * const dip_gen1_state[] = {
150 [0] = "Generic 1 (ACP) DIP Disabled",
151 [1] = "Generic 1 (ACP) DIP Enabled",
152};
153
154static const char * const dip_gen2_state[] = {
155 [0] = "Generic 2 DIP Disabled",
156 [1] = "Generic 2 DIP Enabled",
157};
158
159static const char * const dip_index[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800160 [0] = "Audio DIP",
161 [1] = "ACP DIP",
162 [2] = "ISRC1 DIP",
163 [3] = "ISRC2 DIP",
164 [4] = "Reserved",
165};
166
Mengdong Lindeba8682013-09-09 15:38:40 -0400167static const char * const dip_trans[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800168 [0] = "disabled",
169 [1] = "reserved",
170 [2] = "send once",
171 [3] = "best effort",
172};
173
Mengdong Lindeba8682013-09-09 15:38:40 -0400174static const char * const video_dip_index[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800175 [0] = "AVI DIP",
176 [1] = "Vendor-specific DIP",
Wu Fengguangf3f84bb2011-11-12 11:12:55 +0800177 [2] = "Gamut Metadata DIP",
Wu Fengguang020abdb2010-04-19 13:13:06 +0800178 [3] = "Source Product Description DIP",
179};
180
Mengdong Lindeba8682013-09-09 15:38:40 -0400181static const char * const video_dip_trans[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800182 [0] = "send once",
183 [1] = "send every vsync",
184 [2] = "send at least every other vsync",
185 [3] = "reserved",
186};
187
Mengdong Lindeba8682013-09-09 15:38:40 -0400188static const char * const trans_to_port_sel[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800189 [0] = "no port",
190 [1] = "Digital Port B",
Wang Xingchaof9a24812012-08-15 16:13:37 +0800191 [2] = "Digital Port C",
192 [3] = "Digital Port D",
193 [4] = "reserved",
Alan Coopersmithc4610062012-01-06 14:37:19 -0800194 [5] = "reserved",
195 [6] = "reserved",
196 [7] = "reserved",
Wu Fengguang020abdb2010-04-19 13:13:06 +0800197};
198
Mengdong Lindeba8682013-09-09 15:38:40 -0400199static const char * const ddi_mode[] = {
Wang Xingchaoc4077222012-08-15 16:13:38 +0800200 [0] = "HDMI mode",
201 [1] = "DVI mode",
202 [2] = "DP SST mode",
203 [3] = "DP MST mode",
204 [4] = "DP FDI mode",
205 [5] = "reserved",
206 [6] = "reserved",
207 [7] = "reserved",
208};
209
Mengdong Lindeba8682013-09-09 15:38:40 -0400210static const char * const bits_per_color[] = {
211 [0] = "8 bpc",
212 [1] = "10 bpc",
213 [2] = "6 bpc",
214 [3] = "12 bpc",
215 [4] = "reserved",
216 [5] = "reserved",
217 [6] = "reserved",
218 [7] = "reserved",
219};
220
221static const char * const transcoder_select[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800222 [0] = "Transcoder A",
223 [1] = "Transcoder B",
224 [2] = "Transcoder C",
225 [3] = "reserved",
226};
227
Mengdong Lindeba8682013-09-09 15:38:40 -0400228static const char * const dp_port_width[] = {
Wu Fengguang020abdb2010-04-19 13:13:06 +0800229 [0] = "x1 mode",
230 [1] = "x2 mode",
Wu Fengguangcf4c12f2011-11-12 11:12:46 +0800231 [2] = "reserved",
232 [3] = "x4 mode",
Alan Coopersmithc4610062012-01-06 14:37:19 -0800233 [4] = "reserved",
234 [5] = "reserved",
235 [6] = "reserved",
236 [7] = "reserved",
Wu Fengguang020abdb2010-04-19 13:13:06 +0800237};
238
Mengdong Lindeba8682013-09-09 15:38:40 -0400239static const char * const sample_base_rate[] = {
240 [0] = "48 kHz",
241 [1] = "44.1 kHz",
242};
243
244static const char * const sample_base_rate_mult[] = {
245 [0] = "x1 (48 kHz, 44.1 kHz or less)",
246 [1] = "x2 (96 kHz, 88.2 kHz, 32 kHz)",
247 [2] = "x3 (144 kHz)",
248 [3] = "x4 (192 kHz, 176.4 kHz)",
249 [4] = "Reserved",
250};
251
252static const char * const sample_base_rate_divisor[] = {
253 [0] = "Divided by 1 (48 kHz, 44.1 kHz)",
254 [1] = "Divided by 2 (24 kHz, 22.05 kHz)",
255 [2] = "Divided by 3 (16 kHz, 32 kHz)",
256 [3] = "Divided by 4 (11.025 kHz)",
257 [4] = "Divided by 5 (9.6 kHz)",
258 [5] = "Divided by 6 (8 kHz)",
259 [6] = "Divided by 7",
260 [7] = "Divided by 8 (6 kHz)",
261};
262
263static const char * const connect_list_form[] = {
264 [0] = "Short Form",
265 [1] = "Long Form",
266};
267
268
269static const char * const bits_per_sample[] = {
Wu Fengguang12861a92011-11-12 11:12:47 +0800270 [0] = "reserved",
271 [1] = "16 bits",
272 [2] = "24 bits",
273 [3] = "32 bits",
274 [4] = "20 bits",
275 [5] = "reserved",
276};
277
Mengdong Lindeba8682013-09-09 15:38:40 -0400278static const char * const sdvo_hdmi_encoding[] = {
Wu Fengguangee949582011-11-12 11:12:53 +0800279 [0] = "SDVO",
280 [1] = "reserved",
281 [2] = "TMDS",
282 [3] = "reserved",
283};
Wu Fengguang12861a92011-11-12 11:12:47 +0800284
Mengdong Lindeba8682013-09-09 15:38:40 -0400285static const char * const n_index_value[] = {
Wu Fengguange64abe52012-01-17 07:19:24 +0800286 [0] = "HDMI",
287 [1] = "DisplayPort",
288};
289
Mengdong Lin85357202013-08-13 00:21:57 -0400290static const char * const immed_result_valid[] = {
291 [0] = "No immediate response is available",
292 [1] = "Immediate response is available",
293};
294
295static const char * const immed_cmd_busy[] = {
296 [0] = "Can accept an immediate command",
297 [1] = "Immediate command is available",
298};
299
Mengdong Linf075c3c2013-08-13 00:22:14 -0400300static const char * const vanilla_dp12_en[] = {
301 [0] = "DP 1.2 features are disabled",
302 [1] = "DP 1.2 features are enabled",
303};
304
305static const char * const vanilla_3_widgets_en[] = {
306 [0] = "2nd & 3rd pin/convertor widgets are disabled",
307 [1] = "All three pin/convertor widgets are enabled",
308};
309
310static const char * const block_audio[] = {
311 [0] = "Allow audio data to reach the port",
312 [1] = "Block audio data from reaching the port",
313};
314
315static const char * const dis_eld_valid_pulse_trans[] = {
316 [0] = "Enable ELD valid pulse transition when unsol is disabled",
317 [1] = "Disable ELD valid pulse transition when unsol is disabled",
318};
319
320static const char * const dis_pd_pulse_trans[] = {
321 [0] = "Enable Presense Detect pulse transition when unsol is disabled",
322 [1] = "Disable Presense Detect pulse transition when unsol is disabled",
323};
324
325static const char * const dis_ts_delta_err[] = {
326 [0] = "Enable timestamp delta error for 32/44 KHz",
327 [1] = "Disable timestamp delta error for 32/44 KHz",
328};
329
330static const char * const dis_ts_fix_dp_hbr[] = {
331 [0] = "Enable timestamp fix for DP HBR",
332 [1] = "Disable timestamp fix for DP HBR",
333};
334
335static const char * const pattern_gen_8_ch_en[] = {
336 [0] = "Disable 8-channel pattern generator",
337 [1] = "Enable 8-channel pattern generator",
338};
339
340static const char * const pattern_gen_2_ch_en[] = {
341 [0] = "Disable 2-channel pattern generator",
342 [1] = "Enable 2-channel pattern generator",
343};
344
345static const char * const fabric_32_44_dis[] = {
346 [0] = "Allow sample fabrication for 32/44 KHz",
347 [1] = "Disable sample fabrication for 32/44 KHz",
348};
349
350static const char * const epss_dis[] = {
351 [0] = "Allow audio EPSS",
352 [1] = "Disable audio EPSS",
353};
354
355static const char * const ts_test_mode[] = {
356 [0] = "Default time stamp mode",
357 [1] = "Audio time stamp test mode for audio only feature",
358};
359
360static const char * const en_mmio_program[] = {
361 [0] = "Programming by HD-Audio Azalia",
362 [1] = "Programming by MMIO debug registers",
363};
364
Mengdong Lin97e5cf62013-08-13 00:22:24 -0400365static const char * const audio_dp_dip_status[] = {
366 [0] = "audfc dp fifo full",
367 [1] = "audfc dp fifo empty",
368 [2] = "audfc dp fifo overrun",
369 [3] = "audfc dip fifo full",
370 [4] = "audfc dp fifo empty cd",
371 [5] = "audfb dp fifo full",
372 [6] = "audfb dp fifo empty",
373 [7] = "audfb dp fifo overrun",
374 [8] = "audfb dip fifo full",
375 [9] = "audfb dp fifo empty cd",
376 [10] = "audfa dp fifo full",
377 [11] = "audfa dp fifo empty",
378 [12] = "audfa dp fifo overrun",
379 [13] = "audfa dip fifo full",
380 [14] = "audfa dp fifo empty cd",
381 [15] = "Pipe c audio overflow",
382 [16] = "Pipe b audio overflow",
383 [17] = "Pipe a audio overflow",
384 [31] = 0,
385};
386
Mengdong Lined386662014-02-28 13:25:27 -0500387#undef TRANSCODER_A
388#undef TRANSCODER_B
389#undef TRANSCODER_C
390
391enum {
392 TRANSCODER_A = 0,
393 TRANSCODER_B,
394 TRANSCODER_C,
395};
396
397enum {
398 PIPE_A = 0,
399 PIPE_B,
400 PIPE_C,
401};
402
403enum {
404 PORT_A = 0,
405 PORT_B,
406 PORT_C,
407 PORT_D,
408 PORT_E,
409};
410
411enum {
412 CONVERTER_1 = 0,
413 CONVERTER_2,
414 CONVERTER_3,
415};
416
Wu Fengguang020abdb2010-04-19 13:13:06 +0800417static void do_self_tests(void)
418{
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400419 if (BIT(1, 0) != 1)
420 exit(1);
421 if (BIT(0x80000000, 31) != 1)
422 exit(2);
423 if (BITS(0xc0000000, 31, 30) != 3)
424 exit(3);
Wu Fengguang020abdb2010-04-19 13:13:06 +0800425}
426
427/*
428 * EagleLake registers
429 */
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800430#define AUD_CONFIG 0x62000
431#define AUD_DEBUG 0x62010
432#define AUD_VID_DID 0x62020
433#define AUD_RID 0x62024
434#define AUD_SUBN_CNT 0x62028
435#define AUD_FUNC_GRP 0x62040
436#define AUD_SUBN_CNT2 0x62044
437#define AUD_GRP_CAP 0x62048
438#define AUD_PWRST 0x6204c
439#define AUD_SUPPWR 0x62050
440#define AUD_SID 0x62054
441#define AUD_OUT_CWCAP 0x62070
442#define AUD_OUT_PCMSIZE 0x62074
443#define AUD_OUT_STR 0x62078
444#define AUD_OUT_DIG_CNVT 0x6207c
445#define AUD_OUT_CH_STR 0x62080
446#define AUD_OUT_STR_DESC 0x62084
447#define AUD_PINW_CAP 0x620a0
448#define AUD_PIN_CAP 0x620a4
449#define AUD_PINW_CONNLNG 0x620a8
450#define AUD_PINW_CONNLST 0x620ac
451#define AUD_PINW_CNTR 0x620b0
452#define AUD_PINW_UNSOLRESP 0x620b8
453#define AUD_CNTL_ST 0x620b4
454#define AUD_PINW_CONFIG 0x620bc
455#define AUD_HDMIW_STATUS 0x620d4
456#define AUD_HDMIW_HDMIEDID 0x6210c
457#define AUD_HDMIW_INFOFR 0x62118
458#define AUD_CONV_CHCNT 0x62120
459#define AUD_CTS_ENABLE 0x62128
460
461#define VIDEO_DIP_CTL 0x61170
462#define VIDEO_DIP_ENABLE (1<<31)
463#define VIDEO_DIP_ENABLE_AVI (1<<21)
464#define VIDEO_DIP_ENABLE_VENDOR (1<<22)
465#define VIDEO_DIP_ENABLE_SPD (1<<24)
466#define VIDEO_DIP_BUF_AVI (0<<19)
467#define VIDEO_DIP_BUF_VENDOR (1<<19)
468#define VIDEO_DIP_BUF_SPD (3<<19)
469#define VIDEO_DIP_TRANS_ONCE (0<<16)
470#define VIDEO_DIP_TRANS_1 (1<<16)
471#define VIDEO_DIP_TRANS_2 (2<<16)
472
473#define AUDIO_HOTPLUG_EN (1<<24)
474
475
Wu Fengguang020abdb2010-04-19 13:13:06 +0800476static void dump_eaglelake(void)
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800477{
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400478 uint32_t dword;
479 int i;
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800480
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400481 /* printf("%-18s %8s %s\n\n", "register name", "raw value", "description"); */
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800482
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400483 dump_reg(VIDEO_DIP_CTL, "Video DIP Control");
484 dump_reg(SDVOB, "Digital Display Port B Control Register");
485 dump_reg(SDVOC, "Digital Display Port C Control Register");
486 dump_reg(PORT_HOTPLUG_EN, "Hot Plug Detect Enable");
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800487
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400488 dump_reg(AUD_CONFIG, "Audio Configuration");
489 dump_reg(AUD_DEBUG, "Audio Debug");
490 dump_reg(AUD_VID_DID, "Audio Vendor ID / Device ID");
491 dump_reg(AUD_RID, "Audio Revision ID");
492 dump_reg(AUD_SUBN_CNT, "Audio Subordinate Node Count");
493 dump_reg(AUD_FUNC_GRP, "Audio Function Group Type");
494 dump_reg(AUD_SUBN_CNT2, "Audio Subordinate Node Count");
495 dump_reg(AUD_GRP_CAP, "Audio Function Group Capabilities");
496 dump_reg(AUD_PWRST, "Audio Power State");
497 dump_reg(AUD_SUPPWR, "Audio Supported Power States");
498 dump_reg(AUD_SID, "Audio Root Node Subsystem ID");
499 dump_reg(AUD_OUT_CWCAP, "Audio Output Converter Widget Capabilities");
500 dump_reg(AUD_OUT_PCMSIZE, "Audio PCM Size and Rates");
501 dump_reg(AUD_OUT_STR, "Audio Stream Formats");
502 dump_reg(AUD_OUT_DIG_CNVT, "Audio Digital Converter");
503 dump_reg(AUD_OUT_CH_STR, "Audio Channel ID and Stream ID");
504 dump_reg(AUD_OUT_STR_DESC, "Audio Stream Descriptor Format");
505 dump_reg(AUD_PINW_CAP, "Audio Pin Complex Widget Capabilities");
506 dump_reg(AUD_PIN_CAP, "Audio Pin Capabilities");
507 dump_reg(AUD_PINW_CONNLNG, "Audio Connection List Length");
508 dump_reg(AUD_PINW_CONNLST, "Audio Connection List Entry");
509 dump_reg(AUD_PINW_CNTR, "Audio Pin Widget Control");
510 dump_reg(AUD_PINW_UNSOLRESP, "Audio Unsolicited Response Enable");
511 dump_reg(AUD_CNTL_ST, "Audio Control State Register");
512 dump_reg(AUD_PINW_CONFIG, "Audio Configuration Default");
513 dump_reg(AUD_HDMIW_STATUS, "Audio HDMI Status");
514 dump_reg(AUD_HDMIW_HDMIEDID, "Audio HDMI Data EDID Block");
515 dump_reg(AUD_HDMIW_INFOFR, "Audio HDMI Widget Data Island Packet");
516 dump_reg(AUD_CONV_CHCNT, "Audio Converter Channel Count");
517 dump_reg(AUD_CTS_ENABLE, "Audio CTS Programming Enable");
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800518
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400519 printf("\nDetails:\n\n");
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800520
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400521 dword = INREG(AUD_VID_DID);
522 printf("AUD_VID_DID vendor id\t\t\t0x%x\n", dword >> 16);
523 printf("AUD_VID_DID device id\t\t\t0x%x\n", dword & 0xffff);
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800524
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400525 dword = INREG(AUD_RID);
526 printf("AUD_RID major revision\t\t\t0x%lx\n", BITS(dword, 23, 20));
527 printf("AUD_RID minor revision\t\t\t0x%lx\n", BITS(dword, 19, 16));
528 printf("AUD_RID revision id\t\t\t0x%lx\n", BITS(dword, 15, 8));
529 printf("AUD_RID stepping id\t\t\t0x%lx\n", BITS(dword, 7, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800530
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400531 dword = INREG(SDVOB);
532 printf("SDVOB enable\t\t\t\t%u\n", !!(dword & SDVO_ENABLE));
533 printf("SDVOB HDMI encoding\t\t\t%u\n", !!(dword & SDVO_ENCODING_HDMI));
534 printf("SDVOB SDVO encoding\t\t\t%u\n", !!(dword & SDVO_ENCODING_SDVO));
535 printf("SDVOB null packets\t\t\t%u\n", !!(dword & SDVO_NULL_PACKETS_DURING_VSYNC));
536 printf("SDVOB audio enabled\t\t\t%u\n", !!(dword & SDVO_AUDIO_ENABLE));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800537
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400538 dword = INREG(SDVOC);
539 printf("SDVOC enable\t\t\t\t%u\n", !!(dword & SDVO_ENABLE));
540 printf("SDVOC HDMI encoding\t\t\t%u\n", !!(dword & SDVO_ENCODING_HDMI));
541 printf("SDVOC SDVO encoding\t\t\t%u\n", !!(dword & SDVO_ENCODING_SDVO));
542 printf("SDVOC null packets\t\t\t%u\n", !!(dword & SDVO_NULL_PACKETS_DURING_VSYNC));
543 printf("SDVOC audio enabled\t\t\t%u\n", !!(dword & SDVO_AUDIO_ENABLE));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800544
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400545 dword = INREG(PORT_HOTPLUG_EN);
546 printf("PORT_HOTPLUG_EN DisplayPort/HDMI port B\t%ld\n", BIT(dword, 29)),
547 printf("PORT_HOTPLUG_EN DisplayPort/HDMI port C\t%ld\n", BIT(dword, 28)),
548 printf("PORT_HOTPLUG_EN DisplayPort port D\t%ld\n", BIT(dword, 27)),
549 printf("PORT_HOTPLUG_EN SDVOB\t\t\t%ld\n", BIT(dword, 26)),
550 printf("PORT_HOTPLUG_EN SDVOC\t\t\t%ld\n", BIT(dword, 25)),
551 printf("PORT_HOTPLUG_EN audio\t\t\t%ld\n", BIT(dword, 24)),
552 printf("PORT_HOTPLUG_EN TV\t\t\t%ld\n", BIT(dword, 23)),
553 printf("PORT_HOTPLUG_EN CRT\t\t\t%ld\n", BIT(dword, 9)),
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800554
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400555 dword = INREG(VIDEO_DIP_CTL);
556 printf("VIDEO_DIP_CTL enable graphics DIP\t%ld\n", BIT(dword, 31)),
557 printf("VIDEO_DIP_CTL port select\t\t[0x%lx] %s\n",
558 BITS(dword, 30, 29), dip_port[BITS(dword, 30, 29)]);
559 printf("VIDEO_DIP_CTL DIP buffer trans active\t%lu\n", BIT(dword, 28));
560 printf("VIDEO_DIP_CTL AVI DIP enabled\t\t%lu\n", BIT(dword, 21));
561 printf("VIDEO_DIP_CTL vendor DIP enabled\t%lu\n", BIT(dword, 22));
562 printf("VIDEO_DIP_CTL SPD DIP enabled\t\t%lu\n", BIT(dword, 24));
563 printf("VIDEO_DIP_CTL DIP buffer index\t\t[0x%lx] %s\n",
564 BITS(dword, 20, 19), video_dip_index[BITS(dword, 20, 19)]);
565 printf("VIDEO_DIP_CTL DIP trans freq\t\t[0x%lx] %s\n",
566 BITS(dword, 17, 16), video_dip_trans[BITS(dword, 17, 16)]);
567 printf("VIDEO_DIP_CTL DIP buffer size\t\t%lu\n", BITS(dword, 11, 8));
568 printf("VIDEO_DIP_CTL DIP address\t\t%lu\n", BITS(dword, 3, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800569
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400570 dword = INREG(AUD_CONFIG);
571 printf("AUD_CONFIG pixel clock\t\t\t[0x%lx] %s\n", BITS(dword, 19, 16),
572 OPNAME(pixel_clock, BITS(dword, 19, 16)));
573 printf("AUD_CONFIG fabrication enabled\t\t%lu\n", BITS(dword, 2, 2));
574 printf("AUD_CONFIG professional use allowed\t%lu\n", BIT(dword, 1));
575 printf("AUD_CONFIG fuse enabled\t\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_DEBUG);
578 printf("AUD_DEBUG function reset\t\t%lu\n", BIT(dword, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800579
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400580 dword = INREG(AUD_SUBN_CNT);
581 printf("AUD_SUBN_CNT starting node number\t0x%lx\n", BITS(dword, 23, 16));
582 printf("AUD_SUBN_CNT total number of nodes\t0x%lx\n", BITS(dword, 7, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800583
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400584 dword = INREG(AUD_SUBN_CNT2);
585 printf("AUD_SUBN_CNT2 starting node number\t0x%lx\n", BITS(dword, 24, 16));
586 printf("AUD_SUBN_CNT2 total number of nodes\t0x%lx\n", BITS(dword, 7, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800587
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400588 dword = INREG(AUD_FUNC_GRP);
589 printf("AUD_FUNC_GRP unsol capable\t\t%lu\n", BIT(dword, 8));
590 printf("AUD_FUNC_GRP node type\t\t\t0x%lx\n", BITS(dword, 7, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800591
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400592 dword = INREG(AUD_GRP_CAP);
593 printf("AUD_GRP_CAP beep 0\t\t\t%lu\n", BIT(dword, 16));
594 printf("AUD_GRP_CAP input delay\t\t\t%lu\n", BITS(dword, 11, 8));
595 printf("AUD_GRP_CAP output delay\t\t%lu\n", BITS(dword, 3, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800596
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400597 dword = INREG(AUD_PWRST);
598 printf("AUD_PWRST device power state\t\t%s\n",
599 power_state[BITS(dword, 5, 4)]);
600 printf("AUD_PWRST device power state setting\t%s\n",
601 power_state[BITS(dword, 1, 0)]);
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800602
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400603 dword = INREG(AUD_SUPPWR);
604 printf("AUD_SUPPWR support D0\t\t\t%lu\n", BIT(dword, 0));
605 printf("AUD_SUPPWR support D1\t\t\t%lu\n", BIT(dword, 1));
606 printf("AUD_SUPPWR support D2\t\t\t%lu\n", BIT(dword, 2));
607 printf("AUD_SUPPWR support D3\t\t\t%lu\n", BIT(dword, 3));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800608
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400609 dword = INREG(AUD_OUT_CWCAP);
610 printf("AUD_OUT_CWCAP widget type\t\t0x%lx\n", BITS(dword, 23, 20));
611 printf("AUD_OUT_CWCAP sample delay\t\t0x%lx\n", BITS(dword, 19, 16));
612 printf("AUD_OUT_CWCAP channel count\t\t%lu\n",
613 BITS(dword, 15, 13) * 2 + BIT(dword, 0) + 1);
614 printf("AUD_OUT_CWCAP L-R swap\t\t\t%lu\n", BIT(dword, 11));
615 printf("AUD_OUT_CWCAP power control\t\t%lu\n", BIT(dword, 10));
616 printf("AUD_OUT_CWCAP digital\t\t\t%lu\n", BIT(dword, 9));
617 printf("AUD_OUT_CWCAP conn list\t\t\t%lu\n", BIT(dword, 8));
618 printf("AUD_OUT_CWCAP unsol\t\t\t%lu\n", BIT(dword, 7));
619 printf("AUD_OUT_CWCAP mute\t\t\t%lu\n", BIT(dword, 5));
620 printf("AUD_OUT_CWCAP format override\t\t%lu\n", BIT(dword, 4));
621 printf("AUD_OUT_CWCAP amp param override\t%lu\n", BIT(dword, 3));
622 printf("AUD_OUT_CWCAP out amp present\t\t%lu\n", BIT(dword, 2));
623 printf("AUD_OUT_CWCAP in amp present\t\t%lu\n", BIT(dword, 1));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800624
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400625 dword = INREG(AUD_OUT_DIG_CNVT);
626 printf("AUD_OUT_DIG_CNVT SPDIF category\t\t0x%lx\n", BITS(dword, 14, 8));
627 printf("AUD_OUT_DIG_CNVT SPDIF level\t\t%lu\n", BIT(dword, 7));
628 printf("AUD_OUT_DIG_CNVT professional\t\t%lu\n", BIT(dword, 6));
629 printf("AUD_OUT_DIG_CNVT non PCM\t\t%lu\n", BIT(dword, 5));
630 printf("AUD_OUT_DIG_CNVT copyright asserted\t%lu\n", BIT(dword, 4));
631 printf("AUD_OUT_DIG_CNVT filter preemphasis\t%lu\n", BIT(dword, 3));
632 printf("AUD_OUT_DIG_CNVT validity config\t%lu\n", BIT(dword, 2));
633 printf("AUD_OUT_DIG_CNVT validity flag\t\t%lu\n", BIT(dword, 1));
634 printf("AUD_OUT_DIG_CNVT digital enable\t\t%lu\n", BIT(dword, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800635
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400636 dword = INREG(AUD_OUT_CH_STR);
637 printf("AUD_OUT_CH_STR stream id\t\t0x%lx\n", BITS(dword, 7, 4));
638 printf("AUD_OUT_CH_STR lowest channel\t\t%lu\n", BITS(dword, 3, 0));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800639
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400640 dword = INREG(AUD_OUT_STR_DESC);
641 printf("AUD_OUT_STR_DESC stream channels\t%lu\n", BITS(dword, 3, 0) + 1);
642 printf("AUD_OUT_STR_DESC Bits per Sample\t[%#lx] %s\n",
643 BITS(dword, 6, 4), OPNAME(bits_per_sample, BITS(dword, 6, 4)));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800644
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400645 dword = INREG(AUD_PINW_CAP);
646 printf("AUD_PINW_CAP widget type\t\t0x%lx\n", BITS(dword, 23, 20));
647 printf("AUD_PINW_CAP sample delay\t\t0x%lx\n", BITS(dword, 19, 16));
648 printf("AUD_PINW_CAP channel count\t\t%lu\n",
649 BITS(dword, 15, 13) * 2 + BIT(dword, 0) + 1);
650 printf("AUD_PINW_CAP HDCP\t\t\t%lu\n", BIT(dword, 12));
651 printf("AUD_PINW_CAP L-R swap\t\t\t%lu\n", BIT(dword, 11));
652 printf("AUD_PINW_CAP power control\t\t%lu\n", BIT(dword, 10));
653 printf("AUD_PINW_CAP digital\t\t\t%lu\n", BIT(dword, 9));
654 printf("AUD_PINW_CAP conn list\t\t\t%lu\n", BIT(dword, 8));
655 printf("AUD_PINW_CAP unsol\t\t\t%lu\n", BIT(dword, 7));
656 printf("AUD_PINW_CAP mute\t\t\t%lu\n", BIT(dword, 5));
657 printf("AUD_PINW_CAP format override\t\t%lu\n", BIT(dword, 4));
658 printf("AUD_PINW_CAP amp param override\t\t%lu\n", BIT(dword, 3));
659 printf("AUD_PINW_CAP out amp present\t\t%lu\n", BIT(dword, 2));
660 printf("AUD_PINW_CAP in amp present\t\t%lu\n", BIT(dword, 1));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800661
662
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400663 dword = INREG(AUD_PIN_CAP);
664 printf("AUD_PIN_CAP EAPD\t\t\t%lu\n", BIT(dword, 16));
665 printf("AUD_PIN_CAP HDMI\t\t\t%lu\n", BIT(dword, 7));
666 printf("AUD_PIN_CAP output\t\t\t%lu\n", BIT(dword, 4));
667 printf("AUD_PIN_CAP presence detect\t\t%lu\n", BIT(dword, 2));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800668
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400669 dword = INREG(AUD_PINW_CNTR);
670 printf("AUD_PINW_CNTR mute status\t\t%lu\n", BIT(dword, 8));
671 printf("AUD_PINW_CNTR out enable\t\t%lu\n", BIT(dword, 6));
672 printf("AUD_PINW_CNTR amp mute status\t\t%lu\n", BIT(dword, 8));
673 printf("AUD_PINW_CNTR amp mute status\t\t%lu\n", BIT(dword, 8));
674 printf("AUD_PINW_CNTR stream type\t\t[0x%lx] %s\n",
675 BITS(dword, 2, 0),
676 OPNAME(stream_type, BITS(dword, 2, 0)));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800677
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400678 dword = INREG(AUD_PINW_UNSOLRESP);
679 printf("AUD_PINW_UNSOLRESP enable unsol resp\t%lu\n", BIT(dword, 31));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800680
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400681 dword = INREG(AUD_CNTL_ST);
682 printf("AUD_CNTL_ST DIP audio enabled\t\t%lu\n", BIT(dword, 21));
683 printf("AUD_CNTL_ST DIP ACP enabled\t\t%lu\n", BIT(dword, 22));
684 printf("AUD_CNTL_ST DIP ISRCx enabled\t\t%lu\n", BIT(dword, 23));
685 printf("AUD_CNTL_ST DIP port select\t\t[0x%lx] %s\n",
686 BITS(dword, 30, 29), dip_port[BITS(dword, 30, 29)]);
687 printf("AUD_CNTL_ST DIP buffer index\t\t[0x%lx] %s\n",
688 BITS(dword, 20, 18), OPNAME(dip_index, BITS(dword, 20, 18)));
689 printf("AUD_CNTL_ST DIP trans freq\t\t[0x%lx] %s\n",
690 BITS(dword, 17, 16), dip_trans[BITS(dword, 17, 16)]);
691 printf("AUD_CNTL_ST DIP address\t\t\t%lu\n", BITS(dword, 3, 0));
692 printf("AUD_CNTL_ST CP ready\t\t\t%lu\n", BIT(dword, 15));
693 printf("AUD_CNTL_ST ELD valid\t\t\t%lu\n", BIT(dword, 14));
694 printf("AUD_CNTL_ST ELD ack\t\t\t%lu\n", BIT(dword, 4));
695 printf("AUD_CNTL_ST ELD bufsize\t\t\t%lu\n", BITS(dword, 13, 9));
696 printf("AUD_CNTL_ST ELD address\t\t\t%lu\n", BITS(dword, 8, 5));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800697
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400698 dword = INREG(AUD_HDMIW_STATUS);
699 printf("AUD_HDMIW_STATUS CDCLK/DOTCLK underrun\t%lu\n", BIT(dword, 31));
700 printf("AUD_HDMIW_STATUS CDCLK/DOTCLK overrun\t%lu\n", BIT(dword, 30));
701 printf("AUD_HDMIW_STATUS BCLK/CDCLK underrun\t%lu\n", BIT(dword, 29));
702 printf("AUD_HDMIW_STATUS BCLK/CDCLK overrun\t%lu\n", BIT(dword, 28));
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800703
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400704 dword = INREG(AUD_CONV_CHCNT);
705 printf("AUD_CONV_CHCNT HDMI HBR enabled\t\t%lu\n", BITS(dword, 15, 14));
706 printf("AUD_CONV_CHCNT HDMI channel count\t%lu\n", BITS(dword, 11, 8) + 1);
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800707
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400708 printf("AUD_CONV_CHCNT HDMI channel mapping:\n");
709 for (i = 0; i < 8; i++) {
710 OUTREG(AUD_CONV_CHCNT, i);
711 dword = INREG(AUD_CONV_CHCNT);
712 printf("\t\t\t\t\t[0x%x] %u => %lu\n", dword, i, BITS(dword, 7, 4));
713 }
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800714
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400715 printf("AUD_HDMIW_HDMIEDID HDMI ELD:\n\t");
716 dword = INREG(AUD_CNTL_ST);
717 dword &= ~BITMASK(8, 5);
718 OUTREG(AUD_CNTL_ST, dword);
719 for (i = 0; i < BITS(dword, 14, 10) / 4; i++)
720 printf("%08x ", htonl(INREG(AUD_HDMIW_HDMIEDID)));
721 printf("\n");
Wu Fengguangf32aecb2011-11-12 11:12:50 +0800722
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400723 printf("AUD_HDMIW_INFOFR HDMI audio Infoframe:\n\t");
724 dword = INREG(AUD_CNTL_ST);
725 dword &= ~BITMASK(20, 18);
726 dword &= ~BITMASK(3, 0);
727 OUTREG(AUD_CNTL_ST, dword);
728 for (i = 0; i < 8; i++)
729 printf("%08x ", htonl(INREG(AUD_HDMIW_INFOFR)));
730 printf("\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +0800731}
Wu Fengguang9e9c9f22009-11-06 11:06:22 +0800732
Wu Fengguang020abdb2010-04-19 13:13:06 +0800733#undef AUD_RID
734#undef AUD_VID_DID
735#undef AUD_PWRST
736#undef AUD_OUT_CH_STR
737#undef AUD_HDMIW_STATUS
738
739/*
Wu Fengguang020abdb2010-04-19 13:13:06 +0800740 * CougarPoint registers
741 */
Wu Fengguang97d20312011-11-12 11:12:45 +0800742#define DP_CTL_B 0xE4100
Wu Fengguang020abdb2010-04-19 13:13:06 +0800743#define DP_CTL_C 0xE4200
744#define DP_AUX_CTL_C 0xE4210
745#define DP_AUX_TST_C 0xE4228
746#define SPORT_DDI_CRC_C 0xE4250
747#define SPORT_DDI_CRC_R 0xE4264
748#define DP_CTL_D 0xE4300
749#define DP_AUX_CTL_D 0xE4310
750#define DP_AUX_TST_D 0xE4328
751#define SPORT_DDI_CRC_CTL_D 0xE4350
752#define AUD_CONFIG_A 0xE5000
753#define AUD_MISC_CTRL_A 0xE5010
754#define AUD_VID_DID 0xE5020
755#define AUD_RID 0xE5024
756#define AUD_CTS_ENABLE_A 0xE5028
757#define AUD_PWRST 0xE504C
758#define AUD_HDMIW_HDMIEDID_A 0xE5050
759#define AUD_HDMIW_INFOFR_A 0xE5054
760#define AUD_PORT_EN_HD_CFG 0xE507C
761#define AUD_OUT_DIG_CNVT_A 0xE5080
762#define AUD_OUT_STR_DESC_A 0xE5084
763#define AUD_OUT_CH_STR 0xE5088
764#define AUD_PINW_CONNLNG_LIST 0xE50A8
Mengdong Lin86d15e02014-03-03 13:52:06 -0500765#define AUD_PINW_CONNLNG_SEL 0xE50AC
Wu Fengguang020abdb2010-04-19 13:13:06 +0800766#define AUD_CNTL_ST_A 0xE50B4
767#define AUD_CNTRL_ST2 0xE50C0
768#define AUD_CNTRL_ST3 0xE50C4
769#define AUD_HDMIW_STATUS 0xE50D4
770#define AUD_CONFIG_B 0xE5100
771#define AUD_MISC_CTRL_B 0xE5110
772#define AUD_CTS_ENABLE_B 0xE5128
773#define AUD_HDMIW_HDMIEDID_B 0xE5150
774#define AUD_HDMIW_INFOFR_B 0xE5154
775#define AUD_OUT_DIG_CNVT_B 0xE5180
776#define AUD_OUT_STR_DESC_B 0xE5184
777#define AUD_CNTL_ST_B 0xE51B4
778#define AUD_CONFIG_C 0xE5200
779#define AUD_MISC_CTRL_C 0xE5210
780#define AUD_CTS_ENABLE_C 0xE5228
781#define AUD_HDMIW_HDMIEDID_C 0xE5250
782#define AUD_HDMIW_INFOFR_C 0xE5254
783#define AUD_OUT_DIG_CNVT_C 0xE5280
784#define AUD_OUT_STR_DESC_C 0xE5284
785#define AUD_CNTL_ST_C 0xE52B4
786#define AUD_CONFIG_D 0xE5300
787#define AUD_MISC_CTRL_D 0xE5310
788#define AUD_CTS_ENABLE_D 0xE5328
789#define AUD_HDMIW_HDMIEDID_D 0xE5350
790#define AUD_HDMIW_INFOFR_D 0xE5354
791#define AUD_OUT_DIG_CNVT_D 0xE5380
792#define AUD_OUT_STR_DESC_D 0xE5384
793#define AUD_CNTL_ST_D 0xE53B4
794
Wu Fengguange321f132011-11-12 11:12:52 +0800795#define VIDEO_DIP_CTL_A 0xE0200
796#define VIDEO_DIP_CTL_B 0xE1200
797#define VIDEO_DIP_CTL_C 0xE2200
798#define VIDEO_DIP_CTL_D 0xE3200
799
Wu Fengguang020abdb2010-04-19 13:13:06 +0800800
801static void dump_cpt(void)
802{
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400803 uint32_t dword;
804 int i;
Wu Fengguang020abdb2010-04-19 13:13:06 +0800805
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400806 dump_reg(HDMIB, "sDVO/HDMI Port B Control");
807 dump_reg(HDMIC, "HDMI Port C Control");
808 dump_reg(HDMID, "HDMI Port D Control");
809 dump_reg(DP_CTL_B, "DisplayPort B Control");
810 dump_reg(DP_CTL_C, "DisplayPort C Control");
811 dump_reg(DP_CTL_D, "DisplayPort D Control");
812 dump_reg(TRANS_DP_CTL_A, "Transcoder A DisplayPort Control");
813 dump_reg(TRANS_DP_CTL_B, "Transcoder B DisplayPort Control");
814 dump_reg(TRANS_DP_CTL_C, "Transcoder C DisplayPort Control");
815 dump_reg(AUD_CONFIG_A, "Audio Configuration - Transcoder A");
816 dump_reg(AUD_CONFIG_B, "Audio Configuration - Transcoder B");
817 dump_reg(AUD_CONFIG_C, "Audio Configuration - Transcoder C");
818 dump_reg(AUD_CTS_ENABLE_A, "Audio CTS Programming Enable - Transcoder A");
819 dump_reg(AUD_CTS_ENABLE_B, "Audio CTS Programming Enable - Transcoder B");
820 dump_reg(AUD_CTS_ENABLE_C, "Audio CTS Programming Enable - Transcoder C");
821 dump_reg(AUD_MISC_CTRL_A, "Audio MISC Control for Transcoder A");
822 dump_reg(AUD_MISC_CTRL_B, "Audio MISC Control for Transcoder B");
823 dump_reg(AUD_MISC_CTRL_C, "Audio MISC Control for Transcoder C");
824 dump_reg(AUD_VID_DID, "Audio Vendor ID / Device ID");
825 dump_reg(AUD_RID, "Audio Revision ID");
826 dump_reg(AUD_PWRST, "Audio Power State (Function Group, Convertor, Pin Widget)");
827 dump_reg(AUD_PORT_EN_HD_CFG, "Audio Port Enable HDAudio Config");
828 dump_reg(AUD_OUT_DIG_CNVT_A, "Audio Digital Converter - Conv A");
829 dump_reg(AUD_OUT_DIG_CNVT_B, "Audio Digital Converter - Conv B");
830 dump_reg(AUD_OUT_DIG_CNVT_C, "Audio Digital Converter - Conv C");
831 dump_reg(AUD_OUT_CH_STR, "Audio Channel ID and Stream ID");
832 dump_reg(AUD_OUT_STR_DESC_A, "Audio Stream Descriptor Format - Conv A");
833 dump_reg(AUD_OUT_STR_DESC_B, "Audio Stream Descriptor Format - Conv B");
834 dump_reg(AUD_OUT_STR_DESC_C, "Audio Stream Descriptor Format - Conv C");
835 dump_reg(AUD_PINW_CONNLNG_LIST, "Audio Connection List");
836 dump_reg(AUD_PINW_CONNLNG_SEL, "Audio Connection Select");
837 dump_reg(AUD_CNTL_ST_A, "Audio Control State Register - Transcoder A");
838 dump_reg(AUD_CNTL_ST_B, "Audio Control State Register - Transcoder B");
839 dump_reg(AUD_CNTL_ST_C, "Audio Control State Register - Transcoder C");
840 dump_reg(AUD_CNTRL_ST2, "Audio Control State 2");
841 dump_reg(AUD_CNTRL_ST3, "Audio Control State 3");
842 dump_reg(AUD_HDMIW_STATUS, "Audio HDMI Status");
843 dump_reg(AUD_HDMIW_HDMIEDID_A, "HDMI Data EDID Block - Transcoder A");
844 dump_reg(AUD_HDMIW_HDMIEDID_B, "HDMI Data EDID Block - Transcoder B");
845 dump_reg(AUD_HDMIW_HDMIEDID_C, "HDMI Data EDID Block - Transcoder C");
846 dump_reg(AUD_HDMIW_INFOFR_A, "Audio Widget Data Island Packet - Transcoder A");
847 dump_reg(AUD_HDMIW_INFOFR_B, "Audio Widget Data Island Packet - Transcoder B");
848 dump_reg(AUD_HDMIW_INFOFR_C, "Audio Widget Data Island Packet - Transcoder C");
Wu Fengguang020abdb2010-04-19 13:13:06 +0800849
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400850 printf("\nDetails:\n\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +0800851
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400852 dword = INREG(VIDEO_DIP_CTL_A);
853 printf("VIDEO_DIP_CTL_A Enable_Graphics_DIP\t\t\t%ld\n", BIT(dword, 31)),
854 printf("VIDEO_DIP_CTL_A GCP_DIP_enable\t\t\t\t%ld\n", BIT(dword, 25)),
855 printf("VIDEO_DIP_CTL_A Video_DIP_type_enable AVI\t\t%lu\n", BIT(dword, 21));
856 printf("VIDEO_DIP_CTL_A Video_DIP_type_enable Vendor\t\t%lu\n", BIT(dword, 22));
857 printf("VIDEO_DIP_CTL_A Video_DIP_type_enable Gamut\t\t%lu\n", BIT(dword, 23));
858 printf("VIDEO_DIP_CTL_A Video_DIP_type_enable Source \t\t%lu\n", BIT(dword, 24));
859 printf("VIDEO_DIP_CTL_A Video_DIP_buffer_index\t\t\t[0x%lx] %s\n",
860 BITS(dword, 20, 19), video_dip_index[BITS(dword, 20, 19)]);
861 printf("VIDEO_DIP_CTL_A Video_DIP_frequency\t\t\t[0x%lx] %s\n",
862 BITS(dword, 17, 16), video_dip_trans[BITS(dword, 17, 16)]);
863 printf("VIDEO_DIP_CTL_A Video_DIP_buffer_size\t\t\t%lu\n", BITS(dword, 11, 8));
864 printf("VIDEO_DIP_CTL_A Video_DIP_access_address\t\t%lu\n", BITS(dword, 3, 0));
Wu Fengguange321f132011-11-12 11:12:52 +0800865
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400866 dword = INREG(VIDEO_DIP_CTL_B);
867 printf("VIDEO_DIP_CTL_B Enable_Graphics_DIP\t\t\t%ld\n", BIT(dword, 31)),
868 printf("VIDEO_DIP_CTL_B GCP_DIP_enable\t\t\t\t%ld\n", BIT(dword, 25)),
869 printf("VIDEO_DIP_CTL_B Video_DIP_type_enable AVI\t\t%lu\n", BIT(dword, 21));
870 printf("VIDEO_DIP_CTL_B Video_DIP_type_enable Vendor\t\t%lu\n", BIT(dword, 22));
871 printf("VIDEO_DIP_CTL_B Video_DIP_type_enable Gamut\t\t%lu\n", BIT(dword, 23));
872 printf("VIDEO_DIP_CTL_B Video_DIP_type_enable Source \t\t%lu\n", BIT(dword, 24));
873 printf("VIDEO_DIP_CTL_B Video_DIP_buffer_index\t\t\t[0x%lx] %s\n",
874 BITS(dword, 20, 19), video_dip_index[BITS(dword, 20, 19)]);
875 printf("VIDEO_DIP_CTL_B Video_DIP_frequency\t\t\t[0x%lx] %s\n",
876 BITS(dword, 17, 16), video_dip_trans[BITS(dword, 17, 16)]);
877 printf("VIDEO_DIP_CTL_B Video_DIP_buffer_size\t\t\t%lu\n", BITS(dword, 11, 8));
878 printf("VIDEO_DIP_CTL_B Video_DIP_access_address\t\t%lu\n", BITS(dword, 3, 0));
Wu Fengguange321f132011-11-12 11:12:52 +0800879
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400880 dword = INREG(VIDEO_DIP_CTL_C);
881 printf("VIDEO_DIP_CTL_C Enable_Graphics_DIP\t\t\t%ld\n", BIT(dword, 31)),
882 printf("VIDEO_DIP_CTL_C GCP_DIP_enable\t\t\t\t%ld\n", BIT(dword, 25)),
883 printf("VIDEO_DIP_CTL_C Video_DIP_type_enable AVI\t\t%lu\n", BIT(dword, 21));
884 printf("VIDEO_DIP_CTL_C Video_DIP_type_enable Vendor\t\t%lu\n", BIT(dword, 22));
885 printf("VIDEO_DIP_CTL_C Video_DIP_type_enable Gamut\t\t%lu\n", BIT(dword, 23));
886 printf("VIDEO_DIP_CTL_C Video_DIP_type_enable Source \t\t%lu\n", BIT(dword, 24));
887 printf("VIDEO_DIP_CTL_C Video_DIP_buffer_index\t\t\t[0x%lx] %s\n",
888 BITS(dword, 20, 19), video_dip_index[BITS(dword, 20, 19)]);
889 printf("VIDEO_DIP_CTL_C Video_DIP_frequency\t\t\t[0x%lx] %s\n",
890 BITS(dword, 17, 16), video_dip_trans[BITS(dword, 17, 16)]);
891 printf("VIDEO_DIP_CTL_C Video_DIP_buffer_size\t\t\t%lu\n", BITS(dword, 11, 8));
892 printf("VIDEO_DIP_CTL_C Video_DIP_access_address\t\t%lu\n", BITS(dword, 3, 0));
Wu Fengguange321f132011-11-12 11:12:52 +0800893
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400894 dword = INREG(AUD_VID_DID);
895 printf("AUD_VID_DID vendor id\t\t\t\t\t0x%x\n", dword >> 16);
896 printf("AUD_VID_DID device id\t\t\t\t\t0x%x\n", dword & 0xffff);
Wu Fengguang020abdb2010-04-19 13:13:06 +0800897
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400898 dword = INREG(AUD_RID);
899 printf("AUD_RID Major_Revision\t\t\t\t\t0x%lx\n", BITS(dword, 23, 20));
900 printf("AUD_RID Minor_Revision\t\t\t\t\t0x%lx\n", BITS(dword, 19, 16));
901 printf("AUD_RID Revision_Id\t\t\t\t\t0x%lx\n", BITS(dword, 15, 8));
902 printf("AUD_RID Stepping_Id\t\t\t\t\t0x%lx\n", BITS(dword, 7, 0));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800903
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400904 dword = INREG(HDMIB);
905 printf("HDMIB Port_Enable\t\t\t\t\t%u\n", !!(dword & SDVO_ENABLE));
906 printf("HDMIB Transcoder_Select\t\t\t\t\t[0x%lx] %s\n",
907 BITS(dword, 30, 29), transcoder_select[BITS(dword, 30, 29)]);
908 printf("HDMIB sDVO_Border_Enable\t\t\t\t%lu\n", BIT(dword, 7));
909 printf("HDMIB HDCP_Port_Select\t\t\t\t\t%lu\n", BIT(dword, 5));
910 printf("HDMIB SDVO_HPD_Interrupt_Enable\t\t\t\t%lu\n", BIT(dword, 23));
911 printf("HDMIB Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
912 printf("HDMIB Encoding\t\t\t\t\t\t[0x%lx] %s\n",
913 BITS(dword, 11, 10), sdvo_hdmi_encoding[BITS(dword, 11, 10)]);
914 printf("HDMIB HDMI_or_DVI_Select\t\t\t\t%s\n", BIT(dword, 9) ? "HDMI" : "DVI");
915 printf("HDMIB Audio_Output_Enable\t\t\t\t%u\n", !!(dword & SDVO_AUDIO_ENABLE));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800916
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400917 dword = INREG(HDMIC);
918 printf("HDMIC Port_Enable\t\t\t\t\t%u\n", !!(dword & SDVO_ENABLE));
919 printf("HDMIC Transcoder_Select\t\t\t\t\t[0x%lx] %s\n",
920 BITS(dword, 30, 29), transcoder_select[BITS(dword, 30, 29)]);
921 printf("HDMIC sDVO_Border_Enable\t\t\t\t%lu\n", BIT(dword, 7));
922 printf("HDMIC HDCP_Port_Select\t\t\t\t\t%lu\n", BIT(dword, 5));
923 printf("HDMIC SDVO_HPD_Interrupt_Enable\t\t\t\t%lu\n", BIT(dword, 23));
924 printf("HDMIC Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
925 printf("HDMIC Encoding\t\t\t\t\t\t[0x%lx] %s\n",
926 BITS(dword, 11, 10), sdvo_hdmi_encoding[BITS(dword, 11, 10)]);
927 printf("HDMIC HDMI_or_DVI_Select\t\t\t\t%s\n", BIT(dword, 9) ? "HDMI" : "DVI");
928 printf("HDMIC Audio_Output_Enable\t\t\t\t%u\n", !!(dword & SDVO_AUDIO_ENABLE));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800929
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400930 dword = INREG(HDMID);
931 printf("HDMID Port_Enable\t\t\t\t\t%u\n", !!(dword & SDVO_ENABLE));
932 printf("HDMID Transcoder_Select\t\t\t\t\t[0x%lx] %s\n",
933 BITS(dword, 30, 29), transcoder_select[BITS(dword, 30, 29)]);
934 printf("HDMID sDVO_Border_Enable\t\t\t\t%lu\n", BIT(dword, 7));
935 printf("HDMID HDCP_Port_Select\t\t\t\t\t%lu\n", BIT(dword, 5));
936 printf("HDMID SDVO_HPD_Interrupt_Enable\t\t\t\t%lu\n", BIT(dword, 23));
937 printf("HDMID Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
938 printf("HDMID Encoding\t\t\t\t\t\t[0x%lx] %s\n",
939 BITS(dword, 11, 10), sdvo_hdmi_encoding[BITS(dword, 11, 10)]);
940 printf("HDMID HDMI_or_DVI_Select\t\t\t\t%s\n", BIT(dword, 9) ? "HDMI" : "DVI");
941 printf("HDMID Audio_Output_Enable\t\t\t\t%u\n", !!(dword & SDVO_AUDIO_ENABLE));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800942
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400943 dword = INREG(DP_CTL_B);
944 printf("DP_CTL_B DisplayPort_Enable\t\t\t\t%lu\n", BIT(dword, 31));
945 printf("DP_CTL_B Port_Width_Selection\t\t\t\t[0x%lx] %s\n",
946 BITS(dword, 21, 19), dp_port_width[BITS(dword, 21, 19)]);
947 printf("DP_CTL_B Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
948 printf("DP_CTL_B HDCP_Port_Select\t\t\t\t%lu\n", BIT(dword, 5));
949 printf("DP_CTL_B Audio_Output_Enable\t\t\t\t%lu\n", BIT(dword, 6));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800950
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400951 dword = INREG(DP_CTL_C);
952 printf("DP_CTL_C DisplayPort_Enable\t\t\t\t%lu\n", BIT(dword, 31));
953 printf("DP_CTL_C Port_Width_Selection\t\t\t\t[0x%lx] %s\n",
954 BITS(dword, 21, 19), dp_port_width[BITS(dword, 21, 19)]);
955 printf("DP_CTL_C Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
956 printf("DP_CTL_C HDCP_Port_Select\t\t\t\t%lu\n", BIT(dword, 5));
957 printf("DP_CTL_C Audio_Output_Enable\t\t\t\t%lu\n", BIT(dword, 6));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800958
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400959 dword = INREG(DP_CTL_D);
960 printf("DP_CTL_D DisplayPort_Enable\t\t\t\t%lu\n", BIT(dword, 31));
961 printf("DP_CTL_D Port_Width_Selection\t\t\t\t[0x%lx] %s\n",
962 BITS(dword, 21, 19), dp_port_width[BITS(dword, 21, 19)]);
963 printf("DP_CTL_D Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
964 printf("DP_CTL_D HDCP_Port_Select\t\t\t\t%lu\n", BIT(dword, 5));
965 printf("DP_CTL_D Audio_Output_Enable\t\t\t\t%lu\n", BIT(dword, 6));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800966
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400967 dword = INREG(AUD_CONFIG_A);
968 printf("AUD_CONFIG_A N_index_value\t\t\t\t[0x%lx] %s\n", BIT(dword, 29),
969 n_index_value[BIT(dword, 29)]);
970 printf("AUD_CONFIG_A N_programming_enable\t\t\t%lu\n", BIT(dword, 28));
971 printf("AUD_CONFIG_A Upper_N_value\t\t\t\t0x%02lx\n", BITS(dword, 27, 20));
972 printf("AUD_CONFIG_A Lower_N_value\t\t\t\t0x%03lx\n", BITS(dword, 15, 4));
973 printf("AUD_CONFIG_A Pixel_Clock_HDMI\t\t\t\t[0x%lx] %s\n", BITS(dword, 19, 16),
974 OPNAME(pixel_clock, BITS(dword, 19, 16)));
975 printf("AUD_CONFIG_A Disable_NCTS\t\t\t\t%lu\n", BIT(dword, 3));
976 dword = INREG(AUD_CONFIG_B);
977 printf("AUD_CONFIG_B N_index_value\t\t\t\t[0x%lx] %s\n", BIT(dword, 29),
978 n_index_value[BIT(dword, 29)]);
979 printf("AUD_CONFIG_B N_programming_enable\t\t\t%lu\n", BIT(dword, 28));
980 printf("AUD_CONFIG_B Upper_N_value\t\t\t\t0x%02lx\n", BITS(dword, 27, 20));
981 printf("AUD_CONFIG_B Lower_N_value\t\t\t\t0x%03lx\n", BITS(dword, 15, 4));
982 printf("AUD_CONFIG_B Pixel_Clock_HDMI\t\t\t\t[0x%lx] %s\n", BITS(dword, 19, 16),
983 OPNAME(pixel_clock, BITS(dword, 19, 16)));
984 printf("AUD_CONFIG_B Disable_NCTS\t\t\t\t%lu\n", BIT(dword, 3));
985 dword = INREG(AUD_CONFIG_C);
986 printf("AUD_CONFIG_C N_index_value\t\t\t\t[0x%lx] %s\n", BIT(dword, 29),
987 n_index_value[BIT(dword, 29)]);
988 printf("AUD_CONFIG_C N_programming_enable\t\t\t%lu\n", BIT(dword, 28));
989 printf("AUD_CONFIG_C Upper_N_value\t\t\t\t0x%02lx\n", BITS(dword, 27, 20));
990 printf("AUD_CONFIG_C Lower_N_value\t\t\t\t0x%03lx\n", BITS(dword, 15, 4));
991 printf("AUD_CONFIG_C Pixel_Clock_HDMI\t\t\t\t[0x%lx] %s\n", BITS(dword, 19, 16),
992 OPNAME(pixel_clock, BITS(dword, 19, 16)));
993 printf("AUD_CONFIG_C Disable_NCTS\t\t\t\t%lu\n", BIT(dword, 3));
Wu Fengguang020abdb2010-04-19 13:13:06 +0800994
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -0400995 dword = INREG(AUD_CTS_ENABLE_A);
996 printf("AUD_CTS_ENABLE_A Enable_CTS_or_M_programming\t\t%lu\n", BIT(dword, 20));
997 printf("AUD_CTS_ENABLE_A CTS_M value Index\t\t\t%s\n", BIT(dword, 21) ? "CTS" : "M");
998 printf("AUD_CTS_ENABLE_A CTS_programming\t\t\t%#lx\n", BITS(dword, 19, 0));
999 dword = INREG(AUD_CTS_ENABLE_B);
1000 printf("AUD_CTS_ENABLE_B Enable_CTS_or_M_programming\t\t%lu\n", BIT(dword, 20));
1001 printf("AUD_CTS_ENABLE_B CTS_M value Index\t\t\t%s\n", BIT(dword, 21) ? "CTS" : "M");
1002 printf("AUD_CTS_ENABLE_B CTS_programming\t\t\t%#lx\n", BITS(dword, 19, 0));
1003 dword = INREG(AUD_CTS_ENABLE_C);
1004 printf("AUD_CTS_ENABLE_C Enable_CTS_or_M_programming\t\t%lu\n", BIT(dword, 20));
1005 printf("AUD_CTS_ENABLE_C CTS_M value Index\t\t\t%s\n", BIT(dword, 21) ? "CTS" : "M");
1006 printf("AUD_CTS_ENABLE_C CTS_programming\t\t\t%#lx\n", BITS(dword, 19, 0));
Wu Fengguang020abdb2010-04-19 13:13:06 +08001007
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001008 dword = INREG(AUD_MISC_CTRL_A);
1009 printf("AUD_MISC_CTRL_A Sample_Fabrication_EN_bit\t\t%lu\n", BIT(dword, 2));
1010 printf("AUD_MISC_CTRL_A Sample_present_Disable\t\t\t%lu\n", BIT(dword, 8));
1011 printf("AUD_MISC_CTRL_A Output_Delay\t\t\t\t%lu\n", BITS(dword, 7, 4));
1012 printf("AUD_MISC_CTRL_A Pro_Allowed\t\t\t\t%lu\n", BIT(dword, 1));
1013 dword = INREG(AUD_MISC_CTRL_B);
1014 printf("AUD_MISC_CTRL_B Sample_Fabrication_EN_bit\t\t%lu\n", BIT(dword, 2));
1015 printf("AUD_MISC_CTRL_B Sample_present_Disable\t\t\t%lu\n", BIT(dword, 8));
1016 printf("AUD_MISC_CTRL_B Output_Delay\t\t\t\t%lu\n", BITS(dword, 7, 4));
1017 printf("AUD_MISC_CTRL_B Pro_Allowed\t\t\t\t%lu\n", BIT(dword, 1));
1018 dword = INREG(AUD_MISC_CTRL_C);
1019 printf("AUD_MISC_CTRL_C Sample_Fabrication_EN_bit\t\t%lu\n", BIT(dword, 2));
1020 printf("AUD_MISC_CTRL_C Sample_present_Disable\t\t\t%lu\n", BIT(dword, 8));
1021 printf("AUD_MISC_CTRL_C Output_Delay\t\t\t\t%lu\n", BITS(dword, 7, 4));
1022 printf("AUD_MISC_CTRL_C Pro_Allowed\t\t\t\t%lu\n", BIT(dword, 1));
Wu Fengguang020abdb2010-04-19 13:13:06 +08001023
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001024 dword = INREG(AUD_PWRST);
1025 printf("AUD_PWRST Func_Grp_Dev_PwrSt_Curr \t%s\n", power_state[BITS(dword, 27, 26)]);
1026 printf("AUD_PWRST Func_Grp_Dev_PwrSt_Set \t%s\n", power_state[BITS(dword, 25, 24)]);
1027 printf("AUD_PWRST ConvertorA_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 15, 14)]);
1028 printf("AUD_PWRST ConvertorA_Widget_Power_State_Requsted \t%s\n", power_state[BITS(dword, 13, 12)]);
1029 printf("AUD_PWRST ConvertorB_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 19, 18)]);
1030 printf("AUD_PWRST ConvertorB_Widget_Power_State_Requested \t%s\n", power_state[BITS(dword, 17, 16)]);
1031 printf("AUD_PWRST ConvC_Widget_PwrSt_Curr \t%s\n", power_state[BITS(dword, 23, 22)]);
1032 printf("AUD_PWRST ConvC_Widget_PwrSt_Req \t%s\n", power_state[BITS(dword, 21, 20)]);
1033 printf("AUD_PWRST PinB_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 3, 2)]);
1034 printf("AUD_PWRST PinB_Widget_Power_State_Set \t%s\n", power_state[BITS(dword, 1, 0)]);
1035 printf("AUD_PWRST PinC_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 7, 6)]);
1036 printf("AUD_PWRST PinC_Widget_Power_State_Set \t%s\n", power_state[BITS(dword, 5, 4)]);
1037 printf("AUD_PWRST PinD_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 11, 10)]);
1038 printf("AUD_PWRST PinD_Widget_Power_State_Set \t%s\n", power_state[BITS(dword, 9, 8)]);
Wu Fengguang020abdb2010-04-19 13:13:06 +08001039
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001040 dword = INREG(AUD_PORT_EN_HD_CFG);
1041 printf("AUD_PORT_EN_HD_CFG Convertor_A_Digen\t\t\t%lu\n", BIT(dword, 0));
1042 printf("AUD_PORT_EN_HD_CFG Convertor_B_Digen\t\t\t%lu\n", BIT(dword, 1));
1043 printf("AUD_PORT_EN_HD_CFG Convertor_C_Digen\t\t\t%lu\n", BIT(dword, 2));
1044 printf("AUD_PORT_EN_HD_CFG ConvertorA_Stream_ID\t\t%lu\n", BITS(dword, 7, 4));
1045 printf("AUD_PORT_EN_HD_CFG ConvertorB_Stream_ID\t\t%lu\n", BITS(dword, 11, 8));
1046 printf("AUD_PORT_EN_HD_CFG ConvertorC_Stream_ID\t\t%lu\n", BITS(dword, 15, 12));
1047 printf("AUD_PORT_EN_HD_CFG Port_B_Out_Enable\t\t\t%lu\n", BIT(dword, 16));
1048 printf("AUD_PORT_EN_HD_CFG Port_C_Out_Enable\t\t\t%lu\n", BIT(dword, 17));
1049 printf("AUD_PORT_EN_HD_CFG Port_D_Out_Enable\t\t\t%lu\n", BIT(dword, 18));
1050 printf("AUD_PORT_EN_HD_CFG Port_B_Amp_Mute_Status\t\t%lu\n", BIT(dword, 20));
1051 printf("AUD_PORT_EN_HD_CFG Port_C_Amp_Mute_Status\t\t%lu\n", BIT(dword, 21));
1052 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 +08001053
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001054 dword = INREG(AUD_OUT_DIG_CNVT_A);
1055 printf("AUD_OUT_DIG_CNVT_A V\t\t\t\t\t%lu\n", BIT(dword, 1));
1056 printf("AUD_OUT_DIG_CNVT_A VCFG\t\t\t\t%lu\n", BIT(dword, 2));
1057 printf("AUD_OUT_DIG_CNVT_A PRE\t\t\t\t\t%lu\n", BIT(dword, 3));
1058 printf("AUD_OUT_DIG_CNVT_A Copy\t\t\t\t%lu\n", BIT(dword, 4));
1059 printf("AUD_OUT_DIG_CNVT_A NonAudio\t\t\t\t%lu\n", BIT(dword, 5));
1060 printf("AUD_OUT_DIG_CNVT_A PRO\t\t\t\t\t%lu\n", BIT(dword, 6));
1061 printf("AUD_OUT_DIG_CNVT_A Level\t\t\t\t%lu\n", BIT(dword, 7));
1062 printf("AUD_OUT_DIG_CNVT_A Category_Code\t\t\t%lu\n", BITS(dword, 14, 8));
1063 printf("AUD_OUT_DIG_CNVT_A Lowest_Channel_Number\t\t%lu\n", BITS(dword, 19, 16));
1064 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 +08001065
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001066 dword = INREG(AUD_OUT_DIG_CNVT_B);
1067 printf("AUD_OUT_DIG_CNVT_B V\t\t\t\t\t%lu\n", BIT(dword, 1));
1068 printf("AUD_OUT_DIG_CNVT_B VCFG\t\t\t\t%lu\n", BIT(dword, 2));
1069 printf("AUD_OUT_DIG_CNVT_B PRE\t\t\t\t\t%lu\n", BIT(dword, 3));
1070 printf("AUD_OUT_DIG_CNVT_B Copy\t\t\t\t%lu\n", BIT(dword, 4));
1071 printf("AUD_OUT_DIG_CNVT_B NonAudio\t\t\t\t%lu\n", BIT(dword, 5));
1072 printf("AUD_OUT_DIG_CNVT_B PRO\t\t\t\t\t%lu\n", BIT(dword, 6));
1073 printf("AUD_OUT_DIG_CNVT_B Level\t\t\t\t%lu\n", BIT(dword, 7));
1074 printf("AUD_OUT_DIG_CNVT_B Category_Code\t\t\t%lu\n", BITS(dword, 14, 8));
1075 printf("AUD_OUT_DIG_CNVT_B Lowest_Channel_Number\t\t%lu\n", BITS(dword, 19, 16));
1076 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 +08001077
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001078 dword = INREG(AUD_OUT_DIG_CNVT_C);
1079 printf("AUD_OUT_DIG_CNVT_C V\t\t\t\t\t%lu\n", BIT(dword, 1));
1080 printf("AUD_OUT_DIG_CNVT_C VCFG\t\t\t\t%lu\n", BIT(dword, 2));
1081 printf("AUD_OUT_DIG_CNVT_C PRE\t\t\t\t\t%lu\n", BIT(dword, 3));
1082 printf("AUD_OUT_DIG_CNVT_C Copy\t\t\t\t%lu\n", BIT(dword, 4));
1083 printf("AUD_OUT_DIG_CNVT_C NonAudio\t\t\t\t%lu\n", BIT(dword, 5));
1084 printf("AUD_OUT_DIG_CNVT_C PRO\t\t\t\t\t%lu\n", BIT(dword, 6));
1085 printf("AUD_OUT_DIG_CNVT_C Level\t\t\t\t%lu\n", BIT(dword, 7));
1086 printf("AUD_OUT_DIG_CNVT_C Category_Code\t\t\t%lu\n", BITS(dword, 14, 8));
1087 printf("AUD_OUT_DIG_CNVT_C Lowest_Channel_Number\t\t%lu\n", BITS(dword, 19, 16));
1088 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 +08001089
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001090 printf("AUD_OUT_CH_STR Converter_Channel_MAP PORTB PORTC PORTD\n");
1091 for (i = 0; i < 8; i++) {
1092 OUTREG(AUD_OUT_CH_STR, i | (i << 8) | (i << 16));
1093 dword = INREG(AUD_OUT_CH_STR);
1094 printf("\t\t\t\t%lu\t%lu\t%lu\t%lu\n",
1095 1 + BITS(dword, 3, 0),
1096 1 + BITS(dword, 7, 4),
1097 1 + BITS(dword, 15, 12),
1098 1 + BITS(dword, 23, 20));
1099 }
Wu Fengguang020abdb2010-04-19 13:13:06 +08001100
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001101 dword = INREG(AUD_OUT_STR_DESC_A);
1102 printf("AUD_OUT_STR_DESC_A HBR_enable\t\t\t\t%lu\n", BITS(dword, 28, 27));
1103 printf("AUD_OUT_STR_DESC_A Convertor_Channel_Count\t\t%lu\n", BITS(dword, 20, 16) + 1);
1104 printf("AUD_OUT_STR_DESC_A Bits_per_Sample\t\t\t[%#lx] %s\n",
1105 BITS(dword, 6, 4), OPNAME(bits_per_sample, BITS(dword, 6, 4)));
1106 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 +08001107
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001108 dword = INREG(AUD_OUT_STR_DESC_B);
1109 printf("AUD_OUT_STR_DESC_B HBR_enable\t\t\t\t%lu\n", BITS(dword, 28, 27));
1110 printf("AUD_OUT_STR_DESC_B Convertor_Channel_Count\t\t%lu\n", BITS(dword, 20, 16) + 1);
1111 printf("AUD_OUT_STR_DESC_B Bits_per_Sample\t\t\t[%#lx] %s\n",
1112 BITS(dword, 6, 4), OPNAME(bits_per_sample, BITS(dword, 6, 4)));
1113 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 +08001114
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001115 dword = INREG(AUD_OUT_STR_DESC_C);
1116 printf("AUD_OUT_STR_DESC_C HBR_enable\t\t\t\t%lu\n", BITS(dword, 28, 27));
1117 printf("AUD_OUT_STR_DESC_C Convertor_Channel_Count\t\t%lu\n", BITS(dword, 20, 16) + 1);
1118 printf("AUD_OUT_STR_DESC_C Bits_per_Sample\t\t\t[%#lx] %s\n",
1119 BITS(dword, 6, 4), OPNAME(bits_per_sample, BITS(dword, 6, 4)));
1120 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 +08001121
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001122 dword = INREG(AUD_PINW_CONNLNG_SEL);
1123 printf("AUD_PINW_CONNLNG_SEL Connection_select_Control_B\t%#lx\n", BITS(dword, 7, 0));
1124 printf("AUD_PINW_CONNLNG_SEL Connection_select_Control_C\t%#lx\n", BITS(dword, 15, 8));
1125 printf("AUD_PINW_CONNLNG_SEL Connection_select_Control_D\t%#lx\n", BITS(dword, 23, 16));
Wu Fengguang020abdb2010-04-19 13:13:06 +08001126
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001127 dword = INREG(AUD_CNTL_ST_A);
1128 printf("AUD_CNTL_ST_A DIP_Port_Select\t\t\t\t[%#lx] %s\n",
1129 BITS(dword, 30, 29), dip_port[BITS(dword, 30, 29)]);
1130 printf("AUD_CNTL_ST_A DIP_type_enable_status Audio DIP\t\t%lu\n", BIT(dword, 21));
1131 printf("AUD_CNTL_ST_A DIP_type_enable_status ACP DIP\t\t%lu\n", BIT(dword, 22));
1132 printf("AUD_CNTL_ST_A DIP_type_enable_status Generic 2 DIP\t%lu\n", BIT(dword, 23));
1133 printf("AUD_CNTL_ST_A DIP_transmission_frequency\t\t[0x%lx] %s\n",
1134 BITS(dword, 17, 16), dip_trans[BITS(dword, 17, 16)]);
1135 printf("AUD_CNTL_ST_A ELD_ACK\t\t\t\t\t%lu\n", BIT(dword, 4));
1136 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 +08001137
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001138 dword = INREG(AUD_CNTL_ST_B);
1139 printf("AUD_CNTL_ST_B DIP_Port_Select\t\t\t\t[%#lx] %s\n",
1140 BITS(dword, 30, 29), dip_port[BITS(dword, 30, 29)]);
1141 printf("AUD_CNTL_ST_B DIP_type_enable_status Audio DIP\t\t%lu\n", BIT(dword, 21));
1142 printf("AUD_CNTL_ST_B DIP_type_enable_status ACP DIP\t\t%lu\n", BIT(dword, 22));
1143 printf("AUD_CNTL_ST_B DIP_type_enable_status Generic 2 DIP\t%lu\n", BIT(dword, 23));
1144 printf("AUD_CNTL_ST_B DIP_transmission_frequency\t\t[0x%lx] %s\n",
1145 BITS(dword, 17, 16), dip_trans[BITS(dword, 17, 16)]);
1146 printf("AUD_CNTL_ST_B ELD_ACK\t\t\t\t\t%lu\n", BIT(dword, 4));
1147 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 +08001148
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001149 dword = INREG(AUD_CNTL_ST_C);
1150 printf("AUD_CNTL_ST_C DIP_Port_Select\t\t\t\t[%#lx] %s\n",
1151 BITS(dword, 30, 29), dip_port[BITS(dword, 30, 29)]);
1152 printf("AUD_CNTL_ST_C DIP_type_enable_status Audio DIP\t\t%lu\n", BIT(dword, 21));
1153 printf("AUD_CNTL_ST_C DIP_type_enable_status ACP DIP\t\t%lu\n", BIT(dword, 22));
1154 printf("AUD_CNTL_ST_C DIP_type_enable_status Generic 2 DIP\t%lu\n", BIT(dword, 23));
1155 printf("AUD_CNTL_ST_C DIP_transmission_frequency\t\t[0x%lx] %s\n",
1156 BITS(dword, 17, 16), dip_trans[BITS(dword, 17, 16)]);
1157 printf("AUD_CNTL_ST_C ELD_ACK\t\t\t\t\t%lu\n", BIT(dword, 4));
1158 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 +08001159
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001160 dword = INREG(AUD_CNTRL_ST2);
1161 printf("AUD_CNTRL_ST2 CP_ReadyB\t\t\t\t%lu\n", BIT(dword, 1));
1162 printf("AUD_CNTRL_ST2 ELD_validB\t\t\t\t%lu\n", BIT(dword, 0));
1163 printf("AUD_CNTRL_ST2 CP_ReadyC\t\t\t\t%lu\n", BIT(dword, 5));
1164 printf("AUD_CNTRL_ST2 ELD_validC\t\t\t\t%lu\n", BIT(dword, 4));
1165 printf("AUD_CNTRL_ST2 CP_ReadyD\t\t\t\t%lu\n", BIT(dword, 9));
1166 printf("AUD_CNTRL_ST2 ELD_validD\t\t\t\t%lu\n", BIT(dword, 8));
Wu Fengguang020abdb2010-04-19 13:13:06 +08001167
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001168 dword = INREG(AUD_CNTRL_ST3);
1169 printf("AUD_CNTRL_ST3 TransA_DPT_Audio_Output_En\t\t%lu\n", BIT(dword, 3));
1170 printf("AUD_CNTRL_ST3 TransA_to_Port_Sel\t\t\t[%#lx] %s\n",
1171 BITS(dword, 2, 0), trans_to_port_sel[BITS(dword, 2, 0)]);
1172 printf("AUD_CNTRL_ST3 TransB_DPT_Audio_Output_En\t\t%lu\n", BIT(dword, 7));
1173 printf("AUD_CNTRL_ST3 TransB_to_Port_Sel\t\t\t[%#lx] %s\n",
1174 BITS(dword, 6, 4), trans_to_port_sel[BITS(dword, 6, 4)]);
1175 printf("AUD_CNTRL_ST3 TransC_DPT_Audio_Output_En\t\t%lu\n", BIT(dword, 11));
1176 printf("AUD_CNTRL_ST3 TransC_to_Port_Sel\t\t\t[%#lx] %s\n",
1177 BITS(dword, 10, 8), trans_to_port_sel[BITS(dword, 10, 8)]);
Wu Fengguang020abdb2010-04-19 13:13:06 +08001178
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001179 dword = INREG(AUD_HDMIW_STATUS);
1180 printf("AUD_HDMIW_STATUS Conv_A_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 27));
1181 printf("AUD_HDMIW_STATUS Conv_A_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n", BIT(dword, 26));
1182 printf("AUD_HDMIW_STATUS Conv_B_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 29));
1183 printf("AUD_HDMIW_STATUS Conv_B_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n", BIT(dword, 28));
1184 printf("AUD_HDMIW_STATUS Conv_C_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 31));
1185 printf("AUD_HDMIW_STATUS Conv_C_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n", BIT(dword, 30));
1186 printf("AUD_HDMIW_STATUS BCLK/CDCLK_FIFO_Overrun\t\t%lu\n", BIT(dword, 25));
1187 printf("AUD_HDMIW_STATUS Function_Reset\t\t\t%lu\n", BIT(dword, 24));
Wu Fengguang020abdb2010-04-19 13:13:06 +08001188
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001189 printf("AUD_HDMIW_HDMIEDID_A HDMI ELD:\n\t");
1190 dword = INREG(AUD_CNTL_ST_A);
1191 dword &= ~BITMASK(9, 5);
1192 OUTREG(AUD_CNTL_ST_A, dword);
1193 for (i = 0; i < BITS(dword, 14, 10) / 4; i++)
1194 printf("%08x ", htonl(INREG(AUD_HDMIW_HDMIEDID_A)));
1195 printf("\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +08001196
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001197 printf("AUD_HDMIW_HDMIEDID_B HDMI ELD:\n\t");
1198 dword = INREG(AUD_CNTL_ST_B);
1199 dword &= ~BITMASK(9, 5);
1200 OUTREG(AUD_CNTL_ST_B, dword);
1201 for (i = 0; i < BITS(dword, 14, 10) / 4; i++)
1202 printf("%08x ", htonl(INREG(AUD_HDMIW_HDMIEDID_B)));
1203 printf("\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +08001204
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001205 printf("AUD_HDMIW_HDMIEDID_C HDMI ELD:\n\t");
1206 dword = INREG(AUD_CNTL_ST_C);
1207 dword &= ~BITMASK(9, 5);
1208 OUTREG(AUD_CNTL_ST_C, dword);
1209 for (i = 0; i < BITS(dword, 14, 10) / 4; i++)
1210 printf("%08x ", htonl(INREG(AUD_HDMIW_HDMIEDID_C)));
1211 printf("\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +08001212
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001213 printf("AUD_HDMIW_INFOFR_A HDMI audio Infoframe:\n\t");
1214 dword = INREG(AUD_CNTL_ST_A);
1215 dword &= ~BITMASK(20, 18);
1216 dword &= ~BITMASK(3, 0);
1217 OUTREG(AUD_CNTL_ST_A, dword);
1218 for (i = 0; i < 8; i++)
1219 printf("%08x ", htonl(INREG(AUD_HDMIW_INFOFR_A)));
1220 printf("\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +08001221
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001222 printf("AUD_HDMIW_INFOFR_B HDMI audio Infoframe:\n\t");
1223 dword = INREG(AUD_CNTL_ST_B);
1224 dword &= ~BITMASK(20, 18);
1225 dword &= ~BITMASK(3, 0);
1226 OUTREG(AUD_CNTL_ST_B, dword);
1227 for (i = 0; i < 8; i++)
1228 printf("%08x ", htonl(INREG(AUD_HDMIW_INFOFR_B)));
1229 printf("\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +08001230
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04001231 printf("AUD_HDMIW_INFOFR_C HDMI audio Infoframe:\n\t");
1232 dword = INREG(AUD_CNTL_ST_C);
1233 dword &= ~BITMASK(20, 18);
1234 dword &= ~BITMASK(3, 0);
1235 OUTREG(AUD_CNTL_ST_C, dword);
1236 for (i = 0; i < 8; i++)
1237 printf("%08x ", htonl(INREG(AUD_HDMIW_INFOFR_C)));
1238 printf("\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +08001239
1240}
1241
Mengdong Lin86d15e02014-03-03 13:52:06 -05001242/* Audio config registers of Ironlake */
Wang Xingchaoc4077222012-08-15 16:13:38 +08001243#undef AUD_CONFIG_A
Mengdong Lin86d15e02014-03-03 13:52:06 -05001244#undef AUD_CONFIG_B
Wang Xingchaoc4077222012-08-15 16:13:38 +08001245#undef AUD_MISC_CTRL_A
Mengdong Lin86d15e02014-03-03 13:52:06 -05001246#undef AUD_MISC_CTRL_B
Wang Xingchaoc4077222012-08-15 16:13:38 +08001247#undef AUD_VID_DID
1248#undef AUD_RID
1249#undef AUD_CTS_ENABLE_A
Mengdong Lin86d15e02014-03-03 13:52:06 -05001250#undef AUD_CTS_ENABLE_B
Wang Xingchaoc4077222012-08-15 16:13:38 +08001251#undef AUD_PWRST
1252#undef AUD_HDMIW_HDMIEDID_A
Mengdong Lin86d15e02014-03-03 13:52:06 -05001253#undef AUD_HDMIW_HDMIEDID_B
Wang Xingchaoc4077222012-08-15 16:13:38 +08001254#undef AUD_HDMIW_INFOFR_A
Mengdong Lin86d15e02014-03-03 13:52:06 -05001255#undef AUD_HDMIW_INFOFR_B
Wang Xingchaoc4077222012-08-15 16:13:38 +08001256#undef AUD_PORT_EN_HD_CFG
1257#undef AUD_OUT_DIG_CNVT_A
Mengdong Lin86d15e02014-03-03 13:52:06 -05001258#undef AUD_OUT_DIG_CNVT_B
Wang Xingchaoc4077222012-08-15 16:13:38 +08001259#undef AUD_OUT_STR_DESC_A
Mengdong Lin86d15e02014-03-03 13:52:06 -05001260#undef AUD_OUT_STR_DESC_B
Wang Xingchaoc4077222012-08-15 16:13:38 +08001261#undef AUD_OUT_CH_STR
1262#undef AUD_PINW_CONNLNG_LIST
Mengdong Lindeba8682013-09-09 15:38:40 -04001263#undef AUD_PINW_CONNLNG_SEL
Wang Xingchaoc4077222012-08-15 16:13:38 +08001264#undef AUD_CNTL_ST_A
Wang Xingchaoc4077222012-08-15 16:13:38 +08001265#undef AUD_CNTL_ST_B
Mengdong Lin86d15e02014-03-03 13:52:06 -05001266#undef AUD_CNTL_ST2
1267#undef AUD_HDMIW_STATUS
Wang Xingchaoc4077222012-08-15 16:13:38 +08001268
Mengdong Lin86d15e02014-03-03 13:52:06 -05001269#define PIPE_OFS 0x100
Wang Xingchaoc4077222012-08-15 16:13:38 +08001270
Mengdong Lin86d15e02014-03-03 13:52:06 -05001271#define AUD_CONFIG_A 0x0
1272#define AUD_CONFIG_B (AUD_CONFIG_A + PIPE_OFS)
1273#define AUD_MISC_CTRL_A 0x010
1274#define AUD_MISC_CTRL_B (AUD_MISC_CTRL_A + PIPE_OFS)
1275#define AUD_VID_DID 0x020
1276#define AUD_RID 0x024
1277#define AUD_CTS_ENABLE_A 0x028
1278#define AUD_CTS_ENABLE_B (AUD_CTS_ENABLE_A + PIPE_OFS)
1279#define AUD_PWRST 0x04C
1280#define AUD_HDMIW_HDMIEDID_A 0x050
1281#define AUD_HDMIW_HDMIEDID_B (AUD_HDMIW_HDMIEDID_A + PIPE_OFS)
1282#define AUD_HDMIW_INFOFR_A 0x054
1283#define AUD_HDMIW_INFOFR_B (AUD_HDMIW_INFOFR_A + PIPE_OFS)
1284#define AUD_PORT_EN_HD_CFG 0x07c
1285#define AUD_OUT_DIG_CNVT_A 0x080
1286#define AUD_OUT_DIG_CNVT_B (AUD_OUT_DIG_CNVT_A + PIPE_OFS)
1287#define AUD_OUT_STR_DESC_A 0x084
1288#define AUD_OUT_STR_DESC_B (AUD_OUT_STR_DESC_A + PIPE_OFS)
1289#define AUD_OUT_CH_STR 0x088
1290#define AUD_PINW_CONNLNG_LIST 0x0a8
1291#define AUD_PINW_CONNLNG_SEL 0x0aC
1292#define AUD_CNTL_ST_A 0x0b4
1293#define AUD_CNTL_ST_B (AUD_CNTL_ST_A + PIPE_OFS)
1294#define AUD_CNTL_ST2 0x0c0
1295#define AUD_HDMIW_STATUS 0x0d4
Wang Xingchaoc4077222012-08-15 16:13:38 +08001296
Mengdong Lin86d15e02014-03-03 13:52:06 -05001297/* Audio config registers of Haswell+ */
1298#define AUD_TCA_CONFIG AUD_CONFIG_A
1299#define AUD_TCB_CONFIG (AUD_TCA_CONFIG + PIPE_OFS)
1300#define AUD_TCC_CONFIG (AUD_TCA_CONFIG + PIPE_OFS * 2)
1301#define AUD_C1_MISC_CTRL AUD_MISC_CTRL_A
1302#define AUD_C2_MISC_CTRL (AUD_MISC_CTRL_A + PIPE_OFS)
1303#define AUD_C3_MISC_CTRL (AUD_MISC_CTRL_A + PIPE_OFS * 2)
1304#define AUD_TCA_M_CTS_ENABLE AUD_CTS_ENABLE_A
1305#define AUD_TCB_M_CTS_ENABLE (AUD_TCA_M_CTS_ENABLE + PIPE_OFS)
1306#define AUD_TCC_M_CTS_ENABLE (AUD_TCA_M_CTS_ENABLE + PIPE_OFS * 2)
1307#define AUD_TCA_EDID_DATA AUD_HDMIW_HDMIEDID_A
1308#define AUD_TCB_EDID_DATA (AUD_TCA_EDID_DATA + PIPE_OFS)
1309#define AUD_TCC_EDID_DATA (AUD_TCA_EDID_DATA + PIPE_OFS * 2)
1310#define AUD_TCA_INFOFR AUD_HDMIW_INFOFR_A
1311#define AUD_TCB_INFOFR (AUD_TCA_INFOFR + PIPE_OFS)
1312#define AUD_TCC_INFOFR (AUD_TCA_INFOFR + PIPE_OFS * 2)
1313#define AUD_PIPE_CONV_CFG AUD_PORT_EN_HD_CFG
1314#define AUD_C1_DIG_CNVT AUD_OUT_DIG_CNVT_A
1315#define AUD_C2_DIG_CNVT (AUD_C1_DIG_CNVT + PIPE_OFS)
1316#define AUD_C3_DIG_CNVT (AUD_C1_DIG_CNVT + PIPE_OFS * 2)
1317#define AUD_C1_STR_DESC AUD_OUT_STR_DESC_A
1318#define AUD_C2_STR_DESC (AUD_C1_STR_DESC + PIPE_OFS)
1319#define AUD_C3_STR_DESC (AUD_C1_STR_DESC + PIPE_OFS * 2)
1320#define AUD_OUT_CHAN_MAP AUD_OUT_CH_STR
1321#define AUD_TCA_PIN_PIPE_CONN_ENTRY_LNGTH AUD_PINW_CONNLNG_LIST
1322#define AUD_TCB_PIN_PIPE_CONN_ENTRY_LNGTH (AUD_TCA_PIN_PIPE_CONN_ENTRY_LNGTH + PIPE_OFS)
1323#define AUD_TCC_PIN_PIPE_CONN_ENTRY_LNGTH (AUD_TCA_PIN_PIPE_CONN_ENTRY_LNGTH + PIPE_OFS * 2)
1324#define AUD_PIPE_CONN_SEL_CTRL AUD_PINW_CONNLNG_SEL
1325#define AUD_TCA_DIP_ELD_CTRL_ST AUD_CNTL_ST_A
1326#define AUD_TCB_DIP_ELD_CTRL_ST (AUD_TCA_DIP_ELD_CTRL_ST + PIPE_OFS)
1327#define AUD_TCC_DIP_ELD_CTRL_ST (AUD_TCA_DIP_ELD_CTRL_ST + PIPE_OFS * 2)
1328#define AUD_PIN_ELD_CP_VLD AUD_CNTL_ST2
1329#define AUD_HDMI_FIFO_STATUS AUD_HDMIW_STATUS
1330#define AUD_ICOI 0xf00
1331#define AUD_IRII 0xf04
1332#define AUD_ICS 0xf08
1333#define AUD_CHICKENBIT_REG 0xf10
1334#define AUD_DP_DIP_STATUS 0xf20
1335#define AUD_TCA_M_CTS 0xf44
1336#define AUD_TCB_M_CTS 0xf54
1337#define AUD_TCC_M_CTS 0xf64
Wang Xingchaoc4077222012-08-15 16:13:38 +08001338
Mengdong Lin86d15e02014-03-03 13:52:06 -05001339/* Common functions to dump audio registers */
Mengdong Lindeba8682013-09-09 15:38:40 -04001340#define MAX_PREFIX_SIZE 128
1341
Mengdong Lin86d15e02014-03-03 13:52:06 -05001342static void dump_aud_config(int index)
Mengdong Lindeba8682013-09-09 15:38:40 -04001343{
1344 uint32_t dword;
1345 char prefix[MAX_PREFIX_SIZE];
1346
Mengdong Lin86d15e02014-03-03 13:52:06 -05001347 if (!IS_HASWELL_PLUS(devid)) {
1348 dword = INREG(aud_reg_base + AUD_CONFIG_A + (index - PIPE_A) * 0x100);
1349 sprintf(prefix, "AUD_CONFIG_%c ", 'A' + index - PIPE_A);
1350 } else {
1351 dword = INREG(aud_reg_base + AUD_TCA_CONFIG + (index - TRANSCODER_A) * 0x100);
1352 sprintf(prefix, "AUD_TC%c_CONFIG", 'A' + index - TRANSCODER_A);
1353 }
Mengdong Lindeba8682013-09-09 15:38:40 -04001354
Mengdong Linfa8c7502014-03-04 10:13:09 -05001355 printf("%s Disable_NCTS\t\t\t\t%lu\n", prefix, BIT(dword, 3));
1356 printf("%s Lower_N_value\t\t\t\t0x%03lx\n", prefix, BITS(dword, 15, 4));
Mengdong Lindeba8682013-09-09 15:38:40 -04001357 printf("%s Pixel_Clock_HDMI\t\t\t[0x%lx] %s\n", prefix, BITS(dword, 19, 16),
1358 OPNAME(pixel_clock, BITS(dword, 19, 16)));
Mengdong Linfa8c7502014-03-04 10:13:09 -05001359 printf("%s Upper_N_value\t\t\t\t0x%02lx\n", prefix, BITS(dword, 27, 20));
1360 printf("%s N_programming_enable\t\t\t%lu\n", prefix, BIT(dword, 28));
1361 printf("%s N_index_value\t\t\t\t[0x%lx] %s\n", prefix, BIT(dword, 29),
Mengdong Lindeba8682013-09-09 15:38:40 -04001362 OPNAME(n_index_value, BIT(dword, 29)));
1363}
1364
Mengdong Lin86d15e02014-03-03 13:52:06 -05001365static void dump_aud_misc_control(int index)
Mengdong Lindeba8682013-09-09 15:38:40 -04001366{
1367 uint32_t dword;
1368 char prefix[MAX_PREFIX_SIZE];
1369
Mengdong Lin86d15e02014-03-03 13:52:06 -05001370 if (!IS_HASWELL_PLUS(devid)) {
1371 dword = INREG(aud_reg_base + AUD_MISC_CTRL_A + (index - PIPE_A) * 0x100);
1372 sprintf(prefix, "AUD_MISC_CTRL_%c ", 'A' + index - PIPE_A);
1373 } else {
1374 dword = INREG(aud_reg_base + AUD_C1_MISC_CTRL + (index - CONVERTER_1) * 0x100);
1375 sprintf(prefix, "AUD_C%c_MISC_CTRL", '1' + index - CONVERTER_1);
1376 }
Mengdong Lindeba8682013-09-09 15:38:40 -04001377
Mengdong Linfa8c7502014-03-04 10:13:09 -05001378 printf("%s Pro_Allowed\t\t\t\t%lu\n", prefix, BIT(dword, 1));
Mengdong Lindeba8682013-09-09 15:38:40 -04001379 printf("%s Sample_Fabrication_EN_bit\t\t%lu\n", prefix, BIT(dword, 2));
Mengdong Linfa8c7502014-03-04 10:13:09 -05001380 printf("%s Output_Delay\t\t\t\t%lu\n", prefix, BITS(dword, 7, 4));
1381 printf("%s Sample_present_Disable\t\t%lu\n", prefix, BIT(dword, 8));
Mengdong Lindeba8682013-09-09 15:38:40 -04001382}
1383
1384static void dump_aud_vendor_device_id(void)
1385{
1386 uint32_t dword;
1387
Mengdong Lin86d15e02014-03-03 13:52:06 -05001388 dword = INREG(aud_reg_base + AUD_VID_DID);
Mengdong Lindeba8682013-09-09 15:38:40 -04001389 printf("AUD_VID_DID device id\t\t\t\t\t0x%lx\n", BITS(dword, 15, 0));
1390 printf("AUD_VID_DID vendor id\t\t\t\t\t0x%lx\n", BITS(dword, 31, 16));
1391}
1392
1393static void dump_aud_revision_id(void)
1394{
1395 uint32_t dword;
1396
Mengdong Lin86d15e02014-03-03 13:52:06 -05001397 dword = INREG(aud_reg_base + AUD_RID);
Mengdong Lindeba8682013-09-09 15:38:40 -04001398 printf("AUD_RID Stepping_Id\t\t\t\t\t0x%lx\n", BITS(dword, 7, 0));
1399 printf("AUD_RID Revision_Id\t\t\t\t\t0x%lx\n", BITS(dword, 15, 8));
1400 printf("AUD_RID Minor_Revision\t\t\t\t\t0x%lx\n", BITS(dword, 19, 16));
1401 printf("AUD_RID Major_Revision\t\t\t\t\t0x%lx\n", BITS(dword, 23, 20));
1402}
1403
Mengdong Lin86d15e02014-03-03 13:52:06 -05001404static void dump_aud_m_cts_enable(int index)
Mengdong Lindeba8682013-09-09 15:38:40 -04001405{
1406 uint32_t dword;
1407 char prefix[MAX_PREFIX_SIZE];
1408
Mengdong Lin86d15e02014-03-03 13:52:06 -05001409 if (!IS_HASWELL_PLUS(devid)) {
1410 dword = INREG(aud_reg_base + AUD_CTS_ENABLE_A + (index - PIPE_A) * 0x100);
1411 sprintf(prefix, "AUD_CTS_ENABLE_%c ", 'A' + index - PIPE_A);
1412 } else {
1413 dword = INREG(aud_reg_base + AUD_TCA_M_CTS_ENABLE + (index - TRANSCODER_A) * 0x100);
1414 sprintf(prefix, "AUD_TC%c_M_CTS_ENABLE", 'A' + index - TRANSCODER_A);
1415 }
Mengdong Lindeba8682013-09-09 15:38:40 -04001416
Mengdong Linfa8c7502014-03-04 10:13:09 -05001417 printf("%s CTS_programming\t\t\t%#lx\n", prefix, BITS(dword, 19, 0));
Mengdong Lindeba8682013-09-09 15:38:40 -04001418 printf("%s Enable_CTS_or_M_programming\t%lu\n", prefix, BIT(dword, 20));
Mengdong Lin8fe0c502014-03-13 16:38:02 -04001419 printf("%s CTS_M value Index\t\t\t[0x%lx] %s\n",prefix, BIT(dword, 21),
1420 OPNAME(cts_m_value_index, BIT(dword, 21)));
Mengdong Lindeba8682013-09-09 15:38:40 -04001421}
1422
1423static void dump_aud_power_state(void)
1424{
1425 uint32_t dword;
Mengdong Lin86d15e02014-03-03 13:52:06 -05001426 int num_pipes;
Mengdong Lindeba8682013-09-09 15:38:40 -04001427
Mengdong Lin86d15e02014-03-03 13:52:06 -05001428 dword = INREG(aud_reg_base + AUD_PWRST);
Mengdong Linfa8c7502014-03-04 10:13:09 -05001429 printf("AUD_PWRST PinB_Widget_Power_State_Set \t%s\n", power_state[BITS(dword, 1, 0)]);
1430 printf("AUD_PWRST PinB_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 3, 2)]);
1431 printf("AUD_PWRST PinC_Widget_Power_State_Set \t%s\n", power_state[BITS(dword, 5, 4)]);
1432 printf("AUD_PWRST PinC_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 7, 6)]);
1433 printf("AUD_PWRST PinD_Widget_Power_State_Set \t%s\n", power_state[BITS(dword, 9, 8)]);
1434 printf("AUD_PWRST PinD_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 11, 10)]);
Mengdong Lin86d15e02014-03-03 13:52:06 -05001435
1436 if (!IS_HASWELL_PLUS(devid)) {
1437 printf("AUD_PWRST ConvertorA_Widget_Power_State_Requsted \t%s\n", power_state[BITS(dword, 13, 12)]);
1438 printf("AUD_PWRST ConvertorA_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 15, 14)]);
1439 printf("AUD_PWRST ConvertorB_Widget_Power_State_Requested \t%s\n", power_state[BITS(dword, 17, 16)]);
1440 printf("AUD_PWRST ConvertorB_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 19, 18)]);
1441 } else {
1442 printf("AUD_PWRST Convertor1_Widget_Power_State_Requsted \t%s\n", power_state[BITS(dword, 13, 12)]);
1443 printf("AUD_PWRST Convertor1_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 15, 14)]);
1444 printf("AUD_PWRST Convertor2_Widget_Power_State_Requested \t%s\n", power_state[BITS(dword, 17, 16)]);
1445 printf("AUD_PWRST Convertor2_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 19, 18)]);
1446 }
1447
1448 num_pipes = get_num_pipes();
1449 if (num_pipes == 2) {
1450 printf("AUD_PWRST Func_Grp_Dev_PwrSt_Set \t%s\n", power_state[BITS(dword, 21, 20)]);
1451 printf("AUD_PWRST Func_Grp_Dev_PwrSt_Curr \t%s\n", power_state[BITS(dword, 23, 22)]);
1452 } else { /* 3 pipes */
1453 if (!IS_HASWELL_PLUS(devid)) {
1454 printf("AUD_PWRST ConvertorC_Widget_Power_State_Requested \t%s\n", power_state[BITS(dword, 21, 20)]);
1455 printf("AUD_PWRST ConvertorC_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 23, 22)]);
1456 } else {
1457 printf("AUD_PWRST Convertor3_Widget_Power_State_Requested \t%s\n", power_state[BITS(dword, 21, 20)]);
1458 printf("AUD_PWRST Convertor3_Widget_Power_State_Current \t%s\n", power_state[BITS(dword, 23, 22)]);
1459 }
1460 printf("AUD_PWRST Func_Grp_Dev_PwrSt_Set \t%s\n", power_state[BITS(dword, 25, 24)]);
1461 printf("AUD_PWRST Func_Grp_Dev_PwrSt_Curr \t%s\n", power_state[BITS(dword, 27, 26)]);
1462 }
Mengdong Lindeba8682013-09-09 15:38:40 -04001463}
1464
Mengdong Lin86d15e02014-03-03 13:52:06 -05001465static void dump_aud_edid_data(int index)
Mengdong Lindeba8682013-09-09 15:38:40 -04001466{
1467 uint32_t dword;
1468 int i;
Mengdong Lin86d15e02014-03-03 13:52:06 -05001469 int offset;
1470 int aud_ctrl_st, edid_data;
Mengdong Lindeba8682013-09-09 15:38:40 -04001471
Mengdong Lin86d15e02014-03-03 13:52:06 -05001472 if (IS_HASWELL_PLUS(devid)) {
1473 offset = (index - TRANSCODER_A) * 0x100;
1474 aud_ctrl_st = aud_reg_base + AUD_TCA_DIP_ELD_CTRL_ST + offset;
1475 edid_data = aud_reg_base + AUD_TCA_EDID_DATA + offset;
1476 printf("AUD_TC%c_EDID_DATA ELD:\n\t", 'A' + index - TRANSCODER_A);
1477 } else {
1478 offset = (index - PIPE_A) * 0x100;
1479 aud_ctrl_st = aud_reg_base + AUD_CNTL_ST_A + offset;
1480 edid_data = aud_reg_base + AUD_HDMIW_HDMIEDID_A + offset;
1481 printf("AUD_HDMIW_HDMIEDID_%c HDMI ELD:\n\t", 'A' + index - PIPE_A);
1482 }
1483
1484 dword = INREG(aud_ctrl_st);
Mengdong Lindeba8682013-09-09 15:38:40 -04001485 dword &= ~BITMASK(9, 5);
Mengdong Lin86d15e02014-03-03 13:52:06 -05001486 OUTREG(aud_ctrl_st, dword);
Mengdong Lindeba8682013-09-09 15:38:40 -04001487 for (i = 0; i < BITS(dword, 14, 10) / 4; i++)
Mengdong Lin86d15e02014-03-03 13:52:06 -05001488 printf("%08x ", htonl(INREG(edid_data)));
Mengdong Lindeba8682013-09-09 15:38:40 -04001489 printf("\n");
1490}
1491
Mengdong Lin86d15e02014-03-03 13:52:06 -05001492static void dump_aud_infoframe(int index)
Mengdong Lindeba8682013-09-09 15:38:40 -04001493{
1494 uint32_t dword;
1495 int i;
Mengdong Lin86d15e02014-03-03 13:52:06 -05001496 int offset;
1497 int aud_ctrl_st, info_frm;
Mengdong Lindeba8682013-09-09 15:38:40 -04001498
Mengdong Lin86d15e02014-03-03 13:52:06 -05001499 if (IS_HASWELL_PLUS(devid)) {
1500 offset = (index - TRANSCODER_A) * 0x100;
1501 aud_ctrl_st = aud_reg_base + AUD_TCA_DIP_ELD_CTRL_ST + offset;
1502 info_frm = aud_reg_base + AUD_TCA_INFOFR + offset;
1503 printf("AUD_TC%c_INFOFR audio Infoframe:\n\t", 'A' + index - TRANSCODER_A);
1504 } else {
1505 offset = (index - PIPE_A) * 0x100;
1506 aud_ctrl_st = aud_reg_base + AUD_CNTL_ST_A + offset;
1507 info_frm = aud_reg_base + AUD_HDMIW_INFOFR_A + offset;
1508 printf("AUD_HDMIW_INFOFR_%c HDMI audio Infoframe:\n\t", 'A' + index - PIPE_A);
1509 }
1510
1511 dword = INREG(aud_ctrl_st);
Mengdong Lindeba8682013-09-09 15:38:40 -04001512 dword &= ~BITMASK(20, 18);
1513 dword &= ~BITMASK(3, 0);
Mengdong Lin86d15e02014-03-03 13:52:06 -05001514 OUTREG(aud_ctrl_st, dword);
Mengdong Lindeba8682013-09-09 15:38:40 -04001515 for (i = 0; i < 8; i++)
Mengdong Lin86d15e02014-03-03 13:52:06 -05001516 printf("%08x ", htonl(INREG(info_frm)));
Mengdong Lindeba8682013-09-09 15:38:40 -04001517 printf("\n");
1518}
1519
Mengdong Lin86d15e02014-03-03 13:52:06 -05001520static void dump_aud_port_en_hd_cfg(void)
1521{
1522 uint32_t dword;
1523 int num_pipes = get_num_pipes();
1524
1525 dword = INREG(aud_reg_base + AUD_PORT_EN_HD_CFG);
1526 if (num_pipes == 2) {
1527 printf("AUD_PORT_EN_HD_CFG Convertor_A_Digen\t\t\t%lu\n", BIT(dword, 0));
1528 printf("AUD_PORT_EN_HD_CFG Convertor_B_Digen\t\t\t%lu\n", BIT(dword, 1));
1529 printf("AUD_PORT_EN_HD_CFG Convertor_A_Stream_ID\t\t%lu\n", BITS(dword, 7, 4));
1530 printf("AUD_PORT_EN_HD_CFG Convertor_B_Stream_ID\t\t%lu\n", BITS(dword, 11, 8));
1531
1532 printf("AUD_PORT_EN_HD_CFG Port_B_Out_Enable\t\t\t%lu\n", BIT(dword, 12));
1533 printf("AUD_PORT_EN_HD_CFG Port_C_Out_Enable\t\t\t%lu\n", BIT(dword, 13));
1534 printf("AUD_PORT_EN_HD_CFG Port_D_Out_Enable\t\t\t%lu\n", BIT(dword, 14));
1535 printf("AUD_PORT_EN_HD_CFG Port_B_Amp_Mute_Status\t\t%lu\n", BIT(dword, 16));
1536 printf("AUD_PORT_EN_HD_CFG Port_C_Amp_Mute_Status\t\t%lu\n", BIT(dword, 17));
1537 printf("AUD_PORT_EN_HD_CFG Port_D_Amp_Mute_Status\t\t%lu\n", BIT(dword, 18));
1538 } else { /* three pipes */
1539 printf("AUD_PORT_EN_HD_CFG Convertor_A_Digen\t\t\t%lu\n", BIT(dword, 0));
1540 printf("AUD_PORT_EN_HD_CFG Convertor_B_Digen\t\t\t%lu\n", BIT(dword, 1));
1541 printf("AUD_PORT_EN_HD_CFG Convertor_C_Digen\t\t\t%lu\n", BIT(dword, 2));
1542 printf("AUD_PORT_EN_HD_CFG Convertor_A_Stream_ID\t\t%lu\n", BITS(dword, 7, 4));
1543 printf("AUD_PORT_EN_HD_CFG Convertor_B_Stream_ID\t\t%lu\n", BITS(dword, 11, 8));
1544 printf("AUD_PORT_EN_HD_CFG Convertor_C_Stream_ID\t\t%lu\n", BITS(dword, 15, 12));
1545
1546 printf("AUD_PORT_EN_HD_CFG Port_B_Out_Enable\t\t\t%lu\n", BIT(dword, 16));
1547 printf("AUD_PORT_EN_HD_CFG Port_C_Out_Enable\t\t\t%lu\n", BIT(dword, 17));
1548 printf("AUD_PORT_EN_HD_CFG Port_D_Out_Enable\t\t\t%lu\n", BIT(dword, 18));
1549 printf("AUD_PORT_EN_HD_CFG Port_B_Amp_Mute_Status\t\t%lu\n", BIT(dword, 20));
1550 printf("AUD_PORT_EN_HD_CFG Port_C_Amp_Mute_Status\t\t%lu\n", BIT(dword, 21));
1551 printf("AUD_PORT_EN_HD_CFG Port_D_Amp_Mute_Status\t\t%lu\n", BIT(dword, 22));
1552 }
1553}
1554
Mengdong Lindeba8682013-09-09 15:38:40 -04001555static void dump_aud_pipe_conv_cfg(void)
1556{
1557 uint32_t dword;
1558
Mengdong Lin86d15e02014-03-03 13:52:06 -05001559 dword = INREG(aud_reg_base + AUD_PIPE_CONV_CFG);
Mengdong Linfa8c7502014-03-04 10:13:09 -05001560 printf("AUD_PIPE_CONV_CFG Convertor_1_Digen\t\t\t%lu\n", BIT(dword, 0));
1561 printf("AUD_PIPE_CONV_CFG Convertor_2_Digen\t\t\t%lu\n", BIT(dword, 1));
1562 printf("AUD_PIPE_CONV_CFG Convertor_3_Digen\t\t\t%lu\n", BIT(dword, 2));
1563 printf("AUD_PIPE_CONV_CFG Convertor_1_Stream_ID\t\t%lu\n", BITS(dword, 7, 4));
1564 printf("AUD_PIPE_CONV_CFG Convertor_2_Stream_ID\t\t%lu\n", BITS(dword, 11, 8));
1565 printf("AUD_PIPE_CONV_CFG Convertor_3_Stream_ID\t\t%lu\n", BITS(dword, 15, 12));
1566
1567 printf("AUD_PIPE_CONV_CFG Port_B_Out_Enable\t\t\t%lu\n", BIT(dword, 16));
1568 printf("AUD_PIPE_CONV_CFG Port_C_Out_Enable\t\t\t%lu\n", BIT(dword, 17));
1569 printf("AUD_PIPE_CONV_CFG Port_D_Out_Enable\t\t\t%lu\n", BIT(dword, 18));
Mengdong Lindeba8682013-09-09 15:38:40 -04001570 printf("AUD_PIPE_CONV_CFG Port_B_Amp_Mute_Status\t\t%lu\n", BIT(dword, 20));
1571 printf("AUD_PIPE_CONV_CFG Port_C_Amp_Mute_Status\t\t%lu\n", BIT(dword, 21));
1572 printf("AUD_PIPE_CONV_CFG Port_D_Amp_Mute_Status\t\t%lu\n", BIT(dword, 22));
1573}
1574
Mengdong Lin86d15e02014-03-03 13:52:06 -05001575static void dump_aud_dig_cnvt(int index)
Mengdong Lindeba8682013-09-09 15:38:40 -04001576{
1577 uint32_t dword;
1578 char prefix[MAX_PREFIX_SIZE];
1579
Mengdong Lin86d15e02014-03-03 13:52:06 -05001580 if (!IS_HASWELL_PLUS(devid)) {
1581 dword = INREG(aud_reg_base + AUD_OUT_DIG_CNVT_A + (index - PIPE_A) * 0x100);
1582 sprintf(prefix, "AUD_OUT_DIG_CNVT_%c", 'A' + index - PIPE_A);
1583 } else {
1584 dword = INREG(aud_reg_base + AUD_C1_DIG_CNVT + (index - CONVERTER_1) * 0x100);
1585 sprintf(prefix, "AUD_C%c_DIG_CNVT ", '1' + index - CONVERTER_1);
1586 }
Mengdong Lindeba8682013-09-09 15:38:40 -04001587
Mengdong Linfa8c7502014-03-04 10:13:09 -05001588 printf("%s V\t\t\t\t\t%lu\n", prefix, BIT(dword, 1));
1589 printf("%s VCFG\t\t\t\t%lu\n", prefix, BIT(dword, 2));
1590 printf("%s PRE\t\t\t\t\t%lu\n", prefix, BIT(dword, 3));
1591 printf("%s Copy\t\t\t\t%lu\n", prefix, BIT(dword, 4));
1592 printf("%s NonAudio\t\t\t\t%lu\n", prefix, BIT(dword, 5));
1593 printf("%s PRO\t\t\t\t\t%lu\n", prefix, BIT(dword, 6));
1594 printf("%s Level\t\t\t\t%lu\n", prefix, BIT(dword, 7));
1595 printf("%s Category_Code\t\t\t%lu\n", prefix, BITS(dword, 14, 8));
1596 printf("%s Lowest_Channel_Number\t\t%lu\n", prefix, BITS(dword, 19, 16));
1597 printf("%s Stream_ID\t\t\t\t%lu\n", prefix, BITS(dword, 23, 20));
Mengdong Lindeba8682013-09-09 15:38:40 -04001598}
1599
Mengdong Lin86d15e02014-03-03 13:52:06 -05001600static void dump_aud_str_desc(int index)
Mengdong Lindeba8682013-09-09 15:38:40 -04001601{
1602 uint32_t dword;
1603 char prefix[MAX_PREFIX_SIZE];
1604 uint32_t rate;
1605
Mengdong Lin86d15e02014-03-03 13:52:06 -05001606 if (!IS_HASWELL_PLUS(devid)) {
1607 dword = INREG(aud_reg_base + AUD_OUT_STR_DESC_A + (index - PIPE_A) * 0x100);
1608 sprintf(prefix, "AUD_OUT_STR_DESC_%c", 'A' + index - PIPE_A);
1609 } else {
1610 dword = INREG(aud_reg_base + AUD_C1_STR_DESC + (index - CONVERTER_1) * 0x100);
1611 sprintf(prefix, "AUD_C%c_STR_DESC ", '1' + index - CONVERTER_1);
1612 }
Mengdong Lindeba8682013-09-09 15:38:40 -04001613
Mengdong Linfa8c7502014-03-04 10:13:09 -05001614 printf("%s Number_of_Channels_in_a_Stream\t%lu\n", prefix, BITS(dword, 3, 0) + 1);
1615 printf("%s Bits_per_Sample\t\t\t[%#lx] %s\n", prefix, BITS(dword, 6, 4),
Mengdong Lindeba8682013-09-09 15:38:40 -04001616 OPNAME(bits_per_sample, BITS(dword, 6, 4)));
1617
Mengdong Linfa8c7502014-03-04 10:13:09 -05001618 printf("%s Sample_Base_Rate_Divisor\t\t[%#lx] %s\n", prefix, BITS(dword, 10, 8),
Mengdong Lindeba8682013-09-09 15:38:40 -04001619 OPNAME(sample_base_rate_divisor, BITS(dword, 10, 8)));
Mengdong Linfa8c7502014-03-04 10:13:09 -05001620 printf("%s Sample_Base_Rate_Mult\t\t[%#lx] %s\n", prefix, BITS(dword, 13, 11),
Mengdong Lindeba8682013-09-09 15:38:40 -04001621 OPNAME(sample_base_rate_mult, BITS(dword, 13, 11)));
Mengdong Linfa8c7502014-03-04 10:13:09 -05001622 printf("%s Sample_Base_Rate\t\t\t[%#lx] %s\t", prefix, BIT(dword, 14),
Mengdong Lindeba8682013-09-09 15:38:40 -04001623 OPNAME(sample_base_rate, BIT(dword, 14)));
1624 rate = (BIT(dword, 14) ? 44100 : 48000) * (BITS(dword, 13, 11) + 1)
1625 /(BITS(dword, 10, 8) + 1);
1626 printf("=> Sample Rate %d Hz\n", rate);
1627
Mengdong Linfa8c7502014-03-04 10:13:09 -05001628 printf("%s Convertor_Channel_Count\t\t%lu\n", prefix, BITS(dword, 20, 16) + 1);
Mengdong Lin86d15e02014-03-03 13:52:06 -05001629
1630 if (!IS_HASWELL_PLUS(devid))
1631 printf("%s HBR_enable\t\t\t\t%lu\n", prefix, BITS(dword, 28, 27));
Mengdong Lindeba8682013-09-09 15:38:40 -04001632}
1633
Mengdong Lin86d15e02014-03-03 13:52:06 -05001634#define dump_aud_out_ch_str dump_aud_out_chan_map
Mengdong Lindeba8682013-09-09 15:38:40 -04001635static void dump_aud_out_chan_map(void)
1636{
1637 uint32_t dword;
1638 int i;
1639
1640 printf("AUD_OUT_CHAN_MAP Converter_Channel_MAP PORTB PORTC PORTD\n");
1641 for (i = 0; i < 8; i++) {
Mengdong Lin86d15e02014-03-03 13:52:06 -05001642 OUTREG(aud_reg_base + AUD_OUT_CHAN_MAP, i | (i << 8) | (i << 16));
1643 dword = INREG(aud_reg_base + AUD_OUT_CHAN_MAP);
Mengdong Lindeba8682013-09-09 15:38:40 -04001644 printf("\t\t\t\t%lu\t%lu\t%lu\t%lu\n",
1645 1 + BITS(dword, 3, 0),
1646 1 + BITS(dword, 7, 4),
1647 1 + BITS(dword, 15, 12),
1648 1 + BITS(dword, 23, 20));
1649 }
1650}
1651
Mengdong Lin86d15e02014-03-03 13:52:06 -05001652static void dump_aud_connect_list(void)
Mengdong Lindeba8682013-09-09 15:38:40 -04001653{
1654 uint32_t dword;
1655 char prefix[MAX_PREFIX_SIZE];
1656
Mengdong Lin86d15e02014-03-03 13:52:06 -05001657 dword = INREG(aud_reg_base + AUD_PINW_CONNLNG_LIST);
1658 sprintf(prefix, "AUD_PINW_CONNLNG_LIST");
Mengdong Lindeba8682013-09-09 15:38:40 -04001659
Mengdong Linfa8c7502014-03-04 10:13:09 -05001660 printf("%s Connect_List_Length\t\t%lu\n", prefix, BITS(dword, 6, 0));
1661 printf("%s Form \t\t\t\t[%#lx] %s\n", prefix, BIT(dword, 7),
Mengdong Lindeba8682013-09-09 15:38:40 -04001662 OPNAME(connect_list_form, BIT(dword, 7)));
Mengdong Lin86d15e02014-03-03 13:52:06 -05001663 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 -04001664}
1665
Mengdong Lin86d15e02014-03-03 13:52:06 -05001666static void dump_aud_connect_select(void)
Mengdong Lindeba8682013-09-09 15:38:40 -04001667{
1668 uint32_t dword;
Mengdong Lin86d15e02014-03-03 13:52:06 -05001669 char prefix[MAX_PREFIX_SIZE];
Mengdong Lindeba8682013-09-09 15:38:40 -04001670
Mengdong Lin86d15e02014-03-03 13:52:06 -05001671 if (IS_HASWELL_PLUS(devid)) {
1672 dword = INREG(aud_reg_base + AUD_PIPE_CONN_SEL_CTRL);
1673 sprintf(prefix, "AUD_PIPE_CONN_SEL_CTRL");
1674
1675 } else {
1676 dword = INREG(aud_reg_base + AUD_PINW_CONNLNG_SEL);
1677 sprintf(prefix, "AUD_PINW_CONNLNG_SEL ");
1678 }
1679
1680 printf("%s Connection_select_Port_B\t%#lx\n", prefix, BITS(dword, 7, 0));
1681 printf("%s Connection_select_Port_C\t%#lx\n", prefix, BITS(dword, 15, 8));
1682 printf("%s Connection_select_Port_D\t%#lx\n", prefix, BITS(dword, 23, 16));
Mengdong Lindeba8682013-09-09 15:38:40 -04001683}
1684
Mengdong Lin86d15e02014-03-03 13:52:06 -05001685static void dump_aud_ctrl_state(int index)
Mengdong Lindeba8682013-09-09 15:38:40 -04001686{
1687 uint32_t dword;
Mengdong Lin86d15e02014-03-03 13:52:06 -05001688 int offset;
Mengdong Lindeba8682013-09-09 15:38:40 -04001689
Mengdong Lin86d15e02014-03-03 13:52:06 -05001690 if (IS_HASWELL_PLUS(devid)) {
1691 offset = (index - TRANSCODER_A) * 0x100;
1692 dword = INREG(aud_reg_base + AUD_TCA_DIP_ELD_CTRL_ST + offset);
1693 printf("Audio DIP and ELD control state for Transcoder %c\n", 'A' + index - TRANSCODER_A);
1694 } else {
1695 offset = (index - PIPE_A) * 0x100;
1696 dword = INREG(aud_reg_base + AUD_CNTL_ST_A + offset);
1697 printf("Audio control state - Pipe %c\n", 'A' + index - PIPE_A);
1698 }
Mengdong Lindeba8682013-09-09 15:38:40 -04001699
Mengdong Linfa8c7502014-03-04 10:13:09 -05001700 printf("\tELD_ACK\t\t\t\t\t\t%lu\n", BIT(dword, 4));
1701 printf("\tELD_buffer_size\t\t\t\t\t%lu\n", BITS(dword, 14, 10));
1702 printf("\tDIP_transmission_frequency\t\t\t[0x%lx] %s\n", BITS(dword, 17, 16),
Mengdong Lindeba8682013-09-09 15:38:40 -04001703 dip_trans[BITS(dword, 17, 16)]);
Mengdong Linfa8c7502014-03-04 10:13:09 -05001704 printf("\tDIP Buffer Index \t\t\t\t[0x%lx] %s\n", BITS(dword, 20, 18),
Mengdong Lindeba8682013-09-09 15:38:40 -04001705 dip_index[BITS(dword, 20, 18)]);
1706 printf("\tAudio DIP type enable status\t\t\t[0x%04lx] %s, %s, %s\n", BITS(dword, 24, 21),
1707 dip_type[BIT(dword, 21)], dip_gen1_state[BIT(dword, 22)], dip_gen2_state[BIT(dword, 23)]);
Mengdong Linfa8c7502014-03-04 10:13:09 -05001708 printf("\tAudio DIP port select\t\t\t\t[0x%lx] %s\n", BITS(dword, 30, 29),
Mengdong Lindeba8682013-09-09 15:38:40 -04001709 dip_port[BITS(dword, 30, 29)]);
1710 printf("\n");
1711}
1712
Mengdong Lin86d15e02014-03-03 13:52:06 -05001713static void dump_aud_ctrl_state2(void)
1714{
1715 uint32_t dword;
1716
1717 dword = INREG(aud_reg_base + AUD_CNTL_ST2);
1718 printf("AUD_CNTL_ST2 ELD_validB\t\t\t\t%lu\n", BIT(dword, 0));
1719 printf("AUD_CNTL_ST2 CP_ReadyB\t\t\t\t\t%lu\n", BIT(dword, 1));
1720 printf("AUD_CNTL_ST2 ELD_validC\t\t\t\t%lu\n", BIT(dword, 4));
1721 printf("AUD_CNTL_ST2 CP_ReadyC\t\t\t\t\t%lu\n", BIT(dword, 5));
1722 printf("AUD_CNTL_ST2 ELD_validD\t\t\t\t%lu\n", BIT(dword, 8));
1723 printf("AUD_CNTL_ST2 CP_ReadyD\t\t\t\t\t%lu\n", BIT(dword, 9));
1724}
1725
1726/* for hsw+ */
Mengdong Lindeba8682013-09-09 15:38:40 -04001727static void dump_aud_eld_cp_vld(void)
1728{
1729 uint32_t dword;
1730
Mengdong Lin86d15e02014-03-03 13:52:06 -05001731 dword = INREG(aud_reg_base + AUD_PIN_ELD_CP_VLD);
Mengdong Lindeba8682013-09-09 15:38:40 -04001732 printf("AUD_PIN_ELD_CP_VLD Transcoder_A ELD_valid\t\t%lu\n", BIT(dword, 0));
1733 printf("AUD_PIN_ELD_CP_VLD Transcoder_A CP_Ready \t\t%lu\n", BIT(dword, 1));
1734 printf("AUD_PIN_ELD_CP_VLD Transcoder_A Out_enable\t\t%lu\n", BIT(dword, 2));
1735 printf("AUD_PIN_ELD_CP_VLD Transcoder_A Inactive\t\t%lu\n", BIT(dword, 3));
1736 printf("AUD_PIN_ELD_CP_VLD Transcoder_B ELD_valid\t\t%lu\n", BIT(dword, 4));
1737 printf("AUD_PIN_ELD_CP_VLD Transcoder_B CP_Ready\t\t%lu\n", BIT(dword, 5));
1738 printf("AUD_PIN_ELD_CP_VLD Transcoder_B OUT_enable\t\t%lu\n", BIT(dword, 6));
1739 printf("AUD_PIN_ELD_CP_VLD Transcoder_B Inactive\t\t%lu\n", BIT(dword, 7));
1740 printf("AUD_PIN_ELD_CP_VLD Transcoder_C ELD_valid\t\t%lu\n", BIT(dword, 8));
1741 printf("AUD_PIN_ELD_CP_VLD Transcoder_C CP_Ready\t\t%lu\n", BIT(dword, 9));
1742 printf("AUD_PIN_ELD_CP_VLD Transcoder_C OUT_enable\t\t%lu\n", BIT(dword, 10));
1743 printf("AUD_PIN_ELD_CP_VLD Transcoder_C Inactive\t\t%lu\n", BIT(dword, 11));
1744}
1745
Mengdong Lin86d15e02014-03-03 13:52:06 -05001746static void dump_aud_hdmi_status(void)
Mengdong Lindeba8682013-09-09 15:38:40 -04001747{
1748 uint32_t dword;
1749
Mengdong Lin86d15e02014-03-03 13:52:06 -05001750 dword = INREG(aud_reg_base + AUD_HDMIW_STATUS);
1751 printf("AUD_HDMIW_STATUS Function_Reset\t\t\t%lu\n", BIT(dword, 24));
1752 printf("AUD_HDMIW_STATUS BCLK/CDCLK_FIFO_Overrun\t\t%lu\n", BIT(dword, 25));
1753 printf("AUD_HDMIW_STATUS Conv_A_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n", BIT(dword, 28));
1754 printf("AUD_HDMIW_STATUS Conv_A_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 29));
1755 printf("AUD_HDMIW_STATUS Conv_B_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n", BIT(dword, 30));
1756 printf("AUD_HDMIW_STATUS Conv_B_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 31));
1757}
1758
1759/*
Mengdong Lin449509d2014-03-03 17:03:02 -05001760 * Display registers of Ironlake and Valleyview
Mengdong Lin86d15e02014-03-03 13:52:06 -05001761 */
1762#undef DP_CTL_B
1763#undef DP_CTL_C
1764#undef DP_CTL_D
1765
1766#define DP_CTL_B 0x4100
1767#define DP_CTL_C 0x4200
1768#define DP_CTL_D 0x4300
1769
Mengdong Lin449509d2014-03-03 17:03:02 -05001770/* ILK HDMI port ctrl */
Mengdong Lin86d15e02014-03-03 13:52:06 -05001771#define HDMI_CTL_B 0x1140
1772#define HDMI_CTL_C 0x1150
1773#define HDMI_CTL_D 0x1160
1774
Mengdong Lin449509d2014-03-03 17:03:02 -05001775/* VLV HDMI port ctrl */
1776#define SDVO_HDMI_CTL_B 0x1140
1777#define SDVO_HDMI_CTL_C 0x1160
1778
Mengdong Lin86d15e02014-03-03 13:52:06 -05001779static void dump_dp_port_ctrl(int port)
1780{
1781 uint32_t dword;
1782 int port_ctrl;
1783 char prefix[MAX_PREFIX_SIZE];
1784
1785 sprintf(prefix, "DP_%c", 'B' + port - PORT_B);
1786
1787 port_ctrl = disp_reg_base + DP_CTL_B + (port - PORT_B) * 0x100;
1788 dword = INREG(port_ctrl);
1789 printf("%s DisplayPort_Enable\t\t\t\t\t%lu\n", prefix, BIT(dword, 31));
1790 printf("%s Transcoder_Select\t\t\t\t\t%s\n", prefix, BIT(dword, 30) ? "Transcoder B" : "Transcoder A");
1791 printf("%s Port_Width_Selection\t\t\t\t[0x%lx] %s\n", prefix, BITS(dword, 21, 19),
1792 dp_port_width[BITS(dword, 21, 19)]);
1793 printf("%s Port_Detected\t\t\t\t\t%lu\n", prefix, BIT(dword, 2));
1794 printf("%s HDCP_Port_Select\t\t\t\t\t%lu\n", prefix, BIT(dword, 5));
1795 printf("%s Audio_Output_Enable\t\t\t\t%lu\n", prefix, BIT(dword, 6));
1796}
1797
1798static void dump_hdmi_port_ctrl(int port)
1799{
1800 uint32_t dword;
1801 int port_ctrl;
1802 char prefix[MAX_PREFIX_SIZE];
1803
Mengdong Lin449509d2014-03-03 17:03:02 -05001804 if (IS_VALLEYVIEW(devid)) {
1805 sprintf(prefix, "SDVO/HDMI%c", 'B' + port - PORT_B);
1806 port_ctrl = disp_reg_base + SDVO_HDMI_CTL_B + (port - PORT_B) * 0x20;
1807 } else {
1808 sprintf(prefix, "HDMI%c ", 'B' + port - PORT_B);
1809 port_ctrl = disp_reg_base + HDMI_CTL_B + (port - PORT_B) * 0x10;
1810 }
Mengdong Lin86d15e02014-03-03 13:52:06 -05001811
Mengdong Lin86d15e02014-03-03 13:52:06 -05001812 dword = INREG(port_ctrl);
1813 printf("%s HDMI_Enable\t\t\t\t\t%u\n", prefix, !!(dword & SDVO_ENABLE));
1814 printf("%s Transcoder_Select\t\t\t\t%s\n", prefix, BIT(dword, 30) ? "Transcoder B" : "Transcoder A");
1815 printf("%s HDCP_Port_Select\t\t\t\t%lu\n", prefix, BIT(dword, 5));
1816 if (port == PORT_B) /* TODO: check spec, not found in Ibx b-spec, and only for port B? */
1817 printf("%s SDVO Hot Plug Interrupt Detect Enable\t%lu\n", prefix, BIT(dword, 23));
1818 printf("%s Digital_Port_Detected\t\t\t%lu\n", prefix, BIT(dword, 2));
1819 printf("%s Encoding\t\t\t\t\t[0x%lx] %s\n", prefix, BITS(dword, 11, 10),
1820 sdvo_hdmi_encoding[BITS(dword, 11, 10)]);
1821 printf("%s Null_packets_enabled_during_Vsync\t\t%u\n", prefix, !!(dword & SDVO_NULL_PACKETS_DURING_VSYNC));
1822 printf("%s Audio_Output_Enable\t\t\t\t%u\n", prefix, !!(dword & SDVO_AUDIO_ENABLE));
1823}
1824
1825static void dump_ironlake(void)
1826{
1827 uint32_t dword;
1828
Mengdong Lin449509d2014-03-03 17:03:02 -05001829 if (!IS_VALLEYVIEW(devid))
1830 set_reg_base(0xe0000, 0x2000); /* ironlake */
1831 else
1832 set_reg_base(0x60000 + VLV_DISPLAY_BASE, 0x2000);
Mengdong Lin86d15e02014-03-03 13:52:06 -05001833
Mengdong Lin449509d2014-03-03 17:03:02 -05001834 if (!IS_VALLEYVIEW(devid)) {
1835 dump_disp_reg(HDMI_CTL_B, "sDVO/HDMI Port B Control");
1836 dump_disp_reg(HDMI_CTL_C, "HDMI Port C Control");
1837 dump_disp_reg(HDMI_CTL_D, "HDMI Port D Control");
1838 } else {
1839 dump_disp_reg(SDVO_HDMI_CTL_B, "sDVO/HDMI Port B Control");
1840 dump_disp_reg(SDVO_HDMI_CTL_C, "sDVO/HDMI Port C Control");
1841 }
1842
Mengdong Lin86d15e02014-03-03 13:52:06 -05001843 dump_disp_reg(DP_CTL_B, "DisplayPort B Control Register");
1844 dump_disp_reg(DP_CTL_C, "DisplayPort C Control Register");
Mengdong Lin449509d2014-03-03 17:03:02 -05001845 if (!IS_VALLEYVIEW(devid))
1846 dump_disp_reg(DP_CTL_D, "DisplayPort D Control Register");
Mengdong Lin86d15e02014-03-03 13:52:06 -05001847
1848 dump_aud_reg(AUD_CONFIG_A, "Audio Configuration - Transcoder A");
1849 dump_aud_reg(AUD_CONFIG_B, "Audio Configuration - Transcoder B");
1850 dump_aud_reg(AUD_CTS_ENABLE_A, "Audio CTS Programming Enable - Transcoder A");
1851 dump_aud_reg(AUD_CTS_ENABLE_B, "Audio CTS Programming Enable - Transcoder B");
1852 dump_aud_reg(AUD_MISC_CTRL_A, "Audio MISC Control for Transcoder A");
1853 dump_aud_reg(AUD_MISC_CTRL_B, "Audio MISC Control for Transcoder B");
1854 dump_aud_reg(AUD_VID_DID, "Audio Vendor ID / Device ID");
1855 dump_aud_reg(AUD_RID, "Audio Revision ID");
1856 dump_aud_reg(AUD_PWRST, "Audio Power State (Function Group, Convertor, Pin Widget)");
1857 dump_aud_reg(AUD_PORT_EN_HD_CFG, "Audio Port Enable HDAudio Config");
1858 dump_aud_reg(AUD_OUT_DIG_CNVT_A, "Audio Digital Converter - Conv A");
1859 dump_aud_reg(AUD_OUT_DIG_CNVT_B, "Audio Digital Converter - Conv B");
1860 dump_aud_reg(AUD_OUT_CH_STR, "Audio Channel ID and Stream ID");
1861 dump_aud_reg(AUD_OUT_STR_DESC_A, "Audio Stream Descriptor Format - Conv A");
1862 dump_aud_reg(AUD_OUT_STR_DESC_B, "Audio Stream Descriptor Format - Conv B");
1863 dump_aud_reg(AUD_PINW_CONNLNG_LIST, "Audio Connection List");
1864 dump_aud_reg(AUD_PINW_CONNLNG_SEL, "Audio Connection Select");
1865 dump_aud_reg(AUD_CNTL_ST_A, "Audio Control State Register - Transcoder A");
1866 dump_aud_reg(AUD_CNTL_ST_B, "Audio Control State Register - Transcoder B");
1867 dump_aud_reg(AUD_CNTL_ST2, "Audio Control State 2");
1868 dump_aud_reg(AUD_HDMIW_STATUS, "Audio HDMI Status");
1869 dump_aud_reg(AUD_HDMIW_HDMIEDID_A, "HDMI Data EDID Block - Transcoder A");
1870 dump_aud_reg(AUD_HDMIW_HDMIEDID_B, "HDMI Data EDID Block - Transcoder B");
1871 dump_aud_reg(AUD_HDMIW_INFOFR_A, "Audio Widget Data Island Packet - Transcoder A");
1872 dump_aud_reg(AUD_HDMIW_INFOFR_B, "Audio Widget Data Island Packet - Transcoder B");
1873
1874 printf("\nDetails:\n\n");
1875
1876 dump_aud_vendor_device_id();
1877 dump_aud_revision_id();
1878
1879 dump_hdmi_port_ctrl(PORT_B);
1880 dump_hdmi_port_ctrl(PORT_C);
Mengdong Lin449509d2014-03-03 17:03:02 -05001881 if (!IS_VALLEYVIEW(devid))
1882 dump_hdmi_port_ctrl(PORT_D);
Mengdong Lin86d15e02014-03-03 13:52:06 -05001883
1884 dump_dp_port_ctrl(PORT_B);
1885 dump_dp_port_ctrl(PORT_C);
Mengdong Lin449509d2014-03-03 17:03:02 -05001886 if (!IS_VALLEYVIEW(devid))
1887 dump_dp_port_ctrl(PORT_D);
Mengdong Lin86d15e02014-03-03 13:52:06 -05001888
1889 dump_aud_config(PIPE_A);
1890 dump_aud_config(PIPE_B);
1891
1892 dump_aud_m_cts_enable(PIPE_A);
1893 dump_aud_m_cts_enable(PIPE_B);
1894
1895 dump_aud_misc_control(PIPE_A);
1896 dump_aud_misc_control(PIPE_B);
1897
1898 dump_aud_power_state();
1899 dump_aud_port_en_hd_cfg();
1900
1901 dump_aud_dig_cnvt(PIPE_A);
1902 dump_aud_dig_cnvt(PIPE_B);
1903
1904 dump_aud_out_ch_str();
1905
1906 dump_aud_str_desc(PIPE_A);
1907 dump_aud_str_desc(PIPE_B);
1908
1909 dump_aud_connect_list();
1910 dump_aud_connect_select();
1911
1912 dump_aud_ctrl_state(PIPE_A);
1913 dump_aud_ctrl_state(PIPE_B);
1914 dump_aud_ctrl_state2();
1915
1916 dump_aud_hdmi_status();
1917
1918 dump_aud_edid_data(PIPE_A);
1919 dump_aud_edid_data(PIPE_B);
1920
1921 dump_aud_infoframe(PIPE_A);
1922 dump_aud_infoframe(PIPE_B);
1923}
1924
1925#undef VIDEO_DIP_CTL_A
1926#undef VIDEO_DIP_CTL_B
1927#undef VIDEO_DIP_CTL_C
1928#undef VIDEO_DIP_CTL_D
1929#undef VIDEO_DIP_DATA
1930
1931/*
1932 * Haswell+ display registers
1933 */
1934
1935/* DisplayPort Transport Control */
1936#define DP_TP_CTL_A 0x64040
1937#define DP_TP_CTL_B 0x64140
1938#define DP_TP_CTL_C 0x64240
1939#define DP_TP_CTL_D 0x64340
1940#define DP_TP_CTL_E 0x64440
1941
1942/* DisplayPort Transport Status */
1943#define DP_TP_ST_A 0x64044
1944#define DP_TP_ST_B 0x64144
1945#define DP_TP_ST_C 0x64244
1946#define DP_TP_ST_D 0x64344
1947#define DP_TP_ST_E 0x64444
1948
1949/* DDI Buffer Control */
1950#define DDI_BUF_CTL_A 0x64000
1951#define DDI_BUF_CTL_B 0x64100
1952#define DDI_BUF_CTL_C 0x64200
1953#define DDI_BUF_CTL_D 0x64300
1954#define DDI_BUF_CTL_E 0x64400
1955
1956/* DDI Buffer Translation */
1957#define DDI_BUF_TRANS_A 0x64e00
1958#define DDI_BUF_TRANS_B 0x64e60
1959#define DDI_BUF_TRANS_C 0x64ec0
1960#define DDI_BUF_TRANS_D 0x64f20
1961#define DDI_BUF_TRANS_E 0x64f80
1962
1963/* DDI Aux Channel */
1964#define DDI_AUX_CHANNEL_CTRL 0x64010
1965#define DDI_AUX_DATA 0x64014
1966#define DDI_AUX_TST 0x64028
1967
1968/* DDI CRC Control */
1969#define DDI_CRC_CTL_A 0x64050
1970#define DDI_CRC_CTL_B 0x64150
1971#define DDI_CRC_CTL_C 0x64250
1972#define DDI_CRC_CTL_D 0x64350
1973#define DDI_CRC_CTL_E 0x64450
1974
1975/* Pipe DDI Function Control */
1976#define PIPE_DDI_FUNC_CTL_A 0x60400
1977#define PIPE_DDI_FUNC_CTL_B 0x61400
1978#define PIPE_DDI_FUNC_CTL_C 0x62400
1979#define PIPE_DDI_FUNC_CTL_EDP 0x6F400
1980
1981/* Pipe Configuration */
1982#define PIPE_CONF_A 0x70008
1983#define PIPE_CONF_B 0x71008
1984#define PIPE_CONF_C 0x72008
1985#define PIPE_CONF_EDP 0x7F008
1986
1987/* Video DIP Control */
1988#define VIDEO_DIP_CTL_A 0x60200
1989#define VIDEO_DIP_CTL_B 0x61200
1990#define VIDEO_DIP_CTL_C 0x62200
1991#define VIDEO_DIP_CTL_D 0x63200
1992
1993#define VIDEO_DIP_DATA 0x60220
1994#define VIDEO_DIP_ECC 0x60240
1995
1996static void dump_ddi_buf_ctl(int port)
1997{
1998 uint32_t dword;
1999
2000 dword = INREG(DDI_BUF_CTL_A + (port - PORT_A) * 0x100);
2001 printf("DDI %c Buffer control\n", 'A' + port - PORT_A);
2002
2003 printf("\tDP port width\t\t\t\t\t[0x%lx] %s\n", BITS(dword, 3, 1),
2004 OPNAME(dp_port_width, BITS(dword, 3, 1)));
2005 printf("\tDDI Buffer Enable\t\t\t\t%ld\n", BIT(dword, 31));
2006}
2007
2008static void dump_ddi_func_ctl(int pipe)
2009{
2010 uint32_t dword;
2011
2012 dword = INREG(PIPE_DDI_FUNC_CTL_A + (pipe - PIPE_A) * 0x1000);
2013 printf("Pipe %c DDI Function Control\n", 'A' + pipe - PIPE_A);
2014
2015 printf("\tBITS per color\t\t\t\t\t[0x%lx] %s\n", BITS(dword, 22, 20),
2016 OPNAME(bits_per_color, BITS(dword, 22, 20)));
2017 printf("\tPIPE DDI Mode\t\t\t\t\t[0x%lx] %s\n", BITS(dword, 26, 24),
2018 OPNAME(ddi_mode, BITS(dword, 26, 24)));
2019 printf("\tPIPE DDI selection\t\t\t\t[0x%lx] %s\n", BITS(dword, 30, 28),
2020 OPNAME(trans_to_port_sel, BITS(dword, 30, 28)));
2021 printf("\tPIPE DDI Function Enable\t\t\t[0x%lx]\n", BIT(dword, 31));
2022}
2023
2024static void dump_aud_connect_list_entry_length(int transcoder)
2025{
2026 uint32_t dword;
2027 char prefix[MAX_PREFIX_SIZE];
2028
2029 dword = INREG(aud_reg_base + AUD_TCA_PIN_PIPE_CONN_ENTRY_LNGTH + (transcoder - TRANSCODER_A) * 0x100);
2030 sprintf(prefix, "AUD_TC%c_PIN_PIPE_CONN_ENTRY_LNGTH", 'A' + transcoder - TRANSCODER_A);
2031
2032 printf("%s Connect_List_Length\t%lu\n", prefix, BITS(dword, 6, 0));
2033 printf("%s Form \t\t[%#lx] %s\n", prefix, BIT(dword, 7),
2034 OPNAME(connect_list_form, BIT(dword, 7)));
2035 printf("%s Connect_List_Entry\t%lu\n", prefix, BITS(dword, 15, 8));
2036}
2037
2038static void dump_aud_connect_select_ctrl(void)
2039{
2040 uint32_t dword;
2041
2042 dword = INREG(aud_reg_base + AUD_PIPE_CONN_SEL_CTRL);
2043 printf("AUD_PIPE_CONN_SEL_CTRL Connection_select_Port_B\t%#lx\n", BITS(dword, 7, 0));
2044 printf("AUD_PIPE_CONN_SEL_CTRL Connection_select_Port_C\t%#lx\n", BITS(dword, 15, 8));
2045 printf("AUD_PIPE_CONN_SEL_CTRL Connection_select_Port_D\t%#lx\n", BITS(dword, 23, 16));
2046}
2047
2048static void dump_aud_dip_eld_ctrl_st(int transcoder)
2049{
2050 uint32_t dword;
2051 int offset = (transcoder - TRANSCODER_A) * 0x100;
2052
2053 dword = INREG(aud_reg_base + AUD_TCA_DIP_ELD_CTRL_ST + offset);
2054 printf("Audio DIP and ELD control state for Transcoder %c\n", 'A' + transcoder - TRANSCODER_A);
2055
2056 printf("\tELD_ACK\t\t\t\t\t\t%lu\n", BIT(dword, 4));
2057 printf("\tELD_buffer_size\t\t\t\t\t%lu\n", BITS(dword, 14, 10));
2058 printf("\tDIP_transmission_frequency\t\t\t[0x%lx] %s\n", BITS(dword, 17, 16),
2059 dip_trans[BITS(dword, 17, 16)]);
2060 printf("\tDIP Buffer Index \t\t\t\t[0x%lx] %s\n", BITS(dword, 20, 18),
2061 dip_index[BITS(dword, 20, 18)]);
2062 printf("\tAudio DIP type enable status\t\t\t[0x%04lx] %s, %s, %s\n", BITS(dword, 24, 21),
2063 dip_type[BIT(dword, 21)], dip_gen1_state[BIT(dword, 22)], dip_gen2_state[BIT(dword, 23)]);
2064 printf("\tAudio DIP port select\t\t\t\t[0x%lx] %s\n", BITS(dword, 30, 29),
2065 dip_port[BITS(dword, 30, 29)]);
2066 printf("\n");
2067}
2068
2069static void dump_aud_hdmi_fifo_status(void)
2070{
2071 uint32_t dword;
2072
2073 dword = INREG(aud_reg_base + AUD_HDMI_FIFO_STATUS);
Mengdong Lindeba8682013-09-09 15:38:40 -04002074 printf("AUD_HDMI_FIFO_STATUS Function_Reset\t\t\t%lu\n", BIT(dword, 24));
2075 printf("AUD_HDMI_FIFO_STATUS Conv_1_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n", BIT(dword, 26));
2076 printf("AUD_HDMI_FIFO_STATUS Conv_1_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 27));
2077 printf("AUD_HDMI_FIFO_STATUS Conv_2_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n", BIT(dword, 28));
2078 printf("AUD_HDMI_FIFO_STATUS Conv_2_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 29));
2079 printf("AUD_HDMI_FIFO_STATUS Conv_3_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n", BIT(dword, 30));
2080 printf("AUD_HDMI_FIFO_STATUS Conv_3_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 31));
2081}
Wang Xingchaoc4077222012-08-15 16:13:38 +08002082
Mengdong Linf075c3c2013-08-13 00:22:14 -04002083static void parse_bdw_audio_chicken_bit_reg(uint32_t dword)
2084{
2085 printf("\t");
Mengdong Linfa8c7502014-03-04 10:13:09 -05002086 printf("%s\n\t", OPNAME(vanilla_dp12_en, BIT(dword, 31)));
2087 printf("%s\n\t", OPNAME(vanilla_3_widgets_en, BIT(dword, 30)));
2088 printf("%s\n\t", OPNAME(block_audio, BIT(dword, 10)));
Mengdong Linf075c3c2013-08-13 00:22:14 -04002089 printf("%s\n\t", OPNAME(dis_eld_valid_pulse_trans, BIT(dword, 9)));
Mengdong Linfa8c7502014-03-04 10:13:09 -05002090 printf("%s\n\t", OPNAME(dis_pd_pulse_trans, BIT(dword, 8)));
2091 printf("%s\n\t", OPNAME(dis_ts_delta_err, BIT(dword, 7)));
2092 printf("%s\n\t", OPNAME(dis_ts_fix_dp_hbr, BIT(dword, 6)));
2093 printf("%s\n\t", OPNAME(pattern_gen_8_ch_en, BIT(dword, 5)));
2094 printf("%s\n\t", OPNAME(pattern_gen_2_ch_en, BIT(dword, 4)));
2095 printf("%s\n\t", OPNAME(fabric_32_44_dis, BIT(dword, 3)));
2096 printf("%s\n\t", OPNAME(epss_dis, BIT(dword, 2)));
2097 printf("%s\n\t", OPNAME(ts_test_mode, BIT(dword, 1)));
2098 printf("%s\n", OPNAME(en_mmio_program, BIT(dword, 0)));
Mengdong Linf075c3c2013-08-13 00:22:14 -04002099}
2100
Mengdong Lin69cc00b2013-07-17 13:29:17 -04002101/* Dump audio registers for Haswell and its successors (eg. Broadwell).
2102 * Their register layout are same in the north display engine.
2103 */
2104static void dump_hsw_plus(void)
Wang Xingchaoc4077222012-08-15 16:13:38 +08002105{
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04002106 uint32_t dword;
Mengdong Lin97e5cf62013-08-13 00:22:24 -04002107 int i;
Wang Xingchaoc4077222012-08-15 16:13:38 +08002108
Mengdong Lin86d15e02014-03-03 13:52:06 -05002109 set_aud_reg_base(0x65000);
2110
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04002111 /* HSW DDI Buffer */
Mengdong Linfa8c7502014-03-04 10:13:09 -05002112 dump_reg(DDI_BUF_CTL_A, "DDI Buffer Controler A");
2113 dump_reg(DDI_BUF_CTL_B, "DDI Buffer Controler B");
2114 dump_reg(DDI_BUF_CTL_C, "DDI Buffer Controler C");
2115 dump_reg(DDI_BUF_CTL_D, "DDI Buffer Controler D");
2116 dump_reg(DDI_BUF_CTL_E, "DDI Buffer Controler E");
Wang Xingchaoc4077222012-08-15 16:13:38 +08002117
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04002118 /* HSW Pipe Function */
Mengdong Linfa8c7502014-03-04 10:13:09 -05002119 dump_reg(PIPE_CONF_A, "PIPE Configuration A");
2120 dump_reg(PIPE_CONF_B, "PIPE Configuration B");
2121 dump_reg(PIPE_CONF_C, "PIPE Configuration C");
2122 dump_reg(PIPE_CONF_EDP, "PIPE Configuration EDP");
Wang Xingchaoc4077222012-08-15 16:13:38 +08002123
Mengdong Linfa8c7502014-03-04 10:13:09 -05002124 dump_reg(PIPE_DDI_FUNC_CTL_A, "PIPE DDI Function Control A");
2125 dump_reg(PIPE_DDI_FUNC_CTL_B, "PIPE DDI Function Control B");
2126 dump_reg(PIPE_DDI_FUNC_CTL_C, "PIPE DDI Function Control C");
2127 dump_reg(PIPE_DDI_FUNC_CTL_EDP, "PIPE DDI Function Control EDP");
Wang Xingchaoc4077222012-08-15 16:13:38 +08002128
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04002129 /* HSW Display port */
Mengdong Linfa8c7502014-03-04 10:13:09 -05002130 dump_reg(DP_TP_CTL_A, "DisplayPort Transport A Control");
2131 dump_reg(DP_TP_CTL_B, "DisplayPort Transport B Control");
2132 dump_reg(DP_TP_CTL_C, "DisplayPort Transport C Control");
2133 dump_reg(DP_TP_CTL_D, "DisplayPort Transport D Control");
2134 dump_reg(DP_TP_CTL_E, "DisplayPort Transport E Control");
Wang Xingchaoc4077222012-08-15 16:13:38 +08002135
Mengdong Linfa8c7502014-03-04 10:13:09 -05002136 dump_reg(DP_TP_ST_A, "DisplayPort Transport A Status");
2137 dump_reg(DP_TP_ST_B, "DisplayPort Transport B Status");
2138 dump_reg(DP_TP_ST_C, "DisplayPort Transport C Status");
2139 dump_reg(DP_TP_ST_D, "DisplayPort Transport D Status");
2140 dump_reg(DP_TP_ST_E, "DisplayPort Transport E Status");
Wang Xingchaoc4077222012-08-15 16:13:38 +08002141
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04002142 /* HSW North Display Audio */
Mengdong Lin86d15e02014-03-03 13:52:06 -05002143 dump_aud_reg(AUD_TCA_CONFIG, "Audio Configuration - Transcoder A");
2144 dump_aud_reg(AUD_TCB_CONFIG, "Audio Configuration - Transcoder B");
2145 dump_aud_reg(AUD_TCC_CONFIG, "Audio Configuration - Transcoder C");
2146 dump_aud_reg(AUD_C1_MISC_CTRL, "Audio Converter 1 MISC Control");
2147 dump_aud_reg(AUD_C2_MISC_CTRL, "Audio Converter 2 MISC Control");
2148 dump_aud_reg(AUD_C3_MISC_CTRL, "Audio Converter 3 MISC Control");
2149 dump_aud_reg(AUD_VID_DID, "Audio Vendor ID / Device ID");
2150 dump_aud_reg(AUD_RID, "Audio Revision ID");
2151 dump_aud_reg(AUD_TCA_M_CTS_ENABLE, "Audio M & CTS Programming Enable - Transcoder A");
2152 dump_aud_reg(AUD_TCB_M_CTS_ENABLE, "Audio M & CTS Programming Enable - Transcoder B");
2153 dump_aud_reg(AUD_TCC_M_CTS_ENABLE, "Audio M & CTS Programming Enable - Transcoder C");
2154 dump_aud_reg(AUD_PWRST, "Audio Power State (Function Group, Convertor, Pin Widget)");
2155 dump_aud_reg(AUD_TCA_EDID_DATA, "Audio EDID Data Block - Transcoder A");
2156 dump_aud_reg(AUD_TCB_EDID_DATA, "Audio EDID Data Block - Transcoder B");
2157 dump_aud_reg(AUD_TCC_EDID_DATA, "Audio EDID Data Block - Transcoder C");
2158 dump_aud_reg(AUD_TCA_INFOFR, "Audio Widget Data Island Packet - Transcoder A");
2159 dump_aud_reg(AUD_TCB_INFOFR, "Audio Widget Data Island Packet - Transcoder B");
2160 dump_aud_reg(AUD_TCC_INFOFR, "Audio Widget Data Island Packet - Transcoder C");
2161 dump_aud_reg(AUD_PIPE_CONV_CFG, "Audio Pipe and Converter Configs");
2162 dump_aud_reg(AUD_C1_DIG_CNVT, "Audio Digital Converter - Converter 1");
2163 dump_aud_reg(AUD_C2_DIG_CNVT, "Audio Digital Converter - Converter 2");
2164 dump_aud_reg(AUD_C3_DIG_CNVT, "Audio Digital Converter - Converter 3");
2165 dump_aud_reg(AUD_C1_STR_DESC, "Audio Stream Descriptor Format - Converter 1");
2166 dump_aud_reg(AUD_C2_STR_DESC, "Audio Stream Descriptor Format - Converter 2");
2167 dump_aud_reg(AUD_C3_STR_DESC, "Audio Stream Descriptor Format - Converter 3");
2168 dump_aud_reg(AUD_OUT_CHAN_MAP, "Audio Output Channel Mapping");
2169 dump_aud_reg(AUD_TCA_PIN_PIPE_CONN_ENTRY_LNGTH, "Audio Connection List entry and Length - Transcoder A");
2170 dump_aud_reg(AUD_TCB_PIN_PIPE_CONN_ENTRY_LNGTH, "Audio Connection List entry and Length - Transcoder B");
2171 dump_aud_reg(AUD_TCC_PIN_PIPE_CONN_ENTRY_LNGTH, "Audio Connection List entry and Length - Transcoder C");
2172 dump_aud_reg(AUD_PIPE_CONN_SEL_CTRL, "Audio Pipe Connection Select Control");
2173 dump_aud_reg(AUD_TCA_DIP_ELD_CTRL_ST, "Audio DIP and ELD control state - Transcoder A");
2174 dump_aud_reg(AUD_TCB_DIP_ELD_CTRL_ST, "Audio DIP and ELD control state - Transcoder B");
2175 dump_aud_reg(AUD_TCC_DIP_ELD_CTRL_ST, "Audio DIP and ELD control state - Transcoder C");
2176 dump_aud_reg(AUD_PIN_ELD_CP_VLD, "Audio pin ELD valid and CP ready status");
2177 dump_aud_reg(AUD_HDMI_FIFO_STATUS, "Audio HDMI FIFO Status");
Wang Xingchaoc4077222012-08-15 16:13:38 +08002178
Mengdong Lin85357202013-08-13 00:21:57 -04002179 /* Audio debug registers */
Mengdong Lin86d15e02014-03-03 13:52:06 -05002180 dump_aud_reg(AUD_ICOI, "Audio Immediate Command Output Interface");
2181 dump_aud_reg(AUD_IRII, "Audio Immediate Response Input Interface");
2182 dump_aud_reg(AUD_ICS, "Audio Immediate Command Status");
2183 dump_aud_reg(AUD_CHICKENBIT_REG, "Audio Chicken Bit Register");
2184 dump_aud_reg(AUD_DP_DIP_STATUS, "Audio DP and DIP FIFO Debug Status");
2185 dump_aud_reg(AUD_TCA_M_CTS, "Audio M CTS Read Back Transcoder A");
2186 dump_aud_reg(AUD_TCB_M_CTS, "Audio M CTS Read Back Transcoder B");
2187 dump_aud_reg(AUD_TCC_M_CTS, "Audio M CTS Read Back Transcoder C");
Mengdong Lin85357202013-08-13 00:21:57 -04002188
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04002189 printf("\nDetails:\n\n");
Wang Xingchaoc4077222012-08-15 16:13:38 +08002190
Mengdong Lindeba8682013-09-09 15:38:40 -04002191 dump_ddi_buf_ctl(PORT_A);
2192 dump_ddi_buf_ctl(PORT_B);
2193 dump_ddi_buf_ctl(PORT_C);
2194 dump_ddi_buf_ctl(PORT_D);
2195 dump_ddi_buf_ctl(PORT_E);
Wang Xingchaoc4077222012-08-15 16:13:38 +08002196
Mengdong Lindeba8682013-09-09 15:38:40 -04002197 dump_ddi_func_ctl(PIPE_A);
2198 dump_ddi_func_ctl(PIPE_B);
2199 dump_ddi_func_ctl(PIPE_C);
Wang Xingchaoc4077222012-08-15 16:13:38 +08002200
Mengdong Lindeba8682013-09-09 15:38:40 -04002201 /* audio configuration - details */
Mengdong Lin86d15e02014-03-03 13:52:06 -05002202 dump_aud_config(TRANSCODER_A);
2203 dump_aud_config(TRANSCODER_B);
2204 dump_aud_config(TRANSCODER_C);
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04002205
Mengdong Lindeba8682013-09-09 15:38:40 -04002206 dump_aud_misc_control(CONVERTER_1);
2207 dump_aud_misc_control(CONVERTER_2);
2208 dump_aud_misc_control(CONVERTER_3);
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04002209
Mengdong Lindeba8682013-09-09 15:38:40 -04002210 dump_aud_vendor_device_id();
2211 dump_aud_revision_id();
Wang Xingchaoc4077222012-08-15 16:13:38 +08002212
Mengdong Lindeba8682013-09-09 15:38:40 -04002213 dump_aud_m_cts_enable(TRANSCODER_A);
2214 dump_aud_m_cts_enable(TRANSCODER_B);
2215 dump_aud_m_cts_enable(TRANSCODER_C);
Wang Xingchaoc4077222012-08-15 16:13:38 +08002216
Mengdong Lindeba8682013-09-09 15:38:40 -04002217 dump_aud_power_state();
Wang Xingchaoc4077222012-08-15 16:13:38 +08002218
Mengdong Lindeba8682013-09-09 15:38:40 -04002219 dump_aud_edid_data(TRANSCODER_A);
2220 dump_aud_edid_data(TRANSCODER_B);
2221 dump_aud_edid_data(TRANSCODER_C);
Wang Xingchaoc4077222012-08-15 16:13:38 +08002222
Mengdong Lindeba8682013-09-09 15:38:40 -04002223 dump_aud_infoframe(TRANSCODER_A);
2224 dump_aud_infoframe(TRANSCODER_B);
2225 dump_aud_infoframe(TRANSCODER_C);
Wang Xingchaoc4077222012-08-15 16:13:38 +08002226
Mengdong Lindeba8682013-09-09 15:38:40 -04002227 dump_aud_pipe_conv_cfg();
Wang Xingchaoc4077222012-08-15 16:13:38 +08002228
Mengdong Lindeba8682013-09-09 15:38:40 -04002229 dump_aud_dig_cnvt(CONVERTER_1);
2230 dump_aud_dig_cnvt(CONVERTER_2);
2231 dump_aud_dig_cnvt(CONVERTER_3);
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04002232
Mengdong Lindeba8682013-09-09 15:38:40 -04002233 dump_aud_str_desc(CONVERTER_1);
2234 dump_aud_str_desc(CONVERTER_2);
2235 dump_aud_str_desc(CONVERTER_3);
Wang Xingchaoc4077222012-08-15 16:13:38 +08002236
Mengdong Lindeba8682013-09-09 15:38:40 -04002237 dump_aud_out_chan_map();
Wang Xingchaoc4077222012-08-15 16:13:38 +08002238
Mengdong Lindeba8682013-09-09 15:38:40 -04002239 dump_aud_connect_list_entry_length(TRANSCODER_A);
2240 dump_aud_connect_list_entry_length(TRANSCODER_B);
2241 dump_aud_connect_list_entry_length(TRANSCODER_C);
2242 dump_aud_connect_select_ctrl();
Wang Xingchaoc4077222012-08-15 16:13:38 +08002243
Mengdong Lindeba8682013-09-09 15:38:40 -04002244 dump_aud_dip_eld_ctrl_st(TRANSCODER_A);
2245 dump_aud_dip_eld_ctrl_st(TRANSCODER_B);
2246 dump_aud_dip_eld_ctrl_st(TRANSCODER_C);
Wang Xingchaoc4077222012-08-15 16:13:38 +08002247
Mengdong Lindeba8682013-09-09 15:38:40 -04002248 dump_aud_eld_cp_vld();
Mengdong Lin86d15e02014-03-03 13:52:06 -05002249 dump_aud_hdmi_fifo_status();
Mengdong Lin85357202013-08-13 00:21:57 -04002250
Mengdong Lin86d15e02014-03-03 13:52:06 -05002251 dword = read_aud_reg(AUD_ICS);
Mengdong Lin85357202013-08-13 00:21:57 -04002252 printf("IRV [%1lx] %s\t", BIT(dword, 1),
2253 OPNAME(immed_result_valid, BIT(dword, 1)));
2254 printf("ICB [%1lx] %s\n", BIT(dword, 1),
2255 OPNAME(immed_cmd_busy, BIT(dword, 0)));
Mengdong Linf075c3c2013-08-13 00:22:14 -04002256
Mengdong Lin86d15e02014-03-03 13:52:06 -05002257 dword = read_aud_reg(AUD_CHICKENBIT_REG);
Mengdong Linf075c3c2013-08-13 00:22:14 -04002258 printf("AUD_CHICKENBIT_REG Audio Chicken Bits: %08x\n", dword);
2259 if (IS_BROADWELL(devid))
2260 parse_bdw_audio_chicken_bit_reg(dword);
2261
Mengdong Lin86d15e02014-03-03 13:52:06 -05002262 dword = read_aud_reg(AUD_DP_DIP_STATUS);
Mengdong Lin97e5cf62013-08-13 00:22:24 -04002263 printf("AUD_DP_DIP_STATUS Audio DP & DIP FIFO Status: %08x\n\t", dword);
2264 for (i = 31; i >= 0; i--)
2265 if (BIT(dword, i))
2266 printf("%s\n\t", audio_dp_dip_status[i]);
2267 printf("\n");
Wang Xingchaoc4077222012-08-15 16:13:38 +08002268}
2269
Wu Fengguang020abdb2010-04-19 13:13:06 +08002270int main(int argc, char **argv)
2271{
2272 struct pci_device *pci_dev;
2273
2274 pci_dev = intel_get_pci_device();
2275 devid = pci_dev->device_id; /* XXX not true when mapping! */
2276
2277 do_self_tests();
2278
2279 if (argc == 2)
2280 intel_map_file(argv[1]);
2281 else
2282 intel_get_mmio(pci_dev);
2283
Mengdong Lin449509d2014-03-03 17:03:02 -05002284 if (IS_VALLEYVIEW(devid)) {
2285 printf("Valleyview audio registers:\n\n");
2286 dump_ironlake();
2287 } else if (IS_BROADWELL(devid) || IS_HASWELL(devid)) {
Mengdong Lin69cc00b2013-07-17 13:29:17 -04002288 printf("%s audio registers:\n\n",
2289 IS_BROADWELL(devid) ? "Broadwell" : "Haswell");
2290 dump_hsw_plus();
2291 } else if (IS_GEN6(devid) || IS_GEN7(devid)
2292 || getenv("HAS_PCH_SPLIT")) {
Wu Fengguang6fcb5cd2011-11-12 11:12:49 +08002293 printf("%s audio registers:\n\n",
Mengdong Lin3c7dc5c2013-09-09 15:38:32 -04002294 IS_GEN6(devid) ? "SandyBridge" : "IvyBridge");
Wu Fengguang020abdb2010-04-19 13:13:06 +08002295 intel_check_pch();
2296 dump_cpt();
Wu Fengguang6fcb5cd2011-11-12 11:12:49 +08002297 } else if (IS_GEN5(devid)) {
2298 printf("Ironlake audio registers:\n\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +08002299 dump_ironlake();
Wu Fengguang6fcb5cd2011-11-12 11:12:49 +08002300 } else if (IS_G4X(devid)) {
2301 printf("G45 audio registers:\n\n");
Wu Fengguang020abdb2010-04-19 13:13:06 +08002302 dump_eaglelake();
Wu Fengguang6fcb5cd2011-11-12 11:12:49 +08002303 }
Wu Fengguang020abdb2010-04-19 13:13:06 +08002304
2305 return 0;
Wu Fengguang9e9c9f22009-11-06 11:06:22 +08002306}