23 Jan, 2018

15 commits

  • Add nop variant of media_entity_cleanup. This allows calling
    media_entity_cleanup whether or not Media controller is enabled,
    simplifying driver code.

    Also drop #ifdefs on a few drivers around media_entity_cleanup().

    Signed-off-by: Sakari Ailus
    Reviewed-by: Arnd Bergmann
    Signed-off-by: Mauro Carvalho Chehab

    Sakari Ailus
     
  • Time to time, stream on is failing with a strange positive error.
    Error code is returned erroneously by ov5640_set_ctrl_exposure()
    due to ov5640_get_vts() return value wrongly treated as error.
    Fix this by forcing ret to 0 after ov5640_get_vts() success call,
    in order that ret is set to success for rest of code sequence.

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

    Hugues Fruchet
     
  • With "pages" initialized to vb length + 1 pages, the condition
    check if(!pages--) will break at one more page than intended,
    this can result in out-of-bound access to b->lop[i][j] when setting
    the last dummy page.

    Fixes: c7cbef1fdb54 ("media: intel-ipu3: cio2: fix a crash with out-of-bounds access")

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

    Yong Zhi
     
  • My earlier patch missed two functions, these must be __maybe_unused
    as well:

    drivers/media/pci/intel/ipu3/ipu3-cio2.c:1867:12: error: 'cio2_runtime_resume' defined but not used [-Werror=unused-function]
    drivers/media/pci/intel/ipu3/ipu3-cio2.c:1849:12: error: 'cio2_runtime_suspend' defined but not used [-Werror=unused-function]

    Fixes: 2086dd35705f ("media: intel-ipu3: cio2: mark PM functions as __maybe_unused")

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

    Arnd Bergmann
     
  • This directory contains the videobuf2 framework, so name the
    directory accordingly.

    The name 'videobuf' typically refers to the old and deprecated
    videobuf version 1 framework so that was confusing.

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

    Hans Verkuil
     
  • The cobalt sound driver has a dependency on ALSA, but not
    on the PCM helper code, so this can lead to an extremely
    rare link error in randconfig builds:

    ERROR: "snd_pcm_period_elapsed" [drivers/media/pci/cobalt/cobalt.ko] undefined!
    ERROR: "_snd_pcm_stream_lock_irqsave" [drivers/media/pci/cobalt/cobalt.ko] undefined!
    ERROR: "snd_pcm_hw_constraint_integer" [drivers/media/pci/cobalt/cobalt.ko] undefined!
    ERROR: "snd_pcm_set_ops" [drivers/media/pci/cobalt/cobalt.ko] undefined!
    ERROR: "snd_pcm_stream_unlock_irqrestore" [drivers/media/pci/cobalt/cobalt.ko] undefined!
    ERROR: "snd_pcm_lib_ioctl" [drivers/media/pci/cobalt/cobalt.ko] undefined!
    ERROR: "snd_pcm_new" [drivers/media/pci/cobalt/cobalt.ko] undefined!

    The other audio drivers select 'SND_PCM' for this, so let's
    do the same.

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

    Arnd Bergmann
     
  • Without CONFIG_DMA_SHARED_BUFFER we run into a link error for the
    dma_buf_* APIs:

    ERROR: "dma_buf_map_attachment" [drivers/staging/media/tegra-vde/tegra-vde.ko] undefined!
    ERROR: "dma_buf_attach" [drivers/staging/media/tegra-vde/tegra-vde.ko] undefined!
    ERROR: "dma_buf_get" [drivers/staging/media/tegra-vde/tegra-vde.ko] undefined!
    ERROR: "dma_buf_put" [drivers/staging/media/tegra-vde/tegra-vde.ko] undefined!
    ERROR: "dma_buf_detach" [drivers/staging/media/tegra-vde/tegra-vde.ko] undefined!
    ERROR: "dma_buf_unmap_attachment" [drivers/staging/media/tegra-vde/tegra-vde.ko] undefined!

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

    Arnd Bergmann
     
  • As warned:
    drivers/media/i2c/dw9714.c: warning: incorrect type in initializer (different base types): => 64:19

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

    Mauro Carvalho Chehab
     
  • The client field in driver's struct is redundant. Remove it.

    Signed-off-by: Sakari Ailus
    Tested-by: Rajmohan Mani
    Signed-off-by: Mauro Carvalho Chehab

    Sakari Ailus
     
  • Call pm_runtime_idle() at the end of the driver's probe() function to
    enable the device to reach low power state once probe() finishes.

    Signed-off-by: Sakari Ailus
    Tested-by: Rajmohan Mani
    Signed-off-by: Mauro Carvalho Chehab

    Sakari Ailus
     
  • The rc5 protocol does not have a leading pulse or space, but we encode
    the first bit using a single leading pulse. For other protocols, the
    leading pulse or space does not represent any bit. So, don't remove the
    first bit if a leading pulse is present.

    Cc: Antti Seppälä
    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Sean Young
     
  • The IR rc6 encoder sends the header using manchester encoding using 0
    bits, which causes the following:

    UBSAN: Undefined behaviour in drivers/media/rc/rc-ir-raw.c:247:6
    shift exponent 4294967295 is too large for 64-bit type 'long long unsigned int'

    So, allow the leader code to send a pulse and space and remove the unused
    pulse_space_start field.

    Cc: Antti Seppälä
    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Sean Young
     
  • Since commit 9b6192589be7 ("media: lirc: implement scancode sending"),
    and commit de142c324106 ("media: lirc: implement reading scancode")
    the lirc features ioctl for raw IR devices advertises two modes for
    sending and receiving.

    The lirc daemon now fails to detect a raw IR device, both for transmit
    and receive.

    To fix this, do not advertise the scancode mode in the lirc features
    for raw IR devices (however do keep it for scancode devices). The mode
    can still be used via the LIRC_SET_{REC,SEND}_MODE ioctl.

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

    Sean Young
     
  • Since commit a60d64b15c20 ("media: lirc: lirc interface should not be
    a raw decoder"), there is no lirc_dev module any more. On Ubuntu 16.10,
    the /etc/init.d/lirc startup script attempts to load the lirc_dev module.

    Since this module does not exist any more, this script fails. Add an alias
    so the correct module is loaded.

    Fixes: a60d64b15c20 ("media: lirc: lirc interface should not be a raw decoder")

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

    Sean Young
     
  • The current error exit path if ir_raw_encode_scancode fails is via the
    label out_kfree which kfree's an uninitialized pointer txbuf. Fix this
    by exiting via a new exit path that does not kfree txbuf. Also exit
    via this new exit path for a failed allocation of txbuf to avoid a
    redundant kfree on a NULL pointer (to save a bunch of CPU cycles).

    Detected by: CoverityScan, CID#1463070 ("Uninitialized pointer read")

    Fixes: f81a8158d4fb ("media: lirc: release lock before sleep")

    Signed-off-by: Colin Ian King
    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Colin Ian King
     

06 Jan, 2018

14 commits

  • Add RGB565 (LE & BE) and YUV422 YUYV format in addition
    to existing YUV422 UYVY format.

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

    Hugues Fruchet
     
  • Add support of DVP parallel mode in addition of
    existing MIPI CSI mode. The choice between two modes
    and configuration is made through device tree.

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

    Hugues Fruchet
     
  • Verify that chip identifier is correct when probing.

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

    Hugues Fruchet
     
  • Switch gpiod_set_value to gpiod_set_value_cansleep to avoid
    warnings when powering sensor.

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

    Hugues Fruchet
     
  • The mt9m111 has the test pattern generator features. This makes use of
    it through V4L2_CID_TEST_PATTERN control.

    Cc: Mauro Carvalho Chehab
    Signed-off-by: Akinobu Mita
    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Akinobu Mita
     
  • Create a source pad and set the media controller type to the sensor.

    Cc: Mauro Carvalho Chehab
    Signed-off-by: Akinobu Mita
    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Akinobu Mita
     
  • Set the V4L2_SUBDEV_FL_HAS_DEVNODE flag for the subdevice so that the
    subdevice device node is created.

    Cc: Mauro Carvalho Chehab
    Signed-off-by: Akinobu Mita
    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Akinobu Mita
     
  • The ov7740 (color) image sensor is a high performance VGA CMOS
    image snesor, which supports for output formats: RAW RGB and YUV
    and image sizes: VGA, and QVGA, CIF and any size smaller.

    Signed-off-by: Songjun Wu
    Signed-off-by: Wenyou Yang
    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Wenyou Yang
     
  • Smatch complains that "err" can be uninitialized if we have a zero size
    write. The flow analysis is a little complicated so I'm not sure if
    that's possible or not, but it's harmless to set this to zero and it
    makes the code easier to read.

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

    Dan Carpenter
     
  • cio2 driver should release buffer with QUEUED state
    when start_stream op failed, wrong buffer state will
    cause vb2 core throw a warning.

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

    Yong Zhi
     
  • When dmabuf is used for BLOB type frame, the frame
    buffers allocated by gralloc will hold more pages
    than the valid frame data due to height alignment.

    In this case, the page numbers in sg list could exceed the
    FBPT upper limit value - max_lops(8)*1024 to cause crash.

    Limit the LOP access to the valid data length
    to avoid FBPT sub-entries overflow.

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

    Yong Zhi
     
  • The driver apparently assumes that the device uses the same page size
    as the CPU, but also assumes that this is 4096 bytes. On architectures
    with a larger page size like 65536 bytes, we get a warning about an
    integer overflow:

    drivers/media/pci/intel/ipu3/ipu3-cio2.c: In function 'cio2_fbpt_entry_init_dummy':
    arch/arm64/include/asm/page-def.h:28:20: error: large integer implicitly truncated to unsigned type [-Werror=overflow]
    #define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
    ^
    drivers/media/pci/intel/ipu3/ipu3-cio2.h:404:26: note: in expansion of macro 'PAGE_SIZE'
    #define CIO2_PAGE_SIZE PAGE_SIZE
    ^~~~~~~~~
    drivers/media/pci/intel/ipu3/ipu3-cio2.c:172:3: note: in expansion of macro 'CIO2_PAGE_SIZE'
    CIO2_PAGE_SIZE / sizeof(u32) * CIO2_MAX_LOPS;

    Obviously this won't work, but the driver is also unlikely to ever be
    used on such an architecture, so the easiest workaround is to define
    the CIO2_PAGE_SIZE macro to the size that the hardware actually uses.

    Fixes: c2a6a07afe4a ("media: intel-ipu3: cio2: add new MIPI-CSI2 driver")

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

    Arnd Bergmann
     
  • When CONFIG_PM is disabled, we get harmless warnings about the
    suspend/resume callbacks being unused:

    drivers/media/pci/intel/ipu3/ipu3-cio2.c:1993:12: error: 'cio2_resume' defined but not used [-Werror=unused-function]
    drivers/media/pci/intel/ipu3/ipu3-cio2.c:1967:12: error: 'cio2_suspend' defined but not used [-Werror=unused-function]

    This marks them as __maybe_unused to shut up the warnings.

    Fixes: c2a6a07afe4a ("media: intel-ipu3: cio2: add new MIPI-CSI2 driver")

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

    Arnd Bergmann
     
  • The arr_size() macro which is used to calculate the size of the chunk in the
    array to be arranged resembles ARRAY_SIZE naming-wise. Avoid confusion by
    renaming it to CHUNK_SIZE instead.

    Also use min() macro to calculate the minimum of two numbers.

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

    Sakari Ailus
     

05 Jan, 2018

3 commits


04 Jan, 2018

8 commits

  • As reported on [1], this device needs this quirk to be able to
    reliably initialise the webcam.

    [1] https://sourceforge.net/p/linux-uvc/mailman/message/33791098/

    Signed-off-by: Neil Armstrong
    Signed-off-by: Laurent Pinchart
    Signed-off-by: Mauro Carvalho Chehab

    Neil Armstrong
     
  • Some UVC video cameras contain metadata in their payload headers. This
    patch extracts that data, adding more clock synchronisation information,
    on both bulk and isochronous endpoints and makes it available to the user
    space on a separate video node, using the V4L2_CAP_META_CAPTURE capability
    and the V4L2_BUF_TYPE_META_CAPTURE buffer queue type. By default, only the
    V4L2_META_FMT_UVC pixel format is available from those nodes. However,
    cameras can be added to the device ID table to additionally specify their
    own metadata format, in which case that format will also become available
    from the metadata node.

    [Use put_unaligned instead of __put_unaligned_cpu64]
    [Use put_unaligned for the sof field as well]

    Signed-off-by: Guennadi Liakhovetski
    Signed-off-by: Laurent Pinchart
    Signed-off-by: Mauro Carvalho Chehab

    Guennadi Liakhovetski
     
  • Currently the UVC driver assigns a quirk bitmask to the .driver_info
    field of struct usb_device_id. This patch instroduces a struct to store
    quirks and possibly other per-device parameters in the future.

    Signed-off-by: Guennadi Liakhovetski
    Signed-off-by: Laurent Pinchart
    Signed-off-by: Mauro Carvalho Chehab

    Guennadi Liakhovetski
     
  • Add a pixel format, used by the UVC driver to stream metadata.

    Signed-off-by: Guennadi Liakhovetski
    Signed-off-by: Laurent Pinchart
    Signed-off-by: Mauro Carvalho Chehab

    Guennadi Liakhovetski
     
  • The V4L2 core populates the struct v4l2_capability device_caps field
    from the same field in video_device. There's no need to handle that
    manually in the driver.

    Signed-off-by: Laurent Pinchart
    Reviewed-by: Guennadi Liakhovetski
    Tested-by: Guennadi Liakhovetski
    Signed-off-by: Mauro Carvalho Chehab

    Laurent Pinchart
     
  • The function will then be used to register the video device for metadata
    capture.

    Signed-off-by: Laurent Pinchart
    Reviewed-by: Guennadi Liakhovetski
    Tested-by: Guennadi Liakhovetski
    Signed-off-by: Mauro Carvalho Chehab

    Laurent Pinchart
     
  • uvc_video_get_ts() returns a 'struct timespec', but all its users
    really want a nanoseconds variable anyway.

    Changing the deprecated ktime_get_ts/ktime_get_real_ts to ktime_get
    and ktime_get_real simplifies the code noticeably, while keeping
    the resulting numbers unchanged.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: Laurent Pinchart
    Signed-off-by: Mauro Carvalho Chehab

    Arnd Bergmann
     
  • 'struct timespec' works fine here, but we try to migrate
    away from it in favor of ktime_t or timespec64. In this
    case, using ktime_t produces the simplest code.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: Laurent Pinchart
    Signed-off-by: Mauro Carvalho Chehab

    Arnd Bergmann