linux/include/sound/sb.h

/* SPDX-License-Identifier: GPL-2.0-or-later */
#ifndef __SOUND_SB_H
#define __SOUND_SB_H

/*
 *  Header file for SoundBlaster cards
 *  Copyright (c) by Jaroslav Kysela <[email protected]>
 */

#include <sound/pcm.h>
#include <sound/rawmidi.h>
#include <linux/interrupt.h>
#include <linux/io.h>

enum sb_hw_type {};

#define SB_OPEN_PCM
#define SB_OPEN_MIDI_INPUT
#define SB_OPEN_MIDI_OUTPUT
#define SB_OPEN_MIDI_INPUT_TRIGGER
#define SB_OPEN_MIDI_OUTPUT_TRIGGER

#define SB_MODE_HALT
#define SB_MODE_PLAYBACK_8
#define SB_MODE_PLAYBACK_16
#define SB_MODE_PLAYBACK
#define SB_MODE_CAPTURE_8
#define SB_MODE_CAPTURE_16
#define SB_MODE_CAPTURE

#define SB_RATE_LOCK_PLAYBACK
#define SB_RATE_LOCK_CAPTURE
#define SB_RATE_LOCK

#define SB_MPU_INPUT

struct snd_sb {};

/* I/O ports */

#define SBP(chip, x)
#define SBP1(port, x)

#define s_b_SB_RESET
#define s_b_SB_READ
#define s_b_SB_WRITE
#define s_b_SB_COMMAND
#define s_b_SB_STATUS
#define s_b_SB_DATA_AVAIL
#define s_b_SB_DATA_AVAIL_16
#define s_b_SB_MIXER_ADDR
#define s_b_SB_MIXER_DATA
#define s_b_SB_OPL3_LEFT
#define s_b_SB_OPL3_RIGHT
#define s_b_SB_OPL3_BOTH

#define SB_DSP_OUTPUT
#define SB_DSP_INPUT
#define SB_DSP_BLOCK_SIZE
#define SB_DSP_HI_OUTPUT
#define SB_DSP_HI_INPUT
#define SB_DSP_LO_OUTPUT_AUTO
#define SB_DSP_LO_INPUT_AUTO
#define SB_DSP_HI_OUTPUT_AUTO
#define SB_DSP_HI_INPUT_AUTO
#define SB_DSP_IMMED_INT
#define SB_DSP_GET_VERSION
#define SB_DSP_SPEAKER_ON
#define SB_DSP_SPEAKER_OFF
#define SB_DSP_DMA8_OFF
#define SB_DSP_DMA8_ON
#define SB_DSP_DMA8_EXIT
#define SB_DSP_DMA16_OFF
#define SB_DSP_DMA16_ON
#define SB_DSP_DMA16_EXIT
#define SB_DSP_SAMPLE_RATE
#define SB_DSP_SAMPLE_RATE_OUT
#define SB_DSP_SAMPLE_RATE_IN
#define SB_DSP_MONO_8BIT
#define SB_DSP_MONO_16BIT
#define SB_DSP_STEREO_8BIT
#define SB_DSP_STEREO_16BIT

#define SB_DSP_MIDI_INPUT_IRQ
#define SB_DSP_MIDI_UART_IRQ
#define SB_DSP_MIDI_OUTPUT

#define SB_DSP4_OUT8_AI
#define SB_DSP4_IN8_AI
#define SB_DSP4_OUT16_AI
#define SB_DSP4_IN16_AI
#define SB_DSP4_MODE_UNS_MONO
#define SB_DSP4_MODE_SIGN_MONO
#define SB_DSP4_MODE_UNS_STEREO
#define SB_DSP4_MODE_SIGN_STEREO

#define SB_DSP4_OUTPUT
#define SB_DSP4_INPUT_LEFT
#define SB_DSP4_INPUT_RIGHT

/* registers for SB 2.0 mixer */
#define SB_DSP20_MASTER_DEV
#define SB_DSP20_PCM_DEV
#define SB_DSP20_CD_DEV
#define SB_DSP20_FM_DEV

/* registers for SB PRO mixer */
#define SB_DSP_MASTER_DEV
#define SB_DSP_PCM_DEV
#define SB_DSP_LINE_DEV
#define SB_DSP_CD_DEV
#define SB_DSP_FM_DEV
#define SB_DSP_MIC_DEV
#define SB_DSP_CAPTURE_SOURCE
#define SB_DSP_CAPTURE_FILT
#define SB_DSP_PLAYBACK_FILT
#define SB_DSP_STEREO_SW

#define SB_DSP_MIXS_MIC0
#define SB_DSP_MIXS_CD
#define SB_DSP_MIXS_MIC
#define SB_DSP_MIXS_LINE

/* registers (only for left channel) for SB 16 mixer */
#define SB_DSP4_MASTER_DEV
#define SB_DSP4_BASS_DEV
#define SB_DSP4_TREBLE_DEV
#define SB_DSP4_SYNTH_DEV
#define SB_DSP4_PCM_DEV
#define SB_DSP4_SPEAKER_DEV
#define SB_DSP4_LINE_DEV
#define SB_DSP4_MIC_DEV
#define SB_DSP4_OUTPUT_SW
#define SB_DSP4_CD_DEV
#define SB_DSP4_IGAIN_DEV
#define SB_DSP4_OGAIN_DEV
#define SB_DSP4_MIC_AGC

/* additional registers for SB 16 mixer */
#define SB_DSP4_IRQSETUP
#define SB_DSP4_DMASETUP
#define SB_DSP4_IRQSTATUS
#define SB_DSP4_MPUSETUP

