summaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/s5p-jpeg
Commit message (Collapse)AuthorAgeFilesLines
* media: platform: fix several typosMauro Carvalho Chehab2019-03-011-2/+2
| | | | | | | | | | | | | | | | Use codespell to fix lots of typos over frontends. Manually verified to avoid false-positives. Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Acked-by: Andrzej Pietrasiewicz <andrzejtp2010@gmail.com> Reviewed-by: Benoit Parrot <bparrot@ti.com> Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> Reviewed-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Acked-by: Philipp Zabel <p.zabel@pengutronix.de> Reviewed-by: Houlong Wei <houlong.wei@mediatek.com> Reviewed-by: Yong Deng <yong.deng@magewell.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
* media: s5p-jpeg: Correct return type for mem2mem buffer helpersEzequiel Garcia2019-02-181-19/+19
| | | | | | | | | | | | | | | | | | | | | | | | | Fix the assigned type of mem2mem buffer handling API. Namely, these functions: v4l2_m2m_next_buf v4l2_m2m_last_buf v4l2_m2m_buf_remove v4l2_m2m_next_src_buf v4l2_m2m_next_dst_buf v4l2_m2m_last_src_buf v4l2_m2m_last_dst_buf v4l2_m2m_src_buf_remove v4l2_m2m_dst_buf_remove return a struct vb2_v4l2_buffer, and not a struct vb2_buffer. Fixing this is necessary to fix the mem2mem buffer handling API, changing the return to the correct struct vb2_v4l2_buffer instead of a void pointer. Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
* media: s5p-jpeg: Correct step and max values for V4L2_CID_JPEG_RESTART_INTERVALPawe? Chmiel2019-01-161-1/+1
| | | | | | | | | | | | | | | | | This commit corrects max and step values for v4l2 control for V4L2_CID_JPEG_RESTART_INTERVAL. Max should be 0xffff and step should be 1. It was found by using v4l2-compliance tool and checking result of VIDIOC_QUERY_EXT_CTRL/QUERYMENU test. Previously it was complaining that step was bigger than difference between max and min. Fixes: 15f4bc3b1f42 ("[media] s5p-jpeg: Add JPEG controls support") Signed-off-by: Pawe? Chmiel <pawel.mikolaj.chmiel@gmail.com> Reviewed-by: Jacek Anaszewski <jacek.anaszewski@gmail.com> Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
* media: s5p-jpeg: Check for fmt_ver_flag when doing fmt enumerationPawe? Chmiel2019-01-161-8/+11
| | | | | | | | | | | | | | | | | | | | | Previously when doing format enumeration, it was returning all formats supported by driver, even if they're not supported by hw. Add missing check for fmt_ver_flag, so it'll be fixed and only those supported by hw will be returned. Similar thing is already done in s5p_jpeg_find_format. It was found by using v4l2-compliance tool and checking result of VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS test and using v4l2-ctl to get list of all supported formats. Tested on s5pv210-galaxys (Samsung i9000 phone). Fixes: bb677f3ac434 ("[media] Exynos4 JPEG codec v4l2 driver") Signed-off-by: Pawe? Chmiel <pawel.mikolaj.chmiel@gmail.com> Reviewed-by: Jacek Anaszewski <jacek.anaszewski@gmail.com> [hverkuil-cisco@xs4all.nl: fix a few alignment issues] Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
* media: Change Andrzej Pietrasiewicz's e-mail addressAndrzej Pietrasiewicz2019-01-165-6/+6
| | | | | | | | My @samsung.com address is going to cease existing soon, so change it to an address which can actually be used to contact me. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
* media: use strscpy() instead of strlcpy()Mauro Carvalho Chehab2018-09-111-5/+5
| | | | | | | | | | | The implementation of strscpy() is more robust and safer. That's now the recommended way to copy NUL terminated strings. Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Reviewed-by: Kees Cook <keescook@chromium.org> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
* media: mem2mem: Make .job_abort optionalEzequiel Garcia2018-07-241-7/+0Star
| | | | | | | | | | | | | | Implementing job_abort() does not make sense on some drivers. This is not a problem, as the abort is not required to wait for the job to finish. Quite the opposite, drivers are encouraged not to wait. Demote v4l2_m2m_ops.job_abort from required to optional, and clean all drivers with dummy implementations. 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>
* media: s5p-jpeg: don't return a value on a void functionMauro Carvalho Chehab2018-05-041-2/+2
| | | | | | | | | | Building this driver on arm64 gives this warning: drivers/media/platform/s5p-jpeg/jpeg-hw-exynos3250.c:430:16: error: return expression in void function Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Reviewed-by: Jacek Anaszewski <jacek.anaszewski@gmail.com> Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
* media: s5p-jpeg: Fix off-by-one problemFlavio Ceolin2017-12-181-1/+1
| | | | | | | | | | | | s5p_jpeg_runtime_resume() does not call clk_disable_unprepare() for jpeg->clocks[0] when one of the clk_prepare_enable() fails. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com> Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: s5p-jpeg: directly use parsed subsampling on exynos5433Andrzej Pietrasiewicz2017-08-201-1/+2
| | | | | | | | | | On exynos5433 variant JPEG data is parsed by hardware only from SOS marker, so subsampling is parsed by software. As such, its value need not to be translated from hardware-specific encoding to V4L2 encoding. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: s5p-jpeg: fix number of components macroAndrzej Pietrasiewicz2017-08-201-1/+1
| | | | | | | | | | | The value to be processed must be first masked and then shifted, not the other way round. Fixes: 6c96dbbc2aa9f5b4a ("[media] s5p-jpeg: add support for 5433") Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: s5p-jpeg: Clear JPEG_CODEC_ON bits in sw reset functionTony K Nadackal2017-08-201-0/+4
| | | | | | | | | | | | | | | | Bits EXYNOS4_DEC_MODE and EXYNOS4_ENC_MODE do not get cleared on software reset. These bits need to be cleared explicitly. Even though the bits in question are already cleared in interrupt service routine, the reset should also clear them in case when e.g. bootloader uses the codec and leaves it in a bad state. [Updated commit message] Signed-off-by: Tony K Nadackal <tony.kn@samsung.com> Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: s5p-jpeg: disable encoder/decoder in exynos4-like hardware after useAndrzej Pietrasiewicz2017-08-203-1/+7
| | | | | | | | | | | Clearing the bits turns off the encoder/decoder. If the hardware is not turned off after use, at subsequent uses it does not work in a stable manner, resulting in incorrect interrupt status value being read and e.g. erroneous read of compressed bitstream size. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: s5p-jpeg: Fix crash in jpeg isr due to multiple interruptsTony K Nadackal2017-08-201-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In case of corrupt images, multiple interrupts may occur due to different error scenarios. Since we are removing the src and dest buffers in the first interrupt itself, crash occurs in the second error interrupts. Disable the global interrupt before we start processing the interrupt to avoid the crash. Disable System interrupt in isr to avoid the crash below. Unable to handle kernel NULL pointer dereference at virtual address 000000c8 pgd = ffffffc0007db000 [000000c8] *pgd=00000000fb006003, *pud=00000000fb006003, *pmd=00000000fb007003, *pte=0060000011001707 Internal error: Oops: 96000007 [#1] PREEMPT SMP Modules linked in: CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.18.0-next-20141210+ #22 Hardware name: Samsung Exynos7 Espresso board based on EXYNOS7 (DT) task: ffffffc00075e5c0 ti: ffffffc00074c000 task.ti: ffffffc00074c000 PC is at exynos4_jpeg_irq+0x30/0x15c LR is at exynos4_jpeg_irq+0x2c/0x15c pc : [<ffffffc00040873c>] lr : [<ffffffc000408738>] pstate: 800001c5 sp : ffffffc00074fc60 x29: ffffffc00074fc60 x28: 0000004040000000 x27: ffffffc000673928 x26: ffffffc000673940 x25: ffffffc0007a030c x24: ffffffc0bb20a400 x23: 0000000000000030 x22: ffffffc0ba56ba40 x21: 0000000000000000 x20: 0000000000000000 x19: ffffffc0ba56ba18 x18: 0000000000000000 x17: 0000000000000000 x16: ffffffc00018b508 x15: 0000000000000000 x14: 0000000000000000 x13: 0098968000000000 x12: 0000000000989680 x11: 0000000000000004 x10: 0101010101010101 x9 : 00000020a285a9ea x8 : ffffffc0007af880 x7 : ffffffc0bac001a8 x6 : ffffffc0bac00000 x5 : 00000000fffffffa x4 : ffffffc00040870c x3 : 0000000000000003 x2 : 0000000000010003 x1 : 0000000000010002 x0 : 0000000000000000 Process swapper/0 (pid: 0, stack limit = 0xffffffc00074c058) Stack: (0xffffffc00074fc60 to 0xffffffc000750000) fc60: 0074fca0 ffffffc0 000e4508 ffffffc0 bb225300 ffffffc0 bb20a494 ffffffc0 fc80: 00000000 00000000 00000000 00000000 00000030 00000000 000f8c6c ffffffc0 fca0: 0074fd00 ffffffc0 000e4644 ffffffc0 bb20a400 ffffffc0 bb20a494 ffffffc0 fcc0: 00776a00 ffffffc0 00670da8 ffffffc0 00000000 00000000 00000001 00000000 fce0: bb008000 ffffffc0 407db000 00000000 00081230 ffffffc0 000e4638 ffffffc0 fd00: 0074fd40 ffffffc0 000e7338 ffffffc0 bb20a400 ffffffc0 bb20a494 ffffffc0 fd20: 00776a00 ffffffc0 000e7280 ffffffc0 bb225300 ffffffc0 000e72e0 ffffffc0 fd40: 0074fd70 ffffffc0 000e3d60 ffffffc0 00000030 00000000 00743000 ffffffc0 fd60: 0066e000 ffffffc0 006c2000 ffffffc0 0074fd90 ffffffc0 000e3e90 ffffffc0 fd80: 007437c8 ffffffc0 000e3e6c ffffffc0 0074fdf0 ffffffc0 00082404 ffffffc0 fda0: 0074fe20 ffffffc0 0075a000 ffffffc0 0000200c ffffff80 00002010 ffffff80 fdc0: 60000145 00000000 00672cc8 ffffffc0 407d9000 00000000 befb9b40 ffffffc0 fde0: 0074fe20 ffffffc0 000001d2 00000000 0074ff40 ffffffc0 00085da8 ffffffc0 fe00: 00758584 ffffffc0 0052c000 ffffffc0 0074ff40 ffffffc0 00087114 ffffffc0 fe20: 00000000 00000000 0074ff50 ffffffc0 0067d760 ffffffc0 befb9adc ffffffc0 fe40: 00000001 00000000 d4414200 00000020 d6a39c00 00000020 007a6a18 ffffffc0 fe60: 0075eb00 ffffffc0 0074fd60 ffffffc0 ffffc185 00000000 00000020 00000000 fe80: 0052d340 ffffffc0 00000030 00000000 fffffffe 0fffffff 00000000 00000000 fea0: 0018b508 ffffffc0 00000000 00000000 00000000 00000000 00758584 ffffffc0 fec0: 0052c000 ffffffc0 006c24e8 ffffffc0 007a030a ffffffc0 00000001 00000000 fee0: 00672cc8 ffffffc0 407d9000 00000000 407db000 00000000 00081230 ffffffc0 ff00: 40000000 00000040 0074ff40 ffffffc0 00087110 ffffffc0 0074ff40 ffffffc0 ff20: 00087114 ffffffc0 60000145 00000000 00758584 ffffffc0 0052c000 ffffffc0 ff40: 0074ff50 ffffffc0 000db568 ffffffc0 0074ff90 ffffffc0 00515fdc ffffffc0 ff60: 00758000 ffffffc0 007a3000 ffffffc0 007a3000 ffffffc0 befc8940 ffffffc0 ff80: 40760000 00000000 40000000 00000000 0074ffb0 ffffffc0 006ff998 ffffffc0 ffa0: 00000002 00000000 006ff988 ffffffc0 00000000 00000000 400826c0 00000000 ffc0: 8f03a688 00000000 00000e11 00000000 48000000 00000000 410fd030 00000000 ffe0: 0072c250 ffffffc0 00000000 00000000 00000000 00000000 00000000 00000000 Call trace: [<ffffffc00040873c>] exynos4_jpeg_irq+0x30/0x15c [<ffffffc0000e4504>] handle_irq_event_percpu+0x6c/0x160 [<ffffffc0000e4640>] handle_irq_event+0x48/0x78 [<ffffffc0000e7334>] handle_fasteoi_irq+0xe0/0x198 [<ffffffc0000e3d5c>] generic_handle_irq+0x24/0x40 [<ffffffc0000e3e8c>] __handle_domain_irq+0x80/0xf0 [<ffffffc000082400>] gic_handle_irq+0x30/0x80 Exception stack(0xffffffc00074fe00 to 0xffffffc00074ff20) fe00: 00758584 ffffffc0 0052c000 ffffffc0 0074ff40 ffffffc0 00087114 ffffffc0 fe20: 00000000 00000000 0074ff50 ffffffc0 0067d760 ffffffc0 befb9adc ffffffc0 fe40: 00000001 00000000 d4414200 00000020 d6a39c00 00000020 007a6a18 ffffffc0 fe60: 0075eb00 ffffffc0 0074fd60 ffffffc0 ffffc185 00000000 00000020 00000000 fe80: 0052d340 ffffffc0 00000030 00000000 fffffffe 0fffffff 00000000 00000000 fea0: 0018b508 ffffffc0 00000000 00000000 00000000 00000000 00758584 ffffffc0 fec0: 0052c000 ffffffc0 006c24e8 ffffffc0 007a030a ffffffc0 00000001 00000000 fee0: 00672cc8 ffffffc0 407d9000 00000000 407db000 00000000 00081230 ffffffc0 ff00: 40000000 00000040 0074ff40 ffffffc0 00087110 ffffffc0 0074ff40 ffffffc0 [<ffffffc000085da4>] el1_irq+0x64/0xd8 [<ffffffc0000db564>] cpu_startup_entry+0x118/0x168 [<ffffffc000515fd8>] rest_init+0x7c/0x88 [<ffffffc0006ff994>] start_kernel+0x3a8/0x3bc Code: 94045c34 f9406e60 97ffdc74 aa0003f4 (f9406400) ---[ end trace fa6dc0ea2efad21f ]--- Kernel panic - not syncing: Fatal exception in interrupt ---[ end Kernel panic - not syncing: Fatal exception in interrupt Signed-off-by: Tony K Nadackal <tony.kn@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: s5p-jpeg: set w/h when encodingAndrzej Pietrasiewicz2017-08-201-2/+6
| | | | | | | | | | q_data w/h must be set when encoding. Fixes: 1c84e7f9d5dc596be (media: s5p-jpeg: Add support for resolution change event) Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: s5p-jpeg: don't overwrite result's "size" memberAndrzej Pietrasiewicz2017-08-201-1/+1
| | | | | | | | | | | | | | | Originally the "size" member was modified in a local variable passed to s5p_jpeg_parse_hdr() but the member was not used by the caller, so it did not matter. After applying patch "media: s5p-jpeg: Don't use temporary structure in s5p_jpeg_buf_queue" the unnecessary assignment started overwriting already assigned "size" member of the passed structure with an incorrect value. Fixes: 14a2de14dc0619bf9 ("media: s5p-jpeg: Don't use temporary structure in s5p_jpeg_buf_queue") Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: s5p-jpeg: Add stream error handling for Exynos5420henryhsu2017-07-261-1/+8
| | | | | | | | | | | | | | | On Exynos5420, the STREAM_STAT bit raised on the JPGINTST register means there is a syntax error or an unrecoverable error on compressed file when ERR_INT_EN is set to 1. Fix this case and report BUF_STATE_ERROR to videobuf2. Signed-off-by: Henry-Ruey Hsu <henryhsu@chromium.org> Signed-off-by: Thierry Escande <thierry.escande@collabora.com> Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: s5p-jpeg: Add support for resolution change eventhenryhsu2017-07-262-24/+89
| | | | | | | | | | | | | | | | This patch adds support for resolution change event to notify clients so they can prepare correct output buffer. When resolution change happened, G_FMT for CAPTURE should return old resolution and format before CAPTURE queues streamoff. This event is used in the Chromium browser project by the V4L2 JPEG Decode Accelerator (V4L2JDA) to allocate output buffer. Signed-off-by: Henry-Ruey Hsu <henryhsu@chromium.org> Signed-off-by: Thierry Escande <thierry.escande@collabora.com> Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: s5p-jpeg: Decode 4:1:1 chroma subsampling formatTony K Nadackal2017-07-261-0/+15
| | | | | | | | | | | | This patch adds support for decoding 4:1:1 chroma subsampling in the JPEG header parsing function. Signed-off-by: Tony K Nadackal <tony.kn@samsung.com> Signed-off-by: Thierry Escande <thierry.escande@collabora.com> Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: s5p-jpeg: Split s5p_jpeg_parse_hdr()Thierry Escande2017-07-261-18/+24
| | | | | | | | | | | | | This patch moves the subsampling value decoding read from the JPEG header into its own function. This new function is called s5p_jpeg_subsampling_decode() and returns true if it successfully decodes the subsampling value, false otherwise. Signed-off-by: Thierry Escande <thierry.escande@collabora.com> Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: s5p-jpeg: Don't use temporary structure in s5p_jpeg_buf_queueThierry Escande2017-07-261-19/+4Star
| | | | | | | | | | | | If s5p_jpeg_parse_hdr() fails to parse the JPEG header, the passed s5p_jpeg_q_data structure is not modified so there is no need to use a temporary structure and the field-by-field copy can be avoided. Signed-off-by: Thierry Escande <thierry.escande@collabora.com> Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: s5p-jpeg: Handle parsing error in s5p_jpeg_parse_hdr()Thierry Escande2017-07-261-17/+21
| | | | | | | | | | | | This patch modifies the s5p_jpeg_parse_hdr() function so it only modifies the passed s5p_jpeg_q_data structure if the jpeg header parsing is successful. Signed-off-by: Thierry Escande <thierry.escande@collabora.com> Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: s5p-jpeg: Correct WARN_ON statement for checking subsamplingTony K Nadackal2017-07-261-2/+4
| | | | | | | | | | | | Correct the WARN_ON statement for subsampling based on the JPEG hardware version. Signed-off-by: Tony K Nadackal <tony.kn@samsung.com> Signed-off-by: Thierry Escande <thierry.escande@collabora.com> Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: s5p-jpeg: Call jpeg_bound_align_image after qbufTony K Nadackal2017-07-261-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | When queuing an OUTPUT buffer for decoder, s5p_jpeg_parse_hdr() function parses the input jpeg file and takes the width and height parameters from its header. These new width/height values will be used for the calculation of stride. HX_JPEG Hardware needs the width and height values aligned on a 16 bits boundary. This width/height alignment is handled in the s5p_jpeg_s_fmt_vid_cap() function during the S_FMT ioctl call. But if user space calls the QBUF of OUTPUT buffer after the S_FMT of CAPTURE buffer, these aligned values will be replaced by the values in jpeg header. If the width/height values of jpeg are not aligned, the decoder output will be corrupted. So in this patch we call jpeg_bound_align_image() to align the width/height values of Capture buffer in s5p_jpeg_buf_queue(). Signed-off-by: Tony K Nadackal <tony.kn@samsung.com> Signed-off-by: Thierry Escande <thierry.escande@collabora.com> Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] s5p-jpeg: fix recursive spinlock acquisitionAlexandre Courbot2017-06-131-3/+9
| | | | | | | | | | | | | | | | v4l2_m2m_job_finish(), which is called from the interrupt handler with slock acquired, can call the device_run() hook immediately if another context was in the queue. This hook also acquires slock, resulting in a deadlock for this scenario. Fix this by releasing slock right before calling v4l2_m2m_job_finish(). This is safe to do as the state of the hardware cannot change before v4l2_m2m_job_finish() is called anyway. Signed-off-by: Alexandre Courbot <acourbot@chromium.org> Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] s5p-jpeg: don't return a random width/heightMauro Carvalho Chehab2017-05-191-4/+4
| | | | | | | | | | | | | | | | | | | Gcc 7.1 complains about: drivers/media/platform/s5p-jpeg/jpeg-core.c: In function 's5p_jpeg_parse_hdr.isra.9': drivers/media/platform/s5p-jpeg/jpeg-core.c:1207:12: warning: 'width' may be used uninitialized in this function [-Wmaybe-uninitialized] result->w = width; ~~~~~~~~~~^~~~~~~ drivers/media/platform/s5p-jpeg/jpeg-core.c:1208:12: warning: 'height' may be used uninitialized in this function [-Wmaybe-uninitialized] result->h = height; ~~~~~~~~~~^~~~~~~~ Indeed the code would allow it to return a random value (although it shouldn't happen, in practice). So, explicitly set both to zero, just in case. Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] squash lines for simple wrapper functionsMasahiro Yamada2016-11-161-14/+3Star
| | | | | | | | Remove unneeded variables and assignments. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] s5p-jpeg: fix system and runtime PM integrationMarek Szyprowski2016-09-221-19/+2Star
| | | | | | | | | Use generic helpers instead of open-coding usage of runtime PM for system sleep PM, which was potentially broken for some corner cases. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] platform: constify vb2_ops structuresJulia Lawall2016-09-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Check for vb2_ops structures that are only stored in the ops field of a vb2_queue structure. That field is declared const, so vb2_ops structures that have this property can be declared as const also. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @r disable optional_qualifier@ identifier i; position p; @@ static struct vb2_ops i@p = { ... }; @ok@ identifier r.i; struct vb2_queue e; position p; @@ e.ops = &i@p; @bad@ position p != {r.p,ok.p}; identifier r.i; struct vb2_ops e; @@ e@i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct vb2_ops i = { ... }; // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Fabien Dessenne <fabien.dessenne@st.com> Reviewed-by: Jacek Anaszewski <j.anaszewski@samsung.com> Reviewed-by: Benoit Parrot <bparrot@ti.com> [hans.verkuil@cisco.com: dropped soc_camera/rcar_vin.c patch because that driver will be removed] Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media: s5p-jpeg add missing blank lines after declarationsShuah Khan2016-08-241-3/+10
| | | | | | | | | | Missing blank lines after declarations are making it hard to read the code. Fix them and also fix other checkpatch warnings at the same time. Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com> Acked-by: Jacek Anaszewski <j.anaszewski@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] s5p-jpeg: only fill driver's name in capabilities driver fieldJavier Martinez Canillas2016-08-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | The driver fills in both the struct v4l2_capability driver and card fields the same values, that is the driver's name plus the information if the dev is a decoder or an encoder. But the driver field has a fixed length of 16 bytes so the filled data is truncated: Driver Info (not using libv4l2): Driver name : s5p-jpeg decode Card type : s5p-jpeg decoder Bus info : platform:11f50000.jpeg Driver version: 4.7.0 Also, this field should only contain the driver's name so use just that. The information if the device is a decoder or an encoder is in the card type field anyways. Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Acked-by: Jacek Anaszewski <j.anaszewski@samsung.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Reviewed-by: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] s5p-jpeg: set capablity bus_info as required by VIDIOC_QUERYCAPJavier Martinez Canillas2016-08-241-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | The driver doesn't set the struct v4l2_capability cap_info field so the v4l2-compliance tool reports the following errors for VIDIOC_QUERYCAP: Required ioctls: VIDIOC_QUERYCAP returned 0 (Success) fail: v4l2-compliance.cpp(304): string empty fail: v4l2-compliance.cpp(528): check_ustring(vcap.bus_info, sizeof(vcap.bus_info)) test VIDIOC_QUERYCAP: FAIL This patch fixes by setting the field in VIDIOC_QUERYCAP ioctl handler: Required ioctls: VIDIOC_QUERYCAP returned 0 (Success) test VIDIOC_QUERYCAP: OK Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Acked-by: Jacek Anaszewski <j.anaszewski@samsung.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Reviewed-by: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] vb2: replace void *alloc_ctxs by struct device *alloc_devsHans Verkuil2016-07-081-1/+1
| | | | | | | | | | | | | | | | Make this a proper typed array. Drop the old allocate context code since that is no longer used. Note that the memops functions now get a struct device pointer instead of the struct device ** that was there initially (actually a void pointer to a struct containing only a struct device pointer). This code is now a lot cleaner. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Cc: Sakari Ailus <sakari.ailus@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media/platform: convert drivers to use the new vb2_queue dev fieldHans Verkuil2016-07-082-15/+4Star
| | | | | | | | | Stop using alloc_ctx and just fill in the device pointer. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Cc: Kyungmin Park <kyungmin.park@samsung.com> Cc: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: set proper max seg size for devices on Exynos SoCsMarek Szyprowski2016-06-031-0/+2
| | | | | | | | | All multimedia devices found on Exynos SoCs support only contiguous buffers, so set DMA max segment size to DMA_BIT_MASK(32) to let memory allocator to correctly create contiguous memory mappings. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
* [media] s5p-jpeg: Adjust buffer size for Exynos 4412Andrzej Pietrasiewicz2016-04-131-1/+6
| | | | | | | | | | | Eliminate iommu fault during encoding by adjusting image size used for buffer size computation and ensuring that the buffer is not overrun. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] media: videobuf2: Move timestamp to vb2_bufferJunghak Sung2015-12-181-2/+2
| | | | | | | | | | | | | | Move timestamp from struct vb2_v4l2_buffer to struct vb2_buffer for common use, and change its type to u64 in order to handling y2038 problem. This patch also includes all device drivers' changes related to this restructuring. Signed-off-by: Junghak Sung <jh1009.sung@samsung.com> Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com> Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com> Acked-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Hans Verkuil <hansverk@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] vb2: drop v4l2_format argument from queue_setupHans Verkuil2015-12-181-1/+0Star
| | | | | | | | | | | | | | | | | | | | | The queue_setup callback has a void pointer that is just for V4L2 and is the pointer to the v4l2_format struct that was passed to VIDIOC_CREATE_BUFS. The idea was that drivers would use the information from that struct to buffers suitable for the requested format. After the vb2 split series this pointer is now a void pointer, which is ugly, and the reality is that all existing drivers will effectively just look at the sizeimage field of v4l2_format. To make this more generic the queue_setup callback is changed: the void pointer is dropped, instead if the *num_planes argument is 0, then use the current format size, if it is non-zero, then it contains the number of requested planes and the sizes array contains the requested sizes. If either is unsupported, then return -EINVAL, otherwise use the requested size(s). Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] media: videobuf2: Change queue_setup argumentJunghak Sung2015-10-201-1/+1
| | | | | | | | | | | | | | | Replace struct v4l2_format * with void * to make queue_setup() for common use. And then, modify all device drivers related with this change. Signed-off-by: Junghak Sung <jh1009.sung@samsung.com> Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com> Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com> Acked-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> [hans.verkuil@cisco.com: fix missing const in fimc-lite.c] Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] s5p-jpeg: remove unused varMauro Carvalho Chehab2015-10-011-3/+0Star
| | | | | | | | | changeset 6c96dbbc2aa9 added a new function that seems to be a modified version of an existing function. That's ok, but it was adding a "word" var from the previous code that it is not used on the new function. So, remove this left-over. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] media: videobuf2: Restructure vb2_bufferJunghak Sung2015-10-011-14/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove v4l2 stuff - v4l2_buf, v4l2_plane - from struct vb2_buffer. Add new member variables - bytesused, length, offset, userptr, fd, data_offset - to struct vb2_plane in order to cover all information of v4l2_plane. struct vb2_plane { <snip> unsigned int bytesused; unsigned int length; union { unsigned int offset; unsigned long userptr; int fd; } m; unsigned int data_offset; } Replace v4l2_buf with new member variables - index, type, memory - which are common fields for buffer management. struct vb2_buffer { <snip> unsigned int index; unsigned int type; unsigned int memory; unsigned int num_planes; struct vb2_plane planes[VIDEO_MAX_PLANES]; <snip> }; v4l2 specific fields - flags, field, timestamp, timecode, sequence - are moved to vb2_v4l2_buffer in videobuf2-v4l2.c struct vb2_v4l2_buffer { struct vb2_buffer vb2_buf; __u32 flags; __u32 field; struct timeval timestamp; struct v4l2_timecode timecode; __u32 sequence; }; Signed-off-by: Junghak Sung <jh1009.sung@samsung.com> Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com> Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com> Acked-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] media: videobuf2: Replace videobuf2-core with videobuf2-v4l2Junghak Sung2015-10-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make videobuf2-v4l2 as a wrapper of videobuf2-core for v4l2-use. And replace videobuf2-core.h with videobuf2-v4l2.h. This renaming change should be accompanied by the modifications of all device drivers that include videobuf2-core.h. It can be done with just running this shell script. replace() { str1=$1 str2=$2 dir=$3 for file in $(find $dir -name *.h -o -name *.c -o -name Makefile) do echo $file sed "s/$str1/$str2/g" $file > $file.out mv $file.out $file done } replace "videobuf2-core" "videobuf2-v4l2" "include/media/" replace "videobuf2-core" "videobuf2-v4l2" "drivers/media/" replace "videobuf2-core" "videobuf2-v4l2" "drivers/usb/gadget/" replace "videobuf2-core" "videobuf2-v4l2" "drivers/staging/media/" Signed-off-by: Junghak Sung <jh1009.sung@samsung.com> Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com> Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com> Acked-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] s5p-jpeg: add support for 5433Andrzej Pietrasiewicz2015-10-015-65/+520
| | | | | | | | | | | | | | | | | | | | | | | | | JPEG IP found in Exynos5433 is similar to what is in Exynos4, but there are some subtle differences which this patch takes into account. The most important difference is in what is processed by the JPEG IP and what has to be provided to it. In case of 5433 the IP does not parse Huffman and quantisation tables, so this has to be performed with the CPU and the majority of the code in this patch does that. A small but important difference is in what address is passed to the JPEG IP. In case of 5433 it is the SOS (start of scan) position, which is natural, because the headers must be parsed elsewhere. There is also a difference in how the hardware is put to work in device_run. Data structures are extended as appropriate to accommodate the above changes. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Reviewed-by: Jacek Anaszewski <j.anaszewski@samsung.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] s5p-jpeg: generalize clocks handlingMarek Szyprowski2015-10-012-39/+37Star
| | | | | | | | | | | | | | | | | | | | | Allow jpeg codec variants declare clocks they need. Before this patch is applied jpeg-core gets jpeg->sclk "speculatively": if it is not there, we assume no problem. This patch eliminates this by explicitly declaring what clocks are needed for each variant. This is a preparation for adding Exynos 5433 variant support, which needs 4 clocks of names not compatible with any previous version of jpeg hw module. [Rebase and commit message] Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Reviewed-by: Jacek Anaszewski <j.anaszewski@samsung.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] s5p-jpeg: Eliminate double kfree()Andrzej Pietrasiewicz2015-08-111-10/+4Star
| | | | | | | | | | | | | | | | | | | | video_unregister_device() calls device_unregister(), which calls put_device(), which calls kobject_put(), and if this is the last reference then kobject_release() is called, which calls kobject_cleanup(), which calls ktype's release method which happens to be device_release() in this case, which calls dev->release(), which happens to be v4l2_device_release() in this case, which calls vdev->release(), which happens to be video_device_release(). But video_device_release() is called explicitly both in error recovery path of s5p_jpeg_probe() and in s5p_jpeg_remove(). The pointers in question are not nullified between the two calls, so this is harmful. This patch fixes the driver so that video_device_release() is not called twice for the same object. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* Merge branch 'patchwork' into v4l_for_linusMauro Carvalho Chehab2015-04-214-58/+52Star
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * patchwork: (404 commits) [media] uvcvideo: add support for VIDIOC_QUERY_EXT_CTRL [media] uvcvideo: fix cropcap v4l2-compliance failure [media] media: omap3isp: remove unused clkdev [media] coda: Add tracing support [media] coda: drop dma_sync_single_for_device in coda_bitstream_queue [media] coda: fix fill bitstream errors in nonstreaming case [media] coda: call SEQ_END when the first queue is stopped [media] coda: fail to start streaming if userspace set invalid formats [media] coda: remove duplicate error messages for buffer allocations [media] coda: move parameter buffer in together with context buffer allocation [media] coda: allocate bitstream buffer from REQBUFS, size depends on the format [media] coda: allocate per-context buffers from REQBUFS [media] coda: use strlcpy instead of snprintf [media] coda: bitstream payload is unsigned [media] coda: fix double call to debugfs_remove [media] coda: check kasprintf return value in coda_open [media] coda: bitrate can only be set in kbps steps [media] v4l2-mem2mem: no need to initialize b in v4l2_m2m_next_buf and v4l2_m2m_buf_remove [media] s5p-mfc: set allow_zero_bytesused flag for vb2_queue_init [media] coda: set allow_zero_bytesused flag for vb2_queue_init ...
| * [media] s5p-jpeg: Remove some unused functionsRickard Strandqvist2015-04-072-35/+0Star
| | | | | | | | | | | | | | | | | | | | | | | | Removes some functions that are not used anywhere: s5p_jpeg_input_raw_y16() s5p_jpeg_timer_disable() s5p_jpeg_timer_enable(). This was partially found by using a static code analysis program called cppcheck. Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
| * [media] s5p-jpeg: Initialize jpeg_addr fields to zeroJacek Anaszewski2015-04-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | JPEG codecs on Exynos4 and Exynos3250 SoCs utilize different number of planes for storing the raw image data, depending on the format of the image being processed. For the unused planes a random data was being written to the related registers. Regardless of the fact that this seemed not to be harmful, fix the issue for clarity reasons. Reported-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
| * [media] s5p-jpeg: add 5420 family supportAndrzej Pietrasiewicz2015-04-072-21/+50
| | | | | | | | | | | | | | | | | | JPEG IP found in Exynos5420 is similar to what is in Exynos3250, but there are some subtle differences which this patch takes into account. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* | [media] s5p-jpeg: exynos3250: fix erroneous reset procedureJacek Anaszewski2015-03-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | The first while loop in the function exynos3250_jpeg_reset had no chance to be executed because the reg variable was initialized to 0. Initialize reg variable to 1 to fix the issue. Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com> Reported-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>