19 Feb, 2019

32 commits

  • If a stream is stopped, or if a USERPTR/DMABUF buffer is queued
    backed by a different user address or dmabuf fd, then the timestamp
    should be skipped by vb2_find_timestamp since the memory it refers
    to is no longer valid.

    So keep track of a 'copied_timestamp' state: it is set when the
    timestamp is copied from an output to a capture buffer, and is
    cleared when it is no longer valid.

    Signed-off-by: Hans Verkuil
    Reviewed-by: Paul Kocialkowski
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     
  • The bool type is not recommended for use in structs, so replace these
    by bitfields.

    Signed-off-by: Hans Verkuil
    Reviewed-by: Paul Kocialkowski
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     
  • Buffers generated with YUV32 format seems to be incorrect, hence use
    VUYA32 instead.

    Changes from v1:
    Add both formats VUYA32 and VUYX32 but associate only VUYX32 to the
    output queue as the alpha channel of buffers is ignored on this queue.

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

    Vivek Kasireddy
     
  • Enable vivid to make use of the following formats:
    V4L2_PIX_FMT_AYUV32
    V4L2_PIX_FMT_XYUV32
    V4L2_PIX_FMT_VUYA32
    V4L2_PIX_FMT_VUYX32

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

    Vivek Kasireddy
     
  • Add support for the following formats to tpg:
    V4L2_PIX_FMT_AYUV32
    V4L2_PIX_FMT_XYUV32
    V4L2_PIX_FMT_VUYA32
    V4L2_PIX_FMT_VUYX32

    Changes from v1:
    Remove the duplicate case value

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

    Vivek Kasireddy
     
  • The formats added in this patch include:
    V4L2_PIX_FMT_AYUV32
    V4L2_PIX_FMT_XYUV32
    V4L2_PIX_FMT_VUYA32
    V4L2_PIX_FMT_VUYX32

    These formats enable the trasmission of alpha channel data to other
    drivers and userspace applications in addition to YUV data. For
    example, buffers generated by drivers in one of these formats
    can be used by the Weston compositor to display as a texture or
    flipped directly onto the overlay planes with the help of a DRM
    driver.

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

    Vivek Kasireddy
     
  • Without this, we get failures like this when the kernel attempts to
    initialize a cx231xx device:

    [16046.153653] cx231xx 3-1.2:1.1: New device Hauppauge Hauppauge Device @ 480 Mbps (2040:c200) with 6 interfaces
    [16046.153900] cx231xx 3-1.2:1.1: can't change interface 3 alt no. to 3: Max. Pkt size = 0
    [16046.153907] cx231xx 3-1.2:1.1: Identified as Hauppauge USB Live 2 (card=9)
    [16046.154350] i2c i2c-11: Added multiplexed i2c bus 13
    [16046.154379] i2c i2c-11: Added multiplexed i2c bus 14
    [16046.267194] cx25840 10-0044: cx23102 A/V decoder found @ 0x88 (cx231xx #0-0)
    [16048.424551] cx25840 10-0044: loaded v4l-cx231xx-avcore-01.fw firmware (16382 bytes)
    [16048.463224] cx231xx 3-1.2:1.1: v4l2 driver version 0.0.3
    [16048.567878] cx231xx 3-1.2:1.1: Registered video device video2 [v4l2]
    [16048.568001] cx231xx 3-1.2:1.1: Registered VBI device vbi0
    [16048.568419] cx231xx 3-1.2:1.1: audio EndPoint Addr 0x83, Alternate settings: 3
    [16048.568425] cx231xx 3-1.2:1.1: video EndPoint Addr 0x84, Alternate settings: 5
    [16048.568431] cx231xx 3-1.2:1.1: VBI EndPoint Addr 0x85, Alternate settings: 2
    [16048.568436] cx231xx 3-1.2:1.1: sliced CC EndPoint Addr 0x86, Alternate settings: 2
    [16048.568448] usb 3-1.2: couldn't get decoder output pad for V4L I/O
    [16048.568453] cx231xx 3-1.2:1.1: V4L2 device vbi0 deregistered
    [16048.568579] cx231xx 3-1.2:1.1: V4L2 device video2 deregistered
    [16048.569001] cx231xx: probe of 3-1.2:1.1 failed with error -22

    Likely a regession since Commit 9d6d20e652c0
    ("media: v4l2-mc: switch it to use the new approach to setup pipelines")
    (v4.19-rc1-100-g9d6d20e652c0), which introduced the use of
    PAD_SIGNAL_DV within v4l2_mc_create_media_graph().

    This also modifies cx25840 to remove the VBI pad, matching the action
    taken in Commit 092a37875a22 ("media: v4l2: remove VBI output pad").

    Fixes: 9d6d20e652c0 ("media: v4l2-mc: switch it to use the new approach to setup pipelines")

    Cc: stable@vger.kernel.org
    Signed-off-by: Cody P Schafer
    Tested-by: Hans Verkuil
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Cody P Schafer
     
  • There is a spelling mistake in a fmdbg debug message. Fix it.

    Signed-off-by: Colin Ian King
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Colin Ian King
     
  • media_device_cleanup() wasn't called, which caused a small
    memory leak.

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

    Hans Verkuil
     
  • When the media device registration fails, don't call media_device_unregister
    since the device was never actually registered.

    When removing the module also call media_device_cleanup() to avoid a memory leak.

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

    Hans Verkuil
     
  • This patch makes the SoC camera framework as well as effectively the few
    remaining sensor drivers depend on BROKEN, rendering it uncompileable
    without changes in Kconfig.

    The purpose is to leave the code around if someone wishes to convert the
    drivers to the modern day V4L2 sub-device framework without having to go
    to see development history in git.

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

    Sakari Ailus
     
  • Move the mt9t031 driver to the soc_camera directory in the media staging
    tree.

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

    Sakari Ailus
     
  • Move the imx074 driver to the soc_camera directory in the media staging
    tree.

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

    Sakari Ailus
     
  • The SoC camera framework has no functional drivers left, something that
    has not changed for years. Move the leftovers to the staging tree.

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

    Sakari Ailus
     
  • There is a V4L2 sub-device sensor driver for the rj45n1.
    As there is already another driver, remove the SoC camera one.

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

    Sakari Ailus
     
  • There is a V4L2 sub-device sensor driver for the mt9m001.
    There is already a non-soc_camera driver. So, remove the SoC camera
    one.

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

    Sakari Ailus
     
  • This addresses the below TODO item, no function related changes:

    - Prefix imgu for all public APIs, i.e. change ipu3_v4l2_register() to
    imgu_v4l2_register(). (Sakari)

    The changes were obtained by applying the following perl script
    to driver code under drivers/staging/media/ipu3/.

    perl -pi.back -e 's/ipu3_(?!uapi)/imgu_/g;'

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

    Yong Zhi
     
  • According to the ov5640 specification (2.7 power up sequence), host can
    access the sensor's registers 20ms after reset. Trying to access them
    before leads to undefined behavior and result in sporadic initialization
    errors.

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

    Loic Poulain
     
  • The ov5640_try_frame_interval operation updates the FPS as per user
    input based on default ov5640_frame_rate, OV5640_30_FPS which is failed
    to update when user trigger 15fps.

    So, initialize the default ov5640_frame_rate to OV5640_15_FPS so-that
    it can satisfy to update all fps.

    Fixes: 5a3ad937bc78 ("media: ov5640: Make the return rate type more explicit")

    Signed-off-by: Jagan Teki
    Acked-by: Jacopo Mondi
    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Jagan Teki
     
  • The register value lists for all the supported resolution settings all
    include a register address/value pair for setting the JPEG compression
    mode. With the exception of 1080p (which sets mode 2), all resolutions
    use mode 3.

    The only difference between mode 2 and mode 3 is that mode 2 may have
    padding data on the last line, while mode 3 does not add padding data.

    As these register values were from dumps of running systems, and the
    difference between the modes is quite small, using mode 3 for all
    configurations should be OK.

    [Sakari Ailus: Align OV5640_REG_JPG_MODE_SELECT register naming.]

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

    Chen-Yu Tsai
     
  • When compression is turned on, the on-bus data is framed according to
    the compression mode, and the height and width set in VFIFO_VSIZE and
    VFIFO_HSIZE. If these are not updated correctly, the sensor will send
    data framed in a manner unexpected by the capture interface, such as
    having more bytes per line than expected, and having the extra data
    dropped. This ultimately results in corrupted data.

    Set the two values when the media bus is configured for JPEG data,
    meaning the sensor would be in JPEG mode.

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

    Chen-Yu Tsai
     
  • The OV5640 driver currently supports a static color bar pattern with a
    small vertical gamma gradient. The hardware also supports a color square
    pattern, as well as having a rolling bar for dynamic sequences.

    Add three more test patterns:

    - color bars with a rolling bar (but without the gamma gradient)
    - static color squares
    - color squares with a rolling bar

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

    Chen-Yu Tsai
     
  • The transparent feature for test patterns blends the test pattern with
    an actual captured image. This makes the result non-static, subject to
    changes in the sensor's field of view.

    Test patterns should be predictable and deterministic, even if they are
    dynamic patterns. Disable the transparent feature of the test pattern.

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

    Chen-Yu Tsai
     
  • The OV5640 can generate many types of test patterns, some with
    additional modifiers, such as a rolling bar, or gamma gradients.

    Add the bit definitions for all bits in the test pattern register,
    and use them to compose the values to be written to the register.

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

    Chen-Yu Tsai
     
  • The OV5640 has many options for generating test patterns. Unfortunately
    there is only one V4L2 control for it. Thus the driver would need to
    list some or all combinations.

    Move the test_pattern_menu list before the ov5640_set_ctrl_test_pattern
    function that programs the hardware. This would allow us to add a
    matching list of values to program into the hardware, while keeping the
    two lists together for ease of maintenance.

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

    Chen-Yu Tsai
     
  • The ADV748X_PAGE_WAIT is a fake page to insert arbitrary delays in the
    register tables.

    Its only usage was removed, so we can remove the handling and simplify
    the code.

    Reviewed-by: Laurent Pinchart
    Reviewed-by: Niklas Söderlund
    Signed-off-by: Kieran Bingham
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Kieran Bingham
     
  • The ADV748x is currently reset by writting a small table of registers to
    the device.

    The table lacks documentation and contains magic values to perform the
    actions, including using a fake register address to introduce a delay
    loop.

    Remove the table, and convert to code, documenting the purpose of the
    specific writes along the way.

    Signed-off-by: Kieran Bingham
    Reviewed-by: Laurent Pinchart
    Reviewed-by: Niklas Söderlund
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Kieran Bingham
     
  • When the adv748x driver is informed about a link being created from HDMI or
    AFE to a CSI-2 TX output, the 'link_setup()' callback is invoked. Make
    sure to implement proper routing management at link setup time, to route
    the selected video stream to the desired TX output.

    Signed-off-by: Jacopo Mondi
    Reviewed-by: Kieran Bingham
    Reviewed-by: Niklas Söderlund
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Jacopo Mondi
     
  • Both the AFE and HDMI s_stream routines (adv748x_afe_s_stream() and
    adv748x_hdmi_s_stream()) have to enable the CSI-2 TX they are streaming video
    data to.

    With the introduction of dynamic routing between HDMI and AFE entities to
    TXA, the video stream sink needs to be set at run time, and not statically
    selected as the s_stream functions are currently doing.

    To fix this, store a reference to the active CSI-2 TX sink for both HDMI and
    AFE sources, and operate on it when starting/stopping the stream.

    Reviewed-by: Kieran Bingham
    Reviewed-by: Laurent Pinchart
    Signed-off-by: Jacopo Mondi
    Reviewed-by: Niklas Söderlund
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Jacopo Mondi
     
  • The power_up_tx() procedure needs to set a few registers conditionally to
    the selected video source, but it currently checks for the provided tx to
    be either TXA or TXB.

    With the introduction of dynamic routing between HDMI and AFE entities to
    TXA, checking which TX the function is operating on is not meaningful anymore.

    To fix this, store the subdevice of the source providing video data to the
    CSI-2 TX in the 'struct adv748x_csi2' representing the TX and check on it.

    Reviewed-by: Kieran Bingham
    Reviewed-by: Laurent Pinchart
    Signed-off-by: Jacopo Mondi
    Reviewed-by: Niklas Söderlund
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Jacopo Mondi
     
  • The ADV748x chip supports routing AFE output to either TXA or TXB.
    In order to support run-time configuration of video stream path, create an
    additional (not enabled) "AFE:8->TXA:0" link, and remove the IMMUTABLE flag
    from existing ones.

    Reviewed-by: Kieran Bingham
    Signed-off-by: Jacopo Mondi
    Reviewed-by: Niklas Söderlund
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Jacopo Mondi
     
  • Rename the chip reset procedure as they configure the CP (HDMI) and SD
    (AFE) cores.

    Reviewed-by: Kieran Bingham
    Reviewed-by: Laurent Pinchart
    Signed-off-by: Jacopo Mondi
    Reviewed-by: Niklas Söderlund
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Jacopo Mondi
     

18 Feb, 2019

8 commits

  • Add small is_txb() macro to the existing is_txa() and use it where
    appropriate.

    Reviewed-by: Kieran Bingham
    Reviewed-by: Laurent Pinchart
    Signed-off-by: Jacopo Mondi
    Reviewed-by: Niklas Söderlund
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Jacopo Mondi
     
  • The sd argument of this macro can be a more complex expression. Since it
    is used 5 times in the macro it can be evaluated that many times as well.

    So assign it to a temp variable in the beginning and use that instead.

    This also avoids any potential side-effects of evaluating sd.

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

    Hans Verkuil
     
  • Remove unused but set variables to clean up the code and avoid
    warning.

    Signed-off-by: Lucas A. M. Magalhães
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Lucas A. M. Magalhães
     
  • The capture compose rectangle was not getting updated when setting
    the source subdevice's source pad format. This causes the compose window
    to be zero (or not updated) at stream start unless the capture device
    format was set explicitly at the capture device node.

    Fix by moving the calculation of the capture compose rectangle to
    imx_media_mbus_fmt_to_pix_fmt(), and pass the rectangle to
    imx_media_capture_device_set_format().

    Fixes: 439d8186fb23 ("media: imx: add capture compose rectangle")

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

    Steve Longerbeam
     
  • Add VB2_USERPTR to the vimc capture device.

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

    Hans Verkuil
     
  • A merge conflict rised when merging from -rc7. Fix it.

    In this specific case, we don't need the if anymore, as the
    work_run was moved to its rightful place (struct vim2m_ctx).

    Fixes: b3e64e5b0778 ("media: vim2m: use per-file handler work queue")
    Fixes: 240809ef6630 ("media: vim2m: only cancel work if it is for right context")
    Reviewed-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • The linked commit changed s_fmt/try_fmt to fail if num_planes is bogus.
    This, however, is against the spec, which mandates drivers
    to return a proper num_planes value, without an error.

    Replace the num_planes check and instead clamp it to a sane value,
    so we still make sure we don't overflow the planes array by accident.

    Fixes: 9048b2e15b11c5 ("media: v4l: ioctl: Validate num_planes before using it")

    Signed-off-by: Ezequiel Garcia
    Reviewed-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Ezequiel Garcia
     
  • Linux 5.0-rc7

    * tag 'v5.0-rc7': (1667 commits)
    Linux 5.0-rc7
    Input: elan_i2c - add ACPI ID for touchpad in Lenovo V330-15ISK
    Input: st-keyscan - fix potential zalloc NULL dereference
    Input: apanel - switch to using brightness_set_blocking()
    powerpc/64s: Fix possible corruption on big endian due to pgd/pud_present()
    efi/arm: Revert "Defer persistent reservations until after paging_init()"
    arm64, mm, efi: Account for GICv3 LPI tables in static memblock reserve table
    sunrpc: fix 4 more call sites that were using stack memory with a scatterlist
    include/linux/module.h: copy __init/__exit attrs to init/cleanup_module
    Compiler Attributes: add support for __copy (gcc >= 9)
    lib/crc32.c: mark crc32_le_base/__crc32c_le_base aliases as __pure
    auxdisplay: ht16k33: fix potential user-after-free on module unload
    x86/platform/UV: Use efi_runtime_lock to serialise BIOS calls
    i2c: bcm2835: Clear current buffer pointers and counts after a transfer
    i2c: cadence: Fix the hold bit setting
    drm: Use array_size() when creating lease
    dm thin: fix bug where bio that overwrites thin block ignores FUA
    Revert "exec: load_script: don't blindly truncate shebang string"
    Revert "gfs2: read journal in large chunks to locate the head"
    net: ethernet: freescale: set FEC ethtool regs version
    ...

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab