22 Jan, 2019

4 commits


21 Jan, 2019

2 commits

  • This driver got converted to not depend on soc_camera in commit
    6a26f141bf62 ("media: i2c: mt9t112: Remove soc_camera dependencies").

    There's no sense in keeping the old version there.

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

    Hans Verkuil
     
  • As the tw9910 subdevice is registered through the v4l2-async framework,
    use the v4l2-async provided function to register it.

    Fixes: 7b20f325a566 ("media: i2c: tw9910: Remove soc_camera dependencies")

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

    Jacopo Mondi
     

17 Jan, 2019

34 commits

  • This driver got converted to not depend on soc_camera on commit
    57b0ad9ebe60 ("media: soc_camera: ov9640: move ov9640 out of soc_camera").

    There's no sense on keeping the old version there.

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

    Mauro Carvalho Chehab
     
  • Also add an example pipeline for unconverted capture with interweave
    on SabreAuto.

    Cleanup some language in various places in the process.

    Signed-off-by: Steve Longerbeam
    Reviewed-by: Philipp Zabel
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Steve Longerbeam
     
  • Allow sequential->interlaced interweaving but with top/bottom
    lines swapped to the output buffer.

    This can be accomplished by adding one line length to IDMAC output
    channel address, with a negative line length for the interlace offset.

    This is to allow the seq-bt -> interlaced-bt transformation, where
    bottom lines are still dominant (older in time) but with top lines
    first in the interweaved output buffer.

    With this support, the CSI can now allow seq-bt at its source pads,
    e.g. the following transformations are allowed in CSI from sink to
    source:

    seq-tb -> seq-bt
    seq-bt -> seq-bt
    alternate -> seq-bt

    Suggested-by: Philipp Zabel
    Signed-off-by: Steve Longerbeam
    Reviewed-by: Philipp Zabel
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Steve Longerbeam
     
  • If caller passes un-initialized field type V4L2_FIELD_ANY to CSI
    sink pad, the reset CSI crop window would not be correct, because
    the crop window depends on a valid input field type. To fix move
    the reset of crop and compose windows to after the call to
    imx_media_fill_default_mbus_fields().

    Signed-off-by: Steve Longerbeam
    Reviewed-by: Philipp Zabel
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Steve Longerbeam
     
  • prepare_vdi_in_buffers() was setting up the dma pointers as if the
    VDIC is always programmed to receive the fields in bottom-top order,
    i.e. as if ipu_vdi_set_field_order() only programs BT order in the VDIC.
    But that's not true, ipu_vdi_set_field_order() is working correctly.

    So fix prepare_vdi_in_buffers() to give the VDIC the fields in whatever
    order they were received by the video source, and rely on the VDIC to
    sort out which is top and which is bottom.

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

    Steve Longerbeam
     
  • Skip writing U/V components to odd rows for YVU420 in addition to
    YUV420 and NV12.

    Signed-off-by: Steve Longerbeam
    Reviewed-by: Philipp Zabel
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Steve Longerbeam
     
  • If IDMAC interweaving is enabled in a write channel, the channel must
    write the odd chroma rows for 4:2:0 formats. Skipping writing the odd
    chroma rows produces corrupted captured 4:2:0 images when interweave
    is enabled.

    Reported-by: Krzysztof Ha?asa
    Signed-off-by: Steve Longerbeam
    Reviewed-by: Philipp Zabel
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Steve Longerbeam
     
  • If the incoming sink field type is alternate, the reset crop height
    and crop height bounds must be set to twice the incoming height,
    because in alternate field mode, upstream will report only the
    lines for a single field, and the CSI captures the whole frame.

    Signed-off-by: Steve Longerbeam
    Reviewed-by: Philipp Zabel
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Steve Longerbeam
     
  • IDMAC interlaced scan, a.k.a. interweave, should be enabled in the
    IDMAC output channels only if the IDMAC output pad field type is
    'seq-bt' or 'seq-tb', and field type at the capture interface is
    'interlaced*'.

    V4L2_FIELD_HAS_BOTH() macro should not be used on the input to determine
    enabling interlaced/interweave scan. That macro includes the 'interlaced'
    field types, and in those cases the data is already interweaved with
    top/bottom field lines.

    The CSI will capture whole frames when the source specifies alternate
    field mode. So the CSI also enables interweave for alternate input
    field type and the field type at capture interface is interlaced.

    Fix the logic for setting field type in try_fmt in CSI entity.
    The behavior should be:

    - No restrictions on field type at sink pad.

    - At the output pads, allow sequential fields in TB order, if the sink pad
    field type is sequential or alternate. Otherwise passthrough the field
    type from sink to source pad.

    Move this logic to new function csi_try_field().

    These changes result in the following allowed field transformations
    from CSI sink -> source pads (all other field types at sink are passed
    through to source):

    seq-tb -> seq-tb
    seq-bt -> seq-tb
    alternate -> seq-tb

    In a future patch, the CSI sink -> source will allow:

    seq-tb -> seq-bt
    seq-bt -> seq-bt
    alternate -> seq-bt

    This will require supporting interweave with top/bottom line swapping.
    Until then seq-bt is not allowed at the CSI source pad because there is
    no way to swap top/bottom lines when interweaving to INTERLACED_BT --
    note that despite the name, INTERLACED_BT is top-bottom order in memory.
    The BT in this case refers to field dominance: the bottom lines are
    older in time than the top lines.

    The capture interface device allows selecting IDMAC interweave by
    choosing INTERLACED_TB if the CSI/PRPENCVF source pad is seq-tb and
    INTERLACED_BT if the source pad is seq-bt (for future support of seq-bt).

    Signed-off-by: Steve Longerbeam
    Reviewed-by: Philipp Zabel
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Steve Longerbeam
     
  • To support interlaced scan with planar formats, cpmem SLUV must
    be programmed with the correct chroma line stride. For full and
    partial planar 4:2:2 (YUV422P, NV16), chroma line stride must
    be doubled. For full and partial planar 4:2:0 (YUV420, YVU420, NV12),
    chroma line stride must _not_ be doubled, since a single chroma line
    is shared by two luma lines.

    Signed-off-by: Steve Longerbeam
    Reviewed-by: Philipp Zabel
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Steve Longerbeam
     
  • The function ipu_csi_init_interface() was inverting the F-bit for
    NTSC case, in the CCIR_CODE_1/2 registers. The result being that
    for NTSC bottom-top field order, the CSI would swap fields and
    capture in top-bottom order.

    Instead, base field swap on the field order of the input to the CSI,
    and the field order of the requested output. If the input/output
    fields are sequential but different, swap fields, otherwise do
    not swap. This requires passing both the input and output mbus
    frame formats to ipu_csi_init_interface().

    Move this code to a new private function ipu_csi_set_bt_interlaced_codes()
    that programs the CCIR_CODE_1/2 registers for interlaced BT.656 (and
    possibly interlaced BT.1120 in the future).

    When detecting input video standard from the input frame width/height,
    make sure to double height if input field type is alternate, since
    in that case input height only includes lines for one field.

    Signed-off-by: Steve Longerbeam
    Reviewed-by: Philipp Zabel
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Steve Longerbeam
     
  • Adds two helper macros:

    V4L2_FIELD_IS_SEQUENTIAL: returns true if the given field type is
    'sequential', that is a full frame is transmitted, or exists in
    memory, as all top field lines followed by all bottom field lines,
    or vice-versa.

    V4L2_FIELD_IS_INTERLACED: returns true if the given field type is
    'interlaced', that is a full frame is transmitted, or exists in
    memory, as top field lines interlaced with bottom field lines.

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

    Steve Longerbeam
     
  • There is a block of code in rvin_group_link_notify() that prevents
    enabling a link to a VIN node if any entity in the media graph is
    in use. This prevents enabling a VIN link even if there is an in-use
    entity somewhere in the graph that is independent of the link's
    pipeline.

    For example, the code block will prevent enabling a link from
    the first rcar-csi2 receiver to a VIN node even if there is an
    enabled link somewhere far upstream on the second independent
    rcar-csi2 receiver pipeline.

    If this code block is meant to prevent modifying a link if any entity
    in the graph is actively involved in streaming (because modifying
    the CHSEL register fields can disrupt any/all running streams), then
    the entities stream counts should be checked rather than the use counts.

    (There is already such a check in __media_entity_setup_link() that verifies
    the stream_count of the link's source and sink entities are both zero,
    but that is insufficient, since there should be no running streams in
    the entire graph).

    Modify the code block to check the entity stream_count instead of the
    use_count (and elaborate on the comment). VIN node links can now be
    enabled even if there are other independent in-use entities that are
    not streaming.

    Fixes: c0cc5aef31 ("media: rcar-vin: add link notify for Gen3")

    Signed-off-by: Steve Longerbeam
    Reviewed-by: Niklas Söderlund
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Steve Longerbeam
     
  • Allow to set a fixed quantization parameter offset between luma and
    chroma in the h.264 encoder.

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

    Philipp Zabel
     
  • Allow to enable constrained intra prediction in the h.264 encoder.

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

    Philipp Zabel
     
  • Allow to add fixed quantization parameter offset between luma and
    chroma quantization parameters. This control directly corresponds
    to the chroma_qp_index_offset field of the h.264 picture parameter
    set.

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

    Philipp Zabel
     
  • Allow to enable h.264 constrained intra prediction (macroblocks using
    intra prediction modes are not allowed to use residual data and decoded
    samples of neighboring macroblocks coded using inter prediction modes).
    This control directly corresponds to the constrained_intra_pred_flag
    field in the h.264 picture parameter set.

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

    Philipp Zabel
     
  • The COM3 register at address 0x0c already defaults to 0x10, the two bits
    COM3[7:6] are set according to V4L2 controls by sethvflip later.
    There is no need to set it multiple times during bridge initialization.

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

    Philipp Zabel
     
  • This register is later overwritten by set_frame_rate anyway.

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

    Philipp Zabel
     
  • The video format, payload size, and frame size setup is video format
    and frame size specific. Those registers are overwritten during
    bridge_start anyway.

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

    Philipp Zabel
     
  • Add support to pass through the sensor's native SGBRG8 bayer pattern,
    allowing to cut the required USB bandwidth in half.

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

    Philipp Zabel
     
  • In preparation for adding SGBRG8 as a second video format besides YUYV,
    move video format specific register settings from the bridge_init array
    into the bridge_start arrays.

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

    Philipp Zabel
     
  • If a driver supports multiple pixel formats with the same frame size,
    TRY_FMT will currently always return the first pixel format.
    Fix this by adding pixelformat support to wxh_to_nearest_mode().

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

    Philipp Zabel
     
  • If a driver supports multiple pixel formats with the same frame size,
    ENUM_FRAMEINTERVALS will currently only work for the first pixel format.
    Fix this by adding pixelformat support to wxh_to_mode().

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

    Philipp Zabel
     
  • For short waits, usleep_range should be used instead of msleep,
    see Documentation/timers/timers-howto.txt.

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

    Philipp Zabel
     
  • The buffer arguments to v4l2_m2m_buf_copy_data args were swapped.

    The reason is confusing naming conventions in vim2m. It certainly
    could be improved.

    Fixes: 7aca565ee3d0 ("media: vim2m: use v4l2_m2m_buf_copy_data")

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

    Hans Verkuil
     
  • v4l2_compliance gave a warning for the S_PARM test for output streams:

    warn: v4l2-test-formats.cpp(1235): S_PARM is supported for buftype 2, but not for ENUM_FRAMEINTERVALS

    The reason is that vivid mapped s_parm for output streams to g_parm. But if
    S_PARM doesn't actually change anything, then it shouldn't be enabled at all.

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

    Hans Verkuil
     
  • The video output sizeimage calculation did not take data_offset into account.

    This can cause problems with video loopback or exporting output buffers for
    use as dmabuf import buffers since the output buffer size is now too small.

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

    Hans Verkuil
     
  • V4L2_BUF_TYPE_META_OUTPUT was added by commit 72148d1a57e7
    ("media: v4l: Add support for V4L2_BUF_TYPE_META_OUTPUT") but the patch
    missed adding the type to the macro telling whether a given type is an
    output type or not. Do that now. Getting this wrong leads to handling the
    buffer as a capture buffer in a lot of places.

    Fixes: 72148d1a57e7 ("media: v4l: Add support for V4L2_BUF_TYPE_META_OUTPUT")

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

    Sakari Ailus
     
  • It makes no sense to support the USERPTR memory model if the vivid instance was
    configured as dma_contig. Disable it if this is the case.

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

    Hans Verkuil
     
  • Jian Xu has left the company. Remove his e-mail address that no longer
    works.

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

    Sakari Ailus
     
  • Remove Jian Xu from the driver's reviewers.

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

    Sakari Ailus
     
  • The CSI controller found on the H3 (and H5) is a reduced version of the
    one found on the A31. It only has 1 channel, instead of 4 channels for
    time-multiplexed BT.656. Since the H3 is a reduced version, it cannot
    "fallback" to a compatible that implements more features than it
    supports.

    Add a compatible string entry for the H3.

    Signed-off-by: Chen-Yu Tsai
    Reviewed-by: Jagan Teki
    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Chen-Yu Tsai
     
  • The CSI controller found on the H3 (and H5) is a reduced version of the
    one found on the A31. It only has 1 channel, instead of 4 channels for
    time-multiplexed BT.656. Since the H3 is a reduced version, it cannot
    "fallback" to a compatible that implements more features than it
    supports.

    Split out the H3 compatible as a separate entry, with no fallback.

    Fixes: b7eadaa3a02a ("media: dt-bindings: media: sun6i: Add A31 and H3 compatibles")

    Signed-off-by: Chen-Yu Tsai
    Reviewed-by: Jagan Teki
    Reviewed-by: Rob Herring
    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Chen-Yu Tsai