#define SB_DSP4_3DSE

/* Registers for DT-019x / ALS-007 mixer */
#define SB_DT019X_MASTER_DEV
#define SB_DT019X_PCM_DEV
#define SB_DT019X_SYNTH_DEV
#define SB_DT019X_CD_DEV
#define SB_DT019X_MIC_DEV
#define SB_DT019X_SPKR_DEV
#define SB_DT019X_LINE_DEV
#define SB_DT019X_OUTPUT_SW2
#define SB_DT019X_CAPTURE_SW

#define SB_DT019X_CAP_CD
#define SB_DT019X_CAP_MIC
#define SB_DT019X_CAP_LINE
#define SB_DT019X_CAP_SYNTH
#define SB_DT019X_CAP_MAIN

#define SB_ALS4000_MONO_IO_CTRL
#define SB_ALS4000_OUT_MIXER_CTRL_2
#define SB_ALS4000_MIC_IN_GAIN
#define SB_ALS4000_ANALOG_REFRNC_VOLT_CTRL
#define SB_ALS4000_FMDAC
#define SB_ALS4000_3D_SND_FX
#define SB_ALS4000_3D_TIME_DELAY
#define SB_ALS4000_3D_AUTO_MUTE
#define SB_ALS4000_ANALOG_BLOCK_CTRL
#define SB_ALS4000_3D_DELAYLINE_PATTERN
#define SB_ALS4000_CR3_CONFIGURATION
#define SB_ALS4000_QSOUND

/* IRQ setting bitmap */
#define SB_IRQSETUP_IRQ9
#define SB_IRQSETUP_IRQ5
#define SB_IRQSETUP_IRQ7
#define SB_IRQSETUP_IRQ10

/* IRQ types */
#define SB_IRQTYPE_8BIT
#define SB_IRQTYPE_16BIT
#define SB_IRQTYPE_MPUIN
#define ALS4K_IRQTYPE_CR1E_DMA

/* DMA setting bitmap */
#define SB_DMASETUP_DMA0
#define SB_DMASETUP_DMA1
#define SB_DMASETUP_DMA3
#define SB_DMASETUP_DMA5
#define SB_DMASETUP_DMA6
#define SB_DMASETUP_DMA7

/*
 *
 */

static inline void snd_sb_ack_8bit(struct snd_sb *chip)
{}

static inline void snd_sb_ack_16bit(struct snd_sb *chip)
{}

/* sb_common.c */
int snd_sbdsp_command(struct snd_sb *chip, unsigned char val);
int snd_sbdsp_get_byte(struct snd_sb *chip);
int snd_sbdsp_reset(struct snd_sb *chip);
int snd_sbdsp_create(struct snd_card *card,
		     unsigned long port,
		     int irq,
		     irq_handler_t irq_handler,
		     int dma8, int dma16,
		     unsigned short hardware,
		     struct snd_sb **r_chip);
/* sb_mixer.c */
void snd_sbmixer_write(struct snd_sb *chip, unsigned char reg, unsigned char data);
unsigned char snd_sbmixer_read(struct snd_sb *chip, unsigned char reg);
int snd_sbmixer_new(struct snd_sb *chip);
#ifdef CONFIG_PM
void snd_sbmixer_suspend(struct snd_sb *chip);
void snd_sbmixer_resume(struct snd_sb *chip);
#else
static inline void snd_sbmixer_suspend(struct snd_sb *chip) {}
static inline void snd_sbmixer_resume(struct snd_sb *chip) {}
#endif

/* sb8_init.c */
int snd_sb8dsp_pcm(struct snd_sb *chip, int device);
/* sb8.c */
irqreturn_t snd_sb8dsp_interrupt(struct snd_sb *chip);
int snd_sb8_playback_open(struct snd_pcm_substream *substream);
int snd_sb8_capture_open(struct snd_pcm_substream *substream);
int snd_sb8_playback_close(struct snd_pcm_substream *substream);
int snd_sb8_capture_close(struct snd_pcm_substream *substream);
/* midi8.c */
irqreturn_t snd_sb8dsp_midi_interrupt(struct snd_sb *chip);
int snd_sb8dsp_midi(struct snd_sb *chip, int device);

/* sb16_init.c */
int snd_sb16dsp_pcm(struct snd_sb *chip, int device);
const struct snd_pcm_ops *snd_sb16dsp_get_pcm_ops(int direction);
int snd_sb16dsp_configure(struct snd_sb *chip);
/* sb16.c */
irqreturn_t snd_sb16dsp_interrupt(int irq, void *dev_id);

/* exported mixer stuffs */
enum {};

#define SB_MIXVAL_DOUBLE(left_reg, right_reg, left_shift, right_shift, mask)
#define SB_MIXVAL_SINGLE(reg, shift, mask)
#define SB_MIXVAL_INPUT_SW(reg1, reg2, left_shift, right_shift)

int snd_sbmixer_add_ctl(struct snd_sb *chip, const char *name, int index, int type, unsigned long value);

/* for ease of use */
struct sbmix_elem {};

#define SB_SINGLE(xname, reg, shift, mask)

#define SB_DOUBLE(xname, left_reg, right_reg, left_shift, right_shift, mask)

#define SB16_INPUT_SW(xname, reg1, reg2, left_shift, right_shift)

static inline int snd_sbmixer_add_ctl_elem(struct snd_sb *chip, const struct sbmix_elem *c)
{}

#endif /* __SOUND_SB_H */