Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
media-entity.c File Reference
#include <linux/module.h>
#include <linux/slab.h>
#include <media/media-entity.h>
#include <media/media-device.h>

Go to the source code of this file.

Macros

#define stack_peek(en)   ((en)->stack[(en)->top - 1].entity)
 
#define link_top(en)   ((en)->stack[(en)->top].link)
 
#define stack_top(en)   ((en)->stack[(en)->top].entity)
 

Functions

int media_entity_init (struct media_entity *entity, u16 num_pads, struct media_pad *pads, u16 extra_links)
 
 EXPORT_SYMBOL_GPL (media_entity_init)
 
void media_entity_cleanup (struct media_entity *entity)
 
 EXPORT_SYMBOL_GPL (media_entity_cleanup)
 
void media_entity_graph_walk_start (struct media_entity_graph *graph, struct media_entity *entity)
 
 EXPORT_SYMBOL_GPL (media_entity_graph_walk_start)
 
struct media_entitymedia_entity_graph_walk_next (struct media_entity_graph *graph)
 
 EXPORT_SYMBOL_GPL (media_entity_graph_walk_next)
 
__must_check int media_entity_pipeline_start (struct media_entity *entity, struct media_pipeline *pipe)
 
 EXPORT_SYMBOL_GPL (media_entity_pipeline_start)
 
void media_entity_pipeline_stop (struct media_entity *entity)
 
 EXPORT_SYMBOL_GPL (media_entity_pipeline_stop)
 
struct media_entitymedia_entity_get (struct media_entity *entity)
 
 EXPORT_SYMBOL_GPL (media_entity_get)
 
void media_entity_put (struct media_entity *entity)
 
 EXPORT_SYMBOL_GPL (media_entity_put)
 
int media_entity_create_link (struct media_entity *source, u16 source_pad, struct media_entity *sink, u16 sink_pad, u32 flags)
 
 EXPORT_SYMBOL_GPL (media_entity_create_link)
 
int __media_entity_setup_link (struct media_link *link, u32 flags)
 
int media_entity_setup_link (struct media_link *link, u32 flags)
 
 EXPORT_SYMBOL_GPL (media_entity_setup_link)
 
struct media_linkmedia_entity_find_link (struct media_pad *source, struct media_pad *sink)
 
 EXPORT_SYMBOL_GPL (media_entity_find_link)
 
struct media_padmedia_entity_remote_source (struct media_pad *pad)
 
 EXPORT_SYMBOL_GPL (media_entity_remote_source)
 

Macro Definition Documentation

#define link_top (   en)    ((en)->stack[(en)->top].link)

Definition at line 125 of file media-entity.c.

#define stack_peek (   en)    ((en)->stack[(en)->top - 1].entity)

Definition at line 124 of file media-entity.c.

#define stack_top (   en)    ((en)->stack[(en)->top].entity)

Definition at line 126 of file media-entity.c.

Function Documentation

int __media_entity_setup_link ( struct media_link link,
u32  flags 
)

__media_entity_setup_link - Configure a media link The link being configured : Link configuration flags

The bulk of link setup is handled by the two entities connected through the link. This function notifies both entities of the link configuration change.

If the link is immutable or if the current and new configuration are identical, return immediately.

The user is expected to hold link->source->parent->mutex. If not, media_entity_setup_link() should be used instead.

Definition at line 470 of file media-entity.c.

EXPORT_SYMBOL_GPL ( media_entity_init  )
EXPORT_SYMBOL_GPL ( media_entity_cleanup  )
EXPORT_SYMBOL_GPL ( media_entity_graph_walk_start  )
EXPORT_SYMBOL_GPL ( media_entity_graph_walk_next  )
EXPORT_SYMBOL_GPL ( media_entity_pipeline_start  )
EXPORT_SYMBOL_GPL ( media_entity_pipeline_stop  )
EXPORT_SYMBOL_GPL ( media_entity_get  )
EXPORT_SYMBOL_GPL ( media_entity_put  )
EXPORT_SYMBOL_GPL ( media_entity_create_link  )
EXPORT_SYMBOL_GPL ( media_entity_setup_link  )
EXPORT_SYMBOL_GPL ( media_entity_find_link  )
EXPORT_SYMBOL_GPL ( media_entity_remote_source  )
void media_entity_cleanup ( struct media_entity entity)

