summaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/coda
Commit message (Collapse)AuthorAgeFilesLines
* media: coda: remove definition of CODA_STD_MJPGMartin Kepplinger2017-12-081-1/+0Star
| | | | | | | | | | | | | | | | | According to i.MX VPU API Reference Manuals the MJPG video codec is referenced to by number 7, not 3. Also Philipp pointed out that this value is only meant to fill in CMD_ENC_SEQ_COD_STD for encoding, only on i.MX53. It was never written to any register, and even if defined correctly, wouldn't be needed for i.MX6. So avoid confusion and remove this definition. Signed-off-by: Martin Kepplinger <martink@posteo.de> Acked-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* Merge tag 'media/v4.15-1' of ↵Linus Torvalds2017-11-161-0/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media Pull media updates from Mauro Carvalho Chehab: - Documentation for digital TV (both kAPI and uAPI) are now in sync with the implementation (except for legacy/deprecated ioctls). This is a major step, as there were always a gap there - New sensor driver: imx274 - New cec driver: cec-gpio - New platform driver for rockship rga and tegra CEC - New RC driver: tango-ir - Several cleanups at atomisp driver - Core improvements for RC, CEC, V4L2 async probing support and DVB - Lots of drivers cleanup, fixes and improvements. * tag 'media/v4.15-1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (332 commits) dvb_frontend: don't use-after-free the frontend struct media: dib0700: fix invalid dvb_detach argument media: v4l2-ctrls: Don't validate BITMASK twice media: s5p-mfc: fix lockdep warning media: dvb-core: always call invoke_release() in fe_free() media: usb: dvb-usb-v2: dvb_usb_core: remove redundant code in dvb_usb_fe_sleep media: au0828: make const array addr_list static media: cx88: make const arrays default_addr_list and pvr2000_addr_list static media: drxd: make const array fastIncrDecLUT static media: usb: fix spelling mistake: "synchronuously" -> "synchronously" media: ddbridge: fix build warnings media: av7110: avoid 2038 overflow in debug print media: Don't do DMA on stack for firmware upload in the AS102 driver media: v4l: async: fix unregister for implicitly registered sub-device notifiers media: v4l: async: fix return of unitialized variable ret media: imx274: fix missing return assignment from call to imx274_mode_regs media: camss-vfe: always initialize reg at vfe_set_xbar_cfg() media: atomisp: make function calls cleaner media: atomisp: get rid of storage_class.h media: atomisp: get rid of wrong stddef.h include ...
| * media: coda: Handle return value of kasprintfArvind Yadav2017-10-271-0/+4
| | | | | | | | | | | | | | | | | | kasprintf() can fail here and we must check its return value. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* | License cleanup: add SPDX GPL-2.0 license identifier to files with no licenseGreg Kroah-Hartman2017-11-021-0/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many source files in the tree are missing licensing information, which makes it harder for compliance tools to determine the correct license. By default all files without license information are under the default license of the kernel, which is GPL version 2. Update the files which contain no license information with the 'GPL-2.0' SPDX license identifier. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This patch is based on work done by Thomas Gleixner and Kate Stewart and Philippe Ombredanne. How this work was done: Patches were generated and checked against linux-4.14-rc6 for a subset of the use cases: - file had no licensing information it it. - file was a */uapi/* one with no licensing information in it, - file was a */uapi/* one with existing licensing information, Further patches will be generated in subsequent months to fix up cases where non-standard license headers were used, and references to license had to be inferred by heuristics based on keywords. The analysis to determine which SPDX License Identifier to be applied to a file was done in a spreadsheet of side by side results from of the output of two independent scanners (ScanCode & Windriver) producing SPDX tag:value files created by Philippe Ombredanne. Philippe prepared the base worksheet, and did an initial spot review of a few 1000 files. The 4.13 kernel was the starting point of the analysis with 60,537 files assessed. Kate Stewart did a file by file comparison of the scanner results in the spreadsheet to determine which SPDX license identifier(s) to be applied to the file. She confirmed any determination that was not immediately clear with lawyers working with the Linux Foundation. Criteria used to select files for SPDX license identifier tagging was: - Files considered eligible had to be source code files. - Make and config files were included as candidates if they contained >5 lines of source - File already had some variant of a license header in it (even if <5 lines). All documentation files were explicitly excluded. The following heuristics were used to determine which SPDX license identifiers to apply. - when both scanners couldn't find any license traces, file was considered to have no license information in it, and the top level COPYING file license applied. For non */uapi/* files that summary was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 11139 and resulted in the first patch in this series. If that file was a */uapi/* path one, it was "GPL-2.0 WITH Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 WITH Linux-syscall-note 930 and resulted in the second patch in this series. - if a file had some form of licensing information in it, and was one of the */uapi/* ones, it was denoted with the Linux-syscall-note if any GPL family license was found in the file or had no licensing in it (per prior point). Results summary: SPDX license identifier # files ---------------------------------------------------|------ GPL-2.0 WITH Linux-syscall-note 270 GPL-2.0+ WITH Linux-syscall-note 169 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17 LGPL-2.1+ WITH Linux-syscall-note 15 GPL-1.0+ WITH Linux-syscall-note 14 ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5 LGPL-2.0+ WITH Linux-syscall-note 4 LGPL-2.1 WITH Linux-syscall-note 3 ((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3 ((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1 and that resulted in the third patch in this series. - when the two scanners agreed on the detected license(s), that became the concluded license(s). - when there was disagreement between the two scanners (one detected a license but the other didn't, or they both detected different licenses) a manual inspection of the file occurred. - In most cases a manual inspection of the information in the file resulted in a clear resolution of the license that should apply (and which scanner probably needed to revisit its heuristics). - When it was not immediately clear, the license identifier was confirmed with lawyers working with the Linux Foundation. - If there was any question as to the appropriate license identifier, the file was flagged for further research and to be revisited later in time. In total, over 70 hours of logged manual review was done on the spreadsheet to determine the SPDX license identifiers to apply to the source files by Kate, Philippe, Thomas and, in some cases, confirmation by lawyers working with the Linux Foundation. Kate also obtained a third independent scan of the 4.13 code base from FOSSology, and compared selected files where the other two scanners disagreed against that SPDX file, to see if there was new insights. The Windriver scanner is based on an older version of FOSSology in part, so they are related. Thomas did random spot checks in about 500 files from the spreadsheets for the uapi headers and agreed with SPDX license identifier in the files he inspected. For the non-uapi files Thomas did random spot checks in about 15000 files. In initial set of patches against 4.14-rc6, 3 files were found to have copy/paste license identifier errors, and have been fixed to reflect the correct identifier. Additionally Philippe spent 10 hours this week doing a detailed manual inspection and review of the 12,461 patched files from the initial patch version early this week with: - a full scancode scan run, collecting the matched texts, detected license ids and scores - reviewing anything where there was a license detected (about 500+ files) to ensure that the applied SPDX license was correct - reviewing anything where there was no detection but the patch license was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied SPDX license was correct This produced a worksheet with 20 files needing minor correction. This worksheet was then exported into 3 different .csv files for the different types of files to be modified. These .csv files were then reviewed by Greg. Thomas wrote a script to parse the csv files and add the proper SPDX tag to the file, in the format that the file expected. This script was further refined by Greg based on the output to detect more types of files automatically and to distinguish between header and source .c files (which need different comment types.) Finally Greg ran the script using the .csv files to generate the patches. Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* media: coda/imx-vdoa: Check for platform_get_resource() errorFabio Estevam2017-08-201-0/+2
| | | | | | | | | | | | | | platform_get_resource() may fail and in this case a NULL dereference will occur. Prevent this from happening by returning an error on platform_get_resource() failure. Fixes: b0444f18e0b18abce ("[media] coda: add i.MX6 VDOA driver") Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: coda: constify platform_device_idArvind Yadav2017-08-201-1/+1
| | | | | | | | | | | | platform_device_id are not supposed to change at runtime. All functions working with platform_device_id provided by <linux/platform_device.h> work with const platform_device_id. So mark the non-const structs as const. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Acked-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: coda: reduce iram size to leave space for suspend to ramJan Luebbe2017-08-081-1/+1
| | | | | | | | | | | | | The on-chip SRAM of i.MX6S is only 128 KiB. 4 KiB of that are allocated for suspend to RAM since commit df595746fa69 ("ARM: imx: add suspend in ocram support for i.mx6q"). Reduce the requested IRAM size to 124 KiB to avoid an allocation failure that causes the coda driver to not use the SRAM at all. Signed-off-by: Jan Luebbe <jlu@pengutronix.de> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: coda: fix decoder sequence init escape flagPhilipp Zabel2017-08-081-8/+5Star
| | | | | | | | | | | | coda_command_sync calls coda_command_async, which writes the bit_stream_param context variable into the BIT_STREAM_PARAM register, overwriting the previously set value during coda_start_decoding. Instead of writing to the register, set bit_stream_param to ensure that the decoder sequence init command is executed with the escape flag set. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: coda: explicitly request exclusive reset controlPhilipp Zabel2017-07-261-1/+2
| | | | | | | | | | | | | Commit a53e35db70d1 ("reset: Ensure drivers are explicit when requesting reset lines") started to transition the reset control request API calls to explicitly state whether the driver needs exclusive or shared reset control behavior. Convert all drivers requesting exclusive resets to the explicit API call so the temporary transition helpers can be removed. No functional changes. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: coda: disable BWB only while decoding on CODA 960Philipp Zabel2017-07-261-3/+10
| | | | | | | | | | | | | Disabling the BWB works around hangups observed while decoding. Since no issues have been observed while encoding, and disabling BWB also reduces encoding performance, reenable it for encoding. Fixes: 89ed025d5c53 ("[media] coda: disable BWB for all codecs on CODA 960") Reported-by: Ian Arkver <ian.arkver.dev@gmail.com> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Tested-by: Ian Arkver <ian.arkver.dev@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: coda: wake up capture queue on encoder stop after output streamoffPhilipp Zabel2017-07-191-1/+1
| | | | | | | | | | If an encoder stop command is issued after the output queue has already stopped streaming, the qsequence counter has been reset to 0. Always wake up the capture queue if the output queue is not streaming. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: coda: mark CODA960 firmware versions 2.3.10 and 3.1.1 as supportedPhilipp Zabel2017-07-191-0/+2
| | | | | | | | | | | | Firmware versions 2.3.10 revision 40778 and 3.1.1 revision 46072 are contained in the i.MX firmware download archives provided by NXP at http://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-3.5.7-1.0.0.bin and http://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-5.4.bin, respectively. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: coda: set MPEG-4 encoder class registerPhilipp Zabel2017-07-192-0/+5
| | | | | | | | | Explicitly set MPEG-4 encoder class register instead of relying on the default value of 0. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: coda: align internal mpeg4 framebuffers to 16x16 macroblocksPhilipp Zabel2017-07-191-1/+2
| | | | | | | | | | | | This fixes visual artifacts in the first macroblock row of encoded MPEG-4 video output caused by 8 additional lines of luma data leaking into the chroma planes of the internal reference framebuffers: the buffer size is rounded up to a multiple of 16x16 macroblock size, same as for the h.264 encoder. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: coda: set field of destination buffersPhilipp Zabel2017-07-191-0/+2
| | | | | | | | Set the field of destination buffers properly. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: coda: extend GOP size rangePhilipp Zabel2017-07-192-3/+6
| | | | | | | | | | | | CodaDx6 only accepts GOP sizes up to 60 frames, but CODA960 can handle up to 99 frames. If we disable automatic I frame generation altogether by setting GOP size to 0, we can let an application produce arbitrarily large I frame intervals using the V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME control. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: coda: do not reassign ctx->tiled_map_type in coda_s_fmtPhilipp Zabel2017-07-191-2/+3
| | | | | | | | | | | | | | This smatch warning: coda/coda-common.c:706 coda_s_fmt() warn: missing break? reassigning 'ctx->tiled_map_type' can be silenced by moving the ctx->tiled_map_type assignment into the breakout condition. That way the field is not reassigned when falling through to the next switch statement. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: coda: add h264 and mpeg4 profile and level controlsPhilipp Zabel2017-07-191-0/+47
| | | | | | | | | | | | CODA7541 supports H.264 BP level 3/3.1 and MPEG-4 SP level 5/6. CODA960 supports H.264 BP level 4.0 and MPEG-4 SP level 5/6. Implement the necessary profile and level controls to let userspace know this. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: coda: rename the picture run timeout error handlerPhilipp Zabel2017-06-243-5/+5
| | | | | | | | | | | | | | I would have liked the the picture run timeout error handler to be renamed to something a bit more descriptive in the original commit fb2be08f8cb3 ("[media] coda: first step at error recovery"). Somehow v1 [1] was merged instead of v2 [2]. [1] https://patchwork.kernel.org/patch/9663965/ [2] https://patchwork.kernel.org/patch/9774239/ Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hansverk@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: coda: ctx->codec is not NULL in coda_alloc_framebuffersPhilipp Zabel2017-06-241-2/+2
| | | | | | | | | | | | | | | | This fixes a smatch warning: drivers/media/platform/coda/coda-bit.c:415 coda_alloc_framebuffers() error: we previously assumed 'ctx->codec' could be null (see line 396) coda_alloc_framebuffers() is called from coda_start_encoding() and __coda_start_decoding(). Both dereference ctx->codec before calling coda_alloc_framebuffers() in lines 935 and 1649, so ctx->codec can not be NULL. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hansverk@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] coda/imx-vdoa: always wait for job completionLucas Stach2017-06-201-16/+33
| | | | | | | | | | | | | | As long as only one CODA context is running we get alternating device_run() and wait_for_completion() calls, but when more then one CODA context is active, other VDOA slots can be inserted between those calls for one context. Make sure to wait on job completion before running a different context and before destroying the currently active context. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hansverk@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] coda: first step at error recoveryLucas Stach2017-06-203-0/+24
| | | | | | | | | | | | | | This implements a simple handler for the case where decode did not finish sucessfully. This might be helpful during normal streaming, but for now it only handles the case where the context would deadlock with userspace, i.e. userspace issued DEC_CMD_STOP and waits for EOS, but after the failed decode run we would hold the context and wait for userspace to queue more buffers. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hansverk@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] coda: use correct offset for mvcol bufferLucas Stach2017-06-201-4/+4
| | | | | | | | | | The mvcol buffer needs to be placed behind the chroma plane(s), so use the real offset including any required rounding. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hansverk@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] coda: copy headers in front of every I-framePhilipp Zabel2017-06-071-4/+5
| | | | | | | | | | That way we don't have to rely on userspace to inject the headers on IDR requests, and there is always enough information to start decoding at an I-frame. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] coda: implement forced key framesPhilipp Zabel2017-06-073-4/+12
| | | | | | | | | | | | | Implement the V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME control to force IDR frames. This is useful to implement VFU (Video Fast Update) on RTP transmissions. We already force an IDR frame at the beginning of each GOP to work around a firmware bug on i.MX27, use the same mechanism to service IDR requests from userspace. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] coda: improve colorimetry handlingPhilipp Zabel2017-06-062-15/+39
| | | | | | | | | | | | | | The hardware codec is not colorspace aware. We should trust userspace to set the correct colorimetry information on the OUTPUT queue and mirror the exact same setting on the CAPTURE queue. There is no reason to restrict colorspace to JPEG or REC709 only. Also, set the default colorspace, as returned by calling VIDIOC_TRY/S_FMT with V4L2_COLORSPACE_DEFAULT, initially. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] coda: simplify optional reset handlingPhilipp Zabel2017-06-061-9/+3Star
| | | | | | | | | | | | | As of commit bb475230b8e5 ("reset: make optional functions really optional"), the reset framework API calls use NULL pointers to describe optional, non-present reset controls. This allows to return errors from devm_reset_control_get_optional without special cases and to call reset_control_reset unconditionally. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media: platform: coda: remove variable self assignmentGustavo A. R. Silva2017-06-061-1/+0Star
| | | | | | | | | | Remove variable self assignment. Addresses-Coverity-ID: 1408817 Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] coda: bump maximum number of internal framebuffers to 17Lucas Stach2017-04-191-1/+1
| | | | | | | | | | | | The h.264 standard allows up to 16 reference frame for the high profile and we need one additional internal framebuffer when the VDOA is in use. Lift the current maximum of 8 internal framebuffers to allow playback of those video streams. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Acked-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] coda: do not enumerate YUYV if VDOA is not availablePhilipp Zabel2017-04-101-0/+6
| | | | | | | | | | | | TRY_FMT already disables the YUYV format if the VDOA is not available. ENUM_FMT must do the same. Fixes: d40e98c13b3e ("[media] coda: support YUYV output if VDOA is used") Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Reviewed-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] coda: remove redundant call to v4l2_m2m_get_vqColin Ian King2017-04-101-2/+0Star
| | | | | | | | | | | | | The call to v4ls_m2m_get_vq is only used to get the return value which is not being used, so it appears to be redundant and can be removed. Detected with CoverityScan, CID#1420674 ("Useless call") Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] coda: fix warnings when compiling with 64 bitsMauro Carvalho Chehab2017-03-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | drivers/media/platform/coda/coda-common.c: In function ‘coda_alloc_aux_buf’: ./include/linux/kern_levels.h:4:18: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 4 has type ‘size_t {aka long unsigned int}’ [-Wformat=] #define KERN_SOH "\001" /* ASCII Start Of Header */ ^ ./include/media/v4l2-common.h:69:9: note: in definition of macro ‘v4l2_printk’ printk(level "%s: " fmt, (dev)->name , ## arg) ^~~~~ ./include/linux/kern_levels.h:10:18: note: in expansion of macro ‘KERN_SOH’ #define KERN_ERR KERN_SOH "3" /* error conditions */ ^~~~~~~~ ./include/media/v4l2-common.h:72:14: note: in expansion of macro ‘KERN_ERR’ v4l2_printk(KERN_ERR, dev, fmt , ## arg) ^~~~~~~~ drivers/media/platform/coda/coda-common.c:1341:3: note: in expansion of macro ‘v4l2_err’ v4l2_err(&dev->v4l2_dev, ^~~~~~~~ Hans wrote a similar patch, but it was fold with a Kconfig change. So, I opted to keep my version. Signed-off-by Hans Verkuil <hans.verkuil@cisco.com> Acked-by Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] coda: get rid of unused varMauro Carvalho Chehab2017-03-221-3/+1Star
| | | | | | | | | | | Some vars are not used, as warned by gcc: drivers/media/platform/coda/coda-common.c: In function 'coda_buf_is_end_of_stream': drivers/media/platform/coda/coda-common.c:816:20: warning: variable 'src_vq' set but not used [-Wunused-but-set-variable] struct vb2_queue *src_vq; ^~~~~~ Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] coda: restore original firmware locationsPhilipp Zabel2017-03-221-8/+13
| | | | | | | | | | | | | | | Recently, an unfinished patch was merged that added a third entry to the beginning of the array of firmware locations without changing the code to also look at the third element, thus pushing an old firmware location off the list. Fixes: 8af7779f3cbc ("[media] coda: add Freescale firmware compatibility location") Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Acked-by: Baruch Siach <baruch@tkos.co.il> Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] coda: disable reordering for baseline profile h.264 streamsPhilipp Zabel2017-03-224-2/+122
| | | | | | | | | | | | With reordering enabled, the sequence init in CODA960 firmware requests an unreasonable number of internal frames for some baseline profile streams. Disabling the reordering feature manually if baseline streams are detected fixes this problem. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] coda: pad first h.264 buffer to 512 bytesPhilipp Zabel2017-03-223-8/+45
| | | | | | | | | | The bitstream reader needs 512 bytes ready to read to examine the headers in the first frame. If that frame is too small, prepend it with a filler NAL. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] coda: keep queued buffers on a temporary list during start_streamingPhilipp Zabel2017-03-223-14/+45
| | | | | | | | | | | Keeping buffers filled into the bitstream on a temporary list instead of immediately calling vb2_buffer_done on each of them immediately allows start_streaming to correctly decide whether they should be marked as done or requeued if an error occurs after the bitstream has been filled. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] coda: Use && instead of & for non-bitfield conditionsMichael Tretter2017-03-221-1/+1
| | | | | | | | | | streamon and streamoff are used as boolean values, not as bitfields. Therefore, the logical && should be used to combine them. Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] coda: disable BWB for all codecs on CODA 960Philipp Zabel2017-03-222-1/+7
| | | | | | | | | | | | | | | | | | | I don't know what the BWB unit is, I guess W is for write and one of the Bs is for burst. All I know is that there repeatedly have been issues with it hanging on certain streams (ENGR00223231, ENGR00293425), with various firmware versions, sometimes blocking something related to the GDI bus or the GDI AXI adapter. There are some error cases that we don't know how to recover from without a reboot. Apparently this unit can be disabled by setting bit 12 in the FRAME_MEM_CTRL mailbox register to zero, so do that to avoid crashes. Side effects are reduced burst lengths when writing out decoded frames to memory, so there is an "enable_bwb" module parameter to turn it back on. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] coda: implement encoder stop commandPhilipp Zabel2017-03-221-0/+47
| | | | | | | | | | | There is no need to call v4l2_m2m_try_schedule to kick off draining the bitstream buffer for the encoder, but we have to wake up the destination queue in case there are no new OUTPUT buffers to be encoded and userspace is already polling for new CAPTURE buffers. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] coda/imx-vdoa: platform_driver should not be constArnd Bergmann2017-03-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | The device driver platform is actually written to during registration, for setting the owner field, so platform_driver_register() does not take a const pointer: drivers/media/platform/coda/imx-vdoa.c: In function 'vdoa_driver_init': drivers/media/platform/coda/imx-vdoa.c:333:213: error: passing argument 1 of '__platform_driver_register' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers] module_platform_driver(vdoa_driver); In file included from drivers/media/platform/coda/imx-vdoa.c:22:0: include/linux/platform_device.h:199:12: note: expected 'struct platform_driver *' but argument is of type 'const struct platform_driver *' extern int __platform_driver_register(struct platform_driver *, ^~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/media/platform/coda/imx-vdoa.c: In function 'vdoa_driver_exit': drivers/media/platform/coda/imx-vdoa.c:333:626: error: passing argument 1 of 'platform_driver_unregister' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers] Remove the modifier again. Fixes: d2fe28feaebb ("[media] coda/imx-vdoa: constify structs") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] coda/imx-vdoa: constify structsMauro Carvalho Chehab2017-02-081-2/+2
| | | | | | | | | | | | As warned by checkpatch: WARNING: struct of_device_id should normally be const #318: FILE: drivers/media/platform/coda/imx-vdoa.c:318: +static struct of_device_id vdoa_dt_ids[] = { So, constify structs. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] coda: add Freescale firmware compatibility locationBaruch Siach2017-02-032-1/+5
| | | | | | | | | | The Freescale provided imx-vpu looks for firmware files under /lib/firmware/vpu by default. Make coda look there for firmware files to ease the update path. Cc: Fabio Estevam <festevam@gmail.com> Signed-off-by: Baruch Siach <baruch@tkos.co.il> Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* Revert "[media] coda/imx-vdoa: constify structs"Mauro Carvalho Chehab2017-01-311-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Despite checkpatch comments, it seems that ARM doesn't like to use constified structs. As reported by kernel build robot: In file included from drivers/media/platform/coda/imx-vdoa.c:22:0: drivers/media/platform/coda/imx-vdoa.c: In function 'vdoa_driver_init': >> include/linux/device.h:1461:20: warning: passing argument 1 of '__platform_driver_register' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] return __register(&(__driver) , ##__VA_ARGS__); \ ^ include/linux/platform_device.h:198:29: note: in definition of macro 'platform_driver_register' __platform_driver_register(drv, THIS_MODULE) ^~~ include/linux/platform_device.h:228:2: note: in expansion of macro 'module_driver' module_driver(__platform_driver, platform_driver_register, \ ^~~~~~~~~~~~~ >> drivers/media/platform/coda/imx-vdoa.c:333:1: note: in expansion of macro 'module_platform_driver' module_platform_driver(vdoa_driver); ^~~~~~~~~~~~~~~~~~~~~~ include/linux/platform_device.h:199:12: note: expected 'struct platform_driver *' but argument is of type 'const struct platform_driver *' extern int __platform_driver_register(struct platform_driver *, ^~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from drivers/media/platform/coda/imx-vdoa.c:18:0: drivers/media/platform/coda/imx-vdoa.c: In function 'vdoa_driver_exit': >> include/linux/device.h:1466:15: warning: passing argument 1 of 'platform_driver_unregister' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] __unregister(&(__driver) , ##__VA_ARGS__); \ ^ include/linux/platform_device.h:228:2: note: in expansion of macro 'module_driver' module_driver(__platform_driver, platform_driver_register, \ ^~~~~~~~~~~~~ >> drivers/media/platform/coda/imx-vdoa.c:333:1: note: in expansion of macro 'module_platform_driver' module_platform_driver(vdoa_driver); ^~~~~~~~~~~~~~~~~~~~~~ In file included from drivers/media/platform/coda/imx-vdoa.c:22:0: include/linux/platform_device.h:201:13: note: expected 'struct platform_driver *' but argument is of type 'const struct platform_driver *' extern void platform_driver_unregister(struct platform_driver *); ^~~~~~~~~~~~~~~~~~~~~~~~~~ So, let's just remove it. This reverts commit 126f52b02e6ec6a25f0b32058a91648304922d4a. Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] coda: support YUYV output if VDOA is usedMichael Tretter2017-01-312-2/+35
| | | | | | | | | | | | | | | The VDOA is able to transform the NV12 custom macroblock tiled format of the CODA to YUYV format. If and only if the VDOA is available, the driver can also provide YUYV support. While the driver is configured to produce YUYV output, the CODA must be configured to produce NV12 macroblock tiled frames and the VDOA must transform the intermediate result into the final YUYV output. Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] coda: use VDOA for un-tiling custom macroblock formatMichael Tretter2017-01-313-30/+163
| | | | | | | | | | | | | | | If the CODA driver is configured to produce NV12 output and the VDOA is available, the VDOA can be used to transform the custom macroblock tiled format to a raster-ordered format for scanout. In this case, set the output format of the CODA to the custom macroblock tiled format, disable the rotator, and use the VDOA to write to the v4l2 buffer. The VDOA is synchronized with the CODA to always un-tile the frame that the CODA finished in the previous run. Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] coda: fix frame index to returned errorMichael Tretter2017-01-311-1/+1
| | | | | | | | | | | display_idx refers to the frame that will be returned in the next round. The currently processed frame is ctx->display_idx and errors should be reported for this frame. Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Acked-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] coda: add debug output about tilingPhilipp Zabel2017-01-311-2/+4
| | | | | | | | | | | | In order to make the VDOA work correctly, the CODA must produce frames in tiled format. Print this information in the debug output. Also print the color format in fourcc instead of the numeric value. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] coda: correctly set capture compose rectanglePhilipp Zabel2017-01-311-8/+29
| | | | | | | | | | | Correctly store the rectangle of valid video data in the destination q_data before rounding up to macroblock size. This fixes the output of VIDIOC_G_SELECTION for the capture side compose rectangle. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] coda/imx-vdoa: constify structsMauro Carvalho Chehab2017-01-311-2/+2
| | | | | | | | | | | | As warned by checkpatch: WARNING: struct of_device_id should normally be const #318: FILE: drivers/media/platform/coda/imx-vdoa.c:318: +static struct of_device_id vdoa_dt_ids[] = { So, constify structs. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>