Commit Graph

34681 Commits

Author SHA1 Message Date
Ming Qian
3b53d8b471 LF-15180: media: imx-jpeg: Account for data_offset when getting image address
Applications may set data_offset when it refers to an output queue. So
driver need to account for it when getting the start address of input
image in the plane.

Meanwhile data_offset is included in bytesused. So the data_offset
should be subtracted from the payload of input image.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: Zhou Peng <eagle.zhou@nxp.com>
Acked-by: Jason Liu <jason.hui.liu@nxp.com>
2025-04-30 15:51:06 +08:00
Laurentiu Palcu
da02bb4fef LF-13923 media: nxp: imx8-isi: better handle the m2m usage_count
Currently, if streamon/streamoff calls are imbalanced we can either end up
with a negative ISI m2m usage_count (if streamoff() is called more times
than streamon()) in which case we'll not be able to restart the ISI pipe
next time, or the usage_count never gets to 0 and the pipe is never
switched off.

To avoid that, add a 'streaming' flag to mxc_isi_m2m_ctx_queue_data and use it
in the streamon/streamoff to avoid incrementing/decrementing the usage_count
uselessly, if called multiple times from the same context.

Fixes: cf21f328fc ("media: nxp: Add i.MX8 ISI driver")
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Tested-by: Guoniu Zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
Acked-by: Jason Liu <jason.hui.liu@nxp.com>
2024-11-18 20:24:05 +08:00
Laurentiu Palcu
d0fd392ad3 LF-13267 media: nxp: imx8-isi: fix v4l2-compliance test errors
Running the v4l2-compliance (1.27.0-5208, SHA: af114250d48d) on the m2m
device fails on the MMAP streaming tests, with the following messages:

fail: v4l2-test-buffers.cpp(240): g_field() == V4L2_FIELD_ANY
fail: v4l2-test-buffers.cpp(1508): buf.qbuf(node)

Apparently, the driver does not properly set the field member of
vb2_v4l2_buffer struct, returning the default V4L2_FIELD_ANY value which
is against the guidelines.

Fixes: cf21f328fc ("media: nxp: Add i.MX8 ISI driver")
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Guoniu Zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
Acked-by: Jason Liu <jason.hui.liu@nxp.com>
2024-11-18 20:23:21 +08:00
Laurentiu Palcu
91d5fa5dda LF-13725 media/i2c: ox03c10: initialize custom control values
Currently, interrogating the controls, before they're set for the first
time, will return all-zero values. To fix this, use the init() callback
in the v4l2_ctrl_type_ops structure to populate the initial control
values.

Also, when running the sensor initialization sequence, make sure we
don't cache the settings for the embedded data because they do not
contain register values. They contain ranges. Otherwise we'll end up
with wrong register values in the regmap cache.

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>
Tested-by: Celine Laurencin <celine.laurencin@nxp.com>
Reviewed-by: Celine Laurencin <celine.laurencin@nxp.com>
Acked-by: Jason Liu <jason.hui.liu@nxp.com>
2024-11-13 17:23:47 +08:00
Laurentiu Palcu
102df048cb LF-13840 media/i2c: ox03c10: change embedded data registers
Currently, the registers returned in the embedded data contain RW
registers for gains and exposure. That affects the way the registers are
updated which does not follow the specifications. Using the RO registers
fixes the problem. Also, move the embedded data initialization sequence
to the end and add a comment to be easier to find it out in the future.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Mirela Rabulea <Mirela.rabulea@nxp.com>
Tested-by: Celine Laurencin <celine.laurencin@nxp.com>
Reviewed-by: Celine Laurencin <celine.laurencin@nxp.com>
Acked-by: Jason Liu <jason.hui.liu@nxp.com>
2024-11-13 17:23:45 +08:00
Guoniu Zhou
fbb48d8e2d LF-13493: media: nxp: imx8-isi: Fix ISI write one more line issue
As mentioned in reference manual, ISI actual output line
value will be rounded up to an integer. For example, if
the input line value equal to 800 and the output line
value equal to 720, you must set [Y_SCALE] to a value
such that the theoretical output line value (800/[Y_SCALE])
is equal to or less than 720, which means:

1. If [Y_SCALE] is set to 1C8h, the theoretical output line
value equal to 719.859375 which will be rounded up to 720.
2. If [Y_SCALE] is set to 1C7h, the theoretical output line
value equal to 720.017578 which will be rounded up to 721.

There will be one excessive line in the actual output, So
adjust scale factor to make them equal.

Signed-off-by: Guoniu Zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2024-10-24 22:56:10 +08:00
Guoniu Zhou
d7f3dc683d MLK-26215: media: i2c: ap130x: Keep subdev name as v4l2 core set
Keep subdev name as v4l2 core set since libcamera camera module
model identification heuristic does not work properly, it will
identify camera modules by parsing the default name.

Signed-off-by: Guoniu Zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2024-10-24 22:55:30 +08:00
Guoniu Zhou
4bb1fd3d06 LF-13720: media: nxp: imx8-isi: Add more RGB formats support
Add more RGB formats which supported by ISI.

Signed-off-by: Guoniu Zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2024-10-24 22:37:29 +08:00
Alexi Birlinger
da6b71590a LF-13402: media: nxp: neoisp: Use default streamoff/streamon vb2_ioctl
A CMA leak is observed when interrupting the process abnormally. Before
the process stopped, if another interrupt signal is sent, the process
will be forcefully terminated without cleaning properly. This is
preventing any_buf to be released properly and context to be reset
to default as VIDIOC_STREAMOFF could not be sent.

