^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-or-later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (c) 1999 by Uros Bizjak <uros@kss-loka.si>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Takashi Iwai <tiwai@suse.de>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * SB16ASP/AWE32 CSP control
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #ifndef __SOUND_SB16_CSP_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #define __SOUND_SB16_CSP_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <sound/sb.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <sound/hwdep.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/firmware.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <uapi/sound/sb16_csp.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) struct snd_sb_csp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) /* indices for the known CSP programs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) CSP_PROGRAM_MULAW,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) CSP_PROGRAM_ALAW,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) CSP_PROGRAM_ADPCM_INIT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) CSP_PROGRAM_ADPCM_PLAYBACK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) CSP_PROGRAM_ADPCM_CAPTURE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) CSP_PROGRAM_COUNT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) * CSP operators
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) struct snd_sb_csp_ops {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) int (*csp_use) (struct snd_sb_csp * p);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) int (*csp_unuse) (struct snd_sb_csp * p);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) int (*csp_autoload) (struct snd_sb_csp * p, snd_pcm_format_t pcm_sfmt, int play_rec_mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) int (*csp_start) (struct snd_sb_csp * p, int sample_width, int channels);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) int (*csp_stop) (struct snd_sb_csp * p);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) int (*csp_qsound_transfer) (struct snd_sb_csp * p);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) * CSP private data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) struct snd_sb_csp {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) struct snd_sb *chip; /* SB16 DSP */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) int used; /* usage flag - exclusive */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) char codec_name[16]; /* name of codec */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) unsigned short func_nr; /* function number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) unsigned int acc_format; /* accepted PCM formats */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) int acc_channels; /* accepted channels */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) int acc_width; /* accepted sample width */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) int acc_rates; /* accepted sample rates */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) int mode; /* MODE */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) int run_channels; /* current CSP channels */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) int run_width; /* current sample width */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) int version; /* CSP version (0x10 - 0x1f) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) int running; /* running state */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) struct snd_sb_csp_ops ops; /* operators */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) spinlock_t q_lock; /* locking */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) int q_enabled; /* enabled flag */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) int qpos_left; /* left position */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) int qpos_right; /* right position */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) int qpos_changed; /* position changed flag */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) struct snd_kcontrol *qsound_switch;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) struct snd_kcontrol *qsound_space;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) struct mutex access_mutex; /* locking */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) const struct firmware *csp_programs[CSP_PROGRAM_COUNT];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) int snd_sb_csp_new(struct snd_sb *chip, int device, struct snd_hwdep ** rhwdep);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) #endif /* __SOUND_SB16_CSP */