23 Feb, 2017

1 commit


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


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
     

23 Jul, 2016

2 commits


14 Apr, 2016

1 commit

  • Instead of letting drivers fill in device_caps at querycap time,
    let them fill it in when the video device is registered.

    This has the advantage that in the future the v4l2 core can access
    the video device's capabilities and take decisions based on that.

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

    Hans Verkuil
     

27 Feb, 2016

1 commit

  • Add a new interfaces to be used by v4l-core to invoke enable
    source and disable_source handlers in the media_device. The
    enable_source helper function invokes the enable_source handler
    to find media source entity connected to the entity and check
    is it is available or busy. If source is available, link is
    activated and pipeline is started. The disable_source helper
    function invokes the disable_source handler to deactivate and
    stop the pipeline.

    Signed-off-by: Shuah Khan
    Signed-off-by: Mauro Carvalho Chehab

    Shuah Khan
     

11 Jan, 2016

1 commit


03 Mar, 2015

1 commit


23 Dec, 2014

1 commit

  • The old debug field is renamed to dev_debug to ensure that existing drivers
    (including out-of-tree drivers) that try to use the old name will no longer
    compile. A comment has also been added that makes it explicit that drivers
    shouldn't use this field.

    Additional bits have been added to the debug flag to be more fine-grained
    when debugging, especially when dealing with streaming ioctls and read,
    write and poll. You want to enable those explicitly to prevent flooding
    the log when streaming unless you actually want to do that.

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

    Hans Verkuil
     

05 Jul, 2014

1 commit


06 Mar, 2014

1 commit


21 Jun, 2013

1 commit

  • The last set of drivers still using the parent field of video_device instead
    of the v4l2_dev field have been converted, so v4l2_dev is now always set.
    A proper pointer to v4l2_dev is necessary these days otherwise the advanced
    debugging ioctls will not work when addressing sub-devices. It also ensures
    that the core can always go from a video_device struct to the top-level
    v4l2_device struct.
    There is still one single use case for the parent pointer: if there are
    multiple busses, each being the parent of one or more video nodes, and if
    they all share the same v4l2_device struct. In that case one still needs a
    parent pointer since the v4l2_device struct can only refer to a single
    parent device. The cx88 driver is one such case. Unfortunately, the cx88
    failed to set the parent pointer since 3.6. The next patch will correct this.
    In order to support this use-case the parent pointer is only renamed to
    dev_parent, not removed altogether. It has been renamed to ensure that the
    compiler will catch any (possibly out-of-tree) drivers that were missed during
    the conversion.

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

    Hans Verkuil
     

17 Jun, 2013

1 commit

  • The use of current_norm to keep track of the current standard has been
    deprecated for quite some time. Now that all drivers that were using it
    have been converted to use g_std we can drop it from the core.
    It was a bad idea to introduce this at the time: since it is a per-device
    node field it didn't work for drivers that create multiple nodes, all sharing
    the same tuner (e.g. video and vbi nodes, or a raw video node and a compressed
    video node). In addition it was very surprising behavior that g_std was
    implemented in the core. Often drivers implemented both g_std and current_norm,
    because they didn't understand how it should be used.
    Since the benefits were very limited (if they were there at all), it is better
    to just drop it and require that drivers just implement g_std.

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

    Hans Verkuil
     

26 Sep, 2012

1 commit


10 Aug, 2012

1 commit


07 Jul, 2012

1 commit

  • This prepares struct video_device for easier integration with vb2.

    It also introduces a new lock that protects the vb2_queue. It is up
    to the driver to use it or not. And the driver can associate an owner
    filehandle with the queue to check whether queuing requests are
    permitted for the calling filehandle.

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

    Hans Verkuil
     

15 May, 2012

2 commits

  • Rename the function v4l2_dont_use_lock to v4l2_disable_ioctl_locking,
    and rename v4l2_dont_use_cmd to v4l2_disable_ioctl.

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

    Hans Verkuil
     
  • This flag is for legacy drivers only and will go away in the future.

    A note regarding commit 5126f2590bee412e3053de851cb07f531e4be36a
    (v4l2-dev: add flag to have the core lock all file operations):

    That commit message suggests that by not taking the core lock for fops
    other than unlocked_ioctl all problems relating to AB-BA locking and
    mm->mmap_sem are solved. This is not the case.

    More work needs to be done by moving the core lock further down into
    video_ioctl2. It should only be taken after the copy_from/to_user calls
    are done.

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

    Hans Verkuil
     

