[media] v4l2-mc: add an ancillary routine for PCI-based MC
[linux-2.6-block.git] / include / media / v4l2-mc.h
1 /*
2  * v4l2-mc.h - Media Controller V4L2 types and prototypes
3  *
4  * Copyright (C) 2016 Mauro Carvalho Chehab <mchehab@osg.samsung.com>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  */
16
17 #include <media/media-device.h>
18
19 /**
20  * enum tuner_pad_index - tuner pad index for MEDIA_ENT_F_TUNER
21  *
22  * @TUNER_PAD_RF_INPUT: Radiofrequency (RF) sink pad, usually linked to a
23  *                      RF connector entity.
24  * @TUNER_PAD_OUTPUT:   Tuner video output source pad. Contains the video
25  *                      chrominance and luminance or the hole bandwidth
26  *                      of the signal converted to an Intermediate Frequency
27  *                      (IF) or to baseband (on zero-IF tuners).
28  * @TUNER_PAD_AUD_OUT:  Tuner audio output source pad. Tuners used to decode
29  *                      analog TV signals have an extra pad for audio output.
30  *                      Old tuners use an analog stage with a saw filter for
31  *                      the audio IF frequency. The output of the pad is, in
32  *                      this case, the audio IF, with should be decoded either
33  *                      by the bridge chipset (that's the case of cx2388x
34  *                      chipsets) or may require an external IF sound
35  *                      processor, like msp34xx. On modern silicon tuners,
36  *                      the audio IF decoder is usually incorporated at the
37  *                      tuner. On such case, the output of this pad is an
38  *                      audio sampled data.
39  * @TUNER_NUM_PADS:     Number of pads of the tuner.
40  */
41 enum tuner_pad_index {
42         TUNER_PAD_RF_INPUT,
43         TUNER_PAD_OUTPUT,
44         TUNER_PAD_AUD_OUT,
45         TUNER_NUM_PADS
46 };
47
48 /**
49  * enum if_vid_dec_index - video IF-PLL pad index for
50  *                         MEDIA_ENT_F_IF_VID_DECODER
51  *
52  * @IF_VID_DEC_PAD_IF_INPUT:    video Intermediate Frequency (IF) sink pad
53  * @IF_VID_DEC_PAD_OUT:         IF-PLL video output source pad. Contains the
54  *                              video chrominance and luminance IF signals.
55  * @IF_VID_DEC_PAD_NUM_PADS:    Number of pads of the video IF-PLL.
56  */
57 enum if_vid_dec_pad_index {
58         IF_VID_DEC_PAD_IF_INPUT,
59         IF_VID_DEC_PAD_OUT,
60         IF_VID_DEC_PAD_NUM_PADS
61 };
62
63 /**
64  * enum if_aud_dec_index - audio/sound IF-PLL pad index for
65  *                         MEDIA_ENT_F_IF_AUD_DECODER
66  *
67  * @IF_AUD_DEC_PAD_IF_INPUT:    audio Intermediate Frequency (IF) sink pad
68  * @IF_AUD_DEC_PAD_OUT:         IF-PLL audio output source pad. Contains the
69  *                              audio sampled stream data, usually connected
70  *                              to the bridge bus via an Inter-IC Sound (I2S)
71  *                              bus.
72  * @IF_AUD_DEC_PAD_NUM_PADS:    Number of pads of the audio IF-PLL.
73  */
74 enum if_aud_dec_pad_index {
75         IF_AUD_DEC_PAD_IF_INPUT,
76         IF_AUD_DEC_PAD_OUT,
77         IF_AUD_DEC_PAD_NUM_PADS
78 };
79
80 /**
81  * enum demod_pad_index - analog TV pad index for MEDIA_ENT_F_ATV_DECODER
82  *
83  * @DEMOD_PAD_IF_INPUT: IF input sink pad.
84  * @DEMOD_PAD_VID_OUT:  Video output source pad.
85  * @DEMOD_PAD_VBI_OUT:  Vertical Blank Interface (VBI) output source pad.
86  * @DEMOD_NUM_PADS:     Maximum number of output pads.
87  */
88 enum demod_pad_index {
89         DEMOD_PAD_IF_INPUT,
90         DEMOD_PAD_VID_OUT,
91         DEMOD_PAD_VBI_OUT,
92         DEMOD_NUM_PADS
93 };
94
95
96 struct pci_dev;         /* We don't need to include pci.h here */
97
98 #ifdef CONFIG_MEDIA_CONTROLLER
99 /**
100  * v4l2_mc_create_media_graph() - create Media Controller links at the graph.
101  *
102  * @mdev:       pointer to the &media_device struct.
103  *
104  * Add links between the entities commonly found on PC customer's hardware at
105  * the V4L2 side: camera sensors, audio and video PLL-IF decoders, tuners,
106  * analog TV decoder and I/O entities (video, VBI and Software Defined Radio).
107  * NOTE: webcams are modelled on a very simple way: the sensor is
108  * connected directly to the I/O entity. All dirty details, like
109  * scaler and crop HW are hidden. While such mapping is enough for v4l2
110  * interface centric PC-consumer's hardware, V4L2 subdev centric camera
111  * hardware should not use this routine, as it will not build the right graph.
112  */
113 int v4l2_mc_create_media_graph(struct media_device *mdev);
114
115 /**
116  * v4l2_mc_pci_media_device_init() - create and initialize a
117  *      struct &media_device from a PCI device.
118  *
119  * @pci_dev:    pointer to struct pci_dev
120  * @name:       media device name. If %NULL, the routine will use the default
121  *              name for the pci device, given by pci_name() macro.
122  */
123 struct media_device *v4l2_mc_pci_media_device_init(struct pci_dev *pci_dev,
124                                                    char *name);
125
126
127 #else
128 static inline int v4l2_mc_create_media_graph(struct media_device *mdev)
129 {
130         return 0;
131 }
132
133 struct media_device *v4l2_mc_pci_media_device_init(struct pci_dev *pci_dev,
134                                                    char *name) {
135         return NULL;
136 }
137
138 #endif