22 Apr, 2019

8 commits

  • 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

21 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
     
  • Small readability changes to make the breaking of some lines
    cleaner.

    Signed-off-by: Lucas Leonardo Ciancaglini
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Lucas Leonardo Ciancaglini
     
  • In order to prevent ISOC URBs from being infinitely resubmitted,
    the driver's USB disconnect handler must kill all the in-flight URBs.

    While here, change the URB packet status message to a debug level,
    to avoid spamming the console too much.

    This commit fixes a lockup caused by an interrupt storm coming
    from the URB completion handler.

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

    Ezequiel Garcia
     
  • As warned by smatch:
    drivers/media/dvb-core/dvbdev.c: drivers/media/dvb-core/dvbdev.c:529 dvb_register_device() error: double unlock 'sem:&minor_rwsem'

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

    Mauro Carvalho Chehab
     

26 Mar, 2019

7 commits

  • Smatch warns about small size on two structs:

    drivers/media/platform/qcom/venus/hfi_parser.c:103 parse_profile_level() error: memcpy() 'proflevel' too small (8 vs 128)
    drivers/media/platform/qcom/venus/hfi_parser.c: drivers/media/platform/qcom/venus/hfi_parser.c:129 parse_caps() error: memcpy() 'cap' too small (16 vs 512)

    The reason is that the hfi_parser actually expects:
    - multiple data entries on hfi_capabilities
    - multiple profile_level on hfi_profile_level_supported

    However, the structs trick gcc, making it to believe that
    there's just one value for each.

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • The only way for p_set to be NULL would be if vin_coef_set would be an
    empty array.

    On such case, the driver will OOPS, as it would try to de-reference a
    NULL value. So, the check if p_set is not NULL doesn't make any sense.

    Solves those two smatch warnings:

    drivers/media/platform/rcar-vin/rcar-dma.c:489 rvin_set_coeff() warn: variable dereferenced before check 'p_set' (see line 484)
    drivers/media/platform/rcar-vin/rcar-dma.c:494 rvin_set_coeff() error: we previously assumed 'p_set' could be null (see line 489)

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • At the error logic, ipc_buf was already asigned to &ctx->ipc_buf_struct,
    with can't be null, as warned by smatch:

    drivers/media/platform/sti/delta/delta-ipc.c:223 delta_ipc_open() warn: variable dereferenced before check 'ctx->ipc_buf' (see line 183)

    So, remove the uneeded check.

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • The way the code works, compression will be a valid value (less or equal to 3)
    on both set_video_mode_foo() calls at the beginning of the while() loop.

    So, the value for pChoose can't be NULL.

    Solves those smatch warnings:

    drivers/media/usb/pwc/pwc-ctrl.c: drivers/media/usb/pwc/pwc-ctrl.c:252 set_video_mode_Timon() warn: variable dereferenced before check 'pChoose' (see line 248)
    drivers/media/usb/pwc/pwc-ctrl.c: drivers/media/usb/pwc/pwc-ctrl.c:302 set_video_mode_Kiara() warn: variable dereferenced before check 'pChoose' (see line 298)

    and simplifies the code a little bit.

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • There are some macros at cx2341x_update() with seemed to
    be introduced in order to ensure that lines would be less
    than 80 columns.

    Well, the thing is that they make the code harder to be analized,
    not only by humans, but also for static code analyzers:

    drivers/media/common/cx2341x.c:1116 cx2341x_update() error: we previously assumed 'old' could be null (see line 1047)

    So, remove the "force" var, and replace the NEQ macro to a
    better designed one that makes clearer about what it is doing.

    While here, also remove the "temporal" var, as it is just another
    way of doing the same type of check as the new CMP_FIELD() macro
    already does.

    Finally, fix coding style at the block code.
    remove such macros.

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • As warned by smatch:
    drivers/media/i2c/imx214.c:591 imx214_set_format() warn: variable dereferenced before check 'format' (see line 589)

    It turns that the code at imx214_set_format() has support for being
    called with the format being NULL. I've no idea why, as it is only
    called internally with the pointer set, and via subdev API (with
    should also set it).

    Also, the entire logic there depends on having format != NULL, so
    just remove the bogus broken support for a null format.

    Signed-off-by: Mauro Carvalho Chehab
    Reviewed-by: Hans Verkuil
    Reviewed-by: Ricardo Ribalda Delgado
    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • Indentation is odd in several places, especially when printing messages
    to the kernel log. Fix it to match the usual coding style.

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

    Laurent Pinchart