Definition at line 82 of file media-entity.c.

int media_entity_create_link ( struct media_entity source,
u16  source_pad,
struct media_entity sink,
u16  sink_pad,
u32  flags 
)

Definition at line 392 of file media-entity.c.

struct media_link* media_entity_find_link ( struct media_pad source,
struct media_pad sink 
)
read

media_entity_find_link - Find a link between two pads : Source pad : Sink pad

Return a pointer to the link between the two entities. If no such link exists, return NULL.

Definition at line 543 of file media-entity.c.

struct media_entity* media_entity_get ( struct media_entity entity)
read

Definition at line 335 of file media-entity.c.

struct media_entity* media_entity_graph_walk_next ( struct media_entity_graph graph)
read

media_entity_graph_walk_next - Get the next entity in the graph : Media graph structure

Perform a depth-first traversal of the given media entities graph.

The graph structure must have been previously initialized with a call to media_entity_graph_walk_start().

Return the next entity in the graph or NULL if the whole graph have been traversed.

Definition at line 160 of file media-entity.c.

void media_entity_graph_walk_start ( struct media_entity_graph graph,
struct media_entity entity 
)

media_entity_graph_walk_start - Start walking the media graph at a given entity : Media graph structure that will be used to walk the graph : Starting entity

This function initializes the graph traversal structure to walk the entities graph starting at the given entity. The traversal structure must not be modified by the caller during graph traversal. When done the structure can safely be freed.

Definition at line 138 of file media-entity.c.

int media_entity_init ( struct media_entity entity,
u16  num_pads,
struct media_pad pads,
u16  extra_links 
)

media_entity_init - Initialize a media entity

: Total number of sink and source pads. : Initial estimate of the number of extra links. : Array of 'num_pads' pads.

The total number of pads is an intrinsic property of entities known by the entity driver, while the total number of links depends on hardware design and is an extrinsic property unknown to the entity driver. However, in most use cases the entity driver can guess the number of links which can safely be assumed to be equal to or larger than the number of pads.

For those reasons the links array can be preallocated based on the entity driver guess and will be reallocated later if extra links need to be created.

This function allocates a links array with enough space to hold at least 'num_pads' + 'extra_links' elements. The media_entity::max_links field will be set to the number of allocated elements.

The pads array is managed by the entity driver and passed to media_entity_init() where its pointer will be stored in the entity structure.

Definition at line 53 of file media-entity.c.

__must_check int media_entity_pipeline_start ( struct media_entity entity,
struct media_pipeline pipe 
)

media_entity_pipeline_start - Mark a pipeline as streaming : Starting entity : Media pipeline to be assigned to all entities in the pipeline.

Mark all entities connected to a given entity through enabled links, either directly or indirectly, as streaming. The given pipeline object is assigned to every entity in the pipeline and stored in the media_entity pipe field.

Calls to this function can be nested, in which case the same number of media_entity_pipeline_stop() calls will be required to stop streaming. The pipeline pointer must be identical for all nested calls to media_entity_pipeline_start().

Definition at line 217 of file media-entity.c.

void media_entity_pipeline_stop ( struct media_entity entity)

media_entity_pipeline_stop - Mark a pipeline as not streaming : Starting entity

Mark all entities connected to a given entity through enabled links, either directly or indirectly, as not streaming. The media_entity pipe field is reset to NULL.

If multiple calls to media_entity_pipeline_start() have been made, the same number of calls to this function are required to mark the pipeline as not streaming.

Definition at line 302 of file media-entity.c.

void media_entity_put ( struct media_entity entity)

Definition at line 356 of file media-entity.c.

struct media_pad* media_entity_remote_source ( struct media_pad pad)
read

media_entity_remote_source - Find the source pad at the remote end of a link : Sink pad at the local end of the link

Search for a remote source pad connected to the given sink pad by iterating over all links originating or terminating at that pad until an enabled link is found.

Return a pointer to the pad at the remote end of the first found enabled link, or NULL if no enabled link has been found.

Definition at line 573 of file media-entity.c.

int media_entity_setup_link ( struct media_link link,
u32  flags 
)

Definition at line 522 of file media-entity.c.