04 Nov, 2011

2 commits

  • VIDIOC_G_STD can return the current TV-norm to the user in one of two ways:
    if an .vidioc_g_std() ioctl operation is provided by the driver, it is
    called, otherwise the value ot the .current_norm field of struct
    video_device is returned. Since subdevice drivers currently have no access
    to struct video_device objects, the only way to provide this information to
    the user is by implementing a .g_std() method.

    Signed-off-by: Guennadi Liakhovetski
    Signed-off-by: Mauro Carvalho Chehab

    Guennadi Liakhovetski
     
  • Currently only very few drivers actually use video_device nodes, embedded
    in struct v4l2_subdev. Allocate these nodes dynamically for those drivers
    to save memory for the rest.

    Signed-off-by: Guennadi Liakhovetski
    Tested-by: Sylwester Nawrocki
    Acked-by: Laurent Pinchart
    Signed-off-by: Mauro Carvalho Chehab

    Guennadi Liakhovetski
     

28 Jul, 2011

5 commits

  • Add media bus configuration types and two subdev operations to get
    supported mediabus configurations and to set a specific configuration.
    Subdevs can support several configurations, e.g., they can send video data
    on 1 or several lanes, can be configured to use a specific CSI-2 channel,
    in such cases subdevice drivers return bitmasks with all respective bits
    set. When a set-configuration operation is called, it has to specify a
    non-ambiguous configuration.

    Signed-off-by: Stanimir Varbanov
    Signed-off-by: Guennadi Liakhovetski
    Signed-off-by: Mauro Carvalho Chehab

    Guennadi Liakhovetski
     
  • Callback is used to acquire current analog TV standard from a subdev.
    It is used to avoid keeping current standard in top-level driver.

    Signed-off-by: Tomasz Stanislawski
    Signed-off-by: Kyungmin Park
    Signed-off-by: Mauro Carvalho Chehab

    Tomasz Stanislawski
     
  • Callback is used to acquire current digital video preset from a subdev.
    It is used to avoid keeping dv preset in top-level driver.

    Signed-off-by: Tomasz Stanislawski
    Signed-off-by: Kyungmin Park
    Signed-off-by: Mauro Carvalho Chehab

    Tomasz Stanislawski
     
  • Callback is used to acquire TV norms supported by a subdev.
    It is used to avoid having standards in top-level driver.

    Signed-off-by: Tomasz Stanislawski
    Signed-off-by: Kyungmin Park
    Reviewed-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Tomasz Stanislawski
     
  • The driver had to decide how many events to allocate when the v4l2_fh struct
    was created. It was possible to add more events afterwards, but there was no
    way to ensure that you wouldn't miss important events if the event queue
    would fill up for that filehandle.

    In addition, once there were no more free events, any new events were simply
    dropped on the floor.

    For the control event in particular this made life very difficult since
    control status/value changes could just be missed if the number of allocated
    events and the speed at which the application read events was too low to keep
    up with the number of generated events. The application would have no idea
    what the latest state was for a control since it could have missed the latest
    control change.

    So this patch makes some major changes in how events are allocated. Instead
    of allocating events per-filehandle they are now allocated when subscribing an
    event. So for that particular event type N events (determined by the driver)
    are allocated. Those events are reserved for that particular event type.
    This ensures that you will not miss events for a particular type altogether.

    In addition, if there are N events in use and a new event is raised, then
    the oldest event is dropped and the new one is added. So the latest event
    is always available.

    This can be further improved by adding the ability to merge the state of
    two events together, ensuring that no data is lost at all. This will be
    added in the next patch.

    This also makes it possible to allow the user to determine the number of
    events that will be allocated. This is not implemented at the moment, but
    would be trivial.

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

    Hans Verkuil
     

08 Jul, 2011

2 commits


22 Mar, 2011

