deliverable/linux.git
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>
8 years ago[media] media-entity: protect object creation/removal using spin lock
Mauro Carvalho Chehab [Wed, 9 Dec 2015 21:47:35 +0000 (19:47 -0200)] 
[media] media-entity: protect object creation/removal using spin lock

Some parts of the media controller are using mutexes while
others are using spin locks in order to protect creation
and removal of elements in the graph. That's wrong!

Also, the V4L2 core can remove graph elements on non-interactive
context:
BUG: sleeping function called from invalid context at include/linux/sched.h:2776

Fix it by always using spin locks for graph element addition/removal,
just like entity creation/removal is protected at media-device.c

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media-device: remove interfaces and interface links
Mauro Carvalho Chehab [Sun, 30 Aug 2015 00:23:44 +0000 (21:23 -0300)] 
[media] media-device: remove interfaces and interface links

Just like what's done with entities, when the media controller is
unregistered, release any interface and interface links that
might still be there.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] remove interface links at media_entity_unregister()
Mauro Carvalho Chehab [Sat, 29 Aug 2015 22:07:09 +0000 (19:07 -0300)] 
[media] remove interface links at media_entity_unregister()

Interface links connected to an entity should be removed
before the entity itself can be removed.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media-entity: unregister entity links
Mauro Carvalho Chehab [Mon, 24 Aug 2015 11:46:46 +0000 (08:46 -0300)] 
[media] media-entity: unregister entity links

Add functions to explicitly unregister all entity links.
This function is called automatically when an entity
link is destroyed.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media-device: add support for MEDIA_IOC_G_TOPOLOGY ioctl
Mauro Carvalho Chehab [Sun, 23 Aug 2015 13:36:41 +0000 (10:36 -0300)] 
[media] media-device: add support for MEDIA_IOC_G_TOPOLOGY ioctl

Add support for the new MEDIA_IOC_G_TOPOLOGY ioctl, according
with the RFC for the MC next generation.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media_device: add a topology version field
Mauro Carvalho Chehab [Sun, 23 Aug 2015 12:40:26 +0000 (09:40 -0300)] 
[media] media_device: add a topology version field

Every time a graph object is added or removed, the version
of the topology changes. That's a requirement for the new
MEDIA_IOC_G_TOPOLOGY, in order to allow userspace to know
that the topology has changed after a previous call to it.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media-device: add pads and links to media_device
Mauro Carvalho Chehab [Sun, 23 Aug 2015 11:00:33 +0000 (08:00 -0300)] 
[media] media-device: add pads and links to media_device

The MC next gen API sends objects to userspace grouped by
their types.

In the case of pads and links, in order to improve performance
and have a simpler code, the best is to store them also on
separate linked lists at MC.

If we don't do that, we would need this kind of interaction
to send data to userspace (code is in structured english):

for each entity:
for each pad:
store pads

for each entity:
for each link:
store link

for each interface:
for each link:
store link

With would require one nested loop for pads and two nested
loops for links. By using  separate linked lists for them,
just one loop would be enough.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: move mdev list init to gobj
Mauro Carvalho Chehab [Sun, 23 Aug 2015 10:51:33 +0000 (07:51 -0300)] 
[media] media: move mdev list init to gobj

Let's control the topology changes inside the graph_object. So, move the
addition and removal of interfaces/entities from the mdev lists to
media_gobj_init() and media_gobj_remove().

The main reason is that mdev should have lists for all object types, as
the new MC api will require to store objects in separate places.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: Use a macro to interate between all interfaces
Mauro Carvalho Chehab [Sun, 23 Aug 2015 10:51:22 +0000 (07:51 -0300)] 
[media] media: Use a macro to interate between all interfaces

Just like we do with entities, use a similar macro for the
interfaces loop.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] uapi/media.h: Add MEDIA_IOC_G_TOPOLOGY ioctl
Mauro Carvalho Chehab [Sun, 23 Aug 2015 11:28:21 +0000 (08:28 -0300)] 
[media] uapi/media.h: Add MEDIA_IOC_G_TOPOLOGY ioctl

Add a new ioctl that will report the entire topology on
one go.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: report if a pad is sink or source at debug msg
Mauro Carvalho Chehab [Fri, 21 Aug 2015 21:26:42 +0000 (18:26 -0300)] 
[media] media: report if a pad is sink or source at debug msg

Sometimes, it is important to see if the created pad is
sink or source. Add info to track that.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] dvb: modify core to implement interfaces/entities at MC new gen
Mauro Carvalho Chehab [Fri, 21 Aug 2015 19:18:18 +0000 (16:18 -0300)] 
[media] dvb: modify core to implement interfaces/entities at MC new gen

