summaryrefslogtreecommitdiffstats
path: root/drivers/staging/vc04_services
AgeCommit message (Collapse)Author
2020-01-27staging: bcm2835-camera: fix module autoloadingStefan Wahren
[ Upstream commit 3a2c20024a2b47adbf514e7f3ab79342739c3926 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-01-27staging: bcm2835-camera: Abort probe if there is no cameraStefan Wahren
[ Upstream commit 7566f39dfdc11f8a97d5810c6e6295a88f97ef91 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-07-14staging: bcm2835-camera: Handle empty EOS buffers whilst streamingDave Stevenson
commit a26be06d6d96c10a9ab005e99d93fbb5d3babd98 upstream. The change to mapping V4L2 to MMAL buffers 1:1 didn't handle the condition we get with raw pixel buffers (eg YUV and RGB) direct from the camera's stills port. That sends the pixel buffer and then an empty buffer with the EOS flag set. The EOS buffer wasn't handled and returned an error up the stack. Handle the condition correctly by returning it to the component if streaming, or returning with an error if stopping streaming. Fixes: 938416707071 ("staging: bcm2835-camera: Remove V4L2/MMAL buffer remapping") Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org> Signed-off-by: Stefan Wahren <wahrenst@gmx.net> Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Acked-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-14staging: bcm2835-camera: Remove check of the number of buffers suppliedDave Stevenson
commit bb8e97006d701ae725a177f8f322e5a75fa761b7 upstream. Before commit "staging: bcm2835-camera: Remove V4L2/MMAL buffer remapping" there was a need to ensure that there were sufficient buffers supplied from the user to cover those being sent to the VPU (always 1). Now the buffers are linked 1:1 between MMAL and V4L2, therefore there is no need for that check, and indeed it is wrong as there is no need to submit all the buffers before starting streaming. Fixes: 938416707071 ("staging: bcm2835-camera: Remove V4L2/MMAL buffer remapping") Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org> Signed-off-by: Stefan Wahren <wahrenst@gmx.net> Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Acked-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-14staging: bcm2835-camera: Ensure all buffers are returned on disableDave Stevenson
commit 70ec64ccdaac5d8f634338e33b016c1c99831499 upstream. With the recent change to match MMAL and V4L2 buffers there is a need to wait for all MMAL buffers to be returned during stop_streaming. Fixes: 938416707071 ("staging: bcm2835-camera: Remove V4L2/MMAL buffer remapping") Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org> Signed-off-by: Stefan Wahren <wahrenst@gmx.net> Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Acked-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-14staging: bcm2835-camera: Replace spinlock protecting context_map with mutexDave Stevenson
commit 8dedab2903f152aa3cee9ae3d57c828dea0d356e upstream. The commit "staging: bcm2835-camera: Replace open-coded idr with a struct idr." replaced an internal implementation of an idr with the standard functions and a spinlock. idr_alloc(GFP_KERNEL) can sleep whilst calling kmem_cache_alloc to allocate the new node, but this is not valid whilst in an atomic context due to the spinlock. There is no need for this to be a spinlock as a standard mutex is sufficient. Fixes: 950fd867c635 ("staging: bcm2835-camera: Replace open-coded idr with a struct idr.") Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org> Signed-off-by: Stefan Wahren <wahrenst@gmx.net> Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Acked-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-22Staging: vc04_services: Fix a couple error codesDan Carpenter
[ Upstream commit ca4e4efbefbbdde0a7bb3023ea08d491f4daf9b9 ] These are accidentally returning positive EINVAL instead of negative -EINVAL. Some of the callers treat positive values as success. Fixes: 7b3ad5abf027 ("staging: Import the BCM2835 MMAL-based V4L2 camera driver.") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Stefan Wahren <stefan.wahren@i2se.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-06-09staging: vc04_services: prevent integer overflow in create_pagelist()Dan Carpenter
commit ca641bae6da977d638458e78cd1487b6160a2718 upstream. The create_pagelist() "count" parameter comes from the user in vchiq_ioctl() and it could overflow. If you look at how create_page() is called in vchiq_prepare_bulk_data(), then the "size" variable is an int so it doesn't make sense to allow negatives or larger than INT_MAX. I don't know this code terribly well, but I believe that typical values of "count" are typically quite low and I don't think this check will affect normal valid uses at all. The "pagelist_size" calculation can also overflow on 32 bit systems, but not on 64 bit systems. I have added an integer overflow check for that as well. The Raspberry PI doesn't offer the same level of memory protection that x86 does so these sorts of bugs are probably not super critical to fix. Fixes: 71bad7f08641 ("staging: add bcm2708 vchiq driver") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-31staging: vc04_services: handle kzalloc failureNicholas Mc Guire
[ Upstream commit a5112277872a56017b777770e2fd4324d4a6c866 ] The kzalloc here was being used without checking the return - if the kzalloc fails return VCHIQ_ERROR. The call-site of vchiq_platform_init_state() vchiq_init_state() was not responding to an allocation failure so checks for != VCHIQ_SUCCESS and pass VCHIQ_ERROR up to vchiq_platform_init() which then will fail with -EINVAL. Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org> Reported-by: kbuild test robot <lkp@intel.com> Acked-By: Stefan Wahren <stefan.wahren@i2se.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2018-12-05staging: vchiq_arm: fix compat VCHIQ_IOC_AWAIT_COMPLETIONBen Wolsieffer
commit 5a96b2d38dc054c0bbcbcd585b116566cbd877fe upstream. The compatibility ioctl wrapper for VCHIQ_IOC_AWAIT_COMPLETION assumes that the native ioctl always uses a message buffer and decrements msgbufcount. Certain message types do not use a message buffer and in this case msgbufcount is not decremented, and completion->header for the message is NULL. Because the wrapper unconditionally decrements msgbufcount, the calling process may assume that a message buffer has been used even when it has not. This results in a memory leak in the userspace code that interfaces with this driver. When msgbufcount is decremented, the userspace code assumes that the buffer can be freed though the reference in completion->header, which cannot happen when the reference is NULL. This patch causes the wrapper to only decrement msgbufcount when the native ioctl decrements it. Note that we cannot simply copy the native ioctl's value of msgbufcount, because the wrapper only retrieves messages from the native ioctl one at a time, while userspace may request multiple messages. See https://github.com/raspberrypi/linux/pull/2703 for more discussion of this patch. Fixes: 5569a1260933 ("staging: vchiq_arm: Add compatibility wrappers for ioctls") Signed-off-by: Ben Wolsieffer <benwolsieffer@gmail.com> Acked-by: Stefan Wahren <stefan.wahren@i2se.com> Cc: stable <stable@vger.kernel.org> 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: fix timeout handling in wait_for_completion_timeoutNicholas 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 which is the only error case so no additional check needed here. 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-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-13staging: bcm2835-audio: Don't leak workqueue if open failsTuomas Tynkkynen
Currently, if bcm2835_audio_open() fails partway, the allocated workqueue is leaked. Avoid that. While at it, propagate the return value of bcm2835_audio_open_connection() on failure instead of returning -1. Signed-off-by: Tuomas Tynkkynen <tuomas@tuxera.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-13staging: bcm2835-audio: Check if workqueue allocation failedTuomas Tynkkynen
Currently, if allocating a workqueue fails, the driver will probe successfully but it will silently do nothing, which is rather silly. So instead bail out with -ENOMEM in bcm2835_audio_open() if alloc_workqueue() fails, and remove the now pointless checks for a NULL workqueue. While at it, get rid of the rather pointless one-line function my_workqueue_init(). Signed-off-by: Tuomas Tynkkynen <tuomas@tuxera.com> 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-06-17staging: vc04_services: make a couple of pointers staticColin Ian King
The pointers vchiq_dbg_dir and vchiq_dbg_clients are local to the source and do not need to be in global scope, so make them static. Cleans up sparse warnings: warning: symbol 'vchiq_dbg_dir' was not declared. Should it be static? warning: symbol 'vchiq_dbg_clients' was not declared. Should it be static? Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-01staging: vc04_services: no need to save the log debufs dentriesGreg Kroah-Hartman
The log entry dentries are only set, never referenced, so no need to keep them around. Remove the pointer from struct vchiq_debugfs_log_entry as it is not needed anymore and get rid of the separate vchiq_debugfs_create_log_entries() function as it is only used in one place. Suggested-by: Eric Anholt <eric@anholt.net> Cc: Stefan Wahren <stefan.wahren@i2se.com> Cc: Kees Cook <keescook@chromium.org> Cc: Dan Carpenter <dan.carpenter@oracle.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Keerthi Reddy <keerthigd4990@gmail.com> Cc: linux-rpi-kernel@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-01staging: vc04_services: vchiq_debugfs_log_entry can be a void *Greg Kroah-Hartman
There's no need to set this to be int * when it is only used as a void *. This lets us remove the unneeded cast, and unneeded temporary variable the one place it is referenced in the code. Suggested-by: Eric Anholt <eric@anholt.net> Cc: Stefan Wahren <stefan.wahren@i2se.com> Cc: Kees Cook <keescook@chromium.org> Cc: Dan Carpenter <dan.carpenter@oracle.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Keerthi Reddy <keerthigd4990@gmail.com> Cc: linux-rpi-kernel@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-01staging: vc04_services: remove struct vchiq_debugfs_infoGreg Kroah-Hartman
This structure, and the one static variable that was declared with it, were not being used for anything. The log_categories field was being set, but never used again. So just remove it entirely as it is not needed at all. Suggested-by: Eric Anholt <eric@anholt.net> Cc: Stefan Wahren <stefan.wahren@i2se.com> Cc: Kees Cook <keescook@chromium.org> Cc: Dan Carpenter <dan.carpenter@oracle.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Keerthi Reddy <keerthigd4990@gmail.com> Cc: linux-rpi-kernel@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-01staging: vc04_services: move client dbg directory into static variableGreg Kroah-Hartman
This does not need to be part of a wrapper function, or in a structure, just properly reference it directly as a single variable. The whole variable will be going away soon anyway, this is just a step toward that direction. Suggested-by: Eric Anholt <eric@anholt.net> Cc: Stefan Wahren <stefan.wahren@i2se.com> Cc: Kees Cook <keescook@chromium.org> Cc: Dan Carpenter <dan.carpenter@oracle.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Keerthi Reddy <keerthigd4990@gmail.com> Cc: linux-rpi-kernel@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-01staging: vc04_services: remove odd vchiq_debugfs_top() wrapperGreg Kroah-Hartman
vchiq_debugfs_top() is only a wrapper around a pointer to a dentry, so just use the dentry directly instead, making it a static variable instead of part of a static structure. This also removes the pointless BUG_ON() when checking that dentry as no one should ever care if debugfs is working or not, and the kernel should really not panic over something as trivial as that. Suggested-by: Eric Anholt <eric@anholt.net> Cc: Stefan Wahren <stefan.wahren@i2se.com> Cc: Kees Cook <keescook@chromium.org> Cc: Dan Carpenter <dan.carpenter@oracle.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Keerthi Reddy <keerthigd4990@gmail.com> Cc: linux-rpi-kernel@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-01staging: vc04_services: no need to check debugfs return valuesGreg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Clean up the vchiq_arm code by not caring about the value of debugfs calls. This ends up removing a number of lines of code that are not needed. Cc: Stefan Wahren <stefan.wahren@i2se.com> Cc: Kees Cook <keescook@chromium.org> Cc: Dan Carpenter <dan.carpenter@oracle.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Keerthi Reddy <keerthigd4990@gmail.com> Cc: linux-rpi-kernel@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-14staging: bcm2835: Use BIT_ULL macroKilian Köppchen
This patch fixes the checkpatch.pl check hint: CHECK: Prefer using the BIT_ULL macro Signed-off-by: Kilian Köppchen <kiliankoeppchen@googlemail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-14staging: bcm2835-camera: Replace open-coded idr with a struct idr.Eric Anholt
We just need some integer handles that can map back to our message struct when we're handling a reply, which struct idr is perfect for. v2: Fix error check to look at the right variable. Signed-off-by: Eric Anholt <eric@anholt.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.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: Fix comment typos.Dave Stevenson
Fix a typo flagged by checkpatch, and another in the same line. 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: Move struct vchiq_mmal_rectDave Stevenson
struct vchiq_mmal_rect is only referenced from mmal-parameters.h, yet was defined in mmal-vchiq.h. Move it to avoid having to include multiple headers for no reason. 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: Add multiple include protectionDave Stevenson
mmal-parameters.h didn't have the normal ... protection to stop it being included multiple times. Add it. 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: Remove bulk_mutex as it is not requiredDave Stevenson
There is no requirement to serialise bulk transfers as that is all done in VCHI, and if a second MMAL_MSG_TYPE_BUFFER_TO_HOST happened before the VCHI_CALLBACK_BULK_RECEIVED, then the service_callback thread is deadlocked. Remove the bulk_mutex so that multiple receives can be scheduled at a time. 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-05-11staging/vc04_services: Register a platform device for the camera driver.Eric Anholt
We had the camera driver set up in a module_init function, but that meant that the camera driver would fail to load if it was initialized before VCHI. By attaching to this platform_device, it can get a defined load order. Signed-off-by: Eric Anholt <eric@anholt.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-06staging: vc04_services: Remove stack hog issue from TODOStefan Wahren
Since there is no vchiq function listed by "make checkstack" anymore, we can remove the stack hog issue from the TODO. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-06staging: vchiq_shim: Remove unnecessary breakStefan Wahren
This removes an unnecessary break which has been reported by checkpatch.pl. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-06staging: vchiq_arm: remove unnecessary returnStefan Wahren
This removing an unnecessary return which has been reported by checkpatch.pl. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-06staging: vchiq_2835_arm: Fix whitespace issue in create_pagelistStefan Wahren
This fixes a whitespace issue reported by checkpatch: ERROR: code indent should use tabs where possible Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-06staging: vc04_services: Remove defines from MakefileStefan Wahren
The definition of USE_VCHIQ_ARM and VCOS_VERIFY_BKPTS isn't really necessary so remove them. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-06staging: vchiq_arm: Make index variable more self-explainingStefan Wahren
The chance to mixup i and j is very high. So rename variable j to a more explaining one. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-06staging: vchiq_arm: Rework second abort criterionStefan Wahren
In order to make the code easier to review, move the second abort criterion into the loop and the incrementation into a separate line. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-06staging: vchiq_arm: Clear VLA warningStefan Wahren
The kernel would like to have all stack VLA usage removed[1]. The array here is fixed (declared with a const variable) but it appears like a VLA to the compiler. Also, currently we are putting 768 bytes on the stack. This function is only called on the error path so performance is not critical, let's just allocate the memory instead of using the stack. This saves stack space and removes the VLA build warning. kmalloc a buffer for dumping state instead of using the stack. [1]: https://lkml.org/lkml/2018/3/7/621 Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-06staging: vchiq_arm: print real dump limitStefan Wahren
We better use the real loop limit in the warning about "too many active services". Another benefit is than we don't have to care about the format string in the following change. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>