22 Apr, 2019

18 commits

  • Media Device Allocator API to allows multiple drivers share a media device.
    This API solves a very common use-case for media devices where one physical
    device (an USB stick) provides both audio and video. When such media device
    exposes a standard USB Audio class, a proprietary Video class, two or more
    independent drivers will share a single physical USB bridge. In such cases,
    it is necessary to coordinate access to the shared resource.

    Using this API, drivers can allocate a media device with the shared struct
    device as the key. Once the media device is allocated by a driver, other
    drivers can get a reference to it. The media device is released when all
    the references are released.

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

    Shuah Khan
     
  • Do not access sd_formats[] if num_of_sd_formats is zero, ie
    subdev sensor didn't expose any formats.

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

    Hugues Fruchet
     
  • Report overrun error only when it exceeds a given threshold.

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

    Hugues Fruchet
     
  • Revisit and add some error messages.

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

    Hugues Fruchet
     
  • There are several places where a break statement occurs before
    a following break statement; these are unnecessary and can be
    removed to clean up the code a little.

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

    Colin Ian King
     
  • Enlarge the plane number to support more complex case
    and add the support for fmt change case.

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

    Yunfei Dong
     
  • The image renderer (IMR), or the distortion correction engine, is a
    drawing processor with a simple instruction system capable of referencing
    video capture data or data in an external memory as the 2D texture data
    and performing texture mapping and drawing with respect to any shape that
    is split into triangular objects.

    Document the device tree bindings for the image renderer light extended 4
    (IMR-LX4) found in the R-Car gen3 SoCs...

    Signed-off-by: Sergei Shtylyov
    Acked-by: Rob Herring
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Sergei Shtylyov
     
  • We should get 'driver_data' from 'struct device' directly. Going via
    platform_device is an unneeded step back and forth.

    Signed-off-by: Wolfram Sang
    Reviewed-by: Rui Miguel Silva
    Reviewed-by: Simon Horman
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Wolfram Sang
     
  • Media bus codes were being mapped to pixelformats, which causes a
    limitation on vimc because not all pixelformats can be mapped to media
    bus codes.
    Also, media bus codes are an internal configuration from the device.
    Userspace only assures media bus codes matches between pads and expects
    the image in a given pixelformat. So we can allow almost any media bus
    format to be configured between pads, except for debayer that expects a
    media bus code of type bayer in the sink pad.

    [hverkuil-cisco@xs4all.nl: drop use of v4l2_get_fourcc_name: not yet available]
    [hverkuil-cisco@xs4all.nl: made vimc_mbus_list static]

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

    Helen Fornazier
     
  • Add bayer format information in struct v4l2_format_info table.

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

    Helen Fornazier
     
  • Add two new API helpers, v4l2_fill_pixfmt and v4l2_fill_pixfmt_mp,
    to be used by drivers to calculate plane sizes and bytes per lines.

    Note that driver-specific padding and alignment are not
    taken into account, and must be done by drivers using this API.

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

    Ezequiel Garcia
     
  • The rockchip VPU driver uses generic names for its pixel format
    helpers. We want to use the same names for generic versions
    of these helpers, so rename the rockchip ones.

    The driver will be switched to the generic helpers later.

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

    Ezequiel Garcia
     
  • Minor fix for helper function and comment, s/v4l2_vb2_buffer/vb2_v4l2_buffer.

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

    Ezequiel Garcia
     
  • Somehow the string "Controls name" got pasted in two places
    where it doesn't belong. Remove that text.

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

    Hans Verkuil
     
  • It is mandatory to write CEC_CFGR only when CECEN=0. To protect
    transmission, a check have been added to delayed logical address
    modification. This patch is necessary tp pass all tests of compliance.

    Signed-off-by: Yannick Fertré
    Reviewed-by: Benjamin Gaignard
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Yannick Fertre
     
  • ISC will output the "ARGB32" configuration in byte order: B, G, R, Alpha.
    This is in fact the format BGRA, aka ABGR32.
    If alpha is missing, the same format is equivalent to XBGR32.
    Added both formats and removed ARGB32 which is wrong.

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

    Eugen Hristev
     
  • This change is a redesign in the formats and the way the ISC is
    configured w.r.t. sensor format and the output format from the ISC.
    I have changed the splitting between sensor output (which is also ISC input)
    and ISC output.
    The sensor format represents the way the sensor is configured, and what ISC
    is receiving.
    The format configuration represents the way ISC is interpreting the data and
    formatting the output to the subsystem.
    Now it's much easier to figure out what is the ISC configuration for input, and
    what is the configuration for output.
    The non-raw format can be obtained directly from sensor or it can be done
    inside the ISC. The controller format list will include a configuration for
    each format.
    The old supported formats are still in place, if we want to dump the sensor
    format directly to the output, the try format routine will detect and
    configure the pipeline accordingly.
    This also fixes the previous issues when the raw format was NULL which
    resulted in many crashes for sensors which did not have the expected/tested
    formats.

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

    Eugen Hristev
     
  • Add following V4L2 QP parameters for H.264:
    * V4L2_CID_MPEG_VIDEO_H264_I_FRAME_MIN_QP
    * V4L2_CID_MPEG_VIDEO_H264_I_FRAME_MAX_QP
    * V4L2_CID_MPEG_VIDEO_H264_P_FRAME_MIN_QP
    * V4L2_CID_MPEG_VIDEO_H264_P_FRAME_MAX_QP

    These controls will limit QP range for intra and inter frame,
    provide more manual control to improve video encode quality.

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

    Fish Lin
     