This patch aims to perform cleaning before terminating the process
by using stop_streaming callback to release any_buf and reset context.
This callback is waiting for all buffers to be given back before
terminating, allowing to perform cleaning without being interrupted.
The streamon and streamoff callback will be managed by default video
buffer 2 core framework, while neoisp implementation will be performed
in start_streaming and stop_streaming callback.

Signed-off-by: Alexi Birlinger <alexi.birlinger@nxp.com>
Reviewed-by: Aymen Sghaier <aymen.sghaier@nxp.com>
2024-10-22 16:58:56 +02:00
Alexi Birlinger
2db308515b media: nxp: neoisp: Enable memory dump for LUT via debugfs
Adds dump methods to get isp memory status for Lookup tables.
The Vignetting, Global and Local DRC tonemap tables could be now dumped
using debugfs.

Signed-off-by: Alexi Birlinger <alexi.birlinger@nxp.com>
Reviewed-by: Aymen Sghaier <aymen.sghaier@nxp.com>
2024-10-22 16:50:07 +02:00
Robby Cai
ecd28da1c1 LF-13705-5 media: csi: Fix Coverity issue
Fix issue: CID 5486100: Dereference null return value (NULL_RETURNS)

Signed-off-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: Guoniu Zhou <guoniu.zhou@nxp.com>
2024-10-22 15:34:11 +08:00
Robby Cai
edc276f935 LF-13705-2 media: capture: ov5640_mipi_v2: Fix Coverity issue
Fix Coverity issue: CID 20813467 Enum compared against 0 (NO_EFFECT)
Removed it to fix.

Signed-off-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: Guoniu Zhou <guoniu.zhou@nxp.com>
2024-10-22 15:34:10 +08:00
Robby Cai
311551b0b7 LF-13705-1 media: mxc: pxp_v4l2: Fix Coverity issue
Fix Coverity issue: CID 5484434 of "dereference null return value".
The function pxp_get_format could return NULL, so add the check before use.

Signed-off-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: Guoniu Zhou <guoniu.zhou@nxp.com>
2024-10-22 15:34:09 +08:00
Guoniu Zhou
d0f515bfd6 MLK-26216-02: media: i2c: ap130x: Add two fwnode properities support
Add V4L2_CID_CAMERA_ORIENTATION and V4L2_CID_CAMERA_SENSOR_ROTATION
support for AP1302 device by adding "orientation" and "rotation" two
fwnode properityes to fix libcamera warning since they are recommended
V4L2 control in libcamera.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2024-10-17 15:21:07 +08:00
Laurentiu Palcu
91bb52d5de LF-13684-8 media/i2c: mx95mbcam: fix "declared but not referenced" Coverity issue
The mx95mbcam_ctrl_type_ops structure is not used anywhere. Remove it.
Also, remove the mx95mbcam_ctrl_type_op_validate() which was only
referenced in the structure.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
2024-10-16 09:00:32 +00:00
Laurentiu Palcu
37473cbaad LF-13684-7 media/i2c: max96724: fix "out-of-bounds write" Coverity issue
The issue can happen with csi2_video_pipe_mask array accesses if
csi_of_ep.port < MAX96724_SRC_PAD or higher than MAX96724_N_PADS. Add a
check to make sure we don't get there. Since the function can now return
-EINVAL, add also a check in the caller function to handle this
situation.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
2024-10-16 09:00:32 +00:00
Laurentiu Palcu
c5124fd78a LF-13684-6 media/i2c: max96724: fix "dereference null return value" Coverity issue
The v4l2_subdev_state_get_opposite_stream_format() function can return
NULL. Add a check before continuing.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
2024-10-16 09:00:32 +00:00
Laurentiu Palcu
04c87f3858 LF-13684-5 media/i2c: max96724: fix "unused value" Coverity issue
There is a valid issue inside the function where ret is assigned the
returned value of max96724_xlate_streams() in case of error and then we
jump to 'unlock' only to return 0. So, let's use that ret value this
time. Also, initialize ret to 0 to avoid returning wrong value if
pos == -1 in the while loop.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
2024-10-16 09:00:31 +00:00
Laurentiu Palcu
18a31effaf LF-13684-4 media/i2c: max96724: fix "uninitialized scalar variable" Coverity issues
This patch covers multiple Coverity "uninitialized scalar variable"
issues, all of them false positives since they'll get written in
subsequent function calls when their address is passed on as arguments
to those functions. However, I don't see any issues with initializing
those variables first and Coverity will be happy about it.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
2024-10-16 09:00:31 +00:00
Laurentiu Palcu
d457eb6502 LF-13684-3 media/i2c: max96717: fix "uninitialized scalar variable" Coverity issue
This is a false positive Coverity issue as reg_val will be written when
calling regmap_read(). However, there's nothing inherently wrong with
initializing the variable to 0 and this will also make Coverity happy.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
2024-10-16 09:00:31 +00:00
Laurentiu Palcu
af6162a4db LF-13684-2 media/i2c: ox03c10: fix "extra sizeof expression" Coverity issue
The error revealed a hidden bug with setting the WB registers for LCG,
SPD and VS. They all replicated the HCG values because of incorrect
pointer arithmetic in the for loop initialization.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
2024-10-16 09:00:31 +00:00
Laurentiu Palcu
1e2d519f03 LF-13684-1 media/i2c: ox03c10: fix "uninitialized scalar variable" Coverity issues
The issue reported in ox03c10_streaming_start() is genuine. Variable
'ret' was not initialized which could lead to reporting that starting
streaming failed.

