Mauro Carvalho Chehab | 6aad127 | 2016-01-29 06:11:30 -0200 | [diff] [blame] | 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 | |
Mauro Carvalho Chehab | db15227 | 2016-02-12 07:35:44 -0200 | [diff] [blame^] | 17 | #ifndef _V4L2_MC_H |
| 18 | #define _V4L2_MC_H |
| 19 | |
Mauro Carvalho Chehab | 54d0dba | 2016-02-05 07:02:43 -0200 | [diff] [blame] | 20 | #include <media/media-device.h> |
| 21 | |
Mauro Carvalho Chehab | 6aad127 | 2016-01-29 06:11:30 -0200 | [diff] [blame] | 22 | /** |
| 23 | * enum tuner_pad_index - tuner pad index for MEDIA_ENT_F_TUNER |
| 24 | * |
| 25 | * @TUNER_PAD_RF_INPUT: Radiofrequency (RF) sink pad, usually linked to a |
| 26 | * RF connector entity. |
Mauro Carvalho Chehab | 5c9077e | 2016-01-29 07:00:08 -0200 | [diff] [blame] | 27 | * @TUNER_PAD_OUTPUT: Tuner video output source pad. Contains the video |
| 28 | * chrominance and luminance or the hole bandwidth |
| 29 | * of the signal converted to an Intermediate Frequency |
| 30 | * (IF) or to baseband (on zero-IF tuners). |
| 31 | * @TUNER_PAD_AUD_OUT: Tuner audio output source pad. Tuners used to decode |
| 32 | * analog TV signals have an extra pad for audio output. |
| 33 | * Old tuners use an analog stage with a saw filter for |
| 34 | * the audio IF frequency. The output of the pad is, in |
| 35 | * this case, the audio IF, with should be decoded either |
| 36 | * by the bridge chipset (that's the case of cx2388x |
| 37 | * chipsets) or may require an external IF sound |
| 38 | * processor, like msp34xx. On modern silicon tuners, |
| 39 | * the audio IF decoder is usually incorporated at the |
| 40 | * tuner. On such case, the output of this pad is an |
| 41 | * audio sampled data. |
Mauro Carvalho Chehab | 6aad127 | 2016-01-29 06:11:30 -0200 | [diff] [blame] | 42 | * @TUNER_NUM_PADS: Number of pads of the tuner. |
| 43 | */ |
| 44 | enum tuner_pad_index { |
| 45 | TUNER_PAD_RF_INPUT, |
| 46 | TUNER_PAD_OUTPUT, |
Mauro Carvalho Chehab | 5c9077e | 2016-01-29 07:00:08 -0200 | [diff] [blame] | 47 | TUNER_PAD_AUD_OUT, |
Mauro Carvalho Chehab | 6aad127 | 2016-01-29 06:11:30 -0200 | [diff] [blame] | 48 | TUNER_NUM_PADS |
Mauro Carvalho Chehab | 5c9077e | 2016-01-29 07:00:08 -0200 | [diff] [blame] | 49 | }; |
Mauro Carvalho Chehab | 953a457 | 2016-01-29 07:00:37 -0200 | [diff] [blame] | 50 | |
| 51 | /** |
| 52 | * enum if_vid_dec_index - video IF-PLL pad index for |
| 53 | * MEDIA_ENT_F_IF_VID_DECODER |
| 54 | * |
| 55 | * @IF_VID_DEC_PAD_IF_INPUT: video Intermediate Frequency (IF) sink pad |
| 56 | * @IF_VID_DEC_PAD_OUT: IF-PLL video output source pad. Contains the |
| 57 | * video chrominance and luminance IF signals. |
| 58 | * @IF_VID_DEC_PAD_NUM_PADS: Number of pads of the video IF-PLL. |
| 59 | */ |
| 60 | enum if_vid_dec_pad_index { |
| 61 | IF_VID_DEC_PAD_IF_INPUT, |
| 62 | IF_VID_DEC_PAD_OUT, |
| 63 | IF_VID_DEC_PAD_NUM_PADS |
| 64 | }; |
| 65 | |
| 66 | /** |
| 67 | * enum if_aud_dec_index - audio/sound IF-PLL pad index for |
| 68 | * MEDIA_ENT_F_IF_AUD_DECODER |
| 69 | * |
| 70 | * @IF_AUD_DEC_PAD_IF_INPUT: audio Intermediate Frequency (IF) sink pad |
| 71 | * @IF_AUD_DEC_PAD_OUT: IF-PLL audio output source pad. Contains the |
| 72 | * audio sampled stream data, usually connected |
| 73 | * to the bridge bus via an Inter-IC Sound (I2S) |
| 74 | * bus. |
| 75 | * @IF_AUD_DEC_PAD_NUM_PADS: Number of pads of the audio IF-PLL. |
| 76 | */ |
| 77 | enum if_aud_dec_pad_index { |
| 78 | IF_AUD_DEC_PAD_IF_INPUT, |
| 79 | IF_AUD_DEC_PAD_OUT, |
| 80 | IF_AUD_DEC_PAD_NUM_PADS |
| 81 | }; |
Mauro Carvalho Chehab | e4001e9 | 2016-01-29 07:00:57 -0200 | [diff] [blame] | 82 | |
| 83 | /** |
| 84 | * enum demod_pad_index - analog TV pad index for MEDIA_ENT_F_ATV_DECODER |
| 85 | * |
| 86 | * @DEMOD_PAD_IF_INPUT: IF input sink pad. |
| 87 | * @DEMOD_PAD_VID_OUT: Video output source pad. |
| 88 | * @DEMOD_PAD_VBI_OUT: Vertical Blank Interface (VBI) output source pad. |
| 89 | * @DEMOD_NUM_PADS: Maximum number of output pads. |
| 90 | */ |
| 91 | enum demod_pad_index { |
| 92 | DEMOD_PAD_IF_INPUT, |
| 93 | DEMOD_PAD_VID_OUT, |
| 94 | DEMOD_PAD_VBI_OUT, |
| 95 | DEMOD_NUM_PADS |
| 96 | }; |
Mauro Carvalho Chehab | 54d0dba | 2016-02-05 07:02:43 -0200 | [diff] [blame] | 97 | |
Mauro Carvalho Chehab | 7047f29 | 2016-02-05 13:16:18 -0200 | [diff] [blame] | 98 | |
| 99 | struct pci_dev; /* We don't need to include pci.h here */ |
| 100 | |
| 101 | #ifdef CONFIG_MEDIA_CONTROLLER |
Mauro Carvalho Chehab | 54d0dba | 2016-02-05 07:02:43 -0200 | [diff] [blame] | 102 | /** |
| 103 | * v4l2_mc_create_media_graph() - create Media Controller links at the graph. |
| 104 | * |
| 105 | * @mdev: pointer to the &media_device struct. |
| 106 | * |
| 107 | * Add links between the entities commonly found on PC customer's hardware at |
| 108 | * the V4L2 side: camera sensors, audio and video PLL-IF decoders, tuners, |
| 109 | * analog TV decoder and I/O entities (video, VBI and Software Defined Radio). |
| 110 | * NOTE: webcams are modelled on a very simple way: the sensor is |
| 111 | * connected directly to the I/O entity. All dirty details, like |
| 112 | * scaler and crop HW are hidden. While such mapping is enough for v4l2 |
| 113 | * interface centric PC-consumer's hardware, V4L2 subdev centric camera |
| 114 | * hardware should not use this routine, as it will not build the right graph. |
| 115 | */ |
Mauro Carvalho Chehab | 54d0dba | 2016-02-05 07:02:43 -0200 | [diff] [blame] | 116 | int v4l2_mc_create_media_graph(struct media_device *mdev); |
Mauro Carvalho Chehab | 7047f29 | 2016-02-05 13:16:18 -0200 | [diff] [blame] | 117 | |
| 118 | /** |
| 119 | * v4l2_mc_pci_media_device_init() - create and initialize a |
| 120 | * struct &media_device from a PCI device. |
| 121 | * |
| 122 | * @pci_dev: pointer to struct pci_dev |
| 123 | * @name: media device name. If %NULL, the routine will use the default |
| 124 | * name for the pci device, given by pci_name() macro. |
| 125 | */ |
| 126 | struct media_device *v4l2_mc_pci_media_device_init(struct pci_dev *pci_dev, |
| 127 | char *name); |
| 128 | |
| 129 | |
Mauro Carvalho Chehab | 54d0dba | 2016-02-05 07:02:43 -0200 | [diff] [blame] | 130 | #else |
| 131 | static inline int v4l2_mc_create_media_graph(struct media_device *mdev) |
| 132 | { |
| 133 | return 0; |
| 134 | } |
Mauro Carvalho Chehab | 7047f29 | 2016-02-05 13:16:18 -0200 | [diff] [blame] | 135 | |
| 136 | struct media_device *v4l2_mc_pci_media_device_init(struct pci_dev *pci_dev, |
| 137 | char *name) { |
| 138 | return NULL; |
| 139 | } |
| 140 | |
Mauro Carvalho Chehab | 54d0dba | 2016-02-05 07:02:43 -0200 | [diff] [blame] | 141 | #endif |
Mauro Carvalho Chehab | db15227 | 2016-02-12 07:35:44 -0200 | [diff] [blame^] | 142 | |
| 143 | #endif |