- Jun 20, 2022
-
-
Dongliang Mu authored
The error handling code in pvr2_hdw_create forgets to unregister the v4l2 device. When pvr2_hdw_create returns back to pvr2_context_create, it calls pvr2_context_destroy to destroy context, but mp->hdw is NULL, which leads to that pvr2_hdw_destroy directly returns. Fix this by adding v4l2_device_unregister to decrease the refcount of usb interface. Reported-by:
<syzbot+77b432d57c4791183ed4@syzkaller.appspotmail.com> Signed-off-by:
Dongliang Mu <mudongliangabcd@gmail.com> Signed-off-by:
Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Niklas Söderlund authored
When converting to full Virtual Channel routing an error crept into the routing table for Ebisu (r8a77990). The routing information is used at probe time preventing rcar-vin from probing correctly on this SoC, solve by correcting the routing table. Fixes: 3e52419e ("media: rcar-{csi2,vin}: Move to full Virtual Channel routing per CSI-2 IP") Reported-by:
Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by:
Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Tested-by:
Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by:
Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Justin Green authored
Set allow_cache_hints to 1 for the vb2_queue source and destination queues in the mediatek vcodec V4L2 driver. This allows us to allocate buffers with the V4L2_MEMORY_FLAG_NON_COHERENT set. On Mediatek SoCs, this enables caching for this memory, which vastly improves performance when being read from CPU. Read performance for these buffers is in turn important for detiling MM21 video frames in userspace software, such as libyuv or gstreamer. This change should be safe from race conditions since videobuf2 already invalidates or flushes the appropriate cache lines in its prepare() and finish() methods. Tested on a MT8183 SoC. Resulted in both correct detiling and a 10X speedup. Signed-off-by:
Justin Green <greenjustin@chromium.org> Suggested-by:
Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by:
Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Ziyang Xuan authored
vfree(NULL) is safe. NULL check before vfree() is not needed. Delete them to simplify the code. Generated by coccinelle script: scripts/coccinelle/free/ifnullfree.cocci Signed-off-by:
Ziyang Xuan <william.xuanziyang@huawei.com> Reviewed-by:
ming_qian <ming.qian@nxp.com> Signed-off-by:
Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Ming Qian authored
v4l2 m2m has supplied some helper function to handle drain, so the driver can use the helper function directly. Fixes: d8ebe298 ("media: imx-jpeg: Set V4L2_BUF_FLAG_LAST at eos") Signed-off-by:
Ming Qian <ming.qian@nxp.com> Signed-off-by:
Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Ming Qian authored
The hardware can support any image size WxH, with arbitrary W (image width) and H (image height) dimensions. Align upwards buffer size for both encoder and decoder. and leave the picture resolution unchanged. For decoder, the risk of memory out of bounds can be avoided. For both encoder and decoder, the driver will lift the limitation of resolution alignment. For example, the decoder can support jpeg whose resolution is 227x149 the encoder can support nv12 1080P, won't change it to 1920x1072. Fixes: 2db16c6e ("media: imx-jpeg: Add V4L2 driver for i.MX8 JPEG Encoder/Decoder") Signed-off-by:
Ming Qian <ming.qian@nxp.com> Signed-off-by:
Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Ming Qian authored
There is a hardware bug that it will load the first 128 bytes of configuration data twice, it will led to some configure error. so shift the configuration data 128 bytes, and make the first 128 bytes all zero, then hardware will load the 128 zero twice, and ignore them as garbage. then the configuration data can be loaded correctly Fixes: 2db16c6e ("media: imx-jpeg: Add V4L2 driver for i.MX8 JPEG Encoder/Decoder") Signed-off-by:
Ming Qian <ming.qian@nxp.com> Reviewed-by:
Mirela Rabulea <mirela.rabulea@nxp.com> Reviewed-by:
Tommaso Merciai <tommaso.merciai@amarulasolutions.com> Signed-off-by:
Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Ming Qian authored
the register CAST_NOMFRSIZE_LO should be equal to CAST_STATUS16 the register CAST_NOMFRSIZE_HI should be equal to CAST_STATUS17 the register CAST_OFBSIZE_LO should be equal to CAST_STATUS18 the register CAST_OFBSIZE_HI should be equal to CAST_STATUS19 Fixes: 2db16c6e ("media: imx-jpeg: Add V4L2 driver for i.MX8 JPEG Encoder/Decoder") Signed-off-by:
Ming Qian <ming.qian@nxp.com> Reviewed-by:
Mirela Rabulea <mirela.rabulea@nxp.com> Signed-off-by:
Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Chengguang Xu authored
In error case of s5p_mfc_power_on() we should call clk_disable_unprepare() for the clocks(from pm->clocks[0] to pm->clocks[i-1]). Signed-off-by:
Chengguang Xu <cgxu519@mykernel.net> Signed-off-by:
Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Kees Cook authored
There is a regular need in the kernel to provide a way to declare having a dynamically sized set of trailing elements in a structure. Kernel code should always use “flexible array members”[1] for these cases. The older style of one-element or zero-length arrays should no longer be used[2][3]. [1] https://en.wikipedia.org/wiki/Flexible_array_member [2] https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays [3] https://github.com/KSPP/linux/issues/78 Fixes: 9f599f35 ("media: amphion: add vpu core driver") Cc: Ming Qian <ming.qian@nxp.com> Cc: Shijie Qin <shijie.qin@nxp.com> Cc: Zhou Peng <eagle.zhou@nxp.com> Signed-off-by:
Kees Cook <keescook@chromium.org> Reviewed-by:
Gustavo A. R. Silva <gustavoars@kernel.org> Reviewed-by:
ming_qian <ming.qian@nxp.com> Reviewed-by:
Tommaso Merciai <tommaso.merciai@amarulasolutions.com> Signed-off-by:
Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Benjamin Gaignard authored
Documentation said that g2 init_qp field use bits 24 to 30 of the 8th register. Change the field mask to be able to set 7 bits and not only 6 of them. Conformance test INITQP_B_Main10_Sony_1 decoding is OK with this patch. Fixes: cb5dd5a0 ("media: hantro: Introduce G2/HEVC decoder") Signed-off-by:
Benjamin Gaignard <benjamin.gaignard@collabora.com> Reviewed-by:
Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by:
Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Haowen Bai authored
kmemdup is introduced to duplicate a region of memory in a neat way. Rather than kmalloc/kzalloc + memcpy, which the programmer needs to write the size twice (sometimes lead to mistakes), kmemdup improves readability, leads to smaller code and also reduce the chances of mistakes. Suggestion to use kmemdup rather than using kmalloc/kzalloc + memcpy. Signed-off-by:
Haowen Bai <baihaowen@meizu.com> Signed-off-by:
Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Eugen Hristev authored
The cropping configuration of the Parallel Front Engine (PFE) can be done just once when the streaming starts. The ISC configuration is in place and will not be changed while streaming. It is not effective to keep rewriting the crop registers configuration everytime start_dma is called, as this can be called for each queued buffer. Thus we can configure the cropping at start_streaming time. This change moves the code to a dedicated function. Signed-off-by:
Eugen Hristev <eugen.hristev@microchip.com> Signed-off-by:
Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Vladimir Zapolskiy authored
Common exported functions msm_vfe_get_vfe_id() and msm_vfe_get_vfe_line_id() do not have any users outside of camss-ispif.c, move them to the latter object and staticize. The change is supposed to be a non-functional one. Signed-off-by:
Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org> Reviewed-by:
Robert Foss <robert.foss@linaro.org> Signed-off-by:
Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Ming Qian authored
return error if format is unsupported by vpu, otherwise the vpu will be stalled at decoding Fixes: 3cd08451 ("media: amphion: add vpu v4l2 m2m support") Signed-off-by:
Ming Qian <ming.qian@nxp.com> Signed-off-by:
Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Julia Lawall authored
Spelling mistake (triple letters) in comment. Detected with the help of Coccinelle. Signed-off-by:
Julia Lawall <Julia.Lawall@inria.fr> Signed-off-by:
Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Julia Lawall authored
Spelling mistakes (triple letters) in comments. Detected with the help of Coccinelle. Signed-off-by:
Julia Lawall <Julia.Lawall@inria.fr> Signed-off-by:
Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Julia Lawall authored
Spelling mistake (triple letters) in comment. Detected with the help of Coccinelle. Signed-off-by:
Julia Lawall <Julia.Lawall@inria.fr> Signed-off-by:
Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Julia Lawall authored
Spelling mistake (triple letters) in comment. Detected with the help of Coccinelle. Signed-off-by:
Julia Lawall <Julia.Lawall@inria.fr> Signed-off-by:
Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Zheyu Ma authored
We got the following warning when booting the kernel: [ 3.243674] INFO: trying to register non-static key. [ 3.243922] The code is fine but needs lockdep annotation, or maybe [ 3.244230] you didn't initialize this object before use? [ 3.245642] Call Trace: [ 3.247836] lock_acquire+0xff/0x2d0 [ 3.248727] tw686x_audio_irq+0x1a5/0xcc0 [tw686x] [ 3.249211] tw686x_irq+0x1f9/0x480 [tw686x] The lock 'vc->qlock' will be initialized in tw686x_video_init(), but the driver registers the irq before calling the tw686x_video_init(), and we got the warning. Fix this by registering the irq at the end of probe Fixes: 704a84cc ("[media] media: Support Intersil/Techwell TW686x-based video capture cards") Signed-off-by:
Zheyu Ma <zheyuma97@gmail.com> Signed-off-by:
Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Zheyu Ma authored
When removing the module, we will get the follow flaw: [ 69.323999] remove_proc_entry: removing non-empty directory 'irq/21', leaking at least 'tw5864' [ 69.324449] WARNING: CPU: 0 PID: 395 at fs/proc/generic.c:717 remove_proc_entry+0x389/0x3f0 [ 69.326909] RIP: 0010:remove_proc_entry+0x389/0x3f0 [ 69.331089] Call Trace: [ 69.331215] <TASK> [ 69.331327] unregister_irq_proc+0x14c/0x170 [ 69.332579] tw5864_finidev+0x12a/0x190 [tw5864] [ 69.332811] pci_device_remove+0x92/0x240 Fix this by using managed functions, this makes the error handling more simpler. Signed-off-by:
Zheyu Ma <zheyuma97@gmail.com> Signed-off-by:
Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Scott Chao authored
The Google Moli device uses the same approach as the Google Brask which enables the HDMI CEC via the cros-ec-cec driver. Signed-off-by:
Scott Chao <scott_chao@wistron.corp-partner.google.com> Signed-off-by:
Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Linus Walleij authored
A pointer into virtual memory is represented by a (void *) not an u32, so the compiler warns: drivers/media/platform/ti/omap/omap_voutlib.c:317:54: warning: passing argument 1 of 'virt_to_pfn' makes pointer from integer without a cast [-Wint-conversion] Fix this with an explicit cast. Cc: Vaibhav Hiremath <hvaibhav.linux@gmail.com> Cc: Archit Taneja <architt@codeaurora.org> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Signed-off-by:
Linus Walleij <linus.walleij@linaro.org> Signed-off-by:
Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Ming Qian authored
vdec check the pixel format is supported by vpu, or is it disabled. And don't report it if the result is false Signed-off-by:
Ming Qian <ming.qian@nxp.com> Signed-off-by:
Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Vladimir Zapolskiy authored
The change simplifies driver's probe and remove functions, no functional change is intended. Signed-off-by:
Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org> Reviewed-by:
Robert Foss <robert.foss@linaro.org> Signed-off-by:
Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Benjamin Gaignard authored
On Hantro G2 decoder on IMX8MQ strides requirements aren't the same for NV12_4L4 and NV12 pixel formats. The first one use a 4 bytes padding while the last one needs 16 bytes. To be sure to provide the correct stride in all cases we need: - to relax the constraints on codec formats so set step_width to 4 - use capture queue format and not the output queue format when applying the pixel format constraints. - put the correct step_width constraints on each pixel format. Move HEVC SPS validation in hantro_hevc.c to be able to perform it when setting sps control and when starting to decode the bitstream. Add a new test in HEVC SPS validation function to check if resolution is still matching the hardware constraints. With this SAODBLK_A_MainConcept_4 and SAODBLK_B_MainConcept_4 conformance tests files are correctly decoded with both NV12 and NV12_4L4 pixel formats. These two files have a resolution of 1016x760. Add defines for the various used resolutions. For other variants than Hantro G2 on IMX8M keep the same step_width to avoid regressions. Fluster HEVC test score is now 128/147 vs 126/147 with the both pixel formats as decoder output. Fluster VP9 test score stay at 147/303. [hverkuil: fix trivial checkpatch warnings] Signed-off-by:
Benjamin Gaignard <benjamin.gaignard@collabora.com> Signed-off-by:
Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Oliver Neukum authored
If we want to avoid memory corruption on incoherent architectures, buffers for DMA must not reside - on the stack - embedded within other structures Allocate them separately. v2: fix uninitialized return value Signed-off-by:
Oliver Neukum <oneukum@suse.com> Signed-off-by:
Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
kyrie wu authored
set jpeg encode DMA bit mask to support 34bits iova space(16GB) that the mt8186 iommu HW support. Whole the iova range separate to 0~4G/4G~8G/8G~12G/12G~16G, regarding which iova range jpgenc actually locate, it depends on the dma-ranges property of vdec dtsi node. Signed-off-by:
kyrie wu <kyrie.wu@mediatek.com> Signed-off-by:
Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
kyrie wu authored
Add mediatek,mt8186-jpgenc compatible to binding document. MT8186 iommu support 0~16GB iova. We separate it to four banks: 0~4G; 4G~8G; 8G~12G; 12G~16G. The "dma-ranges" could be used to adjust the bank we locate. If we don't set this property. The default range always is 0~4G. Signed-off-by:
kyrie wu <kyrie.wu@mediatek.com> Reviewed-by:
Rob Herring <robh@kernel.org> Signed-off-by:
Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
keliu authored
Use ida_alloc() and ida_free() instead of the deprecated ida_simple_get() and ida_simple_remove(). Signed-off-by:
keliu <liuke94@huawei.com> Signed-off-by:
Sean Young <sean@mess.org> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Oliver Neukum authored
While the completion handler is running, usb_unlink_urb() on yourself is a NOP. Remove it. Signed-off-by:
Oliver Neukum <oneukum@suse.com> Signed-off-by:
Sean Young <sean@mess.org> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Oliver Neukum authored
During resume we must assume tat devices are not ready for block IO. Use GFP_NOIO. Signed-off-by:
Oliver Neukum <oneukum@suse.com> Signed-off-by:
Sean Young <sean@mess.org> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Oliver Neukum authored
It cannot fail. Make it void. Signed-off-by:
Oliver Neukum <oneukum@suse.com> Signed-off-by:
Sean Young <sean@mess.org> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Oliver Neukum authored
During resume() GFP_NOIO is enough. Signed-off-by:
Oliver Neukum <oneukum@suse.com> Signed-off-by:
Sean Young <sean@mess.org> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Oliver Neukum authored
During resume() GFP_NOIO will do. No need for GFP_ATOMIC Signed-off-by:
Oliver Neukum <oneukum@suse.com> Signed-off-by:
Sean Young <sean@mess.org> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Oliver Neukum authored
No buffer can be embedded inside a descriptor, not even a simple be64. Use a separate kmalloc() Signed-off-by:
Oliver Neukum <oneukum@suse.com> Signed-off-by:
Sean Young <sean@mess.org> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Oliver Neukum authored
Unlinking yourself while the completion handler is running is a NOP. Drop it. Signed-off-by:
Oliver Neukum <oneukum@suse.com> Signed-off-by:
Sean Young <sean@mess.org> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Oliver Neukum authored
Calling that on yourself while the completion handler is running is a NOP. Remove it. Signed-off-by:
Oliver Neukum <oneukum@suse.com> Signed-off-by:
Sean Young <sean@mess.org> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Oliver Neukum authored
The driver uses a timer, that may submit the URB and the URB may start the timer. No simple order of killing can break te cycle. Poison the URB before killing the timer. Signed-off-by:
Oliver Neukum <oneukum@suse.com> Signed-off-by:
Sean Young <sean@mess.org> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Oliver Neukum authored
The timer uses the URB. Free it only after the timer has been stopped. Signed-off-by:
Oliver Neukum <oneukum@suse.com> Signed-off-by:
Sean Young <sean@mess.org> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-