When fixing the tearing on 8QM, I used the same value for 8QXP also, but
the ISI IP on 8QXP is a little bit different from 8QM, so revert back
the buf_active_reverse to its initial value of 'false'.
Fixes: 4dc2e71fee ("LF-13924: media: imx8-isi: Fix tearing of 8QM")
Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Acked-by: Jason Liu <jason.hui.liu@nxp.com>
When a disable_streams is called with less streams than the currently
enabled ones, all the streams (from camera modules) stops sending data.
Also, when starting random individual cameras (not all at once), there
is no stream coming from the deserializer.
So, in order to fix this, start all the cameras at once, no matter the
streams are requested for enable.
Also, refactored the enable_streams/disable_streams, since they shared
the same similar code for enabling cameras.
Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Acked-by: Jason Liu <jason.hui.liu@nxp.com>
Implement V4L2 subdev .get_frame_desc callback for OV5640 driver to
fix bellow warning message from downstream subdev(imx8mq-mipi-csi2
in this case).
[ 1995.949885] imx8mq-mipi-csi2 2daf0000.csi: Remote sub-device on pad 1 should implement .get_frame_desc! Forcing VC = 0 and DT = 1e
Signed-off-by: Guoniu Zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
Acked-by: Jason Liu <jason.hui.liu@nxp.com>
Currently, the remote_pad is not stored correctly, causing
get_frame_desc to be called on the wrong remote pad.
This patch stores the remote pad on either link_setup (if the link is
manually created) or on notify_bound, when the link will be
automatically created.
Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Currently, the get_fmt does note care about the stream received on the
format, so it only set the format on stream 0. Fix this in order to be
able to set the format on all the exposed streams.
Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Reviewed-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
Implement the get_frame_desc operation, in order to allow the camera
module to propagate the frame descriptor along the pipeline.
Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Reviewed-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
Add support for streams, so that each individual serializer connected to
this device will be represented as a stream on the source pad.
Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Reviewed-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
These controls are actually needed by libcamera. So, add them.
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
Even though the current driver supports only one mode, add support for
the aforementioned ioctl so that userspace apps/libraries, like
libcamera, can use it.
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
The amphion decoder will pre-parse 3 frames before decoding the first
frame. If we append a flush padding data after frame, the decoder
will finish parsing and start to decode when the flush data is parsed.
It can reduce the decoding latency.
In the past, we only enable this mode when the display delay is set to
0. But we still can enable this mode without changing the display order,
so we add a frame_flush_mode parameter to enable it.
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
The firmware v1.9.0 supports the display delay 0 for hevc format,
then driver can enable this feature
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
As the iMX8MM camera switch to community mipi csi, so drop local iMX8MM
mipi csi support.
Signed-off-by: Alice Yuan <alice.yuan@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
error log:
drivers/media/platform/nxp/imx-parallel-csi.c:1002:44: error: variable 'ret' is uninitialized when used here [-Werror,-Wuninitialized]
1002 | dev_err(dev, "Failed to get regs: %d\n", ret);
Change-Id: Ia0bcbbd7ee1aa1512ef557db8c2254291456bc5f
Signed-off-by: Zhipeng Wang <zhipeng.wang_1@nxp.com>
Reviewed-by: Alice Yuan <alice.yuan@nxp.com>
This adds standard controls for exposure, analogue gain and digital gain
which will temporarily work in parallel with the custom ones.
Eventually, the custom controls will be removed and only the standard
ones will be used.
The new controls, however, needs a complicated distribution function
that takes all 3 user provided values of exposure, analogue gain and
digital gain as inputs and computes the proper values that will be
written to the sensor registers.
In order to make this process a little more efficient and avoid writing
the same registers 3 times, add a caching mechanism that will avoid
writing a register if its value didn't change.
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
Reviewed-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Add group-hold helper functions for the exposure and gain setting
routines to prepare for the next patches where we need to be able to set
exposure and gains within one single group-hold.
Also, only use group-hold 0 for all operations since the controls are
serialized anyway.
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
Reviewed-by: Mirela Rabulea <mirela.rabulea@nxp.com>
When csi bridge met error interrupt base address change error,
recovery the csi bridge from the error status and skip broken frames.
Signed-off-by: Alice Yuan <alice.yuan@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
Current driver handles only input0 pad with its decompression block, and
hdr merge is unused.
This patch adds input1 pad handling and enables hdr merge block to offer
the ability of processing HDR sensors.
Reviewed-by: Alexi Birlinger <alexi.birlinger@nxp.com>
Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
Current driver supports only raw Bayer input formats while hardware block
supports monochrome input as well.
This patch enables monochrome input support.
Reviewed-by: Alexi Birlinger <alexi.birlinger@nxp.com>
Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
In try_fmt function the color space selection has been added
depending on the incoming configuration from user space.
It selects a valid colorspace by its name or a default one if
incoming configuration is not appropriate. Only default transfer
function, encoding and quantization are supported.
GCM unit uses the configuration from the color space to
define the related registers accordingly.
Signed-off-by: Alexi Birlinger <alexi.birlinger@nxp.com>
Reviewed-by: Aymen Sghaier <aymen.sghaier@nxp.com>
* origin/capture/mt9m114: (6 commits)
LF-13535-13: media: mt9m114: Fix the set fmt failed for mismatch issue
LF-13535-12: media: i2c: initialize subdev active state of MT9M114
LF-13535-11: media: i2c: add v4l2 subdev initial of MT9M114
LF-13535-10: media: i2c: add runtime PM support for MT9M114
IMXBSP-123-3: media: mt9m114: Add the EXTCLK regulator control in mt9m114
...
* origin/capture/ov5640: (29 commits)
LF-13705-2 media: capture: ov5640_mipi_v2: Fix Coverity issue
LF-13534-3: media: i2c: sensor: Fix the downstream platforms start camera failed
LF-13534-1: media: i2c: sensor: add link_setup entity ops for ov5640 driver
LF-13220: media: ov5640: Fix camera the frist few frames are green image
LF-10336-2 media: ov5640_v2: Fix Division by zero problem
...
* origin/capture/media: (6 commits)
Revert "media: v4l2-ioctl: clear fields in s_parm"
media: v4l2: export video_usercopy function
Revert "media: v4l2-subdev.h: remove obsolete g/s_parm"
MLK-20724: uapi: add RGBA to exend V4L2 standard format for android usage
MLK-9662 [V4L2 Capture] Revert patch to re-add support for _G_CHIP_IDENT
...
* origin/capture/jpeg:
LF-13473-7: media: imx-jpeg: Ensure power suppliers be suspended before detach them
LF-13473-6: media: imx-jpeg: Set video drvdata before register video device
media: imx-jpeg: add support for imx9 jpeg codec
LF-5926: media: imx-jpeg: Add soft reset after frame done
* origin/capture/csi2-dwc:
LF-11503-1: media: nxp: dwc-mipi-csi2: Set default VC and DT in CSI when no get_frame_desc
LF-11414-1 media/platform/nxp: dwc-mipi-csi2: add support for RAW 16bit formats
LF-10587-05: media: nxp: add DesignWare MIPI CSI controller driver
Return 0 if streaming on the video device was already started. According
to the documentation:
"If VIDIOC_STREAMON is called when streaming is already in progress,
or if VIDIOC_STREAMOFF is called when streaming is already stopped,
then 0 is returned."
However, in our case -EBUSY is returned by mxc_isi_pipe_acquire(). Fix
this by checking whether we're streaming or not, before going through
with acquiring the ISI pipe.
Fixes: cf21f328fc ("media: nxp: Add i.MX8 ISI driver")
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
Reviewed-by: Guoniu Zhou <guoniu.zhou@nxp.com>
commit 9f070b1862f3411b8bcdfd51a8eaad25286f9deb upstream.
The v4l2_detect_cvt/gtf functions should check the result against the
timing capabilities: these functions calculate the timings, so if they
are out of bounds, they should be rejected.
To do this, add the struct v4l2_dv_timings_cap as argument to those
functions.
This required updates to the adv7604 and adv7842 drivers since the
prototype of these functions has now changed. The timings struct
that is passed to v4l2_detect_cvt/gtf in those two drivers is filled
with the timings detected by the hardware.
The vivid driver was also updated, but an additional check was added:
the width and height specified by VIDIOC_S_DV_TIMINGS has to match the
calculated result, otherwise something went wrong. Note that vivid
*emulates* hardware, so all the values passed to the v4l2_detect_cvt/gtf
functions came from the timings struct that was filled by userspace
and passed on to the driver via VIDIOC_S_DV_TIMINGS. So these fields
can contain random data. Both the constraints check via
struct v4l2_dv_timings_cap and the additional width/height check
ensure that the resulting timings are sane and not messed up by the
v4l2_detect_cvt/gtf calculations.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Fixes: 2576415846 ("[media] v4l2: move dv-timings related code to v4l2-dv-timings.c")
Cc: stable@vger.kernel.org
Reported-by: syzbot+a828133770f62293563e@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/linux-media/000000000000013050062127830a@google.com/
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
commit 1429826883bb18847092b2e04c6598ef34bae1d4 upstream.
Some IPU6 devices have shared interrupts. We need to handle properly
case when interrupt is triggered from other device on shared irq line
and IPU6 itself disabled. In such case we get 0xffffffff from
ISR_STATUS register and handle all irq's cases, for what we are not
not prepared and usually hang the whole system.
To avoid the issue use pm_runtime_get_if_active() to check if
the device is enabled and prevent suspending it when we handle irq
until the end of irq. Additionally use synchronize_irq() in suspend
Fixes: ab29a2478e ("media: intel/ipu6: add IPU6 buttress interface driver")
Cc: stable@vger.kernel.org
Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Hans de Goede <hdegoede@redhat.com> # ThinkPad X1 Yoga Gen 8, ov2740
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
commit ca59f9956d4519ab18ab2270be47c6b8c6ced091 upstream.
Atomicity violation occurs when the fmc_send_cmd() function is executed
simultaneously with the modification of the fmdev->resp_skb value.
Consider a scenario where, after passing the validity check within the
function, a non-null fmdev->resp_skb variable is assigned a null value.
This results in an invalid fmdev->resp_skb variable passing the validity
check. As seen in the later part of the function, skb = fmdev->resp_skb;
when the invalid fmdev->resp_skb passes the check, a null pointer
dereference error may occur at line 478, evt_hdr = (void *)skb->data;
To address this issue, it is recommended to include the validity check of
fmdev->resp_skb within the locked section of the function. This
modification ensures that the value of fmdev->resp_skb does not change
during the validation process, thereby maintaining its validity.
This possible bug is found by an experimental static analysis tool
developed by our team. This tool analyzes the locking APIs
to extract function pairs that can be concurrently executed, and then
analyzes the instructions in the paired functions to identify possible
concurrency bugs including data races and atomicity violations.
Fixes: e8454ff7b9 ("[media] drivers:media:radio: wl128x: FM Driver Common sources")
Cc: stable@vger.kernel.org
Signed-off-by: Qiu-ji Chen <chenqiuji666@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ Upstream commit c8e9120c2065868d97e9e94bceee777e5db08c3e ]
IPU6 driver doesn't override the dma_ops of device now, it doesn't
depends on the ARCH_HAS_DMA_OPS, so remove the dependency in Kconfig.
Fixes: de6c85bf91 ("dma-mapping: clearly mark DMA ops as an architecture feature")
Signed-off-by: Bingbu Cao <bingbu.cao@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
[ Upstream commit daabc5c64703432c4a8798421a3588c2c142c51b ]
DMA ops are a helper for architectures and not for drivers to override the
DMA implementation. Driver should not override the DMA implementation.
This patch removes the dma_ops override from auxiliary device and adds
driver-internal helpers that use the actual DMA mapping APIs.
Fixes: 9163d83573 ("media: intel/ipu6: add IPU6 DMA mapping API and MMU table")
Signed-off-by: Bingbu Cao <bingbu.cao@intel.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
[Sakari Ailus: Fix the commit message a little.]
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
[ Upstream commit 199c204bcc732ec18dbaec2b9d6445addbd376ea ]
Fix printing DMA and physical address printing on 32-bit platforms, by
using correct types. Also cast DMA_BIT_MASK() result to dma_addr_t to make
Clang happy.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Bingbu Cao <bingbu.cao@intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Stable-dep-of: daabc5c64703 ("media: ipu6: not override the dma_ops of device in driver")
Signed-off-by: Sasha Levin <sashal@kernel.org>