1205859Sjoel/*- 2159687Snetchild * Copyright (c) 2001 Katsurajima Naoto <raven@katsurajima.seya.yokohama.jp> 3159687Snetchild * All rights reserved. 4159687Snetchild * 5159687Snetchild * Redistribution and use in source and binary forms, with or without 6159687Snetchild * modification, are permitted provided that the following conditions 7159687Snetchild * are met: 8159687Snetchild * 1. Redistributions of source code must retain the above copyright 9159687Snetchild * notice, this list of conditions and the following disclaimer. 10159687Snetchild * 2. Redistributions in binary form must reproduce the above copyright 11159687Snetchild * notice, this list of conditions and the following disclaimer in the 12159687Snetchild * documentation and/or other materials provided with the distribution. 13159687Snetchild * 14159687Snetchild * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15159687Snetchild * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16159687Snetchild * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17159687Snetchild * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18159687Snetchild * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19159687Snetchild * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20159687Snetchild * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21159687Snetchild * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHERIN CONTRACT, STRICT 22159687Snetchild * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23159687Snetchild * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THEPOSSIBILITY OF 24159687Snetchild * SUCH DAMAGE. 25159687Snetchild * 26159687Snetchild * $FreeBSD: releng/10.2/sys/dev/sound/pci/envy24.h 205859 2010-03-29 20:27:17Z joel $ 27159687Snetchild */ 28159687Snetchild 29159687Snetchild 30159687Snetchild/* -------------------------------------------------------------------- */ 31159687Snetchild 32159687Snetchild/* PCI device ID */ 33159687Snetchild#define PCIV_ENVY24 0x1412 34159687Snetchild#define PCID_ENVY24 0x1712 35159687Snetchild 36159687Snetchild/* PCI Registers */ 37159687Snetchild 38159687Snetchild#define PCIR_CCS 0x10 /* Controller I/O Base Address */ 39159687Snetchild#define PCIR_DDMA 0x14 /* DDMA I/O Base Address */ 40159687Snetchild#define PCIR_DS 0x18 /* DMA Path Registers I/O Base Address */ 41159687Snetchild#define PCIR_MT 0x1c /* Professional Multi-Track I/O Base Address */ 42159687Snetchild 43159687Snetchild#define PCIR_LAC 0x40 /* Legacy Audio Control */ 44159687Snetchild#define PCIM_LAC_DISABLE 0x8000 /* Legacy Audio Hardware disabled */ 45159687Snetchild#define PCIM_LAC_SBDMA0 0x0000 /* SB DMA Channel Select: 0 */ 46159687Snetchild#define PCIM_LAC_SBDMA1 0x0040 /* SB DMA Channel Select: 1 */ 47159687Snetchild#define PCIM_LAC_SBDMA3 0x00c0 /* SB DMA Channel Select: 3 */ 48159687Snetchild#define PCIM_LAC_IOADDR10 0x0020 /* I/O Address Alias Control */ 49159687Snetchild#define PCIM_LAC_MPU401 0x0008 /* MPU-401 I/O enable */ 50159687Snetchild#define PCIM_LAC_GAME 0x0004 /* Game Port enable (200h) */ 51159687Snetchild#define PCIM_LAC_FM 0x0002 /* FM I/O enable (AdLib 388h base) */ 52159687Snetchild#define PCIM_LAC_SB 0x0001 /* SB I/O enable */ 53159687Snetchild 54159687Snetchild#define PCIR_LCC 0x42 /* Legacy Configuration Control */ 55159687Snetchild#define PCIM_LCC_VINT 0xff00 /* Interrupt vector to be snooped */ 56159687Snetchild#define PCIM_LCC_SVIDRW 0x0080 /* SVID read/write enable */ 57159687Snetchild#define PCIM_LCC_SNPSB 0x0040 /* snoop SB 22C/24Ch I/O write cycle */ 58159687Snetchild#define PCIM_LCC_SNPPIC 0x0020 /* snoop PIC I/O R/W cycle */ 59159687Snetchild#define PCIM_LCC_SNPPCI 0x0010 /* snoop PCI bus interrupt acknowledge cycle */ 60159687Snetchild#define PCIM_LCC_SBBASE 0x0008 /* SB base 240h(1)/220h(0) */ 61159687Snetchild#define PCIM_LCC_MPUBASE 0x0006 /* MPU-401 base 300h-330h */ 62159687Snetchild#define PCIM_LCC_LDMA 0x0001 /* Legacy DMA enable */ 63159687Snetchild 64159687Snetchild#define PCIR_SCFG 0x60 /* System Configuration Register */ 65159687Snetchild#define PCIM_SCFG_XIN2 0xc0 /* XIN2 Clock Source Configuration */ 66159687Snetchild /* 00: 22.5792MHz(44.1kHz*512) */ 67159687Snetchild /* 01: 16.9344MHz(44.1kHz*384) */ 68159687Snetchild /* 10: from external clock synthesizer chip */ 69159687Snetchild#define PCIM_SCFG_MPU 0x20 /* 1(0)/2(1) MPU-401 UART(s) */ 70159687Snetchild#define PCIM_SCFG_AC97 0x10 /* 0: AC'97 codec exist */ 71159687Snetchild /* 1: AC'97 codec not exist */ 72159687Snetchild#define PCIM_SCFG_ADC 0x0c /* 1-4 stereo ADC connected */ 73159687Snetchild#define PCIM_SCFG_DAC 0x03 /* 1-4 stereo DAC connected */ 74159687Snetchild 75159687Snetchild#define PCIR_ACL 0x61 /* AC-Link Configuration Register */ 76159687Snetchild#define PCIM_ACL_MTC 0x80 /* Multi-track converter type: 0:AC'97 1:I2S */ 77159687Snetchild#define PCIM_ACL_OMODE 0x02 /* AC 97 codec SDATA_OUT 0:split 1:packed */ 78159687Snetchild#define PCIM_ACL_IMODE 0x01 /* AC 97 codec SDATA_IN 0:split 1:packed */ 79159687Snetchild 80159687Snetchild#define PCIR_I2S 0x62 /* I2S Converters Features Register */ 81159687Snetchild#define PCIM_I2S_VOL 0x80 /* I2S codec Volume and mute */ 82159687Snetchild#define PCIM_I2S_96KHZ 0x40 /* I2S converter 96kHz sampling rate support */ 83159687Snetchild#define PCIM_I2S_RES 0x30 /* Converter resolution */ 84159687Snetchild#define PCIM_I2S_16BIT 0x00 /* 16bit */ 85159687Snetchild#define PCIM_I2S_18BIT 0x10 /* 18bit */ 86159687Snetchild#define PCIM_I2S_20BIT 0x20 /* 20bit */ 87159687Snetchild#define PCIM_I2S_24BIT 0x30 /* 24bit */ 88159687Snetchild#define PCIM_I2S_ID 0x0f /* Other I2S IDs */ 89159687Snetchild 90159687Snetchild#define PCIR_SPDIF 0x63 /* S/PDIF Configuration Register */ 91159687Snetchild#define PCIM_SPDIF_ID 0xfc /* S/PDIF chip ID */ 92159687Snetchild#define PCIM_SPDIF_IN 0x02 /* S/PDIF Stereo In is present */ 93159687Snetchild#define PCIM_SPDIF_OUT 0x01 /* S/PDIF Stereo Out is present */ 94159687Snetchild 95159687Snetchild#define PCIR_POWER_STAT 0x84 /* Power Management Control and Status */ 96159687Snetchild 97159687Snetchild/* Controller Registers */ 98159687Snetchild 99159687Snetchild#define ENVY24_CCS_CTL 0x00 /* Control/Status Register */ 100159687Snetchild#define ENVY24_CCS_CTL_RESET 0x80 /* Entire Chip soft reset */ 101159687Snetchild#define ENVY24_CCS_CTL_DMAINT 0x40 /* DS DMA Channel-C interrupt */ 102159687Snetchild#define ENVY24_CCS_CTL_DOSVOL 0x10 /* set the DOS WT volume control */ 103159687Snetchild#define ENVY24_CCS_CTL_EDGE 0x08 /* SERR# edge (only one PCI clock width) */ 104159687Snetchild#define ENVY24_CCS_CTL_SBINT 0x02 /* SERR# assertion for SB interrupt */ 105159687Snetchild#define ENVY24_CCS_CTL_NATIVE 0x01 /* Mode select: 0:SB mode 1:native mode */ 106159687Snetchild 107159687Snetchild#define ENVY24_CCS_IMASK 0x01 /* Interrupt Mask Register */ 108159687Snetchild#define ENVY24_CCS_IMASK_PMIDI 0x80 /* Primary MIDI */ 109159687Snetchild#define ENVY24_CCS_IMASK_TIMER 0x40 /* Timer */ 110159687Snetchild#define ENVY24_CCS_IMASK_SMIDI 0x20 /* Secondary MIDI */ 111159687Snetchild#define ENVY24_CCS_IMASK_PMT 0x10 /* Professional Multi-track */ 112159687Snetchild#define ENVY24_CCS_IMASK_FM 0x08 /* FM/MIDI trapping */ 113159687Snetchild#define ENVY24_CCS_IMASK_PDMA 0x04 /* Playback DS DMA */ 114159687Snetchild#define ENVY24_CCS_IMASK_RDMA 0x02 /* Consumer record DMA */ 115159687Snetchild#define ENVY24_CCS_IMASK_SB 0x01 /* Consumer/SB mode playback */ 116159687Snetchild 117159687Snetchild#define ENVY24_CCS_ISTAT 0x02 /* Interrupt Status Register */ 118159687Snetchild#define ENVY24_CCS_ISTAT_PMIDI 0x80 /* Primary MIDI */ 119159687Snetchild#define ENVY24_CCS_ISTAT_TIMER 0x40 /* Timer */ 120159687Snetchild#define ENVY24_CCS_ISTAT_SMIDI 0x20 /* Secondary MIDI */ 121159687Snetchild#define ENVY24_CCS_ISTAT_PMT 0x10 /* Professional Multi-track */ 122159687Snetchild#define ENVY24_CCS_ISTAT_FM 0x08 /* FM/MIDI trapping */ 123159687Snetchild#define ENVY24_CCS_ISTAT_PDMA 0x04 /* Playback DS DMA */ 124159687Snetchild#define ENVY24_CCS_ISTAT_RDMA 0x02 /* Consumer record DMA */ 125159687Snetchild#define ENVY24_CCS_ISTAT_SB 0x01 /* Consumer/SB mode playback */ 126159687Snetchild 127159687Snetchild#define ENVY24_CCS_INDEX 0x03 /* Envy24 Index Register */ 128159687Snetchild#define ENVY24_CCS_DATA 0x04 /* Envy24 Data Register */ 129159687Snetchild 130159687Snetchild#define ENVY24_CCS_NMI1 0x05 /* NMI Status Register 1 */ 131159687Snetchild#define ENVY24_CCS_NMI1_PCI 0x80 /* PCI I/O read/write cycle */ 132159687Snetchild#define ENVY24_CCS_NMI1_SB 0x40 /* SB 22C/24C write */ 133159687Snetchild#define ENVY24_CCS_NMI1_SBDMA 0x10 /* SB interrupt (SB DMA/SB F2 command) */ 134159687Snetchild#define ENVY24_CCS_NMI1_DSDMA 0x08 /* DS channel C DMA interrupt */ 135159687Snetchild#define ENVY24_CCS_NMI1_MIDI 0x04 /* MIDI 330h or [PCI_10]h+Ch write */ 136159687Snetchild#define ENVY24_CCS_NMI1_FM 0x01 /* FM data register write */ 137159687Snetchild 138159687Snetchild#define ENVY24_CCS_NMIDAT 0x06 /* NMI Data Register */ 139159687Snetchild#define ENVY24_CCS_NMIIDX 0x07 /* NMI Index Register */ 140159687Snetchild#define ENVY24_CCS_AC97IDX 0x08 /* Consumer AC'97 Index Register */ 141159687Snetchild 142159687Snetchild#define ENVY24_CCS_AC97CMD 0x09 /* Consumer AC'97 Command/Status Register */ 143159687Snetchild#define ENVY24_CCS_AC97CMD_COLD 0x80 /* Cold reset */ 144159687Snetchild#define ENVY24_CCS_AC97CMD_WARM 0x40 /* Warm reset */ 145159687Snetchild#define ENVY24_CCS_AC97CMD_WRCODEC 0x20 /* Write to AC'97 codec registers */ 146159687Snetchild#define ENVY24_CCS_AC97CMD_RDCODEC 0x10 /* Read from AC'97 codec registers */ 147159687Snetchild#define ENVY24_CCS_AC97CMD_READY 0x08 /* AC'97 codec ready status bit */ 148159687Snetchild#define ENVY24_CCS_AC97CMD_PVSR 0x02 /* VSR for Playback */ 149159687Snetchild#define ENVY24_CCS_AC97CMD_RVSR 0x01 /* VSR for Record */ 150159687Snetchild 151159687Snetchild#define ENVY24_CCS_AC97DAT 0x0a /* Consumer AC'97 Data Port Register */ 152159687Snetchild#define ENVY24_CCS_PMIDIDAT 0x0c /* Primary MIDI UART Data Register */ 153159687Snetchild#define ENVY24_CCS_PMIDICMD 0x0d /* Primary MIDI UART Command/Status Register */ 154159687Snetchild 155159687Snetchild#define ENVY24_CCS_NMI2 0x0e /* NMI Status Register 2 */ 156159687Snetchild#define ENVY24_CCS_NMI2_FMBANK 0x30 /* FM bank indicator */ 157159687Snetchild#define ENVY24_CCS_NMI2_FM0 0x10 /* FM bank 0 (388h/220h/228h) */ 158159687Snetchild#define ENVY24_CCS_NMI2_FM1 0x20 /* FM bank 1 (38ah/222h) */ 159159687Snetchild#define ENVY24_CCS_NMI2_PICIO 0x0f /* PIC I/O cycle */ 160159687Snetchild#define ENVY24_CCS_NMI2_PIC20W 0x01 /* 20h write */ 161159687Snetchild#define ENVY24_CCS_NMI2_PICA0W 0x02 /* a0h write */ 162159687Snetchild#define ENVY24_CCS_NMI2_PIC21W 0x05 /* 21h write */ 163159687Snetchild#define ENVY24_CCS_NMI2_PICA1W 0x06 /* a1h write */ 164159687Snetchild#define ENVY24_CCS_NMI2_PIC20R 0x09 /* 20h read */ 165159687Snetchild#define ENVY24_CCS_NMI2_PICA0R 0x0a /* a0h read */ 166159687Snetchild#define ENVY24_CCS_NMI2_PIC21R 0x0d /* 21h read */ 167159687Snetchild#define ENVY24_CCS_NMI2_PICA1R 0x0e /* a1h read */ 168159687Snetchild 169159687Snetchild#define ENVY24_CCS_JOY 0x0f /* Game port register */ 170159687Snetchild 171159687Snetchild#define ENVY24_CCS_I2CDEV 0x10 /* I2C Port Device Address Register */ 172159687Snetchild#define ENVY24_CCS_I2CDEV_ADDR 0xfe /* I2C device address */ 173159687Snetchild#define ENVY24_CCS_I2CDEV_ROM 0xa0 /* reserved for the external I2C E2PROM */ 174159687Snetchild#define ENVY24_CCS_I2CDEV_WR 0x01 /* write */ 175159687Snetchild#define ENVY24_CCS_I2CDEV_RD 0x00 /* read */ 176159687Snetchild 177159687Snetchild#define ENVY24_CCS_I2CADDR 0x11 /* I2C Port Byte Address Register */ 178159687Snetchild#define ENVY24_CCS_I2CDATA 0x12 /* I2C Port Read/Write Data Register */ 179159687Snetchild 180159687Snetchild#define ENVY24_CCS_I2CSTAT 0x13 /* I2C Port Control and Status Register */ 181159687Snetchild#define ENVY24_CCS_I2CSTAT_ROM 0x80 /* external E2PROM exists */ 182159687Snetchild#define ENVY24_CCS_I2CSTAT_BSY 0x01 /* I2C port read/write status busy */ 183159687Snetchild 184159687Snetchild#define ENVY24_CCS_CDMABASE 0x14 /* Consumer Record DMA Current/Base Address Register */ 185159687Snetchild#define ENVY24_CCS_CDMACNT 0x18 /* Consumer Record DMA Current/Base Count Register */ 186159687Snetchild#define ENVY24_CCS_SERR 0x1b /* PCI Configuration SERR# Shadow Register */ 187159687Snetchild#define ENVY24_CCS_SMIDIDAT 0x1c /* Secondary MIDI UART Data Register */ 188159687Snetchild#define ENVY24_CCS_SMIDICMD 0x1d /* Secondary MIDI UART Command/Status Register */ 189159687Snetchild 190159687Snetchild#define ENVY24_CCS_TIMER 0x1e /* Timer Register */ 191159687Snetchild#define ENVY24_CCS_TIMER_EN 0x8000 /* Timer count enable */ 192159687Snetchild#define ENVY24_CCS_TIMER_MASK 0x7fff /* Timer counter mask */ 193159687Snetchild 194159687Snetchild/* Controller Indexed Registers */ 195159687Snetchild 196159687Snetchild#define ENVY24_CCI_PTCHIGH 0x00 /* Playback Terminal Count Register (High Byte) */ 197159687Snetchild#define ENVY24_CCI_PTCLOW 0x01 /* Playback Terminal Count Register (Low Byte) */ 198159687Snetchild 199159687Snetchild#define ENVY24_CCI_PCTL 0x02 /* Playback Control Register */ 200159687Snetchild#define ENVY24_CCI_PCTL_TURBO 0x80 /* 4x up sampling in the host by software */ 201159687Snetchild#define ENVY24_CCI_PCTL_U8 0x10 /* 8 bits unsigned */ 202159687Snetchild#define ENVY24_CCI_PCTL_S16 0x00 /* 16 bits signed */ 203159687Snetchild#define ENVY24_CCI_PCTL_STEREO 0x08 /* stereo */ 204159687Snetchild#define ENVY24_CCI_PCTL_MONO 0x00 /* mono */ 205159687Snetchild#define ENVY24_CCI_PCTL_FLUSH 0x04 /* FIFO flush (sticky bit. Requires toggling) */ 206159687Snetchild#define ENVY24_CCI_PCTL_PAUSE 0x02 /* Pause */ 207159687Snetchild#define ENVY24_CCI_PCTL_ENABLE 0x01 /* Playback enable */ 208159687Snetchild 209159687Snetchild#define ENVY24_CCI_PLVOL 0x03 /* Playback Left Volume/Pan Register */ 210159687Snetchild#define ENVY24_CCI_PRVOL 0x04 /* Playback Right Volume/Pan Register */ 211159687Snetchild#define ENVY24_CCI_VOL_MASK 0x3f /* Volume value mask */ 212159687Snetchild 213159687Snetchild#define ENVY24_CCI_SOFTVOL 0x05 /* Soft Volume/Mute Control Register */ 214159687Snetchild#define ENVY24_CCI_PSRLOW 0x06 /* Playback Sampling Rate Register (Low Byte) */ 215159687Snetchild#define ENVY24_CCI_PSRMID 0x07 /* Playback Sampling Rate Register (Middle Byte) */ 216159687Snetchild#define ENVY24_CCI_PSRHIGH 0x08 /* Playback Sampling Rate Register (High Byte) */ 217159687Snetchild#define ENVY24_CCI_RTCHIGH 0x10 /* Record Terminal Count Register (High Byte) */ 218159687Snetchild#define ENVY24_CCI_RTCLOW 0x11 /* Record Terminal Count Register (Low Byte) */ 219159687Snetchild 220159687Snetchild#define ENVY24_CCI_RCTL 0x12 /* Record Control Register */ 221159687Snetchild#define ENVY24_CCI_RCTL_DRTN 0x80 /* Digital return enable */ 222159687Snetchild#define ENVY24_CCI_RCTL_U8 0x04 /* 8 bits unsigned */ 223159687Snetchild#define ENVY24_CCI_RCTL_S16 0x00 /* 16 bits signed */ 224159687Snetchild#define ENVY24_CCI_RCTL_STEREO 0x00 /* stereo */ 225159687Snetchild#define ENVY24_CCI_RCTL_MONO 0x02 /* mono */ 226159687Snetchild#define ENVY24_CCI_RCTL_ENABLE 0x01 /* Record enable */ 227159687Snetchild 228159687Snetchild#define ENVY24_CCI_GPIODAT 0x20 /* GPIO Data Register */ 229159687Snetchild#define ENVY24_CCI_GPIOMASK 0x21 /* GPIO Write Mask Register */ 230159687Snetchild 231159687Snetchild#define ENVY24_CCI_GPIOCTL 0x22 /* GPIO Direction Control Register */ 232159687Snetchild#define ENVY24_CCI_GPIO_OUT 1 /* output */ 233159687Snetchild#define ENVY24_CCI_GPIO_IN 0 /* input */ 234159687Snetchild 235159687Snetchild#define ENVY24_CCI_CPDWN 0x30 /* Consumer Section Power Down Register */ 236159687Snetchild#define ENVY24_CCI_CPDWN_XTAL 0x80 /* Crystal clock generation power down for XTAL_1 */ 237159687Snetchild#define ENVY24_CCI_CPDWN_GAME 0x40 /* Game port analog power down */ 238159687Snetchild#define ENVY24_CCI_CPDWN_I2C 0x10 /* I2C port clock */ 239159687Snetchild#define ENVY24_CCI_CPDWN_MIDI 0x08 /* MIDI clock */ 240159687Snetchild#define ENVY24_CCI_CPDWN_AC97 0x04 /* AC'97 clock */ 241159687Snetchild#define ENVY24_CCI_CPDWN_DS 0x02 /* DS Block clock */ 242159687Snetchild#define ENVY24_CCI_CPDWN_PCI 0x01 /* PCI clock for SB, DMA controller */ 243159687Snetchild 244159687Snetchild#define ENVY24_CCI_MTPDWN 0x31 /* Multi-Track Section Power Down Register */ 245159687Snetchild#define ENVY24_CCI_MTPDWN_XTAL 0x80 /* Crystal clock generation power down for XTAL_2 */ 246159687Snetchild#define ENVY24_CCI_MTPDWN_SPDIF 0x04 /* S/PDIF clock */ 247159687Snetchild#define ENVY24_CCI_MTPDWN_MIX 0x02 /* Professional digital mixer clock */ 248159687Snetchild#define ENVY24_CCI_MTPDWN_I2S 0x01 /* Multi-track I2S serial interface clock */ 249159687Snetchild 250159687Snetchild/* DDMA Registers */ 251159687Snetchild 252159687Snetchild#define ENVY24_DDMA_ADDR0 0x00 /* DMA Base and Current Address bit 0-7 */ 253159687Snetchild#define ENVY24_DDMA_ADDR8 0x01 /* DMA Base and Current Address bit 8-15 */ 254159687Snetchild#define ENVY24_DDMA_ADDR16 0x02 /* DMA Base and Current Address bit 16-23 */ 255159687Snetchild#define ENVY24_DDMA_ADDR24 0x03 /* DMA Base and Current Address bit 24-31 */ 256159687Snetchild#define ENVY24_DDMA_CNT0 0x04 /* DMA Base and Current Count 0-7 */ 257159687Snetchild#define ENVY24_DDMA_CNT8 0x05 /* DMA Base and Current Count 8-15 */ 258159687Snetchild#define ENVY24_DDMA_CNT16 0x06 /* (not supported) */ 259159687Snetchild#define ENVY24_DDMA_CMD 0x08 /* Status and Command */ 260159687Snetchild#define ENVY24_DDMA_MODE 0x0b /* Mode */ 261159687Snetchild#define ENVY24_DDMA_RESET 0x0c /* Master reset */ 262159687Snetchild#define ENVY24_DDMA_CHAN 0x0f /* Channel Mask */ 263159687Snetchild 264159687Snetchild/* Consumer Section DMA Channel Registers */ 265159687Snetchild 266159687Snetchild#define ENVY24_CS_INTMASK 0x00 /* DirectSound DMA Interrupt Mask Register */ 267159687Snetchild#define ENVY24_CS_INTSTAT 0x02 /* DirectSound DMA Interrupt Status Register */ 268159687Snetchild#define ENVY24_CS_CHDAT 0x04 /* Channel Data register */ 269159687Snetchild 270159687Snetchild#define ENVY24_CS_CHIDX 0x08 /* Channel Index Register */ 271159687Snetchild#define ENVY24_CS_CHIDX_NUM 0xf0 /* Channel number */ 272159687Snetchild#define ENVY24_CS_CHIDX_ADDR0 0x00 /* Buffer_0 DMA base address */ 273159687Snetchild#define ENVY24_CS_CHIDX_CNT0 0x01 /* Buffer_0 DMA base count */ 274159687Snetchild#define ENVY24_CS_CHIDX_ADDR1 0x02 /* Buffer_1 DMA base address */ 275159687Snetchild#define ENVY24_CS_CHIDX_CNT1 0x03 /* Buffer_1 DMA base count */ 276159687Snetchild#define ENVY24_CS_CHIDX_CTL 0x04 /* Channel Control and Status register */ 277159687Snetchild#define ENVY24_CS_CHIDX_RATE 0x05 /* Channel Sampling Rate */ 278159687Snetchild#define ENVY24_CS_CHIDX_VOL 0x06 /* Channel left and right volume/pan control */ 279159687Snetchild/* Channel Control and Status Register at Index 4h */ 280159687Snetchild#define ENVY24_CS_CTL_BUF 0x80 /* indicating that the current active buffer */ 281159687Snetchild#define ENVY24_CS_CTL_AUTO1 0x40 /* Buffer_1 auto init. enable */ 282159687Snetchild#define ENVY24_CS_CTL_AUTO0 0x20 /* Buffer_0 auto init. enable */ 283159687Snetchild#define ENVY24_CS_CTL_FLUSH 0x10 /* Flush FIFO */ 284159687Snetchild#define ENVY24_CS_CTL_STEREO 0x08 /* stereo(or mono) */ 285159687Snetchild#define ENVY24_CS_CTL_U8 0x04 /* 8-bit unsigned(or 16-bit signed) */ 286159687Snetchild#define ENVY24_CS_CTL_PAUSE 0x02 /* DMA request 1:pause */ 287159687Snetchild#define ENVY24_CS_CTL_START 0x01 /* DMA request 1: start, 0:stop */ 288159687Snetchild/* Consumer mode Left/Right Volume Register at Index 06h */ 289159687Snetchild#define ENVY24_CS_VOL_RIGHT 0x3f00 290159687Snetchild#define ENVY24_CS_VOL_LEFT 0x003f 291159687Snetchild 292159687Snetchild/* Professional Multi-Track Control Registers */ 293159687Snetchild 294159687Snetchild#define ENVY24_MT_INT 0x00 /* DMA Interrupt Mask and Status Register */ 295159687Snetchild#define ENVY24_MT_INT_RMASK 0x80 /* Multi-track record interrupt mask */ 296159687Snetchild#define ENVY24_MT_INT_PMASK 0x40 /* Multi-track playback interrupt mask */ 297159687Snetchild#define ENVY24_MT_INT_RSTAT 0x02 /* Multi-track record interrupt status */ 298159687Snetchild#define ENVY24_MT_INT_PSTAT 0x01 /* Multi-track playback interrupt status */ 299159687Snetchild 300159687Snetchild#define ENVY24_MT_RATE 0x01 /* Sampling Rate Select Register */ 301159687Snetchild#define ENVY24_MT_RATE_SPDIF 0x10 /* S/PDIF input clock as the master */ 302159687Snetchild#define ENVY24_MT_RATE_48000 0x00 303159687Snetchild#define ENVY24_MT_RATE_24000 0x01 304159687Snetchild#define ENVY24_MT_RATE_12000 0x02 305159687Snetchild#define ENVY24_MT_RATE_9600 0x03 306159687Snetchild#define ENVY24_MT_RATE_32000 0x04 307159687Snetchild#define ENVY24_MT_RATE_16000 0x05 308159687Snetchild#define ENVY24_MT_RATE_8000 0x06 309159687Snetchild#define ENVY24_MT_RATE_96000 0x07 310159687Snetchild#define ENVY24_MT_RATE_64000 0x0f 311159687Snetchild#define ENVY24_MT_RATE_44100 0x08 312159687Snetchild#define ENVY24_MT_RATE_22050 0x09 313159687Snetchild#define ENVY24_MT_RATE_11025 0x0a 314159687Snetchild#define ENVY24_MT_RATE_88200 0x0b 315159687Snetchild#define ENVY24_MT_RATE_MASK 0x0f 316159687Snetchild 317159687Snetchild#define ENVY24_MT_I2S 0x02 /* I2S Data Format Register */ 318159687Snetchild#define ENVY24_MT_I2S_MLR128 0x08 /* MCLK/LRCLK ratio 128x(or 256x) */ 319159687Snetchild#define ENVY24_MT_I2S_SLR48 0x04 /* SCLK/LRCLK ratio 48bpf(or 64bpf) */ 320159687Snetchild#define ENVY24_MT_I2S_FORM 0x00 /* I2S data format */ 321159687Snetchild 322159687Snetchild#define ENVY24_MT_AC97IDX 0x04 /* Index Register for AC'97 Codecs */ 323159687Snetchild 324159687Snetchild#define ENVY24_MT_AC97CMD 0x05 /* Command and Status Register for AC'97 Codecs */ 325159687Snetchild#define ENVY24_MT_AC97CMD_CLD 0x80 /* Cold reset */ 326159687Snetchild#define ENVY24_MT_AC97CMD_WRM 0x40 /* Warm reset */ 327159687Snetchild#define ENVY24_MT_AC97CMD_WR 0x20 /* write to AC'97 codec register */ 328159687Snetchild#define ENVY24_MT_AC97CMD_RD 0x10 /* read AC'97 CODEC register */ 329159687Snetchild#define ENVY24_MT_AC97CMD_RDY 0x08 /* AC'97 codec ready status bit */ 330159687Snetchild#define ENVY24_MT_AC97CMD_ID 0x03 /* ID(0-3) for external AC 97 registers */ 331159687Snetchild 332159687Snetchild#define ENVY24_MT_AC97DLO 0x06 /* AC'97 codec register data low byte */ 333159687Snetchild#define ENVY24_MT_AC97DHI 0x07 /* AC'97 codec register data high byte */ 334159687Snetchild#define ENVY24_MT_PADDR 0x10 /* Playback DMA Current/Base Address Register */ 335159687Snetchild#define ENVY24_MT_PCNT 0x14 /* Playback DMA Current/Base Count Register */ 336159687Snetchild#define ENVY24_MT_PTERM 0x16 /* Playback Current/Base Terminal Count Register */ 337159687Snetchild#define ENVY24_MT_PCTL 0x18 /* Playback and Record Control Register */ 338159687Snetchild#define ENVY24_MT_PCTL_RSTART 0x04 /* 1: Record start; 0: Record stop */ 339159687Snetchild#define ENVY24_MT_PCTL_PAUSE 0x02 /* 1: Pause; 0: Resume */ 340159687Snetchild#define ENVY24_MT_PCTL_PSTART 0x01 /* 1: Playback start; 0: Playback stop */ 341159687Snetchild 342159687Snetchild#define ENVY24_MT_RADDR 0x20 /* Record DMA Current/Base Address Register */ 343159687Snetchild#define ENVY24_MT_RCNT 0x24 /* Record DMA Current/Base Count Register */ 344159687Snetchild#define ENVY24_MT_RTERM 0x26 /* Record Current/Base Terminal Count Register */ 345159687Snetchild#define ENVY24_MT_RCTL 0x28 /* Record Control Register */ 346159687Snetchild#define ENVY24_MT_RCTL_RSTART 0x01 /* 1: Record start; 0: Record stop */ 347159687Snetchild 348159687Snetchild#define ENVY24_MT_PSDOUT 0x30 /* Routing Control Register for Data to PSDOUT[0:3] */ 349159687Snetchild#define ENVY24_MT_SPDOUT 0x32 /* Routing Control Register for SPDOUT */ 350159687Snetchild#define ENVY24_MT_RECORD 0x34 /* Captured (Recorded) data Routing Selection Register */ 351159687Snetchild 352159687Snetchild#define BUS_SPACE_MAXADDR_ENVY24 0x0fffffff /* Address space beyond 256MB is not supported */ 353159687Snetchild#define BUS_SPACE_MAXSIZE_ENVY24 0x3fffc /* 64k x 4byte(1dword) */ 354159687Snetchild 355159687Snetchild#define ENVY24_MT_VOLUME 0x38 /* Left/Right Volume Control Data Register */ 356159687Snetchild#define ENVY24_MT_VOLUME_L 0x007f /* Left Volume Mask */ 357159687Snetchild#define ENVY24_MT_VOLUME_R 0x7f00 /* Right Volume Mask */ 358159687Snetchild 359159687Snetchild#define ENVY24_MT_VOLIDX 0x3a /* Volume Control Stream Index Register */ 360159687Snetchild#define ENVY24_MT_VOLRATE 0x3b /* Volume Control Rate Register */ 361159687Snetchild#define ENVY24_MT_MONAC97 0x3c /* Digital Mixer Monitor Routing Control Register */ 362159687Snetchild#define ENVY24_MT_PEAKIDX 0x3e /* Peak Meter Index Register */ 363159687Snetchild#define ENVY24_MT_PEAKDAT 0x3f /* Peak Meter Data Register */ 364159687Snetchild 365159687Snetchild/* -------------------------------------------------------------------- */ 366159687Snetchild 367159687Snetchild/* ENVY24 mixer channel defines */ 368159687Snetchild/* 369159687Snetchild ENVY24 mixer has original line matrix. So, general mixer command is not 370159687Snetchild able to use for this. If system has consumer AC'97 output, AC'97 line is 371159687Snetchild used as master mixer, and it is able to control. 372159687Snetchild*/ 373159687Snetchild#define ENVY24_CHAN_NUM 11 /* Play * 5 + Record * 5 + Mix * 1 */ 374159687Snetchild 375159687Snetchild#define ENVY24_CHAN_PLAY_DAC1 0 376159687Snetchild#define ENVY24_CHAN_PLAY_DAC2 1 377159687Snetchild#define ENVY24_CHAN_PLAY_DAC3 2 378159687Snetchild#define ENVY24_CHAN_PLAY_DAC4 3 379159687Snetchild#define ENVY24_CHAN_PLAY_SPDIF 4 380159687Snetchild#define ENVY24_CHAN_REC_ADC1 5 381159687Snetchild#define ENVY24_CHAN_REC_ADC2 6 382159687Snetchild#define ENVY24_CHAN_REC_ADC3 7 383159687Snetchild#define ENVY24_CHAN_REC_ADC4 8 384159687Snetchild#define ENVY24_CHAN_REC_SPDIF 9 385159687Snetchild#define ENVY24_CHAN_REC_MIX 10 386159687Snetchild 387159687Snetchild#define ENVY24_MIX_MASK 0x3ff 388159687Snetchild#define ENVY24_MIX_REC_MASK 0x3e0 389159687Snetchild 390159687Snetchild/* volume value constants */ 391159687Snetchild#define ENVY24_VOL_MAX 0 /* 0db(negate) */ 392159687Snetchild#define ENVY24_VOL_MIN 96 /* -144db(negate) */ 393159687Snetchild#define ENVY24_VOL_MUTE 127 /* mute */ 394159687Snetchild 395159687Snetchild/* -------------------------------------------------------------------- */ 396159687Snetchild 397159687Snetchild/* ENVY24 routing control defines */ 398159687Snetchild/* 399159687Snetchild ENVY24 has input->output data routing matrix switch. But original ENVY24 400159687Snetchild matrix control is so complex. So, in this driver, matrix control is 401159687Snetchild defined 4 parameters. 402159687Snetchild 403159687Snetchild 1: output DAC channels (include S/PDIF output) 404159687Snetchild 2: output data classes 405159687Snetchild a. direct output from DMA 406159687Snetchild b. MIXER output which mixed the DMA outputs and input channels 407159687Snetchild (NOTICE: this class is able to set only DAC-1 and S/PDIF output) 408159687Snetchild c. direct input from ADC 409159687Snetchild d. direct input from S/PDIF 410159687Snetchild 3: input ADC channel selection(when 2:c. is selected) 411159687Snetchild 4: left/right reverse 412159687Snetchild 413159687Snetchild These parameters matrix is bit reduced from original ENVY24 matrix 414159687Snetchild pattern(ex. route different ADC input to one DAC). But almost case 415159687Snetchild this is enough to use. 416159687Snetchild*/ 417159687Snetchild#define ENVY24_ROUTE_DAC_1 0 418159687Snetchild#define ENVY24_ROUTE_DAC_2 1 419159687Snetchild#define ENVY24_ROUTE_DAC_3 2 420159687Snetchild#define ENVY24_ROUTE_DAC_4 3 421159687Snetchild#define ENVY24_ROUTE_DAC_SPDIF 4 422159687Snetchild 423159687Snetchild#define ENVY24_ROUTE_CLASS_DMA 0 424159687Snetchild#define ENVY24_ROUTE_CLASS_MIX 1 425159687Snetchild#define ENVY24_ROUTE_CLASS_ADC 2 426159687Snetchild#define ENVY24_ROUTE_CLASS_SPDIF 3 427159687Snetchild 428159687Snetchild#define ENVY24_ROUTE_ADC_1 0 429159687Snetchild#define ENVY24_ROUTE_ADC_2 1 430159687Snetchild#define ENVY24_ROUTE_ADC_3 2 431159687Snetchild#define ENVY24_ROUTE_ADC_4 3 432159687Snetchild 433159687Snetchild#define ENVY24_ROUTE_NORMAL 0 434159687Snetchild#define ENVY24_ROUTE_REVERSE 1 435159687Snetchild#define ENVY24_ROUTE_LEFT 0 436159687Snetchild#define ENVY24_ROUTE_RIGHT 1 437159687Snetchild 438159687Snetchild/* -------------------------------------------------------------------- */ 439159687Snetchild 440159687Snetchild/* 441159687Snetchild These map values are refferd from ALSA sound driver. 442159687Snetchild*/ 443159687Snetchild/* ENVY24 configuration E2PROM map */ 444159687Snetchild#define ENVY24_E2PROM_SUBVENDOR 0x00 445159687Snetchild#define ENVY24_E2PROM_SUBDEVICE 0x02 446159687Snetchild#define ENVY24_E2PROM_SIZE 0x04 447159687Snetchild#define ENVY24_E2PROM_VERSION 0x05 448159687Snetchild#define ENVY24_E2PROM_SCFG 0x06 449159687Snetchild#define ENVY24_E2PROM_ACL 0x07 450159687Snetchild#define ENVY24_E2PROM_I2S 0x08 451159687Snetchild#define ENVY24_E2PROM_SPDIF 0x09 452159687Snetchild#define ENVY24_E2PROM_GPIOMASK 0x0a 453159687Snetchild#define ENVY24_E2PROM_GPIOSTATE 0x0b 454159687Snetchild#define ENVY24_E2PROM_GPIODIR 0x0c 455159687Snetchild#define ENVY24_E2PROM_AC97MAIN 0x0d 456159687Snetchild#define ENVY24_E2PROM_AC97PCM 0x0f 457159687Snetchild#define ENVY24_E2PROM_AC97REC 0x11 458159687Snetchild#define ENVY24_E2PROM_AC97RECSRC 0x13 459159687Snetchild#define ENVY24_E2PROM_DACID 0x14 460159687Snetchild#define ENVY24_E2PROM_ADCID 0x18 461159687Snetchild#define ENVY24_E2PROM_EXTRA 0x1c 462159687Snetchild 463159687Snetchild/* GPIO connect map of M-Audio Delta series */ 464159687Snetchild#define ENVY24_GPIO_CS84X4_PRO 0x01 465159687Snetchild#define ENVY24_GPIO_CS8414_STATUS 0x02 466159687Snetchild#define ENVY24_GPIO_CS84X4_CLK 0x04 467159687Snetchild#define ENVY24_GPIO_CS84X4_DATA 0x08 468159687Snetchild#define ENVY24_GPIO_AK4524_CDTI 0x10 /* this value is duplicated to input select */ 469159687Snetchild#define ENVY24_GPIO_AK4524_CCLK 0x20 470159687Snetchild#define ENVY24_GPIO_AK4524_CS0 0x40 471159687Snetchild#define ENVY24_GPIO_AK4524_CS1 0x80 472159687Snetchild 473159687Snetchild/* M-Audio Delta series S/PDIF(CS84[01]4) control pin values */ 474159687Snetchild#define ENVY24_CS8404_PRO_RATE 0x18 475159687Snetchild#define ENVY24_CS8404_PRO_RATE32 0x00 476159687Snetchild#define ENVY24_CS8404_PRO_RATE441 0x10 477159687Snetchild#define ENVY24_CS8404_PRO_RATE48 0x08 478159687Snetchild 479159687Snetchild/* M-Audio Delta series parameter */ 480159687Snetchild#define ENVY24_DELTA_AK4524_CIF 0 481159687Snetchild 482170031Sjoel#define I2C_DELAY 1000 483170031Sjoel 484170031Sjoel/* PCA9554 registers */ 485170031Sjoel#define PCA9554_I2CDEV 0x40 /* I2C device address */ 486170031Sjoel#define PCA9554_IN 0x00 /* input port */ 487170031Sjoel#define PCA9554_OUT 0x01 /* output port */ 488170031Sjoel#define PCA9554_INVERT 0x02 /* polarity invert */ 489170031Sjoel#define PCA9554_DIR 0x03 /* port directions */ 490170031Sjoel 491170031Sjoel/* PCF8574 registers */ 492170031Sjoel#define PCF8574_I2CDEV_DAC 0x48 493170031Sjoel#define PCF8574_SENSE_MASK 0x40 494170031Sjoel 495159687Snetchild/* end of file */ 496