blob: 6a9af04cf175afbe31836b98e928fc5ab06c8f1e [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Daniel Macke5779992010-03-04 19:46:13 +01002#ifndef __USBAUDIO_ENDPOINT_H
3#define __USBAUDIO_ENDPOINT_H
4
Daniel Mack8fdff6a2012-04-12 13:51:11 +02005#define SND_USB_ENDPOINT_TYPE_DATA 0
6#define SND_USB_ENDPOINT_TYPE_SYNC 1
7
Takashi Iwaic7474d02020-11-23 09:53:11 +01008struct snd_usb_endpoint *snd_usb_get_endpoint(struct snd_usb_audio *chip,
Takashi Iwai54cb3192020-11-23 09:53:20 +01009 int ep_num);
Takashi Iwaic7474d02020-11-23 09:53:11 +010010
Takashi Iwai54cb3192020-11-23 09:53:20 +010011int snd_usb_add_endpoint(struct snd_usb_audio *chip, int ep_num, int type);
Daniel Mack8fdff6a2012-04-12 13:51:11 +020012
Takashi Iwaibf6313a2020-11-23 09:53:31 +010013struct snd_usb_endpoint *
14snd_usb_endpoint_open(struct snd_usb_audio *chip,
Takashi Iwaicab941b2020-11-23 09:53:33 +010015 const struct audioformat *fp,
Takashi Iwaibf6313a2020-11-23 09:53:31 +010016 const struct snd_pcm_hw_params *params,
17 bool is_sync_ep);
18void snd_usb_endpoint_close(struct snd_usb_audio *chip,
19 struct snd_usb_endpoint *ep);
20int snd_usb_endpoint_configure(struct snd_usb_audio *chip,
21 struct snd_usb_endpoint *ep);
Takashi Iwai4e7cf1f2021-09-29 10:08:36 +020022int snd_usb_endpoint_get_clock_rate(struct snd_usb_audio *chip, int clock);
Daniel Mack8fdff6a2012-04-12 13:51:11 +020023
Takashi Iwaibf6313a2020-11-23 09:53:31 +010024bool snd_usb_endpoint_compatible(struct snd_usb_audio *chip,
25 struct snd_usb_endpoint *ep,
26 const struct audioformat *fp,
27 const struct snd_pcm_hw_params *params);
28
29void snd_usb_endpoint_set_sync(struct snd_usb_audio *chip,
30 struct snd_usb_endpoint *data_ep,
31 struct snd_usb_endpoint *sync_ep);
Takashi Iwai96e221f2020-11-23 09:53:28 +010032void snd_usb_endpoint_set_callback(struct snd_usb_endpoint *ep,
Takashi Iwaid5f871f2021-09-29 10:08:43 +020033 int (*prepare)(struct snd_usb_substream *subs,
34 struct urb *urb,
35 bool in_stream_lock),
Takashi Iwai96e221f2020-11-23 09:53:28 +010036 void (*retire)(struct snd_usb_substream *subs,
37 struct urb *urb),
38 struct snd_usb_substream *data_subs);
39
Takashi Iwaibf6313a2020-11-23 09:53:31 +010040int snd_usb_endpoint_start(struct snd_usb_endpoint *ep);
Takashi Iwai813a17c2021-09-29 10:08:44 +020041void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep, bool keep_pending);
Takashi Iwaif58161b2012-11-08 08:52:45 +010042void snd_usb_endpoint_sync_pending_stop(struct snd_usb_endpoint *ep);
Takashi Iwaibf6313a2020-11-23 09:53:31 +010043void snd_usb_endpoint_suspend(struct snd_usb_endpoint *ep);
Daniel Mack8fdff6a2012-04-12 13:51:11 +020044int snd_usb_endpoint_activate(struct snd_usb_endpoint *ep);
Takashi Iwai92a586b2014-06-25 14:24:47 +020045void snd_usb_endpoint_release(struct snd_usb_endpoint *ep);
Takashi Iwai00272c62021-01-08 08:52:17 +010046void snd_usb_endpoint_free_all(struct snd_usb_audio *chip);
Daniel Mack8fdff6a2012-04-12 13:51:11 +020047
Eldad Zack98ae4722013-04-03 23:18:52 +020048int snd_usb_endpoint_implicit_feedback_sink(struct snd_usb_endpoint *ep);
Takashi Iwai3d587602020-11-23 09:53:37 +010049int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep,
Takashi Iwaid215f632021-09-29 10:08:41 +020050 struct snd_urb_ctx *ctx, int idx,
51 unsigned int avail);
Takashi Iwaid5f871f2021-09-29 10:08:43 +020052void snd_usb_queue_pending_output_urbs(struct snd_usb_endpoint *ep,
53 bool in_stream_lock);
Daniel Mack8fdff6a2012-04-12 13:51:11 +020054
Daniel Macke5779992010-03-04 19:46:13 +010055#endif /* __USBAUDIO_ENDPOINT_H */