The issue reported in ox03c10_otp_correction_get() is a false positive.
Even though the regmap_bulk_read() will overwrite all the array values
with the ones read from the sensor, let's initialize the array to 0 to
silence Coverity.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
2024-10-16 09:00:31 +00:00
Mirela Rabulea
23988dfd99 LF-13588-1: media: ox05b1s: Use centrally managed subdev active state
Remove format member from sensor structure, the sensor subdevice will
not track the state internally, instead it will use the managed
subdev active state, in ox05b1s_set_fmt for example.

Remove ox05b1s_get_fmt and use v4l2_subdev_get_fmt instead.

Use v4l2_subdev_init_finalize to opt-in for managed state, use the same
sensor lock, and initialize it sooner.

Do not lock in set_fmt and get_selection, as these ioctls, among others,
are called from a wrapper that already takes the lock if the subdev
uses active state, see DEFINE_STATE_WRAPPER.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
2024-10-13 10:52:58 +03:00
Mirela Rabulea
5a2fe25a58 LF-13436: media: ox05b1s: Fix hdr_mode control
The current setting of the hdr_mode control is not working properly.
Cannot count on ox05b1s_update_controls() to actually write the
sensor registers, as the sensor may be suspended. Remove the
setting of hdr_mode from ox05b1s_update_controls(), as it is not
useful here, and it was wrong anyway, it should not be set to
the default value, that will overwrite what was set by user.
Instead, use __v4l2_ctrl_handler_setup in ox05b1s_apply_current_mode(),
to ensure control values are written in sensor registers
before streaming starts.

Also, update some comments.

Fixes: 17597cc375 ("LF-12210-2: media: ox05b1s: Add omnivision OX05B1S raw sensor driver")

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
2024-10-13 10:13:53 +03:00
Guoniu.zhou
a232ed03f5 LF-13493: media: nxp: imx8-isi: Add max size for memory ISI can access
ISI may exceed its bounds by accessing memory that does not
belong to it when work with 7 VPU instance at same time. It
maybe a IC bug(TKT0661750), so specifies the maximum size
(in bytes) for the memory location. Tentative write out of
this max size range is not allowed. The feature of ISI is
introduced in iMX95 ISI version.

Reproduce steps:
Setup media pipeline for camera and run commands as bellow:
gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,width=1280,height=800,format=YUY2 ! queue ! waylandsink window-width=320 window-height=240 &

gst-launch-1.0 videotestsrc ! video/x-raw,width=1280,height=576 ! v4l2h264enc ! h264parse ! v4l2h264dec ! waylandsink window-width=320 window-height=240 &
gst-launch-1.0 videotestsrc ! video/x-raw,width=1280,height=576 ! v4l2h264enc ! h264parse ! v4l2h264dec ! waylandsink window-width=320 window-height=240 &
gst-launch-1.0 videotestsrc ! video/x-raw,width=1280,height=576 ! v4l2h264enc ! h264parse ! v4l2h264dec ! waylandsink window-width=320 window-height=240 &
gst-launch-1.0 videotestsrc ! video/x-raw,width=1280,height=576 ! v4l2h264enc ! h264parse ! v4l2h264dec ! waylandsink window-width=320 window-height=240 &
gst-launch-1.0 videotestsrc ! video/x-raw,width=1280,height=576 ! v4l2h264enc ! h264parse ! v4l2h264dec ! waylandsink window-width=320 window-height=240 &
gst-launch-1.0 videotestsrc ! video/x-raw,width=1280,height=576 ! v4l2h264enc ! h264parse ! v4l2h264dec ! waylandsink window-width=320 window-height=240 &
gst-launch-1.0 videotestsrc ! video/x-raw,width=1280,height=576 ! v4l2h264enc ! h264parse ! v4l2h264dec ! waylandsink window-width=320 window-height=240 &

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2024-10-11 18:20:41 +08:00
Ming Qian
d823f92ed5 LF-13473-8: media: amphion: Set video drvdata before register video device
the video drvdata should be set before the video device is registered,
otherwise video_drvdata() may return NULL in the open() file ops, and led
to oops.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2024-10-10 18:29:24 +09:00
Ming Qian
525fc9e53a LF-13473-7: media: imx-jpeg: Ensure power suppliers be suspended before detach them
The power suppliers are always requested to suspend asynchronously,
dev_pm_domain_detach() requires the caller to ensure proper
synchronization of this function with power management callbacks.
otherwise the detach may led to kernel panic, like below:

