diff options
author | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-01-03 16:52:34 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-02-13 21:10:15 -0200 |
commit | 4155109aa88ccf478b1d59a63df1969a5f519800 (patch) | |
tree | d714be9f954e80f63dbd0cf752cb13aa99a148df /drivers/media/dvb-core/dvbdev.c | |
parent | 3bde1b78408b7b1136cd64722b6cd8b2eb70b217 (diff) | |
download | linux-4155109aa88ccf478b1d59a63df1969a5f519800.tar.gz linux-4155109aa88ccf478b1d59a63df1969a5f519800.tar.bz2 linux-4155109aa88ccf478b1d59a63df1969a5f519800.zip |
[media] dvbdev: add a function to create DVB media graph
We need to create a DVB graph, linking the several DVB devnodes.
Add such function. Please notice that this helper function
doesn't take into account devices with multiple DVB adapters
and frontends.
For devices with multiple adapters, they should either create two
different media controller instances or to improve this function
to take the adapter ID into account.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/dvb-core/dvbdev.c')
-rw-r--r-- | drivers/media/dvb-core/dvbdev.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c index c5de02455b17..a991819ed1e1 100644 --- a/drivers/media/dvb-core/dvbdev.c +++ b/drivers/media/dvb-core/dvbdev.c @@ -380,6 +380,51 @@ void dvb_unregister_device(struct dvb_device *dvbdev) } EXPORT_SYMBOL(dvb_unregister_device); + +void dvb_create_media_graph(struct media_device *mdev) +{ +#ifdef CONFIG_MEDIA_CONTROLLER_DVB + struct media_entity *entity, *tuner = NULL, *fe = NULL; + struct media_entity *demux = NULL, *dvr = NULL, *ca = NULL; + + if (!mdev) + return; + + media_device_for_each_entity(entity, mdev) { + switch (entity->type) { + case MEDIA_ENT_T_V4L2_SUBDEV_TUNER: + tuner = entity; + break; + case MEDIA_ENT_T_DEVNODE_DVB_FE: + fe = entity; + break; + case MEDIA_ENT_T_DEVNODE_DVB_DEMUX: + demux = entity; + break; + case MEDIA_ENT_T_DEVNODE_DVB_DVR: + dvr = entity; + break; + case MEDIA_ENT_T_DEVNODE_DVB_CA: + ca = entity; + break; + } + } + + if (tuner && fe) + media_entity_create_link(tuner, 0, fe, 0, 0); + + if (fe && demux) + media_entity_create_link(fe, 1, demux, 0, 0); + + if (demux && dvr) + media_entity_create_link(demux, 1, dvr, 0, 0); + + if (demux && ca) + media_entity_create_link(demux, 1, ca, 0, 0); +#endif +} +EXPORT_SYMBOL_GPL(dvb_create_media_graph); + static int dvbdev_check_free_adapter_num(int num) { struct list_head *entry; |