18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci#ifndef __SOUND_TRIDENT_H 38c2ecf20Sopenharmony_ci#define __SOUND_TRIDENT_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci/* 68c2ecf20Sopenharmony_ci * audio@tridentmicro.com 78c2ecf20Sopenharmony_ci * Fri Feb 19 15:55:28 MST 1999 88c2ecf20Sopenharmony_ci * Definitions for Trident 4DWave DX/NX chips 98c2ecf20Sopenharmony_ci */ 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#include <sound/pcm.h> 128c2ecf20Sopenharmony_ci#include <sound/mpu401.h> 138c2ecf20Sopenharmony_ci#include <sound/ac97_codec.h> 148c2ecf20Sopenharmony_ci#include <sound/util_mem.h> 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci#define TRIDENT_DEVICE_ID_DX ((PCI_VENDOR_ID_TRIDENT<<16)|PCI_DEVICE_ID_TRIDENT_4DWAVE_DX) 178c2ecf20Sopenharmony_ci#define TRIDENT_DEVICE_ID_NX ((PCI_VENDOR_ID_TRIDENT<<16)|PCI_DEVICE_ID_TRIDENT_4DWAVE_NX) 188c2ecf20Sopenharmony_ci#define TRIDENT_DEVICE_ID_SI7018 ((PCI_VENDOR_ID_SI<<16)|PCI_DEVICE_ID_SI_7018) 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#define SNDRV_TRIDENT_VOICE_TYPE_PCM 0 218c2ecf20Sopenharmony_ci#define SNDRV_TRIDENT_VOICE_TYPE_SYNTH 1 228c2ecf20Sopenharmony_ci#define SNDRV_TRIDENT_VOICE_TYPE_MIDI 2 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci#define SNDRV_TRIDENT_VFLG_RUNNING (1<<0) 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci/* TLB code constants */ 278c2ecf20Sopenharmony_ci#define SNDRV_TRIDENT_PAGE_SIZE 4096 288c2ecf20Sopenharmony_ci#define SNDRV_TRIDENT_PAGE_SHIFT 12 298c2ecf20Sopenharmony_ci#define SNDRV_TRIDENT_PAGE_MASK ((1<<SNDRV_TRIDENT_PAGE_SHIFT)-1) 308c2ecf20Sopenharmony_ci#define SNDRV_TRIDENT_MAX_PAGES 4096 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci/* 338c2ecf20Sopenharmony_ci * Direct registers 348c2ecf20Sopenharmony_ci */ 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci#define TRID_REG(trident, x) ((trident)->port + (x)) 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci#define ID_4DWAVE_DX 0x2000 398c2ecf20Sopenharmony_ci#define ID_4DWAVE_NX 0x2001 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci/* Bank definitions */ 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci#define T4D_BANK_A 0 448c2ecf20Sopenharmony_ci#define T4D_BANK_B 1 458c2ecf20Sopenharmony_ci#define T4D_NUM_BANKS 2 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci/* Register definitions */ 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci/* Global registers */ 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_cienum global_control_bits { 528c2ecf20Sopenharmony_ci CHANNEL_IDX = 0x0000003f, 538c2ecf20Sopenharmony_ci OVERRUN_IE = 0x00000400, /* interrupt enable: capture overrun */ 548c2ecf20Sopenharmony_ci UNDERRUN_IE = 0x00000800, /* interrupt enable: playback underrun */ 558c2ecf20Sopenharmony_ci ENDLP_IE = 0x00001000, /* interrupt enable: end of buffer */ 568c2ecf20Sopenharmony_ci MIDLP_IE = 0x00002000, /* interrupt enable: middle buffer */ 578c2ecf20Sopenharmony_ci ETOG_IE = 0x00004000, /* interrupt enable: envelope toggling */ 588c2ecf20Sopenharmony_ci EDROP_IE = 0x00008000, /* interrupt enable: envelope drop */ 598c2ecf20Sopenharmony_ci BANK_B_EN = 0x00010000, /* SiS: enable bank B (64 channels) */ 608c2ecf20Sopenharmony_ci PCMIN_B_MIX = 0x00020000, /* SiS: PCM IN B mixing enable */ 618c2ecf20Sopenharmony_ci I2S_OUT_ASSIGN = 0x00040000, /* SiS: I2S Out contains surround PCM */ 628c2ecf20Sopenharmony_ci SPDIF_OUT_ASSIGN= 0x00080000, /* SiS: 0=S/PDIF L/R | 1=PCM Out FIFO */ 638c2ecf20Sopenharmony_ci MAIN_OUT_ASSIGN = 0x00100000, /* SiS: 0=PCM Out FIFO | 1=MMC Out buffer */ 648c2ecf20Sopenharmony_ci}; 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_cienum miscint_bits { 678c2ecf20Sopenharmony_ci PB_UNDERRUN_IRQ = 0x00000001, REC_OVERRUN_IRQ = 0x00000002, 688c2ecf20Sopenharmony_ci SB_IRQ = 0x00000004, MPU401_IRQ = 0x00000008, 698c2ecf20Sopenharmony_ci OPL3_IRQ = 0x00000010, ADDRESS_IRQ = 0x00000020, 708c2ecf20Sopenharmony_ci ENVELOPE_IRQ = 0x00000040, PB_UNDERRUN = 0x00000100, 718c2ecf20Sopenharmony_ci REC_OVERRUN = 0x00000200, MIXER_UNDERFLOW = 0x00000400, 728c2ecf20Sopenharmony_ci MIXER_OVERFLOW = 0x00000800, NX_SB_IRQ_DISABLE = 0x00001000, 738c2ecf20Sopenharmony_ci ST_TARGET_REACHED = 0x00008000, 748c2ecf20Sopenharmony_ci PB_24K_MODE = 0x00010000, ST_IRQ_EN = 0x00800000, 758c2ecf20Sopenharmony_ci ACGPIO_IRQ = 0x01000000 768c2ecf20Sopenharmony_ci}; 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_ci/* T2 legacy dma control registers. */ 798c2ecf20Sopenharmony_ci#define LEGACY_DMAR0 0x00 // ADR0 808c2ecf20Sopenharmony_ci#define LEGACY_DMAR4 0x04 // CNT0 818c2ecf20Sopenharmony_ci#define LEGACY_DMAR6 0x06 // CNT0 - High bits 828c2ecf20Sopenharmony_ci#define LEGACY_DMAR11 0x0b // MOD 838c2ecf20Sopenharmony_ci#define LEGACY_DMAR15 0x0f // MMR 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_ci#define T4D_START_A 0x80 868c2ecf20Sopenharmony_ci#define T4D_STOP_A 0x84 878c2ecf20Sopenharmony_ci#define T4D_DLY_A 0x88 888c2ecf20Sopenharmony_ci#define T4D_SIGN_CSO_A 0x8c 898c2ecf20Sopenharmony_ci#define T4D_CSPF_A 0x90 908c2ecf20Sopenharmony_ci#define T4D_CSPF_B 0xbc 918c2ecf20Sopenharmony_ci#define T4D_CEBC_A 0x94 928c2ecf20Sopenharmony_ci#define T4D_AINT_A 0x98 938c2ecf20Sopenharmony_ci#define T4D_AINTEN_A 0x9c 948c2ecf20Sopenharmony_ci#define T4D_LFO_GC_CIR 0xa0 958c2ecf20Sopenharmony_ci#define T4D_MUSICVOL_WAVEVOL 0xa8 968c2ecf20Sopenharmony_ci#define T4D_SBDELTA_DELTA_R 0xac 978c2ecf20Sopenharmony_ci#define T4D_MISCINT 0xb0 988c2ecf20Sopenharmony_ci#define T4D_START_B 0xb4 998c2ecf20Sopenharmony_ci#define T4D_STOP_B 0xb8 1008c2ecf20Sopenharmony_ci#define T4D_SBBL_SBCL 0xc0 1018c2ecf20Sopenharmony_ci#define T4D_SBCTRL_SBE2R_SBDD 0xc4 1028c2ecf20Sopenharmony_ci#define T4D_STIMER 0xc8 1038c2ecf20Sopenharmony_ci#define T4D_AINT_B 0xd8 1048c2ecf20Sopenharmony_ci#define T4D_AINTEN_B 0xdc 1058c2ecf20Sopenharmony_ci#define T4D_RCI 0x70 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci/* MPU-401 UART */ 1088c2ecf20Sopenharmony_ci#define T4D_MPU401_BASE 0x20 1098c2ecf20Sopenharmony_ci#define T4D_MPUR0 0x20 1108c2ecf20Sopenharmony_ci#define T4D_MPUR1 0x21 1118c2ecf20Sopenharmony_ci#define T4D_MPUR2 0x22 1128c2ecf20Sopenharmony_ci#define T4D_MPUR3 0x23 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_ci/* S/PDIF Registers */ 1158c2ecf20Sopenharmony_ci#define NX_SPCTRL_SPCSO 0x24 1168c2ecf20Sopenharmony_ci#define NX_SPLBA 0x28 1178c2ecf20Sopenharmony_ci#define NX_SPESO 0x2c 1188c2ecf20Sopenharmony_ci#define NX_SPCSTATUS 0x64 1198c2ecf20Sopenharmony_ci 1208c2ecf20Sopenharmony_ci/* Joystick */ 1218c2ecf20Sopenharmony_ci#define GAMEPORT_GCR 0x30 1228c2ecf20Sopenharmony_ci#define GAMEPORT_MODE_ADC 0x80 1238c2ecf20Sopenharmony_ci#define GAMEPORT_LEGACY 0x31 1248c2ecf20Sopenharmony_ci#define GAMEPORT_AXES 0x34 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_ci/* NX Specific Registers */ 1278c2ecf20Sopenharmony_ci#define NX_TLBC 0x6c 1288c2ecf20Sopenharmony_ci 1298c2ecf20Sopenharmony_ci/* Channel Registers */ 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_ci#define CH_START 0xe0 1328c2ecf20Sopenharmony_ci 1338c2ecf20Sopenharmony_ci#define CH_DX_CSO_ALPHA_FMS 0xe0 1348c2ecf20Sopenharmony_ci#define CH_DX_ESO_DELTA 0xe8 1358c2ecf20Sopenharmony_ci#define CH_DX_FMC_RVOL_CVOL 0xec 1368c2ecf20Sopenharmony_ci 1378c2ecf20Sopenharmony_ci#define CH_NX_DELTA_CSO 0xe0 1388c2ecf20Sopenharmony_ci#define CH_NX_DELTA_ESO 0xe8 1398c2ecf20Sopenharmony_ci#define CH_NX_ALPHA_FMS_FMC_RVOL_CVOL 0xec 1408c2ecf20Sopenharmony_ci 1418c2ecf20Sopenharmony_ci#define CH_LBA 0xe4 1428c2ecf20Sopenharmony_ci#define CH_GVSEL_PAN_VOL_CTRL_EC 0xf0 1438c2ecf20Sopenharmony_ci#define CH_EBUF1 0xf4 1448c2ecf20Sopenharmony_ci#define CH_EBUF2 0xf8 1458c2ecf20Sopenharmony_ci 1468c2ecf20Sopenharmony_ci/* AC-97 Registers */ 1478c2ecf20Sopenharmony_ci 1488c2ecf20Sopenharmony_ci#define DX_ACR0_AC97_W 0x40 1498c2ecf20Sopenharmony_ci#define DX_ACR1_AC97_R 0x44 1508c2ecf20Sopenharmony_ci#define DX_ACR2_AC97_COM_STAT 0x48 1518c2ecf20Sopenharmony_ci 1528c2ecf20Sopenharmony_ci#define NX_ACR0_AC97_COM_STAT 0x40 1538c2ecf20Sopenharmony_ci#define NX_ACR1_AC97_W 0x44 1548c2ecf20Sopenharmony_ci#define NX_ACR2_AC97_R_PRIMARY 0x48 1558c2ecf20Sopenharmony_ci#define NX_ACR3_AC97_R_SECONDARY 0x4c 1568c2ecf20Sopenharmony_ci 1578c2ecf20Sopenharmony_ci#define SI_AC97_WRITE 0x40 1588c2ecf20Sopenharmony_ci#define SI_AC97_READ 0x44 1598c2ecf20Sopenharmony_ci#define SI_SERIAL_INTF_CTRL 0x48 1608c2ecf20Sopenharmony_ci#define SI_AC97_GPIO 0x4c 1618c2ecf20Sopenharmony_ci#define SI_ASR0 0x50 1628c2ecf20Sopenharmony_ci#define SI_SPDIF_CS 0x70 1638c2ecf20Sopenharmony_ci#define SI_GPIO 0x7c 1648c2ecf20Sopenharmony_ci 1658c2ecf20Sopenharmony_cienum trident_nx_ac97_bits { 1668c2ecf20Sopenharmony_ci /* ACR1-3 */ 1678c2ecf20Sopenharmony_ci NX_AC97_BUSY_WRITE = 0x0800, 1688c2ecf20Sopenharmony_ci NX_AC97_BUSY_READ = 0x0800, 1698c2ecf20Sopenharmony_ci NX_AC97_BUSY_DATA = 0x0400, 1708c2ecf20Sopenharmony_ci NX_AC97_WRITE_SECONDARY = 0x0100, 1718c2ecf20Sopenharmony_ci /* ACR0 */ 1728c2ecf20Sopenharmony_ci NX_AC97_SECONDARY_READY = 0x0040, 1738c2ecf20Sopenharmony_ci NX_AC97_SECONDARY_RECORD = 0x0020, 1748c2ecf20Sopenharmony_ci NX_AC97_SURROUND_OUTPUT = 0x0010, 1758c2ecf20Sopenharmony_ci NX_AC97_PRIMARY_READY = 0x0008, 1768c2ecf20Sopenharmony_ci NX_AC97_PRIMARY_RECORD = 0x0004, 1778c2ecf20Sopenharmony_ci NX_AC97_PCM_OUTPUT = 0x0002, 1788c2ecf20Sopenharmony_ci NX_AC97_WARM_RESET = 0x0001 1798c2ecf20Sopenharmony_ci}; 1808c2ecf20Sopenharmony_ci 1818c2ecf20Sopenharmony_cienum trident_dx_ac97_bits { 1828c2ecf20Sopenharmony_ci DX_AC97_BUSY_WRITE = 0x8000, 1838c2ecf20Sopenharmony_ci DX_AC97_BUSY_READ = 0x8000, 1848c2ecf20Sopenharmony_ci DX_AC97_READY = 0x0010, 1858c2ecf20Sopenharmony_ci DX_AC97_RECORD = 0x0008, 1868c2ecf20Sopenharmony_ci DX_AC97_PLAYBACK = 0x0002 1878c2ecf20Sopenharmony_ci}; 1888c2ecf20Sopenharmony_ci 1898c2ecf20Sopenharmony_cienum sis7018_ac97_bits { 1908c2ecf20Sopenharmony_ci SI_AC97_BUSY_WRITE = 0x00008000, 1918c2ecf20Sopenharmony_ci SI_AC97_AUDIO_BUSY = 0x00004000, 1928c2ecf20Sopenharmony_ci SI_AC97_MODEM_BUSY = 0x00002000, 1938c2ecf20Sopenharmony_ci SI_AC97_BUSY_READ = 0x00008000, 1948c2ecf20Sopenharmony_ci SI_AC97_SECONDARY = 0x00000080, 1958c2ecf20Sopenharmony_ci}; 1968c2ecf20Sopenharmony_ci 1978c2ecf20Sopenharmony_cienum serial_intf_ctrl_bits { 1988c2ecf20Sopenharmony_ci WARM_RESET = 0x00000001, 1998c2ecf20Sopenharmony_ci COLD_RESET = 0x00000002, 2008c2ecf20Sopenharmony_ci I2S_CLOCK = 0x00000004, 2018c2ecf20Sopenharmony_ci PCM_SEC_AC97 = 0x00000008, 2028c2ecf20Sopenharmony_ci AC97_DBL_RATE = 0x00000010, 2038c2ecf20Sopenharmony_ci SPDIF_EN = 0x00000020, 2048c2ecf20Sopenharmony_ci I2S_OUTPUT_EN = 0x00000040, 2058c2ecf20Sopenharmony_ci I2S_INPUT_EN = 0x00000080, 2068c2ecf20Sopenharmony_ci PCMIN = 0x00000100, 2078c2ecf20Sopenharmony_ci LINE1IN = 0x00000200, 2088c2ecf20Sopenharmony_ci MICIN = 0x00000400, 2098c2ecf20Sopenharmony_ci LINE2IN = 0x00000800, 2108c2ecf20Sopenharmony_ci HEAD_SET_IN = 0x00001000, 2118c2ecf20Sopenharmony_ci GPIOIN = 0x00002000, 2128c2ecf20Sopenharmony_ci /* 7018 spec says id = 01 but the demo board routed to 10 2138c2ecf20Sopenharmony_ci SECONDARY_ID= 0x00004000, */ 2148c2ecf20Sopenharmony_ci SECONDARY_ID = 0x00004000, 2158c2ecf20Sopenharmony_ci PCMOUT = 0x00010000, 2168c2ecf20Sopenharmony_ci SURROUT = 0x00020000, 2178c2ecf20Sopenharmony_ci CENTEROUT = 0x00040000, 2188c2ecf20Sopenharmony_ci LFEOUT = 0x00080000, 2198c2ecf20Sopenharmony_ci LINE1OUT = 0x00100000, 2208c2ecf20Sopenharmony_ci LINE2OUT = 0x00200000, 2218c2ecf20Sopenharmony_ci GPIOOUT = 0x00400000, 2228c2ecf20Sopenharmony_ci SI_AC97_PRIMARY_READY = 0x01000000, 2238c2ecf20Sopenharmony_ci SI_AC97_SECONDARY_READY = 0x02000000, 2248c2ecf20Sopenharmony_ci SI_AC97_POWERDOWN = 0x04000000, 2258c2ecf20Sopenharmony_ci}; 2268c2ecf20Sopenharmony_ci 2278c2ecf20Sopenharmony_ci/* PCM defaults */ 2288c2ecf20Sopenharmony_ci 2298c2ecf20Sopenharmony_ci#define T4D_DEFAULT_PCM_VOL 10 /* 0 - 255 */ 2308c2ecf20Sopenharmony_ci#define T4D_DEFAULT_PCM_PAN 0 /* 0 - 127 */ 2318c2ecf20Sopenharmony_ci#define T4D_DEFAULT_PCM_RVOL 127 /* 0 - 127 */ 2328c2ecf20Sopenharmony_ci#define T4D_DEFAULT_PCM_CVOL 127 /* 0 - 127 */ 2338c2ecf20Sopenharmony_ci 2348c2ecf20Sopenharmony_cistruct snd_trident; 2358c2ecf20Sopenharmony_cistruct snd_trident_voice; 2368c2ecf20Sopenharmony_cistruct snd_trident_pcm_mixer; 2378c2ecf20Sopenharmony_ci 2388c2ecf20Sopenharmony_cistruct snd_trident_port { 2398c2ecf20Sopenharmony_ci struct snd_midi_channel_set * chset; 2408c2ecf20Sopenharmony_ci struct snd_trident * trident; 2418c2ecf20Sopenharmony_ci int mode; /* operation mode */ 2428c2ecf20Sopenharmony_ci int client; /* sequencer client number */ 2438c2ecf20Sopenharmony_ci int port; /* sequencer port number */ 2448c2ecf20Sopenharmony_ci unsigned int midi_has_voices: 1; 2458c2ecf20Sopenharmony_ci}; 2468c2ecf20Sopenharmony_ci 2478c2ecf20Sopenharmony_cistruct snd_trident_memblk_arg { 2488c2ecf20Sopenharmony_ci short first_page, last_page; 2498c2ecf20Sopenharmony_ci}; 2508c2ecf20Sopenharmony_ci 2518c2ecf20Sopenharmony_cistruct snd_trident_tlb { 2528c2ecf20Sopenharmony_ci __le32 *entries; /* 16k-aligned TLB table */ 2538c2ecf20Sopenharmony_ci dma_addr_t entries_dmaaddr; /* 16k-aligned PCI address to TLB table */ 2548c2ecf20Sopenharmony_ci unsigned long * shadow_entries; /* shadow entries with virtual addresses */ 2558c2ecf20Sopenharmony_ci struct snd_dma_buffer buffer; 2568c2ecf20Sopenharmony_ci struct snd_util_memhdr * memhdr; /* page allocation list */ 2578c2ecf20Sopenharmony_ci struct snd_dma_buffer silent_page; 2588c2ecf20Sopenharmony_ci}; 2598c2ecf20Sopenharmony_ci 2608c2ecf20Sopenharmony_cistruct snd_trident_voice { 2618c2ecf20Sopenharmony_ci unsigned int number; 2628c2ecf20Sopenharmony_ci unsigned int use: 1, 2638c2ecf20Sopenharmony_ci pcm: 1, 2648c2ecf20Sopenharmony_ci synth:1, 2658c2ecf20Sopenharmony_ci midi: 1; 2668c2ecf20Sopenharmony_ci unsigned int flags; 2678c2ecf20Sopenharmony_ci unsigned char client; 2688c2ecf20Sopenharmony_ci unsigned char port; 2698c2ecf20Sopenharmony_ci unsigned char index; 2708c2ecf20Sopenharmony_ci 2718c2ecf20Sopenharmony_ci struct snd_trident_sample_ops *sample_ops; 2728c2ecf20Sopenharmony_ci 2738c2ecf20Sopenharmony_ci /* channel parameters */ 2748c2ecf20Sopenharmony_ci unsigned int CSO; /* 24 bits (16 on DX) */ 2758c2ecf20Sopenharmony_ci unsigned int ESO; /* 24 bits (16 on DX) */ 2768c2ecf20Sopenharmony_ci unsigned int LBA; /* 30 bits */ 2778c2ecf20Sopenharmony_ci unsigned short EC; /* 12 bits */ 2788c2ecf20Sopenharmony_ci unsigned short Alpha; /* 12 bits */ 2798c2ecf20Sopenharmony_ci unsigned short Delta; /* 16 bits */ 2808c2ecf20Sopenharmony_ci unsigned short Attribute; /* 16 bits - SiS 7018 */ 2818c2ecf20Sopenharmony_ci unsigned short Vol; /* 12 bits (6.6) */ 2828c2ecf20Sopenharmony_ci unsigned char Pan; /* 7 bits (1.4.2) */ 2838c2ecf20Sopenharmony_ci unsigned char GVSel; /* 1 bit */ 2848c2ecf20Sopenharmony_ci unsigned char RVol; /* 7 bits (5.2) */ 2858c2ecf20Sopenharmony_ci unsigned char CVol; /* 7 bits (5.2) */ 2868c2ecf20Sopenharmony_ci unsigned char FMC; /* 2 bits */ 2878c2ecf20Sopenharmony_ci unsigned char CTRL; /* 4 bits */ 2888c2ecf20Sopenharmony_ci unsigned char FMS; /* 4 bits */ 2898c2ecf20Sopenharmony_ci unsigned char LFO; /* 8 bits */ 2908c2ecf20Sopenharmony_ci 2918c2ecf20Sopenharmony_ci unsigned int negCSO; /* nonzero - use negative CSO */ 2928c2ecf20Sopenharmony_ci 2938c2ecf20Sopenharmony_ci struct snd_util_memblk *memblk; /* memory block if TLB enabled */ 2948c2ecf20Sopenharmony_ci 2958c2ecf20Sopenharmony_ci /* PCM data */ 2968c2ecf20Sopenharmony_ci 2978c2ecf20Sopenharmony_ci struct snd_trident *trident; 2988c2ecf20Sopenharmony_ci struct snd_pcm_substream *substream; 2998c2ecf20Sopenharmony_ci struct snd_trident_voice *extra; /* extra PCM voice (acts as interrupt generator) */ 3008c2ecf20Sopenharmony_ci unsigned int running: 1, 3018c2ecf20Sopenharmony_ci capture: 1, 3028c2ecf20Sopenharmony_ci spdif: 1, 3038c2ecf20Sopenharmony_ci foldback: 1, 3048c2ecf20Sopenharmony_ci isync: 1, 3058c2ecf20Sopenharmony_ci isync2: 1, 3068c2ecf20Sopenharmony_ci isync3: 1; 3078c2ecf20Sopenharmony_ci int foldback_chan; /* foldback subdevice number */ 3088c2ecf20Sopenharmony_ci unsigned int stimer; /* global sample timer (to detect spurious interrupts) */ 3098c2ecf20Sopenharmony_ci unsigned int spurious_threshold; /* spurious threshold */ 3108c2ecf20Sopenharmony_ci unsigned int isync_mark; 3118c2ecf20Sopenharmony_ci unsigned int isync_max; 3128c2ecf20Sopenharmony_ci unsigned int isync_ESO; 3138c2ecf20Sopenharmony_ci 3148c2ecf20Sopenharmony_ci /* --- */ 3158c2ecf20Sopenharmony_ci 3168c2ecf20Sopenharmony_ci void *private_data; 3178c2ecf20Sopenharmony_ci void (*private_free)(struct snd_trident_voice *voice); 3188c2ecf20Sopenharmony_ci}; 3198c2ecf20Sopenharmony_ci 3208c2ecf20Sopenharmony_cistruct snd_4dwave { 3218c2ecf20Sopenharmony_ci int seq_client; 3228c2ecf20Sopenharmony_ci 3238c2ecf20Sopenharmony_ci struct snd_trident_port seq_ports[4]; 3248c2ecf20Sopenharmony_ci struct snd_trident_voice voices[64]; 3258c2ecf20Sopenharmony_ci 3268c2ecf20Sopenharmony_ci int ChanSynthCount; /* number of allocated synth channels */ 3278c2ecf20Sopenharmony_ci int max_size; /* maximum synth memory size in bytes */ 3288c2ecf20Sopenharmony_ci int current_size; /* current allocated synth mem in bytes */ 3298c2ecf20Sopenharmony_ci}; 3308c2ecf20Sopenharmony_ci 3318c2ecf20Sopenharmony_cistruct snd_trident_pcm_mixer { 3328c2ecf20Sopenharmony_ci struct snd_trident_voice *voice; /* active voice */ 3338c2ecf20Sopenharmony_ci unsigned short vol; /* front volume */ 3348c2ecf20Sopenharmony_ci unsigned char pan; /* pan control */ 3358c2ecf20Sopenharmony_ci unsigned char rvol; /* rear volume */ 3368c2ecf20Sopenharmony_ci unsigned char cvol; /* center volume */ 3378c2ecf20Sopenharmony_ci unsigned char pad; 3388c2ecf20Sopenharmony_ci}; 3398c2ecf20Sopenharmony_ci 3408c2ecf20Sopenharmony_cistruct snd_trident { 3418c2ecf20Sopenharmony_ci int irq; 3428c2ecf20Sopenharmony_ci 3438c2ecf20Sopenharmony_ci unsigned int device; /* device ID */ 3448c2ecf20Sopenharmony_ci 3458c2ecf20Sopenharmony_ci unsigned char bDMAStart; 3468c2ecf20Sopenharmony_ci 3478c2ecf20Sopenharmony_ci unsigned long port; 3488c2ecf20Sopenharmony_ci unsigned long midi_port; 3498c2ecf20Sopenharmony_ci 3508c2ecf20Sopenharmony_ci unsigned int spurious_irq_count; 3518c2ecf20Sopenharmony_ci unsigned int spurious_irq_max_delta; 3528c2ecf20Sopenharmony_ci 3538c2ecf20Sopenharmony_ci struct snd_trident_tlb tlb; /* TLB entries for NX cards */ 3548c2ecf20Sopenharmony_ci 3558c2ecf20Sopenharmony_ci unsigned char spdif_ctrl; 3568c2ecf20Sopenharmony_ci unsigned char spdif_pcm_ctrl; 3578c2ecf20Sopenharmony_ci unsigned int spdif_bits; 3588c2ecf20Sopenharmony_ci unsigned int spdif_pcm_bits; 3598c2ecf20Sopenharmony_ci struct snd_kcontrol *spdif_pcm_ctl; /* S/PDIF settings */ 3608c2ecf20Sopenharmony_ci unsigned int ac97_ctrl; 3618c2ecf20Sopenharmony_ci 3628c2ecf20Sopenharmony_ci unsigned int ChanMap[2]; /* allocation map for hardware channels */ 3638c2ecf20Sopenharmony_ci 3648c2ecf20Sopenharmony_ci int ChanPCM; /* max number of PCM channels */ 3658c2ecf20Sopenharmony_ci int ChanPCMcnt; /* actual number of PCM channels */ 3668c2ecf20Sopenharmony_ci 3678c2ecf20Sopenharmony_ci unsigned int ac97_detect: 1; /* 1 = AC97 in detection phase */ 3688c2ecf20Sopenharmony_ci unsigned int in_suspend: 1; /* 1 during suspend/resume */ 3698c2ecf20Sopenharmony_ci 3708c2ecf20Sopenharmony_ci struct snd_4dwave synth; /* synth specific variables */ 3718c2ecf20Sopenharmony_ci 3728c2ecf20Sopenharmony_ci spinlock_t event_lock; 3738c2ecf20Sopenharmony_ci spinlock_t voice_alloc; 3748c2ecf20Sopenharmony_ci 3758c2ecf20Sopenharmony_ci struct snd_dma_device dma_dev; 3768c2ecf20Sopenharmony_ci 3778c2ecf20Sopenharmony_ci struct pci_dev *pci; 3788c2ecf20Sopenharmony_ci struct snd_card *card; 3798c2ecf20Sopenharmony_ci struct snd_pcm *pcm; /* ADC/DAC PCM */ 3808c2ecf20Sopenharmony_ci struct snd_pcm *foldback; /* Foldback PCM */ 3818c2ecf20Sopenharmony_ci struct snd_pcm *spdif; /* SPDIF PCM */ 3828c2ecf20Sopenharmony_ci struct snd_rawmidi *rmidi; 3838c2ecf20Sopenharmony_ci 3848c2ecf20Sopenharmony_ci struct snd_ac97_bus *ac97_bus; 3858c2ecf20Sopenharmony_ci struct snd_ac97 *ac97; 3868c2ecf20Sopenharmony_ci struct snd_ac97 *ac97_sec; 3878c2ecf20Sopenharmony_ci 3888c2ecf20Sopenharmony_ci unsigned int musicvol_wavevol; 3898c2ecf20Sopenharmony_ci struct snd_trident_pcm_mixer pcm_mixer[32]; 3908c2ecf20Sopenharmony_ci struct snd_kcontrol *ctl_vol; /* front volume */ 3918c2ecf20Sopenharmony_ci struct snd_kcontrol *ctl_pan; /* pan */ 3928c2ecf20Sopenharmony_ci struct snd_kcontrol *ctl_rvol; /* rear volume */ 3938c2ecf20Sopenharmony_ci struct snd_kcontrol *ctl_cvol; /* center volume */ 3948c2ecf20Sopenharmony_ci 3958c2ecf20Sopenharmony_ci spinlock_t reg_lock; 3968c2ecf20Sopenharmony_ci 3978c2ecf20Sopenharmony_ci struct gameport *gameport; 3988c2ecf20Sopenharmony_ci}; 3998c2ecf20Sopenharmony_ci 4008c2ecf20Sopenharmony_ciint snd_trident_create(struct snd_card *card, 4018c2ecf20Sopenharmony_ci struct pci_dev *pci, 4028c2ecf20Sopenharmony_ci int pcm_streams, 4038c2ecf20Sopenharmony_ci int pcm_spdif_device, 4048c2ecf20Sopenharmony_ci int max_wavetable_size, 4058c2ecf20Sopenharmony_ci struct snd_trident ** rtrident); 4068c2ecf20Sopenharmony_ciint snd_trident_create_gameport(struct snd_trident *trident); 4078c2ecf20Sopenharmony_ci 4088c2ecf20Sopenharmony_ciint snd_trident_pcm(struct snd_trident *trident, int device); 4098c2ecf20Sopenharmony_ciint snd_trident_foldback_pcm(struct snd_trident *trident, int device); 4108c2ecf20Sopenharmony_ciint snd_trident_spdif_pcm(struct snd_trident *trident, int device); 4118c2ecf20Sopenharmony_ciint snd_trident_attach_synthesizer(struct snd_trident * trident); 4128c2ecf20Sopenharmony_cistruct snd_trident_voice *snd_trident_alloc_voice(struct snd_trident * trident, int type, 4138c2ecf20Sopenharmony_ci int client, int port); 4148c2ecf20Sopenharmony_civoid snd_trident_free_voice(struct snd_trident * trident, struct snd_trident_voice *voice); 4158c2ecf20Sopenharmony_civoid snd_trident_start_voice(struct snd_trident * trident, unsigned int voice); 4168c2ecf20Sopenharmony_civoid snd_trident_stop_voice(struct snd_trident * trident, unsigned int voice); 4178c2ecf20Sopenharmony_civoid snd_trident_write_voice_regs(struct snd_trident * trident, struct snd_trident_voice *voice); 4188c2ecf20Sopenharmony_ciextern const struct dev_pm_ops snd_trident_pm; 4198c2ecf20Sopenharmony_ci 4208c2ecf20Sopenharmony_ci/* TLB memory allocation */ 4218c2ecf20Sopenharmony_cistruct snd_util_memblk *snd_trident_alloc_pages(struct snd_trident *trident, 4228c2ecf20Sopenharmony_ci struct snd_pcm_substream *substream); 4238c2ecf20Sopenharmony_ciint snd_trident_free_pages(struct snd_trident *trident, struct snd_util_memblk *blk); 4248c2ecf20Sopenharmony_cistruct snd_util_memblk *snd_trident_synth_alloc(struct snd_trident *trident, unsigned int size); 4258c2ecf20Sopenharmony_ciint snd_trident_synth_free(struct snd_trident *trident, struct snd_util_memblk *blk); 4268c2ecf20Sopenharmony_ciint snd_trident_synth_copy_from_user(struct snd_trident *trident, struct snd_util_memblk *blk, 4278c2ecf20Sopenharmony_ci int offset, const char __user *data, int size); 4288c2ecf20Sopenharmony_ci 4298c2ecf20Sopenharmony_ci#endif /* __SOUND_TRIDENT_H */ 430