13 commits

  • Some buggy sensors generate corrupt frames when the stream is started.
    This new operation return the number of corrupt frames to skip when
    starting the stream.

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

    Laurent Pinchart
     
  • This patch adds the VIDIOC_SUBDEV_S_CROP and G_CROP ioctls to the
    userland API. CROPCAP is not implemented because it's redundant.

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

    Antti Koskipaa
     
  • The three new ioctl VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL,
    VIDIOC_SUBDEV_G_FRAME_INTERVAL and VIDIOC_SUBDEV_S_FRAME_INTERVAL can be
    used to enumerate and configure a subdev's frame rate from userspace.

    Two new video::g/s_frame_interval subdev operations are introduced to
    support those ioctls. The existing video::g/s_parm operations are
    deprecated and shouldn't be used anymore.

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

    Laurent Pinchart
     
  • Add a userspace API to get, set and enumerate the media format on a
    subdev pad.

    The format at the output of a subdev usually depends on the format at
    its input(s). The try format operation is thus not suitable for probing
    format at individual pads, as it can't modify the device state and thus
    can't remember the format tried at the input to compute the output
    format.

    To fix the problem, pass an extra argument to the get/set format
    operations to select the 'try' or 'active' format.

    The try format is used when probing the subdev. Setting the try format
    must not change the device configuration but can store data for later
    reuse. Data storage is provided at the file-handle level so applications
    probing the subdev concurently won't interfere with each other.

    The active format is used when configuring the subdev. It's identical to
    the format handled by the usual get/set operations.

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

    Laurent Pinchart
     
  • Add a v4l2_subdev_pad_ops structure for the operations that need to be
    performed at the pad level such as format-related operations.

    Pad format-related operations use v4l2_mbus_framefmt instead of
    v4l2_format.

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

    Laurent Pinchart
     
  • V4L2 sub-devices store pad formats and crop settings in the file handle.
    To let drivers initialize those settings properly, add an open operation
    that is called when the subdev is opened as well as a corresponding
    close operation.

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

    Laurent Pinchart
     
  • Used for storing subdev information per file handle and hold V4L2 file
    handle.

    Signed-off-by: Stanimir Varbanov
    Signed-off-by: Antti Koskipaa
    Signed-off-by: Laurent Pinchart
    Acked-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

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

    When registering/unregistering the subdevice, 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
     
  • Provide v4l2_subdevs with v4l2_event support. Subdev drivers only need very
    little to support events.

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

    Sakari Ailus
     
  • The function isn't small or performance sensitive enough to be inlined.

    Signed-off-by: Laurent Pinchart
    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
     
  • There's no reason to require subdevices to implement the core
    operations. Remove the check for non-NULL core operations when
    initializing the subdev.

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

    Laurent Pinchart
     
  • Add enum_mbus_fsizes V4L2 subdevice video operation.

    Signed-off-by: Qing Xu
    Signed-off-by: Guennadi Liakhovetski
    Signed-off-by: Mauro Carvalho Chehab

    Qing Xu
     

19 Jan, 2011

2 commits

  • Some subdevs need to call into the board code after they are registered
    and have a valid struct v4l2_device pointer. The s_config op was abused
    for this, but now that it is removed we need a cleaner way of solving this.

    So this patch adds a struct with internal ops that the v4l2 core can call.

    Currently only two ops exist: register and unregister. Subdevs can implement
    these to call the board code and pass it the v4l2_device pointer, which the
    board code can then use to get access to the struct that embeds the
    v4l2_device.

    It is expected that in the future open and close ops will also be added.

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

    Hans Verkuil
     
  • The core.s_config op was meant for legacy drivers that needed to work with old
    pre-2.6.26 kernels. This is no longer relevant. Unfortunately, this op was
    incorrectly called from several drivers.

    Replace those occurences with proper i2c_board_info structs and call
    v4l2_i2c_new_subdev_board.

    After these changes v4l2_i2c_new_subdev_cfg() was no longer used, so remove
    that function as well.

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

    Hans Verkuil
     

21 Oct, 2010

2 commits


09 Aug, 2010

5 commits

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

    Andy Walls
     
  • The CX2584x and related cores are multifunction subdevices with a number
    of internal blocks that act as interrupt sources. Move the v4L2_subdev
    interrupt_service_routine callback from v4l_subdev_ir_ops to
    v4l2_subdev_core_ops, as the video and audio blocks of a CX2584x and
    related cores can generate interrupts along with the IR block. This
    change also makes sense for other subdev's that generate interrupts and
    do not have an IR block.

    Signed-off-by: Andy Walls
    Signed-off-by: Mauro Carvalho Chehab

    Andy Walls
     
  • There is a distinction on IR Tx for the CX2388[578] chips of carrier
    sense inversion (space is a carrier burst and mark is no burst) and I/O
    pin level inversion (0 is high output level, 1 is low output level).
    Allow the caller to set these parameters distinctly as v4l2_subdevice
    IR parameters. This permits the IR device to be configured and enabled
    without the IR Tx LED being on during idle/space time due to an external
    hardware level inversion

    Signed-off-by: Andy Walls
    Signed-off-by: Mauro Carvalho Chehab

    Andy Walls
     
  • Add a method to v4l2_sudev_core_ops to allow bridge drivers to
    manage what signal pads/functions are routed out to multiplexed IO pins on a
    pin by pin basis. The interface also allows specifying initial output settings
    for pins and disabling an IO pin altogether.

    Signed-off-by: Andy Walls
    Signed-off-by: Mauro Carvalho Chehab

    Andy Walls
     

01 Jun, 2010

1 commit

  • enum_mbus_fmt received an index argument that was defined as an int instead
    of an unsigned int. This is now fixed. This had the knock-on effect that the
    index argument in the callback get_formats in soc_camera.h also had to be
    changed to unsigned int.

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

    Hans Verkuil
     

