Skip to content

Commit

Permalink
rpi_1049_e5a33f9d545dd69ce73f18b874eb9f699a3cc66f
Browse files Browse the repository at this point in the history
commit e5a33f9
Author: Vincent Sanders <[email protected]>
Date:   Wed Jan 30 12:45:18 2013 +0000

    bcm2835: add v4l2 camera device
    
    - Supports raw YUV capture, preview, JPEG and H264.
    - Uses videobuf2 for data transfer, using dma_buf.
    - Uses 3.6.10 timestamping
    - Camera power based on use
    - Uses immutable input mode on video encoder
    
    Signed-off-by: Daniel Stone <[email protected]>
    Signed-off-by: Luke Diamand <[email protected]>
    
    V4L2: Fixes from 6by9
    
    V4L2: Fix EV values. Add manual shutter speed control
    
    V4L2 EV values should be in units of 1/1000. Corrected.
    Add support for V4L2_CID_EXPOSURE_ABSOLUTE which should
    give manual shutter control. Requires manual exposure mode
    to be selected first.
    
    Signed-off-by: Dave Stevenson <[email protected]>
    
    V4L2: Correct JPEG Q-factor range
    
    Should be 1-100, not 0-100
    
    Signed-off-by: Dave Stevenson <[email protected]>
    
    V4L2: Fix issue of driver jamming if STREAMON failed.
    
    Fix issue where the driver was left in a partially enabled
    state if STREAMON failed, and would then reject many IOCTLs
    as it thought it was streaming.
    
    Signed-off-by: Dave Stevenson <[email protected]>
    
    V4L2: Fix ISO controls.
    
    Driver was passing the index to the GPU, and not the desired
    ISO value.
    
    Signed-off-by: Dave Stevenson <[email protected]>
    
    V4L2: Add flicker avoidance controls
    
    Add support for V4L2_CID_POWER_LINE_FREQUENCY to set flicker
    avoidance frequencies.
    
    Signed-off-by: Dave Stevenson <[email protected]>
    
    V4L2: Add support for frame rate control.
    
    Add support for frame rate (or time per frame as V4L2
    inverts it) control via s_parm.
    
    Signed-off-by: Dave Stevenson <[email protected]>
    
    V4L2: Improve G_FBUF handling so we pass conformance
    
    Return some sane numbers for get framebuffer so that
    we pass conformance.
    
    Signed-off-by: Dave Stevenson <[email protected]>
    
    V4L2: Fix information advertised through g_vidfmt
    
    Width and height were being stored based on incorrect
    values.
    
    Signed-off-by: Dave Stevenson <[email protected]>
    
    V4L2: Add support for inline H264 headers
    
    Add support for V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER
    to control H264 inline headers.
    Requires firmware fix to work correctly, otherwise format
    has to be set to H264 before this parameter is set.
    
    Signed-off-by: Dave Stevenson <[email protected]>
    
    V4L2: Fix JPEG timestamp issue
    
    JPEG images were coming through from the GPU with timestamp
    of 0. Detect this and give current system time instead
    of some invalid value.
    
    Signed-off-by: Dave Stevenson <[email protected]>
    
    V4L2: Fix issue when switching down JPEG resolution.
    
    JPEG buffer size calculation is based on input resolution.
    Input resolution was being configured after output port
    format. Caused failures if switching from one JPEG resolution
    to a smaller one.
    
    Signed-off-by: Dave Stevenson <[email protected]>
    
    V4L2: Enable MJPEG encoding
    
    Requires GPU firmware update to support MJPEG encoder.
    
    Signed-off-by: Dave Stevenson <[email protected]>
    
    V4L2: Correct flag settings for compressed formats
    
    Set flags field correctly on enum_fmt_vid_cap for compressed
    image formats.
    
    Signed-off-by: Dave Stevenson <[email protected]>
    
    V4L2: H264 profile & level ctrls, FPS control and auto exp pri
    
    Several control handling updates.
    H264 profile and level controls.
    Timeperframe/FPS reworked to add V4L2_CID_EXPOSURE_AUTO_PRIORITY to
    select whether AE is allowed to override the framerate specified.
    
    Signed-off-by: Dave Stevenson <[email protected]>
    
    V4L2: Correct BGR24 to RGB24 in format table
    
    Signed-off-by: Dave Stevenson <[email protected]>
    
    V4L2: Add additional pixel formats. Correct colourspace
    
    Adds the other flavours of YUYV, and NV12.
    Corrects the overlay advertised colourspace.
    
    Signed-off-by: Dave Stevenson <[email protected]>
    
    V4L2: Drop logging msg from info to debug
    
    Signed-off-by: Dave Stevenson <[email protected]>
    
    V4L2: Initial pass at scene modes.
    
    Only supports exposure mode and metering modes.
    
    Signed-off-by: Dave Stevenson <[email protected]>
    
    V4L2: Add manual white balance control.
    
    Adds support for V4L2_CID_RED_BALANCE and
    V4L2_CID_BLUE_BALANCE. Only has an effect if
    V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE has
    V4L2_WHITE_BALANCE_MANUAL selected.
    
    Signed-off-by: Dave Stevenson <[email protected]>
    
    config: Enable V4L / MMAL driver
    
    V4L2: Increase the MMAL timeout to 3sec
    
    MJPEG codec flush is now taking longer and results
    in a kernel panic if the driver has stopped waiting for
    the result when it finally completes.
    Increase the timeout value from 1 to 3secs.
    
    Signed-off-by: Dave Stevenson <[email protected]>
    
    V4L2: Add support for setting H264_I_PERIOD
    
    Adds support for the parameter V4L2_CID_MPEG_VIDEO_H264_I_PERIOD
    to set the frequency with which I frames are produced.
    
    Signed-off-by: Dave Stevenson <[email protected]>
    
    V4L2: Enable GPU function for removing padding from images.
    
    GPU can now support arbitrary strides, although may require
    additional processing to achieve it. Enable this feature
    so that the images delivered are the size requested.
    
    Signed-off-by: Dave Stevenson <[email protected]>
    
    V4L2: Add support for V4L2_PIX_FMT_BGR32
    
    Signed-off-by: Dave Stevenson <[email protected]>
    
    V4L2: Set the colourspace to avoid odd YUV-RGB conversions
    
    Removes the amiguity from the conversion routines and stops
    them dropping back to the SD vs HD choice of coeffs.
    
    Signed-off-by: Dave Stevenson <[email protected]>
    
    V4L2: Make video/still threshold a run-time param
    
    Move the define for at what resolution the driver
    switches from a video mode capture to a stills mode
    capture to module parameters.
    
    Signed-off-by: Dave Stevenson <[email protected]>
    
    V4L2: Fix incorrect pool sizing
    
    Signed-off-by: Dave Stevenson <[email protected]>
    
    V4L2: Add option to disable enum_framesizes.
    
    Gstreamer's handling of a driver that advertises
    V4L2_FRMSIZE_TYPE_STEPWISE to define the supported
    resolutions is broken. See bug
    https://bugzilla.gnome.org/show_bug.cgi?id=726521
    
    Optional parameter of gst_v4l2src_is_broken added.
    If non-zero, the driver claims not to support that
    ioctl, and gstreamer should be happy again (it
    guesses a set of defaults for itself).
    
    Signed-off-by: Dave Stevenson <[email protected]>
    
    V4L2: Add support for more image formats
    
    Adds YVU420 (YV12), YVU420SP (NV21), and BGR888.
    
    Signed-off-by: Dave Stevenson <[email protected]>
    
    V4L2: Extend range for V4L2_CID_MPEG_VIDEO_H264_I_PERIOD
    
    Request to extend the range from the fairly arbitrary
    1000 frames (33 seconds at 30fps). Extend out to the
    max range supported (int32 value).
    Also allow 0, which is handled by the codec as only
    send an I-frame on the first frame and never again.
    There may be an exception if it detects a significant
    scene change, but there's no easy way around that.
    
    Signed-off-by: Dave Stevenson <[email protected]>
    
    bcm2835-camera: stop_streaming now has a void return
    
    BCM2835-V4L2: Fix compliance test failures
    
    VIDIOC_TRY_FMT and VIDIOC_S_FMT tests were faling due
    to reporting V4L2_COLORSPACE_JPEG when the colour
    format wasn't V4L2_PIX_FMT_JPEG.
    Now reports V4L2_COLORSPACE_SMPTE170M for YUV formats.
    
    bcm2835 camera planar/packed stride length
    
    Added a field to the mmal_fmt struct used to compute the bytes per line
    when using a particular format. This results in the correct stride being
    calculated even when the format is planar.
    
    Signed-off-by: Garrett Wilson <[email protected]>
    
    bcm2835: camera: check for scene not being found
    
    static analysis by cppcheck detected some potential NULL pointer
    dereference issues:
    
    [drivers/media/platform/bcm2835/controls.c:854]: (error) Possible null
      pointer dereference: scene
      (and lines 858, 859 too)
    
    it is possible that scene is not found because of an invalue ctrl->val
    and is therefore NULL and hence causing a null pointer dereference.
    
    Signed-off-by: Colin Ian King <[email protected]>
    
    bcm2835: memcpy port data to m rather than rmsg
    
    static analysis by cppcheck detected a memcpy to rmsg which is
    not actually initialized at that point.  The memcpy should be copying
    to variable m instead.
    
    Signed-off-by: Colin Ian King <[email protected]>
    
    BCM2835-V4L2: Return buffers to videobuf2 on shutdown
    
    raspberrypi/linux#817
    Fixes the kernel warning from videobuf2 as buffers
    are now returned as they are being flushed on
    stop_streaming.
    
    squash: Fixup bcm2835-camera for changes in kernel 4.4 api
    
    v4l2: Fix up driver to upstream timestamp changes
    
    bcm2835-camera: fix a bug in computation of frame timestamp
    
    Fixes #1318
    
    V4L2 driver updates (#1393)
    
    * BCM2835-V4L2: Correct ISO control and add V4L2_CID_ISO_SENSITIVITY_AUTO
    
    raspberrypi/linux#1251
    
    V4L2_CID_ISO_SENSITIVITY was not advertising ISO*1000 as it should.
    V4L2_CID_ISO_SENSITIVITY_AUTO was not implemented, so was taking
    V4L2_CID_ISO_SENSITIVITY as 0 for auto mode.
    Still accepts 0 for auto, but also abides by the new parameter.
    
    Signed-off-by: Dave Stevenson <[email protected]>
    
    * BCM2835-V4L2: Add a video_nr parameter.
    
    Adds a kernel parameter "video_nr" to specify the preferred
    /dev/videoX device node.
    https://www.raspberrypi.org/forums/viewtopic.php?f=38&t=136120&p=905545
    
    Signed-off-by: Dave Stevenson <[email protected]>
    
    * BCM2835-V4L2: Add support for multiple cameras
    
    Ask GPU on load how many cameras have been detected, and
    enumerate that number of devices.
    Only applicable on the Compute Module as no other device
    exposes multiple CSI2 interfaces.
    
    Signed-off-by: Dave Stevenson <[email protected]>
    
    * BCM2835-V4L2: Add control of the overlay location and alpha.
    
    Actually do something useful in vidioc_s_fmt_vid_overlay and
    vidioc_try_fmt_vid_overlay, rather than effectively having
    read-only fields.
    
    Signed-off-by: Dave Stevenson <[email protected]>
    
    * BCM2835-V4L2: V4L2-Compliance failure fix
    
    VIDIOC_TRY_FMT was failing due to bytesperline not
    being set correctly by default.
    
    Signed-off-by: Dave Stevenson <[email protected]>
    
    * BCM2835-V4L2: Make all module parameters static
    
    Clean up to correct variable scope
    
    Signed-off-by: Dave Stevenson <[email protected]>
    
    V4L2: Request maximum resolution from GPU
    
    Get resolution information about the sensors from the GPU
    and advertise it correctly.
    
    Signed-off-by: Dave Stevenson <[email protected]>
    
    BCM2835-V4L2: Increase minimum resolution to 32x32
    
    raspberrypi/linux#1498 showed
    up that 16x16 is failing to work on the GPU for some reason.
    
    GPU bug being tracked on
    raspberrypi/firmware#607
    Workaround here by increasing minimum resolution via V4L2
    to 32x32.
    
    Signed-off-by: Dave Stevenson <[email protected]>
    
    [media]: bcm2835-camera: fix compilation error
    
    There is an error when compiling rpi-4.6.y branch:
      CC [M]  drivers/media/platform/bcm2835/bcm2835-camera.o
    drivers/media/platform/bcm2835/bcm2835-camera.c:639:17: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
      .queue_setup = queue_setup,
                     ^
    drivers/media/platform/bcm2835/bcm2835-camera.c:639:17: note: (near initialization for 'bm2835_mmal_video_qops.queue_setup')
    
    The const void *parg in setup_queue callback is not needed since commit:
    df9ecb0.
    This commit removes it.
    
    Signed-off-by: Slawomir Stepien <[email protected]>
    
    bcm2835-camera: Fix max/min error when looping over cameras/resolutions
    
    See: raspberrypi/linux#1447 (comment)
    
    BCM2835-V4L2: Correct handling for BGR24 vs RGB24.
    
    There was a bug in the GPU firmware that had reversed these
    two formats.
    Detect the old firmware, and reverse the formats if necessary.
    
    Signed-off-by: Dave Stevenson <[email protected]>
    
    BCM2835-v4l2: Fix a conformance test failure
    
    Format ioctls:
            test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
            warn: v4l2-test-formats.cpp(1195): S_PARM is supported but
                    doesn't report V4L2_CAP_TIMEPERFRAME.
            fail: v4l2-test-formats.cpp(1118): node->has_frmintervals
                    && !cap->capability


Gbp-Pq: Topic rpi
Gbp-Pq: Name rpi_1049_e5a33f9d545dd69ce73f18b874eb9f699a3cc66f.patch
  • Loading branch information
Debian Kernel Team authored and raspbian-autopush committed Oct 22, 2017
1 parent a6eed55 commit 272b54d
Show file tree
Hide file tree
Showing 17 changed files with 7,205 additions and 0 deletions.
60 changes: 60 additions & 0 deletions Documentation/video4linux/bcm2835-v4l2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@

BCM2835 (aka Raspberry Pi) V4L2 driver
======================================

1. Copyright
============

Copyright © 2013 Raspberry Pi (Trading) Ltd.

2. License
==========

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

3. Quick Start
==============

You need a version 1.0 or later of v4l2-ctl, available from:
git://git.linuxtv.org/v4l-utils.git

$ sudo modprobe bcm2835-v4l2

Turn on the overlay:

$ v4l2-ctl --overlay=1

Turn off the overlay:

$ v4l2-ctl --overlay=0

Set the capture format for video:

$ v4l2-ctl --set-fmt-video=width=1920,height=1088,pixelformat=4

(Note: 1088 not 1080).

Capture:

$ v4l2-ctl --stream-mmap=3 --stream-count=100 --stream-to=somefile.h264

Stills capture:

$ v4l2-ctl --set-fmt-video=width=2592,height=1944,pixelformat=3
$ v4l2-ctl --stream-mmap=3 --stream-count=1 --stream-to=somefile.jpg

List of available formats:

$ v4l2-ctl --list-formats
2 changes: 2 additions & 0 deletions drivers/media/platform/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ menuconfig V4L_PLATFORM_DRIVERS

if V4L_PLATFORM_DRIVERS

source "drivers/media/platform/bcm2835/Kconfig"

source "drivers/media/platform/marvell-ccic/Kconfig"

config VIDEO_VIA_CAMERA
Expand Down
2 changes: 2 additions & 0 deletions drivers/media/platform/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# Makefile for the video capture/playback device drivers.
#

obj-$(CONFIG_VIDEO_BCM2835) += bcm2835/

obj-$(CONFIG_VIDEO_M32R_AR_M64278) += arv.o

obj-$(CONFIG_VIDEO_VIA_CAMERA) += via-camera.o
Expand Down
25 changes: 25 additions & 0 deletions drivers/media/platform/bcm2835/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Broadcom VideoCore IV v4l2 camera support

config VIDEO_BCM2835
bool "Broadcom BCM2835 camera interface driver"
depends on VIDEO_V4L2 && ARCH_BCM2835
---help---
Say Y here to enable camera host interface devices for
Broadcom BCM2835 SoC. This operates over the VCHIQ interface
to a service running on VideoCore.


if VIDEO_BCM2835

config VIDEO_BCM2835_MMAL
tristate "Broadcom BM2835 MMAL camera interface driver"
depends on BCM2708_VCHIQ
select VIDEOBUF2_VMALLOC
---help---
This is a V4L2 driver for the Broadcom BCM2835 MMAL camera host interface

To compile this driver as a module, choose M here: the
module will be called bcm2835-v4l2.o


endif # VIDEO_BM2835
5 changes: 5 additions & 0 deletions drivers/media/platform/bcm2835/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
bcm2835-v4l2-objs := bcm2835-camera.o controls.o mmal-vchiq.o

obj-$(CONFIG_VIDEO_BCM2835_MMAL) += bcm2835-v4l2.o

ccflags-$(CONFIG_VIDEO_BCM2835) += -Idrivers/staging/vc04_services -Idrivers/staging/vc04_services/interface/vcos/linuxkernel -D__VCCOREVER__=0x04000000
Loading

0 comments on commit 272b54d

Please sign in to comment.