Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 1999 by Uros Bizjak <uros@kss-loka.si> |
| 3 | * Takashi Iwai <tiwai@suse.de> |
| 4 | * |
| 5 | * SB16ASP/AWE32 CSP control |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program; if not, write to the Free Software |
| 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 20 | * |
| 21 | */ |
David Howells | 674e95c | 2012-10-09 09:49:13 +0100 | [diff] [blame] | 22 | #ifndef __SOUND_SB16_CSP_H |
| 23 | #define __SOUND_SB16_CSP_H |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | |
David Howells | a1ce392 | 2012-10-02 18:01:25 +0100 | [diff] [blame] | 25 | #include <sound/sb.h> |
| 26 | #include <sound/hwdep.h> |
Clemens Ladisch | de66d53 | 2006-11-06 09:18:34 +0100 | [diff] [blame] | 27 | #include <linux/firmware.h> |
David Howells | 674e95c | 2012-10-09 09:49:13 +0100 | [diff] [blame] | 28 | #include <uapi/sound/sb16_csp.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | |
Takashi Iwai | 029d64b | 2005-11-17 14:34:36 +0100 | [diff] [blame] | 30 | struct snd_sb_csp; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | |
Clemens Ladisch | de66d53 | 2006-11-06 09:18:34 +0100 | [diff] [blame] | 32 | /* indices for the known CSP programs */ |
| 33 | enum { |
| 34 | CSP_PROGRAM_MULAW, |
| 35 | CSP_PROGRAM_ALAW, |
| 36 | CSP_PROGRAM_ADPCM_INIT, |
| 37 | CSP_PROGRAM_ADPCM_PLAYBACK, |
| 38 | CSP_PROGRAM_ADPCM_CAPTURE, |
| 39 | |
| 40 | CSP_PROGRAM_COUNT |
| 41 | }; |
| 42 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | /* |
| 44 | * CSP operators |
| 45 | */ |
Takashi Iwai | 029d64b | 2005-11-17 14:34:36 +0100 | [diff] [blame] | 46 | struct snd_sb_csp_ops { |
| 47 | int (*csp_use) (struct snd_sb_csp * p); |
| 48 | int (*csp_unuse) (struct snd_sb_csp * p); |
| 49 | int (*csp_autoload) (struct snd_sb_csp * p, int pcm_sfmt, int play_rec_mode); |
| 50 | int (*csp_start) (struct snd_sb_csp * p, int sample_width, int channels); |
| 51 | int (*csp_stop) (struct snd_sb_csp * p); |
| 52 | int (*csp_qsound_transfer) (struct snd_sb_csp * p); |
| 53 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | |
| 55 | /* |
| 56 | * CSP private data |
| 57 | */ |
| 58 | struct snd_sb_csp { |
Takashi Iwai | 029d64b | 2005-11-17 14:34:36 +0100 | [diff] [blame] | 59 | struct snd_sb *chip; /* SB16 DSP */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | int used; /* usage flag - exclusive */ |
| 61 | char codec_name[16]; /* name of codec */ |
| 62 | unsigned short func_nr; /* function number */ |
| 63 | unsigned int acc_format; /* accepted PCM formats */ |
| 64 | int acc_channels; /* accepted channels */ |
| 65 | int acc_width; /* accepted sample width */ |
| 66 | int acc_rates; /* accepted sample rates */ |
| 67 | int mode; /* MODE */ |
| 68 | int run_channels; /* current CSP channels */ |
| 69 | int run_width; /* current sample width */ |
| 70 | int version; /* CSP version (0x10 - 0x1f) */ |
| 71 | int running; /* running state */ |
| 72 | |
Takashi Iwai | 029d64b | 2005-11-17 14:34:36 +0100 | [diff] [blame] | 73 | struct snd_sb_csp_ops ops; /* operators */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | |
| 75 | spinlock_t q_lock; /* locking */ |
| 76 | int q_enabled; /* enabled flag */ |
| 77 | int qpos_left; /* left position */ |
| 78 | int qpos_right; /* right position */ |
| 79 | int qpos_changed; /* position changed flag */ |
| 80 | |
Takashi Iwai | 029d64b | 2005-11-17 14:34:36 +0100 | [diff] [blame] | 81 | struct snd_kcontrol *qsound_switch; |
| 82 | struct snd_kcontrol *qsound_space; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | |
Ingo Molnar | 8b7547f | 2006-01-16 16:33:08 +0100 | [diff] [blame] | 84 | struct mutex access_mutex; /* locking */ |
Clemens Ladisch | de66d53 | 2006-11-06 09:18:34 +0100 | [diff] [blame] | 85 | |
| 86 | const struct firmware *csp_programs[CSP_PROGRAM_COUNT]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 | }; |
| 88 | |
Takashi Iwai | 029d64b | 2005-11-17 14:34:36 +0100 | [diff] [blame] | 89 | 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] | 90 | #endif /* __SOUND_SB16_CSP */ |