/*- * amd cs5536 audio driver * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ #define NUM_PRD_ELEMS 3 /* 2 DMA descriptors plus 1 jump */ #define CH_INPUT 2 /* RECORD */ #define CH_OUTPUT 3 /* PLAY */ #define CODEC_COMMAND 0x30 #define CODEC_READ_B 0x80 #define CODEC_STATUS 0x30 #define CODEC_BUSY_B 0x01 #define CODEC_DATA 0x32 #define GPIO_DATA 0x60 #define GPIO_DATA_MASK 0x0FFF #define GPIO_HV_STATUS 0x3000 #define GPIO_PME_STATUS 0x4000 #define GPIO_MASK 0x64 #define GPIO_DIRECTION 0x68 #define GPO_PRIMARY_AC97 0x0001 #define GPI_LINEOUT_SENSE 0x0004 #define GPO_SECONDARY_AC97 0x0008 #define GPI_VOL_DOWN 0x0010 #define GPI_VOL_UP 0x0020 #define GPI_IIS_CLK 0x0040 #define GPI_IIS_LRCLK 0x0080 #define GPI_IIS_DATA 0x0100 #define GPI_DOCKING_STATUS 0x0100 #define GPI_HEADPHONE_SENSE 0x0200 #define GPO_EXT_AMP_SHUTDOWN 0x1000 #define FRONT_DAC_RATE 0x2C #define SURR_DAC_RATE 0x2E #define LFE_DAC_RATE 0x30 #define L_R_ADC_RATE 0x32 #define MIC_ADC_RATE 0x34 #define ACC_GPIO_STATUS 0x00 #define ACC_GPIO_CNTL 0x04 #define ACC_CODEC_STATUS 0x08 #define PRIMARY_RDY 0x800000 #define SECONDAR_RDY 0x400000 #define STATUS_ADDR 0xFF000000 #define STATUS_NEW 0x20000 #define ACC_CODEC_CNTL 0x0C #define RW_CMD 0x80000000 #define CMD_ADD 0x7F000000 #define COMM_SEL 0xC00000 /* 00 = 1st Codec 01 = 2nd 10 = 3rd etc */ #define CMD_NEW 0x10000 /* Must wait till clear to issue another cmd */ #define EOP 0x01 #define BM_EOP_ERR 0x02 #define ACC_IRQ_STATUS 0x12 #define ACC_BM0_CMD 0x20 #define ACC_BM1_CMD 0x28 #define ACC_BM2_CMD 0x30 #define ACC_BM3_CMD 0x38 #define ACC_BM4_CMD 0x40 #define ACC_BM5_CMD 0x48 #define ACC_BM6_CMD 0x50 #define ACC_BM7_CMD 0x58 #define ACC_BM0_PRD 0x24 #define ACC_BM1_PRD 0x2C #define ACC_BM2_PRD 0x34 #define ACC_BM3_PRD 0x3C #define ACC_BM4_PRD 0x44 #define ACC_BM5_PRD 0x4C #define ACC_BM6_PRD 0x54 #define ACC_BM7_PRD 0x5C #define ACC_BM0_STATUS 0x21 #define ACC_BM1_STATUS 0x29 #define ACC_BM2_STATUS 0x31 #define ACC_BM3_STATUS 0x39 #define ACC_BM4_STATUS 0x41 #define ACC_BM5_STATUS 0x49 #define ACC_BM6_STATUS 0x51 #define ACC_BM7_STATUS 0x59 #define ACC_BM0_PNTR 0x60 #define ACC_BM1_PNTR 0x64 #define ACC_BM2_PNTR 0x68 #define ACC_BM3_PNTR 0x6C #define ACC_BM4_PNTR 0x70 #define ACC_BM5_PNTR 0x74 #define ACC_BM6_PNTR 0x78 #define ACC_BM7_PNTR 0x7C /* acc_codec bar0 reg bits */ /* ACC_IRQ_STATUS */ #define IRQ_STS 0 #define WU_IRQ_STS 1 #define BM0_IRQ_STS 2 #define BM1_IRQ_STS 3 #define BM2_IRQ_STS 4 #define BM3_IRQ_STS 5 #define BM4_IRQ_STS 6 #define BM5_IRQ_STS 7 #define BM6_IRQ_STS 8 #define BM7_IRQ_STS 9 /* AC97 registers */ #define AC97_VOL_MUTE_B 0x8000 #define AC97_VOL_M 0x1F #define AC97_LEFT_VOL_S 8 #define AC97_MASTER_VOL 0x02 #define AC97_LINE_LEVEL_VOL 0x04 #define AC97_MASTER_MONO_VOL 0x06 #define AC97_PC_BEEP_VOL 0x0A #define AC97_PC_BEEP_VOL_M 0x0F #define AC97_SROUND_MASTER_VOL 0x38 #define AC97_PC_BEEP_VOL_S 1 #define AC97_PHONE_VOL 0x0C #define AC97_MIC_VOL 0x0E #define AC97_MIC_20DB_ENABLE 0x40 #define AC97_LINEIN_VOL 0x10 #define AC97_CD_VOL 0x12 #define AC97_VIDEO_VOL 0x14 #define AC97_AUX_VOL 0x16 #define AC97_PCM_OUT_VOL 0x18 #define AC97_RECORD_SELECT 0x1A #define AC97_RECORD_MIC 0x00 #define AC97_RECORD_CD 0x01 #define AC97_RECORD_VIDEO 0x02 #define AC97_RECORD_AUX 0x03 #define AC97_RECORD_MONO_MUX 0x02 #define AC97_RECORD_DIGITAL 0x03 #define AC97_RECORD_LINE 0x04 #define AC97_RECORD_STEREO 0x05 #define AC97_RECORD_MONO 0x06 #define AC97_RECORD_PHONE 0x07 #define AC97_RECORD_GAIN 0x1C #define AC97_RECORD_VOL_M 0x0F #define AC97_GENERAL_PURPOSE 0x20 #define AC97_POWER_DOWN_CTRL 0x26 #define AC97_ADC_READY 0x0001 #define AC97_DAC_READY 0x0002 #define AC97_ANALOG_READY 0x0004 #define AC97_VREF_ON 0x0008 #define AC97_PR0 0x0100 #define AC97_PR1 0x0200 #define AC97_PR2 0x0400 #define AC97_PR3 0x0800 #define AC97_PR4 0x1000 #define AC97_RESERVED1 0x28 #define AC97_VENDOR_TEST 0x5A #define AC97_CLOCK_DELAY 0x5C #define AC97_LINEOUT_MUX_SEL 0x0001 #define AC97_MONO_MUX_SEL 0x0002 #define AC97_CLOCK_DELAY_SEL 0x1F #define AC97_DAC_CDS_SHIFT 6 #define AC97_ADC_CDS_SHIFT 11 #define AC97_MULTI_CHANNEL_SEL 0x74 #define AC97_VENDOR_ID1 0x7C #define AC97_VENDOR_ID2 0x7E