26 Feb, 2018

1 commit

  • The media.h public header is very messy. It mixes legacy and 'new' defines
    and it is not easy to figure out what should and what shouldn't be used. It
    also contains confusing comment that are either out of date or completely
    uninteresting for anyone that needs to use this header.

    The patch groups all entity functions together, including the 'old' defines
    based on the old range base. The reader just wants to know about the available
    functions and doesn't care about what range is used.

    All legacy defines are moved to the end of the header, so it is easier to
    locate them and just ignore them.

    The legacy structs in the struct media_entity_desc are put under
    also a much more effective signal to the reader that they shouldn't be used
    compared to the old method of relying on '#if 1' followed by a comment.

    The unused MEDIA_INTF_T_ALSA_* defines are also moved to the end of the header
    in the legacy area. They are also dropped from intf_type() in media-entity.c.

    All defines are also aligned at the same tab making the header easier to read.

    Signed-off-by: Hans Verkuil
    [mchehab@s-opensource.com: removed lots of spaces before tabs; typo changes ->change ]
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     

05 Oct, 2017

1 commit


21 Jul, 2017

1 commit


23 Jun, 2017

1 commit

  • Drivers must not perform unbalanced calls to stop the entity pipeline,
    however if they do they will fault in the core media code, as the
    entity->pipe will be set as NULL. We handle this gracefully in the core
    with a WARN for the developer.

    Replace the erroneous check on zero streaming counts, with a check on
    NULL pipe elements instead, as this is the symptom of unbalanced
    media_pipeline_stop calls.

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

    Kieran Bingham
     

20 Jun, 2017

1 commit


19 Apr, 2017

1 commit


30 Jan, 2017

2 commits


28 Jan, 2017

2 commits

  • With media_entity_graph_walk_next() getting more and more complicated (and
    especially so with has_routing() support added), split the function into
    two.

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

    Sakari Ailus
     
  • 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

3 commits

  • Commit 3801bc7d1b8d ("[media] media: Media Controller fix to not let
    stream_count go negative") added a sanity check for negative stream_count,
    but a failure of the check remained silent. Make sure the failure is
    noticed.

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

    Sakari Ailus
     
  • There's a sanity check for the stream count remaining positive or zero on
    error path, but instead of performing the check on the traversed entity it
    is performed on the entity where traversal ends. Fix this.

    Fixes: commit 3801bc7d1b8d ("[media] media: Media Controller fix to not let stream_count go negative")

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

    Sakari Ailus
     
  • 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
     

19 Nov, 2016

1 commit

  • media_gobj_destroy() may be called twice on one instance - once by
    media_device_unregister() and again by dvb_media_device_free(). The
    function media_remove_intf_links() establishes and documents the
    convention that mdev==NULL means that the object is not registered,
    but nobody ever NULLs this variable. So this patch really implements
    this behavior, and adds another mdev==NULL check to
    media_gobj_destroy() to protect against double removal.

    Signed-off-by: Max Kellermann
    Signed-off-by: Mauro Carvalho Chehab

    Max Kellermann
     

09 Sep, 2016

1 commit


24 Aug, 2016

1 commit

  • Some touch controllers send out touch data in a similar way to a
    greyscale frame grabber.

    Add new device type VFL_TYPE_TOUCH:
    - This uses a new device prefix v4l-touch for these devices, to stop
    generic capture software from treating them as webcams. Otherwise,
    touch is treated similarly to video capture.
    - Add V4L2_INPUT_TYPE_TOUCH
    - Add MEDIA_INTF_T_V4L_TOUCH
    - Add V4L2_CAP_TOUCH to indicate device is a touch device

    Add formats:
    - V4L2_TCH_FMT_DELTA_TD16 for signed 16-bit touch deltas
    - V4L2_TCH_FMT_DELTA_TD08 for signed 16-bit touch deltas
    - V4L2_TCH_FMT_TU16 for unsigned 16-bit touch data
    - V4L2_TCH_FMT_TU08 for unsigned 8-bit touch data

    This support will be used by:
    - Atmel maXTouch (atmel_mxt_ts)
    - Synaptics RMI4.
    - sur40

    Signed-off-by: Nick Dyer
    Tested-by: Chris Healy
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab
    Acked-by: Dmitry Torokhov

    Nick Dyer
     

29 Apr, 2016

1 commit

  • According to the V4L2 API, the VIDIOC_STREAMON ioctl should return EPIPE
    if there is a format mismatch in the pipeline configuration.

    As the .vidioc_streamon in the v4l2_ioctl_ops usually forwards the error
    caused by the v4l2_subdev_link_validate_default (if it is in use), it
    should return -EPIPE when it detect the mismatch.

    When an entity is connected to a non enabled link,
    media_entity_pipeline_start should return -ENOLINK, as the link does not
    exist.

    Signed-off-by: Helen Mae Koike Fornazier
    Acked-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Helen Mae Koike Fornazier
     

21 Apr, 2016

1 commit

  • Right now, the lock schema for media_device struct is messy,
    since sometimes, it is protected via a spin lock, while, for
    media graph traversal, it is protected by a mutex.

    Solve this conflict by always using a mutex.

    As a side effect, this prevents a bug when the media notifiers
    is called at atomic context, while running the notifier callback:

    BUG: sleeping function called from invalid context at mm/slub.c:1289
    in_atomic(): 1, irqs_disabled(): 0, pid: 3479, name: modprobe
    4 locks held by modprobe/3479:
    #0: (&dev->mutex){......}, at: [] __driver_attach+0xa3/0x160
    #1: (&dev->mutex){......}, at: [] __driver_attach+0xb1/0x160
    #2: (register_mutex#5){+.+.+.}, at: [] usb_audio_probe+0x257/0x1c90 [snd_usb_audio]
    #3: (&(&mdev->lock)->rlock){+.+.+.}, at: [] media_device_register_entity+0x1cb/0x700 [media]
    CPU: 2 PID: 3479 Comm: modprobe Not tainted 4.5.0-rc3+ #49
    Hardware name: /NUC5i7RYB, BIOS RYBDWi35.86A.0350.2015.0812.1722 08/12/2015
    0000000000000000 ffff8803b3f6f288 ffffffff81933901 ffff8803c4bae000
    ffff8803c4bae5c8 ffff8803b3f6f2b0 ffffffff811c6af5 ffff8803c4bae000
    ffffffff8285d7f6 0000000000000509 ffff8803b3f6f2f0 ffffffff811c6ce5
    Call Trace:
    [] dump_stack+0x85/0xc4
    [] ___might_sleep+0x245/0x3a0
    [] __might_sleep+0x95/0x1a0
    [] kmem_cache_alloc_trace+0x20e/0x300
    [] ? media_add_link+0x4d/0x140 [media]
    [] media_add_link+0x4d/0x140 [media]
    [] media_create_pad_link+0xa1/0x600 [media]
    [] au0828_media_graph_notify+0x173/0x360 [au0828]
    [] ? media_gobj_create+0x1ba/0x480 [media]
    [] media_device_register_entity+0x3ab/0x700 [media]

    Reviewed-by: Javier Martinez Canillas
    Acked-by: Sakari Ailus
    Acked-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     

05 Mar, 2016

1 commit


27 Feb, 2016

3 commits


19 Feb, 2016

1 commit


01 Feb, 2016

1 commit


11 Jan, 2016

16 commits