xref: /linux/include/sound/sb.h (revision 79790b6818e96c58fe2bffee1b418c16e64e7b80)
11a59d1b8SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
21da177e4SLinus Torvalds #ifndef __SOUND_SB_H
31da177e4SLinus Torvalds #define __SOUND_SB_H
41da177e4SLinus Torvalds 
51da177e4SLinus Torvalds /*
61da177e4SLinus Torvalds  *  Header file for SoundBlaster cards
7c1017a4cSJaroslav Kysela  *  Copyright (c) by Jaroslav Kysela <perex@perex.cz>
81da177e4SLinus Torvalds  */
91da177e4SLinus Torvalds 
10a1ce3928SDavid Howells #include <sound/pcm.h>
11a1ce3928SDavid Howells #include <sound/rawmidi.h>
121da177e4SLinus Torvalds #include <linux/interrupt.h>
136cbbfe1cSTakashi Iwai #include <linux/io.h>
141da177e4SLinus Torvalds 
151da177e4SLinus Torvalds enum sb_hw_type {
161da177e4SLinus Torvalds 	SB_HW_AUTO,
171da177e4SLinus Torvalds 	SB_HW_10,
181da177e4SLinus Torvalds 	SB_HW_20,
191da177e4SLinus Torvalds 	SB_HW_201,
201da177e4SLinus Torvalds 	SB_HW_PRO,
21ad8decb7SKrzysztof Helt 	SB_HW_JAZZ16,		/* Media Vision Jazz16 */
221da177e4SLinus Torvalds 	SB_HW_16,
231da177e4SLinus Torvalds 	SB_HW_16CSP,		/* SB16 with CSP chip */
241da177e4SLinus Torvalds 	SB_HW_ALS100,		/* Avance Logic ALS100 chip */
251da177e4SLinus Torvalds 	SB_HW_ALS4000,		/* Avance Logic ALS4000 chip */
261da177e4SLinus Torvalds 	SB_HW_DT019X,		/* Diamond Tech. DT-019X / Avance Logic ALS-007 */
27621887aeSTakashi Iwai 	SB_HW_CS5530,		/* Cyrix/NatSemi 5530 VSA1 */
281da177e4SLinus Torvalds };
291da177e4SLinus Torvalds 
301da177e4SLinus Torvalds #define SB_OPEN_PCM			0x01
311da177e4SLinus Torvalds #define SB_OPEN_MIDI_INPUT		0x02
321da177e4SLinus Torvalds #define SB_OPEN_MIDI_OUTPUT		0x04
331da177e4SLinus Torvalds #define SB_OPEN_MIDI_INPUT_TRIGGER	0x08
341da177e4SLinus Torvalds #define SB_OPEN_MIDI_OUTPUT_TRIGGER	0x10
351da177e4SLinus Torvalds 
361da177e4SLinus Torvalds #define SB_MODE_HALT		0x00
371da177e4SLinus Torvalds #define SB_MODE_PLAYBACK_8	0x01
381da177e4SLinus Torvalds #define SB_MODE_PLAYBACK_16	0x02
391da177e4SLinus Torvalds #define SB_MODE_PLAYBACK	(SB_MODE_PLAYBACK_8 | SB_MODE_PLAYBACK_16)
401da177e4SLinus Torvalds #define SB_MODE_CAPTURE_8	0x04
411da177e4SLinus Torvalds #define SB_MODE_CAPTURE_16	0x08
421da177e4SLinus Torvalds #define SB_MODE_CAPTURE		(SB_MODE_CAPTURE_8 | SB_MODE_CAPTURE_16)
431da177e4SLinus Torvalds 
441da177e4SLinus Torvalds #define SB_RATE_LOCK_PLAYBACK	0x10
451da177e4SLinus Torvalds #define SB_RATE_LOCK_CAPTURE	0x20
461da177e4SLinus Torvalds #define SB_RATE_LOCK		(SB_RATE_LOCK_PLAYBACK | SB_RATE_LOCK_CAPTURE)
471da177e4SLinus Torvalds 
481da177e4SLinus Torvalds #define SB_MPU_INPUT		1
491da177e4SLinus Torvalds 
50029d64b0STakashi Iwai struct snd_sb {
511da177e4SLinus Torvalds 	unsigned long port;		/* base port of DSP chip */
521da177e4SLinus Torvalds 	struct resource *res_port;
531da177e4SLinus Torvalds 	unsigned long mpu_port;		/* MPU port for SB DSP 4.0+ */
541da177e4SLinus Torvalds 	int irq;			/* IRQ number of DSP chip */
551da177e4SLinus Torvalds 	int dma8;			/* 8-bit DMA */
561da177e4SLinus Torvalds 	int dma16;			/* 16-bit DMA */
571da177e4SLinus Torvalds 	unsigned short version;		/* version of DSP chip */
581da177e4SLinus Torvalds 	enum sb_hw_type hardware;	/* see to SB_HW_XXXX */
591da177e4SLinus Torvalds 
601da177e4SLinus Torvalds 	unsigned long alt_port;		/* alternate port (ALS4000) */
611da177e4SLinus Torvalds 	struct pci_dev *pci;		/* ALS4000 */
621da177e4SLinus Torvalds 
631da177e4SLinus Torvalds 	unsigned int open;		/* see to SB_OPEN_XXXX for sb8 */
641da177e4SLinus Torvalds 					/* also SNDRV_SB_CSP_MODE_XXX for sb16_csp */
651da177e4SLinus Torvalds 	unsigned int mode;		/* current mode of stream */
661da177e4SLinus Torvalds 	unsigned int force_mode16;	/* force 16-bit mode of streams */
671da177e4SLinus Torvalds 	unsigned int locked_rate;	/* sb16 duplex */
681da177e4SLinus Torvalds 	unsigned int playback_format;
691da177e4SLinus Torvalds 	unsigned int capture_format;
701da177e4SLinus Torvalds 	struct timer_list midi_timer;
711da177e4SLinus Torvalds 	unsigned int p_dma_size;
721da177e4SLinus Torvalds 	unsigned int p_period_size;
731da177e4SLinus Torvalds 	unsigned int c_dma_size;
741da177e4SLinus Torvalds 	unsigned int c_period_size;
751da177e4SLinus Torvalds 
761da177e4SLinus Torvalds 	spinlock_t mixer_lock;
771da177e4SLinus Torvalds 
781da177e4SLinus Torvalds 	char name[32];
791da177e4SLinus Torvalds 
801da177e4SLinus Torvalds 	void *csp; /* used only when CONFIG_SND_SB16_CSP is set */
811da177e4SLinus Torvalds 
82029d64b0STakashi Iwai 	struct snd_card *card;
83029d64b0STakashi Iwai 	struct snd_pcm *pcm;
84029d64b0STakashi Iwai 	struct snd_pcm_substream *playback_substream;
85029d64b0STakashi Iwai 	struct snd_pcm_substream *capture_substream;
861da177e4SLinus Torvalds 
87029d64b0STakashi Iwai 	struct snd_rawmidi *rmidi;
88029d64b0STakashi Iwai 	struct snd_rawmidi_substream *midi_substream_input;
89029d64b0STakashi Iwai 	struct snd_rawmidi_substream *midi_substream_output;
907d12e780SDavid Howells 	irq_handler_t rmidi_callback;
911da177e4SLinus Torvalds 
921da177e4SLinus Torvalds 	spinlock_t reg_lock;
931da177e4SLinus Torvalds 	spinlock_t open_lock;
941da177e4SLinus Torvalds 	spinlock_t midi_input_lock;
951da177e4SLinus Torvalds 
96029d64b0STakashi Iwai 	struct snd_info_entry *proc_entry;
975bdb6a16STakashi Iwai 
985bdb6a16STakashi Iwai #ifdef CONFIG_PM
995bdb6a16STakashi Iwai 	unsigned char saved_regs[0x20];
1005bdb6a16STakashi Iwai #endif
1011da177e4SLinus Torvalds };
1021da177e4SLinus Torvalds 
1031da177e4SLinus Torvalds /* I/O ports */
1041da177e4SLinus Torvalds 
1051da177e4SLinus Torvalds #define SBP(chip, x)		((chip)->port + s_b_SB_##x)
1061da177e4SLinus Torvalds #define SBP1(port, x)		((port) + s_b_SB_##x)
1071da177e4SLinus Torvalds 
1081da177e4SLinus Torvalds #define s_b_SB_RESET		0x6
1091da177e4SLinus Torvalds #define s_b_SB_READ		0xa
1101da177e4SLinus Torvalds #define s_b_SB_WRITE		0xc
1111da177e4SLinus Torvalds #define s_b_SB_COMMAND		0xc
1121da177e4SLinus Torvalds #define s_b_SB_STATUS		0xc
1131da177e4SLinus Torvalds #define s_b_SB_DATA_AVAIL	0xe
1141da177e4SLinus Torvalds #define s_b_SB_DATA_AVAIL_16 	0xf
1151da177e4SLinus Torvalds #define s_b_SB_MIXER_ADDR	0x4
1161da177e4SLinus Torvalds #define s_b_SB_MIXER_DATA	0x5
1171da177e4SLinus Torvalds #define s_b_SB_OPL3_LEFT	0x0
1181da177e4SLinus Torvalds #define s_b_SB_OPL3_RIGHT	0x2
1191da177e4SLinus Torvalds #define s_b_SB_OPL3_BOTH	0x8
1201da177e4SLinus Torvalds 
1211da177e4SLinus Torvalds #define SB_DSP_OUTPUT		0x14
1221da177e4SLinus Torvalds #define SB_DSP_INPUT		0x24
1231da177e4SLinus Torvalds #define SB_DSP_BLOCK_SIZE	0x48
1241da177e4SLinus Torvalds #define SB_DSP_HI_OUTPUT	0x91
1251da177e4SLinus Torvalds #define SB_DSP_HI_INPUT		0x99
1261da177e4SLinus Torvalds #define SB_DSP_LO_OUTPUT_AUTO	0x1c
1271da177e4SLinus Torvalds #define SB_DSP_LO_INPUT_AUTO	0x2c
1281da177e4SLinus Torvalds #define SB_DSP_HI_OUTPUT_AUTO	0x90
1291da177e4SLinus Torvalds #define SB_DSP_HI_INPUT_AUTO	0x98
1301da177e4SLinus Torvalds #define SB_DSP_IMMED_INT	0xf2
1311da177e4SLinus Torvalds #define SB_DSP_GET_VERSION	0xe1
1321da177e4SLinus Torvalds #define SB_DSP_SPEAKER_ON	0xd1
1331da177e4SLinus Torvalds #define SB_DSP_SPEAKER_OFF	0xd3
1341da177e4SLinus Torvalds #define SB_DSP_DMA8_OFF		0xd0
1351da177e4SLinus Torvalds #define SB_DSP_DMA8_ON		0xd4
1361da177e4SLinus Torvalds #define SB_DSP_DMA8_EXIT	0xda
1371da177e4SLinus Torvalds #define SB_DSP_DMA16_OFF	0xd5
1381da177e4SLinus Torvalds #define SB_DSP_DMA16_ON		0xd6
1391da177e4SLinus Torvalds #define SB_DSP_DMA16_EXIT	0xd9
1401da177e4SLinus Torvalds #define SB_DSP_SAMPLE_RATE	0x40
1411da177e4SLinus Torvalds #define SB_DSP_SAMPLE_RATE_OUT	0x41
1421da177e4SLinus Torvalds #define SB_DSP_SAMPLE_RATE_IN	0x42
1431da177e4SLinus Torvalds #define SB_DSP_MONO_8BIT	0xa0
1441da177e4SLinus Torvalds #define SB_DSP_MONO_16BIT	0xa4
1451da177e4SLinus Torvalds #define SB_DSP_STEREO_8BIT	0xa8
1461da177e4SLinus Torvalds #define SB_DSP_STEREO_16BIT	0xac
1471da177e4SLinus Torvalds 
1481da177e4SLinus Torvalds #define SB_DSP_MIDI_INPUT_IRQ	0x31
1491da177e4SLinus Torvalds #define SB_DSP_MIDI_UART_IRQ	0x35
1501da177e4SLinus Torvalds #define SB_DSP_MIDI_OUTPUT	0x38
1511da177e4SLinus Torvalds 
1521da177e4SLinus Torvalds #define SB_DSP4_OUT8_AI		0xc6
1531da177e4SLinus Torvalds #define SB_DSP4_IN8_AI		0xce
1541da177e4SLinus Torvalds #define SB_DSP4_OUT16_AI	0xb6
1551da177e4SLinus Torvalds #define SB_DSP4_IN16_AI		0xbe
1561da177e4SLinus Torvalds #define SB_DSP4_MODE_UNS_MONO	0x00
1571da177e4SLinus Torvalds #define SB_DSP4_MODE_SIGN_MONO	0x10
1581da177e4SLinus Torvalds #define SB_DSP4_MODE_UNS_STEREO	0x20
1591da177e4SLinus Torvalds #define SB_DSP4_MODE_SIGN_STEREO 0x30
1601da177e4SLinus Torvalds 
1611da177e4SLinus Torvalds #define SB_DSP4_OUTPUT		0x3c
1621da177e4SLinus Torvalds #define SB_DSP4_INPUT_LEFT	0x3d
1631da177e4SLinus Torvalds #define SB_DSP4_INPUT_RIGHT	0x3e
1641da177e4SLinus Torvalds 
1651da177e4SLinus Torvalds /* registers for SB 2.0 mixer */
1661da177e4SLinus Torvalds #define SB_DSP20_MASTER_DEV	0x02
1671da177e4SLinus Torvalds #define SB_DSP20_PCM_DEV	0x0A
1681da177e4SLinus Torvalds #define SB_DSP20_CD_DEV		0x08
1691da177e4SLinus Torvalds #define SB_DSP20_FM_DEV		0x06
1701da177e4SLinus Torvalds 
1711da177e4SLinus Torvalds /* registers for SB PRO mixer */
1721da177e4SLinus Torvalds #define SB_DSP_MASTER_DEV	0x22
1731da177e4SLinus Torvalds #define SB_DSP_PCM_DEV		0x04
1741da177e4SLinus Torvalds #define SB_DSP_LINE_DEV		0x2e
1751da177e4SLinus Torvalds #define SB_DSP_CD_DEV		0x28
1761da177e4SLinus Torvalds #define SB_DSP_FM_DEV		0x26
1771da177e4SLinus Torvalds #define SB_DSP_MIC_DEV		0x0a
1781da177e4SLinus Torvalds #define SB_DSP_CAPTURE_SOURCE	0x0c
1791da177e4SLinus Torvalds #define SB_DSP_CAPTURE_FILT	0x0c
1801da177e4SLinus Torvalds #define SB_DSP_PLAYBACK_FILT	0x0e
1811da177e4SLinus Torvalds #define SB_DSP_STEREO_SW	0x0e
1821da177e4SLinus Torvalds 
1831da177e4SLinus Torvalds #define SB_DSP_MIXS_MIC0	0x00	/* same as MIC */
1841da177e4SLinus Torvalds #define SB_DSP_MIXS_CD		0x01
1851da177e4SLinus Torvalds #define SB_DSP_MIXS_MIC		0x02
1861da177e4SLinus Torvalds #define SB_DSP_MIXS_LINE	0x03
1871da177e4SLinus Torvalds 
1881da177e4SLinus Torvalds /* registers (only for left channel) for SB 16 mixer */
1891da177e4SLinus Torvalds #define SB_DSP4_MASTER_DEV	0x30
1901da177e4SLinus Torvalds #define SB_DSP4_BASS_DEV	0x46
1911da177e4SLinus Torvalds #define SB_DSP4_TREBLE_DEV	0x44
1921da177e4SLinus Torvalds #define SB_DSP4_SYNTH_DEV	0x34
1931da177e4SLinus Torvalds #define SB_DSP4_PCM_DEV		0x32
1941da177e4SLinus Torvalds #define SB_DSP4_SPEAKER_DEV	0x3b
1951da177e4SLinus Torvalds #define SB_DSP4_LINE_DEV	0x38
1961da177e4SLinus Torvalds #define SB_DSP4_MIC_DEV		0x3a
1971da177e4SLinus Torvalds #define SB_DSP4_OUTPUT_SW	0x3c
1981da177e4SLinus Torvalds #define SB_DSP4_CD_DEV		0x36
1991da177e4SLinus Torvalds #define SB_DSP4_IGAIN_DEV	0x3f
2001da177e4SLinus Torvalds #define SB_DSP4_OGAIN_DEV	0x41
2011da177e4SLinus Torvalds #define SB_DSP4_MIC_AGC		0x43
2021da177e4SLinus Torvalds 
2031da177e4SLinus Torvalds /* additional registers for SB 16 mixer */
2041da177e4SLinus Torvalds #define SB_DSP4_IRQSETUP	0x80
2051da177e4SLinus Torvalds #define SB_DSP4_DMASETUP	0x81
2061da177e4SLinus Torvalds #define SB_DSP4_IRQSTATUS	0x82
2071da177e4SLinus Torvalds #define SB_DSP4_MPUSETUP	0x84
2081da177e4SLinus Torvalds 
2091da177e4SLinus Torvalds #define SB_DSP4_3DSE		0x90
2101da177e4SLinus Torvalds 
2111da177e4SLinus Torvalds /* Registers for DT-019x / ALS-007 mixer */
2121da177e4SLinus Torvalds #define SB_DT019X_MASTER_DEV	0x62
2131da177e4SLinus Torvalds #define SB_DT019X_PCM_DEV	0x64
2141da177e4SLinus Torvalds #define SB_DT019X_SYNTH_DEV	0x66
2151da177e4SLinus Torvalds #define SB_DT019X_CD_DEV	0x68
2161da177e4SLinus Torvalds #define SB_DT019X_MIC_DEV	0x6a
2171da177e4SLinus Torvalds #define SB_DT019X_SPKR_DEV	0x6a
2181da177e4SLinus Torvalds #define SB_DT019X_LINE_DEV	0x6e
2191da177e4SLinus Torvalds #define SB_DT019X_OUTPUT_SW2	0x4c
2201da177e4SLinus Torvalds #define SB_DT019X_CAPTURE_SW	0x6c
2211da177e4SLinus Torvalds 
2221da177e4SLinus Torvalds #define SB_DT019X_CAP_CD	0x02
2231da177e4SLinus Torvalds #define SB_DT019X_CAP_MIC	0x04
2241da177e4SLinus Torvalds #define SB_DT019X_CAP_LINE	0x06
2251da177e4SLinus Torvalds #define SB_DT019X_CAP_SYNTH	0x07
2261da177e4SLinus Torvalds #define SB_DT019X_CAP_MAIN	0x07
2271da177e4SLinus Torvalds 
2281da177e4SLinus Torvalds #define SB_ALS4000_MONO_IO_CTRL	0x4b
229cb780cddSAndreas Mohr #define SB_ALS4000_OUT_MIXER_CTRL_2	0x4c
2301da177e4SLinus Torvalds #define SB_ALS4000_MIC_IN_GAIN	0x4d
231cb780cddSAndreas Mohr #define SB_ALS4000_ANALOG_REFRNC_VOLT_CTRL 0x4e
2321da177e4SLinus Torvalds #define SB_ALS4000_FMDAC	0x4f
2331da177e4SLinus Torvalds #define SB_ALS4000_3D_SND_FX	0x50
2341da177e4SLinus Torvalds #define SB_ALS4000_3D_TIME_DELAY	0x51
2351da177e4SLinus Torvalds #define SB_ALS4000_3D_AUTO_MUTE	0x52
236cb780cddSAndreas Mohr #define SB_ALS4000_ANALOG_BLOCK_CTRL 0x53
237cb780cddSAndreas Mohr #define SB_ALS4000_3D_DELAYLINE_PATTERN 0x54
238ce71bfd1SAndreas Mohr #define SB_ALS4000_CR3_CONFIGURATION	0xc3 /* bit 7 is Digital Loop Enable */
2391da177e4SLinus Torvalds #define SB_ALS4000_QSOUND	0xdb
2401da177e4SLinus Torvalds 
2411da177e4SLinus Torvalds /* IRQ setting bitmap */
2421da177e4SLinus Torvalds #define SB_IRQSETUP_IRQ9	0x01
2431da177e4SLinus Torvalds #define SB_IRQSETUP_IRQ5	0x02
2441da177e4SLinus Torvalds #define SB_IRQSETUP_IRQ7	0x04
2451da177e4SLinus Torvalds #define SB_IRQSETUP_IRQ10	0x08
2461da177e4SLinus Torvalds 
2471da177e4SLinus Torvalds /* IRQ types */
2481da177e4SLinus Torvalds #define SB_IRQTYPE_8BIT		0x01
2491da177e4SLinus Torvalds #define SB_IRQTYPE_16BIT	0x02
2501da177e4SLinus Torvalds #define SB_IRQTYPE_MPUIN	0x04
251cb780cddSAndreas Mohr #define ALS4K_IRQTYPE_CR1E_DMA	0x20
2521da177e4SLinus Torvalds 
2531da177e4SLinus Torvalds /* DMA setting bitmap */
2541da177e4SLinus Torvalds #define SB_DMASETUP_DMA0	0x01
2551da177e4SLinus Torvalds #define SB_DMASETUP_DMA1	0x02
2561da177e4SLinus Torvalds #define SB_DMASETUP_DMA3	0x08
2571da177e4SLinus Torvalds #define SB_DMASETUP_DMA5	0x20
2581da177e4SLinus Torvalds #define SB_DMASETUP_DMA6	0x40
2591da177e4SLinus Torvalds #define SB_DMASETUP_DMA7	0x80
2601da177e4SLinus Torvalds 
2611da177e4SLinus Torvalds /*
2621da177e4SLinus Torvalds  *
2631da177e4SLinus Torvalds  */
2641da177e4SLinus Torvalds 
snd_sb_ack_8bit(struct snd_sb * chip)265029d64b0STakashi Iwai static inline void snd_sb_ack_8bit(struct snd_sb *chip)
2661da177e4SLinus Torvalds {
2671da177e4SLinus Torvalds 	inb(SBP(chip, DATA_AVAIL));
2681da177e4SLinus Torvalds }
2691da177e4SLinus Torvalds 
snd_sb_ack_16bit(struct snd_sb * chip)270029d64b0STakashi Iwai static inline void snd_sb_ack_16bit(struct snd_sb *chip)
2711da177e4SLinus Torvalds {
2721da177e4SLinus Torvalds 	inb(SBP(chip, DATA_AVAIL_16));
2731da177e4SLinus Torvalds }
2741da177e4SLinus Torvalds 
2751da177e4SLinus Torvalds /* sb_common.c */
276029d64b0STakashi Iwai int snd_sbdsp_command(struct snd_sb *chip, unsigned char val);
277029d64b0STakashi Iwai int snd_sbdsp_get_byte(struct snd_sb *chip);
278029d64b0STakashi Iwai int snd_sbdsp_reset(struct snd_sb *chip);
279029d64b0STakashi Iwai int snd_sbdsp_create(struct snd_card *card,
2801da177e4SLinus Torvalds 		     unsigned long port,
2811da177e4SLinus Torvalds 		     int irq,
2827d12e780SDavid Howells 		     irq_handler_t irq_handler,
2831da177e4SLinus Torvalds 		     int dma8, int dma16,
2841da177e4SLinus Torvalds 		     unsigned short hardware,
285029d64b0STakashi Iwai 		     struct snd_sb **r_chip);
2861da177e4SLinus Torvalds /* sb_mixer.c */
287029d64b0STakashi Iwai void snd_sbmixer_write(struct snd_sb *chip, unsigned char reg, unsigned char data);
288029d64b0STakashi Iwai unsigned char snd_sbmixer_read(struct snd_sb *chip, unsigned char reg);
289029d64b0STakashi Iwai int snd_sbmixer_new(struct snd_sb *chip);
2905bdb6a16STakashi Iwai #ifdef CONFIG_PM
2915bdb6a16STakashi Iwai void snd_sbmixer_suspend(struct snd_sb *chip);
2925bdb6a16STakashi Iwai void snd_sbmixer_resume(struct snd_sb *chip);
293*8cd4a3b2STakashi Iwai #else
snd_sbmixer_suspend(struct snd_sb * chip)294*8cd4a3b2STakashi Iwai static inline void snd_sbmixer_suspend(struct snd_sb *chip) {}
snd_sbmixer_resume(struct snd_sb * chip)295*8cd4a3b2STakashi Iwai static inline void snd_sbmixer_resume(struct snd_sb *chip) {}
2965bdb6a16STakashi Iwai #endif
2971da177e4SLinus Torvalds 
2981da177e4SLinus Torvalds /* sb8_init.c */
2998c776299SLars-Peter Clausen int snd_sb8dsp_pcm(struct snd_sb *chip, int device);
3001da177e4SLinus Torvalds /* sb8.c */
301029d64b0STakashi Iwai irqreturn_t snd_sb8dsp_interrupt(struct snd_sb *chip);
302029d64b0STakashi Iwai int snd_sb8_playback_open(struct snd_pcm_substream *substream);
303029d64b0STakashi Iwai int snd_sb8_capture_open(struct snd_pcm_substream *substream);
304029d64b0STakashi Iwai int snd_sb8_playback_close(struct snd_pcm_substream *substream);
305029d64b0STakashi Iwai int snd_sb8_capture_close(struct snd_pcm_substream *substream);
3061da177e4SLinus Torvalds /* midi8.c */
307029d64b0STakashi Iwai irqreturn_t snd_sb8dsp_midi_interrupt(struct snd_sb *chip);
3088c776299SLars-Peter Clausen int snd_sb8dsp_midi(struct snd_sb *chip, int device);
3091da177e4SLinus Torvalds 
3101da177e4SLinus Torvalds /* sb16_init.c */
31192533f18SLars-Peter Clausen int snd_sb16dsp_pcm(struct snd_sb *chip, int device);
312029d64b0STakashi Iwai const struct snd_pcm_ops *snd_sb16dsp_get_pcm_ops(int direction);
313029d64b0STakashi Iwai int snd_sb16dsp_configure(struct snd_sb *chip);
3141da177e4SLinus Torvalds /* sb16.c */
3157d12e780SDavid Howells irqreturn_t snd_sb16dsp_interrupt(int irq, void *dev_id);
3161da177e4SLinus Torvalds 
3171da177e4SLinus Torvalds /* exported mixer stuffs */
3181da177e4SLinus Torvalds enum {
3191da177e4SLinus Torvalds 	SB_MIX_SINGLE,
3201da177e4SLinus Torvalds 	SB_MIX_DOUBLE,
3211da177e4SLinus Torvalds 	SB_MIX_INPUT_SW,
3221da177e4SLinus Torvalds 	SB_MIX_CAPTURE_PRO,
323ce71bfd1SAndreas Mohr 	SB_MIX_CAPTURE_DT019X,
324ce71bfd1SAndreas Mohr 	SB_MIX_MONO_CAPTURE_ALS4K
3251da177e4SLinus Torvalds };
3261da177e4SLinus Torvalds 
3271da177e4SLinus Torvalds #define SB_MIXVAL_DOUBLE(left_reg, right_reg, left_shift, right_shift, mask) \
3281da177e4SLinus Torvalds   ((left_reg) | ((right_reg) << 8) | ((left_shift) << 16) | ((right_shift) << 19) | ((mask) << 24))
3291da177e4SLinus Torvalds #define SB_MIXVAL_SINGLE(reg, shift, mask) \
3301da177e4SLinus Torvalds   ((reg) | ((shift) << 16) | ((mask) << 24))
3311da177e4SLinus Torvalds #define SB_MIXVAL_INPUT_SW(reg1, reg2, left_shift, right_shift) \
3321da177e4SLinus Torvalds   ((reg1) | ((reg2) << 8) | ((left_shift) << 16) | ((right_shift) << 24))
3331da177e4SLinus Torvalds 
334029d64b0STakashi Iwai int snd_sbmixer_add_ctl(struct snd_sb *chip, const char *name, int index, int type, unsigned long value);
3351da177e4SLinus Torvalds 
3361da177e4SLinus Torvalds /* for ease of use */
3371da177e4SLinus Torvalds struct sbmix_elem {
3381da177e4SLinus Torvalds 	const char *name;
3391da177e4SLinus Torvalds 	int type;
3401da177e4SLinus Torvalds 	unsigned long private_value;
3411da177e4SLinus Torvalds };
3421da177e4SLinus Torvalds 
3431da177e4SLinus Torvalds #define SB_SINGLE(xname, reg, shift, mask) \
3441da177e4SLinus Torvalds { .name = xname, \
3451da177e4SLinus Torvalds   .type = SB_MIX_SINGLE, \
3461da177e4SLinus Torvalds   .private_value = SB_MIXVAL_SINGLE(reg, shift, mask) }
3471da177e4SLinus Torvalds 
3481da177e4SLinus Torvalds #define SB_DOUBLE(xname, left_reg, right_reg, left_shift, right_shift, mask) \
3491da177e4SLinus Torvalds { .name = xname, \
3501da177e4SLinus Torvalds   .type = SB_MIX_DOUBLE, \
3511da177e4SLinus Torvalds   .private_value = SB_MIXVAL_DOUBLE(left_reg, right_reg, left_shift, right_shift, mask) }
3521da177e4SLinus Torvalds 
3531da177e4SLinus Torvalds #define SB16_INPUT_SW(xname, reg1, reg2, left_shift, right_shift) \
3541da177e4SLinus Torvalds { .name = xname, \
3551da177e4SLinus Torvalds   .type = SB_MIX_INPUT_SW, \
3561da177e4SLinus Torvalds   .private_value = SB_MIXVAL_INPUT_SW(reg1, reg2, left_shift, right_shift) }
3571da177e4SLinus Torvalds 
snd_sbmixer_add_ctl_elem(struct snd_sb * chip,const struct sbmix_elem * c)358029d64b0STakashi Iwai static inline int snd_sbmixer_add_ctl_elem(struct snd_sb *chip, const struct sbmix_elem *c)
3591da177e4SLinus Torvalds {
3601da177e4SLinus Torvalds 	return snd_sbmixer_add_ctl(chip, c->name, 0, c->type, c->private_value);
3611da177e4SLinus Torvalds }
3621da177e4SLinus Torvalds 
3631da177e4SLinus Torvalds #endif /* __SOUND_SB_H */
364