19484Sgarrett.damore@Sun.COM /* 29484Sgarrett.damore@Sun.COM * CDDL HEADER START 39484Sgarrett.damore@Sun.COM * 49484Sgarrett.damore@Sun.COM * The contents of this file are subject to the terms of the 59484Sgarrett.damore@Sun.COM * Common Development and Distribution License (the "License"). 69484Sgarrett.damore@Sun.COM * You may not use this file except in compliance with the License. 79484Sgarrett.damore@Sun.COM * 89484Sgarrett.damore@Sun.COM * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 99484Sgarrett.damore@Sun.COM * or http://www.opensolaris.org/os/licensing. 109484Sgarrett.damore@Sun.COM * See the License for the specific language governing permissions 119484Sgarrett.damore@Sun.COM * and limitations under the License. 129484Sgarrett.damore@Sun.COM * 139484Sgarrett.damore@Sun.COM * When distributing Covered Code, include this CDDL HEADER in each 149484Sgarrett.damore@Sun.COM * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 159484Sgarrett.damore@Sun.COM * If applicable, add the following below this CDDL HEADER, with the 169484Sgarrett.damore@Sun.COM * fields enclosed by brackets "[]" replaced with your own identifying 179484Sgarrett.damore@Sun.COM * information: Portions Copyright [yyyy] [name of copyright owner] 189484Sgarrett.damore@Sun.COM * 199484Sgarrett.damore@Sun.COM * CDDL HEADER END 209484Sgarrett.damore@Sun.COM */ 219484Sgarrett.damore@Sun.COM /* 22*11936Sgdamore@opensolaris.org * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 239484Sgarrett.damore@Sun.COM * Use is subject to license terms. 249484Sgarrett.damore@Sun.COM */ 259484Sgarrett.damore@Sun.COM 269484Sgarrett.damore@Sun.COM #ifndef _AUDIOTS_H 279484Sgarrett.damore@Sun.COM #define _AUDIOTS_H 289484Sgarrett.damore@Sun.COM 299484Sgarrett.damore@Sun.COM /* 309484Sgarrett.damore@Sun.COM * Header file for the audiots device driver. 319484Sgarrett.damore@Sun.COM */ 329484Sgarrett.damore@Sun.COM 339484Sgarrett.damore@Sun.COM /* 349484Sgarrett.damore@Sun.COM * Values returned by the AUDIO_GETDEV ioctl() 359484Sgarrett.damore@Sun.COM */ 369484Sgarrett.damore@Sun.COM #define TS_DEV_NAME "SUNW,audiots" 379484Sgarrett.damore@Sun.COM #define TS_DEV_CONFIG "onboard1" 389484Sgarrett.damore@Sun.COM #define TS_DEV_VERSION_A "a" /* grover, sngl strming play */ 399484Sgarrett.damore@Sun.COM #define TS_DEV_VERSION_B "b" /* birdsnest, sngl strm play */ 409484Sgarrett.damore@Sun.COM 419484Sgarrett.damore@Sun.COM /* 429484Sgarrett.damore@Sun.COM * Driver supported configuration information 439484Sgarrett.damore@Sun.COM */ 449484Sgarrett.damore@Sun.COM #define TS_NAME "audiots" 459484Sgarrett.damore@Sun.COM #define TS_MOD_NAME "audiots audio driver" 469484Sgarrett.damore@Sun.COM 479484Sgarrett.damore@Sun.COM #define TS_RATE (48000) 489484Sgarrett.damore@Sun.COM #define TS_STEREO (2) /* stereo */ 499484Sgarrett.damore@Sun.COM #define TS_FRAMESZ (4) /* 16-bit stereo */ 509484Sgarrett.damore@Sun.COM 519484Sgarrett.damore@Sun.COM /* 529484Sgarrett.damore@Sun.COM * Misc. defines 539484Sgarrett.damore@Sun.COM */ 549484Sgarrett.damore@Sun.COM #define TS_IO_MAPPED_REGS (1) 559484Sgarrett.damore@Sun.COM #define TS_MEM_MAPPED_REGS (2) 569484Sgarrett.damore@Sun.COM #define TS_ALL_DMA_ENGINES (0xffffffff) 579484Sgarrett.damore@Sun.COM #define TS_ALL_DMA_OFF (0x00000000) 589484Sgarrett.damore@Sun.COM 599484Sgarrett.damore@Sun.COM #define TS_20MS (20000) /* 20,000 microseconds */ 609484Sgarrett.damore@Sun.COM #define TS_20US (20) /* 20 microseconds */ 619484Sgarrett.damore@Sun.COM #define TS_SRC_SHIFT (12) 629484Sgarrett.damore@Sun.COM 639484Sgarrett.damore@Sun.COM #define TS_NUM_PORTS (2) 649484Sgarrett.damore@Sun.COM #define TS_OUTPUT_PORT (0) 659484Sgarrett.damore@Sun.COM #define TS_INPUT_PORT (1) 669484Sgarrett.damore@Sun.COM 679484Sgarrett.damore@Sun.COM #define TS_MAX_HW_CHANNELS (32) 689484Sgarrett.damore@Sun.COM 699484Sgarrett.damore@Sun.COM #define TS_WAIT_CNT (512) 709484Sgarrett.damore@Sun.COM #define TS_LOOP_CNT (10) 719484Sgarrett.damore@Sun.COM #define TS_DELAY_CNT (25) 729484Sgarrett.damore@Sun.COM #define TS_CODEC_REG(r) ((r) >> 1) 739484Sgarrett.damore@Sun.COM 749484Sgarrett.damore@Sun.COM /* ALI Hacks */ 759484Sgarrett.damore@Sun.COM #define TS_READ_TRIES (TS_WAIT_CNT/10) 769484Sgarrett.damore@Sun.COM #define TS_RESET_TRIES (16) 779484Sgarrett.damore@Sun.COM #define TS_SB_RESET (0x7fff) 789484Sgarrett.damore@Sun.COM 799484Sgarrett.damore@Sun.COM /* These are the devices we know about */ 809484Sgarrett.damore@Sun.COM #define TS_DEVICE_ALI_M5451 ((0x10b9 << 16) | (0x5451)) 819484Sgarrett.damore@Sun.COM #define TS_DEVICE_TRIDENT_4DWAVEDX ((0x1023 << 16) | (0x2000)) 829484Sgarrett.damore@Sun.COM #define TS_DEVICE_TRIDENT_4DWAVENX ((0x1023 << 16) | (0x2001)) 839484Sgarrett.damore@Sun.COM #define TS_DEVICE_SIS_7018 ((0x1039 << 16) | (0x7018)) 849484Sgarrett.damore@Sun.COM 859484Sgarrett.damore@Sun.COM #define TS_AD_CODEC_ID 0x4144 869484Sgarrett.damore@Sun.COM #define TS_AD_REV_ID 0x5340 879484Sgarrett.damore@Sun.COM #define AC_REV_ID1 0x0001 889484Sgarrett.damore@Sun.COM #define AC_REV_ID2 0x0002 899484Sgarrett.damore@Sun.COM 909484Sgarrett.damore@Sun.COM #define TS_CAP_PTR 0xdc 919484Sgarrett.damore@Sun.COM #define TS_PWR_D0 0x0000 929484Sgarrett.damore@Sun.COM #define TS_PWR_D1 0x0001 939484Sgarrett.damore@Sun.COM #define TS_PWR_D2 0x0002 949484Sgarrett.damore@Sun.COM #define TS_PWR_D3 0x0003 959484Sgarrett.damore@Sun.COM #define TS_PWR_PME 0x8000 969484Sgarrett.damore@Sun.COM 979484Sgarrett.damore@Sun.COM /* 989484Sgarrett.damore@Sun.COM * audiots_aram_t - ARAM registers 999484Sgarrett.damore@Sun.COM */ 1009484Sgarrett.damore@Sun.COM struct audiots_aram { 1019484Sgarrett.damore@Sun.COM uint16_t aram_alpha_fms; /* e0h - e1h */ 1029484Sgarrett.damore@Sun.COM uint16_t aram_cso; /* e2h - e3h */ 1039484Sgarrett.damore@Sun.COM uint32_t aram_cptr_lba; /* e4h - e7h */ 1049484Sgarrett.damore@Sun.COM uint16_t aram_delta; /* e8h - e9h */ 1059484Sgarrett.damore@Sun.COM uint16_t aram_eso; /* eah - ebh */ 1069484Sgarrett.damore@Sun.COM uint32_t aram_reserved; /* ech - efh */ 1079484Sgarrett.damore@Sun.COM }; 1089484Sgarrett.damore@Sun.COM typedef struct audiots_aram audiots_aram_t; 1099484Sgarrett.damore@Sun.COM 1109484Sgarrett.damore@Sun.COM /* aram_cso_alpha_fms register defines */ 1119484Sgarrett.damore@Sun.COM #define ARAM_FMS_MASK 0x000f 1129484Sgarrett.damore@Sun.COM #define ARAM_ALPHA_MASK 0xfff0 1139484Sgarrett.damore@Sun.COM 1149484Sgarrett.damore@Sun.COM /* aram_cptr_lba register defines */ 1159484Sgarrett.damore@Sun.COM #define ARAM_LBA_MASK 0x7fffffff 1169484Sgarrett.damore@Sun.COM #define ARAM_CPTR_MASK 0x80000000 1179484Sgarrett.damore@Sun.COM 1189484Sgarrett.damore@Sun.COM /* 1199484Sgarrett.damore@Sun.COM * audiots_eram_t - ERAM registers 1209484Sgarrett.damore@Sun.COM */ 1219484Sgarrett.damore@Sun.COM struct audiots_eram { 1229484Sgarrett.damore@Sun.COM uint16_t eram_ctrl_ec; /* f0h - f1h */ 1239484Sgarrett.damore@Sun.COM uint16_t eram_gvsel_pan_vol; /* f2h - f3h */ 1249484Sgarrett.damore@Sun.COM uint32_t eram_ebuf1; /* f4h - f7h */ 1259484Sgarrett.damore@Sun.COM uint32_t eram_ebuf2; /* f8h - fbh */ 1269484Sgarrett.damore@Sun.COM uint32_t eram_reserved; /* fch - ffh */ 1279484Sgarrett.damore@Sun.COM }; 1289484Sgarrett.damore@Sun.COM typedef struct audiots_eram audiots_eram_t; 1299484Sgarrett.damore@Sun.COM 1309484Sgarrett.damore@Sun.COM /* eram_ctrl_ec register defines */ 1319484Sgarrett.damore@Sun.COM #define ERAM_EC_MASK 0x0fff 1329484Sgarrett.damore@Sun.COM #define ERAM_CTRL_MASK 0xf000 1339484Sgarrett.damore@Sun.COM #define ERAM_LOOP_MODE 0x1000 1349484Sgarrett.damore@Sun.COM #define ERAM_NOLOOP_MODE 0x0000 1359484Sgarrett.damore@Sun.COM #define ERAM_SIGNED_PCM 0x2000 1369484Sgarrett.damore@Sun.COM #define ERAM_UNSIGNED_PCM 0x0000 1379484Sgarrett.damore@Sun.COM #define ERAM_STEREO 0x4000 1389484Sgarrett.damore@Sun.COM #define ERAM_MONO 0x0000 1399484Sgarrett.damore@Sun.COM #define ERAM_16_BITS 0x8000 1409484Sgarrett.damore@Sun.COM #define ERAM_8_BITS 0x0000 1419484Sgarrett.damore@Sun.COM 1429484Sgarrett.damore@Sun.COM /* eram_gvsel_pan_vol register defines */ 1439484Sgarrett.damore@Sun.COM #define ERAM_VOL_MASK 0x00ff 1449484Sgarrett.damore@Sun.COM #define ERAM_VOL_0dB 0x0000 1459484Sgarrett.damore@Sun.COM #define ERAM_VOL_DEFAULT 0x000f 1469484Sgarrett.damore@Sun.COM #define ERAM_VOL_MAX_ATTEN 0x00ff 1479484Sgarrett.damore@Sun.COM #define ERAM_PAN_MASK 0x3f00 1489484Sgarrett.damore@Sun.COM #define ERAM_PAN_0dB 0x0000 1499484Sgarrett.damore@Sun.COM #define ERAM_PAN_MAX_ATTEN 0x3f00 1509484Sgarrett.damore@Sun.COM #define ERAM_PAN_LEFT 0x0000 1519484Sgarrett.damore@Sun.COM #define ERAM_PAN_RIGHT 0x4000 1529484Sgarrett.damore@Sun.COM #define ERAM_MUSIC_VOL 0x0000 1539484Sgarrett.damore@Sun.COM #define ERAM_WAVE_VOL 0x8000 1549484Sgarrett.damore@Sun.COM 1559484Sgarrett.damore@Sun.COM /* eram_ebuf register defines */ 1569484Sgarrett.damore@Sun.COM #define ERAM_EBUF_STILL 0x30000000 1579484Sgarrett.damore@Sun.COM 1589484Sgarrett.damore@Sun.COM /* 1599484Sgarrett.damore@Sun.COM * audiots_processor_t - Audio Processor registers via I/O space 1609484Sgarrett.damore@Sun.COM * 1619484Sgarrett.damore@Sun.COM * NOTE: Soutbridge rev 1535D+ uses a read/write register at AudioBase +40 1629484Sgarrett.damore@Sun.COM * Previous SB chip revs had a seperate write register at AudioBase +40, and 1639484Sgarrett.damore@Sun.COM * a read register at AudioBase +44. 1649484Sgarrett.damore@Sun.COM * 1659484Sgarrett.damore@Sun.COM */ 1669484Sgarrett.damore@Sun.COM struct audiots_processor { 1679484Sgarrett.damore@Sun.COM uint32_t ap_dmar0_1_2_3; /* 00h - 03h */ 1689484Sgarrett.damore@Sun.COM uint32_t ap_dmar4_5_6_7; /* 04h - 07h */ 1699484Sgarrett.damore@Sun.COM uint32_t ap_dmar8_9_10_11; /* 08h - 0bh */ 1709484Sgarrett.damore@Sun.COM uint32_t ap_dmar12_13_14_15; /* 0ch - 0fh */ 1719484Sgarrett.damore@Sun.COM uint32_t ap_sbr0_1_2_3; /* 10h - 13h */ 1729484Sgarrett.damore@Sun.COM uint32_t ap_sbr4_5_6; /* 14h - 17h */ 1739484Sgarrett.damore@Sun.COM uint32_t ap_svbr7; /* 18h - 1bh */ 1749484Sgarrett.damore@Sun.COM uint32_t ap_sbr8_9_10; /* 1ch - 1fh */ 1759484Sgarrett.damore@Sun.COM uint32_t ap_mpur0_1_2_3; /* 20h - 23h */ 1769484Sgarrett.damore@Sun.COM uint32_t ap_rsvd1[3]; /* 24h - 2fh */ 1779484Sgarrett.damore@Sun.COM uint32_t ap_gamer0_1; /* 30h - 33h */ 1789484Sgarrett.damore@Sun.COM uint32_t ap_gamer2; /* 34h - 37h */ 1799484Sgarrett.damore@Sun.COM uint32_t ap_gamer3; /* 38h - 3bh */ 1809484Sgarrett.damore@Sun.COM uint32_t ap_rsvd2; /* 3ch - 3fh */ 1819484Sgarrett.damore@Sun.COM uint16_t ap_acrdwr_reg; /* 40h - 41h */ 1829484Sgarrett.damore@Sun.COM uint16_t ap_acrdwr_data; /* 42h - 43h */ 1839484Sgarrett.damore@Sun.COM uint16_t ap_acrd_35D_reg; /* 44h - 45h */ 1849484Sgarrett.damore@Sun.COM uint16_t ap_acrd_35D_data; /* 46h - 47h */ 1859484Sgarrett.damore@Sun.COM uint32_t ap_sctrl; /* 48h - 4bh */ 1869484Sgarrett.damore@Sun.COM uint32_t ap_acgpio; /* 4ch - 4fh */ 1879484Sgarrett.damore@Sun.COM uint32_t ap_asr0; /* 50h - 53h */ 1889484Sgarrett.damore@Sun.COM uint32_t ap_asr1_2; /* 54h - 57h */ 1899484Sgarrett.damore@Sun.COM uint32_t ap_asr3; /* 58h - 5bh */ 1909484Sgarrett.damore@Sun.COM uint32_t ap_asr4_5_6; /* 5ch - 5fh */ 1919484Sgarrett.damore@Sun.COM uint32_t ap_aoplsr0; /* 60h - 63h */ 1929484Sgarrett.damore@Sun.COM uint32_t ap_rsvd3[6]; /* 64h - 7bh */ 1939484Sgarrett.damore@Sun.COM uint32_t ap_gp; /* 7ch - 7fh */ 1949484Sgarrett.damore@Sun.COM uint32_t ap_start; /* 80h - 83h */ 1959484Sgarrett.damore@Sun.COM uint32_t ap_stop; /* 84h - 87h */ 1969484Sgarrett.damore@Sun.COM uint32_t ap_delay; /* 88h - 8bh */ 1979484Sgarrett.damore@Sun.COM uint32_t ap_sign_cso; /* 8ch - 8fh */ 1989484Sgarrett.damore@Sun.COM uint32_t ap_cspf; /* 90h - 93h */ 1999484Sgarrett.damore@Sun.COM uint32_t ap_cebc; /* 94h - 97h */ 2009484Sgarrett.damore@Sun.COM uint32_t ap_aint; /* 98h - 9bh */ 2019484Sgarrett.damore@Sun.COM uint32_t ap_eint; /* 9ch - 9fh */ 2029484Sgarrett.damore@Sun.COM uint32_t ap_cir_gc; /* a0h - a3h */ 2039484Sgarrett.damore@Sun.COM uint32_t ap_ainten; /* a4h - a7h */ 2049484Sgarrett.damore@Sun.COM uint32_t ap_volume; /* a8h - abh */ 2059484Sgarrett.damore@Sun.COM uint32_t ap_sbdelta; /* ach - afh */ 2069484Sgarrett.damore@Sun.COM uint32_t ap_miscint; /* b0h - b3h */ 2079484Sgarrett.damore@Sun.COM uint32_t ap_rsvd4[3]; /* b4h - bfh */ 2089484Sgarrett.damore@Sun.COM uint32_t ap_sbdm; /* c0h - c3h */ 2099484Sgarrett.damore@Sun.COM uint32_t ap_sb; /* c4h - c7h */ 2109484Sgarrett.damore@Sun.COM uint32_t ap_stimer; /* c8h - cbh */ 2119484Sgarrett.damore@Sun.COM uint32_t ap_lfo_i2s_delta; /* cch - cfh */ 2129484Sgarrett.damore@Sun.COM uint32_t ap_st_target; /* d0h - d3h */ 2139484Sgarrett.damore@Sun.COM uint32_t ap_global_control; /* d4h - d7h */ 2149484Sgarrett.damore@Sun.COM uint32_t ap_rsvd5[2]; /* d8h - dfh */ 2159484Sgarrett.damore@Sun.COM audiots_aram_t ap_aram; /* e0h - efh */ 2169484Sgarrett.damore@Sun.COM audiots_eram_t ap_eram; /* f0h - ffh */ 2179484Sgarrett.damore@Sun.COM }; 2189484Sgarrett.damore@Sun.COM typedef struct audiots_processor audiots_processor_t; 2199484Sgarrett.damore@Sun.COM 2209484Sgarrett.damore@Sun.COM /* ap_acwr_reg register defines (40h - 41h) */ 2219484Sgarrett.damore@Sun.COM #define AP_ACWR_INDEX_MASK 0x007f 2229484Sgarrett.damore@Sun.COM #define AP_ACWR_W_PRIMARY_CODEC 0x0000 2239484Sgarrett.damore@Sun.COM #define AP_ACWR_W_SECONDARY_CODEC 0x0080 2249484Sgarrett.damore@Sun.COM #define AP_ACWR_W_WRITE_MIXER_REG 0x8000 2259484Sgarrett.damore@Sun.COM #define AP_ACWR_W_SELECT_WRITE 0x0100 2269484Sgarrett.damore@Sun.COM #define AP_ACWR_R_PRIMARY_CODEC 0x0000 2279484Sgarrett.damore@Sun.COM #define AP_ACWR_R_SECONDARY_CODEC 0x0080 2289484Sgarrett.damore@Sun.COM #define AP_ACWR_R_WRITE_BUSY 0x8000 2299484Sgarrett.damore@Sun.COM 2309484Sgarrett.damore@Sun.COM /* ap_acrd_reg register defines (44h - 45h) */ 2319484Sgarrett.damore@Sun.COM #define AP_ACRD_INDEX_MASK 0x007f 2329484Sgarrett.damore@Sun.COM #define AP_ACRD_W_PRIMARY_CODEC 0x0000 2339484Sgarrett.damore@Sun.COM #define AP_ACRD_W_SECONDARY_CODEC 0x0080 2349484Sgarrett.damore@Sun.COM #define AP_ACRD_W_MODEM_READ_REQ 0x2000 2359484Sgarrett.damore@Sun.COM #define AP_ACRD_W_AUDIO_READ_REQ 0x4000 2369484Sgarrett.damore@Sun.COM #define AP_ACRD_W_READ_MIXER_REG 0x8000 2379484Sgarrett.damore@Sun.COM #define AP_ACRD_R_PRIMARY_CODEC 0x0000 2389484Sgarrett.damore@Sun.COM #define AP_ACRD_R_SECONDARY_CODEC 0x0080 2399484Sgarrett.damore@Sun.COM #define AP_ACRD_R_MODEM_READ_REQ 0x2000 2409484Sgarrett.damore@Sun.COM #define AP_ACRD_R_AUDIO_READ_REQ 0x4000 2419484Sgarrett.damore@Sun.COM #define AP_ACRD_R_READ_BUSY 0x8000 2429484Sgarrett.damore@Sun.COM 2439484Sgarrett.damore@Sun.COM /* ap_sctrl register defines (48h - 4bh) */ 2449484Sgarrett.damore@Sun.COM #define AP_SCTRL_WRST_CODEC 0x00000001 2459484Sgarrett.damore@Sun.COM #define AP_SCTRL_CRST_CODEC 0x00000002 2469484Sgarrett.damore@Sun.COM #define AP_SCTRL_12288K_CLOCK 0x00000000 2479484Sgarrett.damore@Sun.COM #define AP_SCTRL_6144K_CLOCK 0x00000004 2489484Sgarrett.damore@Sun.COM #define AP_SCTRL_PCM_TO_PRIMARY 0x00000000 2499484Sgarrett.damore@Sun.COM #define AP_SCTRL_PCM_TO_SECONDARY 0x00000008 2509484Sgarrett.damore@Sun.COM #define AP_SCTRL_DOUPLE_RATE_DISABLE 0x00000000 2519484Sgarrett.damore@Sun.COM #define AP_SCTRL_DOUPLE_RATE_ENABLE 0x00000010 2529484Sgarrett.damore@Sun.COM #define AP_SCTRL_I2S_DISABLE 0x00000000 2539484Sgarrett.damore@Sun.COM #define AP_SCTRL_I2S_ENABLE 0x00000080 2549484Sgarrett.damore@Sun.COM #define AP_SCTRL_PCMIN_SEL_PRIMARY_CODEC 0x00000000 2559484Sgarrett.damore@Sun.COM #define AP_SCTRL_PCMIN_SEL_SECONDARY_CODEC 0x00000100 2569484Sgarrett.damore@Sun.COM #define AP_SCTRL_LINE1IN_SEL_PRIMARY_CODEC 0x00000000 2579484Sgarrett.damore@Sun.COM #define AP_SCTRL_LINE1IN_SEL_SECONDARY_CODEC 0x00000200 2589484Sgarrett.damore@Sun.COM #define AP_SCTRL_MICIN_SEL_PRIMARY_CODEC 0x00000000 2599484Sgarrett.damore@Sun.COM #define AP_SCTRL_MICIN_SEL_SECONDARY_CODEC 0x00000400 2609484Sgarrett.damore@Sun.COM #define AP_SCTRL_LINE2IN_SEL_PRIMARY_CODEC 0x00000000 2619484Sgarrett.damore@Sun.COM #define AP_SCTRL_LINE2IN_SEL_SECONDARY_CODEC 0x00000800 2629484Sgarrett.damore@Sun.COM #define AP_SCTRL_HSETIN_SEL_PRIMARY_CODEC 0x00000000 2639484Sgarrett.damore@Sun.COM #define AP_SCTRL_HSETIN_SEL_SECONDARY_CODEC 0x00001000 2649484Sgarrett.damore@Sun.COM #define AP_SCTRL_GPIOIN_SEL_PRIMARY_CODEC 0x00000000 2659484Sgarrett.damore@Sun.COM #define AP_SCTRL_GPIOIN_SEL_SECONDARY_CODEC 0x00002000 2669484Sgarrett.damore@Sun.COM #define AP_SCTRL_SECONDARY_CODEC_MASK 0x0000c000 2679484Sgarrett.damore@Sun.COM #define AP_SCTRL_SECONDARY_CODEC_DEFAULT 0x00004000 2689484Sgarrett.damore@Sun.COM #define AP_SCTRL_PCMOUT_EN 0x00010000 2699484Sgarrett.damore@Sun.COM #define AP_SCTRL_SURROUT_EN 0x00020000 2709484Sgarrett.damore@Sun.COM #define AP_SCTRL_CENTEROUT_EN 0x00040000 2719484Sgarrett.damore@Sun.COM #define AP_SCTRL_LFEOUT_EN 0x00080000 2729484Sgarrett.damore@Sun.COM #define AP_SCTRL_LINE1OUT_EN 0x00100000 2739484Sgarrett.damore@Sun.COM #define AP_SCTRL_LINE2OUT_EN 0x00200000 2749484Sgarrett.damore@Sun.COM #define AP_SCTRL_HSETOUT_EN 0x00400000 2759484Sgarrett.damore@Sun.COM #define AP_SCTRL_GPIOOUT_EN 0x00800000 2769484Sgarrett.damore@Sun.COM #define AP_SCTRL_CODECA_RDY 0x01000000 /* primary */ 2779484Sgarrett.damore@Sun.COM #define AP_SCTRL_CODECB_RDY 0x02000000 /* secondary */ 2789484Sgarrett.damore@Sun.COM #define AP_SCTRL_CODEC_PD 0x04000000 2799484Sgarrett.damore@Sun.COM 2809484Sgarrett.damore@Sun.COM /* ap_acgpio resister defines (4ch - 4fh) */ 2819484Sgarrett.damore@Sun.COM #define AP_ACGPIO_IRQ1 0x00000002 /* primary */ 2829484Sgarrett.damore@Sun.COM #define AP_ACGPIO_IRQ2 0x00000004 /* secondary */ 2839484Sgarrett.damore@Sun.COM #define AP_ACGPIO_INT1_ENABLE 0x00000008 2849484Sgarrett.damore@Sun.COM #define AP_ACGPIO_INT1_DISABLE 0x00000000 2859484Sgarrett.damore@Sun.COM #define AP_ACGPIO_INT2_ENABLE 0x00000010 2869484Sgarrett.damore@Sun.COM #define AP_ACGPIO_INT2_DISABLE 0x00000000 2879484Sgarrett.damore@Sun.COM #define AP_ACGPIO_WRITE_SLOT_12 0x00008000 2889484Sgarrett.damore@Sun.COM #define AP_ACGPIO_R_SLOT_12_BUSY 0x00008000 2899484Sgarrett.damore@Sun.COM #define AP_ACGPIO_DATA_MASK 0xffff0000 2909484Sgarrett.damore@Sun.COM 2919484Sgarrett.damore@Sun.COM /* ap_asr0 resgister defines (50h - 53h) */ 2929484Sgarrett.damore@Sun.COM #define AP_ASR0_CODEC_READY 0x00008000 2939484Sgarrett.damore@Sun.COM 2949484Sgarrett.damore@Sun.COM /* ap_asr4_5_6 register defines (5ch - 5fh) */ 2959484Sgarrett.damore@Sun.COM #define AP_ASR4_REV_A 0x00000080 2969484Sgarrett.damore@Sun.COM #define AP_ASR4_REV_BC 0x00000049 2979484Sgarrett.damore@Sun.COM #define AP_ASR5_ESP_VERSION 0x00040000 2989484Sgarrett.damore@Sun.COM #define AP_ASR6_ESP_VERSION 0x02000000 2999484Sgarrett.damore@Sun.COM 3009484Sgarrett.damore@Sun.COM /* ap_ain register defines (98h - 9bh) */ 3019484Sgarrett.damore@Sun.COM #define AP_AIN_RESET_ALL 0xffffffff 3029484Sgarrett.damore@Sun.COM 3039484Sgarrett.damore@Sun.COM /* ap_eain register defines (9ch - 9fh) */ 3049484Sgarrett.damore@Sun.COM #define AP_EAIN_RESET_ALL 0xffffffff 3059484Sgarrett.damore@Sun.COM 3069484Sgarrett.damore@Sun.COM /* ap_cir_gc register defines (a0h - a3h) */ 3079484Sgarrett.damore@Sun.COM #define AP_CIR_GC_CHANNEL_INDEX_MASK 0x0000001f 3089484Sgarrett.damore@Sun.COM #define AP_CIR_GC_RST_STIMER 0x00000100 3099484Sgarrett.damore@Sun.COM #define AP_CIR_GC_PAUSE 0x00000200 3109484Sgarrett.damore@Sun.COM #define AP_CIR_GC_OVERUN_IE 0x00000400 3119484Sgarrett.damore@Sun.COM #define AP_CIR_GC_UNDERUN_IE 0x00000800 3129484Sgarrett.damore@Sun.COM #define AP_CIR_GC_ENDLP_IE 0x00001000 3139484Sgarrett.damore@Sun.COM #define AP_CIR_GC_MIDLP_IE 0x00002000 3149484Sgarrett.damore@Sun.COM #define AP_CIR_GC_ETOG_IE 0x00004000 3159484Sgarrett.damore@Sun.COM #define AP_CIR_GC_EDROP_IE 0x00008000 3169484Sgarrett.damore@Sun.COM #define AP_CIR_GC_SYS_MEM_4G_ENABLE 0x00010000 3179484Sgarrett.damore@Sun.COM #define AP_CIR_GC_PCM_FIFO 0x00000000 3189484Sgarrett.damore@Sun.COM #define AP_CIR_GC_MMC_BUFFER 0x00100000 3199484Sgarrett.damore@Sun.COM #define AP_CIR_GC_NORMAL_MODE 0x00000000 3209484Sgarrett.damore@Sun.COM #define AP_CIR_GC_EXPROM_DUMP_MODE_ENABLE 0x00800000 3219484Sgarrett.damore@Sun.COM #define AP_CIR_GC_EXPROM_DEBUG_MODE 0x04000000 3229484Sgarrett.damore@Sun.COM #define AP_CIR_GC_TEST_LOOPBACK_ON 0x08000000 3239484Sgarrett.damore@Sun.COM 3249484Sgarrett.damore@Sun.COM /* ap_ainten register defines (a4h - a7h) */ 3259484Sgarrett.damore@Sun.COM #define AP_AINTEN_DISABLE_ALL 0x00000000 3269484Sgarrett.damore@Sun.COM 3279484Sgarrett.damore@Sun.COM /* ap_volume regsiter defines (a8h - abh) */ 3289484Sgarrett.damore@Sun.COM #define AP_VOLUME_WAVE_LEFT_MASK 0x000000ff 3299484Sgarrett.damore@Sun.COM #define AP_VOLUME_WAVE_LEFT_MUTE 0x000000ff 3309484Sgarrett.damore@Sun.COM #define AP_VOLUME_WAVE_LEFT_FULL 0x00000000 3319484Sgarrett.damore@Sun.COM #define AP_VOLUME_WAVE_LEFT_SHIFT 0 3329484Sgarrett.damore@Sun.COM #define AP_VOLUME_WAVE_RIGHT_MASK 0x0000ff00 3339484Sgarrett.damore@Sun.COM #define AP_VOLUME_WAVE_RIGHT_MUTE 0x0000ff00 3349484Sgarrett.damore@Sun.COM #define AP_VOLUME_WAVE_RIGHT_FULL 0x00000000 3359484Sgarrett.damore@Sun.COM #define AP_VOLUME_WAVE_RIGHT_SHIFT 8 3369484Sgarrett.damore@Sun.COM #define AP_VOLUME_MUSIC_LEFT_MASK 0x00ff0000 3379484Sgarrett.damore@Sun.COM #define AP_VOLUME_MUSIC_LEFT_MUTE 0x00ff0000 3389484Sgarrett.damore@Sun.COM #define AP_VOLUME_MUSIC_LEFT_FULL 0x00000000 3399484Sgarrett.damore@Sun.COM #define AP_VOLUME_MUSIC_LEFT_SHIFT 16 3409484Sgarrett.damore@Sun.COM #define AP_VOLUME_MUSIC_RIGHT_MASK 0xff000000 3419484Sgarrett.damore@Sun.COM #define AP_VOLUME_MUSIC_RIGHT_MUTE 0xff000000 3429484Sgarrett.damore@Sun.COM #define AP_VOLUME_MUSIC_RIGHT_FULL 0x00000000 3439484Sgarrett.damore@Sun.COM #define AP_VOLUME_MUSIC_RIGHT_SHIFT 24 3449484Sgarrett.damore@Sun.COM 3459484Sgarrett.damore@Sun.COM /* ap_miscint register defines (b0h - b3h) */ 3469484Sgarrett.damore@Sun.COM #define AP_MISCINT_PB_UNDERUN_IRQ 0x00000001 3479484Sgarrett.damore@Sun.COM #define AP_MISCINT_REC_OVERRUN_IRQ 0x00000002 3489484Sgarrett.damore@Sun.COM #define AP_MISCINT_SB_IRQ 0x00000004 3499484Sgarrett.damore@Sun.COM #define AP_MISCINT_MPU401_IRQ 0x00000008 3509484Sgarrett.damore@Sun.COM #define AP_MISCINT_OPL3_IRQ 0x00000010 3519484Sgarrett.damore@Sun.COM #define AP_MISCINT_ADDRESS_IRQ 0x00000020 3529484Sgarrett.damore@Sun.COM #define AP_MISCINT_ENVELOPE_IRQ 0x00000040 3539484Sgarrett.damore@Sun.COM #define AP_MISCINT_ST_IRQ 0x00000080 3549484Sgarrett.damore@Sun.COM #define AP_MISCINT_PB_UNDERUN 0x00000100 3559484Sgarrett.damore@Sun.COM #define AP_MISCINT_REC_OVERUN 0x00000200 3569484Sgarrett.damore@Sun.COM #define AP_MISCINT_MIXER_UNDERFLOW_FLAG 0x00000400 3579484Sgarrett.damore@Sun.COM #define AP_MISCINT_MIXER_OVERFLOW_FLAG 0x00000800 3589484Sgarrett.damore@Sun.COM #define AP_MISCINT_ST_TARGET_REACHED 0x00008000 3599484Sgarrett.damore@Sun.COM #define AP_MISCINT_PB_24K_MODE 0x00010000 3609484Sgarrett.damore@Sun.COM #define AP_MISCINT_OPLTIMER_IE 0x00020000 3619484Sgarrett.damore@Sun.COM #define AP_MISCINT_GPIO_IE 0x00040000 3629484Sgarrett.damore@Sun.COM #define AP_MISCINT_ST_IRQ_EN 0x00800000 3639484Sgarrett.damore@Sun.COM #define AP_MISCINT_ACGPIO_IRQ 0x01000000 3649484Sgarrett.damore@Sun.COM #define AP_MISCINT_GPIO_IRQ 0x02000000 3659484Sgarrett.damore@Sun.COM 3669484Sgarrett.damore@Sun.COM /* ap_lfo_i2s_delta register defines (cch - cfh) */ 3679484Sgarrett.damore@Sun.COM #define AP_I2S_DELTA_MASK 0x00001fff 3689484Sgarrett.damore@Sun.COM #define AP_LFO_INIT_MASK 0x00ff0000 3699484Sgarrett.damore@Sun.COM #define AP_LFO_48KHZ 0x00000000 3709484Sgarrett.damore@Sun.COM #define AP_LFO_48KHZ_BY_4 0x01000000 3719484Sgarrett.damore@Sun.COM #define AP_LFO_48KHZ_BY_16 0x02000000 3729484Sgarrett.damore@Sun.COM #define AP_LFO_48KHZ_BY_64 0x03000000 3739484Sgarrett.damore@Sun.COM #define AP_LFO_ENABLE 0x04000000 3749484Sgarrett.damore@Sun.COM 3759484Sgarrett.damore@Sun.COM /* ap_global_control register defines (d4h - d7h) */ 3769484Sgarrett.damore@Sun.COM #define AP_GLOBAL_CTRL_ENABLE_HW_VOLUME 0x00000001 3779484Sgarrett.damore@Sun.COM #define AP_CLOGAL_CTRL_PCM_OUT_AC97 0x00000000 3789484Sgarrett.damore@Sun.COM #define AP_CLOGAL_CTRL_PCM_OUT_I2S 0x00000080 3799484Sgarrett.damore@Sun.COM #define AP_CLOGAL_CTRL_I2SIN_TO_SYS_MEMORY 0x00000000 3809484Sgarrett.damore@Sun.COM #define AP_CLOGAL_CTRL_I2SIN_TO_AC97 0x00001000 3819484Sgarrett.damore@Sun.COM #define AP_CLOGAL_CTRL_I2SIN_TO_SYS_MEMORY_AC97 0x00002000 3829484Sgarrett.damore@Sun.COM #define AP_CLOGAL_CTRL_MMC_FROM_MIXER 0x00000000 3839484Sgarrett.damore@Sun.COM #define AP_CLOGAL_CTRL_MMC_FROM_PCM_OUT 0x00004000 3849484Sgarrett.damore@Sun.COM #define AP_CLOGAL_CTRL_PCM_OUT_TO_AC97 0x00000000 3859484Sgarrett.damore@Sun.COM #define AP_CLOGAL_CTRL_PCM_OUT_TO_I2S 0x00008000 3869484Sgarrett.damore@Sun.COM #define AP_CLOGAL_CTRL_E_HSETOUT_CH16 0x00010000 3879484Sgarrett.damore@Sun.COM #define AP_CLOGAL_CTRL_E_HSETIN_CH17 0x00020000 3889484Sgarrett.damore@Sun.COM #define AP_CLOGAL_CTRL_E_LINE2OUT_CH18 0x00040000 3899484Sgarrett.damore@Sun.COM #define AP_CLOGAL_CTRL_E_LINE2IN_CH19 0x00080000 3909484Sgarrett.damore@Sun.COM #define AP_CLOGAL_CTRL_E_LINE1OUT_CH20 0x00100000 3919484Sgarrett.damore@Sun.COM #define AP_CLOGAL_CTRL_E_LINE1IN_CH21 0x00200000 3929484Sgarrett.damore@Sun.COM #define AP_CLOGAL_CTRL_E_MIC_CH22 0x00400000 3939484Sgarrett.damore@Sun.COM #define AP_CLOGAL_CTRL_E_LFE_CH23 0x00800000 3949484Sgarrett.damore@Sun.COM #define AP_CLOGAL_CTRL_E_CENTER_CH24 0x01000000 3959484Sgarrett.damore@Sun.COM #define AP_CLOGAL_CTRL_E_SURR_R_CH25 0x02000000 3969484Sgarrett.damore@Sun.COM #define AP_CLOGAL_CTRL_E_SURR_L_CH26 0x04000000 3979484Sgarrett.damore@Sun.COM #define AP_CLOGAL_CTRL_E_PCMOUT_R_CH27 0x08000000 3989484Sgarrett.damore@Sun.COM #define AP_CLOGAL_CTRL_E_PCMOUT_L_CH28 0x10000000 3999484Sgarrett.damore@Sun.COM #define AP_CLOGAL_CTRL_E_I2SIN_CH29 0x20000000 4009484Sgarrett.damore@Sun.COM #define AP_CLOGAL_CTRL_E_MMC_CH30 0x40000000 4019484Sgarrett.damore@Sun.COM #define AP_CLOGAL_CTRL_E_PCMIN_CH31 0x80000000 4029484Sgarrett.damore@Sun.COM 4039484Sgarrett.damore@Sun.COM /* 4049484Sgarrett.damore@Sun.COM * audiots_regs_t - Audio processor registers via memory space. 4059484Sgarrett.damore@Sun.COM */ 4069484Sgarrett.damore@Sun.COM struct audiots_regs { 4079484Sgarrett.damore@Sun.COM audiots_processor_t aud_regs; 4089484Sgarrett.damore@Sun.COM uint32_t aud_rsvd1[64]; 4099484Sgarrett.damore@Sun.COM uint32_t aud_oplram[128]; 4109484Sgarrett.damore@Sun.COM uint32_t aud_rsvd2[256]; 4119484Sgarrett.damore@Sun.COM struct { 4129484Sgarrett.damore@Sun.COM audiots_aram_t aram; 4139484Sgarrett.damore@Sun.COM audiots_eram_t eram; 4149484Sgarrett.damore@Sun.COM } aud_ram[TS_MAX_HW_CHANNELS]; /* 32 channels */ 4159484Sgarrett.damore@Sun.COM struct { 4169484Sgarrett.damore@Sun.COM audiots_aram_t aram; 4179484Sgarrett.damore@Sun.COM audiots_eram_t eram; 4189484Sgarrett.damore@Sun.COM } aud_rsvd3[TS_MAX_HW_CHANNELS]; /* another 32 chs not implemented */ 4199484Sgarrett.damore@Sun.COM }; 4209484Sgarrett.damore@Sun.COM typedef struct audiots_regs audiots_regs_t; 4219484Sgarrett.damore@Sun.COM 4229484Sgarrett.damore@Sun.COM /* 4239484Sgarrett.damore@Sun.COM * audiots_save_regs_t - Saved audio controller registers. 4249484Sgarrett.damore@Sun.COM */ 4259484Sgarrett.damore@Sun.COM 4269484Sgarrett.damore@Sun.COM struct audiots_port { 4279484Sgarrett.damore@Sun.COM struct audiots_state *tp_state; 4289484Sgarrett.damore@Sun.COM int tp_num; 4299484Sgarrett.damore@Sun.COM int tp_dma_stream; 4309484Sgarrett.damore@Sun.COM 4319484Sgarrett.damore@Sun.COM uint32_t tp_dma_mask; 4329484Sgarrett.damore@Sun.COM 4339484Sgarrett.damore@Sun.COM boolean_t tp_started; 4349484Sgarrett.damore@Sun.COM unsigned tp_nframes; 4359484Sgarrett.damore@Sun.COM unsigned tp_rate; 4369484Sgarrett.damore@Sun.COM uint64_t tp_count; 4379484Sgarrett.damore@Sun.COM size_t tp_size; 4389484Sgarrett.damore@Sun.COM caddr_t tp_kaddr; 4399484Sgarrett.damore@Sun.COM uint32_t tp_paddr; 4409484Sgarrett.damore@Sun.COM ddi_dma_handle_t tp_dmah; 4419484Sgarrett.damore@Sun.COM ddi_acc_handle_t tp_acch; 4429484Sgarrett.damore@Sun.COM unsigned tp_sync_dir; 4439484Sgarrett.damore@Sun.COM 4449484Sgarrett.damore@Sun.COM audio_engine_t *tp_engine; 4459484Sgarrett.damore@Sun.COM /* counting cso */ 4469484Sgarrett.damore@Sun.COM uint16_t tp_cso; 4479484Sgarrett.damore@Sun.COM }; 4489484Sgarrett.damore@Sun.COM typedef struct audiots_port audiots_port_t; 4499484Sgarrett.damore@Sun.COM 4509484Sgarrett.damore@Sun.COM /* 4519484Sgarrett.damore@Sun.COM * audiots_state_t - per instance state and operation data 4529484Sgarrett.damore@Sun.COM */ 4539484Sgarrett.damore@Sun.COM struct audiots_state { 4549484Sgarrett.damore@Sun.COM uint_t ts_flags; /* flags */ 4559484Sgarrett.damore@Sun.COM dev_info_t *ts_dip; /* used by ts_getinfo() */ 4569484Sgarrett.damore@Sun.COM audio_dev_t *ts_adev; /* audio device handle */ 4579484Sgarrett.damore@Sun.COM ac97_t *ts_ac97; /* ac97 common handle */ 4589484Sgarrett.damore@Sun.COM audiots_regs_t *ts_regs; /* memory mapped registers */ 4599484Sgarrett.damore@Sun.COM audiots_port_t *ts_ports[TS_NUM_PORTS]; 4609484Sgarrett.damore@Sun.COM /* hardware engines */ 4619484Sgarrett.damore@Sun.COM 4629484Sgarrett.damore@Sun.COM ddi_acc_handle_t ts_pcih; /* handle to config regs */ 4639484Sgarrett.damore@Sun.COM ddi_acc_handle_t ts_acch; /* handle to mapped regs */ 4649484Sgarrett.damore@Sun.COM 4659484Sgarrett.damore@Sun.COM uint32_t ts_devid; 4669484Sgarrett.damore@Sun.COM uint8_t ts_revid; /* SB Chip Revision ID */ 4679484Sgarrett.damore@Sun.COM 4689484Sgarrett.damore@Sun.COM }; 4699484Sgarrett.damore@Sun.COM typedef struct audiots_state audiots_state_t; 4709484Sgarrett.damore@Sun.COM 4719484Sgarrett.damore@Sun.COM /* audiots_state.ts_flags defines */ 4729484Sgarrett.damore@Sun.COM #define TS_AUDIO_READ_FAILED 0x0020u /* reading the AC97 register */ 4739484Sgarrett.damore@Sun.COM /* has stopped working */ 4749484Sgarrett.damore@Sun.COM #define TS_READ_FAILURE_PRINTED 0x0040u /* Flag to avoid flooding the */ 4759484Sgarrett.damore@Sun.COM /* console with AC97 failure */ 4769484Sgarrett.damore@Sun.COM /* messages */ 4779484Sgarrett.damore@Sun.COM 4789484Sgarrett.damore@Sun.COM /* 4799484Sgarrett.damore@Sun.COM * Read and write the AC-97 Codec's registers 4809484Sgarrett.damore@Sun.COM */ 4819484Sgarrett.damore@Sun.COM #define AC97_RETRIES 1000 4829484Sgarrett.damore@Sun.COM #define AC97_WAIT 1 4839484Sgarrett.damore@Sun.COM 4849484Sgarrett.damore@Sun.COM /* 4859484Sgarrett.damore@Sun.COM * Useful bit twiddlers 4869484Sgarrett.damore@Sun.COM */ 4879484Sgarrett.damore@Sun.COM #define OR_SET_BYTE(handle, addr, val) \ 4889484Sgarrett.damore@Sun.COM ddi_put8((handle), (uint8_t *)(addr), \ 4899484Sgarrett.damore@Sun.COM (ddi_get8((handle), (uint8_t *)(addr)) | (uint8_t)(val))); 4909484Sgarrett.damore@Sun.COM 4919484Sgarrett.damore@Sun.COM #define OR_SET_SHORT(handle, addr, val) \ 4929484Sgarrett.damore@Sun.COM ddi_put16((handle), (uint16_t *)(addr), \ 4939484Sgarrett.damore@Sun.COM (ddi_get16((handle), (uint16_t *)(addr)) | (uint16_t)(val))); 4949484Sgarrett.damore@Sun.COM 4959484Sgarrett.damore@Sun.COM #define OR_SET_WORD(handle, addr, val) \ 4969484Sgarrett.damore@Sun.COM ddi_put32((handle), (uint32_t *)(addr), \ 4979484Sgarrett.damore@Sun.COM (ddi_get32((handle), (uint32_t *)(addr)) | (uint32_t)(val))); 4989484Sgarrett.damore@Sun.COM 4999484Sgarrett.damore@Sun.COM #define AND_SET_BYTE(handle, addr, val) \ 5009484Sgarrett.damore@Sun.COM ddi_put8((handle), (uint8_t *)(addr), \ 5019484Sgarrett.damore@Sun.COM (ddi_get8((handle), (uint8_t *)(addr)) & (uint8_t)(val))); 5029484Sgarrett.damore@Sun.COM 5039484Sgarrett.damore@Sun.COM #define AND_SET_SHORT(handle, addr, val) \ 5049484Sgarrett.damore@Sun.COM ddi_put16((handle), (uint16_t *)(addr), \ 5059484Sgarrett.damore@Sun.COM (ddi_get16((handle), (uint16_t *)(addr)) & (uint16_t)(val))); 5069484Sgarrett.damore@Sun.COM 5079484Sgarrett.damore@Sun.COM #define AND_SET_WORD(handle, addr, val) \ 5089484Sgarrett.damore@Sun.COM ddi_put32((handle), (uint32_t *)(addr), \ 5099484Sgarrett.damore@Sun.COM (ddi_get32((handle), (uint32_t *)(addr)) & (uint32_t)(val))); 5109484Sgarrett.damore@Sun.COM 5119484Sgarrett.damore@Sun.COM #endif /* _AUDIOTS_H */ 512