deliverable/linux.git
8 years ago[media] media-entity.h fix documentation for several parameters
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>
8 years ago[media] DocBook: document media_entity_graph_walk_cleanup()
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>
8 years ago[media] move documentation to the header files
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>
8 years ago[media] media: Move MEDIA_ENTITY_MAX_PADS from media-entity.h to media-entity.c
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>
8 years ago[media] media: Remove pre-allocated entity enumeration bitmap
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>
8 years ago[media] staging: v4l: davinci_vpbe: Use the new media graph walk interface
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>
8 years ago[media] staging: v4l: omap4iss: Use the new media graph walk interface
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>
8 years ago[media] staging: v4l: omap4iss: Use media entity enumeration interface
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>
8 years ago[media] staging: v4l: omap4iss: Fix sub-device power management code
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>
8 years ago[media] v4l: vsp1: Use media entity enumeration interface
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>
8 years ago[media] v4l: omap3isp: Use media entity enumeration interface
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>
8 years ago[media] media: Keep using the same graph walk object for a given pipeline
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>
8 years ago[media] media: Use entity enums in graph walk
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>
8 years ago[media] v4l: vsp1: Use the new media graph walk interface
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>
8 years ago[media] v4l: xilinx: Use the new media graph walk interface
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>
8 years ago[media] v4l: exynos4-is: Use the new media graph walk interface
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>
8 years ago[media] v4l: omap3isp: Use the new media graph walk interface
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>
8 years ago[media] media: Use the new media graph walk interface
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>
8 years ago[media] media: Amend media graph walk API by init and cleanup functions
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>
8 years ago[media] media: Move media graph state for streamon/off to the pipeline
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>
8 years ago[media] media: Add KernelDoc documentation for struct media_entity_graph
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>
8 years ago[media] media: Move struct media_entity_graph definition up
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>
8 years ago[media] media: Add an API to manage entity enumerations
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>
8 years ago[media] media: Introduce internal index for media entities
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>
8 years ago[media] v4l2-device: fix a missing error code
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>
8 years ago[media] media-device: copy_to/from_user() returns positive
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>
8 years ago[media] media-device: set topology version 0 at media registration
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>
8 years ago[media] v4l2-device: Register entity before calling subdev's registered ops
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>
8 years ago[media] usb: check media device errors
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>
8 years ago[media] media-device: split media initialization and registration
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>
8 years ago[media] media-device: better lock media_device_unregister()
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>
8 years ago[media] media-device: move media entity register/unregister functions
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>
8 years ago[media] media-device: check before unregister if mdev was registered
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>
8 years ago[media] media-entity: cache media_device on object removal
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>
8 years ago[media] media-entity: use mutes for link setup
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>
8 years ago[media] media-devnode.h: document the remaining struct/functions
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>
8 years ago[media] media-devnode: move kernel-doc documentation to the header
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>
8 years ago[media] media-device.h: document the last functions
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>
8 years ago[media] media-entity.h: Document some ancillary functions
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>
8 years ago[media] media: Enforce single entity->pipe in a pipeline
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>
8 years ago[media] DocBook: Document MEDIA_IOC_G_TOPOLOGY
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>
8 years ago[media] DocBook: add a table for Media Controller interfaces
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>
8 years ago[media] Docbook: media-types.xml: update the existing tables
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>
8 years ago[media] DocBook: move data types to a separate section
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>
8 years ago[media] DocBook: MC: add the concept of interfaces
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>
8 years ago[media] dvbdev: Document the new MC-related fields
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>
8 years ago[media] media.h: let be clear that tuners need to use connectors
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>
8 years ago[media] media: move MEDIA_LNK_FL_INTERFACE_LINK logic to link creation
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>
8 years ago[media] media-entity: remove unneded enclosing parenthesis
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>
8 years ago[media] uvcvideo: register entity subdev on init
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>
8 years ago[media] uvcvideo: remove pads prefix from uvc_mc_create_pads_links()
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>
8 years ago[media] v4l: vsp1: use else if instead of continue when creating links
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>
8 years ago[media] v4l: vsp1: remove pads prefix from *_create_pads_links()
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>
8 years ago[media] staging: omap4iss: remove pads prefix from *_create_pads_links()
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>
8 years ago[media] omap3isp: consistently use v4l2_dev var in complete notifier
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>
8 years ago[media] omap3isp: rename single labels to just error
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>
8 years ago[media] omap3isp: remove pads prefix from isp_create_pads_links()
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>
8 years ago[media] omap3isp: remove per ISP module link creation functions
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>
8 years ago[media] media-device: Use u64 ints for pointers
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>
8 years ago[media] media-device.h: Let clearer that entity function must be initialized
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>
8 years ago[media] media: use unsigned for pad index
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>
8 years ago[media] media-entity.h: move kernel-doc tags from media-entity.c
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>
8 years ago[media] media_entity: rename media_obj functions to *_create *_destroy
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>
8 years ago[media] media_entity: get rid of a unused var
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>
8 years ago[media] media-entity: get rid of forward __media_entity_remove_link() declaration
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>
8 years ago[media] media: remove extra blank lines
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>
8 years ago[media] media-device.h: Improve documentation and update it
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>
8 years ago[media] media-entity.h: convert media_entity_cleanup to inline
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>
8 years ago[media] DocBook: Move media-framework.txt contents to media-device.h
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>
8 years ago[media] media-entity.h: get rid of revision and group_id fields
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>
8 years ago[media] media framework: rename pads init function to media_entity_pads_init()
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>
8 years ago[media] media-device: better name Kernelspace/Userspace links
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>
8 years ago[media] media-device: put headers in alphabetic order
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>
8 years ago[media] media-entity: init pads on entity init if was registered before
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>
8 years ago[media] media-device: use unsigned ints on some places
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>
8 years ago[media] media_entity: remove gfp_flags argument
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>
8 years ago[media] dvbdev: Don't create indirect links
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>
8 years ago[media] dvbdev: move indirect links on dvr/demux to a separate function
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>
8 years ago[media] DocBook: update entities documentation
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>
8 years ago[media] uapi/media.h: Rename entities types to functions
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>
8 years ago[media] media-device: export the entity function via new ioctl
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>
8 years ago[media] media-entity.h: rename entity.type to entity.function
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>
8 years ago[media] media-entity: must check media_create_pad_link()
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>
8 years ago[media] au0828: enforce check for graph creation
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>
8 years ago[media] cx231xx: enforce check for graph creation
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>
8 years ago[media] media-entity: enforce check of interface and links creation
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>
8 years ago[media] dvb core: must check dvb_create_media_graph()
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>
8 years ago[media] v4l2 core: enable all interface links at init
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>
8 years ago[media] media-device: supress backlinks at G_TOPOLOGY ioctl
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>
8 years ago[media] au0828: Create connector links
Mauro Carvalho Chehab [Mon, 31 Aug 2015 16:23:28 +0000 (13:23 -0300)] 
[media] au0828: Create connector links

