19 Feb, 2019

40 commits

  • media: add support for RCMM infrared remote controls.

    Signed-off-by: Patrick Lerda
    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Patrick Lerda
     
  • The runtime PM of this device is enabled after v4l2_ctrl_handler_setup(),
    and this makes this device's runtime PM usage count a negative value.

    The ov7740_set_ctrl() tries to do something only if the device's runtime
    PM usage counter is nonzero.

    ov7740_set_ctrl()
    {
    if (!pm_runtime_get_if_in_use(&client->dev))
    return 0;

    ;

    pm_runtime_put(&client->dev);

    return ret;
    }

    However, the ov7740_set_ctrl() is called by v4l2_ctrl_handler_setup()
    while the runtime PM of this device is not yet enabled. In this case,
    the pm_runtime_get_if_in_use() returns -EINVAL (!= 0).

    Therefore we can't bail out of this function and the usage count is
    decreased by pm_runtime_put() without increment.

    This fixes this problem by enabling the runtime PM of this device before
    v4l2_ctrl_handler_setup() so that the ov7740_set_ctrl() is always called
    when the runtime PM is enabled.

    Cc: Wenyou Yang
    Signed-off-by: Akinobu Mita
    Tested-by: Eugen Hristev
    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Akinobu Mita
     
  • Add a flag 'FWHT_FL_I_FRAME' that indicates that
    this is an I-frame. This requires incrementing
    to version 3

    This flag is needed for the upcoming stateless FWHT
    decoder since it has to know if an encoded frame is
    an I or a P frame.

    Signed-off-by: Dafna Hirschfeld
    [hverkuil-cisco@xs4all.nl: added the last paragraph of the commit msg]
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Dafna Hirschfeld
     
  • Since there's a v4l2_m2m_get_vq helper, use it instead of accessing the
    queue directly, which slightly increases readability.

    Also reformat the code using the queue a bit while at it.

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

    Paul Kocialkowski
     
  • Check that our queues are not busy before setting the format or return
    EBUSY if that's the case. This ensures that our format can't change
    once buffers are allocated for the queue.

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

    Paul Kocialkowski
     
  • The check to see if type is V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE is redundant
    as this has been already checked at the start of the function and if
    it's not that value then -ENOSYS is returned. Hence the sprintf can be
    replaced by a simpler string copy.

    Detected by CoverityScan, CID#1309450 ("Logically dead code")

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

    Colin Ian King
     
  • This commit changes the return type of mem2mem buffer handling API.
    Namely, these functions:

    v4l2_m2m_next_buf
    v4l2_m2m_last_buf
    v4l2_m2m_buf_remove
    v4l2_m2m_next_src_buf
    v4l2_m2m_next_dst_buf
    v4l2_m2m_last_src_buf
    v4l2_m2m_last_dst_buf
    v4l2_m2m_src_buf_remove
    v4l2_m2m_dst_buf_remove

    which currently return void pointer.

    In every case, the actual return type is a struct vb2_v4l2_buffer
    pointer. Change the return type of the listed functions,
    so type checking can be properly used.

    Signed-off-by: Ezequiel Garcia
    Signed-off-by: Hans Verkuil
    [hverkuil-cisco@xs4all.nl: clean up line-too-long checkpatch warnings]
    Signed-off-by: Mauro Carvalho Chehab

    Ezequiel Garcia
     
  • Fix the assigned type of mem2mem buffer handling API.
    Namely, these functions:

    v4l2_m2m_next_buf
    v4l2_m2m_last_buf
    v4l2_m2m_buf_remove
    v4l2_m2m_next_src_buf
    v4l2_m2m_next_dst_buf
    v4l2_m2m_last_src_buf
    v4l2_m2m_last_dst_buf
    v4l2_m2m_src_buf_remove
    v4l2_m2m_dst_buf_remove

    return a struct vb2_v4l2_buffer, and not a struct vb2_buffer.

    Fixing this is necessary to fix the mem2mem buffer handling API,
    changing the return to the correct struct vb2_v4l2_buffer instead
    of a void pointer.

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

    Ezequiel Garcia
     
  • Fix the assigned type of mem2mem buffer handling API.
    Namely, these functions:

    v4l2_m2m_next_buf
    v4l2_m2m_last_buf
    v4l2_m2m_buf_remove
    v4l2_m2m_next_src_buf
    v4l2_m2m_next_dst_buf
    v4l2_m2m_last_src_buf
    v4l2_m2m_last_dst_buf
    v4l2_m2m_src_buf_remove
    v4l2_m2m_dst_buf_remove

    return a struct vb2_v4l2_buffer, and not a struct vb2_buffer.

    Fixing this is necessary to fix the mem2mem buffer handling API,
    changing the return to the correct struct vb2_v4l2_buffer instead
    of a void pointer.

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

    Ezequiel Garcia
     
  • Fix the assigned type of mem2mem buffer handling API.
    Namely, these functions:

    v4l2_m2m_next_buf
    v4l2_m2m_last_buf
    v4l2_m2m_buf_remove
    v4l2_m2m_next_src_buf
    v4l2_m2m_next_dst_buf
    v4l2_m2m_last_src_buf
    v4l2_m2m_last_dst_buf
    v4l2_m2m_src_buf_remove
    v4l2_m2m_dst_buf_remove

    return a struct vb2_v4l2_buffer, and not a struct vb2_buffer.

    Fixing this is necessary to fix the mem2mem buffer handling API,
    changing the return to the correct struct vb2_v4l2_buffer instead
    of a void pointer.

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

    Ezequiel Garcia
     
  • Fix the assigned type of mem2mem buffer handling API.
    Namely, these functions:

    v4l2_m2m_next_buf
    v4l2_m2m_last_buf
    v4l2_m2m_buf_remove
    v4l2_m2m_next_src_buf
    v4l2_m2m_next_dst_buf
    v4l2_m2m_last_src_buf
    v4l2_m2m_last_dst_buf
    v4l2_m2m_src_buf_remove
    v4l2_m2m_dst_buf_remove

    return a struct vb2_v4l2_buffer, and not a struct vb2_buffer.

    Fixing this is necessary to fix the mem2mem buffer handling API,
    changing the return to the correct struct vb2_v4l2_buffer instead
    of a void pointer.

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

    Ezequiel Garcia
     
  • Fix the assigned type of mem2mem buffer handling API.
    Namely, these functions:

    v4l2_m2m_next_buf
    v4l2_m2m_last_buf
    v4l2_m2m_buf_remove
    v4l2_m2m_next_src_buf
    v4l2_m2m_next_dst_buf
    v4l2_m2m_last_src_buf
    v4l2_m2m_last_dst_buf
    v4l2_m2m_src_buf_remove
    v4l2_m2m_dst_buf_remove

    return a struct vb2_v4l2_buffer, and not a struct vb2_buffer.

    Fixing this is necessary to fix the mem2mem buffer handling API,
    changing the return to the correct struct vb2_v4l2_buffer instead
    of a void pointer.

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

    Ezequiel Garcia
     
  • Fix the assigned type of mem2mem buffer handling API.
    Namely, these functions:

    v4l2_m2m_next_buf
    v4l2_m2m_last_buf
    v4l2_m2m_buf_remove
    v4l2_m2m_next_src_buf
    v4l2_m2m_next_dst_buf
    v4l2_m2m_last_src_buf
    v4l2_m2m_last_dst_buf
    v4l2_m2m_src_buf_remove
    v4l2_m2m_dst_buf_remove

    return a struct vb2_v4l2_buffer, and not a struct vb2_buffer.

    Fixing this is necessary to fix the mem2mem buffer handling API,
    changing the return to the correct struct vb2_v4l2_buffer instead
    of a void pointer.

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

    Ezequiel Garcia
     
  • Fix the assigned type of mem2mem buffer handling API.
    Namely, these functions:

    v4l2_m2m_next_buf
    v4l2_m2m_last_buf
    v4l2_m2m_buf_remove
    v4l2_m2m_next_src_buf
    v4l2_m2m_next_dst_buf
    v4l2_m2m_last_src_buf
    v4l2_m2m_last_dst_buf
    v4l2_m2m_src_buf_remove
    v4l2_m2m_dst_buf_remove

    return a struct vb2_v4l2_buffer, and not a struct vb2_buffer.

    Fixing this is necessary to fix the mem2mem buffer handling API,
    changing the return to the correct struct vb2_v4l2_buffer instead
    of a void pointer.

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

    Ezequiel Garcia
     
  • Fix the assigned type of mem2mem buffer handling API.
    Namely, these functions:

    v4l2_m2m_next_buf
    v4l2_m2m_last_buf
    v4l2_m2m_buf_remove
    v4l2_m2m_next_src_buf
    v4l2_m2m_next_dst_buf
    v4l2_m2m_last_src_buf
    v4l2_m2m_last_dst_buf
    v4l2_m2m_src_buf_remove
    v4l2_m2m_dst_buf_remove

    return a struct vb2_v4l2_buffer, and not a struct vb2_buffer.

    Fixing this is necessary to fix the mem2mem buffer handling API,
    changing the return to the correct struct vb2_v4l2_buffer instead
    of a void pointer.

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

    Ezequiel Garcia
     
  • Fix the assigned type of mem2mem buffer handling API.
    Namely, these functions:

    v4l2_m2m_next_buf
    v4l2_m2m_last_buf
    v4l2_m2m_buf_remove
    v4l2_m2m_next_src_buf
    v4l2_m2m_next_dst_buf
    v4l2_m2m_last_src_buf
    v4l2_m2m_last_dst_buf
    v4l2_m2m_src_buf_remove
    v4l2_m2m_dst_buf_remove

    return a struct vb2_v4l2_buffer, and not a struct vb2_buffer.

    Fixing this is necessary to fix the mem2mem buffer handling API,
    changing the return to the correct struct vb2_v4l2_buffer instead
    of a void pointer.

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

    Ezequiel Garcia
     
  • Since the removal of the stale soc_camera headers, Migo-R board fails to
    build due to missing dma-mapping include directive.

    Include missing dma-mapping.h header in Migo-R board file to fix the build
    error.

    Fixes: a50c7738e8ae ("media: sh: migor: Remove stale soc_camera include")

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

    Jacopo Mondi
     
  • set_edid never wrote the new EDID to state->edid.edid, it was only
    written to the hardware. Since get_edid returned state->edid.edid,
    it was never returning the right EDID.

    Signed-off-by: Tim Harvey
    Signed-off-by: Hans Verkuil
    [hverkuil-cisco@xs4all.nl: added missing commit log]
    Signed-off-by: Mauro Carvalho Chehab

    Tim Harvey
     
  • The CSI controller can take raw data from the data bus and output it
    directly to capture buffers. This can be used to support the JPEG media
    bus format.

    While the controller can report minimum and maximum bytes per line, it
    has no way to report how many lines were captured in the last frame.
    Thus, even when the on-bus data is framed correctly, we have no way to
    accertain the actual amount of data captured, unless we scan the buffer
    for JPEG EOI markers, or sequential zeros. For now we leave bytesused
    alone, and leave it up to userspace applications to parse the data.

    Signed-off-by: Chen-Yu Tsai
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Chen-Yu Tsai
     
  • The CSI controller can take raw data from the data bus and output RGB565
    format. The controller does not distinguish between RGB565 LE and BE.
    Instead this is determined by the media bus format, i.e. the format or
    order the sensor is sending data in.

    Signed-off-by: Chen-Yu Tsai
    Acked-by: Maxime Ripard
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Chen-Yu Tsai
     
  • max_register is currently set to 0x1000. This is beyond the mapped
    address range of the hardware, so attempts to dump the regmap from
    debugfs would trigger a kernel exception.

    Furthermore, the useful registers only occupy a small section at the
    beginning of the full range. Change the value to 0x9c, the last known
    register on the V3s and H3.

    On the A31, the register range is extended to support additional
    capture channels. Since this is not yet supported, ignore it for now.

    Fixes: 5cc7522d8965 ("media: sun6i: Add support for Allwinner CSI V3s")

    Cc:
    Signed-off-by: Chen-Yu Tsai
    Acked-by: Maxime Ripard
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Chen-Yu Tsai
     
  • Document RZ/G2 support.

    Signed-off-by: Fabrizio Castro
    Signed-off-by: Laurent Pinchart
    Reviewed-by: Simon Horman
    Signed-off-by: Mauro Carvalho Chehab

    Fabrizio Castro
     
  • Document RZ/G1 and RZ/G2 support.

    Signed-off-by: Fabrizio Castro
    Signed-off-by: Laurent Pinchart
    Reviewed-by: Simon Horman
    Signed-off-by: Mauro Carvalho Chehab

    Fabrizio Castro
     
  • drivers/media/platform/vsp1/vsp1_drm.c: drivers/media/platform/vsp1/vsp1_drm.c:336 vsp1_du_pipeline_setup_brx() error: we previously assumed 'pipe->brx' could be null (see line 244)

    smatch missed that if pipe->brx was NULL, then later on it will be
    set with a non-NULL value. But it is easier to just use the brx pointer
    so smatch doesn't get confused.

    Tested-on: Salvator-XS-ES2.0, Salvator-XS-M3N

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

    Hans Verkuil
     
  • The uvc driver uses this function to fill in bus_info for VIDIOC_QUERYCAP,
    so use the same function when filling in the bus_info for the media device.

    The current implementation only fills in part of the info. E.g. if the full
    bus_info is usb-0000:01:00.0-1.4.2, then the media bus_info only has 1.4.2.

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

    Hans Verkuil
     
  • drivers/media/usb/uvc/uvc_video.c: drivers/media/usb/uvc/uvc_video.c:1893 uvc_video_start_transfer() warn: argument 2 to %u specifier is cast from pointer

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

    Hans Verkuil
     
  • Language improvements, fix entity naming, make pipeline a graph and move
    device usage documentation to device documentation ipu3.rst.

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

    Yong Zhi
     
  • CSI block in Allwinner A64 has similar features as like in H3,
    but the default CSI_SCLK rate cannot work properly to drive the
    connected sensor interface.

    The tested mod cock rate is 300 MHz and BSP vfe media driver is also
    using the same rate. Unfortunately there is no valid information about
    clock rate in manual or any other sources except the BSP driver. so more
    faith on BSP code, because same has tested in mainline.

    So, add support for A64 CSI block by setting updated mod clock rate.

    Signed-off-by: Jagan Teki
    Acked-by: Maxime Ripard
    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Jagan Teki
     
  • Allwinner A64 CSI is a single channel time-multiplexed BT.656
    protocol interface.

    Add separate compatible string for A64 since it require explicit
    change in sun6i_csi driver to update default CSI_SCLK rate.

    Signed-off-by: Jagan Teki
    Reviewed-by: Rob Herring
    Acked-by: Maxime Ripard
    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Jagan Teki
     
  • The extended-controls.rst file had become too big. Split it up: each
    control class reference gets its own rst file, and this file just
    describes the Extended Control API.

    Each control class reference is also moved up one level into the
    table of contents to make it easier to find e.g. the codec control
    reference.

    Finally I rearranged the order so that all camera-related control
    classes are grouped together, ditto for codec/jpeg and fm-rx/tx.

    The ext-ctrls-codec.rst is still pretty big and it is a candidate
    to split up further in the future, possibly per codec.

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

    Hans Verkuil
     
  • The epoll function expects that whenever the poll file op is
    called, the poll_wait function is also called. That didn't
    always happen in dvb_demux_poll(), dvb_dvr_poll() and
    dvb_ca_en50221_io_poll(). Fix this, otherwise epoll()
    can timeout when it shouldn't.

    Signed-off-by: Hans Verkuil
    Reviewed-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     
  • The epoll function expects that whenever the poll file op is
    called, the poll_wait function is also called. That didn't
    always happen in videobuf_poll_stream(). Fix this, otherwise
    epoll() would timeout when it shouldn't.

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

    Hans Verkuil
     
  • The v4l2_m2m_poll function didn't check whether q->error
    was set for either of the two queues. Add support for this.

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

    Hans Verkuil
     
  • The epoll function expects that whenever the poll file op is
    called, the poll_wait function is also called. That didn't
    always happen in v4l2_m2m_poll(). Fix this, otherwise
    epoll() would timeout when it shouldn't.

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

    Hans Verkuil
     
  • The epoll function expects that whenever the poll file op is
    called, the poll_wait function is also called. That didn't
    always happen in v4l2_ctrl_poll(). Fix this, otherwise epoll()
    would timeout when it shouldn't.

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

    Hans Verkuil
     
  • The epoll function expects that whenever the poll file op is
    called, the poll_wait function is also called. That didn't
    always happen in vb2_core_poll() and vb2_poll(). Fix this,
    otherwise epoll() would timeout when it shouldn't.

    Signed-off-by: Hans Verkuil
    Reported-by: Yi Qingliang
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     
  • The epoll function expects that whenever the poll file op is
    called, the poll_wait function is also called. That didn't
    always happen in media_request_poll(). Fix this, otherwise
    epoll() would timeout when it shouldn't.

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

    Hans Verkuil
     
  • The epoll function expects that whenever the poll file op is
    called, the poll_wait function is also called. That didn't
    always happen in cec_poll(). Fix this, otherwise epoll()
    would timeout when it shouldn't.

    Signed-off-by: Hans Verkuil
    Reviewed-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     
  • 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