Better handle pads for tuning/decoder part of the devices
Subsystems (5)
cover Better handle pads for tuning/decoder part of the devices
At PC consumer devices, it is very common that the bridge same driver to be attached to different types of tuners and demods. We need a way for the Kernel to properly identify what kind of signal is provided by each PAD, in order to properly setup the pipelines.
The previous approach were to hardcode a fixed number of PADs for all elements of the same type. This is not good, as different devices may actually have a different number of pads.
It was acceptable in the past, as there were a promisse of adding "soon" a properties API that would allow to identify the type for each PADs, but this was never merged (or even a patchset got submitted).
So, replace this approach by another one: add a "taint" mark to pads that contain different types of signals.
I tried to minimize the number of signals, in order to make it simpler to convert from the past way. However, I'm not inspired today to give names to the signals each pad contain. So, feel free to give better suggestions if this one doesn't fit too well.
For now, this is just a RFC, compile-tested only, as the main goal here is to discuss about an approach. Once I get enough feedback, I'll do some tests.
Mauro Carvalho Chehab (4):
media: v4l2: remove VBI output pad
media: v4l2: taint pads with the signal types for consumer devices
v4l2-mc: switch it to use the new approach to setup pipelines
media: dvb: use signals to discover pads
drivers/media/dvb-core/dvbdev.c | 37 ++++++++- drivers/media/dvb-frontends/au8522_decoder.c | 4 +- drivers/media/i2c/msp3400-driver.c | 2 + drivers/media/i2c/saa7115.c | 3 +- drivers/media/i2c/tvp5150.c | 3 +- drivers/media/pci/saa7134/saa7134-core.c | 3 +- drivers/media/tuners/si2157.c | 3 + drivers/media/usb/dvb-usb-v2/mxl111sf.c | 2 + drivers/media/v4l2-core/tuner-core.c | 5 ++ drivers/media/v4l2-core/v4l2-mc.c | 87 ++++++++++++++++---- include/media/media-entity.h | 33 ++++++++ include/media/v4l2-mc.h | 2 - 12 files changed, 158 insertions(+), 26 deletions(-)
Signature · 1 line
2.17.1
RFC PATCH 1/4 media: v4l2: remove VBI output pad
The signal there is the same as the video output (well, except for sliced VBI, but let's simplify the model and ignore it, at least for now - as it is routed together with raw VBI).
--- drivers/media/dvb-frontends/au8522_decoder.c | 1 - drivers/media/i2c/saa7115.c | 1 - drivers/media/i2c/tvp5150.c | 1 - drivers/media/pci/saa7134/saa7134-core.c | 1 - drivers/media/v4l2-core/v4l2-mc.c | 2 +- include/media/v4l2-mc.h | 2 -- 6 files changed, 1 insertion(+), 7 deletions(-)
drivers/media/dvb-frontends/au8522_decoder.c +0 -1
@@ -722,7 +722,6 @@ static int au8522_probe(struct i2c_client *client, state->pads[DEMOD_PAD_IF_INPUT ].flags =MEDIA_PAD_FL_SINK ; state->pads[DEMOD_PAD_VID_OUT ].flags =MEDIA_PAD_FL_SOURCE ; - state->pads[DEMOD_PAD_VBI_OUT ].flags =MEDIA_PAD_FL_SOURCE ; state->pads[DEMOD_PAD_AUDIO_OUT ].flags =MEDIA_PAD_FL_SOURCE ; sd->entity.function =MEDIA_ENT_F_ATV_DECODER ;
drivers/media/i2c/saa7115.c +0 -1
@@ -1836,7 +1836,6 @@ static int saa711x_probe(struct i2c_client *client,#if defined(CONFIG_MEDIA_CONTROLLER ) state->pads[DEMOD_PAD_IF_INPUT ].flags =MEDIA_PAD_FL_SINK ; state->pads[DEMOD_PAD_VID_OUT ].flags =MEDIA_PAD_FL_SOURCE ; - state->pads[DEMOD_PAD_VBI_OUT ].flags =MEDIA_PAD_FL_SOURCE ; sd->entity.function =MEDIA_ENT_F_ATV_DECODER ;
drivers/media/i2c/tvp5150.c +0 -1
@@ -1496,7 +1496,6 @@ static int tvp5150_probe(struct i2c_client *c,#if defined(CONFIG_MEDIA_CONTROLLER ) core->pads[DEMOD_PAD_IF_INPUT ].flags =MEDIA_PAD_FL_SINK ; core->pads[DEMOD_PAD_VID_OUT ].flags =MEDIA_PAD_FL_SOURCE ; - core->pads[DEMOD_PAD_VBI_OUT ].flags =MEDIA_PAD_FL_SOURCE ; sd->entity.function =MEDIA_ENT_F_ATV_DECODER ;
drivers/media/pci/saa7134/saa7134-core.c +0 -1
@@ -847,7 +847,6 @@ static void saa7134_create_entities(struct saa7134_dev *dev) dev->demod.name ="saa713x" ; dev->demod_pad[DEMOD_PAD_IF_INPUT ].flags =MEDIA_PAD_FL_SINK ; dev->demod_pad[DEMOD_PAD_VID_OUT ].flags =MEDIA_PAD_FL_SOURCE ; - dev->demod_pad[DEMOD_PAD_VBI_OUT ].flags =MEDIA_PAD_FL_SOURCE ; dev->demod.function =MEDIA_ENT_F_ATV_DECODER ; ret = media_entity_pads_init(&dev->demod, DEMOD_NUM_PADS,
drivers/media/v4l2-core/v4l2-mc.c +1 -1
@@ -147,7 +147,7 @@ int v4l2_mc_create_media_graph(struct media_device *mdev) }if (io_vbi) { - ret =media_create_pad_link (decoder,DEMOD_PAD_VBI_OUT , + ret =media_create_pad_link (decoder,DEMOD_PAD_VID_OUT , io_vbi,0 ,MEDIA_LNK_FL_ENABLED );if (ret)
include/media/v4l2-mc.h +0 -2
@@ -89,14 +89,12 @@ enum if_aud_dec_pad_index {* * @DEMOD_PAD_IF_INPUT: IF input sink pad. * @DEMOD_PAD_VID_OUT: Video output source pad. -* @DEMOD_PAD_VBI_OUT: Vertical Blank Interface (VBI) output source pad. * @DEMOD_PAD_AUDIO_OUT: Audio output source pad. * @DEMOD_NUM_PADS: Maximum number of output pads. */ enum demod_pad_index {DEMOD_PAD_IF_INPUT ,DEMOD_PAD_VID_OUT , -DEMOD_PAD_VBI_OUT ,DEMOD_PAD_AUDIO_OUT ,DEMOD_NUM_PADS };
Signature · 1 line
2.17.1
RFC PATCH 2/4 media: v4l2: taint pads with the signal types for consumer devices
In reply to Mauro Carvalho ChehabConsumer devices are provided with a wide diferent range of types supported by the same driver, allowing different configutations.
In order to make easier to setup media controller links, "taint" pads with the signal type it carries.
While here, get rid of DEMOD_PAD_VBI_OUT, as the signal it carries is actually the same as the normal video output.
The difference happens at the video/VBI interface:
- for VBI, only the hidden lines are streamed;
- for video, the stream is usually cropped to hide the vbi lines.
--- drivers/media/dvb-frontends/au8522_decoder.c | 3 ++ drivers/media/i2c/msp3400-driver.c | 2 ++ drivers/media/i2c/saa7115.c | 2 ++ drivers/media/i2c/tvp5150.c | 2 ++ drivers/media/pci/saa7134/saa7134-core.c | 2 ++ drivers/media/tuners/si2157.c | 3 ++ drivers/media/usb/dvb-usb-v2/mxl111sf.c | 2 ++ drivers/media/v4l2-core/tuner-core.c | 5 +++ include/media/media-entity.h | 33 ++++++++++++++++++++ 9 files changed, 54 insertions(+)
drivers/media/dvb-frontends/au8522_decoder.c +3 -0
@@ -721,8 +721,11 @@ static int au8522_probe(struct i2c_client *client,#if defined(CONFIG_MEDIA_CONTROLLER ) state->pads[DEMOD_PAD_IF_INPUT ].flags =MEDIA_PAD_FL_SINK ; + state->pads[DEMOD_PAD_IF_INPUT ].sig_type =PAD_SIGNAL_RF ; state->pads[DEMOD_PAD_VID_OUT ].flags =MEDIA_PAD_FL_SOURCE ; + state->pads[DEMOD_PAD_VID_OUT ].sig_type =PAD_SIGNAL_ATV_VIDEO ; state->pads[DEMOD_PAD_AUDIO_OUT ].flags =MEDIA_PAD_FL_SOURCE ; + state->pads[DEMOD_PAD_AUDIO_OUT ].sig_type =PAD_SIGNAL_AUDIO ; sd->entity.function =MEDIA_ENT_F_ATV_DECODER ; ret = media_entity_pads_init(&sd->entity, ARRAY_SIZE(state->pads),
drivers/media/i2c/msp3400-driver.c +2 -0
@@ -704,7 +704,9 @@ static int msp_probe(struct i2c_client *client, const struct i2c_device_id *id)#if defined(CONFIG_MEDIA_CONTROLLER ) state->pads[IF_AUD_DEC_PAD_IF_INPUT ].flags =MEDIA_PAD_FL_SINK ; + state->pads[IF_AUD_DEC_PAD_IF_INPUT ].sig_type =PAD_SIGNAL_AUDIO ; state->pads[IF_AUD_DEC_PAD_OUT ].flags =MEDIA_PAD_FL_SOURCE ; + state->pads[IF_AUD_DEC_PAD_OUT ].sig_type =PAD_SIGNAL_AUDIO ; sd->entity.function =MEDIA_ENT_F_IF_AUD_DECODER ;
drivers/media/i2c/saa7115.c +2 -0
@@ -1835,7 +1835,9 @@ static int saa711x_probe(struct i2c_client *client,#if defined(CONFIG_MEDIA_CONTROLLER ) state->pads[DEMOD_PAD_IF_INPUT ].flags =MEDIA_PAD_FL_SINK ; + state->pads[DEMOD_PAD_IF_INPUT ].sig_type =PAD_SIGNAL_RF ; state->pads[DEMOD_PAD_VID_OUT ].flags =MEDIA_PAD_FL_SOURCE ; + state->pads[DEMOD_PAD_VID_OUT ].sig_type =PAD_SIGNAL_ATV_VIDEO ; sd->entity.function =MEDIA_ENT_F_ATV_DECODER ;
drivers/media/i2c/tvp5150.c +2 -0
@@ -1495,7 +1495,9 @@ static int tvp5150_probe(struct i2c_client *c,#if defined(CONFIG_MEDIA_CONTROLLER ) core->pads[DEMOD_PAD_IF_INPUT ].flags =MEDIA_PAD_FL_SINK ; + core->pads[DEMOD_PAD_IF_INPUT ].sig_type =PAD_SIGNAL_RF ; core->pads[DEMOD_PAD_VID_OUT ].flags =MEDIA_PAD_FL_SOURCE ; + core->pads[DEMOD_PAD_VID_OUT ].sig_type =PAD_SIGNAL_ATV_VIDEO ; sd->entity.function =MEDIA_ENT_F_ATV_DECODER ;
drivers/media/pci/saa7134/saa7134-core.c +2 -0
@@ -846,7 +846,9 @@ static void saa7134_create_entities(struct saa7134_dev *dev)if (!decoder) { dev->demod.name ="saa713x" ; dev->demod_pad[DEMOD_PAD_IF_INPUT ].flags =MEDIA_PAD_FL_SINK ; + dev->demod_pad[DEMOD_PAD_IF_INPUT ].sig_type =PAD_SIGNAL_RF ; dev->demod_pad[DEMOD_PAD_VID_OUT ].flags =MEDIA_PAD_FL_SOURCE ; + dev->demod_pad[DEMOD_PAD_VID_OUT ].sig_type =PAD_SIGNAL_ATV_VIDEO ; dev->demod.function =MEDIA_ENT_F_ATV_DECODER ; ret = media_entity_pads_init(&dev->demod, DEMOD_NUM_PADS,
drivers/media/tuners/si2157.c +3 -0
@@ -469,8 +469,11 @@ static int si2157_probe(struct i2c_client *client, dev->ent.function =MEDIA_ENT_F_TUNER ; dev->pad[TUNER_PAD_RF_INPUT ].flags =MEDIA_PAD_FL_SINK ; + dev->pad[TUNER_PAD_RF_INPUT ].sig_type =PAD_SIGNAL_RF ; dev->pad[TUNER_PAD_OUTPUT ].flags =MEDIA_PAD_FL_SOURCE ; + dev->pad[TUNER_PAD_OUTPUT ].sig_type =PAD_SIGNAL_CARRIERS ; dev->pad[TUNER_PAD_AUD_OUT ].flags =MEDIA_PAD_FL_SOURCE ; + dev->pad[TUNER_PAD_AUD_OUT ].sig_type =PAD_SIGNAL_AUDIO ; ret =media_entity_pads_init (&dev->ent,TUNER_NUM_PADS , &dev->pad[0 ]);
drivers/media/usb/dvb-usb-v2/mxl111sf.c +2 -0
@@ -893,7 +893,9 @@ static int mxl111sf_attach_tuner(struct dvb_usb_adapter *adap) state->tuner.function =MEDIA_ENT_F_TUNER ; state->tuner.name ="mxl111sf tuner" ; state->tuner_pads[TUNER_PAD_RF_INPUT ].flags =MEDIA_PAD_FL_SINK ; + state->tuner_pads[TUNER_PAD_RF_INPUT ].sig_type =PAD_SIGNAL_RF ; state->tuner_pads[TUNER_PAD_OUTPUT ].flags =MEDIA_PAD_FL_SOURCE ; + state->tuner_pads[TUNER_PAD_OUTPUT ].sig_type =PAD_SIGNAL_CARRIERS ; ret =media_entity_pads_init (&state->tuner,TUNER_NUM_PADS , state->tuner_pads);
drivers/media/v4l2-core/tuner-core.c +5 -0
@@ -685,15 +685,20 @@ static int tuner_probe(struct i2c_client *client,*/ if (t->type ==TUNER_TDA9887 ) { t->pad[IF_VID_DEC_PAD_IF_INPUT ].flags =MEDIA_PAD_FL_SINK ; + t->pad[IF_VID_DEC_PAD_IF_INPUT ].sig_type =PAD_SIGNAL_RF ; t->pad[IF_VID_DEC_PAD_OUT ].flags =MEDIA_PAD_FL_SOURCE ; + t->pad[IF_VID_DEC_PAD_OUT ].sig_type =PAD_SIGNAL_ATV_VIDEO ; ret =media_entity_pads_init (&t->sd.entity,IF_VID_DEC_PAD_NUM_PADS , &t->pad[0 ]); t->sd.entity.function =MEDIA_ENT_F_IF_VID_DECODER ; }else { t->pad[TUNER_PAD_RF_INPUT ].flags =MEDIA_PAD_FL_SINK ; + t->pad[TUNER_PAD_RF_INPUT ].sig_type =PAD_SIGNAL_RF ; t->pad[TUNER_PAD_OUTPUT ].flags =MEDIA_PAD_FL_SOURCE ; + t->pad[TUNER_PAD_OUTPUT ].sig_type =PAD_SIGNAL_CARRIERS ; t->pad[TUNER_PAD_AUD_OUT ].flags =MEDIA_PAD_FL_SOURCE ; + t->pad[TUNER_PAD_AUD_OUT ].sig_type =PAD_SIGNAL_AUDIO ; ret =media_entity_pads_init (&t->sd.entity,TUNER_NUM_PADS , &t->pad[0 ]); t->sd.entity.function =MEDIA_ENT_F_TUNER ;
include/media/media-entity.h +33 -0
@@ -155,6 +155,38 @@ struct media_link {bool is_backlink; }; +/** +* struct media_pad_signal_type - type of the signal inside a media pad +* +* @PAD_SIGNAL_DEFAULT +* Default signal. Use this when all inputs or all outputs are +* uniquely identified by just its number and all carries the same +* signal type +* @PAD_SIGNAL_RF +* The pad contains a Radio Frequency, Intermediate Frequency or +* baseband signal. +* All Tuner sinks should use it. +* On tuner sources, this is used for digital TV demodulators and for +* IF-PLL demodulator like tda9887. +* @PAD_SIGNAL_CARRIERS +* The pad contains analog signals carrying either a digital or an analog +* modulated (or baseband) signal. This is provided by tuner source +* pads and used by analog TV standard decoders and by digital tv demods. +* @PAD_SIGNAL_ATV_VIDEO +* Contains a bitstream of samples from an analog TV video source, with +* usually contains the VBI data on it. +* @PAD_SIGNAL_AUDIO +* Contains an Intermediate Frequency analog signal from an audio +* sub-carrier or an audio bitstream. Provided by tuners and consumed by audio AM/FM decoders. +*/ +enum media_pad_signal_type { +PAD_SIGNAL_DEFAULT =0 , +PAD_SIGNAL_RF , +PAD_SIGNAL_CARRIERS , +PAD_SIGNAL_ATV_VIDEO , +PAD_SIGNAL_AUDIO , +}; +/** * struct media_pad - A media pad graph object. *
@@ -169,6 +201,7 @@ struct media_pad {struct media_gobj graph_obj;/* must be first field in struct */ struct media_entity *entity;u16 index; +enum media_pad_signal_type sig_type;unsigned long flags; };
Signature · 1 line
2.17.1
RFC PATCH 3/4 v4l2-mc: switch it to use the new approach to setup pipelines
In reply to Mauro Carvalho ChehabInstead of relying on a static map for pids, use the new sig_type "taint" type to setup the pipelines with the same tipe between different entities.
--- drivers/media/v4l2-core/v4l2-mc.c | 87 +++++++++++++++++++++++++------ 1 file changed, 71 insertions(+), 16 deletions(-)
drivers/media/v4l2-core/v4l2-mc.c +71 -16
@@ -19,6 +19,28 @@#include <media/v4l2-subdev.h> #include <media/videobuf2-core.h> +static int get_pad_index (struct media_entity *entity,bool is_sink, +enum media_pad_signal_type sig_type) +{ +int i; +bool pad_is_sink; + +for (i =0 ; i < entity->num_pads; i++) { +if (entity->pads[i].flags ==MEDIA_PAD_FL_SINK ) + pad_is_sink = true; +else if (entity->pads[i].flags ==MEDIA_PAD_FL_SOURCE ) + pad_is_sink = false; +else +continue ;/* This is an error! */ + +if (pad_is_sink != is_sink) +continue ; +if (entity->pads[i].sig_type == sig_type) +return i; + } +return -EINVAL ; +} +int v4l2_mc_create_media_graph (struct media_device *mdev) {
@@ -28,7 +50,7 @@ int v4l2_mc_create_media_graph(struct media_device *mdev)struct media_entity *io_v4l =NULL , *io_vbi =NULL , *io_swradio =NULL ;bool is_webcam = false;u32 flags; -int ret; +int ret, pad_sink, pad_source;if (!mdev)return 0 ;
@@ -97,29 +119,48 @@ int v4l2_mc_create_media_graph(struct media_device *mdev)/* Link the tuner and IF video output pads */ if (tuner) {if (if_vid) { - ret =media_create_pad_link (tuner,TUNER_PAD_OUTPUT , - if_vid, -IF_VID_DEC_PAD_IF_INPUT , + pad_source =get_pad_index (tuner, false,PAD_SIGNAL_RF ); + pad_sink =get_pad_index (if_vid, true,PAD_SIGNAL_RF ); +if (pad_source <0 || pad_sink <0 ) +return -EINVAL ; + ret =media_create_pad_link (tuner, pad_source, + if_vid, pad_sink,MEDIA_LNK_FL_ENABLED );if (ret)return ret; - ret =media_create_pad_link (if_vid,IF_VID_DEC_PAD_OUT , - decoder,DEMOD_PAD_IF_INPUT , + + pad_source =get_pad_index (if_vid, false, +PAD_SIGNAL_ATV_VIDEO ); + pad_sink =get_pad_index (decoder, true, +PAD_SIGNAL_ATV_VIDEO ); +if (pad_source <0 || pad_sink <0 ) +return -EINVAL ; + ret =media_create_pad_link (if_vid, pad_source, + decoder, pad_sink,MEDIA_LNK_FL_ENABLED );if (ret)return ret; }else { - ret =media_create_pad_link (tuner,TUNER_PAD_OUTPUT , - decoder,DEMOD_PAD_IF_INPUT , + pad_source =get_pad_index (tuner, false,PAD_SIGNAL_RF ); + pad_sink =get_pad_index (decoder, true,PAD_SIGNAL_RF ); +if (pad_source <0 || pad_sink <0 ) +return -EINVAL ; + ret =media_create_pad_link (tuner, pad_source, + decoder, pad_sink,MEDIA_LNK_FL_ENABLED );if (ret)return ret; }if (if_aud) { - ret =media_create_pad_link (tuner,TUNER_PAD_AUD_OUT , - if_aud, -IF_AUD_DEC_PAD_IF_INPUT , + pad_source =get_pad_index (tuner, false, +PAD_SIGNAL_AUDIO ); + pad_sink =get_pad_index (decoder, true, +PAD_SIGNAL_AUDIO ); +if (pad_source <0 || pad_sink <0 ) +return -EINVAL ; + ret =media_create_pad_link (tuner, pad_source, + if_aud, pad_sink,MEDIA_LNK_FL_ENABLED );if (ret)return ret;
@@ -131,7 +172,10 @@ int v4l2_mc_create_media_graph(struct media_device *mdev)/* Create demod to V4L, VBI and SDR radio links */ if (io_v4l) { - ret =media_create_pad_link (decoder,DEMOD_PAD_VID_OUT , + pad_source =get_pad_index (tuner, false,PAD_SIGNAL_ATV_VIDEO ); +if (pad_source <0 ) +return -EINVAL ; + ret =media_create_pad_link (decoder, pad_source, io_v4l,0 ,MEDIA_LNK_FL_ENABLED );if (ret)
@@ -139,7 +183,10 @@ int v4l2_mc_create_media_graph(struct media_device *mdev) }if (io_swradio) { - ret =media_create_pad_link (decoder,DEMOD_PAD_VID_OUT , + pad_source =get_pad_index (tuner, false,PAD_SIGNAL_ATV_VIDEO ); +if (pad_source <0 ) +return -EINVAL ; + ret =media_create_pad_link (decoder, pad_source, io_swradio,0 ,MEDIA_LNK_FL_ENABLED );if (ret)
@@ -147,7 +194,10 @@ int v4l2_mc_create_media_graph(struct media_device *mdev) }if (io_vbi) { - ret =media_create_pad_link (decoder,DEMOD_PAD_VID_OUT , + pad_source =get_pad_index (tuner, false,PAD_SIGNAL_ATV_VIDEO ); +if (pad_source <0 ) +return -EINVAL ; + ret =media_create_pad_link (decoder, pad_source, io_vbi,0 ,MEDIA_LNK_FL_ENABLED );if (ret)
@@ -161,13 +211,18 @@ int v4l2_mc_create_media_graph(struct media_device *mdev)case MEDIA_ENT_F_CONN_RF :if (!tuner)continue ; - + pad_source =get_pad_index (tuner, false,PAD_SIGNAL_RF ); +if (pad_source <0 ) +return -EINVAL ; ret =media_create_pad_link (entity,0 , tuner, -TUNER_PAD_RF_INPUT , + pad_source, flags);break ;case MEDIA_ENT_F_CONN_SVIDEO :case MEDIA_ENT_F_CONN_COMPOSITE : + pad_sink =get_pad_index (decoder, true,PAD_SIGNAL_RF ); +if (pad_sink <0 ) +return -EINVAL ; ret =media_create_pad_link (entity,0 , decoder,DEMOD_PAD_IF_INPUT , flags);
Signature · 1 line
2.17.1
RFC PATCH 4/4 media: dvb: use signals to discover pads
In reply to Mauro Carvalho ChehabOn tuner pads, multiple signals are present. Be sure to get the right PAD by using them.
--- drivers/media/dvb-core/dvbdev.c | 37 +++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-)
drivers/media/dvb-core/dvbdev.c +33 -4
@@ -607,6 +607,28 @@ static int dvb_create_io_intf_links(struct dvb_adapter *adap,return 0 ; } +static int get_pad_index (struct media_entity *entity,bool is_sink, +enum media_pad_signal_type sig_type) +{ +int i; +bool pad_is_sink; + +for (i =0 ; i < entity->num_pads; i++) { +if (entity->pads[i].flags ==MEDIA_PAD_FL_SINK ) + pad_is_sink = true; +else if (entity->pads[i].flags ==MEDIA_PAD_FL_SOURCE ) + pad_is_sink = false; +else +continue ;/* This is an error! */ + +if (pad_is_sink != is_sink) +continue ; +if (entity->pads[i].sig_type == sig_type) +return i; + } +return -EINVAL ; +} +int dvb_create_media_graph (struct dvb_adapter *adap,bool create_rf_connector) {
@@ -618,7 +640,7 @@ int dvb_create_media_graph(struct dvb_adapter *adap,unsigned demux_pad =0 ;unsigned dvr_pad =0 ;unsigned ntuner =0 , ndemod =0 ; -int ret; +int ret, pad_source, pad_sink;static const char *connector_name ="Television" ;if (!mdev)
@@ -678,7 +700,7 @@ int dvb_create_media_graph(struct dvb_adapter *adap,if (ret)return ret; -if (!ntuner) +if (!ntuner) { ret = media_create_pad_links(mdev, MEDIA_ENT_F_CONN_RF, conn, 0,
@@ -686,19 +708,26 @@ int dvb_create_media_graph(struct dvb_adapter *adap, demod,0 ,MEDIA_LNK_FL_ENABLED , false); - else + }else { + pad_sink =get_pad_index (tuner, true,PAD_SIGNAL_RF ); +if (pad_sink <0 ) +return -EINVAL ; ret =media_create_pad_links (mdev,MEDIA_ENT_F_CONN_RF , conn,0 ,MEDIA_ENT_F_TUNER , - tuner,TUNER_PAD_RF_INPUT , + tuner, pad_sink,MEDIA_LNK_FL_ENABLED , false); + }if (ret)return ret; }if (ntuner && ndemod) { + pad_source =get_pad_index (tuner, true,PAD_SIGNAL_RF ); +if (pad_source) +return -EINVAL ; ret = media_create_pad_links(mdev, MEDIA_ENT_F_TUNER, tuner, TUNER_PAD_OUTPUT,
Signature · 1 line
2.17.1