18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (c) by James Courtier-Dutton <James@superbug.demon.co.uk> 48c2ecf20Sopenharmony_ci * Driver p17v chips 58c2ecf20Sopenharmony_ci * Version: 0.01 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci/******************************************************************************/ 98c2ecf20Sopenharmony_ci/* Audigy2Value Tina (P17V) pointer-offset register set, 108c2ecf20Sopenharmony_ci * accessed through the PTR20 and DATA24 registers */ 118c2ecf20Sopenharmony_ci/******************************************************************************/ 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci/* 00 - 07: Not used */ 148c2ecf20Sopenharmony_ci#define P17V_PLAYBACK_FIFO_PTR 0x08 /* Current playback fifo pointer 158c2ecf20Sopenharmony_ci * and number of sound samples in cache. 168c2ecf20Sopenharmony_ci */ 178c2ecf20Sopenharmony_ci/* 09 - 12: Not used */ 188c2ecf20Sopenharmony_ci#define P17V_CAPTURE_FIFO_PTR 0x13 /* Current capture fifo pointer 198c2ecf20Sopenharmony_ci * and number of sound samples in cache. 208c2ecf20Sopenharmony_ci */ 218c2ecf20Sopenharmony_ci/* 14 - 17: Not used */ 228c2ecf20Sopenharmony_ci#define P17V_PB_CHN_SEL 0x18 /* P17v playback channel select */ 238c2ecf20Sopenharmony_ci#define P17V_SE_SLOT_SEL_L 0x19 /* Sound Engine slot select low */ 248c2ecf20Sopenharmony_ci#define P17V_SE_SLOT_SEL_H 0x1a /* Sound Engine slot select high */ 258c2ecf20Sopenharmony_ci/* 1b - 1f: Not used */ 268c2ecf20Sopenharmony_ci/* 20 - 2f: Not used */ 278c2ecf20Sopenharmony_ci/* 30 - 3b: Not used */ 288c2ecf20Sopenharmony_ci#define P17V_SPI 0x3c /* SPI interface register */ 298c2ecf20Sopenharmony_ci#define P17V_I2C_ADDR 0x3d /* I2C Address */ 308c2ecf20Sopenharmony_ci#define P17V_I2C_0 0x3e /* I2C Data */ 318c2ecf20Sopenharmony_ci#define P17V_I2C_1 0x3f /* I2C Data */ 328c2ecf20Sopenharmony_ci/* I2C values */ 338c2ecf20Sopenharmony_ci#define I2C_A_ADC_ADD_MASK 0x000000fe /*The address is a 7 bit address */ 348c2ecf20Sopenharmony_ci#define I2C_A_ADC_RW_MASK 0x00000001 /*bit mask for R/W */ 358c2ecf20Sopenharmony_ci#define I2C_A_ADC_TRANS_MASK 0x00000010 /*Bit mask for I2c address DAC value */ 368c2ecf20Sopenharmony_ci#define I2C_A_ADC_ABORT_MASK 0x00000020 /*Bit mask for I2C transaction abort flag */ 378c2ecf20Sopenharmony_ci#define I2C_A_ADC_LAST_MASK 0x00000040 /*Bit mask for Last word transaction */ 388c2ecf20Sopenharmony_ci#define I2C_A_ADC_BYTE_MASK 0x00000080 /*Bit mask for Byte Mode */ 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci#define I2C_A_ADC_ADD 0x00000034 /*This is the Device address for ADC */ 418c2ecf20Sopenharmony_ci#define I2C_A_ADC_READ 0x00000001 /*To perform a read operation */ 428c2ecf20Sopenharmony_ci#define I2C_A_ADC_START 0x00000100 /*Start I2C transaction */ 438c2ecf20Sopenharmony_ci#define I2C_A_ADC_ABORT 0x00000200 /*I2C transaction abort */ 448c2ecf20Sopenharmony_ci#define I2C_A_ADC_LAST 0x00000400 /*I2C last transaction */ 458c2ecf20Sopenharmony_ci#define I2C_A_ADC_BYTE 0x00000800 /*I2C one byte mode */ 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci#define I2C_D_ADC_REG_MASK 0xfe000000 /*ADC address register */ 488c2ecf20Sopenharmony_ci#define I2C_D_ADC_DAT_MASK 0x01ff0000 /*ADC data register */ 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci#define ADC_TIMEOUT 0x00000007 /*ADC Timeout Clock Disable */ 518c2ecf20Sopenharmony_ci#define ADC_IFC_CTRL 0x0000000b /*ADC Interface Control */ 528c2ecf20Sopenharmony_ci#define ADC_MASTER 0x0000000c /*ADC Master Mode Control */ 538c2ecf20Sopenharmony_ci#define ADC_POWER 0x0000000d /*ADC PowerDown Control */ 548c2ecf20Sopenharmony_ci#define ADC_ATTEN_ADCL 0x0000000e /*ADC Attenuation ADCL */ 558c2ecf20Sopenharmony_ci#define ADC_ATTEN_ADCR 0x0000000f /*ADC Attenuation ADCR */ 568c2ecf20Sopenharmony_ci#define ADC_ALC_CTRL1 0x00000010 /*ADC ALC Control 1 */ 578c2ecf20Sopenharmony_ci#define ADC_ALC_CTRL2 0x00000011 /*ADC ALC Control 2 */ 588c2ecf20Sopenharmony_ci#define ADC_ALC_CTRL3 0x00000012 /*ADC ALC Control 3 */ 598c2ecf20Sopenharmony_ci#define ADC_NOISE_CTRL 0x00000013 /*ADC Noise Gate Control */ 608c2ecf20Sopenharmony_ci#define ADC_LIMIT_CTRL 0x00000014 /*ADC Limiter Control */ 618c2ecf20Sopenharmony_ci#define ADC_MUX 0x00000015 /*ADC Mux offset */ 628c2ecf20Sopenharmony_ci#if 0 638c2ecf20Sopenharmony_ci/* FIXME: Not tested yet. */ 648c2ecf20Sopenharmony_ci#define ADC_GAIN_MASK 0x000000ff //Mask for ADC Gain 658c2ecf20Sopenharmony_ci#define ADC_ZERODB 0x000000cf //Value to set ADC to 0dB 668c2ecf20Sopenharmony_ci#define ADC_MUTE_MASK 0x000000c0 //Mask for ADC mute 678c2ecf20Sopenharmony_ci#define ADC_MUTE 0x000000c0 //Value to mute ADC 688c2ecf20Sopenharmony_ci#define ADC_OSR 0x00000008 //Mask for ADC oversample rate select 698c2ecf20Sopenharmony_ci#define ADC_TIMEOUT_DISABLE 0x00000008 //Value and mask to disable Timeout clock 708c2ecf20Sopenharmony_ci#define ADC_HPF_DISABLE 0x00000100 //Value and mask to disable High pass filter 718c2ecf20Sopenharmony_ci#define ADC_TRANWIN_MASK 0x00000070 //Mask for Length of Transient Window 728c2ecf20Sopenharmony_ci#endif 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci#define ADC_MUX_MASK 0x0000000f //Mask for ADC Mux 758c2ecf20Sopenharmony_ci#define ADC_MUX_0 0x00000001 //Value to select Unknown at ADC Mux (Not used) 768c2ecf20Sopenharmony_ci#define ADC_MUX_1 0x00000002 //Value to select Unknown at ADC Mux (Not used) 778c2ecf20Sopenharmony_ci#define ADC_MUX_2 0x00000004 //Value to select Mic at ADC Mux 788c2ecf20Sopenharmony_ci#define ADC_MUX_3 0x00000008 //Value to select Line-In at ADC Mux 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_ci#define P17V_START_AUDIO 0x40 /* Start Audio bit */ 818c2ecf20Sopenharmony_ci/* 41 - 47: Reserved */ 828c2ecf20Sopenharmony_ci#define P17V_START_CAPTURE 0x48 /* Start Capture bit */ 838c2ecf20Sopenharmony_ci#define P17V_CAPTURE_FIFO_BASE 0x49 /* Record FIFO base address */ 848c2ecf20Sopenharmony_ci#define P17V_CAPTURE_FIFO_SIZE 0x4a /* Record FIFO buffer size */ 858c2ecf20Sopenharmony_ci#define P17V_CAPTURE_FIFO_INDEX 0x4b /* Record FIFO capture index */ 868c2ecf20Sopenharmony_ci#define P17V_CAPTURE_VOL_H 0x4c /* P17v capture volume control */ 878c2ecf20Sopenharmony_ci#define P17V_CAPTURE_VOL_L 0x4d /* P17v capture volume control */ 888c2ecf20Sopenharmony_ci/* 4e - 4f: Not used */ 898c2ecf20Sopenharmony_ci/* 50 - 5f: Not used */ 908c2ecf20Sopenharmony_ci#define P17V_SRCSel 0x60 /* SRC48 and SRCMulti sample rate select 918c2ecf20Sopenharmony_ci * and output select 928c2ecf20Sopenharmony_ci */ 938c2ecf20Sopenharmony_ci#define P17V_MIXER_AC97_10K1_VOL_L 0x61 /* 10K to Mixer_AC97 input volume control */ 948c2ecf20Sopenharmony_ci#define P17V_MIXER_AC97_10K1_VOL_H 0x62 /* 10K to Mixer_AC97 input volume control */ 958c2ecf20Sopenharmony_ci#define P17V_MIXER_AC97_P17V_VOL_L 0x63 /* P17V to Mixer_AC97 input volume control */ 968c2ecf20Sopenharmony_ci#define P17V_MIXER_AC97_P17V_VOL_H 0x64 /* P17V to Mixer_AC97 input volume control */ 978c2ecf20Sopenharmony_ci#define P17V_MIXER_AC97_SRP_REC_VOL_L 0x65 /* SRP Record to Mixer_AC97 input volume control */ 988c2ecf20Sopenharmony_ci#define P17V_MIXER_AC97_SRP_REC_VOL_H 0x66 /* SRP Record to Mixer_AC97 input volume control */ 998c2ecf20Sopenharmony_ci/* 67 - 68: Reserved */ 1008c2ecf20Sopenharmony_ci#define P17V_MIXER_Spdif_10K1_VOL_L 0x69 /* 10K to Mixer_Spdif input volume control */ 1018c2ecf20Sopenharmony_ci#define P17V_MIXER_Spdif_10K1_VOL_H 0x6A /* 10K to Mixer_Spdif input volume control */ 1028c2ecf20Sopenharmony_ci#define P17V_MIXER_Spdif_P17V_VOL_L 0x6B /* P17V to Mixer_Spdif input volume control */ 1038c2ecf20Sopenharmony_ci#define P17V_MIXER_Spdif_P17V_VOL_H 0x6C /* P17V to Mixer_Spdif input volume control */ 1048c2ecf20Sopenharmony_ci#define P17V_MIXER_Spdif_SRP_REC_VOL_L 0x6D /* SRP Record to Mixer_Spdif input volume control */ 1058c2ecf20Sopenharmony_ci#define P17V_MIXER_Spdif_SRP_REC_VOL_H 0x6E /* SRP Record to Mixer_Spdif input volume control */ 1068c2ecf20Sopenharmony_ci/* 6f - 70: Reserved */ 1078c2ecf20Sopenharmony_ci#define P17V_MIXER_I2S_10K1_VOL_L 0x71 /* 10K to Mixer_I2S input volume control */ 1088c2ecf20Sopenharmony_ci#define P17V_MIXER_I2S_10K1_VOL_H 0x72 /* 10K to Mixer_I2S input volume control */ 1098c2ecf20Sopenharmony_ci#define P17V_MIXER_I2S_P17V_VOL_L 0x73 /* P17V to Mixer_I2S input volume control */ 1108c2ecf20Sopenharmony_ci#define P17V_MIXER_I2S_P17V_VOL_H 0x74 /* P17V to Mixer_I2S input volume control */ 1118c2ecf20Sopenharmony_ci#define P17V_MIXER_I2S_SRP_REC_VOL_L 0x75 /* SRP Record to Mixer_I2S input volume control */ 1128c2ecf20Sopenharmony_ci#define P17V_MIXER_I2S_SRP_REC_VOL_H 0x76 /* SRP Record to Mixer_I2S input volume control */ 1138c2ecf20Sopenharmony_ci/* 77 - 78: Reserved */ 1148c2ecf20Sopenharmony_ci#define P17V_MIXER_AC97_ENABLE 0x79 /* Mixer AC97 input audio enable */ 1158c2ecf20Sopenharmony_ci#define P17V_MIXER_SPDIF_ENABLE 0x7A /* Mixer SPDIF input audio enable */ 1168c2ecf20Sopenharmony_ci#define P17V_MIXER_I2S_ENABLE 0x7B /* Mixer I2S input audio enable */ 1178c2ecf20Sopenharmony_ci#define P17V_AUDIO_OUT_ENABLE 0x7C /* Audio out enable */ 1188c2ecf20Sopenharmony_ci#define P17V_MIXER_ATT 0x7D /* SRP Mixer Attenuation Select */ 1198c2ecf20Sopenharmony_ci#define P17V_SRP_RECORD_SRR 0x7E /* SRP Record channel source Select */ 1208c2ecf20Sopenharmony_ci#define P17V_SOFT_RESET_SRP_MIXER 0x7F /* SRP and mixer soft reset */ 1218c2ecf20Sopenharmony_ci 1228c2ecf20Sopenharmony_ci#define P17V_AC97_OUT_MASTER_VOL_L 0x80 /* AC97 Output master volume control */ 1238c2ecf20Sopenharmony_ci#define P17V_AC97_OUT_MASTER_VOL_H 0x81 /* AC97 Output master volume control */ 1248c2ecf20Sopenharmony_ci#define P17V_SPDIF_OUT_MASTER_VOL_L 0x82 /* SPDIF Output master volume control */ 1258c2ecf20Sopenharmony_ci#define P17V_SPDIF_OUT_MASTER_VOL_H 0x83 /* SPDIF Output master volume control */ 1268c2ecf20Sopenharmony_ci#define P17V_I2S_OUT_MASTER_VOL_L 0x84 /* I2S Output master volume control */ 1278c2ecf20Sopenharmony_ci#define P17V_I2S_OUT_MASTER_VOL_H 0x85 /* I2S Output master volume control */ 1288c2ecf20Sopenharmony_ci/* 86 - 87: Not used */ 1298c2ecf20Sopenharmony_ci#define P17V_I2S_CHANNEL_SWAP_PHASE_INVERSE 0x88 /* I2S out mono channel swap 1308c2ecf20Sopenharmony_ci * and phase inverse */ 1318c2ecf20Sopenharmony_ci#define P17V_SPDIF_CHANNEL_SWAP_PHASE_INVERSE 0x89 /* SPDIF out mono channel swap 1328c2ecf20Sopenharmony_ci * and phase inverse */ 1338c2ecf20Sopenharmony_ci/* 8A: Not used */ 1348c2ecf20Sopenharmony_ci#define P17V_SRP_P17V_ESR 0x8B /* SRP_P17V estimated sample rate and rate lock */ 1358c2ecf20Sopenharmony_ci#define P17V_SRP_REC_ESR 0x8C /* SRP_REC estimated sample rate and rate lock */ 1368c2ecf20Sopenharmony_ci#define P17V_SRP_BYPASS 0x8D /* srps channel bypass and srps bypass */ 1378c2ecf20Sopenharmony_ci/* 8E - 92: Not used */ 1388c2ecf20Sopenharmony_ci#define P17V_I2S_SRC_SEL 0x93 /* I2SIN mode sel */ 1398c2ecf20Sopenharmony_ci 1408c2ecf20Sopenharmony_ci 1418c2ecf20Sopenharmony_ci 1428c2ecf20Sopenharmony_ci 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_ci 145