[ 1457.107934] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000040
[ 1457.116777] Mem abort info:
[ 1457.119589]   ESR = 0x0000000096000004
[ 1457.123358]   EC = 0x25: DABT (current EL), IL = 32 bits
[ 1457.128692]   SET = 0, FnV = 0
[ 1457.131764]   EA = 0, S1PTW = 0
[ 1457.134920]   FSC = 0x04: level 0 translation fault
[ 1457.139812] Data abort info:
[ 1457.142707]   ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000
[ 1457.148196]   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
[ 1457.153256]   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
[ 1457.158563] user pgtable: 4k pages, 48-bit VAs, pgdp=00000001138b6000
[ 1457.165000] [0000000000000040] pgd=0000000000000000, p4d=0000000000000000
[ 1457.171792] Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
[ 1457.178045] Modules linked in: v4l2_jpeg wave6_vpu_ctrl(-) [last unloaded: mxc_jpeg_encdec]
[ 1457.186383] CPU: 0 PID: 51938 Comm: kworker/0:3 Not tainted 6.6.36-gd23d64eea511 #66
[ 1457.194112] Hardware name: NXP i.MX95 19X19 board (DT)
[ 1457.199236] Workqueue: pm pm_runtime_work
[ 1457.203247] pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 1457.210188] pc : genpd_runtime_suspend+0x20/0x290
[ 1457.214886] lr : __rpm_callback+0x48/0x1d8
[ 1457.218968] sp : ffff80008250bc50
[ 1457.222270] x29: ffff80008250bc50 x28: 0000000000000000 x27: 0000000000000000
[ 1457.229394] x26: 0000000000000000 x25: 0000000000000008 x24: 00000000000f4240
[ 1457.236518] x23: 0000000000000000 x22: ffff00008590f0e4 x21: 0000000000000008
[ 1457.243642] x20: ffff80008099c434 x19: ffff00008590f000 x18: ffffffffffffffff
[ 1457.250766] x17: 5300326563697665 x16: 645f676e696c6f6f x15: 63343a6d726f6674
[ 1457.257890] x14: 0000000000000004 x13: 00000000000003a4 x12: 0000000000000002
[ 1457.265014] x11: 0000000000000000 x10: 0000000000000a60 x9 : ffff80008250bbb0
[ 1457.272138] x8 : ffff000092937200 x7 : ffff0003fdf6af80 x6 : 0000000000000000
[ 1457.279262] x5 : 00000000410fd050 x4 : 0000000000200000 x3 : 0000000000000000
[ 1457.286386] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff00008590f000
[ 1457.293510] Call trace:
[ 1457.295946]  genpd_runtime_suspend+0x20/0x290
[ 1457.300296]  __rpm_callback+0x48/0x1d8
[ 1457.304038]  rpm_callback+0x6c/0x78
[ 1457.307515]  rpm_suspend+0x10c/0x570
[ 1457.311077]  pm_runtime_work+0xc4/0xc8
[ 1457.314813]  process_one_work+0x138/0x248
[ 1457.318816]  worker_thread+0x320/0x438
[ 1457.322552]  kthread+0x110/0x114
[ 1457.325767]  ret_from_fork+0x10/0x20

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2024-10-10 18:29:24 +09:00
Ming Qian
a814c549c5 LF-13473-6: media: imx-jpeg: Set video drvdata before register video device
the video drvdata should be set before the video device is registered,
otherwise video_drvdata() may return NULL in the open() file ops, and led
to oops.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2024-10-10 18:29:24 +09:00
TaoJiang
d7403ef2aa lf-13605: arm64: virtio video: solve warning
change variable type

Signed-off-by: TaoJiang <tao.jiang_2@nxp.com>
2024-10-09 11:20:21 +05:30
TaoJiang
e1e4ac7c48 LF-13605: arm64: virtio video: limit codec buffer size
Currently, IOMMU was not enabled, so SWIOTLB was used.
But the default maximum size of one singe bounce is 256KB
So we need to limit codec buffer size.
When IOMMU is enabled, we can revert this patch.

Signed-off-by: TaoJiang <tao.jiang_2@nxp.com>
Reviewed-by: MingQian <ming.qian@nxp.com>
2024-10-09 11:11:06 +05:30
TaoJiang
06f9153494 LF-13605: add imx virtio video improvement v1.0
optimize performace for xen.
adapt gstreamer & unittest

Signed-off-by: TaoJiang <tao.jiang_2@nxp.com>
2024-10-08 14:32:12 +05:30
Ming Qian
d7c90011a0 virtio_video: Add the Virtio Video V4L2 driver
This adds a Virtio based video driver for video streaming device that
operates input and output data buffers to share video devices with
several guests. The current implementation consist of V4L2 based video
driver supporting video functions of decoder and encoder. The device
uses command structures to advertise and negotiate stream formats and
controls. This allows the driver to modify the processing logic of the
device on a per stream basis.

from https://github.com/aesteve-rh/linux,
align with 80c89869c3f7 ("virtio_video: add vicodec support and config")

Signed-off-by: Albert Esteve <aesteve@redhat.com>
Signed-off-by: Dmitry Sepp <dmitry.sepp@opensynergy.com>
Signed-off-by: Kiran Pawar <Kiran.Pawar@opensynergy.com>
Signed-off-by: Nikolay Martyanov <Nikolay.Martyanov@opensynergy.com>
Signed-off-by: Samiullah Khawaja <samiullah.khawaja@opensynergy.com>
Signed-off-by: Keiichi Watanabe <keiichiw@chromium.org>
2024-10-08 14:31:13 +05:30
Jason Liu
239f62168d This is the 6.6.51 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmbisF0ACgkQONu9yGCS
 aT5Y8xAAqS/rmrC+/qlFvbtAqK+KXLq9BIGvDHW2QHfCyMpSZ6isehVhh64apHE/
 /XvJ6a+2iPVp5o52iDTUKzbcDr3Jx/QwhS8Xa/HyQQy1rXIPpJNJb8Vuvkn/B2Cq
 cPCfTtfPZUUQTd09uAdBhy5NT8hsT2kSVpmSXDnahn9ih8k0tR40udw5Qf7xpWcf
 HqljbfonLP86mF/SB9m+VhDGF9fekujyb+0iS0OPE+TdvSjKB9ySoeL4PIeTSxrz
 goZdp9ygAYy8Bks825ztbfQszqIwceHU/xZRaUrGfOOk4A5kwTmbdUQu7ooMc+5F
 kbpifbewmY1UGn2KTxgj59xCjQ7HLQe+sqacy0/gALzRSajUNyjLn0n4w3UqaJWb
 pf+gwqHBLgDRfvWctggEdY2ApKgOlM9D7TTpWWB9uv1oR/g3PGfgehZgrMMPgPUw
 EZ8JiwnITfRaRFiH/vSR3aJKRj6qjb4mX3/U8HgGcACtyFfHgtuI7jzhnX36fRNO
 FG38bxSUMrJnlohghfBl6zyaruZBMHVaoQzs6MYZ7qrVvCbt3CHivJdaQ85nw0h7
 YHa2zYFfT0ztyaSMzWq6JatgI7BZfd8PjobhbRZADBBD39KC8aL8XLoDPnpzWMUY
 UDlK8n96gOKo0t8ILDWcIisCVGNogcHJlGppC8Fu7ZyKzYsMhN4=
 =OEL/
 -----END PGP SIGNATURE-----