The Media Controller New Generation redefines the types for both
interfaces and entities to be used on DVB. Make the needed
changes at the DVB core for all interfaces, entities and
data and interface links to appear in the graph.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] DocBook: update descriptions for the media controller entities
Mauro Carvalho Chehab [Fri, 8 May 2015 01:12:40 +0000 (22:12 -0300)] 
[media] DocBook: update descriptions for the media controller entities

Cleanup the media controller entities description:
- remove MEDIA_ENT_T_DEVNODE and MEDIA_ENT_T_V4L2_SUBDEV entity
  types, as they don't mean anything;
- add MEDIA_ENT_T_UNKNOWN with a proper description;
- remove ALSA and FB entity types. Those should not be used, as
  the types are deprecated. We'll soon be adidng ALSA, but with
  a different entity namespace;
- improve the description of some entities.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media.h: don't use legacy entity macros at Kernel
Mauro Carvalho Chehab [Sat, 29 Aug 2015 17:50:46 +0000 (14:50 -0300)] 
[media] media.h: don't use legacy entity macros at Kernel

Put the legacy MEDIA_ENT_* macros under a #ifndef __KERNEL__,
in order to be sure that none of those old symbols are used
inside the Kernel.

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media controller: get rid of entity subtype on Kernel
Mauro Carvalho Chehab [Fri, 8 May 2015 01:12:39 +0000 (22:12 -0300)] 
[media] media controller: get rid of entity subtype on Kernel

Don't use anymore the type/subtype entity data/macros
inside the Kernel.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l2-subdev: use MEDIA_ENT_T_UNKNOWN for new subdevs
Mauro Carvalho Chehab [Fri, 8 May 2015 01:12:38 +0000 (22:12 -0300)] 
[media] v4l2-subdev: use MEDIA_ENT_T_UNKNOWN for new subdevs

Instead of abusing MEDIA_ENT_T_V4L2_SUBDEV, initialize
new subdev entities as MEDIA_ENT_T_UNKNOWN.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] omap4iss: change the logic that checks if an entity is a subdev
Mauro Carvalho Chehab [Fri, 8 May 2015 01:12:37 +0000 (22:12 -0300)] 
[media] omap4iss: change the logic that checks if an entity is a subdev

As we're getting rid of an specific number range for the V4L2 subdev,
we need to replace the check for MEDIA_ENT_T_V4L2_SUBDEV by a macro.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] davinci_vbpe: stop MEDIA_ENT_T_V4L2_SUBDEV abuse
Mauro Carvalho Chehab [Fri, 8 May 2015 01:12:36 +0000 (22:12 -0300)] 
[media] davinci_vbpe: stop MEDIA_ENT_T_V4L2_SUBDEV abuse

This driver is abusing MEDIA_ENT_T_V4L2_SUBDEV:

- it uses a hack to check if the remote entity is a subdev;
- it still uses the legacy entity subtype check macro, that
  will be removed soon.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] s5k5baf: fix subdev type
Mauro Carvalho Chehab [Fri, 8 May 2015 01:12:35 +0000 (22:12 -0300)] 
[media] s5k5baf: fix subdev type

The driver creates two subdevs, one for the image sensor pixel array
(and the related readout logic) and one for an ISP.

The first subdev already uses the MEDIA_ENT_T_V4L2_SUBDEV_SENSOR type,
but the second subdev isn't a sensor pixel array.

So, rename the second subdev as MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] s5c73m3: fix subdev type
Mauro Carvalho Chehab [Fri, 8 May 2015 01:12:34 +0000 (22:12 -0300)] 
[media] s5c73m3: fix subdev type

This sensor driver is abusing MEDIA_ENT_T_V4L2_SUBDEV, creating
some subdevs with a non-existing type.

As this is a sensor driver, one of the entries is
MEDIA_ENT_T_CAM_SENSOR. The other one will be using
MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN, because the subdev is not
any of the already existing types.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] omap3/omap4/davinci: get rid of MEDIA_ENT_T_V4L2_SUBDEV abuse
Mauro Carvalho Chehab [Fri, 8 May 2015 01:12:33 +0000 (22:12 -0300)] 
[media] omap3/omap4/davinci: get rid of MEDIA_ENT_T_V4L2_SUBDEV abuse

On omap3/omap4/davinci drivers, MEDIA_ENT_T_V4L2_SUBDEV macro is
abused in order to "simplify" the pad checks.

Basically, it does a logical or of this macro, in order to check
for a local index and if the entity is either a subdev or not.

As we'll get rid of MEDIA_ENT_T_V4L2_SUBDEV macro, replace it by
2 << 16 where it occurs, and add a note saying that the code
there is actually a hack.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: use macros to check for V4L2 subdev entities
Mauro Carvalho Chehab [Fri, 8 May 2015 01:12:32 +0000 (22:12 -0300)] 
[media] media: use macros to check for V4L2 subdev entities