14 May, 2012

3 commits

  • This used to be the default if the lock pointer was set, but now that lock is by
    default only used for ioctl serialization. Those drivers that already used
    core locking have this flag set explicitly, except for some drivers where
    it was obvious that there was no need to serialize any file operations other
    than ioctl.

    The drivers that didn't need this flag were:

    drivers/media/radio/dsbr100.c
    drivers/media/radio/radio-isa.c
    drivers/media/radio/radio-keene.c
    drivers/media/radio/radio-miropcm20.c
    drivers/media/radio/radio-mr800.c
    drivers/media/radio/radio-tea5764.c
    drivers/media/radio/radio-timb.c
    drivers/media/video/vivi.c
    sound/i2c/other/tea575x-tuner.c

    The other drivers that use core locking and where it was not immediately
    obvious that this flag wasn't needed were changed so that the flag is set
    together with a comment that that driver needs work to avoid having to
    set that flag. This will often involve taking the core lock in the fops
    themselves.

    Eventually this flag should go and it should not be used in new drivers.

    There are a few reasons why we want to avoid core locking of non-ioctl
    fops: in the case of mmap this can lead to a deadlock in rare situations
    since when mmap is called the mmap_sem is held and it is possible for
    other parts of the code to take that lock as well (copy_from_user()/copy_to_user()
    perform a down_read(&mm->mmap_sem) when a page fault occurs).

    It is very unlikely that that happens since the core lock serializes all
    fops, but the kernel warns about it if lock validation is turned on.

    For poll it is also undesirable to take the core lock as that can introduce
    increased latency. The same is true for read/write.

    While it was possible to make flags or something to turn on/off taking the
    core lock for each file operation, in practice it is much simpler to just
    not take it at all except for ioctl and leave it to the driver to take the
    lock. There are only a handful fops compared to the zillion ioctls we have.

    I also wanted to make it obvious which drivers still take the lock for all
    fops, so that's why I chose to have drivers set it explicitly.

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

    Hans Verkuil
     
  • Rather than testing whether an ioctl is implemented in the driver or not
    every time the ioctl is called, do it upfront when the device is registered.

    This also allows a driver to disable certain ioctls based on the capabilities
    of the detected board, something you can't do today without creating separate
    v4l2_ioctl_ops structs for each new variation.

    For the most part it is pretty straightforward, but for control ioctls a flag
    is needed since it is possible that you have per-filehandle controls, and that
    can't be determined upfront of course.

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

    Hans Verkuil
     
  • Using the V4L2 core lock is a very robust method that is usually very good
    at doing the right thing. But some drivers, particularly USB drivers, may
    want to prevent the core from taking the lock for specific ioctls, particularly
    buffer queuing ioctls.

    The reason is that certain commands like S_CTRL can take a long time to process
    over USB and all the time the core has the lock, preventing VIDIOC_DQBUF from
    proceeding, even though a frame may be ready in the queue.

    This introduces unwanted latency.

    Since the buffer queuing commands often have their own internal lock it is
    often not necessary to take the core lock. Drivers can now say that they don't
    want the core to take the lock for specific ioctls.

    As it is a specific opt-out it makes it clear to the reviewer that those
    ioctls will need more care when reviewing.

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

    Hans Verkuil
     

20 Mar, 2012

1 commit

  • Drivers implementing custom ioctls need to handle 32-bit/64-bit
    compatibility themselves. Provide them with a way to do so.

    To avoid circular module dependencies, merge the v4l2-compat-ioctl32
    module into videodev. There is no point in keeping them separate, as the
    v4l2_compat_ioctl32() function is required by videodev if CONFIG_COMPAT
    is set anyway.

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

    Laurent Pinchart
     

01 Jun, 2011

1 commit