Merge tag 'v6.6.51' into lf-6.6.y

This is the 6.6.51 stable release

* tag 'v6.6.51': (2369 commits)
  Linux 6.6.51
  Bluetooth: hci_sync: Fix UAF on hci_abort_conn_sync
  Bluetooth: hci_sync: Fix UAF on create_le_conn_complete
  ...

Signed-off-by: Jason Liu <jason.hui.liu@nxp.com>

 Conflicts:
	arch/arm64/boot/dts/freescale/imx8mp.dtsi
	arch/arm64/boot/dts/freescale/imx93.dtsi
	drivers/dma/fsl-edma-common.c
	drivers/dma/fsl-edma-common.h
	drivers/dma/fsl-edma.c
	drivers/irqchip/irq-imx-irqsteer.c
	drivers/perf/fsl_imx9_ddr_perf.c
	drivers/spi/spi-fsl-lpspi.c
	sound/soc/sof/imx/imx8m.c
2024-09-24 11:49:41 +08:00
Chen Ni
b4987d0236 media: qcom: camss: Add check for v4l2_fwnode_endpoint_parse
[ Upstream commit 4caf6d93d9 ]

Add check for the return value of v4l2_fwnode_endpoint_parse() and
return the error if it fails in order to catch the error.

Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-09-12 11:11:31 +02:00
Hans Verkuil
4676bacc6e media: vivid: don't set HDMI TX controls if there are no HDMI outputs
[ Upstream commit 17763960b1 ]

When setting the EDID it would attempt to update two controls
that are only present if there is an HDMI output configured.

If there isn't any (e.g. when the vivid module is loaded with
node_types=1), then calling VIDIOC_S_EDID would crash.

Fix this by first checking if outputs are present.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-09-12 11:11:31 +02:00
Hans Verkuil
6ae2e315a3 media: vivid: fix wrong sizeimage value for mplane
[ Upstream commit 0fd7c0c2c1 ]

In several places a division by fmt->vdownsampling[p] was
missing in the sizeimage[p] calculation, causing incorrect
behavior for multiplanar formats were some planes are smaller
than the first plane.

Found by new v4l2-compliance tests.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-09-12 11:11:30 +02:00
Ricardo Ribalda
d8915d2716 media: uvcvideo: Enforce alignment of frame and interval
[ Upstream commit c8931ef55b ]

Struct uvc_frame and interval (u32*) are packaged together on
streaming->formats on a single contiguous allocation.

Right now they are allocated right after uvc_format, without taking into
consideration their required alignment.

This is working fine because both structures have a field with a
pointer, but it will stop working when the sizeof() of any of those
structs is not a multiple of the sizeof(void*).

Enforce that alignment during the allocation.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://lore.kernel.org/r/20240404-uvc-align-v2-1-9e104b0ecfbd@chromium.org
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-09-08 07:54:49 +02:00
Sakari Ailus
f576acf752 media: v4l2-cci: Always assign *val
[ Upstream commit 7417b1b1f3 ]

Always assign *val to 0 in cci_read(). This has the benefit of not
requiring initialisation of the variables data is read to using
cci_read(). Once smatch is fixed, it could catch the use of uninitialised
reads.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-09-08 07:54:44 +02:00
Philipp Stanner
2f50c1ea7f media: drivers/media/dvb-core: copy user arrays safely
[ Upstream commit 102fb77c2d ]

At several positions in dvb_frontend.c, memdup_user() is utilized to
copy userspace arrays. This is done without overflow checks.

Use the new wrapper memdup_array_user() to copy the arrays more safely.

Link: https://lore.kernel.org/linux-media/20231102191633.52592-2-pstanner@redhat.com
Suggested-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Philipp Stanner <pstanner@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-08-29 17:33:34 +02:00
Hans Verkuil
b1397fb4a7 media: pci: cx23885: check cx23885_vdev_init() return
[ Upstream commit 15126b916e ]

cx23885_vdev_init() can return a NULL pointer, but that pointer
is used in the next line without a check.

Add a NULL pointer check and go to the error unwind if it is NULL.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reported-by: Sicong Huang <huangsicong@iie.ac.cn>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-08-29 17:33:33 +02:00
Hans Verkuil
9649d26dc9 media: qcom: venus: fix incorrect return value
[ Upstream commit 51b74c09ac ]

'pd' can be NULL, and in that case it shouldn't be passed to
PTR_ERR. Fixes a smatch warning:

