endpoint.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __USBAUDIO_ENDPOINT_H
  3. #define __USBAUDIO_ENDPOINT_H
  4. #define SND_USB_ENDPOINT_TYPE_DATA 0
  5. #define SND_USB_ENDPOINT_TYPE_SYNC 1
  6. struct snd_usb_endpoint *snd_usb_add_endpoint(struct snd_usb_audio *chip,
  7. struct usb_host_interface *alts,
  8. int ep_num, int direction, int type);
  9. int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep,
  10. snd_pcm_format_t pcm_format,
  11. unsigned int channels,
  12. unsigned int period_bytes,
  13. unsigned int period_frames,
  14. unsigned int buffer_periods,
  15. unsigned int rate,
  16. struct audioformat *fmt,
  17. struct snd_usb_endpoint *sync_ep);
  18. int snd_usb_endpoint_start(struct snd_usb_endpoint *ep);
  19. void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep);
  20. void snd_usb_endpoint_sync_pending_stop(struct snd_usb_endpoint *ep);
  21. int snd_usb_endpoint_activate(struct snd_usb_endpoint *ep);
  22. void snd_usb_endpoint_deactivate(struct snd_usb_endpoint *ep);
  23. void snd_usb_endpoint_release(struct snd_usb_endpoint *ep);
  24. void snd_usb_endpoint_free(struct snd_usb_endpoint *ep);
  25. int snd_usb_endpoint_implicit_feedback_sink(struct snd_usb_endpoint *ep);
  26. int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep);
  27. void snd_usb_handle_sync_urb(struct snd_usb_endpoint *ep,
  28. struct snd_usb_endpoint *sender,
  29. const struct urb *urb);
  30. #define USB_AUDIO_DATA_OUT 0
  31. #define USB_AUDIO_DATA_IN 1
  32. #define USB_AUDIO_DATA_SYNC 2
  33. #ifdef CONFIG_MTK_UAC_POWER_SAVING
  34. extern void *mtk_usb_alloc_sram(int id, size_t size, dma_addr_t *dma);
  35. extern void mtk_usb_free_sram(int id);
  36. #else
  37. static inline void *mtk_usb_alloc_sram(int id, size_t size,
  38. dma_addr_t *dma)
  39. {
  40. return NULL;
  41. };
  42. static inline void mtk_usb_free_sram(int id) {};
  43. #endif
  44. #endif /* __USBAUDIO_ENDPOINT_H */