30 Mar, 2019

4 commits


29 Mar, 2019

18 commits

  • Remove a few files left over from the mt9t031 driver. While at it, add a
    TODO file for the SoC camera framework as a whole.

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

    Sakari Ailus
     
  • The SoC camera was moved to the staging tree but we missed updating
    MAINTAINERS. Do that now.

    Fixes: 280de94a6519 ("media: soc_camera: Move to the staging tree")

    Reported-by: Joe Perches
    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Sakari Ailus
     
  • The exposure control is clustered with the autoexposure control and
    flagged as volatile, but the g_volatile_ctrl() doesn't handle
    V4L2_CID_EXPOSURE_AUTO. So, the value of the exposure control can't be
    read in autoexposure mode.

    This enables to get the exposure control in autoexposure mode by making
    ov7740_get_volatile_ctrl() deal with V4L2_CID_EXPOSURE_AUTO.

    This also sets the exposure control as volatile by specifying the
    argument to v4l2_ctrl_auto_cluster() instead of manually flagging it.

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

    Akinobu Mita
     
  • Instead of doing the cast, just change the type to char.

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

    Mauro Carvalho Chehab
     
  • The strncpy() function is being deprecated upstream. Replace
    it by the safer strscpy().

    While here, replace a few occurences of strlcpy() that were
    recently added to also use strscpy().

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

    Mauro Carvalho Chehab
     
  • The support for those two formats are archtecture-dependent.
    Use the endianness to CPU macros to do it right.

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • The st_register() returns have changed over time, but these days it
    never returns -1. We should just be checking for any negative error
    codes.

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

    Dan Carpenter
     
  • Smatch marks skb->data as untrusted so it warns that "evt_hdr->dlen"
    can copy up to 255 bytes and we only have room for two bytes. Even
    if this comes from the firmware and we trust it, the new policy
    generally is just to fix it as kernel hardenning.

    I can't test this code so I tried to be very conservative. I considered
    not allowing "evt_hdr->dlen == 1" because it doesn't initialize the
    whole variable but in the end I decided to allow it and manually
    initialized "asic_id" and "asic_ver" to zero.

    Fixes: e8454ff7b9a4 ("[media] drivers:media:radio: wl128x: FM Driver Common sources")

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

    Dan Carpenter
     
  • 'vb' null check should be done before dereferencing it in
    tw5864_handle_frame, otherwise a NULL pointer dereference
    may occur.

    Fixes: 34d1324edd31 ("[media] pci: Add tw5864 driver")

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

    YueHaibing
     
  • In case usb_alloc_coherent fails, the fix returns -ENOMEM to
    avoid a potential NULL pointer dereference.

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

    Kangjie Lu
     
  • devm_kcalloc may fail and return a null pointer. The fix returns
    -ENOMEM upon failures to avoid null pointer dereferences.

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

    Kangjie Lu
     
  • This member is never read throughout the code, so remove it.

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

    Alexandre Courbot
     
  • Commit 0650a91499e0 ("media: mtk-vcodec: Correct return type for mem2mem
    buffer helpers") fixed the return types for mem2mem buffer helper
    functions by changing a few local variables from vb2_buffer to
    vb2_v4l2_buffer. However, it left a few accesses to vb2_buffer::planes
    as-is, accidentally turning them into accesses to
    vb2_v4l2_buffer::planes and resulting in values being read from/written
    to the wrong place.

    Fix this by inserting vb2_buf into these accesses so they mimic their
    original behavior.

    Fixes: 0650a91499e0 ("media: mtk-vcodec: Correct return type for mem2mem buffer helpers")

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

    Alexandre Courbot
     
  • This code generates a static checker warning:

    drivers/media/v4l2-core/v4l2-ctrls.c:2921 v4l2_querymenu()
    warn: should '(1 << i)' be a 64 bit type?

    The problem is that "ctrl->menu_skip_mask" is a u64 and we're only
    testing the lower 32 bits.

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

    Dan Carpenter
     
  • clang warns about a possible variable use that gcc never
    complained about:

    drivers/media/platform/davinci/isif.c:982:32: error: variable 'frame_size' is uninitialized when used here
    [-Werror,-Wuninitialized]
    dm365_vpss_set_pg_frame_size(frame_size);
    ^~~~~~~~~~
    drivers/media/platform/davinci/isif.c:887:2: note: variable 'frame_size' is declared here
    struct vpss_pg_frame_size frame_size;
    ^
    1 error generated.

    There is no initialization for this variable at all, and there
    has never been one in the mainline kernel, so we really should
    not put that stack data into an mmio register.

    On the other hand, I suspect that gcc checks the condition
    more closely and notices that the global
    isif_cfg.bayer.config_params.test_pat_gen flag is initialized
    to zero and never written to from any code path, so anything
    depending on it can be eliminated.

    To shut up the clang warning, just remove the dead code manually,
    it has probably never been used because any attempt to do so
    would have resulted in undefined behavior.

    Fixes: 63e3ab142fa3 ("V4L/DVB: V4L - vpfe capture - source for ISIF driver on DM365")

    Signed-off-by: Arnd Bergmann
    Reviewed-by: Nathan Chancellor
    Acked-by: Lad, Prabhakar
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Arnd Bergmann
     
  • Building tda1997x fails now unless V4L2_FWNODE is selected:

    drivers/media/i2c/tda1997x.o: in function `tda1997x_parse_dt'
    undefined reference to `v4l2_fwnode_endpoint_parse'

    While at it, also sort the selections alphabetically

    Fixes: 9ac0038db9a7 ("media: i2c: Add TDA1997x HDMI receiver driver")

    Signed-off-by: Koen Vandeputte
    Cc: stable@vger.kernel.org # v4.17+
    Acked-by: Sakari Ailus
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Koen Vandeputte
     
  • When CONFIG_DEBUGFS is enabled, we get a warning about an
    incorrect section annotation that can lead to undefined
    behavior:

    WARNING: vmlinux.o(.text+0xd3c7c4): Section mismatch in reference from the function mipi_csis_probe() to the function .init.text:mipi_csis_debugfs_init()
    The function mipi_csis_probe() references
    the function __init mipi_csis_debugfs_init().
    This is often because mipi_csis_probe lacks a __init
    annotation or the annotation of mipi_csis_debugfs_init is wrong.

    The same function for an unknown reason has a different
    version for !CONFIG_DEBUGFS, which does not have this problem,
    but behaves the same way otherwise (it does nothing when debugfs
    is disabled).
    Consolidate the two versions, using the correct section from
    one version, and the implementation from the other.

    Signed-off-by: Arnd Bergmann
    Reviewed-by: Rui Miguel Silva
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Arnd Bergmann
     
  • clang is unable to optimize the isif_ioctl() in the same way that
    gcc does, as it fails to prove that the local copy of
    the 'struct vpfe_isif_raw_config' argument is unnecessary:

    drivers/staging/media/davinci_vpfe/dm365_isif.c:622:13: error: stack frame size of 1344 bytes in function 'isif_ioctl' [-Werror,-Wframe-larger-than=]

    Marking it as 'const' while passing the data down clearly shows us that
    the copy is never modified, and we can skip copying it entirely, which
    reduces the stack usage to just eight bytes.

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

    Arnd Bergmann