drivers/media/platform/qcom/venus/pm_helpers.c:873 vcodec_domains_get() warn: passing zero to 'PTR_ERR'

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-08-29 17:33:27 +02:00
Chengfeng Ye
e6571cff84 media: s5p-mfc: Fix potential deadlock on condlock
[ Upstream commit 04d19e6513 ]

As &dev->condlock is acquired under irq context along the following
call chain from s5p_mfc_irq(), other acquisition of the same lock
inside process context or softirq context should disable irq avoid double
lock. enc_post_frame_start() seems to be one such function that execute
under process context or softirq context.

<deadlock #1>

enc_post_frame_start()
--> clear_work_bit()
--> spin_loc(&dev->condlock)
<interrupt>
   --> s5p_mfc_irq()
   --> s5p_mfc_handle_frame()
   --> clear_work_bit()
   --> spin_lock(&dev->condlock)

This flaw was found by an experimental static analysis tool I am
developing for irq-related deadlock.

To prevent the potential deadlock, the patch change clear_work_bit()
inside enc_post_frame_start() to clear_work_bit_irqsave().

Signed-off-by: Chengfeng Ye <dg573847474@gmail.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-08-29 17:33:26 +02:00
Hans Verkuil
55e9057c8a media: radio-isa: use dev_name to fill in bus_info
[ Upstream commit 8b7f3cf4eb ]

This fixes this warning:

drivers/media/radio/radio-isa.c: In function 'radio_isa_querycap':
drivers/media/radio/radio-isa.c:39:57: warning: '%s' directive output may be truncated writing up to 35 bytes into a region of size 28 [-Wformat-truncation=]
   39 |         snprintf(v->bus_info, sizeof(v->bus_info), "ISA:%s", isa->v4l2_dev.name);
      |                                                         ^~
drivers/media/radio/radio-isa.c:39:9: note: 'snprintf' output between 5 and 40 bytes into a destination of size 32
   39 |         snprintf(v->bus_info, sizeof(v->bus_info), "ISA:%s", isa->v4l2_dev.name);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-08-29 17:33:25 +02:00
Mirela Rabulea
f34f51f27d LF-13206: media: ox05b1s: Update controls when format changes
The first run with libcamera does not work because the pixel rate
control value is not updated after set_fmt, it is only updated during
the first streamon. This is causing libcamerasrc negotiation failure
with the downstream caps filter on the fps.
So, update control values to reflect the current format upon
set_fmt.

Signed-off-by: Mirela Rabulea <mirela.rabulea@oss.nxp.com>
Reviewed-by: Alexi Birlinger <alexi.birlinger@nxp.com>
Tested-by: Alexi Birlinger <alexi.birlinger@nxp.com>
Acked-by: Jason Liu <jason.hui.liu@nxp.com>
2024-08-23 11:46:56 +08:00
Sean Young
fb6f56244a media: Revert "media: dvb-usb: Fix unexpected infinite loop in dvb_usb_read_remote_control()"
commit 0c84bde4f3 upstream.

This reverts commit 2052138b7d.

This breaks the TeVii s480 dual DVB-S2 S660. The device has a bulk in
endpoint but no corresponding out endpoint, so the device does not pass
the "has both receive and send bulk endpoint" test.

Seemingly this device does not use dvb_usb_generic_rw() so I have tried
removing the generic_bulk_ctrl_endpoint entry, but this resulted in
different problems.

As we have no explanation yet, revert.

$ dmesg | grep -i -e dvb -e dw21 -e usb\ 4
[    0.999122] usb 1-1: new high-speed USB device number 2 using ehci-pci
[    1.023123] usb 4-1: new high-speed USB device number 2 using ehci-pci
[    1.130247] usb 1-1: New USB device found, idVendor=9022, idProduct=d482,
+bcdDevice= 0.01
[    1.130257] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    1.152323] usb 4-1: New USB device found, idVendor=9022, idProduct=d481,
+bcdDevice= 0.01
[    1.152329] usb 4-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    6.701033] dvb-usb: found a 'TeVii S480.2 USB' in cold state, will try to
+load a firmware
[    6.701178] dvb-usb: downloading firmware from file 'dvb-usb-s660.fw'
[    6.701179] dw2102: start downloading DW210X firmware
[    6.703715] dvb-usb: found a 'Microsoft Xbox One Digital TV Tuner' in cold
+state, will try to load a firmware
[    6.703974] dvb-usb: downloading firmware from file 'dvb-usb-dib0700-1.20.fw'
[    6.756432] usb 1-1: USB disconnect, device number 2
[    6.862119] dvb-usb: found a 'TeVii S480.2 USB' in warm state.
[    6.862194] dvb-usb: TeVii S480.2 USB error while loading driver (-22)
[    6.862209] dvb-usb: found a 'TeVii S480.1 USB' in cold state, will try to
+load a firmware
[    6.862244] dvb-usb: downloading firmware from file 'dvb-usb-s660.fw'
[    6.862245] dw2102: start downloading DW210X firmware
[    6.914811] usb 4-1: USB disconnect, device number 2
[    7.014131] dvb-usb: found a 'TeVii S480.1 USB' in warm state.
[    7.014487] dvb-usb: TeVii S480.1 USB error while loading driver (-22)
[    7.014538] usbcore: registered new interface driver dw2102

Closes: https://lore.kernel.org/stable/20240801165146.38991f60@mir/

