mixer.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #ifndef __USBMIXER_H
  2. #define __USBMIXER_H
  3. #include <sound/info.h>
  4. struct usb_mixer_interface {
  5. struct snd_usb_audio *chip;
  6. struct usb_host_interface *hostif;
  7. struct list_head list;
  8. unsigned int ignore_ctl_error;
  9. struct urb *urb;
  10. /* array[MAX_ID_ELEMS], indexed by unit id */
  11. struct usb_mixer_elem_list **id_elems;
  12. /* the usb audio specification version this interface complies to */
  13. int protocol;
  14. /* Sound Blaster remote control stuff */
  15. const struct rc_config *rc_cfg;
  16. u32 rc_code;
  17. wait_queue_head_t rc_waitq;
  18. struct urb *rc_urb;
  19. struct usb_ctrlrequest *rc_setup_packet;
  20. u8 rc_buffer[6];
  21. };
  22. #define MAX_CHANNELS 16 /* max logical channels */
  23. enum {
  24. USB_MIXER_BOOLEAN,
  25. USB_MIXER_INV_BOOLEAN,
  26. USB_MIXER_S8,
  27. USB_MIXER_U8,
  28. USB_MIXER_S16,
  29. USB_MIXER_U16,
  30. };
  31. typedef void (*usb_mixer_elem_dump_func_t)(struct snd_info_buffer *buffer,
  32. struct usb_mixer_elem_list *list);
  33. typedef int (*usb_mixer_elem_resume_func_t)(struct usb_mixer_elem_list *elem);
  34. struct usb_mixer_elem_list {
  35. struct usb_mixer_interface *mixer;
  36. struct usb_mixer_elem_list *next_id_elem; /* list of controls with same id */
  37. struct snd_kcontrol *kctl;
  38. unsigned int id;
  39. usb_mixer_elem_dump_func_t dump;
  40. usb_mixer_elem_resume_func_t resume;
  41. };
  42. struct usb_mixer_elem_info {
  43. struct usb_mixer_elem_list head;
  44. unsigned int control; /* CS or ICN (high byte) */
  45. unsigned int cmask; /* channel mask bitmap: 0 = master */
  46. unsigned int idx_off; /* Control index offset */
  47. unsigned int ch_readonly;
  48. unsigned int master_readonly;
  49. int channels;
  50. int val_type;
  51. int min, max, res;
  52. int dBmin, dBmax;
  53. int cached;
  54. int cache_val[MAX_CHANNELS];
  55. u8 initialized;
  56. void *private_data;
  57. };
  58. int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif,
  59. int ignore_error);
  60. void snd_usb_mixer_disconnect(struct usb_mixer_interface *mixer);
  61. void snd_usb_mixer_notify_id(struct usb_mixer_interface *mixer, int unitid);
  62. int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval,
  63. int request, int validx, int value_set);
  64. int snd_usb_mixer_add_control(struct usb_mixer_elem_list *list,
  65. struct snd_kcontrol *kctl);
  66. void snd_usb_mixer_elem_init_std(struct usb_mixer_elem_list *list,
  67. struct usb_mixer_interface *mixer,
  68. int unitid);
  69. int snd_usb_mixer_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
  70. unsigned int size, unsigned int __user *_tlv);
  71. #ifdef CONFIG_PM
  72. int snd_usb_mixer_suspend(struct usb_mixer_interface *mixer);
  73. int snd_usb_mixer_resume(struct usb_mixer_interface *mixer, bool reset_resume);
  74. #endif
  75. int snd_usb_set_cur_mix_value(struct usb_mixer_elem_info *cval, int channel,
  76. int index, int value);
  77. int snd_usb_get_cur_mix_value(struct usb_mixer_elem_info *cval,
  78. int channel, int index, int *value);
  79. extern void snd_usb_mixer_elem_free(struct snd_kcontrol *kctl);
  80. #endif /* __USBMIXER_H */