1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * media.h - Media Controller specific ALSA driver code
5 * Copyright (c) 2019 Shuah Khan <shuah@kernel.org>
10 * This file adds Media Controller support to the ALSA driver
11 * to use the Media Controller API to share the tuner with DVB
12 * and V4L2 drivers that control the media device.
14 * The media device is created based on the existing quirks framework.
15 * Using this approach, the media controller API usage can be added for
20 #ifdef CONFIG_SND_USB_AUDIO_USE_MEDIA_CONTROLLER
22 #include <linux/media.h>
23 #include <media/media-device.h>
24 #include <media/media-entity.h>
25 #include <media/media-dev-allocator.h>
26 #include <sound/asound.h>
29 struct media_device
*media_dev
;
30 struct media_entity media_entity
;
31 struct media_intf_devnode
*intf_devnode
;
32 struct media_link
*intf_link
;
33 struct media_pad media_pad
;
34 struct media_pipeline media_pipe
;
38 * One source pad each for SNDRV_PCM_STREAM_CAPTURE and
39 * SNDRV_PCM_STREAM_PLAYBACK. One for sink pad to link
42 #define MEDIA_MIXER_PAD_MAX (SNDRV_PCM_STREAM_LAST + 2)
44 struct media_mixer_ctl
{
45 struct media_device
*media_dev
;
46 struct media_entity media_entity
;
47 struct media_intf_devnode
*intf_devnode
;
48 struct media_link
*intf_link
;
49 struct media_pad media_pad
[MEDIA_MIXER_PAD_MAX
];
50 struct media_pipeline media_pipe
;
53 int snd_media_device_create(struct snd_usb_audio
*chip
,
54 struct usb_interface
*iface
);
55 void snd_media_device_delete(struct snd_usb_audio
*chip
);
56 int snd_media_stream_init(struct snd_usb_substream
*subs
, struct snd_pcm
*pcm
,
58 void snd_media_stream_delete(struct snd_usb_substream
*subs
);
59 int snd_media_start_pipeline(struct snd_usb_substream
*subs
);
60 void snd_media_stop_pipeline(struct snd_usb_substream
*subs
);
62 static inline int snd_media_device_create(struct snd_usb_audio
*chip
,
63 struct usb_interface
*iface
)
65 static inline void snd_media_device_delete(struct snd_usb_audio
*chip
) { }
66 static inline int snd_media_stream_init(struct snd_usb_substream
*subs
,
67 struct snd_pcm
*pcm
, int stream
)
69 static inline void snd_media_stream_delete(struct snd_usb_substream
*subs
) { }
70 static inline int snd_media_start_pipeline(struct snd_usb_substream
*subs
)
72 static inline void snd_media_stop_pipeline(struct snd_usb_substream
*subs
) { }
74 #endif /* __MEDIA_H */