Commit Graph

34681 Commits

Author SHA1 Message Date
Fei Shao
5c217253c7 media: mediatek: vcodec: Only free buffer VA that is not NULL
[ Upstream commit eb005c801e ]

In the MediaTek vcodec driver, while mtk_vcodec_mem_free() is mostly
called only when the buffer to free exists, there are some instances
that didn't do the check and triggered warnings in practice.

We believe those checks were forgotten unintentionally. Add the checks
back to fix the warnings.

Signed-off-by: Fei Shao <fshao@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-07-11 12:49:04 +02:00
Ricardo Ribalda
c15bb7c940 media: dvb-usb: dib0700_devices: Add missing release_firmware()
[ Upstream commit 4b267c23ee ]

Add missing release_firmware on the error paths.

drivers/media/usb/dvb-usb/dib0700_devices.c:2415 stk9090m_frontend_attach() warn: 'state->frontend_firmware' from request_firmware() not released on lines: 2415.
drivers/media/usb/dvb-usb/dib0700_devices.c:2497 nim9090md_frontend_attach() warn: 'state->frontend_firmware' from request_firmware() not released on lines: 2489,2497.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-07-11 12:49:03 +02:00
Ricardo Ribalda
47abb68e17 media: dvb: as102-fe: Fix as10x_register_addr packing
[ Upstream commit 309422d280 ]

This structure is embedded in multiple other structures that are packed,
which conflicts with it being aligned.

drivers/media/usb/as102/as10x_cmd.h:379:30: warning: field reg_addr within 'struct as10x_dump_memory::(unnamed at drivers/media/usb/as102/as10x_cmd.h:373:2)' is less aligned than 'struct as10x_register_addr' and is usually due to 'struct as10x_dump_memory::(unnamed at drivers/media/usb/as102/as10x_cmd.h:373:2)' being packed, which can lead to unaligned accesses [-Wunaligned-access]

Mark it as being packed.

Marking the inner struct as 'packed' does not change the layout, since the
whole struct is already packed, it just silences the clang warning. See
also this llvm discussion:

https://github.com/llvm/llvm-project/issues/55520

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-07-11 12:49:03 +02:00
Mirela Rabulea
251ada8ebd LF-12850-1: media: os08a20: Remove old os08a20 sensor driver for imx95
The os08a20 is now supported in the ox05b1s driver.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Alice Yuan <alice.yuan@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2024-07-09 09:46:08 +03:00
Ricardo Ribalda
06fa2d9445 media: dvbdev: Initialize sbuf
[ Upstream commit 17d1316de0 ]

Because the size passed to copy_from_user() cannot be known beforehand,
it needs to be checked during runtime with check_object_size. That makes
gcc believe that the content of sbuf can be used before init.

Fix:
./include/linux/thread_info.h:215:17: warning: ‘sbuf’ may be used uninitialized [-Wmaybe-uninitialized]

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-07-05 09:33:52 +02:00
Aymen Sghaier
f2e144a22a ILIE-64 media: nxp: neoisp: Add crop support
"s_selection" interface is implemented on "input0" video node (output).
Size of "frame" video node (capture) should match input crop size.
Crop is operated by offsetting input image start address and line
stride.

Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
Reviewed-by: Alexi Birlinger <alexi.birlinger@nxp.com>
2024-07-03 07:56:41 +02:00
Aymen Sghaier
ace0579a14 Revert "ILIE-64 media: nxp: neoisp: Add crop support"
This reverts commit 1b546d1225.

Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
Reviewed-by: Alexi Birlinger <alexi.birlinger@nxp.com>
2024-07-03 07:56:41 +02:00
Aymen Sghaier
449db74ecf ILIE-97: Remove parameters buffer useless copy and use vb2 queue
Current driver allocates a dma mapped buffer for parameters and copy each
queued buffer to it. This was done to mimic the pisp driver and is useless
for neoisp.
This patch removes this extra copy and uses the vb2 queue instead.

Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
Reviewed-by: Alexi Birlinger <alexi.birlinger@nxp.com>
2024-07-03 07:52:40 +02:00
Aymen Sghaier
68662d473c ILIE-103: media: nxp: neoisp: Enable regmap debugfs
Regmap framework includes useful registers dump to debugfs, but this is
not functional for neoisp driver.

This patch adds needed settings to enable debugfs for neoisp.
It also adds a module parameter enable_debugfs that should be set to 1
to prevent clock disabling at probe.

Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
Reviewed-by: Antoine Bouyer <antoine.bouyer@nxp.com>
2024-07-02 15:52:26 +02:00
Aymen Sghaier
15d5fba6ee ILIE-88 media: nxp: neoisp: Fix bit width configuration in isp pipeline
HDR decompression isp block is unable to output 20 bits per pixel if input
bit width is less than 12 bits.
This patch involves obwb block to compensate this limitation and reach
20 bits per pixel in isp internal pipeline 0, also adds the same procedure
to handle 16 bits internal bit width for pipeline 1.

This patch also set the default BNR configuration to the default ISP
registers values.

Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
Signed-off-by: Celine Laurencin <celine.laurencin@nxp.com>
Reviewed-by: Julien Vuillaumier <julien.vuillaumier@nxp.com>
2024-07-02 10:26:14 +02:00
Alexi Birlinger
919585d6e5 ILIE-91: media: nxp: neoisp: Fix VYUY format
The YVYU is an unsupported format which is a leftover
that was wrongly swapped with VYUY supported format.

Signed-off-by: Alexi Birlinger <alexi.birlinger@nxp.com>
Reviewed-by: Aymen Sghaier <aymen.sghaier@nxp.com>
2024-07-02 10:26:13 +02:00
Alexi Birlinger
3d570d946d LF-12485: media: nxp: neoisp: Fix clock enable count after module removing
After neoisp module is removed isp and isi clock are still enabled
This patch fixes pm_runtime management by setting autosuspend mode
with a delay defined by NEOISP_SUSPEND_TIMEOUT_MS.
Clocks are disabled at the end of probe function to release them
while driver is not in use.
Also, it calls pm_runtime_dont_use_autosuspend
while autosuspend mode is not used.

Signed-off-by: Alexi Birlinger <alexi.birlinger@nxp.com>
Reviewed-by: Aymen Sghaier <aymen.sghaier@nxp.com>
2024-07-02 10:26:13 +02:00
Ming Qian
16dd4e050e media: amphion: Report the average QP of current encoded frame
Report the average QP value of the current encoded frame via the
V4L2_CID_MPEG_VIDEO_AVERAGE_QP control, the value applies to the last
dequeued capture buffer.

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>
2024-07-02 10:07:50 +09:00
Ming Qian
475c75b77c media: amphion: Remove lock in s_ctrl callback
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>
2024-07-02 10:07:50 +09:00
Ming Qian
569e32a224 media: v4l2-ctrls: Add average QP control
Add a control V4L2_CID_MPEG_VIDEO_AVERAGE_QP to report the average QP
value of the current encoded frame. The value applies to the last
dequeued capture buffer.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-07-02 10:07:49 +09:00
Laurentiu Palcu
26f591d2bb LF-12725 media/i2c: max96724: Fix for working in different configurations
Currently, if less than 4 cameras are needed, one has to modify the DTB
in order to have the new topology work. That's because we enabled all
configured GMSL links by default. This fix simply disables the links
that didn't lock and we can connect sensors in various configurations.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Mirela Rabulea <mirela.rabulea@nxp.com>
2024-07-01 17:00:12 +03:00
Laurentiu Palcu
c0af0cfd11 LF-12679-3 media/i2c: max96724: Add a more robust GMSL link check mechanism
It may happen when booting the system up that GMSL links do not lock.
However, a simple chip reset can fix it easily. So, this patch modifies
the init sequence by implementing a retry mechanism that checks the GMSL
links, resetting the chip in case no link has locked. The checks will be
done at the beginning of the init sequence, instead of the end.  Also,
remove the links reset call from max96724_reset_gmsl_links() and rename
the function to max96724_check_gmsl_links().

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Mirela Rabulea <mirela.rabulea@nxp.com>
2024-07-01 17:00:12 +03:00
Laurentiu Palcu
fb6e98560e LF-12679-2 media/i2c: mx95mbcam: Reset serializer before removal or reboot
Since the MX95MBCAM sensor module has the PWDNB pin, that should reset
the serializer, hard-wired to HIGH, we need to make sure we leave the
serializer in the default state when we remove the module or we perform
a warm reboot. This would avoid issues with GMSL links not locking when
rebooting the board.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Mirela Rabulea <mirela.rabulea@nxp.com>
2024-07-01 17:00:12 +03:00
Laurentiu Palcu
64d56bf0ee LF-12679-1 media/i2c: max96717: Add function for resetting the chip
We'll need this in order to reset the chip before warm reboot or module
removal, as the PWDNB pin is always HIGH.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Mirela Rabulea <mirela.rabulea@nxp.com>
2024-07-01 17:00:12 +03:00
Mirela Rabulea
657cc0dc39 LF-12210-7: media: ox05b1s: Add support for Omnivision OS08A20 raw sensor
This is an 8MP raw10/raw12 sensor with HDR capabilities.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
2024-07-01 17:00:12 +03:00
Mirela Rabulea
17597cc375 LF-12210-2: media: ox05b1s: Add omnivision OX05B1S raw sensor driver
This is a v4l2 driver for Omnivision OX05B1S RGB-IR sensor.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
2024-07-01 17:00:11 +03:00
Mirela Rabulea
7b8a5b629f MLK-26186: media: os08a20: Fix V4L2_CID_ANALOGUE_GAIN
The os08a20_set_gain() function was inherited from imx8mp,
and it is specific to the VSI ISP, which is expecting a total
gain of 1024 for 1x gain, with the analogue and digital gain
being combined.

For imx95, add a new function and let the control update only
the analog gain registers with the gain code in sensor format.
This covers linear mode (gain for long exposure).

Fixes: 4892da9340 ("MLK-26186-5: media: os08a20: Add analog gain and exposure controls")

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
2024-07-01 16:54:28 +03:00
Laurentiu Palcu
f03cd73fcf LF-12520-2 media/i2c: ox03c10: add HFLIP control
Allow userspace to flip the image horizontally.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
2024-07-01 16:54:28 +03:00
Laurentiu Palcu
9c2e52acf2 LF-12520-1 media/i2c: ox03c10: correct image orientation
Currently, the image is horizontally flipped. Change the ox03c10 default
initialization sequence so that the image is correct.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
2024-07-01 16:54:28 +03:00
Laurentiu Palcu
bdee8c5309 LF-12521-5 media/i2c: ox03c10: use I2C bulk writes whenever possible
Instead of writing registers one by one, we can quite some time by using
bulk writes.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
2024-07-01 16:54:28 +03:00
Laurentiu Palcu
965ea79c04 LF-12521-4 media/i2c: ox03c10: apply settings only during vertical blanking
Currently, any exposure or gain changes are applied immediately to the
sensor. That may lead to unexpected behavior if the sensor is streaming.
In order to avoid that, use group hold registers to store new settings
and use VBlank delay launch mode to apply them during vertical blanking.

As we have 4 group holds that we can use for operations unrelated to
embedded-data or statistics, we can use one group hold for each control:
exposure, analog_gain, digital_gain and white balance gain.

Also, forbid changing PWL related settings while streaming.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
2024-07-01 16:54:28 +03:00
Laurentiu Palcu
529c789759 LF-12521-3 media/i2c: max96724: increase I2C speed over GMSL to 980kHz
Allow for a higher speed between the deserializer and the serializer.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
2024-07-01 16:54:28 +03:00
Laurentiu Palcu
ebc5eca7d2 LF-12521-2 media/i2c: mx95mbcam: increase I2C bus rate to 980kHz
This will improve times taken to send commands to the sensor.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
2024-07-01 16:54:28 +03:00
Laurentiu Palcu
f195e196bb LF-12521-1 media/i2c: max96717: add possibily to change I2C rate
This patch adds support for changing I2C communication channel speed
rate of the serializer to other values.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
2024-07-01 16:54:28 +03:00
Aymen Sghaier
1b546d1225 ILIE-64 media: nxp: neoisp: Add crop support
Add crop implementation to input0 and input1

Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
2024-07-01 16:54:28 +03:00
TaoJiang
f79ac2cfa5 LF-12494: arm64: vpu: wave6: add YUV24 common info
VPU use v4l2_format_info to calculate some parameters for each format now,
such as width,height,stride,bytesperline...
However v4l2 common level hasn't support YUV24 format.
So we need to add YUV24 info.

