summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-08-29media: mtk-vcodec: vdec_vp9_if.c: fix comparison to boolDaniel W. S. Almeida
Fix the following coccinelle report: drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c:963:6-31: WARNING: Comparison to bool Found using - Coccinelle (http://coccinelle.lip6.fr) Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-29media: pci: cobalt-i2c.c: fix comparison of 0/1 to bool variableDaniel W. S. Almeida
Fix the following coccinelle reports: drivers/media/pci/cobalt/cobalt-i2c.c:176:16-21: WARNING: Comparison of 0/1 to bool variable drivers/media/pci/cobalt/cobalt-i2c.c:180:29-33: WARNING: Comparison of 0/1 to bool variable drivers/media/pci/cobalt/cobalt-i2c.c:121:16-21: WARNING: Comparison of 0/1 to bool variable drivers/media/pci/cobalt/cobalt-i2c.c:125:29-33: WARNING: Comparison of 0/1 to bool variable Found using - Coccinelle (http://coccinelle.lip6.fr) Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-29media: i2c: tda1997x.c: Fix assignment of 0/1 to bool variableDaniel W. S. Almeida
Fix the following coccinelle reports: drivers/media/i2c/tda1997x.c:911:6-21: WARNING: Assignment of 0/1 to bool variable drivers/media/i2c/tda1997x.c:939:2-17: WARNING: Assignment of 0/1 to bool variable drivers/media/i2c/tda1997x.c:947:4-19: WARNING: Assignment of 0/1 to bool variable Replace assignment to 1 with true and assignment to 0 with false. Found using - Coccinelle (http://coccinelle.lip6.fr) Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-29media: i2c: imx219.c: fix assignment of 0/1 to bool variableDaniel W. S. Almeida
Fix the following coccinelle report: drivers/media/i2c/imx219.c:1191:1-18: WARNING: Assignment of 0/1 to bool variable Replace the assignment to 0 with false instead. Found using - Coccinelle (http://coccinelle.lip6.fr) Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-29media: pci: cx23855-video.c: remove duplicate argument in 'or'Daniel W. S. Almeida
Fix the following coccinelle report: drivers/media/pci/cx23885/cx23885-video.c:639:24-44: duplicated argument to & or | V4L2_CAP_VBI_CAPTURE appears twice, remove it. Found using - Coccinelle (http://coccinelle.lip6.fr) Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-29media: dvb-frontends: mb86a16.c: remove useless if/elseDaniel W. S. Almeida
Fix the following coccinelle report: drivers/media/dvb-frontends/mb86a16.c:1455:6-8: WARNING: possible condition with no effect (if == else) Both branches are the same, so remove the if/else altogether. Found using - Coccinelle (http://coccinelle.lip6.fr) Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-29media: usb: dib0700_devices.c: remove useless if/elseDaniel W. S. Almeida
Fix the following coccinelle report: drivers/media/usb/dvb-usb/dib0700_devices.c:1741:1-3: WARNING: possible condition with no effect (if == else) Both branches are the same, so remove the if/else altogether. Found using - Coccinelle (http://coccinelle.lip6.fr) [hverkuil: fix checkpatch warnings] Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-29media: pci: saa7164-core.c: replace if (cond) BUG() with BUG_ON()Daniel W. S. Almeida
Fix the following coccinelle reports: drivers/media/pci/saa7164/saa7164-core.c:579:2-5: WARNING: Use BUG_ON instead of if condition followed by BUG. drivers/media/pci/saa7164/saa7164-core.c:592:3-6: WARNING: Use BUG_ON instead of if condition followed by BUG. drivers/media/pci/saa7164/saa7164-core.c:898:2-5: WARNING: Use BUG_ON instead of if condition followed by BUG. Found using - Coccinelle (http://coccinelle.lip6.fr) Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-29media: pci: saa7164-vbi.c: replace if (cond) BUG() with BUG_ON()Daniel W. S. Almeida
Fix the following coccinelle reports: drivers/media/pci/saa7164/saa7164-vbi.c:707:2-5: WARNING: Use BUG_ON instead of if condition followed by BUG. drivers/media/pci/saa7164/saa7164-vbi.c:760:2-5: WARNING: Use BUG_ON instead of if condition followed by BUG. Found using - Coccinelle (http://coccinelle.lip6.fr) Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-29media: pci: saa7164-dvb.c: replace if(cond) BUG() with BUG_ON()Daniel W. S. Almeida
Fix the following coccinelle reports: drivers/media/pci/saa7164/saa7164-dvb.c:341:2-5: WARNING: Use BUG_ON instead of if condition followed by BUG drivers/media/pci/saa7164/saa7164-dvb.c:483:2-5: WARNING: Use BUG_ON instead of if condition followed by BUG. Found using - Coccinelle (http://coccinelle.lip6.fr) Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-29media: pci: saa7164.c: Replace if(cond) BUG with BUG_ONDaniel W. S. Almeida
Fix the following coccinelle reports: drivers/media/pci/saa7164/saa7164-buffer.c:254:3-6: WARNING: Use BUG_ON instead of if condition followed by BUG. drivers/media/pci/saa7164/saa7164-buffer.c:261:3-6: WARNING: Use BUG_ON instead of if condition followed by BUG. Found using - Coccinelle (http://coccinelle.lip6.fr) Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-29media: vicodec: vicodec-core.c: fix assignment of 0/1 to bool variableDaniel W. S. Almeida
Fix the following coccinelle reports: drivers/media/test-drivers/vicodec/vicodec-core.c:1674:2-21: WARNING: Assignment of 0/1 to bool variable drivers/media/test-drivers/vicodec/vicodec-core.c:1675:2-26: WARNING: Assignment of 0/1 to bool variable By replacing the assignment to 0 with 'false' instead. Found using - Coccinelle (http://coccinelle.lip6.fr) Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-29media: mtk-vcodec: mtk_vcodec_dec.c: fix comparison to boolDaniel W. S. Almeida
Fix the following coccinelle reports: drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c:197:14-35: WARNING: Comparison to bool drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c:198:7-29: WARNING: Comparison to bool drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c:451:12-19: WARNING: Comparison to bool drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c:1159:6-15: WARNING: Comparison to bool By replacing (cond == true) with (cond) and (cond == false) with (!cond) Found using - Coccinelle (http://coccinelle.lip6.fr) Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-29media: cobalt: cobalt-omnitek.c: fix comparison to boolDaniel W. S. Almeida
Fix the following coccinelle report: drivers/media/pci/cobalt/cobalt-omnitek.c:119:5-19: WARNING: Comparison to bool By using "!cond" instead of "cond == false" Found using - Coccinelle (http://coccinelle.lip6.fr) Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-29media: sunxi: sun8i-rotate.c: remove useless error messageDaniel W. S. Almeida
This fixes the following coccinelle report: drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c:751:2-9: line 751 is redundant because platform_get_irq() already prints an error By removing the useless call to dev_err() Found using - Coccinelle (http://coccinelle.lip6.fr) Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-28media: platform: Add jpeg enc featureXia Jiang
Add mtk jpeg encode v4l2 driver based on jpeg decode, because that jpeg decode and encode have great similarities with function operation. Reviewed-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Xia Jiang <xia.jiang@mediatek.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-28media: platform: Using the variant structure to contain the varability ↵Xia Jiang
between dec and enc Add varability which would be used between jpeg dec and enc to a match data structure, it will make the code linear. Reviewed-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Xia Jiang <xia.jiang@mediatek.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-28media: platform: Rename existing functions/defines/variablesXia Jiang
Rename existing functions/defines/variables with a _dec prefix and without dec_ prefix to prepare for the addition of the jpeg encoder feature. Reviewed-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Xia Jiang <xia.jiang@mediatek.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-28media: platform: Rename jpeg dec file nameXia Jiang
Rename the files which are for decode feature. This is preparing path since the jpeg enc patch will be added later. Reviewed-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Xia Jiang <xia.jiang@mediatek.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-28media: dt-bindings: Add jpeg enc device tree node documentXia Jiang
Add jpeg enc device tree node document. Reviewed-by: Rob Herring <robh@kernel.org> Reviewed-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Xia Jiang <xia.jiang@mediatek.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-28media: platform: Change the call functions of getting/enable/disable the ↵Xia Jiang
jpeg's clock Use the generic clk_bulk_* helpers to enable and disable clocks. Reviewed-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Xia Jiang <xia.jiang@mediatek.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-28media: platform: Refactor mtk_jpeg_set_default_params()Xia Jiang
Call mtk_jpeg_try_fmt_mplane() to replace the original computation of sizeimage and bytesperline, because that mtk_jpeg_try_fmt_mplane() already did it. Reviewed-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Xia Jiang <xia.jiang@mediatek.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-28media: platform: Change the colorspace of jpeg to the fixed valueXia Jiang
Jpeg doesn't support colorspace conversion, so it shouldn't accept any other colorspace in S_FMT. Change the colorspace of jpeg to the fixed value. Reviewed-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Xia Jiang <xia.jiang@mediatek.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-28media: platform: Redefinition of mtk_jpeg_q_data structureXia Jiang
The standard v4l2_pix_format_mplane structure contains width/height/ sizeimage/bytesperline, so use v4l2_pix_format_mplane to replace them. Reviewed-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Xia Jiang <xia.jiang@mediatek.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-28media: platform: Refactor mtk_jpeg_find_format()Xia Jiang
Delete the unused ctx parameter. Using mtk_jpeg_formats and num_formats parameters is more generic, because that jpeg enc will also use it. Delete the macro definition of MTK_JPEG_FMT_TYPE_OUTPUT and MTK_JPEG_FMT_TYPE_CAPTURE, because that MTK_JPEG_FMT_FLAG_DEC_OUTPUT and MTK_JPEG_FMT_FLAG_DEC_CAPTURE are enough. Reviewed-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Xia Jiang <xia.jiang@mediatek.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-28media: platform: Refactor mtk_jpeg_try_fmt_mplane()Xia Jiang
The function of mtk_jpeg_adjust_fmt_mplane() equals mtk_jpeg_g_fmt_vid_mplane(), so use mtk_jpeg_g_fmt_vid_mplane() to replace it . Delete the unused ctx parameter. Using fourcc to distinguish between different formats is more generic, because that jpeg enc will also use it. Reviewed-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Xia Jiang <xia.jiang@mediatek.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-28media: platform: Change the maximum width and height supported by JPEG decXia Jiang
The maximum width and height supported by JPEG dec is 65535, so change them from 8192 to 65535. Reviewed-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Xia Jiang <xia.jiang@mediatek.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-28media: platform: Delete vidioc_s_selection ioctl of jpeg decXia Jiang
JPEG dec does't support setting a compose rectangle, so remove mtk_jpeg_dec_s_selection(). Reviewed-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Xia Jiang <xia.jiang@mediatek.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-28media: platform: Delete redundant code and add annotation for an enumXia Jiang
Delete unused member variables annotation. Delete unused variable definition. Delete redundant log print, because V4L2 debug logs already print it. Add annotation for enum mtk_jpeg_ctx_state. Reviewed-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Xia Jiang <xia.jiang@mediatek.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-28media: platform: Change MTK_JPEG_COMP_MAX macro definition locationXia Jiang
Move MTK_JPEG_COMP_MAX definition to mtk_jpeg_core.h file, because it is used by mtk_jpeg_core.c file. Reviewed-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Xia Jiang <xia.jiang@mediatek.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-28media: platform: Use generic rounding helpersXia Jiang
Use clamp() to replace mtk_jpeg_bound_align_image() and round() to replace mtk_jpeg_align(). Reviewed-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Xia Jiang <xia.jiang@mediatek.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-28media: platform: Stylistic changes for improving code qualityXia Jiang
Change register offset hex numerals from uppercase to lowercase. Change data type of max/min width/height from integer to unsigned integer. Reviewed-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Xia Jiang <xia.jiang@mediatek.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-28media: platform: Delete zeroing the reserved fieldsXia Jiang
Delete zeroing the reserved fields because that the core already does it. Reviewed-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Xia Jiang <xia.jiang@mediatek.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-28media: platform: Cancel the last frame handling flowXia Jiang
There is no need to queue an empty buffer for signaling a last frame, because all frames are separate from each other in JPEG. Reviewed-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Xia Jiang <xia.jiang@mediatek.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-28media: platform: Add mechanism to handle jpeg hardware's locking upXia Jiang
There is a delayed work scheduled before starting the hardware and canceled in the interrupt handler. If the delayed work is executed, it resets the hardware and reports the failure to V4L2, so that the execution can continue from next frames. Reviewed-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Xia Jiang <xia.jiang@mediatek.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-28media: platform: Improve the implementation of the system PM opsXia Jiang
Add v4l2_m2m_suspend() function call in mtk_jpeg_suspend() to make sure that the current frame is processed completely before suspend. Add v4l2_m2m_resume() function call in mtk_jpeg_resume() to unblock the driver from scheduling next frame. Reviewed-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Xia Jiang <xia.jiang@mediatek.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-28media: v4l2-mem2mem: add v4l2_m2m_suspend, v4l2_m2m_resumePi-Hsun Shih
Add two functions that can be used to stop new jobs from being queued / continue running queued job. This can be used while a driver using m2m helper is going to suspend / wake up from resume, and can ensure that there's no job running in suspend process. Signed-off-by: Pi-Hsun Shih <pihsun@chromium.org> Signed-off-by: Jerry-ch Chen <jerry-ch.chen@mediatek.corp-partner.google.com> Reviewed-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-28media: platform: Delete the resetting hardware flow in the system PM opsXia Jiang
Delete the resetting hardware flow in suspend and resume function because that resetting operation will be done in device_run(). Reviewed-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Xia Jiang <xia.jiang@mediatek.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-28media: platform: Improve power on and power off flowXia Jiang
Call pm_runtime_get_sync() before starting a frame and then pm_runtime_put() after completing it. This can save power for the time between processing two frames. Reviewed-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Xia Jiang <xia.jiang@mediatek.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-28media: platform: Change the fixed device node number to unfixed valueXia Jiang
The driver can be instantiated multiple times, e.g. for a decoder and an encoder. Moreover, other drivers could coexist on the same system. This makes the static video node number assignment pointless, so switch to automatic assignment instead. Reviewed-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Xia Jiang <xia.jiang@mediatek.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-28media: platform: Improve getting and requesting irq flow for bug fixingXia Jiang
Delete platform_get_resource operation for irq. Return actual value rather than EINVAL when fail to get and request irq. Reviewed-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Xia Jiang <xia.jiang@mediatek.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-28media: platform: Improve queue set up flow for bug fixingXia Jiang
Add checking created buffer size follow in mtk_jpeg_queue_setup(). Reviewed-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Xia Jiang <xia.jiang@mediatek.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-28media: platform: Improve subscribe event flow for bug fixingXia Jiang
Let v4l2_ctrl_subscribe_event() do the job for other types except V4L2_EVENT_SOURCE_CHANGE. Reviewed-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Xia Jiang <xia.jiang@mediatek.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-28media: tegra-video: Compute settle times based on the clock rateSowjanya Komatineni
Settle time determines the number of cil clock cyles to wait after LP00 when moving from LP to HS. This patch computes T-CLK-SETTLE and T-HS-SETTLE times based on cil clock rate and pixel rate from the sensor and programs them during streaming. T-CLK-SETTLE time is the interval during which receiver will ignore any HS transitions on clock lane starting from the beginning of T-CLK-PREPARE. T-HS-SETTLE time is the interval during which recevier will ignore any HS transitions on data lane starting from the beginning of T-HS-PREPARE. Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-28media: tegra-video: Add CSI MIPI pads calibrationSowjanya Komatineni
CSI MIPI pads need to be enabled and calibrated for capturing from the external sensor or transmitter. MIPI CAL unit calibrates MIPI pads pull-up, pull-down and termination impedances. Calibration is done by co-work of MIPI BIAS pad and MIPI CAL control unit. Triggering calibration start can happen any time after MIPI pads are enabled but calibration results will be latched and applied to MIPI pads by MIPI CAL unit only when the link is in LP11 state and then calibration status register gets updated. This patch enables CSI MIPI pads and calibrates them during streaming. Tegra CSI receiver is able to catch the very first clock transition. So, CSI receiver is always enabled prior to sensor streaming and trigger of calibration start is done during CSI subdev streaming and status of calibration is verified after sensor stream on. Reviewed-by: Dmitry Osipenko <digetx@gmail.com> Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-28media: gpu: host1x: mipi: Keep MIPI clock enabled and mutex locked till ↵Sowjanya Komatineni
calibration done With the split of MIPI calibration into tegra_mipi_calibrate() and tegra_mipi_wait(), MIPI clock is not kept enabled and mutex is not locked till the calibration is done. So, this patch keeps MIPI clock enabled and mutex locked after triggering start of calibration till its done. To let calibration process go through its finite sequence codes before calibration logic waiting for pads idle state added wait time of 75usec to make sure it sees idle state to apply the results. This patch renames tegra_mipi_calibrate() as tegra_mipi_start_calibration() and tegra_mipi_wait() as tegra_mipi_finish_calibration() to be inline with their usage. Reviewed-by: Dmitry Osipenko <digetx@gmail.com> Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-28media: tegra-video: Add support for selection ioctl opsSowjanya Komatineni
This patch adds selection v4l2 ioctl operations to allow configuring a selection rectangle in the sensor through the Tegra video device node. Some sensor drivers supporting crop uses try_crop rectangle from v4l2_subdev_pad_config during try format for computing binning. So with selection ops support, this patch also updates try format to use try crop rectangle either from subdev frame size enumeration or from subdev crop boundary. Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-28media: tegra-video: Add support for external sensor captureSowjanya Komatineni
This patch adds support to capture from the external sensor based on device graph in the device tree. Driver walks through the device graph to create media links between the entities and registers and unregisters video devices when the corresponding sub-devices are bound and unbound. Channel formats are enumerated based on available formats from the sensor and the corresponding matched formats from the Tegra supported video formats list. Each Tegra CSI instance can be configured as 4-lane or 2-lane based on supported lane configuration from the sensor through the device tree. Currently this driver supports V4L2 video node centric only. [hverkuil: changed video_unregister_device to vb2_video_unregister_device] Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-28media: tegra-video: Separate CSI stream enable and disable implementationsSowjanya Komatineni
This patch separates implementation of CSI stream enable and disable into separate functions for readability. Reviewed-by: Dmitry Osipenko <digetx@gmail.com> Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-08-28media: dt-bindings: tegra: Update VI and CSI bindings with port infoSowjanya Komatineni
Update VI and CSI bindings to add port and endpoint nodes as per media video-interfaces DT binding document. Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>