20 May, 2011

1 commit


23 Mar, 2011

3 commits


22 Mar, 2011

2 commits

  • V4L2 devices are media entities. As such they need to inherit from
    (include) the media_entity structure.

    When registering/unregistering the device, the media entity is
    automatically registered/unregistered. The entity is acquired on device
    open and released on device close.

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

    Laurent Pinchart
     
  • Create a device node named subdevX for every registered subdev.

    As the device node is registered before the subdev core::s_config
    function is called, return -EGAIN on open until initialization
    completes.

    Signed-off-by: Laurent Pinchart
    Signed-off-by: Vimarsh Zutshi
    Acked-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Laurent Pinchart
     

21 Oct, 2010

3 commits

  • Drivers can optionally set a pointer to a mutex in struct video_device.
    The core will use that to lock before calling open, read, write, unlocked_ioctl,
    poll, mmap or release.

    Updated the documentation as well and ensure that v4l2-event knows about the
    lock: it will unlock it before doing a blocking wait on an event and relock it
    afterwards.

    Ensure that the 'video_is_registered' check is done when the lock is held:
    a typical disconnect will take the lock as well before unregistering the
    device nodes, so to prevent race conditions the video_is_registered check
    should also be done with the lock held.

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

    Hans Verkuil
     
  • The get_unmapped_area file operation is unused. Remove.

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

    Hans Verkuil
     
  • Remove the vtx (aka videotext aka teletext) API from the v4l2 core.
    This API was scheduled for removal in kernel 2.6.35.

    The vtx device nodes have been superseded by vbi device nodes
    for many years. No applications exist that use the vtx support.
    Of the two i2c drivers that actually support this API the saa5249
    has been impossible to use for a year now and no known hardware
    that supports this device exists. The saa5246a is theoretically
    supported by the old mxb boards, but it never actually worked.

    In summary: there is no hardware that can use this API and there
    are no applications actually implementing this API.

    The vtx support still reserves minors 192-223 and we would really
    like to reuse those for upcoming new functionality. In the unlikely
    event that new hardware appears that wants to use the functionality
    provided by the vtx API, then that functionality should be build
    around the sliced VBI API instead.

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

    Hans Verkuil
     

09 Aug, 2010

1 commit

  • Add a new framework to handle controls which makes life for driver
    developers much easier.

    Note that this patch moves some of the control support that used to be in
    v4l2-common.c to v4l2-ctrls.c. The tables were copied unchanged. The body
    of v4l2_ctrl_query_fill() was copied to a new v4l2_ctrl_fill() function
    in v4l2-ctrls.c. This new function doesn't use the v4l2_queryctrl
    struct anymore, which makes it more general.

    The remainder of v4l2-ctrls.c is all new. Highlights include:

    - No need to implement VIDIOC_QUERYCTRL, QUERYMENU, S_CTRL, G_CTRL,
    S_EXT_CTRLS, G_EXT_CTRLS or TRY_EXT_CTRLS in either bridge drivers
    or subdevs. New wrapper functions are provided that can just be plugged in.
    Once everything has been converted these wrapper functions can be removed as well.

    - When subdevices are added their controls can be automatically merged
    with the bridge driver's controls.

    - Most drivers just need to implement s_ctrl to set the controls.
    The framework handles the locking and tries to be as 'atomic' as possible.

    - Ready for the subdev device nodes: the same mechanism applies to subdevs
    and their device nodes as well. Sub-device drivers can make controls
    local, preventing them from being merged with bridge drivers.

    - Takes care of backwards compatibility handling of VIDIOC_S_CTRL and
    VIDIOC_G_CTRL. Handling of V4L2_CID_PRIVATE_BASE is fully transparent.
    CTRL_CLASS controls are automatically added.

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

    Hans Verkuil
     

19 May, 2010

1 commit

  • This patch adds a list of v4l2_fh structures to every video_device.
    It allows using file handle related information in V4L2. The event interface
    is one example of such use.

    The use of v4l2_fh is not mandatory for drivers.

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

    Sakari Ailus
     

16 Dec, 2009

2 commits


19 Sep, 2009

2 commits