aboutsummaryrefslogtreecommitdiff
path: root/drivers/media/platform/coda/coda-common.c
AgeCommit message (Collapse)AuthorFilesLines
2014-10-28[media] coda: add CODA7541 JPEG supportPhilipp Zabel1-18/+94
This patch adds JPEG encoding and decoding support for CODA7541, using the BIT processor. Separate JPEG encoder and decoder video devices are created due to different streaming behaviour and different supported pixel formats. The hardware can not change subsampling on the fly, but encode and decode 4:2:2 subsampled JPEG images from and into this format. The CODA7541 JPEG decoder uses the bitstream buffer and thus can run without new buffers queued if there is a buffer in the bitstream. Since there is no standard way to store the colorspace used in JPEGs, and to make v4l2-compliance happy, the JPEG format always reports V4L2_COLORSPACE_JPEG. Signed-off-by: Lucas Stach <[email protected]> Signed-off-by: Philipp Zabel <[email protected]> Signed-off-by: Kamil Debski <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2014-10-28[media] coda: split out encoder control setup to specify controls per video ↵Philipp Zabel1-7/+13
device This patch splits the encoder specific controls out of the main control setup function. This way each video device registers only relevant controls. Signed-off-by: Philipp Zabel <[email protected]> Signed-off-by: Kamil Debski <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2014-10-28[media] coda: add coda_video_device descriptorsPhilipp Zabel1-152/+198
Each video device descriptor determines the name, callback ops, and input and output formats on the corresponding video device. This simplifies coda_enum_fmt and coda_try_fmt a bit and will simplify adding separate video devices for JPEG codecs due to the slightly different behavior in the CodaDx6/CODA7542 case and a separate hardware unit on CODA960. Signed-off-by: Philipp Zabel <[email protected]> Signed-off-by: Kamil Debski <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2014-10-28[media] coda: identify platform device earlierPhilipp Zabel1-11/+9
We'll use this information to decide whether to request the JPEG IRQ later. Signed-off-by: Philipp Zabel <[email protected]> Signed-off-by: Kamil Debski <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2014-10-28[media] coda: add support for planar YCbCr 4:2:2 (YUV422P) formatPhilipp Zabel1-0/+13
This patch adds support for the three-plane YUV422P format with one luma plane and two horizontally subsampled chroma planes. Signed-off-by: Philipp Zabel <[email protected]> Signed-off-by: Kamil Debski <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2014-10-28[media] coda: add support for partial interleaved YCbCr 4:2:0 (NV12) formatPhilipp Zabel1-0/+8
This patch adds support for the two-plane NV12 format with one luma plane and one interleaved chroma plane. Signed-off-by: Philipp Zabel <[email protected]> Signed-off-by: Kamil Debski <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2014-10-28[media] coda: simplify frame memory control register handlingPhilipp Zabel1-1/+3
Since the firmware newer writes to FRAME_MEM_CTRL, we can initialize it once per context (incidentally, we already do write it in coda_hw_init) and never have to read it back. Signed-off-by: Philipp Zabel <[email protected]> Signed-off-by: Kamil Debski <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2014-10-28[media] coda: add coda_write_base helperPhilipp Zabel1-0/+24
Add a helper function that writes a vb2_buffer's Y, Cb, and Cr plane base addresses of into three consecutive registers. This moves common code out of coda-bit.c. Signed-off-by: Philipp Zabel <[email protected]> Signed-off-by: Kamil Debski <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2014-10-28[media] coda: remove superfluous error message on devm_kzalloc failurePhilipp Zabel1-4/+1
When devm_kzalloc causes an OOM condition, this is already reported by the MM subsystem. Signed-off-by: Philipp Zabel <[email protected]> Signed-off-by: Kamil Debski <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2014-10-28[media] coda: clear aborting flag in stop_streamingPhilipp Zabel1-1/+1
Clearing the aborting flag in stop_streaming is necessary if we want to start streaming again without having to closing and reopening the device. Also, do not explicitly set it in default_params; the context is zeroed by kzalloc anyway. Signed-off-by: Philipp Zabel <[email protected]> Signed-off-by: Kamil Debski <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2014-10-20media: platform: coda: drop owner assignment from platform_driversWolfram Sang1-1/+0
A platform_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by: Wolfram Sang <[email protected]>
2014-09-26[media] coda: Improve runtime PM supportUlf Hansson1-34/+21
For several reasons it's good practice to leave devices in runtime PM active state while those have been probed. In this cases we also want to prevent the device from going inactive, until the firmware has been completely installed, especially when using a PM domain. Signed-off-by: Ulf Hansson <[email protected]> Signed-off-by: Philipp Zabel <[email protected]> Signed-off-by: Kamil Debski <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2014-08-21[media] coda: checkpatch cleanupPhilipp Zabel1-11/+23
This patch breaks most long lines, concatenates broken up text strings, and adds or removes parentheses where needed to make checkpatch happy. The long codec list lines and a few 81-wide lines remain. Signed-off-by: Philipp Zabel <[email protected]> Signed-off-by: Kamil Debski <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2014-08-21[media] coda: disable old cropping ioctlsPhilipp Zabel1-0/+5
Since we neither support composing on the OUTPUT side, nor cropping on the CAPTURE side, disable VIDIOC_CROPCAP and VIDIOC_G/S_CROP altogether. This silences a GStreamer warning when GStreamer tries to obtain the pixel aspect ratio using VIDIOC_CROPCAP. Signed-off-by: Philipp Zabel <[email protected]> Signed-off-by: Kamil Debski <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2014-08-21[media] coda: set capture frame size with output S_FMTPhilipp Zabel1-1/+11
This patch makes coda_s_fmt_vid_out propagate the output frame size to the capture side. The GStreamer v4l2videodec only ever calls S_FMT on the output side and then expects G_FMT on the capture side to return a valid format. Signed-off-by: Philipp Zabel <[email protected]> Signed-off-by: Kamil Debski <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2014-08-21[media] coda: fix coda_s_fmt_vid_outPhilipp Zabel1-1/+3
Set the context color space when s_fmt succeeded, not when it failed. Signed-off-by: Philipp Zabel <[email protected]> Signed-off-by: Kamil Debski <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2014-08-21[media] coda: fix timestamp list handlingPhilipp Zabel1-0/+2
Lock modification of the timestamp list with bitstream_mutex and do not try to remove a timestamp element if the list is empty. This can happen if the userspace feeds us garbage or multiple encoded frames in a single buffer. Signed-off-by: Michael Olbrich <[email protected]> Signed-off-by: Philipp Zabel <[email protected]> Signed-off-by: Kamil Debski <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2014-08-21[media] coda: improve allocation error messagesPhilipp Zabel1-1/+5
Produce some error messages when internal buffer allocation fails, for example because the CMA region is too small. Signed-off-by: Philipp Zabel <[email protected]> Signed-off-by: Kamil Debski <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2014-08-21[media] coda: add an intermediate debug levelPhilipp Zabel1-3/+3
Dumping all register accesses drowns other debugging messages in the log. Add a less verbose debug level. Signed-off-by: Philipp Zabel <[email protected]> Signed-off-by: Kamil Debski <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2014-08-21[media] coda: increase max vertical frame size to 1088Philipp Zabel1-7/+6
This patch increases the maximum vertical frame size reported by enum_fmt and accepted by try_fmt/s_fmt from 1080 to 1088. Since for 16x16-pixel macroblocks 1080p will be rounded up to this anyway, we may as well admit that we support it. Signed-off-by: Philipp Zabel <[email protected]> Signed-off-by: Kamil Debski <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2014-08-21[media] coda: allow running coda without iram on mx6dlPhilipp Zabel1-7/+7
Signed-off-by: Philipp Zabel <[email protected]> Signed-off-by: Kamil Debski <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2014-08-21[media] coda: skip calling coda_find_codec in encoder try_fmt_vid_outPhilipp Zabel1-5/+6
We know that it will return NULL in this case, so we can just as well skip it altogether. Signed-off-by: Philipp Zabel <[email protected]> Signed-off-by: Kamil Debski <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2014-08-21[media] coda: dequeue buffers on streamoffPhilipp Zabel1-0/+8
This is needed to decrease the q->owned_by_drv_count to zero before __vb2_queue_cancel is called, to avoid the WARN_ON therein. Signed-off-by: Philipp Zabel <[email protected]> Signed-off-by: Kamil Debski <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2014-08-21[media] coda: dequeue buffers if start_streaming failsPhilipp Zabel1-8/+26
Signed-off-by: Philipp Zabel <[email protected]> Signed-off-by: Kamil Debski <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2014-08-21[media] coda: request BIT processor interrupt by namePhilipp Zabel1-1/+3
Request the main coda interrupt using its name, "bit", if available. Fall back to requesting the first interrupt for backwards compatibility. Signed-off-by: Philipp Zabel <[email protected]> Signed-off-by: Kamil Debski <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2014-08-21[media] coda: move BIT specific functions into separate filePhilipp Zabel1-1818/+13
This patch moves the BIT processor specific coda_context_ops, the firmware upload and other related functions from coda-common.c into coda-bit.c. Signed-off-by: Philipp Zabel <[email protected]> Signed-off-by: Kamil Debski <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2014-08-21[media] coda: move H.264 helper function into separate filePhilipp Zabel1-22/+0
Currently there is only the coda_h264_padding function, but we will have to add more H.264 specific helpers later. Signed-off-by: Philipp Zabel <[email protected]> Signed-off-by: Kamil Debski <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2014-08-21[media] coda: move per-instance buffer allocation and cleanupPhilipp Zabel1-10/+21
This patch moves the context buffer allocation into the context start_streaming callbacks. The context buffer and internal framebuffer cleanup is moved into the context release callback. Signed-off-by: Philipp Zabel <[email protected]> Signed-off-by: Kamil Debski <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2014-08-21[media] coda: add coda_bit_stream_set_flag helperPhilipp Zabel1-33/+19
This adds a helper function to consolidate three occurences where the bitstream parameter stream end flag is set during operation. Signed-off-by: Philipp Zabel <[email protected]> Signed-off-by: Kamil Debski <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2014-08-21[media] coda: move BIT processor command execution out of pic_run_workPhilipp Zabel1-8/+13
In preparation for the split, move the AXI_SRAM_USE register access and the PIC_RUN command execution out of pic_run_work into prepare_encode/decode. Signed-off-by: Philipp Zabel <[email protected]> Signed-off-by: Kamil Debski <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2014-08-21[media] coda: add context opsPhilipp Zabel1-35/+50
Add a struct coda_context_ops that encapsulates context specific operations. This will simplify adding JPEG support in the future and helps to avoid exporting all functions individually when they move out of the main code file. Signed-off-by: Philipp Zabel <[email protected]> Signed-off-by: Kamil Debski <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2014-08-21[media] coda: move defines, enums, and structs into shared headerPhilipp Zabel1-190/+3
These will have to be shared between multiple code files. Signed-off-by: Philipp Zabel <[email protected]> Signed-off-by: Kamil Debski <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2014-08-21[media] coda: move coda driver into its own directoryPhilipp Zabel1-0/+3999
The coda driver has grown significantly and will continue to grow. Move the coda driver into its own directory so it can be split. Rename coda.h to coda_regs.h as it contains the register defines. Signed-off-by: Philipp Zabel <[email protected]> Signed-off-by: Kamil Debski <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>