mixer.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. bool disconnected;
  22. };
  23. #define MAX_CHANNELS 16 /* max logical channels */
  24. enum {
  25. USB_MIXER_BOOLEAN,
  26. USB_MIXER_INV_BOOLEAN,
  27. USB_MIXER_S8,
  28. USB_MIXER_U8,
  29. USB_MIXER_S16,
  30. USB_MIXER_U16,
  31. USB_MIXER_S32,
  32. USB_MIXER_U32,
  33. };
  34. typedef void (*usb_mixer_elem_dump_func_t)(struct snd_info_buffer *buffer,
  35. struct usb_mixer_elem_list *list);
  36. typedef int (*usb_mixer_elem_resume_func_t)(struct usb_mixer_elem_list *elem);
  37. struct usb_mixer_elem_list {
  38. struct usb_mixer_interface *mixer;
  39. struct usb_mixer_elem_list *next_id_elem; /* list of controls with same id */
  40. struct snd_kcontrol *kctl;
  41. unsigned int id;
  42. usb_mixer_elem_dump_func_t dump;
  43. usb_mixer_elem_resume_func_t resume;
  44. };
  45. struct usb_mixer_elem_info {
  46. struct usb_mixer_elem_list head;
  47. unsigned int control; /* CS or ICN (high byte) */
  48. unsigned int cmask; /* channel mask bitmap: 0 = master */
  49. unsigned int idx_off; /* Control index offset */
  50. unsigned int ch_readonly;
  51. unsigned int master_readonly;
  52. int channels;
  53. int val_type;
  54. int min, max, res;
  55. int dBmin, dBmax;
  56. int cached;
  57. int cache_val[MAX_CHANNELS];
  58. u8 initialized;
  59. u8 min_mute;
  60. void *private_data;
  61. };
  62. int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif,
  63. int ignore_error);
  64. void snd_usb_mixer_disconnect(struct usb_mixer_interface *mixer);
  65. void snd_usb_mixer_notify_id(struct usb_mixer_interface *mixer, int unitid);
  66. int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval,
  67. int request, int validx, int value_set);
  68. int snd_usb_mixer_add_control(struct usb_mixer_elem_list *list,
  69. struct snd_kcontrol *kctl);
  70. void snd_usb_mixer_elem_init_std(struct usb_mixer_elem_list *list,
  71. struct usb_mixer_interface *mixer,
  72. int unitid);
  73. int snd_usb_mixer_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
  74. unsigned int size, unsigned int __user *_tlv);
  75. #ifdef CONFIG_PM
  76. int snd_usb_mixer_suspend(struct usb_mixer_interface *mixer);
  77. int snd_usb_mixer_resume(struct usb_mixer_interface *mixer, bool reset_resume);
  78. #endif
  79. int snd_usb_set_cur_mix_value(struct usb_mixer_elem_info *cval, int channel,
  80. int index, int value);
  81. int snd_usb_get_cur_mix_value(struct usb_mixer_elem_info *cval,
  82. int channel, int index, int *value);
  83. extern void snd_usb_mixer_elem_free(struct snd_kcontrol *kctl);
  84. #endif /* __USBMIXER_H */