Instead of relying on media subtype, use the new macros to detect
if an entity is a subdev or an A/V DMA entity.

Please note that most drivers assume that there's just AV_DMA or
V4L2 subdevs. This is not true anymore, as we've added MC support
for DVB, and there are plans to add support for ALSA and FB/DRM
too.

Ok, on the current pipelines supported by those drivers, just V4L
stuff are there, but, assuming that some day a pipeline that also
works with other subsystems will ever added, it is better to add
explicit checks for the AV_DMA stuff.

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: add macros to check if subdev or V4L2 DMA
Mauro Carvalho Chehab [Fri, 21 Aug 2015 15:17:40 +0000 (12:17 -0300)] 
[media] media: add macros to check if subdev or V4L2 DMA

As we'll be removing entity subtypes from the Kernel, we need
to provide a way for drivers and core to check if a given
entity is represented by a V4L2 subdev or if it is an V4L2
I/O entity (typically with DMA).

Drivers that create entities that don't belong to any defined subdev
category should use MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] replace all occurrences of MEDIA_ENT_T_DEVNODE_DVB
Mauro Carvalho Chehab [Fri, 21 Aug 2015 14:54:40 +0000 (11:54 -0300)] 
[media] replace all occurrences of MEDIA_ENT_T_DEVNODE_DVB

Now that interfaces and entities are distinct, it makes no sense
of keeping something named as MEDIA_ENT_T_DEVNODE_DVB_foo.

Made via this script:
for i in $(git grep -l MEDIA_ENT_T|grep -v uapi/linux/media.h); do sed s,MEDIA_ENT_T_DEVNODE_DVB_,MEDIA_ENT_T_DVB_, <$i >a && mv a $i; done
for i in $(git grep -l MEDIA_ENT_T|grep -v uapi/linux/media.h); do sed s,MEDIA_ENT_T_DVB_DVR,MEDIA_ENT_T_DVB_TSOUT, <$i >a && mv a $i; done
for i in $(git grep -l MEDIA_ENT_T|grep -v uapi/linux/media.h); do sed s,MEDIA_ENT_T_DVB_FE,MEDIA_ENT_T_DVB_DEMOD, <$i >a && mv a $i; done
for i in $(git grep -l MEDIA_ENT_T|grep -v uapi/linux/media.h); do sed s,MEDIA_ENT_T_DVB_NET,MEDIA_ENT_T_DVB_DEMOD_NET_DECAP, <$i >a && mv a $i; done

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] replace all occurrences of MEDIA_ENT_T_DEVNODE_V4L
Mauro Carvalho Chehab [Fri, 21 Aug 2015 14:50:17 +0000 (11:50 -0300)] 
[media] replace all occurrences of MEDIA_ENT_T_DEVNODE_V4L

Now that interfaces and entities are distinct, it makes no sense
of keeping something named as MEDIA_ENT_T_DEVNODE.

This change was done with this script:

for i in $(git grep -l MEDIA_ENT_T|grep -v uapi/linux/media.h); do sed s,MEDIA_ENT_T_DEVNODE_V4L,MEDIA_ENT_T_V4L2_VIDEO, <$i >a && mv a $i; done

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: Fix entity namespace
Mauro Carvalho Chehab [Fri, 21 Aug 2015 14:40:34 +0000 (11:40 -0300)] 
[media] uapi/media.h: Fix entity namespace

Now that interfaces got created, we need to fix the entity
namespace.

So, let's create a consistent new namespace and add backward
compatibility macros to keep the old namespace preserved.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] dvbdev: add support for indirect interface links
Mauro Carvalho Chehab [Fri, 21 Aug 2015 12:32:38 +0000 (09:32 -0300)] 
[media] dvbdev: add support for indirect interface links

Some interfaces indirectly control multiple entities.
Add support for those.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: add a linked list to track interfaces by mdev
Mauro Carvalho Chehab [Fri, 21 Aug 2015 12:23:22 +0000 (09:23 -0300)] 
[media] media: add a linked list to track interfaces by mdev

The media device should list the interface objects, so add a linked list
for those interfaces in struct media_device.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] dvbdev: add support for interfaces
Mauro Carvalho Chehab [Fri, 21 Aug 2015 11:20:22 +0000 (08:20 -0300)] 
[media] dvbdev: add support for interfaces

Now that the infrastruct for that is set, add support for
interfaces.

Please notice that we're missing two links:
DVB FE intf    -> tuner
DVB demux intf -> dvr

Those should be added latter, after having the entire graph
set. With the current infrastructure, those should be added
at dvb_create_media_graph(), but it would also require some
extra core changes, to allow the function to enumerate the
interfaces.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
This page took 0.046782 seconds and 5 git commands to generate.