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 _AUDIO_4231_H 279484Sgarrett.damore@Sun.COM #define _AUDIO_4231_H 289484Sgarrett.damore@Sun.COM 299484Sgarrett.damore@Sun.COM #ifdef __cplusplus 309484Sgarrett.damore@Sun.COM extern "C" { 319484Sgarrett.damore@Sun.COM #endif 329484Sgarrett.damore@Sun.COM 339484Sgarrett.damore@Sun.COM /* 349484Sgarrett.damore@Sun.COM * Header file for the audiocs device driver. 359484Sgarrett.damore@Sun.COM */ 369484Sgarrett.damore@Sun.COM 379484Sgarrett.damore@Sun.COM /* 389484Sgarrett.damore@Sun.COM * Values returned by the AUDIO_GETDEV ioctl() 399484Sgarrett.damore@Sun.COM */ 409484Sgarrett.damore@Sun.COM #define CS_DEV_NAME "SUNW,CS4231" 419484Sgarrett.damore@Sun.COM #define CS_DEV_CONFIG_ONBRD1 "onboard1" 429484Sgarrett.damore@Sun.COM #define CS_DEV_VERSION "a" /* SS5 */ 439484Sgarrett.damore@Sun.COM #define CS_DEV_VERSION_A CS_DEV_VERSION 449484Sgarrett.damore@Sun.COM #define CS_DEV_VERSION_B "b" /* Electron - internal loopback */ 459484Sgarrett.damore@Sun.COM #define CS_DEV_VERSION_C "c" /* Positron */ 469484Sgarrett.damore@Sun.COM #define CS_DEV_VERSION_D "d" /* PowerPC - Retired */ 479484Sgarrett.damore@Sun.COM #define CS_DEV_VERSION_E "e" /* x86 - Retired */ 489484Sgarrett.damore@Sun.COM #define CS_DEV_VERSION_F "f" /* Tazmo */ 499484Sgarrett.damore@Sun.COM #define CS_DEV_VERSION_G "g" /* Quark Audio Module */ 509484Sgarrett.damore@Sun.COM #define CS_DEV_VERSION_H "h" /* Darwin */ 519484Sgarrett.damore@Sun.COM 529484Sgarrett.damore@Sun.COM /* 539484Sgarrett.damore@Sun.COM * Driver supported configuration information 549484Sgarrett.damore@Sun.COM */ 559484Sgarrett.damore@Sun.COM #define CS4231_NAME "audiocs" 569484Sgarrett.damore@Sun.COM #define CS4231_MOD_NAME "CS4231 audio driver" 579484Sgarrett.damore@Sun.COM 589484Sgarrett.damore@Sun.COM /* 599484Sgarrett.damore@Sun.COM * Implementation specific header file for the audiocs device driver. 609484Sgarrett.damore@Sun.COM */ 619484Sgarrett.damore@Sun.COM 629484Sgarrett.damore@Sun.COM #ifdef _KERNEL 639484Sgarrett.damore@Sun.COM 649484Sgarrett.damore@Sun.COM enum { 659484Sgarrett.damore@Sun.COM CTL_VOLUME = 0, 669484Sgarrett.damore@Sun.COM CTL_IGAIN, 679484Sgarrett.damore@Sun.COM CTL_MGAIN, 689484Sgarrett.damore@Sun.COM CTL_INPUTS, 699484Sgarrett.damore@Sun.COM CTL_OUTPUTS, 709484Sgarrett.damore@Sun.COM CTL_MICBOOST, 719484Sgarrett.damore@Sun.COM CTL_NUM 729484Sgarrett.damore@Sun.COM }; 739484Sgarrett.damore@Sun.COM 749484Sgarrett.damore@Sun.COM typedef struct CS_engine CS_engine_t; 759484Sgarrett.damore@Sun.COM typedef struct CS_ctrl CS_ctrl_t; 769484Sgarrett.damore@Sun.COM typedef struct CS_state CS_state_t; 779484Sgarrett.damore@Sun.COM 789484Sgarrett.damore@Sun.COM /* 799484Sgarrett.damore@Sun.COM * These are the registers for the APC DMA channel interface to the 809484Sgarrett.damore@Sun.COM * 4231. One handle provides access the CODEC and the DMA engine's 819484Sgarrett.damore@Sun.COM * registers. 829484Sgarrett.damore@Sun.COM */ 839484Sgarrett.damore@Sun.COM 849484Sgarrett.damore@Sun.COM struct cs4231_apc { 859484Sgarrett.damore@Sun.COM uint32_t dmacsr; /* APC CSR */ 869484Sgarrett.damore@Sun.COM uint32_t lpad[3]; /* PAD */ 879484Sgarrett.damore@Sun.COM uint32_t dmacva; /* Capture Virtual Address */ 889484Sgarrett.damore@Sun.COM uint32_t dmacc; /* Capture Count */ 899484Sgarrett.damore@Sun.COM uint32_t dmacnva; /* Capture Next VAddress */ 909484Sgarrett.damore@Sun.COM uint32_t dmacnc; /* Capture next count */ 919484Sgarrett.damore@Sun.COM uint32_t dmapva; /* Playback Virtual Address */ 929484Sgarrett.damore@Sun.COM uint32_t dmapc; /* Playback Count */ 939484Sgarrett.damore@Sun.COM uint32_t dmapnva; /* Playback Next VAddress */ 949484Sgarrett.damore@Sun.COM uint32_t dmapnc; /* Playback Next Count */ 959484Sgarrett.damore@Sun.COM }; 969484Sgarrett.damore@Sun.COM typedef struct cs4231_apc cs4231_apc_t; 979484Sgarrett.damore@Sun.COM 989484Sgarrett.damore@Sun.COM #define APC_DMACSR state->cs_regs->apc.dmacsr 999484Sgarrett.damore@Sun.COM #define APC_DMACVA state->cs_regs->apc.dmacva 1009484Sgarrett.damore@Sun.COM #define APC_DMACC state->cs_regs->apc.dmacc 1019484Sgarrett.damore@Sun.COM #define APC_DMACNVA state->cs_regs->apc.dmacnva 1029484Sgarrett.damore@Sun.COM #define APC_DMACNC state->cs_regs->apc.dmacnc 1039484Sgarrett.damore@Sun.COM #define APC_DMAPVA state->cs_regs->apc.dmapva 1049484Sgarrett.damore@Sun.COM #define APC_DMAPC state->cs_regs->apc.dmapc 1059484Sgarrett.damore@Sun.COM #define APC_DMAPNVA state->cs_regs->apc.dmapnva 1069484Sgarrett.damore@Sun.COM #define APC_DMAPNC state->cs_regs->apc.dmapnc 1079484Sgarrett.damore@Sun.COM 1089484Sgarrett.damore@Sun.COM /* 1099484Sgarrett.damore@Sun.COM * APC CSR Register bit definitions 1109484Sgarrett.damore@Sun.COM */ 1119484Sgarrett.damore@Sun.COM 1129484Sgarrett.damore@Sun.COM #define APC_RESET 0x00000001u /* Reset the DMA engine, R/W */ 1139484Sgarrett.damore@Sun.COM #define APC_CDMA_GO 0x00000004u /* Capture DMA go, R/W */ 1149484Sgarrett.damore@Sun.COM #define APC_PDMA_GO 0x00000008u /* Playback DMA go, R/W */ 1159484Sgarrett.damore@Sun.COM #define APC_LOOP_BACK 0x00000010u /* Loopback, Capture to Play */ 1169484Sgarrett.damore@Sun.COM #define APC_COD_PDWN 0x00000020u /* CODEC power down, R/W */ 1179484Sgarrett.damore@Sun.COM #define APC_C_ABORT 0x00000040u /* Capture abort, R/W */ 1189484Sgarrett.damore@Sun.COM #define APC_P_ABORT 0x00000080u /* Play abort, R/W */ 1199484Sgarrett.damore@Sun.COM #define APC_CXI_EN 0x00000100u /* Capture expired int. enable, R/W */ 1209484Sgarrett.damore@Sun.COM #define APC_CXI 0x00000200u /* Capture expired interrupt, R/W */ 1219484Sgarrett.damore@Sun.COM #define APC_CD 0x00000400u /* Capture next VA dirty, R/O */ 1229484Sgarrett.damore@Sun.COM #define APC_CX 0x00000800u /* Capture expired (pipe empty), R/O */ 1239484Sgarrett.damore@Sun.COM #define APC_PMI_EN 0x00001000u /* Play pipe empty int. enable, R/W */ 1249484Sgarrett.damore@Sun.COM #define APC_PD 0x00002000u /* Playback next VA dirty, R/O */ 1259484Sgarrett.damore@Sun.COM #define APC_PM 0x00004000u /* Play pipe empty, R/O */ 1269484Sgarrett.damore@Sun.COM #define APC_PMI 0x00008000u /* Play pipe empty interrupt, R/W */ 1279484Sgarrett.damore@Sun.COM #define APC_EIE 0x00010000u /* Error interrupt enable, R/W */ 1289484Sgarrett.damore@Sun.COM #define APC_CIE 0x00020000u /* Capture interrupt enable, R/W */ 1299484Sgarrett.damore@Sun.COM #define APC_PIE 0x00040000u /* Playback interrupt enable, R/W */ 1309484Sgarrett.damore@Sun.COM #define APC_IE 0x00080000u /* Interrupt enable, R/W */ 1319484Sgarrett.damore@Sun.COM #define APC_EI 0x00100000u /* Error interrupt, R/W */ 1329484Sgarrett.damore@Sun.COM #define APC_CI 0x00200000u /* Capture interrupt, R/W */ 1339484Sgarrett.damore@Sun.COM #define APC_PI 0x00400000u /* Playback interrupt, R/W */ 1349484Sgarrett.damore@Sun.COM #define APC_IP 0x00800000u /* Interrupt Pending, R/O */ 1359484Sgarrett.damore@Sun.COM #define APC_ID 0xff000000u /* ID bits, set to 7E, R/O */ 1369484Sgarrett.damore@Sun.COM 1379484Sgarrett.damore@Sun.COM #define APC_ID_VALUE 0x7E000000u /* ID read from CSR */ 1389484Sgarrett.damore@Sun.COM #define APC_CLEAR_RESET_VALUE 0x00 1399484Sgarrett.damore@Sun.COM 1409484Sgarrett.damore@Sun.COM #define APC_PINTR_MASK (APC_PI|APC_PMI) 1419484Sgarrett.damore@Sun.COM #define APC_CINTR_MASK (APC_CI|APC_CXI) 1429484Sgarrett.damore@Sun.COM #define APC_COMMON_MASK (APC_IP|APC_EI) 1439484Sgarrett.damore@Sun.COM #define APC_PINTR_ENABLE (APC_PIE|APC_PMI_EN) 1449484Sgarrett.damore@Sun.COM #define APC_CINTR_ENABLE (APC_CIE|APC_CXI_EN) 1459484Sgarrett.damore@Sun.COM #define APC_COMMON_ENABLE (APC_IE|APC_EIE) 1469484Sgarrett.damore@Sun.COM 147*11936Sgdamore@opensolaris.org #define APC_PLAY_ENABLE (APC_PDMA_GO) 148*11936Sgdamore@opensolaris.org #define APC_PLAY_DISABLE (APC_PDMA_GO) 149*11936Sgdamore@opensolaris.org #define APC_CAP_ENABLE (APC_CDMA_GO) 150*11936Sgdamore@opensolaris.org #define APC_CAP_DISABLE (APC_CDMA_GO) 1519484Sgarrett.damore@Sun.COM 1529484Sgarrett.damore@Sun.COM /* 1539484Sgarrett.damore@Sun.COM * These are the registers for the EBUS2 DMA channel interface to the 1549484Sgarrett.damore@Sun.COM * 4231. One struct per channel for playback and record, therefore there 1559484Sgarrett.damore@Sun.COM * individual handles for the CODEC and the two DMA engines. 1569484Sgarrett.damore@Sun.COM */ 1579484Sgarrett.damore@Sun.COM 1589484Sgarrett.damore@Sun.COM struct cs4231_eb2regs { 1599484Sgarrett.damore@Sun.COM uint32_t eb2csr; /* Ebus 2 csr */ 1609484Sgarrett.damore@Sun.COM uint32_t eb2acr; /* ebus 2 Addrs */ 1619484Sgarrett.damore@Sun.COM uint32_t eb2bcr; /* ebus 2 counts */ 1629484Sgarrett.damore@Sun.COM }; 1639484Sgarrett.damore@Sun.COM typedef struct cs4231_eb2regs cs4231_eb2regs_t; 1649484Sgarrett.damore@Sun.COM 1659484Sgarrett.damore@Sun.COM #define EB2_PLAY_CSR state->cs_eb2_regs.play->eb2csr 1669484Sgarrett.damore@Sun.COM #define EB2_PLAY_ACR state->cs_eb2_regs.play->eb2acr 1679484Sgarrett.damore@Sun.COM #define EB2_PLAY_BCR state->cs_eb2_regs.play->eb2bcr 1689484Sgarrett.damore@Sun.COM #define EB2_REC_CSR state->cs_eb2_regs.record->eb2csr 1699484Sgarrett.damore@Sun.COM #define EB2_REC_ACR state->cs_eb2_regs.record->eb2acr 1709484Sgarrett.damore@Sun.COM #define EB2_REC_BCR state->cs_eb2_regs.record->eb2bcr 1719484Sgarrett.damore@Sun.COM #define EB2_AUXIO_REG state->cs_eb2_regs.auxio 1729484Sgarrett.damore@Sun.COM 1739484Sgarrett.damore@Sun.COM /* 1749484Sgarrett.damore@Sun.COM * Audio auxio register definitions 1759484Sgarrett.damore@Sun.COM */ 1769484Sgarrett.damore@Sun.COM #define EB2_AUXIO_COD_PDWN 0x00000001u /* power down Codec */ 1779484Sgarrett.damore@Sun.COM 1789484Sgarrett.damore@Sun.COM /* 1799484Sgarrett.damore@Sun.COM * EBUS 2 CSR definitions 1809484Sgarrett.damore@Sun.COM */ 1819484Sgarrett.damore@Sun.COM 1829484Sgarrett.damore@Sun.COM #define EB2_INT_PEND 0x00000001u /* Interrupt pending, R/O */ 1839484Sgarrett.damore@Sun.COM #define EB2_ERR_PEND 0x00000002u /* Error interrupt, R/O */ 1849484Sgarrett.damore@Sun.COM #define EB2_DRAIN 0x00000004u /* FIFO being drained, R/O */ 1859484Sgarrett.damore@Sun.COM #define EB2_INT_EN 0x00000010u /* Enable interrupts, R/W */ 1869484Sgarrett.damore@Sun.COM #define EB2_RESET 0x00000080u /* Reset DMA engine, R/W */ 1879484Sgarrett.damore@Sun.COM #define EB2_WRITE 0x00000100u /* DMA direction (to mem) R/W */ 1889484Sgarrett.damore@Sun.COM #define EB2_READ 0x00000000u /* DMA direction (to dev) R/W */ 1899484Sgarrett.damore@Sun.COM #define EB2_EN_DMA 0x00000200u /* Enable DMA, R/W */ 1909484Sgarrett.damore@Sun.COM #define EB2_CYC_PENDING 0x00000400u /* DMA cycle pending, R/O */ 1919484Sgarrett.damore@Sun.COM #define EB2_DIAG_RD_DONE 0x00000800u /* Diag RD done, R/O */ 1929484Sgarrett.damore@Sun.COM #define EB2_DIAG_WR_DONE 0x00001000u /* Diag WR done, R/O */ 1939484Sgarrett.damore@Sun.COM #define EB2_EN_CNT 0x00002000u /* Enable byte count, R/W */ 1949484Sgarrett.damore@Sun.COM #define EB2_TC 0x00004000u /* Terminal count, R/W */ 1959484Sgarrett.damore@Sun.COM #define EB2_DIS_CSR_DRN 0x00010000u /* Dis. drain with W-CSR, R/W */ 1969484Sgarrett.damore@Sun.COM #define EB2_16 0x00000000u /* 19,18 == 0,0, R/W */ 1979484Sgarrett.damore@Sun.COM #define EB2_32 0x00040000u /* 19,18 == 0,1, R/W */ 1989484Sgarrett.damore@Sun.COM #define EB2_4 0x00080000u /* 19,18 == 1,0, R/W */ 1999484Sgarrett.damore@Sun.COM #define EB2_64 0x000C0000u /* 19,18 == 1,1, R/W */ 2009484Sgarrett.damore@Sun.COM #define EB2_DIAG_EN 0x00100000u /* DMA diag. enable, R/W */ 2019484Sgarrett.damore@Sun.COM #define EB2_DIS_ERR_PEND 0x00400000u /* Disable Error int., R/W */ 2029484Sgarrett.damore@Sun.COM #define EB2_TCI_DIS 0x00800000u /* Disable TC int., R/W */ 2039484Sgarrett.damore@Sun.COM #define EB2_EN_NEXT 0x01000000u /* Next addr. enabled, R/W */ 2049484Sgarrett.damore@Sun.COM #define EB2_DMA_ON 0x02000000u /* DMA engine enabled, R/O */ 2059484Sgarrett.damore@Sun.COM #define EB2_A_LOADED 0x04000000u /* Address loaded, R/O */ 2069484Sgarrett.damore@Sun.COM #define EB2_NA_LOADED 0x08000000u /* Next add. loaded, R/O */ 2079484Sgarrett.damore@Sun.COM #define EB2_DEV_ID 0xf0000000u /* Device ID -0x0C, R/O */ 2089484Sgarrett.damore@Sun.COM 2099484Sgarrett.damore@Sun.COM #define EB2_ID_VALUE 0xC0000000u /* ID read from CSR */ 2109484Sgarrett.damore@Sun.COM #define EB2_PCLEAR_RESET_VALUE (EB2_READ|EB2_EN_NEXT|EB2_EN_CNT) 2119484Sgarrett.damore@Sun.COM #define EB2_RCLEAR_RESET_VALUE (EB2_WRITE|EB2_EN_NEXT|EB2_EN_CNT) 2129484Sgarrett.damore@Sun.COM 213*11936Sgdamore@opensolaris.org #define EB2_PLAY_ENABLE (EB2_EN_DMA|EB2_EN_CNT|EB2_64|\ 2149484Sgarrett.damore@Sun.COM EB2_PCLEAR_RESET_VALUE) 2159484Sgarrett.damore@Sun.COM 216*11936Sgdamore@opensolaris.org #define EB2_REC_ENABLE (EB2_EN_DMA|EB2_EN_CNT|EB2_64|\ 2179484Sgarrett.damore@Sun.COM EB2_RCLEAR_RESET_VALUE) 2189484Sgarrett.damore@Sun.COM 2199484Sgarrett.damore@Sun.COM #define EB2_FIFO_DRAIN (EB2_DRAIN|EB2_CYC_PENDING) 2209484Sgarrett.damore@Sun.COM 2219484Sgarrett.damore@Sun.COM /* 2229484Sgarrett.damore@Sun.COM * Misc. defines 2239484Sgarrett.damore@Sun.COM */ 2249484Sgarrett.damore@Sun.COM #define CS4231_REGS (32) 2259484Sgarrett.damore@Sun.COM #define CS4231_NCOMPONENTS (1) 2269484Sgarrett.damore@Sun.COM #define CS4231_COMPONENT (0) 2279484Sgarrett.damore@Sun.COM #define CS4231_PWR_OFF (0) 2289484Sgarrett.damore@Sun.COM #define CS4231_PWR_ON (1) 2299484Sgarrett.damore@Sun.COM #define CS4231_TIMEOUT (100000) 2309484Sgarrett.damore@Sun.COM #define CS4231_300MS (300*1000) 2319484Sgarrett.damore@Sun.COM #define CS4231_PLAY 0 2329484Sgarrett.damore@Sun.COM #define CS4231_REC 1 233*11936Sgdamore@opensolaris.org #define CS4231_NFRAMES 4096 234*11936Sgdamore@opensolaris.org #define CS4231_NFRAGS 2 235*11936Sgdamore@opensolaris.org #define CS4231_FRAGSZ ((CS4231_NFRAMES / CS4231_NFRAGS) * 4) 236*11936Sgdamore@opensolaris.org #define CS4231_BUFSZ (CS4231_NFRAMES * 4) 2379484Sgarrett.damore@Sun.COM 2389484Sgarrett.damore@Sun.COM /* 2399484Sgarrett.damore@Sun.COM * Supported dma engines and the ops vector 2409484Sgarrett.damore@Sun.COM */ 2419484Sgarrett.damore@Sun.COM enum cs_dmae_types {APC_DMA, EB2_DMA}; 2429484Sgarrett.damore@Sun.COM typedef enum cs_dmae_types cs_dmae_types_e; 2439484Sgarrett.damore@Sun.COM 2449484Sgarrett.damore@Sun.COM /* 2459484Sgarrett.damore@Sun.COM * Hardware registers 2469484Sgarrett.damore@Sun.COM */ 2479484Sgarrett.damore@Sun.COM struct cs4231_pioregs { 2489484Sgarrett.damore@Sun.COM uint8_t iar; /* index address register */ 2499484Sgarrett.damore@Sun.COM uint8_t pad1[3]; /* pad */ 2509484Sgarrett.damore@Sun.COM uint8_t idr; /* indexed data register */ 2519484Sgarrett.damore@Sun.COM uint8_t pad2[3]; /* pad */ 2529484Sgarrett.damore@Sun.COM uint8_t statr; /* status register */ 2539484Sgarrett.damore@Sun.COM uint8_t pad3[3]; /* pad */ 2549484Sgarrett.damore@Sun.COM uint8_t piodr; /* PIO data regsiter */ 2559484Sgarrett.damore@Sun.COM uint8_t pad4[3]; 2569484Sgarrett.damore@Sun.COM }; 2579484Sgarrett.damore@Sun.COM typedef struct cs4231_pioregs cs4231_pioregs_t; 2589484Sgarrett.damore@Sun.COM 2599484Sgarrett.damore@Sun.COM 2609484Sgarrett.damore@Sun.COM struct cs4231_eb2 { 2619484Sgarrett.damore@Sun.COM cs4231_eb2regs_t *play; /* play EB2 registers */ 2629484Sgarrett.damore@Sun.COM cs4231_eb2regs_t *record; /* record EB2 registers */ 2639484Sgarrett.damore@Sun.COM uint_t *auxio; /* aux io - power down */ 2649484Sgarrett.damore@Sun.COM }; 2659484Sgarrett.damore@Sun.COM typedef struct cs4231_eb2 cs4231_eb2_t; 2669484Sgarrett.damore@Sun.COM 2679484Sgarrett.damore@Sun.COM struct cs4231_regs { 2689484Sgarrett.damore@Sun.COM cs4231_pioregs_t codec; /* CS4231 CODEC registers */ 2699484Sgarrett.damore@Sun.COM cs4231_apc_t apc; /* gets mapped with CODEC */ 2709484Sgarrett.damore@Sun.COM }; 2719484Sgarrett.damore@Sun.COM typedef struct cs4231_regs cs4231_regs_t; 2729484Sgarrett.damore@Sun.COM 2739484Sgarrett.damore@Sun.COM #define CS4231_IAR state->cs_regs->codec.iar /* Index Add. Reg. */ 2749484Sgarrett.damore@Sun.COM #define CS4231_IDR state->cs_regs->codec.idr /* Index Data Reg. */ 2759484Sgarrett.damore@Sun.COM #define CS4231_STATUS state->cs_regs->codec.statr /* Status Reg. */ 2769484Sgarrett.damore@Sun.COM #define CS4231_PIODR state->cs_regs->codec.piodr /* PIO Data Reg. */ 2779484Sgarrett.damore@Sun.COM 2789484Sgarrett.damore@Sun.COM /* 2799484Sgarrett.damore@Sun.COM * Misc. state enumerations and structures 2809484Sgarrett.damore@Sun.COM */ 2819484Sgarrett.damore@Sun.COM struct cs4231_handle { 2829484Sgarrett.damore@Sun.COM ddi_acc_handle_t cs_codec_hndl; /* CODEC handle, APC & EB2 */ 2839484Sgarrett.damore@Sun.COM ddi_acc_handle_t cs_eb2_play_hndl; /* EB2 only, play handle */ 2849484Sgarrett.damore@Sun.COM ddi_acc_handle_t cs_eb2_rec_hndl; /* EB2 only, record handle */ 2859484Sgarrett.damore@Sun.COM ddi_acc_handle_t cs_eb2_auxio_hndl; /* EB2 only, auxio handle */ 2869484Sgarrett.damore@Sun.COM }; 2879484Sgarrett.damore@Sun.COM typedef struct cs4231_handle cs4231_handle_t; 2889484Sgarrett.damore@Sun.COM #define CODEC_HANDLE state->cs_handles.cs_codec_hndl 2899484Sgarrett.damore@Sun.COM #define APC_HANDLE state->cs_handles.cs_codec_hndl 2909484Sgarrett.damore@Sun.COM #define EB2_PLAY_HNDL state->cs_handles.cs_eb2_play_hndl 2919484Sgarrett.damore@Sun.COM #define EB2_REC_HNDL state->cs_handles.cs_eb2_rec_hndl 2929484Sgarrett.damore@Sun.COM #define EB2_AUXIO_HNDL state->cs_handles.cs_eb2_auxio_hndl 2939484Sgarrett.damore@Sun.COM 2949484Sgarrett.damore@Sun.COM /* 2959484Sgarrett.damore@Sun.COM * CS_port_t - per port (playback or record) state 2969484Sgarrett.damore@Sun.COM */ 2979484Sgarrett.damore@Sun.COM struct CS_engine { 2989484Sgarrett.damore@Sun.COM CS_state_t *ce_state; 2999484Sgarrett.damore@Sun.COM audio_engine_t *ce_engine; 3009484Sgarrett.damore@Sun.COM int ce_num; 3019484Sgarrett.damore@Sun.COM unsigned ce_syncdir; 3029484Sgarrett.damore@Sun.COM boolean_t ce_started; 3039484Sgarrett.damore@Sun.COM uint64_t ce_count; 3049484Sgarrett.damore@Sun.COM 3059484Sgarrett.damore@Sun.COM caddr_t ce_kaddr; 3069484Sgarrett.damore@Sun.COM ddi_dma_handle_t ce_dmah; 3079484Sgarrett.damore@Sun.COM ddi_acc_handle_t ce_acch; 308*11936Sgdamore@opensolaris.org uint32_t ce_paddr; 309*11936Sgdamore@opensolaris.org uint32_t ce_curoff; 310*11936Sgdamore@opensolaris.org int ce_curidx; 3119484Sgarrett.damore@Sun.COM 3129484Sgarrett.damore@Sun.COM /* registers (EB2 only) */ 3139484Sgarrett.damore@Sun.COM ddi_acc_handle_t ce_regsh; 3149484Sgarrett.damore@Sun.COM cs4231_eb2regs_t *ce_eb2regs; /* EB2 registers */ 3159484Sgarrett.damore@Sun.COM 3169484Sgarrett.damore@Sun.COM /* codec enable */ 3179484Sgarrett.damore@Sun.COM uint8_t ce_codec_en; 3189484Sgarrett.damore@Sun.COM }; 3199484Sgarrett.damore@Sun.COM 3209484Sgarrett.damore@Sun.COM struct CS_ctrl { 3219484Sgarrett.damore@Sun.COM CS_state_t *cc_state; 3229484Sgarrett.damore@Sun.COM audio_ctrl_t *cc_ctrl; 3239484Sgarrett.damore@Sun.COM uint32_t cc_num; 3249484Sgarrett.damore@Sun.COM uint64_t cc_val; 3259484Sgarrett.damore@Sun.COM }; 3269484Sgarrett.damore@Sun.COM 3279484Sgarrett.damore@Sun.COM /* 3289484Sgarrett.damore@Sun.COM * CS_state_t - per instance state and operation data 3299484Sgarrett.damore@Sun.COM */ 3309484Sgarrett.damore@Sun.COM struct CS_state { 3319484Sgarrett.damore@Sun.COM kmutex_t cs_lock; /* state protection lock */ 3329484Sgarrett.damore@Sun.COM kcondvar_t cs_cv; /* suspend/resume cond. var. */ 3339484Sgarrett.damore@Sun.COM dev_info_t *cs_dip; /* used by cs4231_getinfo() */ 3349484Sgarrett.damore@Sun.COM audio_dev_t *cs_adev; /* audio device state */ 3359484Sgarrett.damore@Sun.COM 3369484Sgarrett.damore@Sun.COM cs_dmae_types_e cs_dma_engine; /* dma engine for this h/w */ 3379484Sgarrett.damore@Sun.COM struct cs4231_dma_ops *cs_dma_ops; /* dma engine ops vector */ 3389484Sgarrett.damore@Sun.COM cs4231_regs_t *cs_regs; /* hardware registers */ 3399484Sgarrett.damore@Sun.COM cs4231_eb2_t cs_eb2_regs; /* eb2 DMA registers */ 3409484Sgarrett.damore@Sun.COM cs4231_handle_t cs_handles; /* hardware handles */ 3419484Sgarrett.damore@Sun.COM 3429484Sgarrett.damore@Sun.COM boolean_t cs_suspended; /* power management state */ 3439484Sgarrett.damore@Sun.COM boolean_t cs_powered; /* device powered up? */ 3449484Sgarrett.damore@Sun.COM 3459484Sgarrett.damore@Sun.COM CS_engine_t *cs_engines[2]; 3469484Sgarrett.damore@Sun.COM 3479484Sgarrett.damore@Sun.COM boolean_t cs_revA; /* B_TRUE if Rev A CODEC */ 3489484Sgarrett.damore@Sun.COM uint8_t cs_save[CS4231_REGS]; /* PM reg. storage */ 3499484Sgarrett.damore@Sun.COM 3509484Sgarrett.damore@Sun.COM /* 3519484Sgarrett.damore@Sun.COM * Control related fields. 3529484Sgarrett.damore@Sun.COM */ 3539484Sgarrett.damore@Sun.COM uint64_t cs_imask; 3549484Sgarrett.damore@Sun.COM uint64_t cs_omask; 3559484Sgarrett.damore@Sun.COM uint64_t cs_omod; /* modifiable ports */ 3569484Sgarrett.damore@Sun.COM 3579484Sgarrett.damore@Sun.COM CS_ctrl_t *cs_ogain; 3589484Sgarrett.damore@Sun.COM CS_ctrl_t *cs_igain; 3599484Sgarrett.damore@Sun.COM CS_ctrl_t *cs_micboost; 3609484Sgarrett.damore@Sun.COM CS_ctrl_t *cs_mgain; 3619484Sgarrett.damore@Sun.COM CS_ctrl_t *cs_outputs; 3629484Sgarrett.damore@Sun.COM CS_ctrl_t *cs_inputs; 3639484Sgarrett.damore@Sun.COM }; 3649484Sgarrett.damore@Sun.COM 3659484Sgarrett.damore@Sun.COM /* 3669484Sgarrett.damore@Sun.COM * DMA ops vector definition 3679484Sgarrett.damore@Sun.COM */ 3689484Sgarrett.damore@Sun.COM struct cs4231_dma_ops { 3699484Sgarrett.damore@Sun.COM char *dma_device; 3709484Sgarrett.damore@Sun.COM ddi_dma_attr_t *cs_dma_attr; 3719484Sgarrett.damore@Sun.COM int (*cs_dma_map_regs)(CS_state_t *); 3729484Sgarrett.damore@Sun.COM void (*cs_dma_unmap_regs)(CS_state_t *); 3739484Sgarrett.damore@Sun.COM void (*cs_dma_reset)(CS_state_t *); 3749484Sgarrett.damore@Sun.COM int (*cs_dma_start)(CS_engine_t *); 3759484Sgarrett.damore@Sun.COM void (*cs_dma_stop)(CS_engine_t *); 3769484Sgarrett.damore@Sun.COM void (*cs_dma_power)(CS_state_t *, int); 377*11936Sgdamore@opensolaris.org void (*cs_dma_reload)(CS_engine_t *); 378*11936Sgdamore@opensolaris.org uint32_t (*cs_dma_addr)(CS_engine_t *); 3799484Sgarrett.damore@Sun.COM }; 3809484Sgarrett.damore@Sun.COM typedef struct cs4231_dma_ops cs4231_dma_ops_t; 3819484Sgarrett.damore@Sun.COM 3829484Sgarrett.damore@Sun.COM extern cs4231_dma_ops_t cs4231_apcdma_ops; 3839484Sgarrett.damore@Sun.COM extern cs4231_dma_ops_t cs4231_eb2dma_ops; 3849484Sgarrett.damore@Sun.COM 3859484Sgarrett.damore@Sun.COM #define CS4231_DMA_MAP_REGS(S) ((S)->cs_dma_ops->cs_dma_map_regs)(S) 3869484Sgarrett.damore@Sun.COM #define CS4231_DMA_UNMAP_REGS(S) ((S)->cs_dma_ops->cs_dma_unmap_regs)(S) 3879484Sgarrett.damore@Sun.COM #define CS4231_DMA_RESET(S) ((S)->cs_dma_ops->cs_dma_reset)(S) 3889484Sgarrett.damore@Sun.COM #define CS4231_DMA_START(S, E) ((S)->cs_dma_ops->cs_dma_start)(E) 3899484Sgarrett.damore@Sun.COM #define CS4231_DMA_STOP(S, E) ((S)->cs_dma_ops->cs_dma_stop)(E) 3909484Sgarrett.damore@Sun.COM #define CS4231_DMA_POWER(S, L) ((S)->cs_dma_ops->cs_dma_power)(S, L) 3919484Sgarrett.damore@Sun.COM #define CS4231_DMA_ATTR(S) ((S)->cs_dma_ops->cs_dma_attr) 392*11936Sgdamore@opensolaris.org #define CS4231_DMA_RELOAD(S, E) ((S)->cs_dma_ops->cs_dma_reload)(E) 393*11936Sgdamore@opensolaris.org #define CS4231_DMA_ADDR(S, E) ((S)->cs_dma_ops->cs_dma_addr)(E) 3949484Sgarrett.damore@Sun.COM 3959484Sgarrett.damore@Sun.COM /* 3969484Sgarrett.damore@Sun.COM * Useful bit twiddlers 3979484Sgarrett.damore@Sun.COM */ 3989484Sgarrett.damore@Sun.COM #define CS4231_RETRIES 10 3999484Sgarrett.damore@Sun.COM 4009484Sgarrett.damore@Sun.COM #define OR_SET_WORD(handle, addr, val) \ 4019484Sgarrett.damore@Sun.COM ddi_put32((handle), (uint_t *)(addr), \ 4029484Sgarrett.damore@Sun.COM (ddi_get32((handle), (uint_t *)(addr)) | (uint_t)(val))) 4039484Sgarrett.damore@Sun.COM 4049484Sgarrett.damore@Sun.COM #define AND_SET_WORD(handle, addr, val) \ 4059484Sgarrett.damore@Sun.COM ddi_put32((handle), (uint_t *)(addr), \ 4069484Sgarrett.damore@Sun.COM (ddi_get32((handle), (uint_t *)(addr)) & (uint_t)(val))) 4079484Sgarrett.damore@Sun.COM 4089484Sgarrett.damore@Sun.COM /* 4099484Sgarrett.damore@Sun.COM * CS4231 Register Set Definitions 4109484Sgarrett.damore@Sun.COM */ 4119484Sgarrett.damore@Sun.COM /* Index Address Register */ 4129484Sgarrett.damore@Sun.COM #define IAR_ADDRESS_MASK 0x1f /* mask for index addresses, R/W */ 4139484Sgarrett.damore@Sun.COM #define IAR_TRD 0x20 /* Transfer Request Disable, R/W */ 4149484Sgarrett.damore@Sun.COM #define IAR_MCE 0x40 /* Mode Change Enable, R/W */ 4159484Sgarrett.damore@Sun.COM #define IAR_INIT 0x80 /* 4231 init cycle, R/O */ 4169484Sgarrett.damore@Sun.COM 4179484Sgarrett.damore@Sun.COM /* Status Register */ 4189484Sgarrett.damore@Sun.COM #define STATUS_INT 0x01 /* Interrupt status, R/O */ 4199484Sgarrett.damore@Sun.COM #define STATUS_PRDY 0x02 /* Playback Data Ready */ 4209484Sgarrett.damore@Sun.COM #define STATUS_PLR 0x04 /* Playback Left/Right sample */ 4219484Sgarrett.damore@Sun.COM #define STATUS_PUL 0x08 /* Playback Upper/Lower byte */ 4229484Sgarrett.damore@Sun.COM #define STATUS_SER 0x10 /* Sample Error, see Index 24 */ 4239484Sgarrett.damore@Sun.COM #define STATUS_CRDY 0x20 /* Capture Data Ready */ 4249484Sgarrett.damore@Sun.COM #define STATUS_CLR 0x40 /* Capture Left/Right sample */ 4259484Sgarrett.damore@Sun.COM #define STATUS_CUL 0x80 /* Capture Upper/Lower byte */ 4269484Sgarrett.damore@Sun.COM #define STATUS_RESET 0x00 /* Reset the status register */ 4279484Sgarrett.damore@Sun.COM 4289484Sgarrett.damore@Sun.COM /* Index 00 - Left ADC Input Control, Modes 1&2 */ 4299484Sgarrett.damore@Sun.COM #define LADCI_REG 0x00 /* Left ADC Register */ 4309484Sgarrett.damore@Sun.COM #define LADCI_GAIN_MASK 0x0f /* Left gain mask, 1.5 dB/step */ 4319484Sgarrett.damore@Sun.COM #define LADCI_LMGE 0x20 /* Left Mic Gain Enable, 20 dB stage */ 4329484Sgarrett.damore@Sun.COM #define LADCI_LLINE 0x00 /* Left Line in enable */ 4339484Sgarrett.damore@Sun.COM #define LADCI_LAUX1 0x40 /* Left AUX1 in enable */ 4349484Sgarrett.damore@Sun.COM #define LADCI_LMIC 0x80 /* Left MIC in enable */ 4359484Sgarrett.damore@Sun.COM #define LADCI_LLOOP 0xc0 /* Left Loopback enable */ 4369484Sgarrett.damore@Sun.COM #define LADCI_IN_MASK 0xc0 /* Left input mask */ 4379484Sgarrett.damore@Sun.COM #define LADCI_VALID_MASK 0xef /* Left valid bits mask */ 4389484Sgarrett.damore@Sun.COM 4399484Sgarrett.damore@Sun.COM /* Index 01 - Right ADC Input Control, Modes 1&2 */ 4409484Sgarrett.damore@Sun.COM #define RADCI_REG 0x01 /* Right ADC Register */ 4419484Sgarrett.damore@Sun.COM #define RADCI_GAIN_MASK 0x0f /* Right gain mask, 1.5 dB/step */ 4429484Sgarrett.damore@Sun.COM #define RADCI_RMGE 0x20 /* Right Mic Gain Enable, 20 dB stage */ 4439484Sgarrett.damore@Sun.COM #define RADCI_RLINE 0x00 /* Right Line in enable */ 4449484Sgarrett.damore@Sun.COM #define RADCI_RAUX1 0x40 /* Right AUX1 in enable */ 4459484Sgarrett.damore@Sun.COM #define RADCI_RMIC 0x80 /* Right MIC in enable */ 4469484Sgarrett.damore@Sun.COM #define RADCI_RLOOP 0xc0 /* Right Loopback enable */ 4479484Sgarrett.damore@Sun.COM #define RADCI_IN_MASK 0xc0 /* Right input mask */ 4489484Sgarrett.damore@Sun.COM #define RADCI_VALID_MASK 0xef /* Right valid bits mask */ 4499484Sgarrett.damore@Sun.COM 4509484Sgarrett.damore@Sun.COM /* Index 02 - Left Aux #1 Input Control, Modes 1&2 */ 4519484Sgarrett.damore@Sun.COM #define LAUX1_REG 0x02 /* Left Aux#1 Register */ 4529484Sgarrett.damore@Sun.COM #define LAUX1_GAIN_MASK 0x1f /* Left Aux#1 gain mask, 1.5 dB/step */ 4539484Sgarrett.damore@Sun.COM #define LAUX1_LX1M 0x80 /* Left Aux#1 mute */ 4549484Sgarrett.damore@Sun.COM #define LAUX1_UNITY_GAIN 0x08 /* Left Aux#1 unity gain */ 4559484Sgarrett.damore@Sun.COM #define LAUX1_VALID_MASK 0x9f /* Left valid bits mask */ 4569484Sgarrett.damore@Sun.COM 4579484Sgarrett.damore@Sun.COM /* Index 03 - Right Aux #1 Input Control, Modes 1&2 */ 4589484Sgarrett.damore@Sun.COM #define RAUX1_REG 0x03 /* Right Aux#1 Register */ 4599484Sgarrett.damore@Sun.COM #define RAUX1_GAIN_MASK 0x1f /* Right Aux#1 gain mask, 1.5 dB/step */ 4609484Sgarrett.damore@Sun.COM #define RAUX1_RX1M 0x80 /* Right Aux#1 mute */ 4619484Sgarrett.damore@Sun.COM #define RAUX1_UNITY_GAIN 0x08 /* Right Aux#1 unity gain */ 4629484Sgarrett.damore@Sun.COM #define RAUX1_VALID_MASK 0x9f /* Right valid bits mask */ 4639484Sgarrett.damore@Sun.COM 4649484Sgarrett.damore@Sun.COM /* Index 04 - Left Aux #2 Input Control, Modes 1&2 */ 4659484Sgarrett.damore@Sun.COM #define LAUX2_REG 0x04 /* Left Aux#2 Register */ 4669484Sgarrett.damore@Sun.COM #define LAUX2_GAIN_MASK 0x1f /* Left Aux#2 gain mask, 1.5 dB/step */ 4679484Sgarrett.damore@Sun.COM #define LAUX2_LX2M 0x80 /* Left Aux#2 mute */ 4689484Sgarrett.damore@Sun.COM #define LAUX2_UNITY_GAIN 0x08 /* Left Aux#2 unity gain */ 4699484Sgarrett.damore@Sun.COM #define LAUX2_VALID_MASK 0x9f /* Left valid bits mask */ 4709484Sgarrett.damore@Sun.COM 4719484Sgarrett.damore@Sun.COM /* Index 05 - Right Aux #2 Input Control, Modes 1&2 */ 4729484Sgarrett.damore@Sun.COM #define RAUX2_REG 0x05 /* Right Aux#2 Register */ 4739484Sgarrett.damore@Sun.COM #define RAUX2_GAIN_MASK 0x1f /* Right Aux#2 gain mask, 1.5 dB/step */ 4749484Sgarrett.damore@Sun.COM #define RAUX2_RX2M 0x80 /* Right Aux#2 mute */ 4759484Sgarrett.damore@Sun.COM #define RAUX2_UNITY_GAIN 0x08 /* Right Aux#2 unity gain */ 4769484Sgarrett.damore@Sun.COM #define RAUX2_VALID_MASK 0x9f /* Right valid bits mask */ 4779484Sgarrett.damore@Sun.COM 4789484Sgarrett.damore@Sun.COM /* Index 06 - Left DAC Output Control, Modes 1&2 */ 4799484Sgarrett.damore@Sun.COM #define LDACO_REG 0x06 /* Left DAC Register */ 4809484Sgarrett.damore@Sun.COM #define LDACO_ATTEN_MASK 0x3f /* Left attenuation mask, 1.5 dB/setp */ 4819484Sgarrett.damore@Sun.COM #define LDACO_LDM 0x80 /* Left mute */ 4829484Sgarrett.damore@Sun.COM #define LDACO_MID_GAIN 0x11 /* Left DAC mid gain */ 4839484Sgarrett.damore@Sun.COM #define LDAC0_VALID_MASK 0xbf /* Left valid bits mask */ 4849484Sgarrett.damore@Sun.COM 4859484Sgarrett.damore@Sun.COM /* Index 07 - Right DAC Output Control, Modes 1&2 */ 4869484Sgarrett.damore@Sun.COM #define RDACO_REG 0x07 /* Right DAC Register */ 4879484Sgarrett.damore@Sun.COM #define RDACO_ATTEN_MASK 0x3f /* Right atten. mask, 1.5 dB/setp */ 4889484Sgarrett.damore@Sun.COM #define RDACO_RDM 0x80 /* Right mute */ 4899484Sgarrett.damore@Sun.COM #define RDACO_MID_GAIN 0x11 /* Right DAC mid gain */ 4909484Sgarrett.damore@Sun.COM #define RDAC0_VALID_MASK 0xbf /* Right valid bits mask */ 4919484Sgarrett.damore@Sun.COM 4929484Sgarrett.damore@Sun.COM /* Index 08 - Sample Rate and Data Format, Mode 2 only */ 4939484Sgarrett.damore@Sun.COM #define FSDF_REG 0x08 /* Sample Rate & Data Format Register */ 4949484Sgarrett.damore@Sun.COM #define FS_5510 0x01 /* XTAL2, Freq. Divide #0 */ 4959484Sgarrett.damore@Sun.COM #define FS_6620 0x0f /* XTAL2, Freq. Divide #7 */ 4969484Sgarrett.damore@Sun.COM #define FS_8000 0x00 /* XTAL1, Freq. Divide #0 */ 4979484Sgarrett.damore@Sun.COM #define FS_9600 0x0e /* XTAL2, Freq. Divide #7 */ 4989484Sgarrett.damore@Sun.COM #define FS_11025 0x03 /* XTAL2, Freq. Divide #1 */ 4999484Sgarrett.damore@Sun.COM #define FS_16000 0x02 /* XTAL1, Freq. Divide #1 */ 5009484Sgarrett.damore@Sun.COM #define FS_18900 0x05 /* XTAL2, Freq. Divide #2 */ 5019484Sgarrett.damore@Sun.COM #define FS_22050 0x07 /* XTAL2, Freq. Divide #3 */ 5029484Sgarrett.damore@Sun.COM #define FS_27420 0x04 /* XTAL1, Freq. Divide #2 */ 5039484Sgarrett.damore@Sun.COM #define FS_32000 0x06 /* XTAL1, Freq. Divide #3 */ 5049484Sgarrett.damore@Sun.COM #define FS_33075 0x0d /* XTAL2, Freq. Divide #6 */ 5059484Sgarrett.damore@Sun.COM #define FS_37800 0x09 /* XTAL2, Freq. Divide #4 */ 5069484Sgarrett.damore@Sun.COM #define FS_44100 0x0b /* XTAL2, Freq. Divide #5 */ 5079484Sgarrett.damore@Sun.COM #define FS_48000 0x0c /* XTAL1, Freq. Divide #6 */ 5089484Sgarrett.damore@Sun.COM #define PDF_STEREO 0x10 /* Stereo Playback */ 5099484Sgarrett.damore@Sun.COM #define PDF_MONO 0x00 /* Mono Playback */ 5109484Sgarrett.damore@Sun.COM #define PDF_LINEAR8 0x00 /* Linear, 8-bit unsigned */ 5119484Sgarrett.damore@Sun.COM #define PDF_ULAW8 0x20 /* u-Law, 8-bit companded */ 5129484Sgarrett.damore@Sun.COM #define PDF_LINEAR16LE 0x40 /* Linear, 16-bit signed, little end. */ 5139484Sgarrett.damore@Sun.COM #define PDF_ALAW8 0x60 /* A-Law, 8-bit companded */ 5149484Sgarrett.damore@Sun.COM #define PDF_ADPCM4 0xa0 /* ADPCM, 4-bit, IMA compatible */ 5159484Sgarrett.damore@Sun.COM #define PDF_LINEAR16BE 0xc0 /* Linear, 16-bit signed, big endian */ 5169484Sgarrett.damore@Sun.COM #define FSDF_VALID_MASK 0xff /* Valid bits mask */ 5179484Sgarrett.damore@Sun.COM #ifdef _BIG_ENDIAN 5189484Sgarrett.damore@Sun.COM #define PDF_LINEAR16NE PDF_LINEAR16BE 5199484Sgarrett.damore@Sun.COM #else 5209484Sgarrett.damore@Sun.COM #define PDF_LINEAR16NE PDF_LINEAR16LE 5219484Sgarrett.damore@Sun.COM #endif 5229484Sgarrett.damore@Sun.COM 5239484Sgarrett.damore@Sun.COM /* Index 09 - Interface Configuration, Mode 1&2 */ 5249484Sgarrett.damore@Sun.COM #define INTC_REG 0x09 /* Interrupt Configuration Register */ 5259484Sgarrett.damore@Sun.COM #define INTC_PEN 0x01 /* Playback enable */ 5269484Sgarrett.damore@Sun.COM #define INTC_CEN 0x02 /* Capture enable */ 5279484Sgarrett.damore@Sun.COM #define INTC_SDC 0x04 /* Single DMA channel */ 5289484Sgarrett.damore@Sun.COM #define INTC_DDC 0x00 /* Dual DMA channels */ 5299484Sgarrett.damore@Sun.COM #define INTC_ACAL 0x08 /* Auto-Calibrate Enable */ 5309484Sgarrett.damore@Sun.COM #define INTC_PPIO 0x40 /* Playback vi PIO */ 5319484Sgarrett.damore@Sun.COM #define INTC_PDMA 0x00 /* Playback vi DMA */ 5329484Sgarrett.damore@Sun.COM #define INTC_CPIO 0x80 /* Capture vi PIO */ 5339484Sgarrett.damore@Sun.COM #define INTC_CDMA 0x00 /* Capture vi DMA */ 5349484Sgarrett.damore@Sun.COM #define INTC_VALID_MASK 0xcf /* Valid bits mask */ 5359484Sgarrett.damore@Sun.COM 5369484Sgarrett.damore@Sun.COM /* Index 10 - Pin Control, Mode 1&2 */ 5379484Sgarrett.damore@Sun.COM #define PC_REG 0x0a /* Pin Control Register */ 5389484Sgarrett.damore@Sun.COM #define PC_IEN 0x02 /* Interrupt Enable */ 5399484Sgarrett.damore@Sun.COM #define PC_DEN 0x04 /* Dither Enable */ 5409484Sgarrett.damore@Sun.COM #define PC_XCTL0 0x40 /* External control 0 */ 5419484Sgarrett.damore@Sun.COM #define PC_LINE_OUT_MUTE 0x40 /* Line Out Mute */ 5429484Sgarrett.damore@Sun.COM #define PC_XCTL1 0x80 /* External control 1 */ 5439484Sgarrett.damore@Sun.COM #define PC_HEADPHONE_MUTE 0x80 /* Headphone Mute */ 5449484Sgarrett.damore@Sun.COM #define PC_VALID_MASK 0xca /* Valid bits mask */ 5459484Sgarrett.damore@Sun.COM 5469484Sgarrett.damore@Sun.COM /* Index 11 - Error Status and Initialization, Mode 1&2 */ 5479484Sgarrett.damore@Sun.COM #define ESI_REG 0x0b /* Error Status & Init. Register */ 5489484Sgarrett.damore@Sun.COM #define ESI_ORL_MASK 0x03 /* Left ADC Overrange */ 5499484Sgarrett.damore@Sun.COM #define ESI_ORR_MASK 0x0c /* Right ADC Overrange */ 5509484Sgarrett.damore@Sun.COM #define ESI_DRS 0x10 /* DRQ status */ 5519484Sgarrett.damore@Sun.COM #define ESI_ACI 0x20 /* Auto-Calibrate In Progress */ 5529484Sgarrett.damore@Sun.COM #define ESI_PUR 0x40 /* Playback Underrun */ 5539484Sgarrett.damore@Sun.COM #define ESI_COR 0x80 /* Capture Overrun */ 5549484Sgarrett.damore@Sun.COM #define ESI_VALID_MASK 0xff /* Valid bits mask */ 5559484Sgarrett.damore@Sun.COM 5569484Sgarrett.damore@Sun.COM /* Index 12 - Mode and ID, Modes 1&2 */ 5579484Sgarrett.damore@Sun.COM #define MID_REG 0x0c /* Mode and ID Register */ 5589484Sgarrett.damore@Sun.COM #define MID_ID_MASK 0x0f /* CODEC ID */ 5599484Sgarrett.damore@Sun.COM #define MID_MODE2 0x40 /* Mode 2 enable */ 5609484Sgarrett.damore@Sun.COM #define MID_VALID_MASK 0xcf /* Valid bits mask */ 5619484Sgarrett.damore@Sun.COM 5629484Sgarrett.damore@Sun.COM /* Index 13 - Loopback Control, Modes 1&2 */ 5639484Sgarrett.damore@Sun.COM #define LC_REG 0x0d /* Loopback Control Register */ 5649484Sgarrett.damore@Sun.COM #define LC_LBE 0x01 /* Loopback Enable */ 5659484Sgarrett.damore@Sun.COM #define LC_ATTEN_MASK 0xfc /* Loopback attenuation mask */ 5669484Sgarrett.damore@Sun.COM #define LC_OFF 0x00 /* Loopback off */ 5679484Sgarrett.damore@Sun.COM #define LC_VALID_MASK 0xfd /* Valid bits mask */ 5689484Sgarrett.damore@Sun.COM 5699484Sgarrett.damore@Sun.COM /* Index 14 - Playback Upper Base, Mode 2 only */ 5709484Sgarrett.damore@Sun.COM #define PUB_REG 0x0e /* Playback Upper Base Register */ 5719484Sgarrett.damore@Sun.COM #define PUB_VALID_MASK 0xff /* Valid bits mask */ 5729484Sgarrett.damore@Sun.COM 5739484Sgarrett.damore@Sun.COM /* Index 15 - Playback Lower Base, Mode 2 only */ 5749484Sgarrett.damore@Sun.COM #define PLB_REG 0x0f /* Playback Lower Base Register */ 5759484Sgarrett.damore@Sun.COM #define PLB_VALID_MASK 0xff /* Valid bits mask */ 5769484Sgarrett.damore@Sun.COM 5779484Sgarrett.damore@Sun.COM /* Index 16 - Alternate Feature Enable 1, Mode 2 only */ 5789484Sgarrett.damore@Sun.COM #define AFE1_REG 0x10 /* Alternate Feature Enable 1 Reg */ 5799484Sgarrett.damore@Sun.COM #define AFE1_DACZ 0x01 /* DAC Zero */ 5809484Sgarrett.damore@Sun.COM #define AFE1_TE 0x40 /* Timer Enable */ 5819484Sgarrett.damore@Sun.COM #define AFE1_OLB 0x80 /* Output Level Bit, 1=2.8Vpp, 0=2Vpp */ 5829484Sgarrett.damore@Sun.COM #define AFE1_VALID_MASK 0xc1 /* Valid bits mask */ 5839484Sgarrett.damore@Sun.COM 5849484Sgarrett.damore@Sun.COM /* Index 17 - Alternate Feature Enable 2, Mode 2 only */ 5859484Sgarrett.damore@Sun.COM #define AFE2_REG 0x11 /* Alternate Feature Enable 2 Reg */ 5869484Sgarrett.damore@Sun.COM #define AFE2_HPF 0x01 /* High Pass Filter - DC blocking */ 5879484Sgarrett.damore@Sun.COM #define AFE2_VALID_MASK 0x01 /* Valid bits mask */ 5889484Sgarrett.damore@Sun.COM 5899484Sgarrett.damore@Sun.COM /* Index 18 - Left Line Input Control, Mode 2 only */ 5909484Sgarrett.damore@Sun.COM #define LLIC_REG 0x12 /* Left Line Input Control Register */ 5919484Sgarrett.damore@Sun.COM #define LLIC_MIX_GAIN_MASK 0x1f /* Left Mix Gain Mask, 1.5 dB/step */ 5929484Sgarrett.damore@Sun.COM #define LLIC_LLM 0x80 /* Left Line Mute */ 5939484Sgarrett.damore@Sun.COM #define LLIC_UNITY_GAIN 0x08 /* Left unit gain */ 5949484Sgarrett.damore@Sun.COM #define LLIC_VALID_MASK 0x9f /* Left valid bits mask */ 5959484Sgarrett.damore@Sun.COM 5969484Sgarrett.damore@Sun.COM /* Index 19 - Right Line Input Control, Mode 2 only */ 5979484Sgarrett.damore@Sun.COM #define RLIC_REG 0x13 /* Right Line Input Control Register */ 5989484Sgarrett.damore@Sun.COM #define RLIC_MIX_GAIN_MASK 0x1f /* Right Mix Gain Mask, 1.5 dB/step */ 5999484Sgarrett.damore@Sun.COM #define RLIC_RLM 0x80 /* Right Line Mute */ 6009484Sgarrett.damore@Sun.COM #define RLIC_UNITY_GAIN 0x08 /* Right unit gain */ 6019484Sgarrett.damore@Sun.COM #define RLIC_VALID_MASK 0x9f /* Right valid bits mask */ 6029484Sgarrett.damore@Sun.COM 6039484Sgarrett.damore@Sun.COM /* Index 20 - Timer Lower Byte, Mode 2 only */ 6049484Sgarrett.damore@Sun.COM #define TLB_REG 0x14 /* Timer Lower Byte Register */ 6059484Sgarrett.damore@Sun.COM #define TLB_VALID_MASK 0xff /* Valid bits mask */ 6069484Sgarrett.damore@Sun.COM 6079484Sgarrett.damore@Sun.COM /* Index 21 - Timer Upper Byte, Mode 2 only */ 6089484Sgarrett.damore@Sun.COM #define TUB_REG 0x15 /* Timer Upper Byte Register */ 6099484Sgarrett.damore@Sun.COM #define TUB_VALID_MASK 0xff /* Valid bits mask */ 6109484Sgarrett.damore@Sun.COM 6119484Sgarrett.damore@Sun.COM /* Index 22 and 23 are reserved */ 6129484Sgarrett.damore@Sun.COM 6139484Sgarrett.damore@Sun.COM /* Index 24 - Alternate Feature Status, Mode 2 only */ 6149484Sgarrett.damore@Sun.COM #define AFS_REG 0x18 /* Alternate Feature Status Register */ 6159484Sgarrett.damore@Sun.COM #define AFS_PU 0x01 /* Playback Underrun */ 6169484Sgarrett.damore@Sun.COM #define AFS_PO 0x02 /* Playback Overrun */ 6179484Sgarrett.damore@Sun.COM #define AFS_CO 0x04 /* Capture Overrun */ 6189484Sgarrett.damore@Sun.COM #define AFS_CU 0x08 /* Capture Underrun */ 6199484Sgarrett.damore@Sun.COM #define AFS_PI 0x10 /* Playback Interrupt */ 6209484Sgarrett.damore@Sun.COM #define AFS_CI 0x20 /* Capture Interrupt */ 6219484Sgarrett.damore@Sun.COM #define AFS_TI 0x40 /* Timer Interrupt */ 6229484Sgarrett.damore@Sun.COM #define AFS_RESET_STATUS 0x00 /* Reset the status register */ 6239484Sgarrett.damore@Sun.COM #define AFS_VALID_MASK 0x7f /* Valid bits mask */ 6249484Sgarrett.damore@Sun.COM 6259484Sgarrett.damore@Sun.COM /* Index 25 - Version and ID, Mode 2 only */ 6269484Sgarrett.damore@Sun.COM #define VID_REG 0x19 /* Version and ID Register */ 6279484Sgarrett.damore@Sun.COM #define VID_CID_MASK 0x07 /* Chip ID Mask */ 6289484Sgarrett.damore@Sun.COM #define VID_VERSION_MASK 0xe0 /* Version number Mask */ 6299484Sgarrett.damore@Sun.COM #define VID_A 0x20 /* Version A */ 6309484Sgarrett.damore@Sun.COM #define VID_CDE 0x80 /* Versions C, D or E */ 6319484Sgarrett.damore@Sun.COM #define VID_VALID_MASK 0xe7 /* Valid bits mask */ 6329484Sgarrett.damore@Sun.COM 6339484Sgarrett.damore@Sun.COM /* Index 26 - Mono I/O Control, Mode 2 only */ 6349484Sgarrett.damore@Sun.COM #define MIOC_REG 0x1a /* Mono I/O Control Register */ 6359484Sgarrett.damore@Sun.COM #define MIOC_MI_ATTEN_MASK 0x0f /* Mono In Attenuation Mask */ 6369484Sgarrett.damore@Sun.COM #define MIOC_MOM 0x40 /* Mono Out Mute */ 6379484Sgarrett.damore@Sun.COM #define MIOC_MONO_SPKR_MUTE 0x40 /* Mono (internal) speaker mute */ 6389484Sgarrett.damore@Sun.COM #define MIOC_MIM 0x80 /* Mono In Mute */ 6399484Sgarrett.damore@Sun.COM #define MIOC_VALID_MASK 0xcf /* Valid bits mask */ 6409484Sgarrett.damore@Sun.COM 6419484Sgarrett.damore@Sun.COM /* Index 27 is reserved */ 6429484Sgarrett.damore@Sun.COM 6439484Sgarrett.damore@Sun.COM /* Index 28 - Capture Data Format, Mode 2 only */ 6449484Sgarrett.damore@Sun.COM #define CDF_REG 0x1c /* Capture Date Foramt Register */ 6459484Sgarrett.damore@Sun.COM #define CDF_STEREO 0x10 /* Stereo Capture */ 6469484Sgarrett.damore@Sun.COM #define CDF_MONO 0x00 /* Mono Capture */ 6479484Sgarrett.damore@Sun.COM #define CDF_LINEAR8 0x00 /* Linear, 8-bit unsigned */ 6489484Sgarrett.damore@Sun.COM #define CDF_ULAW8 0x20 /* u-Law, 8-bit companded */ 6499484Sgarrett.damore@Sun.COM #define CDF_LINEAR16LE 0x40 /* Linear, 16-bit signed, little end. */ 6509484Sgarrett.damore@Sun.COM #define CDF_ALAW8 0x60 /* A-Law, 8-bit companded */ 6519484Sgarrett.damore@Sun.COM #define CDF_ADPCM4 0xa0 /* ADPCM, 4-bit, IMA compatible */ 6529484Sgarrett.damore@Sun.COM #define CDF_LINEAR16BE 0xc0 /* Linear, 16-bit signed, big endian */ 6539484Sgarrett.damore@Sun.COM #define CDF_VALID_MASK 0xf0 /* Valid bits mask */ 6549484Sgarrett.damore@Sun.COM #ifdef _BIG_ENDIAN 6559484Sgarrett.damore@Sun.COM #define CDF_LINEAR16NE CDF_LINEAR16BE 6569484Sgarrett.damore@Sun.COM #else 6579484Sgarrett.damore@Sun.COM #define CDF_LINEAR16NE CDF_LINEAR16LE 6589484Sgarrett.damore@Sun.COM #endif 6599484Sgarrett.damore@Sun.COM 6609484Sgarrett.damore@Sun.COM /* Index 29 is reserved */ 6619484Sgarrett.damore@Sun.COM 6629484Sgarrett.damore@Sun.COM /* Index 30 - Capture Upper Base, Mode 2 only */ 6639484Sgarrett.damore@Sun.COM #define CUB_REG 0x1e /* Capture Upper Base Register */ 6649484Sgarrett.damore@Sun.COM #define CUB_VALID_MASK 0xff /* Valid bits mask */ 6659484Sgarrett.damore@Sun.COM 6669484Sgarrett.damore@Sun.COM /* Index 31 - Capture Lower Base, Mode 2 only */ 6679484Sgarrett.damore@Sun.COM #define CLB_REG 0x1f /* Capture Lower Base Register */ 6689484Sgarrett.damore@Sun.COM #define CLB_VALID_MASK 0xff /* Valid bits mask */ 6699484Sgarrett.damore@Sun.COM 6709484Sgarrett.damore@Sun.COM #endif /* _KERNEL */ 6719484Sgarrett.damore@Sun.COM 6729484Sgarrett.damore@Sun.COM #ifdef __cplusplus 6739484Sgarrett.damore@Sun.COM } 6749484Sgarrett.damore@Sun.COM #endif 6759484Sgarrett.damore@Sun.COM 6769484Sgarrett.damore@Sun.COM #endif /* _AUDIO_4231_H */ 677