Fixes: 2052138b7d ("media: dvb-usb: Fix unexpected infinite loop in dvb_usb_read_remote_control()")
Reported-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>
Cc: stable@vger.kernel.org
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-08-19 06:04:31 +02:00
Chi Zhiling
850304152d media: xc2028: avoid use-after-free in load_firmware_cb()
[ Upstream commit 68594cec29 ]

syzkaller reported use-after-free in load_firmware_cb() [1].
The reason is because the module allocated a struct tuner in tuner_probe(),
and then the module initialization failed, the struct tuner was released.
A worker which created during module initialization accesses this struct
tuner later, it caused use-after-free.

The process is as follows:

task-6504           worker_thread
tuner_probe                             <= alloc dvb_frontend [2]
...
request_firmware_nowait                 <= create a worker
...
tuner_remove                            <= free dvb_frontend
...
                    request_firmware_work_func  <= the firmware is ready
                    load_firmware_cb    <= but now the dvb_frontend has been freed

To fix the issue, check the dvd_frontend in load_firmware_cb(), if it is
null, report a warning and just return.

[1]:
    ==================================================================
     BUG: KASAN: use-after-free in load_firmware_cb+0x1310/0x17a0
     Read of size 8 at addr ffff8000d7ca2308 by task kworker/2:3/6504

     Call trace:
      load_firmware_cb+0x1310/0x17a0
      request_firmware_work_func+0x128/0x220
      process_one_work+0x770/0x1824
      worker_thread+0x488/0xea0
      kthread+0x300/0x430
      ret_from_fork+0x10/0x20

     Allocated by task 6504:
      kzalloc
      tuner_probe+0xb0/0x1430
      i2c_device_probe+0x92c/0xaf0
      really_probe+0x678/0xcd0
      driver_probe_device+0x280/0x370
      __device_attach_driver+0x220/0x330
      bus_for_each_drv+0x134/0x1c0
      __device_attach+0x1f4/0x410
      device_initial_probe+0x20/0x30
      bus_probe_device+0x184/0x200
      device_add+0x924/0x12c0
      device_register+0x24/0x30
      i2c_new_device+0x4e0/0xc44
      v4l2_i2c_new_subdev_board+0xbc/0x290
      v4l2_i2c_new_subdev+0xc8/0x104
      em28xx_v4l2_init+0x1dd0/0x3770

     Freed by task 6504:
      kfree+0x238/0x4e4
      tuner_remove+0x144/0x1c0
      i2c_device_remove+0xc8/0x290
      __device_release_driver+0x314/0x5fc
      device_release_driver+0x30/0x44
      bus_remove_device+0x244/0x490
      device_del+0x350/0x900
      device_unregister+0x28/0xd0
      i2c_unregister_device+0x174/0x1d0
      v4l2_device_unregister+0x224/0x380
      em28xx_v4l2_init+0x1d90/0x3770

     The buggy address belongs to the object at ffff8000d7ca2000
      which belongs to the cache kmalloc-2k of size 2048
     The buggy address is located 776 bytes inside of
      2048-byte region [ffff8000d7ca2000, ffff8000d7ca2800)
     The buggy address belongs to the page:
     page:ffff7fe00035f280 count:1 mapcount:0 mapping:ffff8000c001f000 index:0x0
     flags: 0x7ff800000000100(slab)
     raw: 07ff800000000100 ffff7fe00049d880 0000000300000003 ffff8000c001f000
     raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000
     page dumped because: kasan: bad access detected

     Memory state around the buggy address:
      ffff8000d7ca2200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      ffff8000d7ca2280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
     >ffff8000d7ca2300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                           ^
      ffff8000d7ca2380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      ffff8000d7ca2400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
     ==================================================================

[2]
    Actually, it is allocated for struct tuner, and dvb_frontend is inside.

Signed-off-by: Chi Zhiling <chizhiling@kylinos.cn>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-08-14 13:58:46 +02:00
Michal Pecio
7f855b6681 media: uvcvideo: Fix the bandwdith quirk on USB 3.x
[ Upstream commit 9e3d55fbd1 ]

The bandwidth fixup quirk doesn't know that SuperSpeed exists and has
the same 8 service intervals per millisecond as High Speed, hence its
calculations are wrong.

Assume that all speeds from HS up use 8 intervals per millisecond.

No further changes are needed, updated code has been confirmed to work
with all speeds from FS to SS.

Signed-off-by: Michal Pecio <michal.pecio@gmail.com>
Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://lore.kernel.org/r/20240414190040.2255a0bc@foxbook
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-08-14 13:58:46 +02:00
Ricardo Ribalda
5b835d12cf media: uvcvideo: Ignore empty TS packets
[ Upstream commit 5cd7c25f6f ]

Some SunplusIT cameras took a borderline interpretation of the UVC 1.5
standard, and fill the PTS and SCR fields with invalid data if the
package does not contain data.

"STC must be captured when the first video data of a video frame is put
on the USB bus."

Some SunplusIT devices send, e.g.,

buffer: 0xa7755c00 len 000012 header:0x8c stc 00000000 sof 0000 pts 00000000
buffer: 0xa7755c00 len 000012 header:0x8c stc 00000000 sof 0000 pts 00000000
buffer: 0xa7755c00 len 000668 header:0x8c stc 73779dba sof 070c pts 7376d37a

While the UVC specification meant that the first two packets shouldn't
have had the SCR bit set in the header.

This borderline/buggy interpretation has been implemented in a variety
of devices, from directly SunplusIT and from other OEMs that rebrand
SunplusIT products. So quirking based on VID:PID will be problematic.