Now that connectors are entities, we need to represent the
connector links.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] au0828: add support for the connectors
Mauro Carvalho Chehab [Mon, 31 Aug 2015 14:43:09 +0000 (11:43 -0300)] 
[media] au0828: add support for the connectors

Depending on the input, an au0828 may have a different
number of connectors. add entities to represent them.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media.h: create connector entities for hybrid TV devices
Mauro Carvalho Chehab [Mon, 31 Aug 2015 14:41:29 +0000 (11:41 -0300)] 
[media] media.h: create connector entities for hybrid TV devices

Add entities to represent the connectors that exists inside a
hybrid TV device.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media-entity.h: document all the structs
Mauro Carvalho Chehab [Sun, 30 Aug 2015 02:43:03 +0000 (23:43 -0300)] 
[media] media-entity.h: document all the structs

Only a few structs are documented on kernel-doc-nano format
(the ones added by the MC next gen patches).

Add a documentation for all structs, and ensure that they'll
be producing the documentation at the Kernel's device driver
DocBook.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l2-core: create MC interfaces for devnodes
Mauro Carvalho Chehab [Mon, 24 Aug 2015 11:47:54 +0000 (08:47 -0300)] 
[media] v4l2-core: create MC interfaces for devnodes

V4L2 device (and subdevice) nodes should create an interface, if the
Media Controller support is enabled.

Please notice that radio devices should not create an entity, as radio
input/output is either via wires or via ALSA.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] dvbdev: returns error if graph object creation fails
Mauro Carvalho Chehab [Fri, 4 Sep 2015 18:10:29 +0000 (15:10 -0300)] 
[media] dvbdev: returns error if graph object creation fails

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>
8 years ago[media] media-entity: fix backlink removal on __media_entity_remove_link()
Mauro Carvalho Chehab [Thu, 10 Dec 2015 17:29:22 +0000 (15:29 -0200)] 
[media] media-entity: fix backlink removal on __media_entity_remove_link()

The logic is testing if num_links==0 at the wrong place. Due to
that, a backlink may be kept without removal, causing KASAN
to complain about usage after free during either entity or
link removal.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: don't try to empty links list in media_entity_cleanup()
Javier Martinez Canillas [Mon, 24 Aug 2015 17:57:53 +0000 (14:57 -0300)] 
[media] media: don't try to empty links list in media_entity_cleanup()

The media_entity_cleanup() function only cleans up the entity links list
but this operation is already made in media_device_unregister_entity().

In most cases this should be harmless (besides having duplicated code)
since the links list would be empty so the iteration would not happen
but the links list is initialized in media_device_register_entity() so
if a driver fails to register an entity with a media device and clean up
the entity in the error path, a NULL deference pointer error will happen.

So don't try to empty the links list in media_entity_cleanup() since
is either done already or haven't been initialized yet.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
8 years ago[media] au0828: postpone call to au0828_unregister_media_device()
Mauro Carvalho Chehab [Thu, 10 Dec 2015 12:58:04 +0000 (10:58 -0200)] 
[media] au0828: postpone call to au0828_unregister_media_device()

The DVB core needs to unregister the media device. So, we
can't call au0828_unregister_media_device() before calling
au0828_dvb_unregister(), otherwise the DVB MC free code
(that will be implemented on the next patch) will fail.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] dvbdev: enable all interface links at init
Mauro Carvalho Chehab [Thu, 10 Dec 2015 11:16:34 +0000 (09:16 -0200)] 
[media] dvbdev: enable all interface links at init

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>
8 years ago[media] tuner-core: add an input pad
Mauro Carvalho Chehab [Mon, 31 Aug 2015 16:23:03 +0000 (13:23 -0300)] 
[media] tuner-core: add an input pad

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>
This page took 0.046728 seconds and 5 git commands to generate.