Mauro Carvalho Chehab [Wed, 30 Dec 2015 12:11:53 +0000 (10:11 -0200)]
[media] dvbdev: create links on devices with multiple frontends
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>
Mauro Carvalho Chehab [Wed, 30 Dec 2015 11:45:48 +0000 (09:45 -0200)]
[media] media-entitiy: add a function to create multiple links
Sometimes, it is desired to create 1:n and n:1 or even
n:n links between different entities with the same
function.
This is actually needed to support DVB devices that
have multiple frontends. While we could do a function
like that internally at the DVB core, such function is
generic enough to be at media-entity, and it could be
useful on some other places.
So, add such function.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Tue, 29 Dec 2015 18:45:21 +0000 (16:45 -0200)]
[media] dvb-usb-v2: postpone removal of media_device
We should not remove the media_device until its last usage,
or we may have use after free troubles.
So, move the per-adapter media_device removal to happen at
the end of the adapter removal code.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Tue, 29 Dec 2015 13:52:23 +0000 (11:52 -0200)]
[media] dvbdev: Add RF connector if needed
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>
Mauro Carvalho Chehab [Mon, 28 Dec 2015 12:30:06 +0000 (10:30 -0200)]
[media] dvbdev: remove two dead functions if !CONFIG_MEDIA_CONTROLLER_DVB
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>
Mauro Carvalho Chehab [Mon, 28 Dec 2015 11:24:23 +0000 (09:24 -0200)]
[media] call media_device_init() before registering the V4L2 device
Currently, v4l2_device_register() doesn't use the media_device
struct. So, calling media_device_init() could be called either
before or after v4l2_device_register().
Yet, it is a good practice to initialize everything before calling
the register functions. Also, the other drivers call
media_device_init() before registering the V4L2 device.
So, move the call for media_device_init() to happen earlier on
exynos4-is and s3c-camif.
This is just a cleanup patch.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Thu, 17 Dec 2015 11:07:38 +0000 (09:07 -0200)]
[media] uapi/media.h: Use u32 for the number of graph objects
While we need to keep a u64 alignment to avoid compat32 issues,
having the number of entities/pads/links/interfaces represented
by an u64 is incoherent with the ID number, with is an u32.
In order to make it coherent, change those quantities to u32.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Wed, 16 Dec 2015 17:33:54 +0000 (15:33 -0200)]
[media] media-entity: don't sleep at media_device_register_entity()
media_device_register_entity() is protected by a spin_lock.
Calling ida_pre_get() with GFP_KERNEL may put it to sleep,
with is a bad idea and causes this warning:
[ 8812.397195] BUG: sleeping function called from invalid context at mm/slub.c:1287
[ 8812.397203] in_atomic(): 1, irqs_disabled(): 0, pid: 15179, name: modprobe
[ 8812.397207] INFO: lockdep is turned off.
[ 8812.397213] CPU: 2 PID: 15179 Comm: modprobe Tainted: G B 4.4.0-rc2+ #41
[ 8812.397218] Hardware name: /NUC5i7RYB, BIOS RYBDWi35.86A.0350.2015.0812.1722 08/12/2015
[ 8812.397222]
0000000000000000 ffff880314c77268 ffffffff818f8ba7 ffff8803b17dde00
[ 8812.397232]
ffff880314c77290 ffffffff811c2ee5 ffff8803b17dde00 ffffffff8284dbc9
[ 8812.397241]
0000000000000507 ffff880314c772d0 ffffffff811c30d5 0000000041b58ab3
[ 8812.397250] Call Trace:
[ 8812.397258] [<
ffffffff818f8ba7>] dump_stack+0x4b/0x64
[ 8812.397265] [<
ffffffff811c2ee5>] ___might_sleep+0x245/0x3a0
[ 8812.397270] [<
ffffffff811c30d5>] __might_sleep+0x95/0x1a0
[ 8812.397276] [<
ffffffff818fd083>] ? ida_pre_get+0x113/0x250
[ 8812.397282] [<
ffffffff8153bb77>] kmem_cache_alloc+0x197/0x250
[ 8812.397288] [<
ffffffff818fd083>] ida_pre_get+0x113/0x250
[ 8812.397293] [<
ffffffff818fd265>] ida_simple_get+0xa5/0x170
[ 8812.397298] [<
ffffffff818fd1c0>] ? ida_pre_get+0x250/0x250
[ 8812.397306] [<
ffffffffa07382d1>] media_device_register_entity+0x171/0x420 [media]
[ 8812.397318] [<
ffffffffa129e76f>] v4l2_device_register_subdev+0x34f/0x640 [videodev]
[ 8812.397324] [<
ffffffffa0768dea>] v4l2_i2c_new_subdev_board+0x12a/0x250 [v4l2_common]
[ 8812.397330] [<
ffffffffa0768fe7>] v4l2_i2c_new_subdev+0xd7/0x110 [v4l2_common]
[ 8812.397337] [<
ffffffffa0768f10>] ? v4l2_i2c_new_subdev_board+0x250/0x250 [v4l2_common]
[ 8812.397347] [<
ffffffffa13d2f76>] au0828_card_analog_fe_setup+0x2e6/0x3f0 [au0828]
[ 8812.397352] [<
ffffffff814450cc>] ? power_down+0xc4/0xc4
[ 8812.397361] [<
ffffffffa13d2c90>] ? au0828_tuner_callback+0x160/0x160 [au0828]
[ 8812.397370] [<
ffffffffa13d319f>] au0828_card_setup+0x11f/0x340 [au0828]
[ 8812.397378] [<
ffffffffa13d3080>] ? au0828_card_analog_fe_setup+0x3f0/0x3f0 [au0828]
[ 8812.397384] [<
ffffffff812a575b>] ? msleep+0x7b/0xc0
[ 8812.397393] [<
ffffffffa13d0d79>] au0828_usb_probe+0x679/0xcf0 [au0828]
[ 8812.397399] [<
ffffffff81d7619d>] usb_probe_interface+0x45d/0x940
[ 8812.397406] [<
ffffffff81ca7004>] driver_probe_device+0x454/0xd90
[ 8812.397411] [<
ffffffff81ca7940>] ? driver_probe_device+0xd90/0xd90
[ 8812.397417] [<
ffffffff81ca7940>] ? driver_probe_device+0xd90/0xd90
[ 8812.397422] [<
ffffffff81ca7a61>] __driver_attach+0x121/0x160
[ 8812.397427] [<
ffffffff81ca141f>] bus_for_each_dev+0x11f/0x1a0
[ 8812.397433] [<
ffffffff81ca1300>] ? subsys_dev_iter_exit+0x10/0x10
[ 8812.397439] [<
ffffffff822917d7>] ? _raw_spin_unlock+0x27/0x40
[ 8812.397445] [<
ffffffff81ca5d4d>] driver_attach+0x3d/0x50
[ 8812.397450] [<
ffffffff81ca5039>] bus_add_driver+0x4c9/0x770
[ 8812.397456] [<
ffffffff81ca944c>] driver_register+0x18c/0x3b0
[ 8812.397462] [<
ffffffff8124c952>] ? __raw_spin_lock_init+0x32/0x100
[ 8812.397468] [<
ffffffff81d71e58>] usb_register_driver+0x1f8/0x440
[ 8812.397473] [<
ffffffffa0208000>] ? 0xffffffffa0208000
[ 8812.397481] [<
ffffffffa02080b7>] au0828_init+0xb7/0x1000 [au0828]
[ 8812.397486] [<
ffffffff810021b1>] do_one_initcall+0x141/0x300
[ 8812.397492] [<
ffffffff81002070>] ? try_to_run_init_process+0x40/0x40
[ 8812.397497] [<
ffffffff8123bbf6>] ? trace_hardirqs_on_caller+0x16/0x590
[ 8812.397502] [<
ffffffff815406e6>] ? kasan_unpoison_shadow+0x36/0x50
[ 8812.397507] [<
ffffffff815406e6>] ? kasan_unpoison_shadow+0x36/0x50
[ 8812.397512] [<
ffffffff815406e6>] ? kasan_unpoison_shadow+0x36/0x50
[ 8812.397517] [<
ffffffff815407f7>] ? __asan_register_globals+0x87/0xa0
[ 8812.397524] [<
ffffffff814454e5>] do_init_module+0x1d0/0x5a4
[ 8812.397530] [<
ffffffff812ed7e8>] load_module+0x6648/0x9d70
[ 8812.397535] [<
ffffffff812e4b70>] ? symbol_put_addr+0x50/0x50
[ 8812.397546] [<
ffffffff812e71a0>] ? module_frob_arch_sections+0x20/0x20
[ 8812.397552] [<
ffffffff8158e950>] ? open_exec+0x50/0x50
[ 8812.397559] [<
ffffffff811648db>] ? ns_capable+0x5b/0xd0
[ 8812.397565] [<
ffffffff812f1208>] SyS_finit_module+0x108/0x130
[ 8812.397571] [<
ffffffff812f1100>] ? SyS_init_module+0x1f0/0x1f0
[ 8812.397576] [<
ffffffff81004044>] ? lockdep_sys_exit_thunk+0x12/0x14
[ 8812.397582] [<
ffffffff82292236>] entry_SYSCALL_64_fastpath+0x16/0x7a
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Wed, 16 Dec 2015 17:18:25 +0000 (15:18 -0200)]
[media] media-entity: increase max number of PADs
The DVB drivers may have 257 PADs. Get the next power of two
that would accomodate that amount.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Wed, 16 Dec 2015 17:15:18 +0000 (15:15 -0200)]
[media] media-entity.h: document the remaining functions
There are two ancillary functions that are missing comments.
While those are used only internally at media-entity.c,
document them, for completeness.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Wed, 16 Dec 2015 16:28:01 +0000 (14:28 -0200)]
[media] media-device.h: use just one u32 counter for object ID
Instead of using one u32 counter per type for object IDs, use
just one counter. With such change, it makes sense to simplify
the debug logs too.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Wed, 16 Dec 2015 15:58:31 +0000 (13:58 -0200)]
[media] media-entity.h fix documentation for several parameters
Several parameters added by the media_ent_enum patches
were declared with wrong argument names:
include/media/media-device.h:333: warning: No description found for parameter 'entity_internal_idx_max'
include/media/media-device.h:354: warning: No description found for parameter 'ent_enum'
include/media/media-device.h:354: warning: Excess function parameter 'e' description in 'media_entity_enum_init'
include/media/media-device.h:333: warning: No description found for parameter 'entity_internal_idx_max'
include/media/media-device.h:354: warning: No description found for parameter 'ent_enum'
include/media/media-device.h:354: warning: Excess function parameter 'e' description in 'media_entity_enum_init'
include/media/media-entity.h:397: warning: No description found for parameter 'ent_enum'
include/media/media-entity.h:397: warning: Excess function parameter 'e' description in 'media_entity_enum_zero'
include/media/media-entity.h:409: warning: No description found for parameter 'ent_enum'
include/media/media-entity.h:409: warning: Excess function parameter 'e' description in 'media_entity_enum_set'
include/media/media-entity.h:424: warning: No description found for parameter 'ent_enum'
include/media/media-entity.h:424: warning: Excess function parameter 'e' description in 'media_entity_enum_clear'
include/media/media-entity.h:441: warning: No description found for parameter 'ent_enum'
include/media/media-entity.h:441: warning: Excess function parameter 'e' description in 'media_entity_enum_test'
include/media/media-entity.h:458: warning: No description found for parameter 'ent_enum'
include/media/media-entity.h:458: warning: Excess function parameter 'e' description in 'media_entity_enum_test_and_set'
include/media/media-entity.h:474: warning: No description found for parameter 'ent_enum'
include/media/media-entity.h:474: warning: Excess function parameter 'e' description in 'media_entity_enum_empty'
include/media/media-entity.h:474: warning: Excess function parameter 'entity' description in 'media_entity_enum_empty'
include/media/media-entity.h:489: warning: No description found for parameter 'ent_enum1'
include/media/media-entity.h:489: warning: No description found for parameter 'ent_enum2'
include/media/media-entity.h:489: warning: Excess function parameter 'e' description in 'media_entity_enum_intersects'
include/media/media-entity.h:489: warning: Excess function parameter 'f' description in 'media_entity_enum_intersects'
Fix them.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Wed, 16 Dec 2015 15:56:14 +0000 (13:56 -0200)]
[media] DocBook: document media_entity_graph_walk_cleanup()
This function was added recently, but weren't documented.
Add documentation for it.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Wed, 16 Dec 2015 15:53:04 +0000 (13:53 -0200)]
[media] move documentation to the header files
Some exported functions were still documented at the .c file,
instead of documenting at the .h one.
Move the documentation to the right place, as we only use headers
at media device-drivers.xml DocBook.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Sakari Ailus [Wed, 16 Dec 2015 13:32:37 +0000 (11:32 -0200)]
[media] media: Move MEDIA_ENTITY_MAX_PADS from media-entity.h to media-entity.c
This isn't really a part of any interface drivers are expected to use. In
order to keep drivers from using it, hide it in media-entity.c. This was
always an arbitrary number and should be removed in the long run.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Sakari Ailus [Wed, 16 Dec 2015 13:32:36 +0000 (11:32 -0200)]
[media] media: Remove pre-allocated entity enumeration bitmap
The bitmaps for entity enumerations used to be statically allocated. Now
that the drivers have been converted to use the new interface which
explicitly initialises the enum objects, drop the pre-allocated bitmaps.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Sakari Ailus [Wed, 16 Dec 2015 13:32:35 +0000 (11:32 -0200)]
[media] staging: v4l: davinci_vpbe: Use the new media graph walk interface
The media graph walk requires initialisation and cleanup soon. Update the
users to perform the soon necessary API calls.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Prabhakar Lad <prabhakar.lad@ti.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Sakari Ailus [Wed, 16 Dec 2015 13:32:34 +0000 (11:32 -0200)]
[media] staging: v4l: omap4iss: Use the new media graph walk interface
The media graph walk requires initialisation and cleanup soon. Update the
users to perform the soon necessary API calls.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Sakari Ailus [Wed, 16 Dec 2015 13:32:33 +0000 (11:32 -0200)]
[media] staging: v4l: omap4iss: Use media entity enumeration interface
Instead of using a bitmap directly in a driver, use the new media
entity enumeration interface to perform the same.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Sakari Ailus [Wed, 16 Dec 2015 13:32:32 +0000 (11:32 -0200)]
[media] staging: v4l: omap4iss: Fix sub-device power management code
The same bug was present in the omap4iss driver as was in the omap3isp
driver. The code got copied to the omap4iss driver while broken. Fix the
omap4iss driver as well.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Sakari Ailus [Wed, 16 Dec 2015 13:32:31 +0000 (11:32 -0200)]
[media] v4l: vsp1: Use media entity enumeration interface
Instead of using a bitmap directly in a driver, use the new media entity
enumeration interface to perform the same.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Sakari Ailus [Wed, 16 Dec 2015 13:32:30 +0000 (11:32 -0200)]
[media] v4l: omap3isp: Use media entity enumeration interface
Instead of using a bitmap directly in a driver, use the new media entity
enumeration interface to perform the same.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Sakari Ailus [Wed, 16 Dec 2015 13:32:29 +0000 (11:32 -0200)]
[media] media: Keep using the same graph walk object for a given pipeline
Initialise a given graph walk object once, and then keep using it whilst
the same pipeline is running. Once the pipeline is stopped, release the
graph walk object.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Sakari Ailus [Wed, 16 Dec 2015 13:32:28 +0000 (11:32 -0200)]
[media] media: Use entity enums in graph walk
This will also mean that the necessary graph related data structures will
be allocated dynamically, removing the need for maximum ID checks.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Sakari Ailus [Wed, 16 Dec 2015 13:32:27 +0000 (15:32 +0200)]
[media] v4l: vsp1: Use the new media graph walk interface
The media graph walk requires initialisation and cleanup soon. Update the
users to perform the soon necessary API calls.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Sakari Ailus [Wed, 16 Dec 2015 13:32:26 +0000 (11:32 -0200)]
[media] v4l: xilinx: Use the new media graph walk interface
The media graph walk requires initialisation and cleanup soon. Update the
users to perform the soon necessary API calls.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Hyun Kwon <hyun.kwon@xilinx.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Sakari Ailus [Wed, 16 Dec 2015 13:32:25 +0000 (15:32 +0200)]
[media] v4l: exynos4-is: Use the new media graph walk interface
The media graph walk requires initialisation and cleanup soon. Update the
users to perform the soon necessary API calls.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Javier Martinez Canillas <javier@osg.samsung.com>
Cc: Kamil Debski <k.debski@samsung.com>
Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Sakari Ailus [Wed, 16 Dec 2015 13:32:24 +0000 (11:32 -0200)]
[media] v4l: omap3isp: Use the new media graph walk interface
The media graph walk requires initialisation and cleanup soon. Update the
users to perform the soon necessary API calls.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Sakari Ailus [Wed, 16 Dec 2015 13:32:23 +0000 (15:32 +0200)]
[media] media: Use the new media graph walk interface
The media graph walk requires initialisation and cleanup soon. Update the
users to perform the soon necessary API calls.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Sakari Ailus [Wed, 16 Dec 2015 13:32:22 +0000 (11:32 -0200)]
[media] media: Amend media graph walk API by init and cleanup functions
Add media_entity_graph_walk_init() and media_entity_graph_walk_cleanup()
functions in order to dynamically allocate memory for the graph. This is
not done in media_entity_graph_walk_start() as there are situations where
e.g. correct error handling, that itself may not fail, requires successful
graph walk.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Sakari Ailus [Wed, 16 Dec 2015 13:32:21 +0000 (11:32 -0200)]
[media] media: Move media graph state for streamon/off to the pipeline
The struct media_entity_graph was allocated in the stack, limiting the
number of entities that could be reasonably allocated. Instead, move the
struct to struct media_pipeline which is typically allocated using
kmalloc() instead.
The intent is to keep the enumeration around for later use for the
duration of the streaming. As streaming is eventually stopped, an
unfortunate memory allocation failure would prevent stopping the
streaming. As no memory will need to be allocated, the problem is avoided
altogether.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Sakari Ailus [Wed, 16 Dec 2015 13:32:20 +0000 (11:32 -0200)]
[media] media: Add KernelDoc documentation for struct media_entity_graph
KernelDoc doesn't appear to handle anonymous structs defined inside
another gracefully. As the struct is internal to the framework graph walk
algorithm, detailed documentation isn't seen very important.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Sakari Ailus [Wed, 16 Dec 2015 13:32:19 +0000 (11:32 -0200)]
[media] media: Move struct media_entity_graph definition up
It will be needed in struct media_pipeline shortly.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Sakari Ailus [Wed, 16 Dec 2015 13:44:32 +0000 (11:44 -0200)]
[media] media: Add an API to manage entity enumerations
This is useful in e.g. knowing whether certain operations have already
been performed for an entity. The users include the framework itself (for
graph walking) and a number of drivers.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Sakari Ailus [Wed, 16 Dec 2015 13:32:17 +0000 (11:32 -0200)]
[media] media: Introduce internal index for media entities
The internal index can be used internally by the framework in order to keep
track of entities for a purpose or another. The internal index is constant
while it's registered to a media device, but the same index may be re-used
once the entity having that index is unregistered.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Dan Carpenter [Tue, 15 Dec 2015 11:04:14 +0000 (09:04 -0200)]
[media] v4l2-device: fix a missing error code
We need to set "err = -ENOMEM" here.
Fixes: 38b11f19667a ('[media] v4l2-core: create MC interfaces for devnodes')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Dan Carpenter [Tue, 15 Dec 2015 11:00:40 +0000 (09:00 -0200)]
[media] media-device: copy_to/from_user() returns positive
The copy_to/from_user() functions return the number of bytes *not*
copied. They don't return error codes.
Fixes: 4f6b3f363475 ('media] media-device: add support for MEDIA_IOC_G_TOPOLOGY ioctl')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Javier Martinez Canillas [Fri, 11 Dec 2015 22:57:09 +0000 (20:57 -0200)]
[media] media-device: set topology version 0 at media registration
The G_TOPOLOGY ioctl is used to get a graph topology and since in the
future a graph can be dynamically updated, there is a way to know the
topology version so userspace can be aware that the graph has changed.
The version 0 is reserved to indicate that the graph is static (i.e no
graphs updates since the media device was registered).
So, now that the media device initialization and registration has been
split and the media device node is not exposed to user-space until all
the entities have been registered and links created, it is safe to set
a topology version 0 in media_device_register().
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Suggested-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Sakari Ailus [Sun, 27 Dec 2015 23:45:00 +0000 (01:45 +0200)]
[media] v4l2-device: Register entity before calling subdev's registered ops
Registering a V4L2 sub-device includes, among other things, registering
the related media entity and calling the sub-device's registered op. Since
patch "media: convert links from array to list", creating a link between
two pads requires registering the entity first. If the registered() op
involves link creation, the link list head will not be initialised before
it is used.
Resolve this by first registering the entity, then calling its
registered() op.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Mon, 28 Dec 2015 11:55:49 +0000 (09:55 -0200)]
[media] usb: check media device errors
There are now two new warnings:
drivers/media/usb/dvb-usb-v2/dvb_usb_core.c: In function 'dvb_usbv2_media_device_register':
drivers/media/usb/dvb-usb-v2/dvb_usb_core.c:433:2: warning: ignoring return value of '__media_device_register', declared with attribute warn_unused_result [-Wunused-result]
media_device_register(adap->dvb_adap.mdev);
^
drivers/media/usb/dvb-usb/dvb-usb-dvb.c: In function 'dvb_usb_media_device_register':
drivers/media/usb/dvb-usb/dvb-usb-dvb.c:128:2: warning: ignoring return value of '__media_device_register', declared with attribute warn_unused_result [-Wunused-result]
media_device_register(adap->dvb_adap.mdev);
^
Those are because the drivers are not properly checking if the
media device init and register were succeeded.
Fix it.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Javier Martinez Canillas [Fri, 11 Dec 2015 22:57:08 +0000 (20:57 -0200)]
[media] media-device: split media initialization and registration
The media device node is registered and so made visible to user-space
before entities are registered and links created which means that the
media graph obtained by user-space could be only partially enumerated
if that happens too early before all the graph has been created.
To avoid this race condition, split the media init and registration
in separate functions and only register the media device node when
all the pending subdevices have been registered, either explicitly
by the driver or asynchronously using v4l2_async_register_subdev().
The media_device_register() had a check for drivers not filling dev
and model fields but all drivers in mainline set them and not doing
it will be a driver bug so change the function return to void and
add a BUG_ON() for dev being NULL instead.
Also, add a media_device_cleanup() function that will destroy the
graph_mutex that is initialized in media_device_init().
[mchehab@osg.samsung.com: Fix compilation if !CONFIG_MEDIA_CONTROLLER
and remove two warnings added by this changeset]
Suggested-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Tue, 15 Dec 2015 10:36:51 +0000 (08:36 -0200)]
[media] media-device: better lock media_device_unregister()
If media_device_unregister() is called by two different
drivers, a race condition may happen, as the check if the
device is not registered is not protected.
Move the spin_lock() to happen earlier in the function, in order
to prevent such race condition.
Reported-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Tue, 15 Dec 2015 10:26:52 +0000 (08:26 -0200)]
[media] media-device: move media entity register/unregister functions
media entity register and unregister functions are called by media
device register/unregister. Move them to occur earlier, as we'll need
an unlocked version of media_device_entity_unregister() and we don't
want to add a function prototype without needing it.
No functional changes.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Javier Martinez Canillas [Fri, 11 Dec 2015 22:57:07 +0000 (20:57 -0200)]
[media] media-device: check before unregister if mdev was registered
Most media functions that unregister, check if the corresponding register
function succeed before. So these functions can safely be called even if a
registration was never made or the component as already been unregistered.
Add the same check to media_device_unregister() function for consistency.
This will also allow to split the media_device_register() function in an
initialization and registration functions without the need to change the
generic cleanup functions and error code paths for all the media drivers.
Suggested-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Tue, 15 Dec 2015 10:01:13 +0000 (08:01 -0200)]
[media] media-entity: cache media_device on object removal
As pointed by Dan, the commit
f8fd4c61b5ae ("[media] media-entity:
protect object creation/removal using spin lock")' leads to the
following static checker warning:
drivers/media/media-entity.c:781 media_remove_intf_link()
error: dereferencing freed memory 'link'
drivers/media/media-entity.c
777 void media_remove_intf_link(struct media_link *link)
778 {
779 spin_lock(&link->graph_obj.mdev->lock);
780 __media_remove_intf_link(link);
781 spin_unlock(&link->graph_obj.mdev->lock);
In practice, I didn't see any troubles even with KASAN enabled. I guess
gcc optimizer internally cached the mdev reference, instead of getting
it twice. Yet, it is a very bad idea to rely on such optimization. So,
let's fix the code.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Tue, 15 Dec 2015 09:58:18 +0000 (07:58 -0200)]
[media] media-entity: use mutes for link setup
Changeset
f8fd4c61b5ae ("[media] media-entity: protect object
creation/removal using spin lock") changed the object creation/removal
protection to spin lock, as this is what's used on media-device,
keeping the mutex reserved for graph traversal routines. However, it
also changed the link setup, by mistake.
This could cause troubles, as the link setup can affect the graph
traversal, and this is likely the reason for a mutex there.
So, revert media_entity_setup_link() to use mutex.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Sun, 13 Dec 2015 11:00:00 +0000 (09:00 -0200)]
[media] media-devnode.h: document the remaining struct/functions
There is one struct and two functions that were not documented.
Add the corresponding kernel-doc documentation for them.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Sun, 13 Dec 2015 10:40:45 +0000 (08:40 -0200)]
[media] media-devnode: move kernel-doc documentation to the header
As we're using the headers file only for documentation, move the
two kernel-doc macros to the header, and fix it to avoid
warnings.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Sun, 13 Dec 2015 10:36:58 +0000 (08:36 -0200)]
[media] media-device.h: document the last functions
Add kernel-doc documentation for media_device_get_devres and
media_device_find_devres.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Sun, 13 Dec 2015 10:20:46 +0000 (08:20 -0200)]
[media] media-entity.h: Document some ancillary functions
Add a basic documentation for most ancillary functions.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Sakari Ailus [Sun, 29 Nov 2015 19:20:02 +0000 (17:20 -0200)]
[media] media: Enforce single entity->pipe in a pipeline
If a different entity->pipe in a pipeline was encountered, a warning was
issued but the execution continued as if nothing had happened. Return an
error instead right there.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Sat, 12 Dec 2015 12:56:13 +0000 (10:56 -0200)]
[media] DocBook: Document MEDIA_IOC_G_TOPOLOGY
Add description for this new media controller ioctl.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Sat, 12 Dec 2015 12:54:45 +0000 (10:54 -0200)]
[media] DocBook: add a table for Media Controller interfaces
Document the media controller interfaces at the media
uAPI docbook.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Sat, 12 Dec 2015 12:29:30 +0000 (10:29 -0200)]
[media] Docbook: media-types.xml: update the existing tables
There were some changes on the media types that were not reflected
on the types tables. Update them to reflect the upstream changes.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Sat, 12 Dec 2015 11:56:07 +0000 (09:56 -0200)]
[media] DocBook: move data types to a separate section
As MEDIA_IOC_G_TOPOLOGY shares the data types already declared
for entities, pads and links, we should move those to a separate
part of the document, and use cross-references where needed.
So, move the following tables to a separate section at the
DocBook:
media-entity-type
media-entity-flag
media-pad-flag
media-link-flag
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Sat, 12 Dec 2015 10:59:14 +0000 (08:59 -0200)]
[media] DocBook: MC: add the concept of interfaces
The Media Controller next generation patches added a new graph
element type: interfaces. It also allows links between interfaces
and entities. Update the docbook to reflect that.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Sat, 12 Dec 2015 10:25:44 +0000 (08:25 -0200)]
[media] dvbdev: Document the new MC-related fields
The Media Controller next gen patchset added several new fields
to be used with it. Document them.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Fri, 11 Dec 2015 20:26:53 +0000 (18:26 -0200)]
[media] media.h: let be clear that tuners need to use connectors
The V4L2 core won't be adding connectors to the tuners and other
entities that need them. Let it be clear.
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Fri, 11 Dec 2015 20:09:13 +0000 (18:09 -0200)]
[media] media: move MEDIA_LNK_FL_INTERFACE_LINK logic to link creation
Instead of flagging an interface link as MEDIA_LNK_FL_INTERFACE_LINK
only when returning to userspace, do it at link creation time.
That would allow using such flag internally, and cleans up a
little bit the code for G_TOPOLOGY ioctl.
[mchehab@osg.samsung.com: folded with a fixup from Dan Carpenter,
replacing & by &&]
Suggested-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Javier Martinez Canillas [Fri, 11 Dec 2015 17:16:36 +0000 (15:16 -0200)]
[media] media-entity: remove unneded enclosing parenthesis
Commit
86ee417578a2 ("[media] media: convert links from array to list")
had many changes that were automated using coccinelle but the semantic
patch was not smart enough to rely on operators precedence and avoid
using unnecessary enclosing parenthesis.
This patch removes them since are not needed.
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Javier Martinez Canillas [Fri, 11 Dec 2015 17:16:35 +0000 (15:16 -0200)]
[media] uvcvideo: register entity subdev on init
The uvc_mc_register_entities() function iterated over the entities three
times to initialize the entities, register the subdev for the ones whose
type was UVC_TT_STREAMING and to create the entities links.
But this can be simplied by merging the init and registration logic in a
single loop.
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Javier Martinez Canillas [Fri, 11 Dec 2015 17:16:34 +0000 (15:16 -0200)]
[media] uvcvideo: remove pads prefix from uvc_mc_create_pads_links()
The function uvc_mc_create_pads_links() creates entities links but the
"pads" prefix is redundant since the driver doesn't handle any other
kind of link, so it can be removed.
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Javier Martinez Canillas [Fri, 11 Dec 2015 17:16:33 +0000 (15:16 -0200)]
[media] v4l: vsp1: use else if instead of continue when creating links
The for loop in the vsp1_create_entities() function that create the links,
checks the entity type and call the proper link creation function but then
it uses continue to force the next iteration of the loop to take place and
skipping code in between that creates links for different entities types.
It is more readable and easier to understand if the if else constructs is
used instead of the continue statement.
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Javier Martinez Canillas [Fri, 11 Dec 2015 17:16:32 +0000 (15:16 -0200)]
[media] v4l: vsp1: remove pads prefix from *_create_pads_links()
The functions that create entities links are called *_create_pads_links()
but the "pads" prefix is redundant since the driver doesn't handle any
other kind of link so it can be removed.
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Javier Martinez Canillas [Fri, 11 Dec 2015 17:16:31 +0000 (15:16 -0200)]
[media] staging: omap4iss: remove pads prefix from *_create_pads_links()
The functions that create ISS internal and external entities links are
called *_create_pads_links() but the "pads" prefix is redundant since
the driver doesn't handle any other kind of link so it can be removed.
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Javier Martinez Canillas [Fri, 11 Dec 2015 17:16:30 +0000 (15:16 -0200)]
[media] omap3isp: consistently use v4l2_dev var in complete notifier
The isp_subdev_notifier_complete() complete callback defines a struct
v4l2_device *v4l2_dev to avoid needing two level of indirections to
access the V4L2 subdevs but the var is not always used when possible
as when calling v4l2_device_register_subdev_nodes().
So change that to consistently use the defined v4l2_dev pointer var.
Suggested-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Javier Martinez Canillas [Fri, 11 Dec 2015 17:16:29 +0000 (15:16 -0200)]
[media] omap3isp: rename single labels to just error
Commit
bc36b30fe06b ("[media] omap3isp: separate links creation from
entities init") moved the link creation logic from the entities init
functions and so removed the error_link labels from the error paths.
But after that, some functions have a single error label so it makes
more sense to rename the label to just "error" in thi case.
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Javier Martinez Canillas [Fri, 11 Dec 2015 17:16:28 +0000 (15:16 -0200)]
[media] omap3isp: remove pads prefix from isp_create_pads_links()
The function that creates the links between ISP internal and external
entities is called isp_create_pads_links() but the "pads" prefix is
redundant since the driver doesn't handle any other kind of link so
it can just be removed.
While being there, fix the function's kernel-doc since is not using
a proper format.
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Javier Martinez Canillas [Fri, 11 Dec 2015 17:16:27 +0000 (15:16 -0200)]
[media] omap3isp: remove per ISP module link creation functions
The entities to video nodes links were created on separate functions for
each ISP module but since the only thing that these functions do is to
call media_create_pad_link(), there's no need for that indirection level
and all link creation logic can be just inlined in the caller function.
Also, since the only possible failure for the link creation is a memory
allocation, there is no need for error messages since the core already
reports a very verbose message in that case.
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Fri, 11 Dec 2015 18:07:57 +0000 (16:07 -0200)]
[media] media-device: Use u64 ints for pointers
By using u64 integers and pointers, we can get rid of compat32
logic. So, let's do it!
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Fri, 11 Dec 2015 14:41:12 +0000 (12:41 -0200)]
[media] media-device.h: Let clearer that entity function must be initialized
Improve the documentation to let it clear that the entity function
must be initialized.
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Fri, 11 Dec 2015 14:23:23 +0000 (12:23 -0200)]
[media] media: use unsigned for pad index
The pad index is unsigned. Replace the occurences of it where
pertinent.
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Fri, 11 Dec 2015 14:14:58 +0000 (12:14 -0200)]
[media] media-entity.h: move kernel-doc tags from media-entity.c
Several additional functions are described at media-entity.c.
Moving them to the header file, to make the code cleaner and
to have all such macros at the same place.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Fri, 11 Dec 2015 13:55:40 +0000 (11:55 -0200)]
[media] media_entity: rename media_obj functions to *_create *_destroy
Those media_obj_* functions are actually creating/destroying
media graph objects. So, rename them to better represent
what they're actually doing.
No functional changes.
This was created via this small shell script:
for i in $(git grep -l media_gobj_init); do sed s,media_gobj_init,media_gobj_create,g <$i >a && mv a $i; done
for i in $(git grep -l media_gobj_remove); do sed s,media_gobj_remove,media_gobj_destroy,g <$i >a && mv a $i; done
Suggested-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Fri, 11 Dec 2015 13:25:23 +0000 (11:25 -0200)]
[media] media_entity: get rid of a unused var
> > > + if (rlink != link->reverse) {
> > > + r++;
> >
> > The variable is incremented here but otherwise never used, you can remove it.
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Fri, 11 Dec 2015 13:19:38 +0000 (11:19 -0200)]
[media] media-entity: get rid of forward __media_entity_remove_link() declaration
Move this function to happen earlier, in order to avoid
a uneeded forward declaration.
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Fri, 11 Dec 2015 13:12:57 +0000 (11:12 -0200)]
[media] media: remove extra blank lines
No functional changes.
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Fri, 11 Dec 2015 13:06:08 +0000 (11:06 -0200)]
[media] media-device.h: Improve documentation and update it
Now that we moved the content of the media-framework.txt into
the kerneldoc documentation, move the per-function specific
documentation to the corresponding functions and clean it up.
It would be good if we had already the markdown kernel-doc
patches merged upstream, but, while we doesn't have it,
let's make it less ugly at device-drivers.xml.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Fri, 11 Dec 2015 11:13:23 +0000 (09:13 -0200)]
[media] media-entity.h: convert media_entity_cleanup to inline
This function was used in the past to free the links
that were allocated by the media controller core.
However, this is not needed anymore. We should likely
get rid of the funcion on some function, but, for now,
let's just convert into an inlined function and let the
compiler to get rid of it.
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Fri, 11 Dec 2015 10:21:39 +0000 (08:21 -0200)]
[media] DocBook: Move media-framework.txt contents to media-device.h
Instead of using a text file, let's put it together with the
struct documentation for the Media Controller.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Fri, 11 Dec 2015 10:02:19 +0000 (08:02 -0200)]
[media] media-entity.h: get rid of revision and group_id fields
Both revision and group_id fields were never used and were always
initialized to zero. Remove them.
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Fri, 11 Dec 2015 09:44:40 +0000 (07:44 -0200)]
[media] media framework: rename pads init function to media_entity_pads_init()
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>
Mauro Carvalho Chehab [Fri, 11 Dec 2015 09:25:01 +0000 (07:25 -0200)]
[media] media-device: better name Kernelspace/Userspace links
The __media_device_enum_links() copies links definitions from
Kernelspace to userspace. It has to work with 3 structs that
handle with links. Better name them to:
link: Kernelspace internal link representation, of the
type media_link;
klink_desc: struct media_link_desc pointer to the
kernel memory where the data will be filled;
ulink_desc: struct media_link_desc pointer to the
memory where the data will be copied to
userspace.
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Fri, 11 Dec 2015 09:23:09 +0000 (07:23 -0200)]
[media] media-device: put headers in alphabetic order
It is better to keep the headers in alphabetic order.
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Javier Martinez Canillas [Tue, 8 Sep 2015 17:10:56 +0000 (14:10 -0300)]
[media] media-entity: init pads on entity init if was registered before
If an entity is registered with a media device before is initialized
with media_device_register_entity(), the number of pads won't be set
so media_device_register_entity() won't create pad objects and add
it to the media device pads list.
Do this at entity initialization time if the entity was registered
before so the graph is complete and correct regardless of the order
in which the entities are initialized and registered.
Suggested-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Wed, 9 Sep 2015 11:23:51 +0000 (08:23 -0300)]
[media] media-device: use unsigned ints on some places
The entity->num_pads are defined as u16. So, better to use an
unsigned int, as this prevents additional warnings when W=2
(or W=1 on some architectures).
The "i" counter at __media_device_get_topology() is also a
monotonic counter that should never be below zero. So,
make it unsigned too.
Suggested-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Wed, 9 Sep 2015 11:19:25 +0000 (08:19 -0300)]
[media] media_entity: remove gfp_flags argument
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>
Mauro Carvalho Chehab [Sun, 6 Sep 2015 16:38:23 +0000 (13:38 -0300)]
[media] dvbdev: Don't create indirect links
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>
Mauro Carvalho Chehab [Sun, 6 Sep 2015 16:28:48 +0000 (13:28 -0300)]
[media] dvbdev: move indirect links on dvr/demux to a separate function
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>
Mauro Carvalho Chehab [Sun, 6 Sep 2015 15:30:43 +0000 (12:30 -0300)]
[media] DocBook: update entities documentation
Due to the rename, the documentation became outdated.
Update it to reflect what's there at media.h.
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Thu, 10 Dec 2015 19:25:41 +0000 (17:25 -0200)]
[media] uapi/media.h: Rename entities types to functions
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>
Mauro Carvalho Chehab [Sun, 6 Sep 2015 13:59:08 +0000 (10:59 -0300)]
[media] media-device: export the entity function via new ioctl
Now that entities have a main function, expose it via
MEDIA_IOC_G_TOPOLOGY ioctl.
Please notice that some entities may have secundary functions.
Such use case will be addressed later, when we add support for the
Media Controller properties.
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Sun, 6 Sep 2015 12:33:39 +0000 (09:33 -0300)]
[media] media-entity.h: rename entity.type to entity.function
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>
Mauro Carvalho Chehab [Fri, 4 Sep 2015 19:08:24 +0000 (16:08 -0300)]
[media] media-entity: must check media_create_pad_link()
Drivers should check if media_create_pad_link() actually
worked.
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Fri, 4 Sep 2015 19:08:02 +0000 (16:08 -0300)]
[media] au0828: enforce check for graph creation
If the graph creation fails, don't register the device.
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Fri, 4 Sep 2015 19:07:03 +0000 (16:07 -0300)]
[media] cx231xx: enforce check for graph creation
If the graph creation fails, don't register the device.
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Fri, 4 Sep 2015 18:34:19 +0000 (15:34 -0300)]
[media] media-entity: enforce check of interface and links creation
Drivers should check if interfaces and interface links were
created. Add a must_check for them.
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Fri, 4 Sep 2015 18:33:46 +0000 (15:33 -0300)]
[media] dvb core: must check dvb_create_media_graph()
If media controller is enabled and mdev is filled, it should
ensure that the media graph will be properly initialized.
Enforce that.
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Mauro Carvalho Chehab [Fri, 4 Sep 2015 18:39:43 +0000 (15:39 -0300)]
[media] v4l2 core: enable all interface links at init
Interface links are normally enabled, meaning that the interfaces are
bound to the entities. So, any ioctl send to the interface are reflected
at the entities managed by the interface.
However, when a device is used, 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>
Mauro Carvalho Chehab [Sun, 30 Aug 2015 12:53:57 +0000 (09:53 -0300)]
[media] media-device: supress backlinks at G_TOPOLOGY ioctl
Due to the graph traversal algorithm currently in usage, we
need a copy of all data links. Those backlinks should not be
send to userspace, as otherwise, all links there will be
duplicated.
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
This page took 0.047691 seconds and 5 git commands to generate.