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