20 Mar, 2019

1 commit

  • The module ownership refcounting was done in media_entity_get/put,
    but that was very confusing and it did not work either in case an
    application had a v4l-subdevX device open and the module was
    unbound. When the v4l-subdevX device was closed the media_entity_put
    was never called and the module refcount was left one too high, making
    it impossible to unload it.

    Since v4l2-subdev.c was the only place where media_entity_get/put was
    called, just move the functionality to v4l2-subdev.c and drop those
    confusing entity functions.

    Store the module in subdev_fh so module_put no longer depends on
    the media_entity struct.

    Signed-off-by: Hans Verkuil
    Reviewed-by: Laurent Pinchart
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     

18 Sep, 2018

2 commits

  • Instead of relying on a static map for pids, use the new sig_type
    "taint" type to setup the pipelines with the same tipe between
    different entities.

    Acked-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • Consumer devices are provided with a wide different range of types
    supported by the same driver, allowing different configutations.

    In order to make easier to setup media controller links, "taint"
    pads with the signal type it carries.

    While here, get rid of DEMOD_PAD_VBI_OUT, as the signal it carries
    is actually the same as the normal video output.

    The difference happens at the video/VBI interface:
    - for VBI, only the hidden lines are streamed;
    - for video, the stream is usually cropped to hide the
    vbi lines.

    Acked-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     

10 May, 2018

1 commit


23 Jan, 2018

1 commit

  • Add nop variant of media_entity_cleanup. This allows calling
    media_entity_cleanup whether or not Media controller is enabled,
    simplifying driver code.

    Also drop #ifdefs on a few drivers around media_entity_cleanup().

    Signed-off-by: Sakari Ailus
    Reviewed-by: Arnd Bergmann
    Signed-off-by: Mauro Carvalho Chehab

    Sakari Ailus
     

18 Dec, 2017

1 commit


21 Jul, 2017

1 commit


20 Jun, 2017

2 commits


28 Jan, 2017

1 commit

  • The media_entity_pipeline_start() and media_entity_pipeline_stop()
    functions are renamed as media_pipeline_start() and media_pipeline_stop(),
    respectively. The reason is two-fold: the pipeline struct is, rightly,
    already called media_pipeline (rather than media_entity_pipeline) and what
    this really is about is a pipeline. A pipeline consists of entities ---
    and, well, other objects embedded in these entities.

    As the pipeline object will be in the future moved from entities to pads
    in order to support multiple pipelines through a single entity, do the
    renaming now.

    Similarly, functions operating on struct media_entity_graph as well as the
    struct itself are renamed by dropping the "entity_" part from the prefix
    of the function family and the data structure. The graph traversal which
    is what the functions are about is not specifically about entities only
    and will operate on pads for the same reason as the media pipeline.

    The patch has been generated using the following command:

    git grep -l media_entity |xargs perl -i -pe '
    s/media_entity_pipeline/media_pipeline/g;
    s/media_entity_graph/media_graph/g'

    And a few manual edits related to line start alignment and line wrapping.

    Signed-off-by: Sakari Ailus
    Acked-by: Laurent Pinchart
    Signed-off-by: Mauro Carvalho Chehab

    Sakari Ailus
     

27 Jan, 2017

1 commit

  • Drop the FSF's postal address from the source code files that typically
    contain mostly the license text. Of the 628 removed instances, 578 are
    outdated.

    The patch has been created with the following command without manual edits:

    git grep -l "675 Mass Ave\|59 Temple Place\|51 Franklin St" -- \
    drivers/media/ include/media|while read i; do i=$i perl -e '
    open(F,"< $ENV{i}");
    $a=join("", );
    $a =~ s/[ \t]*\*\n.*You should.*\n.*along with.*\n.*(\n.*USA.*$)?\n//m
    && $a =~ s/(^.*)Or, (point your browser to) /$1To obtain the license, $2\n$1/m;
    close(F);
    open(F, "> $ENV{i}");
    print F $a;
    close(F);'; done

    Signed-off-by: Sakari Ailus

    Sakari Ailus
     

22 Sep, 2016

1 commit

  • As warned by linuxdoc[1] tool, using:

    $ for i in $(git grep kernel-doc Documentation/media/kapi/|cut -d: -f4); do kernel-lintdoc --sloppy $i; done

    include/media/v4l2-dev.h:118 :WARN: function name from comment differs: v4l2_prio_close v4l2_prio_check
    include/media/v4l2-mc.h:56 [kernel-doc WARN] : enum name from comment differs: if_vid_dec_index if_vid_dec_pad_index
    include/media/v4l2-mc.h:71 [kernel-doc WARN] : enum name from comment differs: if_aud_dec_index if_aud_dec_pad_index
    include/media/v4l2-mem2mem.h:396 [kernel-doc WARN] : function name from comment differs: v4l2_m2m_num_src_bufs_ready v4l2_m2m_num_dst_bufs_ready
    drivers/media/dvb-core/dvb_math.h:28 [kernel-doc WARN] : function name from comment differs: cintlog2 intlog2
    include/media/v4l2-subdev.h:215 [kernel-doc WARN] : struct name from comment differs: s_radio v4l2_subdev_tuner_ops
    include/media/v4l2-subdev.h:890 [kernel-doc WARN] : function name from comment differs: v4l2_set_subdevdata v4l2_set_subdev_hostdata
    include/media/v4l2-subdev.h:901 [kernel-doc WARN] : function name from comment differs: v4l2_get_subdevdata v4l2_get_subdev_hostdata
    drivers/media/dvb-core/dvb_ringbuffer.h:196 [kernel-doc WARN] : function name from comment differs: dvb_ringbuffer_writeuser dvb_ringbuffer_write_user
    include/media/videobuf2-core.h:399 [kernel-doc WARN] : struct name from comment differs: vb2_ops vb2_buf_ops
    include/media/media-entity.h:132 [kernel-doc ERROR] : duplicate parameter definition 'source'
    include/media/media-entity.h:477 [kernel-doc WARN] : function name from comment differs: media_entity_enum_test media_entity_enum_test_and_set
    include/media/media-entity.h:535 [kernel-doc WARN] : function name from comment differs: gobj_to_entity gobj_to_pad
    include/media/media-entity.h:544 [kernel-doc WARN] : function name from comment differs: gobj_to_entity gobj_to_link
    include/media/media-entity.h:553 [kernel-doc WARN] : function name from comment differs: gobj_to_entity gobj_to_intf
    include/media/media-entity.h:562 [kernel-doc WARN] : function name from comment differs: gobj_to_entity intf_to_devnode
    include/media/rc-core.h:234 [kernel-doc WARN] : function name from comment differs: rc_open rc_close
    include/media/v4l2-ctrls.h:397 [kernel-doc WARN] : missing initial short description of 'v4l2_ctrl_handler_init'
    include/media/v4l2-dev.h:118 [kernel-doc WARN] : function name from comment differs: v4l2_prio_close v4l2_prio_check
    include/media/v4l2-event.h:225 [kernel-doc WARN] : missing initial short description of 'v4l2_src_change_event_subscribe'

    [1] https://return42.github.io/linuxdoc/linux.html

    The above are real issues at the documentation. On several cases,
    caused by cut-and-paste.

    Fix them.

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     

