aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb-core/dvbdev.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2016-05-07[media] media/dvb-core: forward media_create_pad_links() return valueMax Kellermann1-2/+2
Instead of always return -ENOMEM, return the real error that should come from media_create_pad_link(). Signed-off-by: Max Kellermann <max@duempel.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-03-03[media] dvb-core: fix return code checking for devices with CAOlli Salonen1-1/+1
The test for the return code was mistakenly inverted. This caused DVB devices with CA module to fail on modprobe. Tested with TechnoTrend CT2-4650 CI USB tuner. Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-01[media] dvbdev: the space is required after ','Xiubo Li1-3/+3
The space is missing after ',', and this will be introduce much noise when checking new patch around them. Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-01[media] dvbdev: replace kcalloc with kzallocXiubo Li1-2/+1
Since the number of elements equals to 1, so just use kzalloc to simplify the code and make it more readable. Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-01[media] dvbdev: remove useless parentheses after returnXiubo Li1-1/+1
The parentheses are not required after return, and just remove it. Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-01[media] tuner.h: rename TUNER_PAD_IF_OUTPUT to TUNER_PAD_OUTPUTMauro Carvalho Chehab1-1/+1
The output of a tuner is not only IF frequencies. They may also output audio on some of its pins, and may even be a zero-IF tuner, with outputs a baseband. So, rename the PAD name to make it clearer and add a proper documentation about that at tuner.h. No functional changes. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] dvbdev: create links on devices with multiple frontendsMauro Carvalho Chehab1-13/+44
Devices like mxl111sf-based WinTV Aero-m have multiple frontends, all linked on the same demod. Currently, the dvb_create_graph() function is not smart enough to create multiple links. Fix it. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] dvbdev: Add RF connector if neededMauro Carvalho Chehab1-2/+47
Several pure digital TV devices have a frontend with the tuner integrated on it. Add the RF connector when dvb_create_media_graph() is called on such devices. Tested with siano and dvb_usb_mxl111sf drivers. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] dvbdev: remove two dead functions if !CONFIG_MEDIA_CONTROLLER_DVBMauro Carvalho Chehab1-4/+2
Those functions are used only if CONFIG_MEDIA_CONTROLLER_DVB. Without that, if !CONFIG_MEDIA_CONTROLLER_DVB, it would produce two warnings: drivers/media/dvb-core/dvbdev.c:219:12: warning: 'dvb_create_tsout_entity' defined but not used [-Wunused-function] static int dvb_create_tsout_entity(struct dvb_device *dvbdev, ^ drivers/media/dvb-core/dvbdev.c:264:12: warning: 'dvb_create_media_entity' defined but not used [-Wunused-function] static int dvb_create_media_entity(struct dvb_device *dvbdev, ^ Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] media framework: rename pads init function to media_entity_pads_init()Mauro Carvalho Chehab1-2/+2
With the MC next gen rework, what's left for media_entity_init() is to just initialize the PADs. However, certain devices, like a FLASH led/light doesn't have any input or output PAD. So, there's no reason why calling media_entity_init() would be mandatory. Also, despite its name, what this function actually does is to initialize the PADs data. So, rename it to media_entity_pads_init() in order to reflect that. The media entity actual init happens during entity register, at media_device_register_entity(). We should move init of num_links and num_backlinks to it. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] media_entity: remove gfp_flags argumentMauro Carvalho Chehab1-2/+1
We should not be creating device nodes at IRQ contexts. So, the only flags we'll be using will be GFP_KERNEL. Let's remove the gfp_flags, in order to make the interface simpler. If we ever need it, it would be easy to revert those changes. While here, remove an extra blank line. Suggested-by: Sakari Ailus <sakari.ailus@iki.fi> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] dvbdev: Don't create indirect linksMauro Carvalho Chehab1-2/+8
Indirect links are those whose interface indirectly controls other functions. There are two interfaces that have indirect controls at the DVB side: - the network interface, which also controls the demux; - the DVR interface which also controls the demux. One could argue that the frontend control to the tuner is indirect. Well, that's debatable. There's no way to create subdev interfaces for tuner and demod, as those devices are tightly coupled. So, it was decided that just one interface is the best to control both entities, and there's no plan (or easy way) to decouple both. So, the DVB frontend interface should link to both entities. Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] dvbdev: move indirect links on dvr/demux to a separate functionMauro Carvalho Chehab1-19/+31
Cleanup the code a little bit by moving the routine that creates links between DVR and demux to the I/O entitis into a separate function. While here, fix the code to use strncmp() instead of strcmp(). Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] uapi/media.h: Rename entities types to functionsMauro Carvalho Chehab1-10/+10
Rename the userspace types from MEDIA_ENT_T_ to MEDIA_ENT_F_ and add the backward compatibility bits. The changes at the .c files was generated by the following coccinelle script: @@ @@ -MEDIA_ENT_T_UNKNOWN +MEDIA_ENT_F_UNKNOWN @@ @@ -MEDIA_ENT_T_DVB_BASE +MEDIA_ENT_F_DVB_BASE @@ @@ -MEDIA_ENT_T_V4L2_BASE +MEDIA_ENT_F_V4L2_BASE @@ @@ -MEDIA_ENT_T_V4L2_SUBDEV_BASE +MEDIA_ENT_F_V4L2_SUBDEV_BASE @@ @@ -MEDIA_ENT_T_CONNECTOR_BASE +MEDIA_ENT_F_CONNECTOR_BASE @@ @@ -MEDIA_ENT_T_V4L2_VIDEO +MEDIA_ENT_F_IO_V4L @@ @@ -MEDIA_ENT_T_V4L2_VBI +MEDIA_ENT_F_IO_VBI @@ @@ -MEDIA_ENT_T_V4L2_SWRADIO +MEDIA_ENT_F_IO_SWRADIO @@ @@ -MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN +MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN @@ @@ -MEDIA_ENT_T_CONN_RF +MEDIA_ENT_F_CONN_RF @@ @@ -MEDIA_ENT_T_CONN_SVIDEO +MEDIA_ENT_F_CONN_SVIDEO @@ @@ -MEDIA_ENT_T_CONN_COMPOSITE +MEDIA_ENT_F_CONN_COMPOSITE @@ @@ -MEDIA_ENT_T_CONN_TEST +MEDIA_ENT_F_CONN_TEST @@ @@ -MEDIA_ENT_T_V4L2_SUBDEV_SENSOR +MEDIA_ENT_F_CAM_SENSOR @@ @@ -MEDIA_ENT_T_V4L2_SUBDEV_FLASH +MEDIA_ENT_F_FLASH @@ @@ -MEDIA_ENT_T_V4L2_SUBDEV_LENS +MEDIA_ENT_F_LENS @@ @@ -MEDIA_ENT_T_V4L2_SUBDEV_DECODER +MEDIA_ENT_F_ATV_DECODER @@ @@ -MEDIA_ENT_T_V4L2_SUBDEV_TUNER +MEDIA_ENT_F_TUNER @@ @@ -MEDIA_ENT_T_DVB_DEMOD +MEDIA_ENT_F_DTV_DEMOD @@ @@ -MEDIA_ENT_T_DVB_DEMUX +MEDIA_ENT_F_TS_DEMUX @@ @@ -MEDIA_ENT_T_DVB_TSOUT +MEDIA_ENT_F_IO_DTV @@ @@ -MEDIA_ENT_T_DVB_CA +MEDIA_ENT_F_DTV_CA @@ @@ -MEDIA_ENT_T_DVB_NET_DECAP +MEDIA_ENT_F_DTV_NET_DECAP Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] media-entity.h: rename entity.type to entity.functionMauro Carvalho Chehab1-7/+7
Entities should have one or more functions. Calling it as a type proofed to not be correct, as an entity could eventually have more than one type. So, rename the field as function. Please notice that this patch doesn't extend support for multiple function entities. Such change will happen when we have real case drivers using it. No functional changes. Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] dvbdev: returns error if graph object creation failsMauro Carvalho Chehab1-130/+183
Right now, if something gets wrong at dvb_create_media_entity() or at dvb_create_media_graph(), the device will still be registered. Change the logic to properly handle it and free all media graph objects if something goes wrong at dvb_register_device(). Also, change the logic at dvb_create_media_graph() to return an error code if something goes wrong. It is up to the caller to implement the right logic and to call dvb_unregister_device() to unregister the already-created objects. While here, add a missing logic to unregister the created interfaces. Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] dvbdev: enable all interface links at initMauro Carvalho Chehab1-6/+11
Interface links are normally enabled, meaning that the interfaces are bound to the entities. So, any ioctl sent to the interface are reflected at the entities managed by the interface. However, when a device is in use, other interfaces for the same hardware could be decoupled from the entities linked to them, because the hardware may have some parts busy. That's for example, what happens when an hybrid TV device is in use. If it is streaming analog TV or capturing signals from S-Video/Composite connectors, typically the digital part of the hardware can't be used and vice-versa. This is generally due to some internal hardware or firmware limitation, that it is not easily mapped via data pipelines. What the Kernel drivers do internally is that they decouple the hardware from the interface. So, all changes, if allowed, are done only at some interface cache, but not physically changed at the hardware. The usage is similar to the usage of the MEDIA_LNK_FL_ENABLED on data links. So, let's use the same flag to indicate if either the interface to entity link is bound/enabled or not. Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] tuner-core: add an input padMauro Carvalho Chehab1-1/+4
Tuners actually have at least one connector on its input. Add a PAD to connect it. Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] media: Use a macro to interate between all interfacesMauro Carvalho Chehab1-1/+2
Just like we do with entities, use a similar macro for the interfaces loop. Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] dvb: modify core to implement interfaces/entities at MC new genMauro Carvalho Chehab1-18/+128
The Media Controller New Generation redefines the types for both interfaces and entities to be used on DVB. Make the needed changes at the DVB core for all interfaces, entities and data and interface links to appear in the graph. Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] uapi/media.h: Fix entity namespaceMauro Carvalho Chehab1-13/+13
Now that interfaces got created, we need to fix the entity namespace. So, let's create a consistent new namespace and add backward compatibility macros to keep the old namespace preserved. Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] dvbdev: add support for indirect interface linksMauro Carvalho Chehab1-0/+11
Some interfaces indirectly control multiple entities. Add support for those. Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] dvbdev: add support for interfacesMauro Carvalho Chehab1-24/+78
Now that the infrastruct for that is set, add support for interfaces. Please notice that we're missing two links: DVB FE intf -> tuner DVB demux intf -> dvr Those should be added latter, after having the entire graph set. With the current infrastructure, those should be added at dvb_create_media_graph(), but it would also require some extra core changes, to allow the function to enumerate the interfaces. Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] media: rename the function that create pad linksMauro Carvalho Chehab1-4/+4
With the new API, a link can be either between two PADs or between an interface and an entity. So, we need to use a better name for the function that create links between two pads. So, rename the such function to media_create_pad_link(). No functional changes. This patch was created via this shell script: for i in $(find drivers/media -name '*.[ch]' -type f) $(find drivers/staging/media -name '*.[ch]' -type f) $(find include/ -name '*.h' -type f) ; do sed s,media_entity_create_link,media_create_pad_link,g <$i >a && mv a $i; done Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Tested-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] media: get rid of unused "extra_links" param on media_entity_init()Mauro Carvalho Chehab1-1/+1
Currently, media_entity_init() creates an array with the links, allocated at init time. It provides a parameter (extra_links) that would allocate more links than the current needs, but this is not used by any driver. As we want to be able to do dynamic link allocation/removal, we'll need to change the implementation of the links. So, before doing that, let's first remove that extra unused parameter, in order to cleanup the interface first. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-02[media] dvbdev: use adapter arg for dvb_create_media_graph()Mauro Carvalho Chehab1-3/+4
Instead of using media_dev argument for dvb_create_media_graph(), use the adapter. That allows to create a stub for this function, if compiled without DVB support, avoiding to add extra if's at the drivers. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-13[media] dvbdev: enable DVB-specific linksMauro Carvalho Chehab1-3/+3
For now, let's keep the DVB-specific media controller links enabled by default. On most devices, this is fixed anyway, so no big issue. Ok, the demux actually have dynamic links based on the filters, but we don't represent them yet, as the media controller currently lacks the capability of dynamically create/delete entities. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-13[media] dvbdev: add a function to create DVB media graphMauro Carvalho Chehab1-0/+45
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>
2015-02-13[media] dvbdev: represent frontend with two padsMauro Carvalho Chehab1-5/+7
While on some devices the tuner is bound inside the frontend, other devices use a separate subdevice for it. So, in order to be more generic, better to map it with two pads. That will allows to use the media controller to lock the tuner between the DVB and the V4L2 sub-drivers, on hybrid devices. While here, change the logic to use pad 0 as sink for devices with both sink and source pads. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-13[media] dvbdev: add pad for the DVB devnodesMauro Carvalho Chehab1-3/+36
We want to represent the links between the several DVB devnodes, so let's create PADs for them. The DVB net devnode is a different matter, as it is not related to the media stream, but with network. So, at least for now, let's not add any pad for it. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-13[media] dvbdev: add support for media controllerMauro Carvalho Chehab1-1/+62
Provide a way to register media controller device nodes at the DVB core. Please notice that the dvbdev callers also require changes for the devices to be registered via the media controller. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2013-10-24consolidate the reassignments of ->f_op in ->open() instancesAl Viro1-13/+6
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2012-12-27[media] dvb: push down ioctl lock in dvb_usercopyNikolaus Schulz1-2/+0
Since most dvb ioctls wrap their real work with dvb_usercopy, the static mutex used in dvb_usercopy effectively is a global lock for dvb ioctls. Unfortunately, frontend ioctls can be blocked by the frontend thread for several seconds; this leads to unacceptable lock contention. Mitigate that by pushing the mutex from dvb_usercopy down to the individual, device specific ioctls. There are 10 such ioctl functions using dvb_usercopy, either calling it directly, or via the trivial wrapper dvb_generic_ioctl. The following already employ their own locking and look safe: • dvb_demux_ioctl (as per dvb_demux_do_ioctl) • dvb_dvr_ioctl (as per dvb_dvr_do_ioctl) • dvb_osd_ioctl (as per single non-trivial callee) • fdtv_ca_ioctl (as per callees) • dvb_frontend_ioctl The following functions do not, and are thus changed to use a device specific mutex: • dvb_net_ioctl (as per dvb_net_do_ioctl) • dvb_ca_en50221_io_ioctl (as per dvb_ca_en50221_io_do_ioctl) • dvb_video_ioctl • dvb_audio_ioctl • dvb_ca_ioctl Signed-off-by: Nikolaus Schulz <schulz@macnetix.de> Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-09-15[media] media:dvb:fix up ENOIOCTLCMD error handlingWanlong Gao1-1/+1
At commit 07d106d0, Linus pointed out that ENOIOCTLCMD should be translated as ENOTTY to user mode. Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-13[media] dvb: move the dvb core one level upMauro Carvalho Chehab1-0/+507
just like the V4L2 core, move the DVB core to drivers/media, as the intention is to get rid of both "video" and "dvb" directories. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>