sb16_csp.h 2.1 KB

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