19 May, 2010

3 commits


18 May, 2010

1 commit

  • Add support SPI bus to v4l2. Useful for control some device with SPI bus like
    hardware MPEG2 encoders and etc.

    Signed-off-by: Beholder Intl. Ltd. Dmitry Belimov
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Dmitri Belimov
     

27 Feb, 2010

1 commit

  • This change attempts to fix the ivtv tinny audio problem by keeping digitizer
    to encoder audio clocks running, while disabling the video clocks as needed to
    avoid unpredictable PCI bus hangs.

    To accomplish this, for the cx25840 module enabling of audio streaming had
    to be separated from enabling video streaming, requiring an additional
    v4l2_subdev_audio_op and calls to this new op in the pvrusb2 and ivtv drivers.

    The cx231xx and cx23885 driver use the cx25840 module for affecting only
    video on s_stream calls, so those drivers needed no change.

    The CX23418 hardware does not exhibit either the tinny audio problem nor the PCI
    bus hang, so the cx18 driver did not need corresponding changes.

    CX2341[56] based cards that are not using the CX2584x family of chips
    do not seem to be affected by the tinny audio problem, and this change should
    not affect how they are configured. It will delay their first capture by
    starting by another 300 msec though.

    Many thanks go to Argus and
    Martin Dauskardt whose persistent testing and
    investigation of this problem will hopefully fix this problem once and for all
    for many ivtv users.

    Reported-by: Martin Dauskardt
    Reported-by: Argus
    Signed-off-by: Andy Walls
    Signed-off-by: Mauro Carvalho Chehab

    Andy Walls
     

16 Dec, 2009

3 commits

  • Video subdevices, like cameras, decoders, connect to video bridges over
    specialised busses. Data is being transferred over these busses in various
    formats, which only loosely correspond to fourcc codes, describing how video
    data is stored in RAM. This is not a one-to-one correspondence, therefore we
    cannot use fourcc codes to configure subdevice output data formats. This patch
    adds codes for several such on-the-bus formats and an API, similar to the
    familiar .s_fmt(), .g_fmt(), .try_fmt(), .enum_fmt() API for configuring those
    codes. After all users of the old API in struct v4l2_subdev_video_ops are
    converted, it will be removed. Also add helper routines to support generic
    pass-through mode for the soc-camera framework.

    create mode 100644 drivers/media/video/soc_mediabus.c
    create mode 100644 include/media/soc_mediabus.h
    create mode 100644 include/media/v4l2-mediabus.h

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

    Guennadi Liakhovetski
     
  • Introduce new v4l2-subdev sensor operations, move .enum_framesizes() and
    .enum_frameintervals() methods to it, add a new .g_skip_top_lines() method
    and switch soc-camera to use it instead of .y_skip_top soc_camera_device
    member, which can now be removed.

    Signed-off-by: Guennadi Liakhovetski
    Reviewed-by: Hans Verkuil
    Reviewed-by: Sergio Aguirre
    Signed-off-by: Mauro Carvalho Chehab

    Guennadi Liakhovetski
     
  • This adds the above APIs to the v4l2 core. This is based on version v1.2
    of the RFC titled "V4L - Support for video timings at the input/output interface"
    Following new ioctls are added:-

    - VIDIOC_ENUM_DV_PRESETS
    - VIDIOC_S_DV_PRESET
    - VIDIOC_G_DV_PRESET
    - VIDIOC_QUERY_DV_PRESET
    - VIDIOC_S_DV_TIMINGS
    - VIDIOC_G_DV_TIMINGS

    Please refer to the RFC for the details. This code was tested using vpfe
    capture driver on TI's DM365. Following is the test configuration used :-

    Blu-Ray HD DVD source -> TVP7002 -> DM365 (VPFE) ->DDR

    A draft version of the TVP7002 driver (currently being reviewed in the mailing
    list) was used that supports V4L2_DV_1080I60 & V4L2_DV_720P60 presets.

    A loopback video capture application was used for testing these APIs. This calls
    following IOCTLS :-

    - verify the new v4l2_input capabilities flag added
    - Enumerate available presets using VIDIOC_ENUM_DV_PRESETS
    - Set one of the supported preset using VIDIOC_S_DV_PRESET
    - Get current preset using VIDIOC_G_DV_PRESET
    - Detect current preset using VIDIOC_QUERY_DV_PRESET
    - Using stub functions in tvp7002, verify VIDIOC_S_DV_TIMINGS
    and VIDIOC_G_DV_TIMINGS ioctls are received at the sub device.
    - Tested on 64bit platform by Hans Verkuil

    Signed-off-by: Muralidharan Karicheri
    Signed-off-by: Hans Verkuil
    Reviewed-by: Randy Dunlap
    Signed-off-by: Mauro Carvalho Chehab

    Muralidharan Karicheri