media.h (bc0868c62bb13834b20a864f684cced1f84a2412) media.h (66354f18fe5fbb65f7b10a519654013d6df09f80)
1/* SPDX-License-Identifier: GPL-2.0+ */
1/*
2 * media.h - Media Controller specific ALSA driver code
3 *
2/*
3 * media.h - Media Controller specific ALSA driver code
4 *
4 * Copyright (c) 2016 Shuah Khan <shuahkh@osg.samsung.com>
5 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
5 * Copyright (c) 2019 Shuah Khan <shuah@kernel.org>
6 *
6 *
7 * This file is released under the GPLv2.
8 */
9
10/*
7 */
8
9/*
11 * This file adds Media Controller support to ALSA driver
12 * to use the Media Controller API to share tuner with DVB
13 * and V4L2 drivers that control media device. Media device
14 * is created based on existing quirks framework. Using this
15 * approach, the media controller API usage can be added for
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.
13 *
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
16 * a specific device.
16 * a specific device.
17*/
17 */
18#ifndef __MEDIA_H
19
20#ifdef CONFIG_SND_USB_AUDIO_USE_MEDIA_CONTROLLER
21
18#ifndef __MEDIA_H
19
20#ifdef CONFIG_SND_USB_AUDIO_USE_MEDIA_CONTROLLER
21
22#include <linux/media.h>
22#include <media/media-device.h>
23#include <media/media-entity.h>
23#include <media/media-device.h>
24#include <media/media-entity.h>
25#include <media/media-dev-allocator.h>
24#include <sound/asound.h>
25
26struct media_ctl {
27 struct media_device *media_dev;
28 struct media_entity media_entity;
29 struct media_intf_devnode *intf_devnode;
30 struct media_link *intf_link;
31 struct media_pad media_pad;
32 struct media_pipeline media_pipe;
33};
34
35/*
36 * One source pad each for SNDRV_PCM_STREAM_CAPTURE and
37 * SNDRV_PCM_STREAM_PLAYBACK. One for sink pad to link
38 * to AUDIO Source
26#include <sound/asound.h>
27
28struct media_ctl {
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;
35};
36
37/*
38 * One source pad each for SNDRV_PCM_STREAM_CAPTURE and
39 * SNDRV_PCM_STREAM_PLAYBACK. One for sink pad to link
40 * to AUDIO Source
39*/
41 */
40#define MEDIA_MIXER_PAD_MAX (SNDRV_PCM_STREAM_LAST + 2)
41
42struct media_mixer_ctl {
43 struct media_device *media_dev;
44 struct media_entity media_entity;
45 struct media_intf_devnode *intf_devnode;
46 struct media_link *intf_link;
47 struct media_pad media_pad[MEDIA_MIXER_PAD_MAX];
48 struct media_pipeline media_pipe;
49};
50
42#define MEDIA_MIXER_PAD_MAX (SNDRV_PCM_STREAM_LAST + 2)
43
44struct 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;
51};
52
51int media_snd_device_create(struct snd_usb_audio *chip,
53int snd_media_device_create(struct snd_usb_audio *chip,
52 struct usb_interface *iface);
54 struct usb_interface *iface);
53void media_snd_device_delete(struct snd_usb_audio *chip);
54int media_snd_stream_init(struct snd_usb_substream *subs, struct snd_pcm *pcm,
55void snd_media_device_delete(struct snd_usb_audio *chip);
56int snd_media_stream_init(struct snd_usb_substream *subs, struct snd_pcm *pcm,
55 int stream);
57 int stream);
56void media_snd_stream_delete(struct snd_usb_substream *subs);
57int media_snd_start_pipeline(struct snd_usb_substream *subs);
58void media_snd_stop_pipeline(struct snd_usb_substream *subs);
58void snd_media_stream_delete(struct snd_usb_substream *subs);
59int snd_media_start_pipeline(struct snd_usb_substream *subs);
60void snd_media_stop_pipeline(struct snd_usb_substream *subs);
59#else
61#else
60static inline int media_snd_device_create(struct snd_usb_audio *chip,
62static inline int snd_media_device_create(struct snd_usb_audio *chip,
61 struct usb_interface *iface)
62 { return 0; }
63 struct usb_interface *iface)
64 { return 0; }
63static inline void media_snd_device_delete(struct snd_usb_audio *chip) { }
64static inline int media_snd_stream_init(struct snd_usb_substream *subs,
65static inline void snd_media_device_delete(struct snd_usb_audio *chip) { }
66static inline int snd_media_stream_init(struct snd_usb_substream *subs,
65 struct snd_pcm *pcm, int stream)
66 { return 0; }
67 struct snd_pcm *pcm, int stream)
68 { return 0; }
67static inline void media_snd_stream_delete(struct snd_usb_substream *subs) { }
68static inline int media_snd_start_pipeline(struct snd_usb_substream *subs)
69static inline void snd_media_stream_delete(struct snd_usb_substream *subs) { }
70static inline int snd_media_start_pipeline(struct snd_usb_substream *subs)
69 { return 0; }
71 { return 0; }
70static inline void media_snd_stop_pipeline(struct snd_usb_substream *subs) { }
72static inline void snd_media_stop_pipeline(struct snd_usb_substream *subs) { }
71#endif
72#endif /* __MEDIA_H */
73#endif
74#endif /* __MEDIA_H */