summaryrefslogtreecommitdiff
path: root/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
AgeCommit message (Collapse)Author
2019-01-16media: staging: bcm2835-camera: use V4L2_FRACT_COMPAREAkinobu Mita
Now the equivalent of FRACT_CMP() is added in v4l2 common internal API header. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-12-12staging: bcm2835-camera: Provide more specific probe error messagesStefan Wahren
Currently there is only a catch-all info message which print the relevant error code without any context. So add more specific error messages in order to narrow down possible issues. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-12staging: bcm2835-camera: Move module info to the endStefan Wahren
In order to have this more consistent between the vc04 services move the module information to the end of the file. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-12staging: bcm2835-camera: fix module autoloadingStefan Wahren
In order to make the module bcm2835-camera load automatically, we need to add a module alias. Fixes: 4bebb0312ea9 ("staging/bcm2835-camera: Set ourselves up as a platform driver.") Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-12staging: bcm2835-camera: Abort probe if there is no cameraStefan Wahren
Abort the probing of the camera driver in case there isn't a camera actually connected to the Raspberry Pi. This solution also avoids a NULL ptr dereference of mmal instance on driver unload. Fixes: 7b3ad5abf027 ("staging: Import the BCM2835 MMAL-based V4L2 camera driver.") Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-18Merge tag 'staging-4.19-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging Pull staging and IIO updates from Greg KH: "Here are the big staging/iio patches for 4.19-rc1. Lots of churn here, with tons of cleanups happening in staging drivers, a removal of an old crypto driver that no one was using (skein), and the addition of some new IIO drivers. Also added was a "gasket" driver from Google that needs loads of work and the erofs filesystem. Even with adding all of the new drivers and a new filesystem, we are only adding about 1000 lines overall to the kernel linecount, which shows just how much cleanup happened, and how big the unused crypto driver was. All of these have been in the linux-next tree for a while now with no reported issues" * tag 'staging-4.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (903 commits) staging:rtl8192u: Remove unused macro definitions - Style staging:rtl8192u: Add spaces around '+' operator - Style staging:rtl8192u: Remove stale comment - Style staging: rtl8188eu: remove unused mp_custom_oid.h staging: fbtft: Add spaces around / - Style staging: fbtft: Erases some repetitive usage of function name - Style staging: fbtft: Adjust some empty-line problems - Style staging: fbtft: Removes one nesting level to help readability - Style staging: fbtft: Changes gamma table to define. staging: fbtft: A bit more information on dev_err. staging: fbtft: Fixes some alignment issues - Style staging: fbtft: Puts macro arguments in parenthesis to avoid precedence issues - Style staging: rtl8188eu: remove unused array dB_Invert_Table staging: rtl8188eu: remove whitespace, add missing blank line staging: rtl8188eu: use is_multicast_ether_addr in rtw_sta_mgt.c staging: rtl8188eu: remove whitespace - style staging: rtl8188eu: cleanup block comment - style staging: rtl8188eu: use is_multicast_ether_addr in rtl8188eu_xmit.c staging: rtl8188eu: use is_multicast_ether_addr in recv_linux.c staging: rtlwifi: refactor rtl_get_tcb_desc ...
2018-07-24staging: bcm2835-camera: handle wait_for_completion_timeout return properlyNicholas Mc Guire
wait_for_completion_timeout returns unsigned long not int so a variable of proper type is introduced. Further the check for <= 0 is ambiguous and should be == 0 here indicating timeout. Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org> Fixes: 7b3ad5abf027 ("staging: Import the BCM2835 MMAL-based V4L2 camera driver.") Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-04media: staging: bcm2835-camera: Provide lock for vb2_queueEzequiel Garcia
Use the device mutex to protect the vb2_queue. This allows to replace the ad-hoc wait_{prepare, finish} with vb2_ops_wait_{prepare, finish}. Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-14staging: bcm2835-camera: Fix module section mismatch warnings.Eric Anholt
Noticed by Stephen Rothwell in -next. Signed-off-by: Eric Anholt <eric@anholt.net> Fixes: 4bebb0312ea9 ("staging/bcm2835-camera: Set ourselves up as a platform driver.") Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-11staging: bcm2835: Fix mmal_port_parameter_get() signed/unsigned warnings.Eric Anholt
The arg is a u32 *, so switch over to that in our declarations. Signed-off-by: Eric Anholt <eric@anholt.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-11staging: bcm2835: Remove dead code related to framerate.Eric Anholt
Fixes a compiler warning about a set-but-not-used variable. I think this was just leftover dead code from before set_framerate_params(), since that also sets up some mmal_parameter_rational structs for fps. Signed-off-by: Eric Anholt <eric@anholt.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-11staging: bcm2835-camera: Fix warnings about string ops on v4l2 uapi.Eric Anholt
The v4l2 uapi uses u8[] for strings, so cast those to char * to avoid compiler warnings about unsigned vs signed with sprintf() and friends. Signed-off-by: Eric Anholt <eric@anholt.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-11staging: bcm2835-camera: Fix indentation of tablesDave Stevenson
As requested by Mauro Carvalho Chehab in review. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org> Signed-off-by: Eric Anholt <eric@anholt.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-11staging: bcm2835-camera: Replace BUG_ON with return errorDave Stevenson
The error conditions don't warrant taking the kernel down, so remove BUG_ON. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org> Signed-off-by: Eric Anholt <eric@anholt.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-11staging: bcm2835-camera: Remove V4L2/MMAL buffer remappingDave Stevenson
The MMAL and V4L2 buffers had been disassociated, and linked on demand. Seeing as both are finite and low in number, and we now have the same number of each, link them for the duration. This removes the complexity of maintaining lists as the struct mmal_buffer context comes back from the VPU, so we can directly link back to the relevant V4L2 buffer. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org> Signed-off-by: Eric Anholt <eric@anholt.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-11staging: bcm2835-camera: Match MMAL buffer count to V4L2.Dave Stevenson
For historical reasons, the number of buffers passed to the VPU over MMAL did not match that passed from V4L2. That is a silly situation as the driver has to duplicate serialisation and other functions that have already been implemented in V4L2/videobuf2. As we had more V4L2 buffers than MMAL ones, the MMAL buffer headers were returned to the VPU immediately on being filled, which is now invalid. Match the number of buffers notified in queue_setup with that used in MMAL. Return buffers only when we get them from V4L2. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org> Signed-off-by: Eric Anholt <eric@anholt.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-11staging: bcm2835-camera: Allocate context once per bufferDave Stevenson
The struct mmal_msg_context was being allocated for every message being sent to the VPU, and freed when it came back. Whilst that is required behaviour for some messages (mainly the synchronous ones), it is wasteful for the video buffers that make up the majority of the traffic. Add to the buffer_init/cleanup hooks that it allocates/frees the msg_context required. v2: changes by anholt from the downstream tree: clean up indentation, pass an error value through, forward-declare the struct so we have less void * Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org> Signed-off-by: Eric Anholt <eric@anholt.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-11staging: bcm2835-camera: Skip ISP pass to eliminate padding.Dave Stevenson
Interleaved RGB and single plane YUV formats can be delivered by the GPU without the secondary step of removing padding, as the bytesperline field can be set appropriately. Planar YUV needs the GPU to still remove padding, as there is no way to report that there is padding between the planes (ie on the height). The multi-planar formats are NOT applicable, as there is no easy way to make them contiguous in memory (ie one large allocation that gets broken up). The whole task is passed across to videobuf2 which has no notion of that requirement. v2: Changes by anholt from the downstream driver: Flag two more planar formats as needing padding removal, and remove broken userspace workaround. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org> Signed-off-by: Eric Anholt <eric@anholt.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-11staging/bcm2835-camera: Set ourselves up as a platform driver.Eric Anholt
This allows bcm2835-camera to automatically probe after VCHI has loaded, rather than only successfully probing if the arbitrary probe order chooses us after VCHI. Signed-off-by: Eric Anholt <eric@anholt.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-15staging: vc04_services: bcm2835-camera: remove redundant license textGreg Kroah-Hartman
Now that the SPDX tag is in all drivers/staging/vc04_services/bcm2835-camera/ files, that identifies the license in a specific and legally-defined manner. So the extra GPL text wording can be removed as it is no longer needed at all. This is done on a quest to remove the 700+ different ways that files in the kernel describe the GPL license text. And there's unneeded stuff like the address (sometimes incorrect) for the FSF which is never needed. No copyright headers or other non-license-description text was removed. Cc: Eric Anholt <eric@anholt.net> Cc: Stefan Wahren <stefan.wahren@i2se.com> Cc: Florian Fainelli <f.fainelli@gmail.com> Cc: Ray Jui <rjui@broadcom.com> Cc: Scott Branden <sbranden@broadcom.com> Cc: <bcm-kernel-feedback-list@broadcom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-15staging: vc04_services: bcm2835-camera: add SPDX identifiersGreg Kroah-Hartman
It's good to have SPDX identifiers in all files to make it easier to audit the kernel tree for correct licenses. Fix up the bcm2835-camera driver to have a proper SPDX identifier, based on the license text in the file itself. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This work is based on a script and data from Thomas Gleixner, Philippe Ombredanne, and Kate Stewart. Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Kate Stewart <kstewart@linuxfoundation.org> Cc: Philippe Ombredanne <pombredanne@nexb.com> Cc: Eric Anholt <eric@anholt.net> Cc: Stefan Wahren <stefan.wahren@i2se.com> Cc: Florian Fainelli <f.fainelli@gmail.com> Cc: Ray Jui <rjui@broadcom.com> Cc: Scott Branden <sbranden@broadcom.com> Cc: <bcm-kernel-feedback-list@broadcom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-06staging: vc04_services: Unsplit user-visible stringsGenki Sky
This was found using checkpatch.pl's SPLIT_STRING warning. While joining these strings makes for long lines, the kernel codebase consistently does it this way to make user-visible strings easier to grep for. Signed-off-by: Genki Sky <sky@genki.is> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-06staging: vc04_services: Join multiline dereferencesGenki Sky
This was found using checkpatch.pl's MULTILINE_DEREFERENCE warning. Putting the dereference onto one line makes them easier to read, especially when part of a larger expression (in this case, function arguments and ternary operator), and when the dereferences are short (as they are here). Signed-off-by: Genki Sky <sky@genki.is> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-28staging: bcm2835-camera use ktime_t for timestampsArnd Bergmann
struct timeval is deprecated for in-kernel use, and converting this function to use ktime_t makes it simpler as well. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28staging: bcm2835-camera: make video_device constBhumika Goyal
Make this const as it is only used in a copy operation. Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-18staging: bcm2835-camera: constify vb2_ops structuresJulia Lawall
These vb2_ops structures are only stored in the ops field of a vb2_queue structure, which is declared as const. Thus the vb2_ops structures themselves can be const. Done with the help of Coccinelle. // <smpl> @r disable optional_qualifier@ identifier i; position p; @@ static struct vb2_ops i@p = { ... }; @ok@ identifier r.i; struct vb2_queue e; position p; @@ e.ops = &i@p; @bad@ position p != {r.p,ok.p}; identifier r.i; struct vb2_ops e; @@ e@i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct vb2_ops i = { ... }; // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-18staging: media/platform/bcm2835: remove gstreamer workaroundKevin Wern
Gstreamer's v4l2src reacted poorly to certain outputs from the bcm2835 video driver's ioctl ops function vidioc_enum_framesizes, so a workaround was created that could be activated by user input. This workaround would replace the driver's ioctl ops struct with another, similar struct--only with no function pointed to by vidioc_enum_framesizes. With no response, gstreamer would attempt to continue with some default settings that happened to work better. However, this bug has been fixed in gstreamer since 2014, so we shouldn't include this workaround in the stable version of the driver. Signed-off-by: Kevin Wern <kevin.m.wern@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-12Staging: bcm2835: Fixed style of block commentsDerek Robson
Fixed style of block comments across whole driver Found using checkpatch Signed-off-by: Derek Robson <robsonde@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-10staging: bcm2835-camera: Create struct mmal_es_format_local to mirror struct ↵Michael Zoran
mmal_es_format The struct struct mmal_es_format is passed between the firmware which has pointers. A local version of mmal_es_format is also used. Luckly, the two versions are always memberwise copied from each other so simply have different structures for the local and msg versions. Signed-off-by: Michael Zoran <mzoran@crowfest.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-07Staging: media: platform: bcm2835 - style fixDerek Robson
Changed permissions to octal style Found using checkpatch Signed-off-by: Derek Robson <robsonde@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-07staging: bcm2835-camera: Replace ternary operator with min_t macroNarcisa Ana Maria Vasile
Use macro min_t to get the minimum of two values for readability. Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06staging: bcm2835-camera: prefer allocating memory using sizeof(*ptr) instead ↵Aishwarya Pant
of sizeof(struct type name) Using sizeof(*ptr) instead of sizeof(struct type name) is more robust to errors. Signed-off-by: Aishwarya Pant <aishpant@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06staging: vc04_services: bcm2835-camera: Remove unnecessary variableNarcisa Ana Maria Vasile
Instead of storing the result, make the function return directly Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06staging: bcm2835-camera: Refactored get_format functionNarcisa Ana Maria Vasile
Now, when the condition inside the for is fulfilled, I return the result, instead of checking afterwards whether the counter has reached or not the end of the list. Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06staging: vc04_services: bcm2835-camera: Simplify NULL comparisonsAishwarya Pant
Remove instances of explicit NULL comparisons in bcm2835-camera driver for code compaction. Signed-off-by: Aishwarya Pant <aishpant@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06staging: bcm2835-camera: Move driver under vc04_servicesMichael Zoran
The bcm2835-camera driver is part of v04_services, so it makes sense for it to be located under vc04_services to make configuration clearer. Signed-off-by: Michael Zoran <mzoran@crowfest.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>