All the affected modules have the following extension unit:
VideoControl Interface Descriptor:
  guidExtensionCode         {82066163-7050-ab49-b8cc-b3855e8d221d}

But the vendor plans to use that GUID in the future and fix the bug,
this means that we should use heuristic to figure out the broken
packets.

This patch takes care of this.

lsusb of one of the affected cameras:

Bus 001 Device 003: ID 1bcf:2a01 Sunplus Innovation Technology Inc.
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.01
  bDeviceClass          239 Miscellaneous Device
  bDeviceSubClass         2 ?
  bDeviceProtocol         1 Interface Association
  bMaxPacketSize0        64
  idVendor           0x1bcf Sunplus Innovation Technology Inc.
  idProduct          0x2a01
  bcdDevice            0.02
  iManufacturer           1 SunplusIT Inc
  iProduct                2 HanChen Wise Camera
  iSerial                 3 01.00.00
  bNumConfigurations      1

Tested-by: HungNien Chen <hn.chen@sunplusit.com>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Link: https://lore.kernel.org/r/20240323-resend-hwtimestamp-v10-2-b08e590d97c7@chromium.org
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-08-14 13:58:46 +02:00
Ming Qian
a29c1e51ef media: amphion: Remove lock in s_ctrl callback
[ Upstream commit 065927b51e ]

There is no need to add a lock in s_ctrl callback, it has been
synchronized by the ctrl_handler's lock, otherwise it may led to
a deadlock if the driver calls v4l2_ctrl_s_ctrl().

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-08-14 13:58:45 +02:00
Guoniu.zhou
d257108142 LF-13106: media: imx-csi-formatter: Fix kernel oops issue
Fix kernel oops issue when capture without pipeline setup, log
as bellow:

[   65.185151] Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
[   65.217211] CPU: 2 PID: 730 Comm: v4l2-ctl Not tainted 6.6.36-g7bb0a8c6ab3d #31
[   65.224506] Hardware name: NXP i.MX95 19X19 board (DT)
[   65.229635] pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[   65.236579] pc : formatter_subdev_enable_streams+0xb0/0x22c
[   65.242143] lr : formatter_subdev_enable_streams+0x188/0x22c
[   65.247794] sp : ffff80008576b940
[   65.251096] x29: ffff80008576b940 x28: ffff000085b3e180 x27: ffff0000806844b0
[   65.258220] x26: 0000000000000002 x25: ffff000080684480 x24: 0000000000000001
[   65.265344] x23: ffff000080f37010 x22: 0000000000000000 x21: ffff00008442cae0
[   65.272468] x20: ffff0000810e3498 x19: ffff0000810e3480 x18: ffffffffffffffff
[   65.279592] x17: 6d6920646c756f68 x16: 7320312064617020 x15: 6e6f206563697665
[   65.286724] x14: 642d627573206574 x13: ffff800082091528 x12: 000000000000081c
[   65.293848] x11: 00000000000002b4 x10: ffff8000820e9528 x9 : 0000000000000000
[   65.300972] x8 : ffff80008576b7e4 x7 : 0000000000000000 x6 : ffff000080f37190
[   65.308096] x5 : 0000000000000000 x4 : 0000000000000000 x3 : 0000000000000000
[   65.315220] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff8000816e7000
[   65.322345] Call trace:
[   65.324781]  formatter_subdev_enable_streams+0xb0/0x22c
[   65.329997]  v4l2_subdev_enable_streams+0xe8/0x26c
[   65.334781]  mxc_isi_crossbar_enable_streams+0x12c/0x1d0
[   65.340085]  v4l2_subdev_enable_streams+0xe8/0x26c
[   65.344869]  mxc_isi_pipe_enable+0x204/0x2ac
[   65.349124]  mxc_isi_vb2_start_streaming+0xa0/0xe4
[   65.353908]  vb2_start_streaming+0x68/0x15c
[   65.358086]  vb2_core_streamon+0xf8/0x1bc
[   65.362081]  vb2_streamon+0x18/0x64
[   65.365565]  mxc_isi_video_streamon+0x28c/0x314
[   65.370080]  v4l_streamon+0x24/0x30
[   65.373564]  __video_do_ioctl+0x32c/0x3f8
[   65.377568]  video_usercopy+0x2c8/0x658
[   65.381399]  video_ioctl2+0x18/0x24
[   65.384883]  v4l2_ioctl+0x40/0x60
[   65.388194]  __arm64_sys_ioctl+0xac/0xf0
[   65.392111]  invoke_syscall+0x48/0x114
[   65.395855]  el0_svc_common.constprop.0+0xc0/0xe0
[   65.400552]  do_el0_svc+0x1c/0x28
[   65.403863]  el0_svc+0x40/0xe4
[   65.406914]  el0t_64_sync_handler+0x120/0x12c
[   65.411264]  el0t_64_sync+0x190/0x194
[   65.414916] Code: a8c57bfd d50323bf d65f03c0 f0004320 (39401085)
[   65.420998] ---[ end trace 0000000000000000 ]---

Reproduce step:
  Run command as bellow after system boot.
  $ v4l2-ctl -v width=1920,height=1080,pixelformat=YUYV --stream-mmap

The reason is that it will try to get data type index by searching map
between data type and its index when start capture, but the data type
is missing by default if no pipepline setup. So initialize the data type
to default value aligned to subdev format.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2024-08-06 16:38:41 +08:00