Signed-off-by: TaoJiang <tao.jiang_2@nxp.com>
Reviewed-by: Ming Qian <ming.qian@nxp.com>
2024-07-01 11:19:23 +05:30
Jason Liu
1cace3bcdc This is the 6.6.36 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmZ9UcMACgkQONu9yGCS
 aT4wtw//d08jymmJRWFySKz7BZeXhkCaElyGfSh43297UEMKuRZBShh4QqT9WvcX
 MvFQJ8Kzyg6xL+VV/49YVve4YbEZ9SLQalQJ//6wUtKxCbBQ5xmydOwTikBbifdf
 U4edeT4ZU/e8TVvrABgz/Cu5vjhWbOCbEEARthXntG4X9msI3tifhVM80t4wTiLn
 OvnYVq2x93/f9nbw50T7VYtrKnsEdVo4GNF/76DyFDXy8upwBWSvtfrbvAvI/Gx9
 /m7eQqhUx13ms3Rfb4fd+inYDjfYOADnQEh0feb5VvghXoZmfu+Y8VcyLPOcKpyy
 fWDeB40s4Pj8dhSdKbLLjknVsyyJ0qGdRz3R1/rlJRMGMqXkqa42AlPfSR/dpJbW
 jwPpZZ8RvVvxQx+hmPG1TIoflhblJK0nZjdfTq+0Eqe7Iupl4Ni7nihTvOUEdg9m
 VD/HLmHkHFTBc7pSeNfjlNvmw4EJ51309g0s/sd7oGoHIt7FQXkHMPb56w0z6fuR
 CTmGKMbXwDbPnCTsH3FnPXLd/RVjgbjtn81iWIPawQ57sJoKP96dz80KpcD9Woz1
 6b+rvxWI6cQfD4L/Tu+4sv5Hu5aIRjFXPKD7OHLPFaz06bQVzISLwswjrxWTYfST
 wxARzK8fD0jquYXl98oFmvapmGFJfkyfCxUvBa7zWkrOKbUdHDg=
 =1haK
 -----END PGP SIGNATURE-----

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

This is the 6.6.36 stable release

* tag 'v6.6.36': (192 commits)
  Linux 6.6.36
  Revert "mm: mmap: allow for the maximum number of bits for randomizing mmap_base by default"
  hid: asus: asus_report_fixup: fix potential read out of bounds
  ...

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

 Conflicts:
	Documentation/devicetree/bindings/dma/fsl,edma.yaml
	arch/arm64/boot/dts/freescale/imx8qm-mek.dts
	drivers/spi/spi-imx.c
2024-06-28 14:03:35 +08:00
Fullway Wang
f066882293 media: mtk-vcodec: potential null pointer deference in SCP
[ Upstream commit 53dbe08504 ]

The return value of devm_kzalloc() needs to be checked to avoid
NULL pointer deference. This is similar to CVE-2022-3113.

Link: https://lore.kernel.org/linux-media/PH7PR20MB5925094DAE3FD750C7E39E01BF712@PH7PR20MB5925.namprd20.prod.outlook.com
Signed-off-by: Fullway Wang <fullwaywang@outlook.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-06-27 13:49:03 +02:00
Ricardo Ribalda
23d3c898d5 media: intel/ipu6: Fix build with !ACPI
[ Upstream commit 8810e055b5 ]

Modify the code so it can be compiled tested in configurations that do
not have ACPI enabled.

