@@ -133,6 +133,25 @@ int snd_usb_unregister_vendor_ops(void)
}
EXPORT_SYMBOL_GPL(snd_usb_unregister_vendor_ops);
+struct snd_usb_stream *snd_usb_find_suppported_substream(int card_idx,
+ struct snd_pcm_hw_params *params, int direction)
+{
+ struct snd_usb_stream *as;
+ struct snd_usb_substream *subs = NULL;
+ const struct audioformat *fmt;
+
+ if (usb_chip[card_idx] && enable[card_idx]) {
+ list_for_each_entry(as, &usb_chip[card_idx]->pcm_list, list) {
+ subs = &as->substream[direction];
+ fmt = find_substream_format(subs, params);
+ if (fmt)
+ return as;
+ }
+ }
+
+ return 0;
+}
+
/*
* disconnect streams
* called from usb_audio_disconnect()
@@ -213,4 +213,7 @@ struct snd_usb_vendor_ops {
int snd_usb_register_vendor_ops(struct snd_usb_vendor_ops *ops);
int snd_usb_unregister_vendor_ops(void);
+
+struct snd_usb_stream *snd_usb_find_suppported_substream(int card_idx,
+ struct snd_pcm_hw_params *params, int direction);
#endif /* __USBAUDIO_CARD_H */
Allow for checks on a specific USB audio device to see if a requested PCM format is supported. This is needed for support for when playback is initiated by the ASoC USB backend path. Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com> --- sound/usb/card.c | 19 +++++++++++++++++++ sound/usb/card.h | 3 +++ 2 files changed, 22 insertions(+)