aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/coda (follow)
AgeCommit message (Collapse)AuthorFilesLines
2017-08-20media: coda/imx-vdoa: Check for platform_get_resource() errorFabio Estevam1-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>
2017-08-20media: coda: constify platform_device_idArvind Yadav1-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>
2017-08-08media: coda: reduce iram size to leave space for suspend to ramJan Luebbe1-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>
2017-08-08media: coda: fix decoder sequence init escape flagPhilipp Zabel1-8/+5
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>
2017-07-26media: coda: explicitly request exclusive reset controlPhilipp Zabel1-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>
2017-07-26media: coda: disable BWB only while decoding on CODA 960Philipp Zabel1-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>
2017-07-19media: coda: wake up capture queue on encoder stop after output streamoffPhilipp Zabel1-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>
2017-07-19media: coda: mark CODA960 firmware versions 2.3.10 and 3.1.1 as supportedPhilipp Zabel1-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>
2017-07-19media: coda: set MPEG-4 encoder class registerPhilipp Zabel2-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>
2017-07-19media: coda: align internal mpeg4 framebuffers to 16x16 macroblocksPhilipp Zabel1-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>
2017-07-19media: coda: set field of destination buffersPhilipp Zabel1-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>
2017-07-19media: coda: extend GOP size rangePhilipp Zabel2-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>
2017-07-19media: coda: do not reassign ctx->tiled_map_type in coda_s_fmtPhilipp Zabel1-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>
2017-07-19media: coda: add h264 and mpeg4 profile and level controlsPhilipp Zabel1-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>
2017-06-24media: coda: rename the picture run timeout error handlerPhilipp Zabel3-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>
2017-06-24media: coda: ctx->codec is not NULL in coda_alloc_framebuffersPhilipp Zabel1-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>
2017-06-20[media] coda/imx-vdoa: always wait for job completionLucas Stach1-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>
2017-06-20[media] coda: first step at error recoveryLucas Stach3-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>
2017-06-20[media] coda: use correct offset for mvcol bufferLucas Stach1-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>
2017-06-07[media] coda: copy headers in front of every I-framePhilipp Zabel1-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>
2017-06-07[media] coda: implement forced key framesPhilipp Zabel3-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>
2017-06-06[media] coda: improve colorimetry handlingPhilipp Zabel2-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>
2017-06-06[media] coda: simplify optional reset handlingPhilipp Zabel1-9/+3
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>
2017-06-06[media] media: platform: coda: remove variable self assignmentGustavo A. R. Silva1-1/+0
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>
2017-04-19[media] coda: bump maximum number of internal framebuffers to 17Lucas Stach1-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>
2017-04-10[media] coda: do not enumerate YUYV if VDOA is not availablePhilipp Zabel1-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>
2017-04-10[media] coda: remove redundant call to v4l2_m2m_get_vqColin Ian King1-2/+0
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>
2017-03-22[media] coda: fix warnings when compiling with 64 bitsMauro Carvalho Chehab1-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>
2017-03-22[media] coda: get rid of unused varMauro Carvalho Chehab1-3/+1
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>
2017-03-22[media] coda: restore original firmware locationsPhilipp Zabel1-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>
2017-03-22[media] coda: disable reordering for baseline profile h.264 streamsPhilipp Zabel4-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>
2017-03-22[media] coda: pad first h.264 buffer to 512 bytesPhilipp Zabel3-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>
2017-03-22[media] coda: keep queued buffers on a temporary list during start_streamingPhilipp Zabel3-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>
2017-03-22[media] coda: Use && instead of & for non-bitfield conditionsMichael Tretter1-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>
2017-03-22[media] coda: disable BWB for all codecs on CODA 960Philipp Zabel2-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>
2017-03-22[media] coda: implement encoder stop commandPhilipp Zabel1-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>
2017-03-03[media] coda/imx-vdoa: platform_driver should not be constArnd Bergmann1-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>
2017-02-08[media] coda/imx-vdoa: constify structsMauro Carvalho Chehab1-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>
2017-02-03[media] coda: add Freescale firmware compatibility locationBaruch Siach2-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>
2017-01-31Revert "[media] coda/imx-vdoa: constify structs"Mauro Carvalho Chehab1-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>
2017-01-31[media] coda: support YUYV output if VDOA is usedMichael Tretter2-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>
2017-01-31[media] coda: use VDOA for un-tiling custom macroblock formatMichael Tretter3-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>
2017-01-31[media] coda: fix frame index to returned errorMichael Tretter1-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>
2017-01-31[media] coda: add debug output about tilingPhilipp Zabel1-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>
2017-01-31[media] coda: correctly set capture compose rectanglePhilipp Zabel1-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>
2017-01-31[media] coda/imx-vdoa: constify structsMauro Carvalho Chehab1-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>
2017-01-31[media] coda: add i.MX6 VDOA driverPhilipp Zabel3-0/+397
The i.MX6 Video Data Order Adapter's (VDOA) sole purpose is to convert from a custom macroblock tiled format produced by the CODA960 decoder into linear formats that can be used for scanout. Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com> 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>
2016-10-24[media] coda: fix the error path in coda_probe()Fabio Estevam1-1/+6
In the case of coda_firmware_request() failure, we should release the prevously acquired resources. Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-10-24[media] coda: add missing header dependenciesBaoyou Xie1-0/+1
We get 1 warning when building kernel with W=1: drivers/media/platform/coda/coda-h264.c:22:5: warning: no previous prototype for 'coda_h264_padding' [-Wmissing-prototypes] In fact, this function is declared in coda.h, so this patch add missing header dependencies. Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
2016-07-08[media] media: coda: Fix probe() if reset controller is missingAlexander Shiyan1-1/+1
Commit 39b4da71ca33 ("reset: use ENOTSUPP instead of ENOSYS") changed return value for reset controller if it missing. This patch changes the CODA driver to handle this value. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>