It fixes the following errors:
drivers/media/pci/intel/ipu-bridge.c:103:30: error: implicit declaration of function ‘acpi_device_handle’; did you mean ‘acpi_fwnode_handle’? [-Werror=implicit-function-declaration]
drivers/media/pci/intel/ipu-bridge.c:103:30: warning: initialization of ‘acpi_handle’ {aka ‘void *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
drivers/media/pci/intel/ipu-bridge.c:110:17: error: implicit declaration of function ‘for_each_acpi_dev_match’ [-Werror=implicit-function-declaration]
drivers/media/pci/intel/ipu-bridge.c:110:74: error: expected ‘;’ before ‘for_each_acpi_consumer_dev’
drivers/media/pci/intel/ipu-bridge.c:104:29: warning: unused variable ‘consumer’ [-Wunused-variable]
drivers/media/pci/intel/ipu-bridge.c:103:21: warning: unused variable ‘handle’ [-Wunused-variable]
drivers/media/pci/intel/ipu-bridge.c:166:38: error: invalid use of undefined type ‘struct acpi_device’
drivers/media/pci/intel/ipu-bridge.c:185:43: error: invalid use of undefined type ‘struct acpi_device’
drivers/media/pci/intel/ipu-bridge.c:191:30: error: invalid use of undefined type ‘struct acpi_device’
drivers/media/pci/intel/ipu-bridge.c:196:30: error: invalid use of undefined type ‘struct acpi_device’
drivers/media/pci/intel/ipu-bridge.c:202:30: error: invalid use of undefined type ‘struct acpi_device’
drivers/media/pci/intel/ipu-bridge.c:223:31: error: invalid use of undefined type ‘struct acpi_device’
drivers/media/pci/intel/ipu-bridge.c:236:18: error: implicit declaration of function ‘acpi_get_physical_device_location’ [-Werror=implicit-function-declaration]
drivers/media/pci/intel/ipu-bridge.c:236:56: error: invalid use of undefined type ‘struct acpi_device’
drivers/media/pci/intel/ipu-bridge.c:238:31: error: invalid use of undefined type ‘struct acpi_device’
drivers/media/pci/intel/ipu-bridge.c:256:31: error: invalid use of undefined type ‘struct acpi_device’
drivers/media/pci/intel/ipu-bridge.c:275:31: error: invalid use of undefined type ‘struct acpi_device’
drivers/media/pci/intel/ipu-bridge.c:280:30: error: invalid use of undefined type ‘struct acpi_device’
drivers/media/pci/intel/ipu-bridge.c:469:26: error: implicit declaration of function ‘acpi_device_hid’; did you mean ‘dmi_device_id’? [-Werror=implicit-function-declaration]
drivers/media/pci/intel/ipu-bridge.c:468:74: warning: format ‘%s’ expects argument of type ‘char *’, but argument 4 has type ‘int’ [-Wformat=]
drivers/media/pci/intel/ipu-bridge.c:637:58: error: expected ‘;’ before ‘{’ token
drivers/media/pci/intel/ipu-bridge.c:696:1: warning: label ‘err_put_adev’ defined but not used [-Wunused-label]
drivers/media/pci/intel/ipu-bridge.c:693:1: warning: label ‘err_put_ivsc’ defined but not used [-Wunused-label]
drivers/media/pci/intel/ipu-bridge.c:691:1: warning: label ‘err_free_swnodes’ defined but not used [-Wunused-label]
drivers/media/pci/intel/ipu-bridge.c:632:40: warning: unused variable ‘primary’ [-Wunused-variable]
drivers/media/pci/intel/ipu-bridge.c:632:31: warning: unused variable ‘fwnode’ [-Wunused-variable]
drivers/media/pci/intel/ipu-bridge.c:733:73: error: expected ‘;’ before ‘{’ token
drivers/media/pci/intel/ipu-bridge.c:725:24: warning: unused variable ‘csi_dev’ [-Wunused-variable]
drivers/media/pci/intel/ipu-bridge.c:724:43: warning: unused variable ‘adev’ [-Wunused-variable]
drivers/media/pci/intel/ipu-bridge.c:599:12: warning: ‘ipu_bridge_instantiate_ivsc’ defined but not used [-Wunused-function]
drivers/media/pci/intel/ipu-bridge.c:444:13: warning: ‘ipu_bridge_create_connection_swnodes’ defined but not used [-Wunused-function]
drivers/media/pci/intel/ipu-bridge.c:297:13: warning: ‘ipu_bridge_create_fwnode_properties’ defined but not used [-Wunused-function]
drivers/media/pci/intel/ipu-bridge.c:155:12: warning: ‘ipu_bridge_check_ivsc_dev’ defined but not used [-Wunused-function]

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-06-27 13:49:03 +02:00
Jason Liu
21efea47c1 This is the 6.6.34 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmZu0U0ACgkQONu9yGCS
 aT4c2Q//SGn9+yEUml1/7nQUTND434ly4JPMdrR1jjJSKwxAsgzOYKCoUpzpXim8
 7mdKz7q1cXx/l+tfJgEDdJ8JzVS6ipJWAwF4vE+18zWZjEax/M3dgluZUUswXKYg
 Da76wSaNkfGiIewu8HV90LKAKaQoCR4ypyWG8CqDZkCnGJORUJA09GNDrKFhOodT
 f0TzjIvPw8E3rU2+HZfPmxUI0XQEzfVPWb5DK+0F7hcHw4ETcij7y0AInBkQ5bNt
 tFRCc462nT23e3jXJECWMbSXdRF57LlT8G9626Om0iS+TY7YD6PPNa7/bdqVHzcw
 hDmKE+xONslwvuzkYn2R9u+nc/dw/hJ8QI5j9QohbJCcXjcv8N3QeXoiLPjiDxxv
 1JVVi6emyKvKx26kjY/m0ZTZ/QWWwQlj/+R8Or/yIMMYZvPwyBUX3I8cZIQhyAg4
 n/fc2tFqmax0K6e9YOXj3sa+OlXx02DAC8oVToNrSS7HT5uhtoKT4vU1d+et2alo
 dFJAhklt27k+eV+Ayxo+RUaxUVggM0MAB67S7XUR0kylP2BeL2l9wMKVzZz2V5T4
 O9PHY1RpD8OGk7aZvlbZYIis7LBqVTXcaEB4l5QtSYM4RMON4BYb5QLEc0jYywzV
 U7GMNiKhhuwEHjiPD0cIXyeWeQzTlH9os5lhW8moVY9mtthGlr0=
 =zdH0
 -----END PGP SIGNATURE-----

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

This is the 6.6.34 stable release

* tag 'v6.6.34': (2530 commits)
  Linux 6.6.34
  smp: Provide 'setup_max_cpus' definition on UP too
  selftests: net: more strict check in net_helper
  ...

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

 Conflicts:
	arch/arm64/boot/dts/freescale/imx8-ss-conn.dtsi
	drivers/net/ethernet/freescale/fec_ptp.c
	drivers/pmdomain/imx/imx8mp-blk-ctrl.c
	drivers/usb/dwc3/host.c
	tools/perf/util/pmu.c
2024-06-18 17:16:08 +08:00
Alexander Stein
a80d1da923 media: v4l: async: Fix notifier list entry init
commit 6d8acd02c4 upstream.

struct v4l2_async_notifier has several list_head members, but only
waiting_list and done_list are initialized. notifier_entry was kept
'zeroed' leading to an uninitialized list_head.
This results in a NULL-pointer dereference if csi2_async_register() fails,
e.g. node for remote endpoint is disabled, and returns -ENOTCONN.
The following calls to v4l2_async_nf_unregister() results in a NULL
pointer dereference.
Add the missing list head initializer.

Fixes: b8ec754ae4 ("media: v4l: async: Set v4l2_device and subdev in async notifier init")
Cc: <stable@vger.kernel.org> # for 6.6 and later
Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-06-16 13:47:36 +02:00
Sakari Ailus
001b4825c9 media: v4l: async: Don't set notifier's V4L2 device if registering fails
commit 46bc0234ad upstream.

The V4L2 device used to be set when the notifier was registered but this
has been moved to the notifier initialisation. Don't touch the V4L2 device
if registration fails.

Fixes: b8ec754ae4 ("media: v4l: async: Set v4l2_device and subdev in async notifier init")
Cc: <stable@vger.kernel.org> # for 6.6 and later
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-06-16 13:47:36 +02:00
Sakari Ailus
87100b0924 media: v4l: async: Properly re-initialise notifier entry in unregister
commit 9537a8425a upstream.

The notifier_entry of a notifier is not re-initialised after unregistering
the notifier. This leads to dangling pointers being left there so use
list_del_init() to return the notifier_entry an empty list.

Fixes: b8ec754ae4 ("media: v4l: async: Set v4l2_device and subdev in async notifier init")
Cc: <stable@vger.kernel.org> # for 6.6 and later
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-06-16 13:47:36 +02:00
Hans Verkuil
dde33147c9 media: v4l2-core: hold videodev_lock until dev reg, finishes
commit 1ed4477f2e upstream.

After the new V4L2 device node was registered, some additional
initialization was done before the device node was marked as
'registered'. During the time between creating the device node
and marking it as 'registered' it was possible to open the
device node, which would return -ENODEV since the 'registered'
flag was not yet set.

Hold the videodev_lock mutex from just before the device node
is registered until the 'registered' flag is set. Since v4l2_open
will take the same lock, it will wait until this registration
process is finished. This resolves this race condition.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: <stable@vger.kernel.org>      # for vi4.18 and up
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-06-16 13:47:36 +02:00
Nathan Chancellor
3e7eeba0d3 media: mxl5xx: Move xpt structures off stack
commit 526f452754 upstream.

When building for LoongArch with clang 18.0.0, the stack usage of
probe() is larger than the allowed 2048 bytes:

  drivers/media/dvb-frontends/mxl5xx.c:1698:12: warning: stack frame size (2368) exceeds limit (2048) in 'probe' [-Wframe-larger-than]
   1698 | static int probe(struct mxl *state, struct mxl5xx_cfg *cfg)
        |            ^
  1 warning generated.

This is the result of the linked LLVM commit, which changes how the
arrays of structures in config_ts() get handled with
CONFIG_INIT_STACK_ZERO and CONFIG_INIT_STACK_PATTERN, which causes the
above warning in combination with inlining, as config_ts() gets inlined
into probe().

This warning can be easily fixed by moving the array of structures off
of the stackvia 'static const', which is a better location for these
variables anyways because they are static data that is only ever read
from, never modified, so allocating the stack space is wasteful.

This drops the stack usage from 2368 bytes to 256 bytes with the same
compiler and configuration.

Link: https://lore.kernel.org/linux-media/20240111-dvb-mxl5xx-move-structs-off-stack-v1-1-ca4230e67c11@kernel.org
Cc: stable@vger.kernel.org
Closes: https://github.com/ClangBuiltLinux/linux/issues/1977
Link: afe8b93ffd
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Miguel Ojeda <ojeda@kernel.org>
Tested-by: Miguel Ojeda <ojeda@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-06-16 13:47:35 +02:00
Hans Verkuil
77c4cd7e0b media: mc: mark the media devnode as registered from the, start
commit 4bc6073615 upstream.

First the media device node was created, and if successful it was
marked as 'registered'. This leaves a small race condition where
an application can open the device node and get an error back
because the 'registered' flag was not yet set.

Change the order: first set the 'registered' flag, then actually
register the media device node. If that fails, then clear the flag.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Fixes: cf4b9211b5 ("[media] media: Media device node support")
Cc: stable@vger.kernel.org
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-06-16 13:47:35 +02:00
Tomi Valkeinen
e80d9db99b media: mc: Fix graph walk in media_pipeline_start
commit 8a9d420149 upstream.

The graph walk tries to follow all links, even if they are not between
pads. This causes a crash with, e.g. a MEDIA_LNK_FL_ANCILLARY_LINK link.

Fix this by allowing the walk to proceed only for MEDIA_LNK_FL_DATA_LINK
links.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Cc: stable@vger.kernel.org # for 6.1 and later
Fixes: ae21987283 ("media: mc: entity: Rewrite media_pipeline_start()")
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-06-16 13:47:35 +02:00
Zheyu Ma
7d12e918f2 media: lgdt3306a: Add a check against null-pointer-def
commit c1115ddbda upstream.

The driver should check whether the client provides the platform_data.

The following log reveals it:

[   29.610324] BUG: KASAN: null-ptr-deref in kmemdup+0x30/0x40
[   29.610730] Read of size 40 at addr 0000000000000000 by task bash/414
[   29.612820] Call Trace:
[   29.613030]  <TASK>
[   29.613201]  dump_stack_lvl+0x56/0x6f
[   29.613496]  ? kmemdup+0x30/0x40
[   29.613754]  print_report.cold+0x494/0x6b7
[   29.614082]  ? kmemdup+0x30/0x40
[   29.614340]  kasan_report+0x8a/0x190
[   29.614628]  ? kmemdup+0x30/0x40
[   29.614888]  kasan_check_range+0x14d/0x1d0
[   29.615213]  memcpy+0x20/0x60
[   29.615454]  kmemdup+0x30/0x40
[   29.615700]  lgdt3306a_probe+0x52/0x310
[   29.616339]  i2c_device_probe+0x951/0xa90

Link: https://lore.kernel.org/linux-media/20220405095018.3993578-1-zheyuma97@gmail.com
Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-06-16 13:47:32 +02:00
Laurent Pinchart
2948c1e5d5 media: vsp1: Remove unbalanced .s_stream(0) calls
commit 42d62b7e47 upstream.

The VSP1 driver uses the subdev .s_stream() operation to stop WPF
instances, without a corresponding call to start them. The V4L2 subdev
core started warning about unbalanced .s_stream() calls in commit
009905ec50 ("media: v4l2-subdev: Document and enforce .s_stream()
requirements"), causing a regression with this driver.

Fix the problem by replacing the .s_stream() operation with an explicit
function call for WPF instances. This allows sharing an additional data
structure between RPF and WPF instances.

Fixes: 009905ec50 ("media: v4l2-subdev: Document and enforce .s_stream() requirements")
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Closes: https://lore.kernel.org/linux-media/2221395-6a9b-9527-d697-e76aebc6af@linux-m68k.org/
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-06-12 11:13:02 +02:00
Hans Verkuil
89af84e651 media: cec: core: avoid confusing "transmit timed out" message
[ Upstream commit cbe499977b ]

If, when waiting for a transmit to finish, the wait is interrupted,
then you might get a "transmit timed out" message, even though the
transmit was interrupted and did not actually time out.

Set transmit_in_progress_aborted to true if the
wait_for_completion_killable() call was interrupted and ensure
that the transmit is properly marked as ABORTED.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reported-by: Yang, Chenyuan <cy54@illinois.edu>
Closes: https://lore.kernel.org/linux-media/PH7PR11MB57688E64ADE4FE82E658D86DA09EA@PH7PR11MB5768.namprd11.prod.outlook.com/
Fixes: 590a8e564c ("media: cec: abort if the current transmit was canceled")
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-06-12 11:12:43 +02:00
Hans Verkuil
1af4790bc1 media: cec: core: avoid recursive cec_claim_log_addrs
[ Upstream commit 47c82aac10 ]

Keep track if cec_claim_log_addrs() is running, and return -EBUSY
if it is when calling CEC_ADAP_S_LOG_ADDRS.

This prevents a case where cec_claim_log_addrs() could be called
while it was still in progress.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reported-by: Yang, Chenyuan <cy54@illinois.edu>
Closes: https://lore.kernel.org/linux-media/PH7PR11MB57688E64ADE4FE82E658D86DA09EA@PH7PR11MB5768.namprd11.prod.outlook.com/
Fixes: ca684386e6 ("[media] cec: add HDMI CEC framework (api)")
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-06-12 11:12:43 +02:00
Hans Verkuil
cceda163b7 media: cec: cec-api: add locking in cec_release()
[ Upstream commit 42bcaacae9 ]

When cec_release() uses fh->msgs it has to take fh->lock,
otherwise the list can get corrupted.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reported-by: Yang, Chenyuan <cy54@illinois.edu>
Closes: https://lore.kernel.org/linux-media/PH7PR11MB57688E64ADE4FE82E658D86DA09EA@PH7PR11MB5768.namprd11.prod.outlook.com/
Fixes: ca684386e6 ("[media] cec: add HDMI CEC framework (api)")
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-06-12 11:12:43 +02:00
Hans Verkuil
8f40b92f54 media: cec: cec-adap: always cancel work in cec_transmit_msg_fh
[ Upstream commit 9fe2816816 ]

Do not check for !data->completed, just always call
cancel_delayed_work_sync(). This fixes a small race condition.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reported-by: Yang, Chenyuan <cy54@illinois.edu>
Closes: https://lore.kernel.org/linux-media/PH7PR11MB57688E64ADE4FE82E658D86DA09EA@PH7PR11MB5768.namprd11.prod.outlook.com/
Fixes: 490d84f6d7 ("media: cec: forgot to cancel delayed work")
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-06-12 11:12:43 +02:00
Randy Dunlap
75aafce64a media: sunxi: a83-mips-csi2: also select GENERIC_PHY
[ Upstream commit 8237026159 ]

When selecting GENERIC_PHY_MIPI_DPHY, also select GENERIC_PHY to
prevent kconfig warnings:

WARNING: unmet direct dependencies detected for GENERIC_PHY_MIPI_DPHY
  Depends on [n]: GENERIC_PHY [=n]
  Selected by [y]:
  - VIDEO_SUN8I_A83T_MIPI_CSI2 [=y] && MEDIA_SUPPORT [=y] && MEDIA_PLATFORM_SUPPORT [=y] && MEDIA_PLATFORM_DRIVERS [=y] && V4L_PLATFORM_DRIVERS [=y] && VIDEO_DEV [=y] && (ARCH_SUNXI || COMPILE_TEST [=y]) && PM [=y] && COMMON_CLK [=y] && RESET_CONTROLLER [=y]

Fixes: 94d7fd9692 ("media: sunxi: Depend on GENERIC_PHY_MIPI_DPHY")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/r/ZQ/WS8HC1A3F0Qn8@rli9-mobl
Link: https://lore.kernel.org/linux-media/20230927040438.5589-1-rdunlap@infradead.org

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-06-12 11:12:43 +02:00
Dongliang Mu
3d50e4cef2 media: flexcop-usb: fix sanity check of bNumEndpoints
[ Upstream commit f62dc8f6bf ]

Commit d725d20e81 ("media: flexcop-usb: sanity checking of endpoint type
") adds a sanity check for endpoint[1], but fails to modify the sanity
check of bNumEndpoints.

Fix this by modifying the sanity check of bNumEndpoints to 2.

Link: https://lore.kernel.org/linux-media/20220602055027.849014-1-dzm91@hust.edu.cn
Fixes: d725d20e81 ("media: flexcop-usb: sanity checking of endpoint type")
Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-06-12 11:12:42 +02:00
Eugen Hristev
c73d327327 media: mediatek: vcodec: fix possible unbalanced PM counter
[ Upstream commit c28d4921a1 ]

It is possible that mtk_vcodec_enc_pw_on fails, and in that scenario
the PM counter is not incremented, and subsequent call to
mtk_vcodec_enc_pw_off decrements the counter, leading to a PM imbalance.
Fix by bailing out of venc_if_encode in the case when mtk_vcodec_enc_pw_on
fails.

Fixes: 4e855a6efa ("[media] vcodec: mediatek: Add Mediatek V4L2 Video Encoder Driver")
Signed-off-by: Eugen Hristev <eugen.hristev@collabora.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.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-06-12 11:12:41 +02:00
Irui Wang
f29a426420 media: mediatek: vcodec: add encoder power management helper functions
[ Upstream commit 3568cb6556 ]

Remove PM functions at start/stop streaming, add PM helper functions
to get PM before encoding frame start and put PM after encoding frame
done. Meanwhile, remove unnecessary clock operations.

Signed-off-by: Irui Wang <irui.wang@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Stable-dep-of: c28d4921a1 ("media: mediatek: vcodec: fix possible unbalanced PM counter")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-06-12 11:12:41 +02:00
Dan Carpenter
d410017a71 media: stk1160: fix bounds checking in stk1160_copy_video()
[ Upstream commit faa4364bef ]

The subtract in this condition is reversed.  The ->length is the length
of the buffer.  The ->bytesused is how many bytes we have copied thus
far.  When the condition is reversed that means the result of the
subtraction is always negative but since it's unsigned then the result
is a very high positive value.  That means the overflow check is never
true.

Additionally, the ->bytesused doesn't actually work for this purpose
because we're not writing to "buf->mem + buf->bytesused".  Instead, the
math to calculate the destination where we are writing is a bit
involved.  You calculate the number of full lines already written,
multiply by two, skip a line if necessary so that we start on an odd
numbered line, and add the offset into the line.

To fix this buffer overflow, just take the actual destination where we
are writing, if the offset is already out of bounds print an error and
return.  Otherwise, write up to buf->length bytes.

Fixes: 9cb2173e6e ("[media] media: Add stk1160 new driver (easycap replacement)")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-06-12 11:12:40 +02:00
Fabio Estevam
755575a42c media: ov2680: Do not fail if data-lanes property is absent
[ Upstream commit 24034af644 ]

Since commit 63b0cd30b7 ("media: ov2680: Add bus-cfg / endpoint
property verification") the ov2680 driver no longer probes when the
'data-lanes' property is absent.

The OV2680 sensor has only one data lane, so there is no need for
describing it the devicetree.

Remove the unnecessary data-lanes property check.

Suggested-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Fixes: 63b0cd30b7 ("media: ov2680: Add bus-cfg / endpoint property verification")
Signed-off-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-06-12 11:12:38 +02:00
Fabio Estevam
08754dd758 media: ov2680: Allow probing if link-frequencies is absent
[ Upstream commit fd2e66abd7 ]

Since commit 63b0cd30b7 ("media: ov2680: Add bus-cfg / endpoint
property verification") the ov2680 no longer probes on a imx7s-warp7:

ov2680 1-0036: error -EINVAL: supported link freq 330000000 not found
ov2680 1-0036: probe with driver ov2680 failed with error -22

As the 'link-frequencies' property is not mandatory, allow the probe
to succeed by skipping the link-frequency verification when the
property is absent.

Cc: stable@vger.kernel.org
Fixes: 63b0cd30b7 ("media: ov2680: Add bus-cfg / endpoint property verification")
Signed-off-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Stable-dep-of: 24034af644 ("media: ov2680: Do not fail if data-lanes property is absent")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-06-12 11:12:37 +02:00
Fabio Estevam
a7e0a70ac6 media: ov2680: Clear the 'ret' variable on success
[ Upstream commit 49a9bad83b ]

Since commit 63b0cd30b7 ("media: ov2680: Add bus-cfg / endpoint
property verification") even when the correct 'link-frequencies'
property is passed in the devicetree, the driver fails to probe:

ov2680 1-0036: probe with driver ov2680 failed with error -22

The reason is that the variable 'ret' may contain the -EINVAL value
from a previous assignment:

ret = fwnode_property_read_u32(dev_fwnode(dev), "clock-frequency",
			       &rate);

Fix the problem by clearing 'ret' on the successful path.

Tested on imx7s-warp board with the following devicetree:

port {
	ov2680_to_mipi: endpoint {
		remote-endpoint = <&mipi_from_sensor>;
		clock-lanes = <0>;
		data-lanes = <1>;
		link-frequencies = /bits/ 64 <330000000>;
	};
};

Cc: stable@vger.kernel.org
Fixes: 63b0cd30b7 ("media: ov2680: Add bus-cfg / endpoint property verification")
Suggested-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Stable-dep-of: 24034af644 ("media: ov2680: Do not fail if data-lanes property is absent")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-06-12 11:12:37 +02:00
Sakari Ailus
9a496f7d18 media: v4l: Don't turn on privacy LED if streamon fails
[ Upstream commit f2bf6cd8f4 ]

Turn on the privacy LED only if streamon succeeds. This can be done after
enabling streaming on the sensor.

Fixes: b6e10ff6c2 ("media: v4l2-core: Make the v4l2-core code enable/disable the privacy LED if present")
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-06-12 11:12:37 +02:00
Laurent Pinchart
35556d0e1c media: v4l2-subdev: Document and enforce .s_stream() requirements
[ Upstream commit 009905ec50 ]

The subdev .s_stream() operation must not be called to start an already
started subdev, or stop an already stopped one. This requirement has
never been formally documented. Fix it, and catch possible offenders
with a WARN_ON() in the call_s_stream() wrapper.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Stable-dep-of: f2bf6cd8f4 ("media: v4l: Don't turn on privacy LED if streamon fails")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-06-12 11:12:37 +02:00
Sean Young
a10c3d5ff9 pwm: Rename pwm_apply_state() to pwm_apply_might_sleep()
[ Upstream commit c748a6d77c ]

In order to introduce a pwm api which can be used from atomic context,
we will need two functions for applying pwm changes:

	int pwm_apply_might_sleep(struct pwm *, struct pwm_state *);
	int pwm_apply_atomic(struct pwm *, struct pwm_state *);

This commit just deals with renaming pwm_apply_state(), a following
commit will introduce the pwm_apply_atomic() function.

Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Mark Brown <broonie@kernel.org>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> # for input
Acked-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Lee Jones <lee@kernel.org>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Stable-dep-of: 974afccd37 ("leds: pwm: Disable PWM when going to suspend")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-06-12 11:12:24 +02:00
Pratyush Yadav
205b6dd5b7 media: cadence: csi2rx: configure DPHY before starting source stream
[ Upstream commit fd64dda48f ]

When the source device is operating above 1.5 Gbps per lane, it needs to
send the Skew Calibration Sequence before sending any HS data. If the
DPHY is initialized after the source stream is started, then it might
miss the sequence and not be able to receive data properly. Move the
start of source subdev to the end of the sequence to make sure
everything is ready to receive data before the source starts streaming.

Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
Fixes: 3295cf1241 ("media: cadence: Add support for external dphy")
Tested-by: Julien Massot <julien.massot@collabora.com>
Tested-by: Changhuang Liang <Changhuang.liang@starfivetech.com>
Reviewed-by: Julien Massot <julien.massot@collabora.com>
Reviewed-by: Changhuang Liang <Changhuang.liang@starfivetech.com>
Signed-off-by: Jai Luthra <j-luthra@ti.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-06-12 11:12:05 +02:00
Ricardo Ribalda
4b3421c2f6 media: uvcvideo: Add quirk for Logitech Rally Bar
[ Upstream commit 07731053d1 ]

Logitech Rally Bar devices, despite behaving as UVC cameras, have a
different power management system that the other cameras from Logitech.

USB_QUIRK_RESET_RESUME is applied to all the UVC cameras from Logitech
at the usb core. Unfortunately, USB_QUIRK_RESET_RESUME causes undesired
USB disconnects in the Rally Bar that make them completely unusable.

There is an open discussion about if we should fix this in the core or
add a quirk in the UVC driver. In order to enable this hardware, let's
land this patch first, and we can revert it later if there is a
different conclusion.

Fixes: e387ef5c47 ("usb: Add USB_QUIRK_RESET_RESUME for all Logitech UVC webcams")
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Devinder Khroad <dkhroad@logitech.com>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20240404-rallybar-v6-1-6d67bb6b69af@chromium.org
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-06-12 11:12:04 +02:00
Laurent Pinchart
983e91ad75 media: v4l2-subdev: Fix stream handling for crop API
[ Upstream commit 34d7bf1c8e ]

When support for streams was added to the V4L2 subdev API, the
v4l2_subdev_crop structure was extended with a stream field, but the
field was not handled in the core code that translates the
VIDIOC_SUBDEV_[GS]_CROP ioctls to the selection API. Fix it.

Fixes: 2f91e10ee6 ("media: subdev: add stream based configuration")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-06-12 11:12:02 +02:00
Uwe Kleine-König
c1a3803e5b media: i2c: et8ek8: Don't strip remove function when driver is builtin
[ Upstream commit 545b215736 ]

Using __exit for the remove function results in the remove callback
being discarded with CONFIG_VIDEO_ET8EK8=y. When such a device gets
unbound (e.g. using sysfs or hotplug), the driver is just removed
without the cleanup being performed. This results in resource leaks. Fix
it by compiling in the remove callback unconditionally.

This also fixes a W=1 modpost warning:

	WARNING: modpost: drivers/media/i2c/et8ek8/et8ek8: section mismatch in reference: et8ek8_i2c_driver+0x10 (section: .data) -> et8ek8_remove (section: .exit.text)

Fixes: c5254e72b8 ("[media] media: Driver for Toshiba et8ek8 5MP sensor")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-06-12 11:12:02 +02:00
Sakari Ailus
db572c3973 media: ipu3-cio2: Request IRQ earlier
[ Upstream commit a069f79bfa ]

Call devm_request_irq() before registering the async notifier, as otherwise
it would be possible to use the device before the interrupts could be
delivered to the driver.

Fixes: c2a6a07afe ("media: intel-ipu3: cio2: add new MIPI-CSI2 driver")
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-06-12 11:12:01 +02:00
Ricardo Ribalda
0f070f0c3b media: radio-shark2: Avoid led_names truncations
[ Upstream commit 1820e16a30 ]

Increase the size of led_names so it can fit any valid v4l2 device name.

Fixes:
drivers/media/radio/radio-shark2.c:197:17: warning: ‘%s’ directive output may be truncated writing up to 35 bytes into a region of size 32 [-Wformat-truncation=]

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-06-12 11:12:01 +02:00
Arnd Bergmann
d8076c9e02 media: rcar-vin: work around -Wenum-compare-conditional warning
[ Upstream commit 1a742c6010 ]

clang-19 warns about mixing two enum types here:

drivers/media/platform/renesas/rcar-vin/rcar-vin.h:296:12: error: conditional expression between different enumeration types ('enum rvin_csi_id' and 'enum rvin_isp_id') [-Werror,-Wenum-compare-conditional]
drivers/media/platform/renesas/rcar-vin/rcar-core.c:216:18: error: conditional expression between different enumeration types ('enum rvin_csi_id' and 'enum rvin_isp_id') [-Werror,-Wenum-compare-conditional]
drivers/media/platform/renesas/rcar-vin/rcar-vin.h:296:12: error: conditional expression between different enumeration types ('enum rvin_csi_id' and 'enum rvin_isp_id') [-Werror,-Wenum-compare-conditional]
drivers/media/platform/renesas/rcar-vin/rcar-vin.h:296:12: error: conditional expression between different enumeration types ('enum rvin_csi_id' and 'enum rvin_isp_id') [-Werror,-Wenum-compare-conditional]

This one is intentional, and there is already a cast to work around another
warning, so address this by adding another cast.

Fixes: 406bb586de ("media: rcar-vin: Add r8a779a0 support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-06-12 11:12:01 +02:00
Aleksandr Burakov
f987b53c28 media: ngene: Add dvb_ca_en50221_init return value check
[ Upstream commit 9bb1fd7edd ]

The return value of dvb_ca_en50221_init() is not checked here that may
cause undefined behavior in case of nonzero value return.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 25aee3debe ("[media] Rename media/dvb as media/pci")
Signed-off-by: Aleksandr Burakov <a.burakov@rosalinux.ru>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-06-12 11:12:01 +02:00
Aymen Sghaier
18badd880b ILIE-86: media: nxp: neoisp: Fix spinlock init issue
When CONFIG_DEBUG_SPINLOCK flag is enabled, a bug appears right after
starting a neoisp pipeline as follow:

[   50.704779] BUG: spinlock bad magic on CPU#4, v4l2src0:src/743
[   50.711818]  lock: 0xffff00008a7204a0, .magic: 00000000,
                 .owner: <none>/-1, .owner_cpu: 0
[   50.731688] Hardware name: NXP i.MX95 19X19 board (DT)
[   50.738284] Call trace:
[   50.742193]  dump_backtrace+0x90/0xe8
[   50.747314]  show_stack+0x18/0x24
[   50.752089]  dump_stack_lvl+0x48/0x60
[   50.757211]  dump_stack+0x18/0x24
[   50.761986]  spin_bug+0x9c/0xd8
[   50.766589]  do_raw_spin_lock+0xe4/0x10c
[   50.771970]  _raw_spin_lock_irqsave+0x2c/0x40
[   50.777786]  neoisp_schedule_one+0x30/0x80 [neoisp]
[   50.784121]  neoisp_node_buffer_queue+0x64/0x78 [neoisp]

This patch adds the missing initialization of hw_lock spinlock to fix
the above bug.

Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
Reviewed-by: Julien Vuillaumier <julien.vuillaumier@nxp.com>
2024-05-31 18:45:08 +02:00
Aymen Sghaier
784dcdfa53 LF-12472: media: nxp: neoisp: Fix suspend resume while streaming
While neoisp streaming is on, a suspend trigger is not waiting the end of
current frame processing. Also, at resume, neoisp is not taking into
account that registers are cleared. This leads to bus error interruption
followed by a kernel dump.

This patch adds a waiting loop at pm suspend request, reloads full context
registers and internal memory look up tables, rework the saved context
in memory by split gcm and packetizer and simplifies the switch context
handling to cover pm resume case.

Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
Reviewed-by: Julien Vuillaumier <julien.vuillaumier@nxp.com>
2024-05-31 18:44:54 +02:00
Aymen Sghaier
3dbc05a8a7 LF-12337: media: nxp: neoisp: Fix xBGR v4l2 pixel format code
Neosip device supports RGB x padding at byte 3 only, meanwhile 'BGRX'
v4l2 pixel format code was misleading since x channel is at byte 0, thus
colors order is wrong.
This patch replaces unsupported BGRX by XBGR pixel format as a fix.

Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
Reviewed-by: Julien Vuillaumier <julien.vuillaumier@nxp.com>
2024-05-17 07:36:22 +02:00
Aymen Sghaier
bb0514c2c6 LF-12340 media: nxp: neoisp: Fix 24 bit RGB format issue
After playing a 32 bit RGBX format from neoisp some related settings
remain and cause an issue if a 24 bit RGB format is used.
This patch adds a reset to initial value and fix this issue.

Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
Reviewed-by: Julien Vuillaumier <julien.vuillaumier@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
2024-05-17 07:35:52 +02:00
Guoniu.zhou
279d111abd LF-12188-09: media: i2c: ds90ub960: add internally generated FrameSync support
DS90UB960 support two different frame synchronization signal mode.
The first option offers sending the external FrameSync using one
of the available GPIO pins on the DS90UB960 and mapping that GPIO
to a back channel GPIO on one or more of the FPD-Link III ports.
                               ┌───────────────────┐
 ┌─┐ GPIOx┌──────────┐         │   HUB Desrializer │
 │ │ ◄────┤Serializer◄─────────┤◄──────┐ BC_GPIOx  │
─┘ └─     └──────────┘         │       │           │
                               │       │           │
 ┌─┐ GPIOx┌──────────┐         │       │           │
 │ │ ◄────┤Serializer◄─────────┤ ◄─────┤ BC_GPIOx  │
─┘ └─     └──────────┘         │       │           │
                               │       │           │
 ┌─┐ GPIOx┌──────────┐         │       │           │
 │ │ ◄────┤Serializer◄─────────┤ ◄─────┤ BC_GPIOx  │    ┌─┐
─┘ └─     └──────────┘         │       │           │    │ │
                               │       │           │   ─┘ └─
 ┌─┐ GPIOx┌──────────┐         │       │ BC_GPIOx  │   GPIOy
 │ │ ◄────┤Serializer◄─────────┤◄──────┴───────────┼──────────
─┘ └─     └──────────┘         │                   │
                               └───────────────────┘

The second option is to have the DS90UB960 internally generate a
FrameSync signal to send through GPIO to one or more of the attached
Serializers.
                               ┌───────────────────────────────┐
 ┌─┐ GPIOx┌──────────┐         │   HUB Desrializer             │
 │ │ ◄────┤Serializer◄─────────┤◄──────┐ BC_GPIOx              │
─┘ └─     └──────────┘         │       │                       │
                               │       │                       │
 ┌─┐ GPIOx┌──────────┐         │       │                       │
 │ │ ◄────┤Serializer◄─────────┤ ◄─────┤ BC_GPIOx              │
─┘ └─     └──────────┘         │       │               ┌─┐     │
                               │       │               │ │     │
 ┌─┐ GPIOx┌──────────┐         │       │              ─┘ └─    │
 │ │ ◄────┤Serializer◄─────────┤ ◄─────┤ BC_GPIOx              │
─┘ └─     └──────────┘         │       │          ┌──────────┐ │
                               │       │          │FrameSync │ │
 ┌─┐ GPIOx┌──────────┐         │       │ BC_GPIOx │Generator │ │
 │ │ ◄────┤Serializer◄─────────┤◄──────┴───────── └──────────┘ │
─┘ └─     └──────────┘         │                               │
                               └───────────────────────────────┘
Only the second option is supported.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2024-04-30 16:40:36 +08:00
Guoniu.zhou
7886a5f0b7 LF-12188-08: media: i2c: implement .[s/g]_frame_interval subdev callback
Implement .[s/g]_frame_interval subdev callback for ds90ub960.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2024-04-30 16:40:36 +08:00
Guoniu.zhou
2a3625712c LF-12188-07: media: i2c: ds90ub960: add back channel GPIO select support
Add back channel GPIO select support to send a frame synchronization
signal in multiple camera case.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2024-04-30 16:40:36 +08:00
Guoniu.zhou
ca7fc6c9e0 LF-12188-04: media: i2c: ds90ub953: set GPIO as back channel by default
When enabled as an output, each DS90UB953 GPIO pin can be
programed to output remote data coming from the compatible
deserializer. User can also change the output value using
LOCAL_GPIO_DATA(0x0D) register.

Enable remote deserializer GPIO data on local GPIO by default
since no API in GPIO framework can select this mode. User can
change it to output the value in LOCAL_GPIO_DATA(0x0D[3:0]) by
calling gpio_set_value().

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2024-04-30 16:40:36 +08:00
Guoniu.zhou
c2085ec9f6 LF-12188-03: media: i2c: add v4l2-subdev driver for OX03C10 sensor
Add v4l2-subdev driver which reuse OX03C10 LIB code for OX03C10 sensor.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2024-04-30 16:40:36 +08:00
Guoniu.zhou
3273a0c710 LF-12188-02: media: i2c: ds90ub960: add RAW16 support
Add RAW16 format support in DS90UB960 driver.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2024-04-30 16:40:36 +08:00
Mirela Rabulea
33aaa2c8d9 MLK-26186-8: media: os08a20: Fix v4l2-compliance ioctl error
The v4l2-compliance error is:
fail: v4l2-compliance.cpp(810): doioctl(node, ioc, nullptr) != ENOTTY
test invalid ioctls: FAIL

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
Tested-by: Julien Vuillaumier <julien.vuillaumier@nxp.com>
2024-04-29 14:08:28 +03:00
Mirela Rabulea
f2ca865165 MLK-26186-7: media: os08a20: Initialize default format
The first GET_FMT, prior to any SET_FMT reports width=0,
height=0, etc. This is inconsistent with the default mode
set during probe, so also initialize the sensor->format.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
Tested-by: Julien Vuillaumier <julien.vuillaumier@nxp.com>
2024-04-29 14:08:28 +03:00
Mirela Rabulea
60d92b913b MLK-26186-6: media: os08a20: Allow link_freq control to change
The V4L2_CID_LINK_FREQ refers to the freqency on the data bus,
it affects the pixel rate on the bus.
Remove the read-only flag and add a new value, for further testing
more frame rates.

Signed-off-by: Mirela Rabulea <mirela.rabulea@oss.nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
Tested-by: Julien Vuillaumier <julien.vuillaumier@nxp.com>
2024-04-29 14:08:27 +03:00
Mirela Rabulea
4892da9340 MLK-26186-5: media: os08a20: Add analog gain and exposure controls
The V4L2_CID_ANALOGUE_GAIN and V4L2_CID_EXPOSURE controls are
modifying the registers for the long exposure.
For HDR mode, it is necessary to modify also the short exposure,
this is not implemented yet.

Signed-off-by: Mirela Rabulea <mirela.rabulea@oss.nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
Tested-by: Julien Vuillaumier <julien.vuillaumier@nxp.com>
2024-04-29 14:08:27 +03:00
Mirela Rabulea
03055a6393 MLK-26186-4: media: os08a20: Add hblank, vblank and pixel_rate controls
The V4L2_CID_VBLANK and V4L2_CID_HBLANK will modify the VTS/HTS
sensor registers and influence the frame rate. For now, keep the
HBLANK fixed per mode, but allow some variance for VBLANK.

The V4L2_CID_PIXEL_RATE refers to pixel sampling rate on the
devices pixel array, is read-only by definition, it is only
updated by the driver based on current mode.

All these controls depend on current mode settings, so update their
ranges, default value and current value on format change.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
Tested-by: Julien Vuillaumier <julien.vuillaumier@nxp.com>
2024-04-29 14:08:27 +03:00
Mirela Rabulea
0c1de91afc MLK-26186-3: media: os08a20: Implement get_selection
Minimal implementation for G_SELECTION API.
TGT_CROP is not supported.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
Tested-by: Julien Vuillaumier <julien.vuillaumier@nxp.com>
2024-04-29 14:08:27 +03:00
Mirela Rabulea
0504b14fed MLK-26186-2: media: os08a20: Implement enum_frame_size
For each mbus code, report each framesize only once.
For 10bpp mbus code, the driver supports 1080p and 4k.
For 12bpp mbus code, the driver only supports 4k.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
Tested-by: Julien Vuillaumier <julien.vuillaumier@nxp.com>
2024-04-29 14:08:27 +03:00
Mirela Rabulea
d637918104 MLK-26186-1: media: os08a20: Fix enum_mbus_codes
Register configurations are present for SBGGR10 both with or without HDR.
For SBGGR12 there is only register configuration without HDR, but HDR mode
can be achieved by enabling some HDR related registers.
So, both SBGGR10 & SBGGR12 can be achieved for both HDR/no-HDR modes.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
Tested-by: Julien Vuillaumier <julien.vuillaumier@nxp.com>
2024-04-29 14:08:27 +03:00
Mirela Rabulea
e0513d845b LF-11724-5: media: os08a20: Add comments to registers
Add some descriptions to the registers used for
sensor configuration, for easier diffs between modes.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
Tested-by: Julien Vuillaumier <julien.vuillaumier@nxp.com>
2024-04-29 14:08:27 +03:00
Mirela Rabulea
aa6198681e LF-11724-4: media: os08a20: Fix fps for non-hdr mode following hdr mode
When running a non-hdr mode after an hdr mode, residual hdr settings
remained in the registers, for example mode 2 after mode 3, causing
the fps to drop to half. So, apply the hdr register settings whenever
hdr mode changes during s_ctrl.

Fixes: 1761777d67 ("LF-11724-2: media: os08a20: Implement V4L2_CID_HDR_SENSOR_MODE")

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
Tested-by: Julien Vuillaumier <julien.vuillaumier@nxp.com>
2024-04-29 14:08:27 +03:00
Mirela Rabulea
6b658f63ef LF-11724-3: media: os08a20: Don't fail in set_fmt
According to documentation, S_FMT cannot fail for unsupported
format, instead it should modify the format to match device
capabilities and keep it as closely as possible to the original
request.
Libcamera calls S_FMT with a purposely invalid mbus code 0, expecting
the driver will update it with a supported format.

So, modify os08a20_update_current_mode such that it never fails,
at the last resort, fallback to nearest size, even if it does not match
the current hdr mode set by the v4l2-ctrl.

Achieve the requested hdr by appending the hdr register config
to the current mode. For this purpose, add two helper functions:
os08a20_enable_staggered_hdr, os08a20_disable_staggered_hdr.

Fixes: 426200cd8e ("LF-11724-1: media: os08a20: Fix S_FMT")
Fixes: 1761777d67 ("LF-11724-2: media: os08a20: Implement V4L2_CID_HDR_SENSOR_MODE")

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
Tested-by: Julien Vuillaumier <julien.vuillaumier@nxp.com>
2024-04-29 14:08:27 +03:00
Hans Verkuil
390a71e361 media: videobuf2: request more buffers for vb2_read
[ Upstream commit 350ab13e13 ]

The vb2 read support requests 1 buffer, leaving it to the driver
to increase this number to something that works.

Unfortunately, drivers do not deal with this reliably, and in fact
this caused problems for the bttv driver and reading from /dev/vbiX,
causing every other VBI frame to be all 0.

Instead, request as the number of buffers whatever is the maximum of
2 and q->min_buffers_needed+1.

In order to start streaming you need at least q->min_buffers_needed
queued buffers, so add 1 buffer for processing. And if that field
is 0, then choose 2 (again, one buffer is being filled while the
other one is being processed).

This certainly makes more sense than requesting just 1 buffer, and
the VBI bttv support is now working again.

It turns out that the old videobuf1 behavior of bttv was to allocate
8 (video) and 4 (vbi) buffers when used with read(). After the vb2
conversion that changed to 2 for both. With this patch it is 3, which
is really all you need.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Fixes: b7ec3212a7 ("media: bttv: convert to vb2")
Tested-by: Dr. David Alan Gilbert <dave@treblig.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-04-27 17:11:30 +02:00
Aymen Sghaier
05c6aad791 ILIE-75 media: nxp: neoisp: Fix neoisp issue upon resume from suspend state
Suspend / resume test showed that neoisp driver is stuck when triggered
to process a frame. The root cause is missing hardware init call after
resume.
This patch adds hardware init call in pm resume function.

Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
Reviewed-by: Celine Laurencin <celine.laurencin@nxp.com>
2024-04-26 18:53:28 +02:00
Aymen Sghaier
d6f89549d9 ILIE-74: media: nxp: neoisp: Refine media device links
Current neoisp media links are all immutables while some pads are
optionals.
This patch refines default links flags as follow:
  pad0: Sink <- "neoisp-input0":0 [ENABLED,IMMUTABLE]
  pad1: Sink <- "neoisp-input1":0 []
  pad2: Sink <- "neoisp-params":0 [ENABLED]
  pad3: Source -> "neoisp-frame":0 [ENABLED]
  pad4: Source -> "neoisp-ir":0 []
  pad5: Source -> "neoisp-stats":0 [ENABLED]

Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
Reviewed-by: Celine Laurencin <celine.laurencin@nxp.com>
2024-04-26 18:53:28 +02:00
Aymen Sghaier
c91e68b954 ILIE-72-1: media: nxp: neoisp: Add hw_revision to media device
This patch fills hw_revision field for neosip media device that could be
retrieved by MEDIA_IOC_DEVICE_INFO ioctl.

Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
Reviewed-by: Celine Laurencin <celine.laurencin@nxp.com>
2024-04-26 18:53:27 +02:00
Mirela Rabulea
1761777d67 LF-11724-2: media: os08a20: Implement V4L2_CID_HDR_SENSOR_MODE
The information from S_FMT (resolution and pixel code) is not
enough to define the sensor mode, further more, we need to know
the hdr mode. For that, implement V4L2_CID_HDR_SENSOR_MODE.
We need to take into account that s_ctrl and S_FMT may come
in any order. So let the S_FMT establish the resolution
and pixel code and use whatever hdr mode was previously set,
while the s_ctrl will try to find a mode that matches the
current resolution and code and the new hdr mode.
Both S_FMT and s_ctrl will update the sensor if needed and
if a matching mode is found.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Alice Yuan <alice.yuan@nxp.com>
2024-04-25 18:29:53 +03:00
Mirela Rabulea
426200cd8e LF-11724-1: media: os08a20: Fix S_FMT
Currently, S_FMT fails for any attempt to change the
format that is hardcoded in probe. Partially fix it
by looking for a matching mode based on resolution
and mbus code.
Refactor S_FMT, separate finding and applying sensor mode.

The HDR mode is not addressed yet.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Alice Yuan <alice.yuan@nxp.com>
2024-04-25 18:29:44 +03:00
Guoniu.zhou
e260226d94 LF-12089-02: media: i2c: mx95mbcam: update ox03c10 initialize interface
Update ox03c10 initialize interface since the changes in commit
56c25fe6a496 ("LF-12089-01: media: ox03c10: extend ox03c10_init() usage")

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
2024-04-24 16:32:31 +08:00
Guoniu.zhou
be7ea096c7 LF-12089-01: media: ox03c10: extend ox03c10_init() usage
The current implementation of ox03c10_init() only for dummy i2c
client device and it's the case for Maxim SerDes solution. But
for TI SerDes solution, it will register i2c client for sensor
when serializer is registered as i2c adapter. So by adding one
new parameter(use_dummy) to distinguish the two different case
in order to reuse OX03C10_LIB code.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
2024-04-24 16:32:01 +08:00
Guoniu.zhou
52ca08ec7c LF-12086: media: i2c: mx95mbcam: remove invalid i2c client data setting
I2C client data will be set to point to struct v4l2subdev instance
in v4l2_i2c_subdev_init(), so it will be overwritten. Remove it.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
2024-04-24 15:04:31 +08:00
Guoniu.zhou
cca36a54de LF-12084: media: ox03c10: remove ox03c10_deinit() since no definition
ox03c10_deinit() only has declaration in header file and no definition
in source file, nowhere use it, so remove it.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
2024-04-24 15:04:31 +08:00
Guoniu.zhou
917e084df6 LF-12023: media: imx8-isi: fix hang issue when run multiple capture instance
When run multiple capture instance by duplicating AP1302 stream,
kill one of them will cause the other streams stop. The reason
for this issue is ISI can duplicate stream from same input port.
It means close one of stream will stop AP1302 streaming, so the
other stream instance will hang. Using counter for each stream
and do stopping camera streaming when the counter is zero.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2024-04-23 09:45:29 +08:00
Aymen Sghaier
88450f8601 ILIE-71: media: nxp: neoisp: Remove useless interrupts
ISP hardware could trigger several interrupts for different phases in
the pipeline blocks, this is useful while debug, but while nominal
processing it could be harmful for performance.
This patch enables only statistics done and frame done interrupts to
prevent handling irrelevant ones.

Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
Reviewed-by: Julien Vuillaumier <julien.vuillaumier@nxp.com>
Acked-by: Robert Chiras <robert.chiras@nxp.com>
2024-04-19 15:15:41 +02:00
Aymen Sghaier
eec425eff7 ILIE-70: media: nxp: neoisp: Fix default params restore after stream-off
Current driver keeps latest set parameters in buffer after a stream-off,
and next processed frame will run with non-default parameters.
This patch fixes this issue and ensures using default parameters upon
stream-on event.

Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
Reviewed-by: Julien Vuillaumier <julien.vuillaumier@nxp.com>
Acked-by: Robert Chiras <robert.chiras@nxp.com>
2024-04-19 15:15:39 +02:00
Alexi Birlinger
f2ddb547ec ILIE-53-2: media: nxp: neoisp: Expand YUV video capture formats
Add support of the following video capture formats:
- YUVX32, VUYX32 and VYUY (interleaved)
- NV12, NV21, NV16 and NV61 (semi-planar)

Signed-off-by: Alexi Birlinger <alexi.birlinger@nxp.com>
Reviewed-by: Julien Vuillaumier <julien.vuillaumier@nxp.com>
Acked-by: Robert Chiras <robert.chiras@nxp.com>
2024-04-19 15:15:08 +02:00
Alexi Birlinger
038ac01355 ILIE-53-1: media: nxp: neoisp: Remove unsupported greyscale formats
Remove greyscale capture formats from formats_vcap struct and update
table size.
Y14 format is not supported
Y10, Y12 are not tested and will be added in the future

Signed-off-by: Alexi Birlinger <alexi.birlinger@nxp.com>
Reviewed-by: Julien Vuillaumier <julien.vuillaumier@nxp.com>
Acked-by: Robert Chiras <robert.chiras@nxp.com>
2024-04-19 15:15:08 +02:00
Alexi Birlinger
8b17ad6cdf ILIE-53: media: nxp: neoisp: Expand RGB capture format support
This patch enables BGRX32, RGBX32 and BGR24 video capture formats

Signed-off-by: Alexi Birlinger <alexi.birlinger@nxp.com>
Reviewed-by: Julien Vuillaumier <julien.vuillaumier@nxp.com>
Acked-by: Robert Chiras <robert.chiras@nxp.com>
2024-04-19 15:15:08 +02:00
Alexi Birlinger
4855fb395b ILIE-60: media: nxp: neoisp: Change default alignment for input buffers
Image buffers provided to ISP are MSB aligned, while default parameter
is set to LSB alignment.
This patch updates default parameter to be MSB aligned.

Signed-off-by: Alexi Birlinger <alexi.birlinger@nxp.com>
Reviewed-by: Julien Vuillaumier <julien.vuillaumier@nxp.com>
Acked-by: Robert Chiras <robert.chiras@nxp.com>
2024-04-19 15:15:08 +02:00
Alexi Birlinger
ea0ad75f00 ILIE-44: media: nxp: neoisp: Fix hdr decompression missing ratio
Add kneepoint_ratio4 as default ratio for pixel values being equal
or greater than declared kneepoints

Signed-off-by: Alexi Birlinger <alexi.birlinger@nxp.com>
Reviewed-by: Julien Vuillaumier <julien.vuillaumier@nxp.com>
Acked-by: Robert Chiras <robert.chiras@nxp.com>
2024-04-19 15:15:02 +02:00
Aymen Sghaier
1e57ad8adf ILIE-48: media: nxp: neoisp: Remove V4L2_SUBDEV_FL_STREAMS flag for subdevice
Current v4l2 subdevice node does not support stream/routing file ops,
while V4L2_SUBDEV_FL_STREAMS flag is set and leads to segfault when
using media-ctl with v4l-utils version 1.26.
This patch remove this flag until adding stream/routing support.

Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
Reviewed-by: Julien Vuillaumier <julien.vuillaumier@nxp.com>
Acked-by: Robert Chiras <robert.chiras@nxp.com>
2024-04-19 14:58:57 +02:00
Aymen Sghaier
74658ebdce ILIE-25: media: nxp: neoisp: Add multiple contexts support
The driver is updating isp parameters for each processed frame, assuming
only one camera context is used.
This patch adds multiple camera contexts handling.

Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
Reviewed-by: Julien Vuillaumier <julien.vuillaumier@nxp.com>
Acked-by: Robert Chiras <robert.chiras@nxp.com>
2024-04-19 14:57:43 +02:00
Nini Song
7611722dc5 media: cec: core: remove length check of Timer Status
commit ce5d241c3a upstream.

The valid_la is used to check the length requirements,
including special cases of Timer Status. If the length is
shorter than 5, that means no Duration Available is returned,
the message will be forced to be invalid.

However, the description of Duration Available in the spec
is that this parameter may be returned when these cases, or
that it can be optionally return when these cases. The key
words in the spec description are flexible choices.

Remove the special length check of Timer Status to fit the
spec which is not compulsory about that.

Signed-off-by: Nini Song <nini.song@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-04-17 11:19:26 +02:00
Mirela Rabulea
cec4700deb LF-11503-5: media: os08a20: Implement .get_frame_desc subdev callback
In order to provide the virtual channel and the CSI data type,
implement the .get_frame_desc() operation.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
2024-04-14 19:57:50 +03:00
Mirela Rabulea
3e96822777 MLK-26180: media: nxp: imx8-isi: Fix potential null pointer dereference
Fix mxc_isi_get_frame_desc(), in case the subdevice get_frame_desc
returns success, but the stream is not found in source_fd.

Fixes: 438ca0fc316b ("LF-11234-07: media: nxp: imx8-isi: Implement .get_frame_desc subdev callback")

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
2024-04-14 19:56:37 +03:00
Mirela Rabulea
3e050005f8 LF-11503-1: media: nxp: dwc-mipi-csi2: Set default VC and DT in CSI when no get_frame_desc
In order to support sensors that do not implement yet the
get_frame_desc(), do not fail, but provide a default virtual
channel and data type for the CSI.

Fixes: a01abbceaf9d ("LF-11234-03: media: nxp: dwc-mipi-csi2: Implement multi frame description")

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
2024-04-14 19:55:20 +03:00
Yunfei Dong
41671f0c01 media: mediatek: vcodec: adding lock to protect encoder context list
[ Upstream commit afaaf3a0f6 ]

Add a lock for the ctx_list, to avoid accessing a NULL pointer
within the 'vpu_enc_ipi_handler' function when the ctx_list has
been deleted due to an unexpected behavior on the SCP IP block.

Fixes: 1972e32431 ("media: mediatek: vcodec: Fix possible invalid memory access for encoder")
Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.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-04-13 13:07:40 +02:00
Yunfei Dong
0a2dc707aa media: mediatek: vcodec: adding lock to protect decoder context list
[ Upstream commit 6467cda18c ]

Add a lock for the ctx_list, to avoid accessing a NULL pointer
within the 'vpu_dec_ipi_handler' function when the ctx_list has
been deleted due to an unexpected behavior on the SCP IP block.

Hardware name: Google juniper sku16 board (DT)
pstate: 20400005 (nzCv daif +PAN -UAO -TCO BTYPE=--)
pc : vpu_dec_ipi_handler+0x58/0x1f8 [mtk_vcodec_dec]
lr : scp_ipi_handler+0xd0/0x194 [mtk_scp]
sp : ffffffc0131dbbd0
x29: ffffffc0131dbbd0 x28: 0000000000000000
x27: ffffff9bb277f348 x26: ffffff9bb242ad00
x25: ffffffd2d440d3b8 x24: ffffffd2a13ff1d4
x23: ffffff9bb7fe85a0 x22: ffffffc0133fbdb0
x21: 0000000000000010 x20: ffffff9b050ea328
x19: ffffffc0131dbc08 x18: 0000000000001000
x17: 0000000000000000 x16: ffffffd2d461c6e0
x15: 0000000000000242 x14: 000000000000018f
x13: 000000000000004d x12: 0000000000000000
x11: 0000000000000001 x10: fffffffffffffff0
x9 : ffffff9bb6e793a8 x8 : 0000000000000000
x7 : 0000000000000000 x6 : 000000000000003f
x5 : 0000000000000040 x4 : fffffffffffffff0
x3 : 0000000000000020 x2 : ffffff9bb6e79080
x1 : 0000000000000010 x0 : ffffffc0131dbc08
Call trace:
vpu_dec_ipi_handler+0x58/0x1f8 [mtk_vcodec_dec (HASH:6c3f 2)]
scp_ipi_handler+0xd0/0x194 [mtk_scp (HASH:7046 3)]
mt8183_scp_irq_handler+0x44/0x88 [mtk_scp (HASH:7046 3)]
scp_irq_handler+0x48/0x90 [mtk_scp (HASH:7046 3)]
irq_thread_fn+0x38/0x94
irq_thread+0x100/0x1c0
kthread+0x140/0x1fc
ret_from_fork+0x10/0x30
Code: 54000088 f94ca50a eb14015f 54000060 (f9400108)
---[ end trace ace43ce36cbd5c93 ]---
Kernel panic - not syncing: Oops: Fatal exception
SMP: stopping secondary CPUs
Kernel Offset: 0x12c4000000 from 0xffffffc010000000
PHYS_OFFSET: 0xffffffe580000000
CPU features: 0x08240002,2188200c
Memory Limit: none

Fixes: 655b86e52e ("media: mediatek: vcodec: Fix possible invalid memory access for decoder")
Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.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-04-13 13:07:40 +02:00
Nicolas Dufresne
ec25fc3c2c media: mediatek: vcodec: Fix oops when HEVC init fails
[ Upstream commit 97c75ee5de ]

The stateless HEVC decoder saves the instance pointer in the context
regardless if the initialization worked or not. This caused a use after
free, when the pointer is freed in case of a failure in the deinit
function.
Only store the instance pointer when the initialization was successful,
to solve this issue.

 Hardware name: Acer Tomato (rev3 - 4) board (DT)
 pstate: 80400009 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
 pc : vcodec_vpu_send_msg+0x4c/0x190 [mtk_vcodec_dec]
 lr : vcodec_send_ap_ipi+0x78/0x170 [mtk_vcodec_dec]
 sp : ffff80008750bc20
 x29: ffff80008750bc20 x28: ffff1299f6d70000 x27: 0000000000000000
 x26: 0000000000000000 x25: 0000000000000000 x24: 0000000000000000
 x23: ffff80008750bc98 x22: 000000000000a003 x21: ffffd45c4cfae000
 x20: 0000000000000010 x19: ffff1299fd668310 x18: 000000000000001a
 x17: 000000040044ffff x16: ffffd45cb15dc648 x15: 0000000000000000
 x14: ffff1299c08da1c0 x13: ffffd45cb1f87a10 x12: ffffd45cb2f5fe80
 x11: 0000000000000001 x10: 0000000000001b30 x9 : ffffd45c4d12b488
 x8 : 1fffe25339380d81 x7 : 0000000000000001 x6 : ffff1299c9c06c00
 x5 : 0000000000000132 x4 : 0000000000000000 x3 : 0000000000000000
 x2 : 0000000000000010 x1 : ffff80008750bc98 x0 : 0000000000000000
 Call trace:
  vcodec_vpu_send_msg+0x4c/0x190 [mtk_vcodec_dec]
  vcodec_send_ap_ipi+0x78/0x170 [mtk_vcodec_dec]
  vpu_dec_deinit+0x1c/0x30 [mtk_vcodec_dec]
  vdec_hevc_slice_deinit+0x30/0x98 [mtk_vcodec_dec]
  vdec_if_deinit+0x38/0x68 [mtk_vcodec_dec]
  mtk_vcodec_dec_release+0x20/0x40 [mtk_vcodec_dec]
  fops_vcodec_release+0x64/0x118 [mtk_vcodec_dec]
  v4l2_release+0x7c/0x100
  __fput+0x80/0x2d8
  __fput_sync+0x58/0x70
  __arm64_sys_close+0x40/0x90
  invoke_syscall+0x50/0x128
  el0_svc_common.constprop.0+0x48/0xf0
  do_el0_svc+0x24/0x38
  el0_svc+0x38/0xd8
  el0t_64_sync_handler+0xc0/0xc8
  el0t_64_sync+0x1a8/0x1b0
 Code: d503201f f9401660 b900127f b900227f (f9400400)

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Fixes: 2674486aac ("media: mediatek: vcodec: support stateless hevc decoder")
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.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-04-13 13:07:40 +02:00
Arnd Bergmann
cb9420142e media: sta2x11: fix irq handler cast
[ Upstream commit 3de49ae81c ]

clang-16 warns about casting incompatible function pointers:

drivers/media/pci/sta2x11/sta2x11_vip.c:1057:6: error: cast from 'irqreturn_t (*)(int, struct sta2x11_vip *)' (aka 'enum irqreturn (*)(int, struct sta2x11_vip *)') to 'irq_handler_t' (aka 'enum irqreturn (*)(int, void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]

Change the prototype of the irq handler to the regular version with a
local variable to adjust the argument type.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil: update argument documentation]
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-04-13 13:07:35 +02:00
Guoniu.zhou
f02a70ea4e LF-11913: media: imx8-isi: fix invalid frame description issue
For iMX95, the stream configurations are moved to csi formatter from
gasket enable/disable callback and only leave ISI QoS setting. When
enable multiple stream support in ISI driver, it will get multiple
frame description entity from remote subdev, but for gasket, only
need be called once, so remove the checking for the number of frame
description entity and use the first stream for single camera platform.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
2024-04-12 17:29:53 +08:00
Laurentiu Palcu
6a03b4c555 LF-11414-8 media/i2c: add support for mx95mbcam camera module
This is a NXP camera module containing a MAX96717F serializer chip and
an OX03C10 Omnivision sensor.

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>
2024-04-11 08:37:59 +00:00
Laurentiu Palcu
cb1389d3f3 LF-11414-7 media/i2c: add ox03c10 camera sensor library
The OX03C10 is 1/2.6" optical format, 1920x1280 stacked-chip digital
high dynamic range sensor intended for high-end CMS and SVS application
for the automotive market.

This is the library supporting the chip and will be used by module
drivers that usually contain a serializer and a sensor.

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>
2024-04-11 08:37:59 +00:00
Laurentiu Palcu
23ceb31ee0 LF-11414-6 media/i2c: add max96717 chip library
The MAX96717F GMSL serializer receives video on a MIPI CSI-2 interface
and outputs it on a GMSL2 serial link transceiver.

This is just a library that will be used by camera modules drivers that
usually contain a serializer and a camera sensor.

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>
2024-04-11 08:37:59 +00:00
Laurentiu Palcu
ad6c1bb4d0 LF-11414-4 media/i2c: add support for MAX96724 deserializer chip
The MAX96724/F/R deserializer converts four GMSL2/1 inputs to 1, 2, or 4
MIPI D-PHY or C-PHY outputs. The device allows simultaneous transmit
bidirectional transmissions over 50ohm coax or 100ohm STP cables that meet
the GMSL channel specification.

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>
2024-04-11 08:37:59 +00:00
Laurentiu Palcu
142920ec88 LF-11414-3 media/platform/nxp: imx8-isi: add 16bit raw formats support
We will need RAW16 formats for the OX03C10 cameras.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
Reviewed-by: G.N. Zhou <guoniu.zhou@nxp.com>
Reviewed-by: Mirela Rabulea <Mirela.rabulea@nxp.com>
2024-04-11 08:37:59 +00:00
Laurentiu Palcu
f06eedea02 LF-11414-2 media/platform/nxp: imx-csi-formatter: add RAW16 support
The CSI controller and pixel formatter supports RAW16 as well. Add it.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
Reviewed-by: G.N. Zhou <guoniu.zhou@nxp.com>
Reviewed-by: Mirela Rabulea <Mirela.rabulea@nxp.com>
2024-04-11 08:37:59 +00:00
Laurentiu Palcu
a115bfbfa4 LF-11414-1 media/platform/nxp: dwc-mipi-csi2: add support for RAW 16bit formats
The 16bit RAW formats will be needed for the OX03C10 camera sensor.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
Reviewed-by: G.N. Zhou <guoniu.zhou@nxp.com>
Reviewed-by: Mirela Rabulea <Mirela.rabulea@nxp.com>
2024-04-11 08:37:59 +00:00
Guoniu.zhou
b588873215 LF-11655: media: i2c: ap130x: add scaling support
AP1302 is an external ISP which can support scaling. User can use
this feature to reach 1080P@60 since the maximum size output by
AR0144 sensor is 1280x800.

How to set scaling:
$ media-ctl -V "'ap130x.2-003c':2 [fmt:UYVY8_1X16/1920x1080 field:none]"

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2024-04-08 11:25:51 +08:00
Guoniu.zhou
f5926e028e LF-11653-02: media: i2c: ap130x: remove ADV_IRQ_SYS_INTE register setting
Remove ADV_IRQ_SYS_INTE register setting when enable stream, otherwise
data lanes changing won't take effect. I can't find any description
about the register in AP1302 data sheet. I'm asking Onsemi for help.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2024-04-08 11:25:51 +08:00
Guoniu.zhou
c2d0ac5b4e LF-11233: media: i2c: ap130x: Implement .get_frame_desc subdev callback
Implement .get_frame_desc subdev callback.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2024-04-08 11:25:50 +08:00
Guoniu.zhou
8d1a3591dd LF-11234-07: media: nxp: imx8-isi: Implement .get_frame_desc subdev callback
Implement .get_frame_desc subdev callback for ISI.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Tested-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2024-04-08 11:25:50 +08:00
Guoniu.zhou
84dfe1bc31 LF-11234-06: media: nxp: imx8-isi: add virtual channel support
ISI of iMX95 can handle 8 virtual channel and only process the data
from pixel link which virtual channel ID number matched. It gets the
number from remote connected subdev, so it can handler 8 different
independent camera stream.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Tested-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2024-04-08 11:25:50 +08:00
Guoniu.zhou
10fc626a62 LF-11234-05: media: nxp: imx8-isi: add ISI stream duplicated support
ISI support duplicate input stream into multiple outputs,
but v4l2 subdev stream only can be enabled/disabled one
time, so return zero directly for input stream which has
been enabled or disabled.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Tested-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2024-04-08 11:25:50 +08:00
Guoniu.zhou
081e0820af LF-11234-04: media: nxp: dwc-mipi-csi2: Add multiplexed streams support
Add multiplexed streams support for DesignWare MIPI CSI-2 driver.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Tested-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2024-04-08 11:25:50 +08:00
Guoniu.zhou
34520c46ad LF-11234-03: media: nxp: dwc-mipi-csi2: Implement multi frame description
Implement multi frame description since its input may have
multiple stream, not only single one.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Tested-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2024-04-08 11:25:50 +08:00
Guoniu.zhou
aa2cafeee7 LF-11234-02: media: nxp: dwc-mipi-csi2: Rename sensor_sd to source_sd
Rename sensor_sd to source_sd since the input of MIPI CSI-2
maybe other bridge device, such as deserilizer, so the name
source_sd for the remote connected subdev should be better.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Tested-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2024-04-08 11:25:50 +08:00
Guoniu.zhou
d1eb6606b9 LF-11234-01: media: nxp: dwc-mipi-csi2: fix resources uncleaned issue
Some resources are not cleaned when error happened, fix them.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Tested-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2024-04-08 11:25:50 +08:00
Guoniu.zhou
dd701628d6 LF-10853-04: media: nxp: imx8-isi: remove gasket support for iMX95
The gasket operations are used to control csi pixel formatter, remove
it since a new driver for pixel formatter has been added.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2024-04-08 11:25:50 +08:00
Guoniu.zhou
f261ddc3d1 LF-10853-03: media: nxp: add v4l2 subdev driver for csi pixel formatter
The CSI2 pixel formatter is a module which can uses packet info, pixel
and non-pixel data from the CSI2 host controller and reformat them to
match Pixel Link (PL) definition. In addition, optionally, it can either
route non-pixel data or one of pixel data type to another pixel link
virtual channel.

So add a V4L2 subdev driver for it since it's a standalone module and
need to export more controls to userspace.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2024-04-08 11:25:50 +08:00
Laurent Pinchart
88efc3095b media: nxp: imx8-isi: Mark all crossbar sink pads as MUST_CONNECT
[ Upstream commit 9b71021b2e ]

All the sink pads of the crossbar switch require an active link if
they're part of the pipeline. Mark them with the
MEDIA_PAD_FL_MUST_CONNECT flag to fail pipeline validation if they're
not connected. This allows removing a manual check when translating
streams.

Cc: stable@vger.kernel.org # 6.1
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-04-03 15:28:18 +02:00
Laurent Pinchart
d0e3440dab media: mc: Expand MUST_CONNECT flag to always require an enabled link
[ Upstream commit b3decc5ce7 ]

The MEDIA_PAD_FL_MUST_CONNECT flag indicates that the pad requires an
enabled link to stream, but only if it has any link at all. This makes
little sense, as if a pad is part of a pipeline, there are very few use
cases for an active link to be mandatory only if links exist at all. A
review of in-tree drivers confirms they all need an enabled link for
pads marked with the MEDIA_PAD_FL_MUST_CONNECT flag.

Expand the scope of the flag by rejecting pads that have no links at
all. This requires modifying the pipeline build code to add those pads
to the pipeline.

Cc: stable@vger.kernel.org # 6.1
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-04-03 15:28:17 +02:00
Laurent Pinchart
3b6ccc91dc media: mc: Rename pad variable to clarify intent
[ Upstream commit 9ec9109cf9 ]

The pad local variable in the media_pipeline_explore_next_link()
function is used to store the pad through which the entity has been
reached. Rename it to origin to reflect that and make the code easier to
read. This will be even more important in subsequent commits when
expanding the function with additional logic.

Cc: stable@vger.kernel.org # 6.1
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-04-03 15:28:17 +02:00
Laurent Pinchart
ebb6fb7f62 media: mc: Add num_links flag to media_pad
[ Upstream commit baeddf94aa ]

Maintain a counter of the links connected to a pad in the media_pad
structure. This helps checking if a pad is connected to anything, which
will be used in the pipeline building code.

Cc: stable@vger.kernel.org # 6.1
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-04-03 15:28:17 +02:00
Marek Vasut
c95318607f media: nxp: imx8-isi: Check whether crossbar pad is non-NULL before access
[ Upstream commit eb2f932100 ]

When translating source to sink streams in the crossbar subdev, the
driver tries to locate the remote subdev connected to the sink pad. The
remote pad may be NULL, if userspace tries to enable a stream that ends
at an unconnected crossbar sink. When that occurs, the driver
dereferences the NULL pad, leading to a crash.

Prevent the crash by checking if the pad is NULL before using it, and
return an error if it is.

Cc: stable@vger.kernel.org # 6.1
Fixes: cf21f328fc ("media: nxp: Add i.MX8 ISI driver")
Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://lore.kernel.org/r/20231201150614.63300-1-marex@denx.de
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-04-03 15:28:17 +02:00
Laurent Pinchart
0a76902247 media: mc: Fix flags handling when creating pad links
[ Upstream commit 422f7af75d ]

The media_create_pad_link() function doesn't correctly clear reject link
type flags, nor does it set the DATA_LINK flag. It only works because
the MEDIA_LNK_FL_DATA_LINK flag's value is 0.

Fix it by returning an error if any link type flag is set. This doesn't
introduce any regression, as nobody calls the media_create_pad_link()
function with link type flags (easily checked by grepping for the flag
in the source code, there are very few hits).

Set the MEDIA_LNK_FL_DATA_LINK explicitly, which is a no-op that the
compiler will optimize out, but is still useful to make the code more
explicit and easier to understand.

Cc: stable@vger.kernel.org # 6.1
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-04-03 15:28:17 +02:00
Laurent Pinchart
cc088ebf8b media: mc: Add local pad to pipeline regardless of the link state
[ Upstream commit 78f0daa026 ]

When building pipelines by following links, the
media_pipeline_explore_next_link() function only traverses enabled
links. The remote pad of a disabled link is not added to the pipeline,
and neither is the local pad. While the former is correct as disabled
links should not be followed, not adding the local pad breaks processing
of the MEDIA_PAD_FL_MUST_CONNECT flag.

The MEDIA_PAD_FL_MUST_CONNECT flag is checked in the
__media_pipeline_start() function that iterates over all pads after
populating the pipeline. If the pad is not present, the check gets
skipped, rendering it useless.

Fix this by adding the local pad of all links regardless of their state,
only skipping the remote pad for disabled links.

Cc: stable@vger.kernel.org # 6.1
Fixes: ae21987283 ("media: mc: entity: Rewrite media_pipeline_start()")
Reported-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Closes: https://lore.kernel.org/linux-media/7658a15a-80c5-219f-2477-2a94ba6c6ba1@kontron.de
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-04-03 15:28:17 +02:00
Gui-Dong Han
dc5e4f2404 media: xc4000: Fix atomicity violation in xc4000_get_frequency
[ Upstream commit 36d503ad54 ]

In xc4000_get_frequency():
	*freq = priv->freq_hz + priv->freq_offset;
The code accesses priv->freq_hz and priv->freq_offset without holding any
lock.

In xc4000_set_params():
	// Code that updates priv->freq_hz and priv->freq_offset
	...

xc4000_get_frequency() and xc4000_set_params() may execute concurrently,
risking inconsistent reads of priv->freq_hz and priv->freq_offset. Since
these related data may update during reading, it can result in incorrect
frequency calculation, leading to atomicity violations.

This possible bug is found by an experimental static analysis tool
developed by our team, BassCheck[1]. 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. The above
possible bug is reported when our tool analyzes the source code of
Linux 6.2.

To address this issue, it is proposed to add a mutex lock pair in
xc4000_get_frequency() to ensure atomicity. With this patch applied, our
tool no longer reports the possible bug, with the kernel configuration
allyesconfig for x86_64. Due to the lack of associated hardware, we cannot
test the patch in runtime testing, and just verify it according to the
code logic.

[1] https://sites.google.com/view/basscheck/

Fixes: 4c07e32884 ("[media] xc4000: Fix get_frequency()")
Cc: stable@vger.kernel.org
Reported-by: BassCheck <bass@buaa.edu.cn>
Signed-off-by: Gui-Dong Han <2045gemini@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-04-03 15:28:17 +02:00
Ming Qian
168cffba43 media: amphion: Abort vpu parsing directly in seek
Driver abort vpu decoding when both output and capture queues are off,
but if seek in parsing the sequence header, driver may miss aborting the
parsing. so just abort the vpu parsing directly in seek.

Meanwhile if capture is off unexpectedly, we still need to abort the
decoding and return capture buffers.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-04-01 15:21:33 +09:00
Ming Qian
69bd9bfd4e media: imx-jpeg: Support for negotiating bytesperline with client
This mxc-jpeg driver doesn't allow the client to set the bytesperline,
but for some android cts case, it need to negotiate the bytesperline
between decoder and display, and fail the case if driver doesn't support
negotiating bytesperline

The jpegdec and jpegenc does support to set bytesperline which is
multiple of 2, and greater than the value calulated by driver.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-04-01 15:21:33 +09:00
Peng Fan
b4ebd56fb4 LF-11722 Update copyright for scmi and isi
Add NXP Copyright following patch creation time.

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2024-04-01 14:04:08 +08:00
Alice Yuan
48a6b3a7dd LF-11619-3: capture: csi : remove unused clocks for mipi csi
As ic ticket TKT0639003 describes, the CSI1_PHY_REF clock (named "phy_clk"
in driver) is unused for imx8mm CSI. However other platforms like iMX7D
still requires "phy_clk", use devm_clk_get_optional() instead.

Test command:
gst-launch-1.0 -v v4l2src device=/dev/video1 num-buffers=20 !
"video/x-raw,format=YUY2,width=1920,height=1080" ! queue ! filesink
location=/home/root/video.yuyv &

Signed-off-by: Alice Yuan <alice.yuan@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2024-04-01 13:57:18 +08:00
Jason Liu
039a4cdb2c Linux 6.6.23
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEE4n5dijQDou9mhzu83qZv95d3LNwFAmYDTh8ACgkQ3qZv95d3
 LNzBbhAAwSqAoBZBxApda8QQEVvF012dZG0btn0wJv2H3Bu8wasAhfD2pD5LxFZf
 Ru3EVgrBeupMKhZk/aeN5d2qSxn5mCiU4WnAwqDvjtsIicjmeeRaqcGGFFmZ6TyM
 KrK+NjxHu77L6dlkMZRLRugP/7WGGUI3G0fGj2HvJOlMRFHJSx8o4JeX1Yc10xDz
 MbySZBj4ZctjvP16dxehA44Grw08CTxnoPgrHn52TgncLGuQfcx+w+fXEDJfdRzP
 vS8D+8C4G8iwjyfKLnb/jytZR0jlVii3DkQXcIjUzGRQ4UEhfzvSn9C07zu80cPV
 iskQCo/IS1/2gD5M6OgVOjfR0yfF/NCOm692omEH6oQHjNu6QOxM2PpFpIYzm34r
 /4wnTMg58AMsNGp/D5bipl3X5B93pWDoCLq939ZU9688EaR1n/Xsh5+EXG0lKIux
 Eb4tk2z7zJt54/UQM+J2qhtJrqriflSl1dTBxpuZb2abUrq5ewQgNyqhb0hXBc5f
 F5SU5O+dkntQGcUQ1GBSWk5B5q8oXmqY9reIeuhhRYI0w0Y+Xt+jeQHhQSU0j7ne
 DLv5uG32HTR9p8z1jidJJY8VL3MuCpMzrfFkZsEUEut0haF8FhpGIxZ+YjNYcgRt
 f57z1Sf5Gzr+fpM1q8TesHI8+7MEh7Fel+elyWpvnidJfMNx4t8=
 =mu/j
 -----END PGP SIGNATURE-----

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

Linux 6.6.23

* tag 'v6.6.23': (630 commits)
  Linux 6.6.23
  x86/efistub: Don't clear BSS twice in mixed mode
  x86/efistub: Clear decompressor BSS in native EFI entrypoint
  ...

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

 Conflicts:
	arch/arm64/boot/dts/freescale/imx8mp-evk.dts
	drivers/gpio/Kconfig
	drivers/spi/spi-imx.c
2024-04-01 11:00:10 +08:00
Arnd Bergmann
7334b815d2 media: mediatek: vcodec: avoid -Wcast-function-type-strict warning
[ Upstream commit bfb1b99802 ]

The ipi handler here tries hard to maintain const-ness of its argument,
but by doing that causes a warning about function type casts:

drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_vpu.c:38:32: error: cast from 'mtk_vcodec_ipi_handler' (aka 'void (*)(void *, unsigned int, void *)') to 'ipi_handler_t' (aka 'void (*)(const void *, unsigned int, void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
   38 |         ipi_handler_t handler_const = (ipi_handler_t)handler;
      |                                       ^~~~~~~~~~~~~~~~~~~~~~

Remove the hack and just use a non-const argument.

Fixes: bf1d556ad4 ("media: mtk-vcodec: abstract firmware interface")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-03-26 18:19:53 -04:00