Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  *  Copyright (c) 1999 by Uros Bizjak <uros@kss-loka.si>
0004  *                        Takashi Iwai <tiwai@suse.de>
0005  *
0006  *  SB16ASP/AWE32 CSP control
0007  */
0008 #ifndef __SOUND_SB16_CSP_H
0009 #define __SOUND_SB16_CSP_H
0010 
0011 #include <sound/sb.h>
0012 #include <sound/hwdep.h>
0013 #include <linux/firmware.h>
0014 #include <uapi/sound/sb16_csp.h>
0015 
0016 struct snd_sb_csp;
0017 
0018 /* indices for the known CSP programs */
0019 enum {
0020     CSP_PROGRAM_MULAW,
0021     CSP_PROGRAM_ALAW,
0022     CSP_PROGRAM_ADPCM_INIT,
0023     CSP_PROGRAM_ADPCM_PLAYBACK,
0024     CSP_PROGRAM_ADPCM_CAPTURE,
0025 
0026     CSP_PROGRAM_COUNT
0027 };
0028 
0029 /*
0030  * CSP operators
0031  */
0032 struct snd_sb_csp_ops {
0033     int (*csp_use) (struct snd_sb_csp * p);
0034     int (*csp_unuse) (struct snd_sb_csp * p);
0035     int (*csp_autoload) (struct snd_sb_csp * p, snd_pcm_format_t pcm_sfmt, int play_rec_mode);
0036     int (*csp_start) (struct snd_sb_csp * p, int sample_width, int channels);
0037     int (*csp_stop) (struct snd_sb_csp * p);
0038     int (*csp_qsound_transfer) (struct snd_sb_csp * p);
0039 };
0040 
0041 /*
0042  * CSP private data
0043  */
0044 struct snd_sb_csp {
0045     struct snd_sb *chip;        /* SB16 DSP */
0046     int used;       /* usage flag - exclusive */
0047     char codec_name[16];    /* name of codec */
0048     unsigned short func_nr; /* function number */
0049     unsigned int acc_format;    /* accepted PCM formats */
0050     int acc_channels;   /* accepted channels */
0051     int acc_width;      /* accepted sample width */
0052     int acc_rates;      /* accepted sample rates */
0053     int mode;       /* MODE */
0054     int run_channels;   /* current CSP channels */
0055     int run_width;      /* current sample width */
0056     int version;        /* CSP version (0x10 - 0x1f) */
0057     int running;        /* running state */
0058 
0059     struct snd_sb_csp_ops ops;  /* operators */
0060 
0061     spinlock_t q_lock;  /* locking */
0062     int q_enabled;      /* enabled flag */
0063     int qpos_left;      /* left position */
0064     int qpos_right;     /* right position */
0065     int qpos_changed;   /* position changed flag */
0066 
0067     struct snd_kcontrol *qsound_switch;
0068     struct snd_kcontrol *qsound_space;
0069 
0070     struct mutex access_mutex;  /* locking */
0071 
0072     const struct firmware *csp_programs[CSP_PROGRAM_COUNT];
0073 };
0074 
0075 int snd_sb_csp_new(struct snd_sb *chip, int device, struct snd_hwdep ** rhwdep);
0076 #endif /* __SOUND_SB16_CSP */