09 Sep, 2016

1 commit

  • There are several issues on the documentation:
    - the media.h header were not properly referenced;
    - verbatim expressions were not properly marked as such;
    - struct member references were wrong;
    - some notes were not using the right markup;
    - a comment that were moved to the kernel-doc markup were
    duplicated as a comment inside the struct media_entity;
    - some args were not pointing to the struct they're using;
    - macros weren't documented.

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     

25 Aug, 2016

3 commits


23 Jul, 2016

3 commits


18 Jul, 2016

1 commit

  • There were lots of issues at the media controller side,
    after the conversion:

    - Some documentation at the header files weren't using the
    kernel-doc start block;

    - Now, the C files with the exported symbols also need to be
    added. So, all headers need to be included twice: one to
    get the structs/enums/.. and another one for the functions;

    - Notes should use the ReST tag, as kernel-doc doesn't
    recognizes it anymore;

    - Identation needs to be fixed, as ReST uses it to identify
    when a format "tag" ends.

    - Fix the cross-references at the media controller description.

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     

21 Apr, 2016

1 commit


14 Apr, 2016

2 commits

  • All users of is_media_entity_v4l2_io() (the exynos4-is, omap3isp,
    davince_vpfe and omap4iss drivers and the v4l2-mc power management code)
    use the function to check whether entities are video_device instances,
    either to ensure they can cast the entity to a struct video_device, or
    to count the number of video nodes users.

    The purpose of the function is thus to identify whether the media entity
    instance is an instance of the video_device object, not to check whether
    it can perform I/O. Rename it accordingly, we will introduce a more
    specific is_media_entity_v4l2_io() check when needed.

    Signed-off-by: Laurent Pinchart
    Acked-by: Hans Verkuil
    Acked-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Laurent Pinchart
     
  • Code that processes media entities can require knowledge of the
    structure type that embeds a particular media entity instance in order
    to cast the entity to the proper object type. This needs is shown by the
    presence of the is_media_entity_v4l2_io and is_media_entity_v4l2_subdev
    functions.

    The implementation of those two functions relies on the entity function
    field, which is both a wrong and an inefficient design, without even
    mentioning the maintenance issue involved in updating the functions
    every time a new entity function is added. Fix this by adding add an
    obj_type field to the media entity structure to carry the information.

    Signed-off-by: Laurent Pinchart
    Acked-by: Hans Verkuil
    Acked-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Laurent Pinchart
     

03 Mar, 2016

1 commit


27 Feb, 2016

1 commit


11 Jan, 2016

15 commits

  • Sometimes, it is desired to create 1:n and n:1 or even
    n:n links between different entities with the same
    function.

    This is actually needed to support DVB devices that
    have multiple frontends. While we could do a function
    like that internally at the DVB core, such function is
    generic enough to be at media-entity, and it could be
    useful on some other places.

    So, add such function.

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • There are two ancillary functions that are missing comments.

    While those are used only internally at media-entity.c,
    document them, for completeness.

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • Instead of using one u32 counter per type for object IDs, use
    just one counter. With such change, it makes sense to simplify
    the debug logs too.

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • 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

    Mauro Carvalho Chehab
     
  • This function was added recently, but weren't documented.
    Add documentation for it.

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • 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

    Mauro Carvalho Chehab
     
  • 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
    Signed-off-by: Mauro Carvalho Chehab

    Sakari Ailus
     
  • 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
    Signed-off-by: Mauro Carvalho Chehab

    Sakari Ailus
     
  • 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
    Signed-off-by: Mauro Carvalho Chehab

    Sakari Ailus
     
  • 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
    Signed-off-by: Mauro Carvalho Chehab

    Sakari Ailus
     
  • 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
    Signed-off-by: Mauro Carvalho Chehab

    Sakari Ailus
     
  • 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
    Reviewed-by: Mauro Carvalho Chehab
    Signed-off-by: Mauro Carvalho Chehab

    Sakari Ailus
     
  • 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
    Signed-off-by: Mauro Carvalho Chehab

    Sakari Ailus
     
  • It will be needed in struct media_pipeline shortly.

    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Sakari Ailus
     
  • 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
    Signed-off-by: Mauro Carvalho Chehab

    Sakari Ailus