linux-2.6-microblaze.git
6 months agomedia: go7007: fix a memleak in go7007_load_encoder
Zhipeng Lu [Wed, 21 Feb 2024 04:37:13 +0000 (12:37 +0800)]
media: go7007: fix a memleak in go7007_load_encoder

In go7007_load_encoder, bounce(i.e. go->boot_fw), is allocated without
a deallocation thereafter. After the following call chain:

saa7134_go7007_init
  |-> go7007_boot_encoder
        |-> go7007_load_encoder
  |-> kfree(go)

go is freed and thus bounce is leaked.

Fixes: 95ef39403f89 ("[media] go7007: remember boot firmware")
Signed-off-by: Zhipeng Lu <alexious@zju.edu.cn>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
6 months agomedia: dvb-frontends: avoid stack overflow warnings with clang
Arnd Bergmann [Fri, 16 Feb 2024 16:31:44 +0000 (17:31 +0100)]
media: dvb-frontends: avoid stack overflow warnings with clang

A previous patch worked around a KASAN issue in stv0367, now a similar
problem showed up with clang:

drivers/media/dvb-frontends/stv0367.c:1222:12: error: stack frame size (3624) exceeds limit (2048) in 'stv0367ter_set_frontend' [-Werror,-Wframe-larger-than]
 1214 | static int stv0367ter_set_frontend(struct dvb_frontend *fe)

Rework the stv0367_writereg() function to be simpler and mark both
register access functions as noinline_for_stack so the temporary
i2c_msg structures do not get duplicated on the stack when KASAN_STACK
is enabled.

Fixes: 3cd890dbe2a4 ("media: dvb-frontends: fix i2c access helpers for KASAN")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Justin Stitt <justinstitt@google.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
6 months agomedia: pvrusb2: fix uaf in pvr2_context_set_notify
Edward Adam Davis [Fri, 16 Feb 2024 07:30:47 +0000 (15:30 +0800)]
media: pvrusb2: fix uaf in pvr2_context_set_notify

[Syzbot reported]
BUG: KASAN: slab-use-after-free in pvr2_context_set_notify+0x2c4/0x310 drivers/media/usb/pvrusb2/pvrusb2-context.c:35
Read of size 4 at addr ffff888113aeb0d8 by task kworker/1:1/26

CPU: 1 PID: 26 Comm: kworker/1:1 Not tainted 6.8.0-rc1-syzkaller-00046-gf1a27f081c1f #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024
Workqueue: usb_hub_wq hub_event
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:377 [inline]
 print_report+0xc4/0x620 mm/kasan/report.c:488
 kasan_report+0xda/0x110 mm/kasan/report.c:601
 pvr2_context_set_notify+0x2c4/0x310 drivers/media/usb/pvrusb2/pvrusb2-context.c:35
 pvr2_context_notify drivers/media/usb/pvrusb2/pvrusb2-context.c:95 [inline]
 pvr2_context_disconnect+0x94/0xb0 drivers/media/usb/pvrusb2/pvrusb2-context.c:272

Freed by task 906:
kasan_save_stack+0x33/0x50 mm/kasan/common.c:47
kasan_save_track+0x14/0x30 mm/kasan/common.c:68
kasan_save_free_info+0x3f/0x60 mm/kasan/generic.c:640
poison_slab_object mm/kasan/common.c:241 [inline]
__kasan_slab_free+0x106/0x1b0 mm/kasan/common.c:257
kasan_slab_free include/linux/kasan.h:184 [inline]
slab_free_hook mm/slub.c:2121 [inline]
slab_free mm/slub.c:4299 [inline]
kfree+0x105/0x340 mm/slub.c:4409
pvr2_context_check drivers/media/usb/pvrusb2/pvrusb2-context.c:137 [inline]
pvr2_context_thread_func+0x69d/0x960 drivers/media/usb/pvrusb2/pvrusb2-context.c:158

[Analyze]
Task A set disconnect_flag = !0, which resulted in Task B's condition being met
and releasing mp, leading to this issue.

[Fix]
Place the disconnect_flag assignment operation after all code in pvr2_context_disconnect()
to avoid this issue.

Reported-and-tested-by: syzbot+ce750e124675d4599449@syzkaller.appspotmail.com
Fixes: e5be15c63804 ("V4L/DVB (7711): pvrusb2: Fix race on module unload")
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
6 months agomedia: usb: s2255: Refactor s2255_get_fx2fw
Ricardo Ribalda [Sun, 28 Jan 2024 16:13:57 +0000 (16:13 +0000)]
media: usb: s2255: Refactor s2255_get_fx2fw

Resize the buffer to the actual size needed and initialize it. With this
we can convince gcc-11 that the variable is not used uninitialized.

drivers/media/usb/s2255/s2255drv.c:1914:25: warning: 'transBuffer' may be used uninitialized [-Wmaybe-uninitialized]

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
6 months agomedia: ti: j721e-csi2rx: Convert to platform remove callback returning void
Uwe Kleine-König [Fri, 23 Feb 2024 12:59:08 +0000 (13:59 +0100)]
media: ti: j721e-csi2rx: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
6 months agomedia: stm32-dcmipp: Convert to platform remove callback returning void
Uwe Kleine-König [Fri, 23 Feb 2024 12:59:07 +0000 (13:59 +0100)]
media: stm32-dcmipp: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
6 months agomedia: nxp: imx8-isi: Convert to platform remove callback returning void
Uwe Kleine-König [Fri, 23 Feb 2024 12:59:06 +0000 (13:59 +0100)]
media: nxp: imx8-isi: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
6 months agomedia: nuvoton: Convert to platform remove callback returning void
Uwe Kleine-König [Fri, 23 Feb 2024 12:59:05 +0000 (13:59 +0100)]
media: nuvoton: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
6 months agomedia: chips-media: wave5: Convert to platform remove callback returning void
Uwe Kleine-König [Fri, 23 Feb 2024 12:59:04 +0000 (13:59 +0100)]
media: chips-media: wave5: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
6 months agomedia: chips-media: wave5: Remove unnecessary semicolons
Thorsten Blum [Tue, 13 Feb 2024 14:04:41 +0000 (15:04 +0100)]
media: chips-media: wave5: Remove unnecessary semicolons

Remove unnecessary semicolons reported by Coccinelle/coccicheck and the
semantic patch at scripts/coccinelle/misc/semicolon.cocci.

Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
6 months agoMerge tag 'tags/media-next-rkisp1-20240223' of git://git.kernel.org/pub/scm/linux...
Hans Verkuil [Fri, 23 Feb 2024 14:17:10 +0000 (15:17 +0100)]
Merge tag 'tags/media-next-rkisp1-20240223' of git://git./linux/kernel/git/pinchartl/linux.git into media_stage

This adds i.MX8MP support to the rkisp1 driver.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://patchwork.linuxtv.org/project/linux-media/patch/20240223123556.GA26004@pendragon.ideasonboard.com/
6 months agomedia: i2c: imx290: Fix IMX920 typo
Alexander Stein [Wed, 21 Feb 2024 07:15:50 +0000 (08:15 +0100)]
media: i2c: imx290: Fix IMX920 typo

Replace IMX920 by IMX290.

Fixes: b4ab57b07c5b9 ("media: i2c: imx290: Add crop selection targets support")
Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-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>
6 months agomedia: platform: replace of_graph_get_next_endpoint()
Kuninori Morimoto [Tue, 20 Feb 2024 01:16:36 +0000 (01:16 +0000)]
media: platform: replace of_graph_get_next_endpoint()

From DT point of view, in general, drivers should be asking for a
specific port number because their function is fixed in the binding.

of_graph_get_next_endpoint() doesn't match to this concept.

Simply replace

- of_graph_get_next_endpoint(xxx, NULL);
+ of_graph_get_endpoint_by_regs(xxx, 0, -1);

Link: https://lore.kernel.org/r/20240202174941.GA310089-robh@kernel.org
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
6 months agomedia: i2c: replace of_graph_get_next_endpoint()
Kuninori Morimoto [Tue, 20 Feb 2024 01:16:21 +0000 (01:16 +0000)]
media: i2c: replace of_graph_get_next_endpoint()

From DT point of view, in general, drivers should be asking for a
specific port number because their function is fixed in the binding.

of_graph_get_next_endpoint() doesn't match to this concept.

Simply replace

- of_graph_get_next_endpoint(xxx, NULL);
+ of_graph_get_endpoint_by_regs(xxx, 0, -1);

Link: https://lore.kernel.org/r/20240202174941.GA310089-robh@kernel.org
Link: https://lore.kernel.org/r/9d1e99b0-892d-4a72-a9b3-886b8ed094b0@xs4all.nl
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
6 months agomedia: ivsc: csi: Make use of sub-device state
Sakari Ailus [Wed, 14 Feb 2024 09:12:14 +0000 (11:12 +0200)]
media: ivsc: csi: Make use of sub-device state

The MEI CSI driver was using sub-device state but still maintained its own
format information and did its own locking. Rely on sub-device state
instead. This also fixes a circular locking problem during link
validation.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
6 months agomedia: ivsc: csi: Swap SINK and SOURCE pads
Sakari Ailus [Wed, 7 Feb 2024 12:17:09 +0000 (14:17 +0200)]
media: ivsc: csi: Swap SINK and SOURCE pads

This patch swaps SINK and SOURCE pads of the MEI CSI sub-device. While
this does change the UAPI by swapping the pads, the driver has never been
usable in upstream kernel as the Intel IPU6 driver it depends on any
functionality has not yet been merged.

Fixes: 29006e196a56 ("media: pci: intel: ivsc: Add CSI submodule")
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
6 months agomedia: ipu-bridge: Serialise calls to IPU bridge init
Sakari Ailus [Tue, 13 Feb 2024 09:42:30 +0000 (11:42 +0200)]
media: ipu-bridge: Serialise calls to IPU bridge init

The IPU bridge initialisation will be called from multiple locations in
the future. Serialise the access to devices' fwnodes in this context.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
6 months agomedia: ipu-bridge: Move graph checking to IPU bridge
Sakari Ailus [Tue, 13 Feb 2024 09:41:18 +0000 (11:41 +0200)]
media: ipu-bridge: Move graph checking to IPU bridge

Move checking the graph to the IPU bridge. This way the caller won't need
to do it.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
6 months agomedia: ipu-bridge: Add ov01a10 in Dell XPS 9315
Sakari Ailus [Wed, 31 Jan 2024 13:23:34 +0000 (15:23 +0200)]
media: ipu-bridge: Add ov01a10 in Dell XPS 9315

Add Omnivision ov01a10 sensor used in Dell XPS 9315, and use the driver
default frequency.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
6 months agomedia: imx335: Add support for test pattern generator
Matthias Fend [Tue, 20 Feb 2024 09:28:21 +0000 (14:58 +0530)]
media: imx335: Add support for test pattern generator

Add support for the sensor's test pattern generator.

Signed-off-by: Matthias Fend <matthias.fend@emfend.at>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
6 months agomedia: imx335: Refactor power sequence to set controls
Umang Jain [Tue, 20 Feb 2024 09:28:20 +0000 (14:58 +0530)]
media: imx335: Refactor power sequence to set controls

Additional controls might require the sensor to be powered up
to set the control value. Currently, only the exposure control
powers up the sensor.

Move the power up sequence out of the switch-case block.
In a subsequent patch, test pattern control will be added that
needs the sensor to be powered up. Hence, refactor the power
sequence to be present outside the switch-case block.

The VBLANK control is also moved out of the switch-case in order
to be handled early on, to propagate the changes to other controls.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
6 months agomedia: imx335: Support multiple link frequency
Umang Jain [Tue, 20 Feb 2024 09:28:19 +0000 (14:58 +0530)]
media: imx335: Support multiple link frequency

Support link frequency of 445MHz in addition to 594MHz.
Break out the register set specific to each data lane rate and also add
the general timing register set corresponding to the each data
lane rate.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
6 months agomedia: imx335: Use v4l2_link_freq_to_bitmap helper
Umang Jain [Tue, 20 Feb 2024 09:28:18 +0000 (14:58 +0530)]
media: imx335: Use v4l2_link_freq_to_bitmap helper

Use the v4l2_link_freq_to_bitmap() helper to figure out which
driver-supported link frequencies can be used on a given system.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
6 months agomedia: imx335: Set reserved register to default value
Umang Jain [Tue, 20 Feb 2024 09:28:17 +0000 (14:58 +0530)]
media: imx335: Set reserved register to default value

0x3a00 is a reserved register as per the datasheet. The driver
currently sets to it 0x01 while the datasheet claims 0x00 to be
the default value.

On one of the setup based on i.MX8MP platform with IMX335, this register
write broke the CSI-2 configuration. Setting 0x3a00 to its default
value (i.e. 0x00) fixed the issue. It is not clear from the datasheet
what this register write is responsible for but setting it to its default
value seems the right thing to do, provided it has been found
responsible to break CSI-2 configuration on one of the platform.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reported-by: Matthias Fend <matthias.fend@emfend.at>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
6 months agomedia: i2c: dw9714: Fix occasional probe errors
Ondrej Jirman [Sat, 17 Feb 2024 18:49:11 +0000 (19:49 +0100)]
media: i2c: dw9714: Fix occasional probe errors

The powerup delay was not observed during probe, leading to occasional
I2C communication failures in RPM suspend callback. Power delay is
properly observed in resume callback already.

Signed-off-by: Ondrej Jirman <megi@xff.cz>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
6 months agomedia: i2c: ov5645: Remove software reset entry from ov5645_global_init_setting
Biju Das [Thu, 15 Feb 2024 14:43:33 +0000 (14:43 +0000)]
media: i2c: ov5645: Remove software reset entry from ov5645_global_init_setting

The SYSTEM_CTRL0 register in ov5645 is almost similar to ov5640. But the
hard reset control is mandatory for the ov5645 device, so there is no
need for soft reset in the driver.

Add a 1msec delay for the software power up (OV5645_SYSTEM_CTRL0_START)
register in ov5645_global_init_setting. Without this delay sometimes the
image is not captured at all when the i2c frequency is 400kHz.

The changes are fixing both the greenish issue and image capture at 400kHz
i2c frequency on Renesas RZ/G2L SMARC EVK platforms.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
6 months agomedia: i2c: alvium: fix req_fr check in alvium_s_frame_interval()
Tommaso Merciai [Wed, 20 Dec 2023 12:40:23 +0000 (13:40 +0100)]
media: i2c: alvium: fix req_fr check in alvium_s_frame_interval()

req_fr check in alvium_s_frame_interval() is incorrect. In particular
req_fr can't be >=max and <= min at the same time. Ensure the requested
frame rate remains within the supported range between min_fr and max_fr by
clamping it.

Also remove the unused dft_fr argument of alvium_get_frame_interval().

Signed-off-by: Tommaso Merciai <tomm.merciai@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
6 months agomedia: i2c: alvium: store frame interval in subdev state
Tommaso Merciai [Wed, 20 Dec 2023 12:40:22 +0000 (13:40 +0100)]
media: i2c: alvium: store frame interval in subdev state

Use the newly added storage for frame interval in the subdev state to
simplify the driver.

Signed-off-by: Tommaso Merciai <tomm.merciai@gmail.com>
Reviewed-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>
6 months agomedia: i2c: alvium: inline set_frame_interval into s_frame_interval
Tommaso Merciai [Wed, 20 Dec 2023 12:40:21 +0000 (13:40 +0100)]
media: i2c: alvium: inline set_frame_interval into s_frame_interval

Inline alvium_set_frame_interval() into alvium_s_frame_interval().
The alvium_set_frame_interval() is called once only, by
alvium_s_frame_interval(). The latter is a thin wrapper around the
former. Inline the function in its caller to make the code more
readable.

Signed-off-by: Tommaso Merciai <tomm.merciai@gmail.com>
Reviewed-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>
6 months agomedia: i2c: alvium: remove the fr field of the alvium_dev structure
Tommaso Merciai [Wed, 20 Dec 2023 12:40:20 +0000 (13:40 +0100)]
media: i2c: alvium: remove the fr field of the alvium_dev structure

The fr (frame rate) field of the alvium_dev structure is
only used to pass result from alvium_set_frame_interval() to
alvium_set_frame_rate() that writes this info into the hw reg.
Replace it with a function parameter.

Signed-off-by: Tommaso Merciai <tomm.merciai@gmail.com>
Reviewed-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>
6 months agomedia: i2c: alvium: removal of dft_fr, min_fr and max_fr
Tommaso Merciai [Wed, 20 Dec 2023 12:40:19 +0000 (13:40 +0100)]
media: i2c: alvium: removal of dft_fr, min_fr and max_fr

The dft_fr, min_fr and max_fr fields of the alvium_dev structure are
only used to pass results from alvium_get_frame_interval() to its
caller. Replace them with function parameters.

Signed-off-by: Tommaso Merciai <tomm.merciai@gmail.com>
Reviewed-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>
6 months agomedia: rkisp1: Add match data for i.MX8MP ISP
Paul Elder [Fri, 16 Feb 2024 09:54:58 +0000 (18:54 +0900)]
media: rkisp1: Add match data for i.MX8MP ISP

Add match data to the rkisp1 driver to match the i.MX8MP ISP.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Tested-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
6 months agomedia: rkisp1: Fix endianness on raw streams on i.MX8MP
Paul Elder [Fri, 16 Feb 2024 09:54:57 +0000 (18:54 +0900)]
media: rkisp1: Fix endianness on raw streams on i.MX8MP

The i.MX8MP has extra register fields in the memory interface control
register for setting the output format, which work with the output
alignment format register for byte-swapping and LSB/MSB alignment.

With processed and 8-bit raw streams, it doesn't cause any problems to
not set these, but with raw streams of higher bit depth the endianness
is swapped and the data is not aligned properly.

Add support for setting these registers and plumb them in to fix this.

While at it, reflow a comment related to the forced configuration
update.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com>
6 months agomedia: rkisp1: Add UYVY as an output format
Paul Elder [Fri, 16 Feb 2024 09:54:56 +0000 (18:54 +0900)]
media: rkisp1: Add UYVY as an output format

Add support for UYVY as an output format. The uv_swap bit in the
MI_XTD_FORMAT_CTRL register that is used for the NV formats does not
work for packed YUV formats. Thus, UYVY support is implemented via
byte-swapping. This method clearly does not work for implementing
support for YVYU and VYUY.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Tested-by: Adam Ford <aford173@gmail.com>
6 months agomedia: rkisp1: Add YC swap capability
Paul Elder [Fri, 16 Feb 2024 09:54:55 +0000 (18:54 +0900)]
media: rkisp1: Add YC swap capability

The ISP version in the i.MX8MP has an MI_OUTPUT_ALIGN_FORMAT register
that the rk3399 does not have. This register allows swapping bytes,
which can be used to implement UYVY from YUYV.

Add a flag to the format info in the list of formats supported by the
capture v4l2 devices, and update enum_fmt and s_fmt to take it into
account.

To signify the presence of this feature, reuse the MAIN_STRIDE feature
flag, as it is very likely that any ISP version that supports one of
these two features will also support the other.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Tested-by: Adam Ford <aford173@gmail.com>
6 months agomedia: rkisp1: Support i.MX8MP's 34-bit DMA
Paul Elder [Fri, 16 Feb 2024 09:54:54 +0000 (18:54 +0900)]
media: rkisp1: Support i.MX8MP's 34-bit DMA

On the ISP that is integrated in the i.MX8MP, DMA addresses have been
extended to 34 bits, with the 32 MSBs stored in the DMA address
registers and the 2 LSBs set to 0.

To support this:
- Shift the addresses to the right by 2 when writing to registers
- Set the dma mask to 34 bits
- Use dma_addr_t instead of u32 when storing the addresses

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Tested-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
6 months agomedia: rkisp1: Configure gasket on i.MX8MP
Laurent Pinchart [Fri, 16 Feb 2024 09:54:53 +0000 (18:54 +0900)]
media: rkisp1: Configure gasket on i.MX8MP

The i.MX8MP has a gasket between the CSI-2 receiver and the ISP.
Configure and enable it when starting the ISP, and disable it when
stopping.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Tested-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
6 months agomedia: rkisp1: Add version enum for i.MX8MP ISP
Paul Elder [Fri, 16 Feb 2024 09:54:52 +0000 (18:54 +0900)]
media: rkisp1: Add version enum for i.MX8MP ISP

The NXP i.MX8MP integrates an ISP8000Nano from VeriSilicon, which is a
derivative of the ISP found in earlier Rockchip SoCs. It isn't clear at
which exact point the two product lines have diverged, and there is no
public information regarding the version numbering scheme of the
ISP8000Nano. Nonetheless, this ISP is close enough to the V10 found in
the RK3399 to be supported by the same driver.

Add an entry for the ISP found in the NXP i.MX8MP to the version enum.
Given the lack of information on the version numbering scheme, and on
whether or not the version in the i.MX8MP is identical to other
ISP8000Nano versions or has been customized for the i.MX8MP, depart from
the number-based versions and name this new version V_IMX8MP.

Update comments for the other versions and for relevant parameters
blocks to clearly indicate the size of grids and histogram for the
different versions.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com>
6 months agodt-bindings: media: rkisp1: Add i.MX8MP ISP to compatible
Paul Elder [Fri, 16 Feb 2024 09:54:51 +0000 (18:54 +0900)]
dt-bindings: media: rkisp1: Add i.MX8MP ISP to compatible

The i.MX8MP ISP is compatbile with the rkisp1 driver. Add it to the list
of compatible strings. While at it, expand on the description of the
clocks to make it clear which clock in the i.MX8MP ISP they map to,
based on the names from the datasheet.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Tested-by: Adam Ford <aford173@gmail.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
6 months agomedia: rkisp1: Support devices lacking dual crop
Paul Elder [Fri, 16 Feb 2024 09:54:50 +0000 (18:54 +0900)]
media: rkisp1: Support devices lacking dual crop

Some versions of the ISP supported by the rkisp1 driver, such as the ISP
in the i.MX8MP, lack the dual crop registers and don't support cropping
at the resizer input. They instead rely on cropping in the Image
Stabilization module, at the output of the ISP, to modify the resizer
input size and implement digital zoom.

Add a dual crop feature flag to distinguish the versions of the ISP that
support dual crop from those that don't, and make sure that the sink
crop is set to the sink format when dual crop is not supported.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Tested-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
6 months agomedia: rkisp1: Support devices lacking self path
Paul Elder [Fri, 16 Feb 2024 09:54:49 +0000 (18:54 +0900)]
media: rkisp1: Support devices lacking self path

Some versions of the ISP supported by the rkisp1 driver, such as the ISP
in the i.MX8MP, lack the self path. Support those ISP versions by adding
a self path feature flag, and massage the rest of the driver to support
the lack of a self path.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Tested-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
6 months agomedia: rkisp1: Support setting memory stride for main path
Paul Elder [Fri, 16 Feb 2024 09:54:48 +0000 (18:54 +0900)]
media: rkisp1: Support setting memory stride for main path

Some versions of the ISP supported by the rkisp1 driver, such as the ISP
in the i.MX8MP, implement configurable memory stride for the main path
the same way as already implemented by the driver for the self path.
Support this feature by adding a main stride feature flag and program
the corresponding registers accordingly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Tested-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
6 months agomedia: rkisp1: Add and use rkisp1_has_feature() macro
Laurent Pinchart [Fri, 16 Feb 2024 09:54:47 +0000 (18:54 +0900)]
media: rkisp1: Add and use rkisp1_has_feature() macro

Simplify feature tests with a macro that shortens lines.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Tested-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
7 months agomedia: visl: Add codec specific variability on output frames
Detlev Casanova [Wed, 17 Jan 2024 15:10:18 +0000 (10:10 -0500)]
media: visl: Add codec specific variability on output frames

When running tests with different input data, the stable output frames
could be too similar and hide possible issues.

This commit adds variation by using some codec specific parameters.

Only HEVC and H.264 support this.

Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com>
Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil: add media: prefix to Subject]

7 months agodoc: media: visl: Document tpg_verbose parameter
Detlev Casanova [Wed, 17 Jan 2024 15:10:17 +0000 (10:10 -0500)]
doc: media: visl: Document tpg_verbose parameter

Also document stable frames and what it means for testing tools.

Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil: add media: prefix to Subject]

7 months agomedia: visl: Add a tpg_verbose parameter
Detlev Casanova [Wed, 17 Jan 2024 15:10:16 +0000 (10:10 -0500)]
media: visl: Add a tpg_verbose parameter

The text written on the output frames stable for a given input.
Remove the unstable elements like pointers, buffer indexes or queues
status so that frames are always identical and can be compared against
a reference in automatic tests.

As the unstable information can be relevant when debugging the API, add
a tpg_verbose parameter to show them.

Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil: correct a few small checkpatch issues]

7 months agomedia: visl,vidtv: Set parameters permissions to 0444
Detlev Casanova [Wed, 17 Jan 2024 15:10:15 +0000 (10:10 -0500)]
media: visl,vidtv: Set parameters permissions to 0444

This avoids confusion with default values and lets userspace
programs get the modules parameters values at run time.

This can be useful when setting up a test suite.

Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com>
Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: v4l: marvell: select CONFIG_V4L2_ASYNC where needed
Arnd Bergmann [Tue, 13 Feb 2024 09:55:51 +0000 (10:55 +0100)]
media: v4l: marvell: select CONFIG_V4L2_ASYNC where needed

Drivers that call v4l2_async_nf_init() need to select the corresponding
Kconfig symbol:

ERROR: modpost: "v4l2_async_nf_init" [drivers/media/platform/marvell/cafe_ccic.ko] undefined!
ERROR: modpost: "__v4l2_async_nf_add_i2c" [drivers/media/platform/marvell/cafe_ccic.ko] undefined!
ERROR: modpost: "v4l2_async_nf_unregister" [drivers/media/platform/marvell/mcam-core.ko] undefined!
ERROR: modpost: "v4l2_async_nf_init" [drivers/media/platform/marvell/mmp_camera.ko] undefined!
ERROR: modpost: "__v4l2_async_nf_add_fwnode_remote" [drivers/media/platform/marvell/mmp_camera.ko] undefined!

I checked all v4l2 drivers to see if anything else has the same
bug, but these two appear to be the only ones.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: pvrusb2: fix pvr2_stream_callback casts
Arnd Bergmann [Tue, 13 Feb 2024 10:04:27 +0000 (11:04 +0100)]
media: pvrusb2: fix pvr2_stream_callback casts

clang-16 complains about a control flow integrity (KCFI) issue in pvrusb2,
which casts three different prototypes into pvr2_stream_callback:

drivers/media/usb/pvrusb2/pvrusb2-v4l2.c:1070:30: error: cast from 'void (*)(struct pvr2_v4l2_fh *)' to 'pvr2_stream_callback' (aka 'void (*)(void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
 1070 |         pvr2_stream_set_callback(sp,(pvr2_stream_callback)pvr2_v4l2_notify,fh);
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/usb/pvrusb2/pvrusb2-context.c:110:6: error: cast from 'void (*)(struct pvr2_context *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
  110 |                                         (void (*)(void *))pvr2_context_notify,
      |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/usb/pvrusb2/pvrusb2-dvb.c:152:6: error: cast from 'void (*)(struct pvr2_dvb_adapter *)' to 'pvr2_stream_callback' (aka 'void (*)(void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
  152 |                                  (pvr2_stream_callback) pvr2_dvb_notify, adap);
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Change the functions to actually take a void* argument so the cast is no longer
needed.

Fixes: bb8ce9d9143c ("V4L/DVB (7682): pvrusb2-dvb: finish up stream & buffer handling")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: sta2x11: fix irq handler cast
Arnd Bergmann [Tue, 13 Feb 2024 09:54:47 +0000 (10:54 +0100)]
media: sta2x11: fix irq handler cast

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]

7 months agomedia: videobuf2: Add missing doc comment for waiting_in_dqbuf
Andrzej Pietrasiewicz [Mon, 12 Feb 2024 19:12:03 +0000 (20:12 +0100)]
media: videobuf2: Add missing doc comment for waiting_in_dqbuf

While at it rearrange other comments to match the order of struct members.

Fixes: d65842f7126a ("media: vb2: add waiting_in_dqbuf flag")

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Acked-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: pvrusb2: remove redundant NULL check
Daniil Dulov [Sun, 11 Feb 2024 15:07:25 +0000 (07:07 -0800)]
media: pvrusb2: remove redundant NULL check

Pointer dip->stream cannot be NULL due to a shift, thus remove redundant
NULL check.

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

Fixes: c74e0062684b ("V4L/DVB (5059): Pvrusb2: Be smarter about mode restoration")
Signed-off-by: Daniil Dulov <d.dulov@aladdin.ru>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: go7007: add check of return value of go7007_read_addr()
Daniil Dulov [Sun, 11 Feb 2024 15:07:05 +0000 (07:07 -0800)]
media: go7007: add check of return value of go7007_read_addr()

If go7007_read_addr() returns error channel is not assigned a value.
In this case go to allocfail.

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

Fixes: 866b8695d67e ("Staging: add the go7007 video driver")
Signed-off-by: Daniil Dulov <d.dulov@aladdin.ru>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: bt8xx: make bttv_sub_bus_type const
Ricardo B. Marliere [Fri, 9 Feb 2024 23:27:48 +0000 (20:27 -0300)]
media: bt8xx: make bttv_sub_bus_type const

Now that the driver core can properly handle constant struct bus_type,
move the bttv_sub_bus_type variable to be a constant structure as well,
placing it into read-only memory which can not be modified at runtime.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agodocs: media: fix typo in docs
Vincenzo Mezzela [Thu, 8 Feb 2024 16:23:17 +0000 (17:23 +0100)]
docs: media: fix typo in docs

This patch resolves a spelling error in the documentation.

It is submitted as part of my application to the "Linux Kernel Bug
Fixing Spring Unpaid 2024" mentorship program of the Linux Kernel
Foundation.

Signed-off-by: Vincenzo Mezzela <vincenzo.mezzela@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: core: v4l2-ioctl.c: use is_valid_ioctl()
Hans Verkuil [Wed, 7 Feb 2024 09:03:30 +0000 (10:03 +0100)]
media: core: v4l2-ioctl.c: use is_valid_ioctl()

In most cases the is_valid_ioctl() macro is used to check if an ioctl is
valid, except in one place. Use it there as well as it makes the code
easier to read.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: ti: Use devm_platform_ioremap_resource() in ti_csi2rx_probe()
Markus Elfring [Tue, 6 Feb 2024 14:30:13 +0000 (15:30 +0100)]
media: ti: Use devm_platform_ioremap_resource() in ti_csi2rx_probe()

A wrapper function is available since the commit 7945f929f1a7
("drivers: provide devm_platform_ioremap_resource()").

* Thus reuse existing functionality instead of keeping duplicate source
  code.

* Delete a local variable which became unnecessary with this refactoring.

This issue was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Reviewed-by: Jai Luthra <j-luthra@ti.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: platform: cros-ec: Add Dita to the match table
Kells Ping [Tue, 6 Feb 2024 07:49:26 +0000 (15:49 +0800)]
media: platform: cros-ec: Add Dita to the match table

The Google Dita device uses the same approach as the Google Brask
which enables the HDMI CEC via the cros-ec-cec driver.

Signed-off-by: Kells Ping <kells.ping@quanta.corp-partner.google.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: i2c: st-vgxy61: remove redundant initialization of pointer mode
Colin Ian King [Mon, 5 Feb 2024 22:05:08 +0000 (22:05 +0000)]
media: i2c: st-vgxy61: remove redundant initialization of pointer mode

The pointer mode is being initialized with a value that is never
read, it is being re-assigned later on. The initialization is
redundant and can be removed.

Cleans up clang scan build warning:
drivers/media/i2c/st-vgxy61.c:632:33: warning: Value stored to 'mode'
during its initialization is never read [deadcode.DeadStores]

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Reviewed-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: tda18271: remove redundant assignment to variable bcal
Colin Ian King [Mon, 5 Feb 2024 21:49:25 +0000 (21:49 +0000)]
media: tda18271: remove redundant assignment to variable bcal

The variable bcal is being initialized with a value that is never
read, it is being re-assigned in both paths of an if statement near
the end of the function. The initialization is redundant and can
be removed.

Cleans up clang scan build warning:
drivers/media/tuners/tda18271-fe.c:473:2: warning: Value stored
to 'bcal' is never read [deadcode.DeadStores]

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: v4l2-ctrls-core.c: check min/max for menu, controls
Hans Verkuil [Mon, 5 Feb 2024 11:10:31 +0000 (12:10 +0100)]
media: v4l2-ctrls-core.c: check min/max for menu, controls

Menu controls that use the menu_skip_mask require that the min-max range is
inside 0-63.

Negative values obviously make no sense for menu controls, and the maximum
value is currently limited by the number of bits of the menu_skip_mask
value. However, if menu_skip_mask == 0, then larger menus are fine.

If we ever need to add support for larger menus that support the skip
mask, then more work is needed.

In the places where the menu_skip_mask is checked, use BIT_ULL to get the
bit to check and check if the bit number is < BITS_PER_LONG_LONG to avoid
shifting out of range. With the new check in check_range this should
never happen, but it is better to be safe and avoid static analyzer
warnings.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: amphion: Abort vpu parsing directly in seek
Ming Qian [Mon, 5 Feb 2024 08:17:58 +0000 (17:17 +0900)]
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>
7 months agomedia: imx-jpeg: Support for negotiating bytesperline with client
Ming Qian [Mon, 5 Feb 2024 07:25:56 +0000 (16:25 +0900)]
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>
7 months agomedia: imx: csc/scaler: fix v4l2_ctrl_handler memory leak
Lucas Stach [Wed, 31 Jan 2024 12:00:33 +0000 (13:00 +0100)]
media: imx: csc/scaler: fix v4l2_ctrl_handler memory leak

Free the memory allocated in v4l2_ctrl_handler_init on release.

Fixes: a8ef0488cc59 ("media: imx: add csc/scaler mem2mem device")
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agostaging: media: starfive: Set 16 bpp for capture_raw device
Changhuang Liang [Wed, 31 Jan 2024 09:24:32 +0000 (01:24 -0800)]
staging: media: starfive: Set 16 bpp for capture_raw device

For StarFive JH7110 Camera Subsystem, capture_raw video device output
raw10 pixelformat requires 16bit of alignment.

Fixes: e080f339c80a ("media: staging: media: starfive: camss: Add capture driver")
Signed-off-by: Changhuang Liang <changhuang.liang@starfivetech.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: rcar-csi2: Move driver to renesas directory
Niklas Söderlund [Thu, 25 Jan 2024 19:54:58 +0000 (20:54 +0100)]
media: rcar-csi2: Move driver to renesas directory

The rcar-csi2 driver was added before the platform/renesas directory
existed and since it was used together in a pipeline with the rcar-vin
driver it was located together with it.

The rcar-isp driver can also be used together with the rcar-csi2 driver
in a pipeline that is terminated by the rcar-vin driver. However by the
time rcar-isp was added the platform/renesas directory existed so it was
added there.

To remove the confusion that the rcar-csi2 driver have code dependencies
on the rcar-vin driver move it to the same directory level as the
rcar-isp driver. This makes it clear they are three distinct drivers
that can be used together in a pipeline, but do not depend on each
other.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: staging: imx: controls are from another device, mark this
Hans Verkuil [Wed, 17 Jan 2024 11:46:45 +0000 (12:46 +0100)]
media: staging: imx: controls are from another device, mark this

The last argument of v4l2_ctrl_add_handler() indicates whether the controls
you add are from a control handler owned by another driver (true) or from
the same driver (false). In this case the last argument was incorrectly set
to false. The control handlers are from different devices.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: dvb-frontends: Clean up errors in tda8083.h
XueBing Chen [Thu, 11 Jan 2024 11:08:46 +0000 (11:08 +0000)]
media: dvb-frontends: Clean up errors in tda8083.h

Fix the following errors reported by checkpatch:

ERROR: "foo* bar" should be "foo *bar"

Signed-off-by: XueBing Chen <chenxb_99091@126.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: Clean up errors in bcm3510_priv.h
XueBing Chen [Thu, 11 Jan 2024 11:07:03 +0000 (11:07 +0000)]
media: Clean up errors in bcm3510_priv.h

Fix the following errors reported by checkpatch:

ERROR: space prohibited before that ',' (ctx:WxW)

Signed-off-by: XueBing Chen <chenxb_99091@126.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: stv6110x: Clean up errors in stv6110x.h
XueBing Chen [Thu, 11 Jan 2024 11:03:15 +0000 (11:03 +0000)]
media: stv6110x: Clean up errors in stv6110x.h

Fix the following errors reported by checkpatch:

ERROR: space prohibited before that ',' (ctx:WxW)

Signed-off-by: XueBing Chen <chenxb_99091@126.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: dvb-frontends: Clean up errors in cx24110.h
XueBing Chen [Thu, 11 Jan 2024 11:01:32 +0000 (11:01 +0000)]
media: dvb-frontends: Clean up errors in cx24110.h

Fix the following errors reported by checkpatch:

ERROR: "foo* bar" should be "foo *bar"

Signed-off-by: XueBing Chen <chenxb_99091@126.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: zl10036: Fix my email address
Matthias Schwarzott [Mon, 8 Jan 2024 16:57:14 +0000 (17:57 +0100)]
media: zl10036: Fix my email address

It has been wrong from the beginning.

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Reported-by: Ulrich Mueller <ulm@gentoo.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: pvrusb2: Use wait_event_freezable() for freezable kthread
Kevin Hao [Thu, 21 Dec 2023 02:22:28 +0000 (10:22 +0800)]
media: pvrusb2: Use wait_event_freezable() for freezable kthread

A freezable kernel thread can enter frozen state during freezing by
either calling try_to_freeze() or using wait_event_freezable() and its
variants. So for the following snippet of code in a kernel thread loop:
  try_to_freeze();
  wait_event_interruptible();

We can change it to a simple wait_event_freezable() and then eliminate
a function call.

Signed-off-by: Kevin Hao <haokexin@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: msp3400: Use wait_event_freezable_timeout() in msp_sleep()
Kevin Hao [Thu, 21 Dec 2023 02:22:27 +0000 (10:22 +0800)]
media: msp3400: Use wait_event_freezable_timeout() in msp_sleep()

The msp_sleep() is nearly open-coded wait_event_interruptible_timeout(),
and a freezable kernel thread can enter frozen state during freezing by
either calling try_to_freeze() or using wait_event_freezable() and its
variants. So we can reimplement msp_sleep() to simply invoke
a wait_event_freezable_timeout() and then eliminate a call to
try_to_freeze().

Signed-off-by: Kevin Hao <haokexin@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: dvb_frontend: Use wait_event_freezable_timeout() for freezable kthread
Kevin Hao [Thu, 21 Dec 2023 02:22:26 +0000 (10:22 +0800)]
media: dvb_frontend: Use wait_event_freezable_timeout() for freezable kthread

A freezable kernel thread can enter frozen state during freezing by
either calling try_to_freeze() or using wait_event_freezable() and its
variants. So for the following snippet of code in a kernel thread loop:
  wait_event_interruptible_timeout();
  try_to_freeze();

We can change it to a simple wait_event_freezable_timeout() and
then eliminate a function call.

Signed-off-by: Kevin Hao <haokexin@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: sun8i-di: Fix chroma difference threshold
Jernej Skrabec [Sat, 16 Dec 2023 13:34:22 +0000 (14:34 +0100)]
media: sun8i-di: Fix chroma difference threshold

While there is no good explanation what this value does, vendor driver
uses value 31 for it. Align driver with it.

Fixes: a4260ea49547 ("media: sun4i: Add H3 deinterlace driver")
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: sun8i-di: Fix power on/off sequences
Jernej Skrabec [Sat, 16 Dec 2023 13:34:21 +0000 (14:34 +0100)]
media: sun8i-di: Fix power on/off sequences

According to user manual, reset line should be deasserted before clocks
are enabled. Also fix power down sequence to be reverse of that.

Fixes: a4260ea49547 ("media: sun4i: Add H3 deinterlace driver")
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: sun8i-di: Fix coefficient writes
Jernej Skrabec [Sat, 16 Dec 2023 13:34:20 +0000 (14:34 +0100)]
media: sun8i-di: Fix coefficient writes

Currently coefficients are applied only once, since they don't change.
However, this is done before enable bit is set and thus it doesn't get
applied properly.

Fix that by applying coefficients after enable bit is set. While this
means that it will be done evey time, it doesn't bring much time
penalty.

Fixes: a4260ea49547 ("media: sun4i: Add H3 deinterlace driver")
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: cedrus: h265: Fix configuring bitstream size
Jernej Skrabec [Sat, 16 Dec 2023 13:09:25 +0000 (14:09 +0100)]
media: cedrus: h265: Fix configuring bitstream size

bit_size field holds size of slice, not slice + header. Because of HW
quirks, driver can't program in just slice, but also preceding header.
But that means that currently used bit_size is wrong (too small).
Instead, just use size of whole buffer. There is no harm in doing this.

Fixes: 86caab29da78 ("media: cedrus: Add HEVC/H.265 decoding support")
Suggested-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: mediatek: vcodec: Remove unneeded semicolon
Yang Li [Mon, 27 Nov 2023 00:58:33 +0000 (08:58 +0800)]
media: mediatek: vcodec: Remove unneeded semicolon

./drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c:569:2-3: Unneeded semicolon
./drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c:583:2-3: Unneeded semicolon
./drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c:599:2-3: Unneeded semicolon
./drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c:613:2-3: Unneeded semicolon
./drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c:633:2-3: Unneeded semicolon
./drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c:647:2-3: Unneeded semicolon
./drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c:683:2-3: Unneeded semicolon

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=7632
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: platform: rzg2l-cru: rzg2l-video: Fix start reception procedure
Biju Das [Tue, 13 Feb 2024 18:12:33 +0000 (18:12 +0000)]
media: platform: rzg2l-cru: rzg2l-video: Fix start reception procedure

As per section 35.3.1 Starting Reception for the MIPI CSI-2 Input on the
latest hardware manual (R01UH0914EJ0145 Rev.1.45) we need to supply all
the clocks and then release the CRU resets. Currently we are releasing
the resets and then supplying the clocks. So, fix the start reception
procedure.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20240213181233.242316-6-biju.das.jz@bp.renesas.com
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: platform: rzg2l-cru: rzg2l-csi2: Restructure vclk handling
Biju Das [Tue, 13 Feb 2024 18:12:32 +0000 (18:12 +0000)]
media: platform: rzg2l-cru: rzg2l-csi2: Restructure vclk handling

As per section 35.3.1 Starting Reception for the MIPI CSI-2 Input on the
latest hardware manual (R01UH0914EJ0145 Rev.1.45) we need to disable the
vclk before enabling the LINK reception and enable the vclk after enabling
the link Reception. So restructure vclk handling as per the HW manual.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20240213181233.242316-5-biju.das.jz@bp.renesas.com
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: platform: rzg2l-cru: rzg2l-video: Fix image processing initialization
Biju Das [Tue, 13 Feb 2024 18:12:31 +0000 (18:12 +0000)]
media: platform: rzg2l-cru: rzg2l-video: Fix image processing initialization

As per section 35.3.1 Starting Reception for the MIPI CSI-2 Input on the
latest hardware manual (R01UH0914EJ0140 Rev.1.40) it is mentioned that
initialize the AXI master first and then initialize the image processing.
Fix the start procedure as per the hardware manual.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Link: https://lore.kernel.org/r/20240213181233.242316-4-biju.das.jz@bp.renesas.com
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: platform: rzg2l-cru: rzg2l-ip: Add delay after D-PHY reset
Biju Das [Tue, 13 Feb 2024 18:12:30 +0000 (18:12 +0000)]
media: platform: rzg2l-cru: rzg2l-ip: Add delay after D-PHY reset

As per section 35.3.1 Starting Reception for the MIPI CSI-2 Input on the
latest hardware manual (R01UH0914EJ0140 Rev.1.40) it is mentioned that
after DPHY reset, we need to wait for 1 msec or more before start
receiving data from the sensor. So add a delay after pre_streamon().

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Link: https://lore.kernel.org/r/20240213181233.242316-3-biju.das.jz@bp.renesas.com
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: platform: rzg2l-cru: rzg2l-csi2: Switch to RUNTIME_PM_OPS()
Biju Das [Tue, 13 Feb 2024 18:12:29 +0000 (18:12 +0000)]
media: platform: rzg2l-cru: rzg2l-csi2: Switch to RUNTIME_PM_OPS()

Replace the old SET_RUNTIME_PM_OPS() helpers with its modern alternative
RUNTIME_PM_OPS(). The usage of pm_ptr and RUNTIME_PM_OPS() allows the
compiler to see where it's used but still drop the dead code. After this
we can get rid of the unnecessary '__maybe_unused' annotations on PM
functions.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Link: https://lore.kernel.org/r/20240213181233.242316-2-biju.das.jz@bp.renesas.com
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: edia: dvbdev: fix a use-after-free
Zhipeng Lu [Sat, 3 Feb 2024 13:40:43 +0000 (14:40 +0100)]
media: edia: dvbdev: fix a use-after-free

In dvb_register_device, *pdvbdev is set equal to dvbdev, which is freed
in several error-handling paths. However, *pdvbdev is not set to NULL
after dvbdev's deallocation, causing use-after-frees in many places,
for example, in the following call chain:

budget_register
  |-> dvb_dmxdev_init
        |-> dvb_register_device
  |-> dvb_dmxdev_release
        |-> dvb_unregister_device
              |-> dvb_remove_device
                    |-> dvb_device_put
                          |-> kref_put

When calling dvb_unregister_device, dmxdev->dvbdev (i.e. *pdvbdev in
dvb_register_device) could point to memory that had been freed in
dvb_register_device. Thereafter, this pointer is transferred to
kref_put and triggering a use-after-free.

Link: https://lore.kernel.org/linux-media/20240203134046.3120099-1-alexious@zju.edu.cn
Fixes: b61901024776 ("V4L/DVB (5244): Dvbdev: fix illegal re-usage of fileoperations struct")
Signed-off-by: Zhipeng Lu <alexious@zju.edu.cn>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: docs: uAPI: dvb/decoder: completing the documentation
Stefan Herdler [Sun, 28 Jan 2024 23:32:44 +0000 (00:32 +0100)]
media: docs: uAPI: dvb/decoder: completing the documentation

The existing documentation of the legacy DVB Decoder API was incomplete.

Revising the documentation, adding missing parts and arranging the
documentation files new.

This patch contains the new index file and links to it.

Link: https://lore.kernel.org/linux-media/20240128233249.32794-2-herdler@nurfuerspam.de
Signed-off-by: Stefan Herdler <herdler@nurfuerspam.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: docs: uAPI: dvb/video: completing the documentation (function calls)
Stefan Herdler [Sun, 28 Jan 2024 23:32:49 +0000 (00:32 +0100)]
media: docs: uAPI: dvb/video: completing the documentation (function calls)

The existing documentation of the legacy DVB Decoder API was incomplete.

Revising the documentation, adding missing parts and arranging the
documentation files new.

This patch contains the documentation of the function calls defined in
video.h.

Link: https://lore.kernel.org/linux-media/20240128233249.32794-7-herdler@nurfuerspam.de
Signed-off-by: Stefan Herdler <herdler@nurfuerspam.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: docs: uAPI: dvb/video: completing the documentation (data types)
Stefan Herdler [Sun, 28 Jan 2024 23:32:48 +0000 (00:32 +0100)]
media: docs: uAPI: dvb/video: completing the documentation (data types)

The existing documentation of the legacy DVB Decoder API was incomplete.

Revising the documentation, adding missing parts and arranging the
documentation files new.

This patch contains the documentation of the data types defined in
video.h.

Link: https://lore.kernel.org/linux-media/20240128233249.32794-6-herdler@nurfuerspam.de
Signed-off-by: Stefan Herdler <herdler@nurfuerspam.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: docs: uAPI: dvb/audio: completing the documentation (function calls)
Stefan Herdler [Sun, 28 Jan 2024 23:32:47 +0000 (00:32 +0100)]
media: docs: uAPI: dvb/audio: completing the documentation (function calls)

The existing documentation of the legacy DVB Decoder API was incomplete.

Revising the documentation, adding missing parts and arranging the
documentation files new.

This patch contains the documentation of the function calls defined in
audio.h.

Link: https://lore.kernel.org/linux-media/20240128233249.32794-5-herdler@nurfuerspam.de
Signed-off-by: Stefan Herdler <herdler@nurfuerspam.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: docs: uAPI: dvb/audio: completing the documentation (data types)
Stefan Herdler [Sun, 28 Jan 2024 23:32:46 +0000 (00:32 +0100)]
media: docs: uAPI: dvb/audio: completing the documentation (data types)

The existing documentation of the legacy DVB Decoder API was incomplete.

Revising the documentation, adding missing parts and arranging the
documentation files new.

This patch contains the documentation of the data types defined in
audio.h.

Link: https://lore.kernel.org/linux-media/20240128233249.32794-4-herdler@nurfuerspam.de
Signed-off-by: Stefan Herdler <herdler@nurfuerspam.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: docs: uAPI: dvb/osd: completing the documentation
Stefan Herdler [Sun, 28 Jan 2024 23:32:45 +0000 (00:32 +0100)]
media: docs: uAPI: dvb/osd: completing the documentation

The existing documentation of the legacy DVB Decoder API was incomplete.

Revising the documentation, adding missing parts and arranging the
documentation files new.

This patch contains the documentation of osd.h.

Link: https://lore.kernel.org/linux-media/20240128233249.32794-3-herdler@nurfuerspam.de
Signed-off-by: Stefan Herdler <herdler@nurfuerspam.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: dvb: remove redundant assignment to variable ret
Colin Ian King [Tue, 16 Jan 2024 11:50:02 +0000 (12:50 +0100)]
media: dvb: remove redundant assignment to variable ret

The variable ret is being assigned a value but it isn't being
read afterwards. The assignment is redundant and so ret can be
removed. Also add spaces after , to clean up checkpatch warnings.

Cleans up clang scan build warning:
warning: Although the value stored to 'ret' is used in the
enclosing expression, the value is never actually read from
'ret' [deadcode.DeadStores]

Link: https://lore.kernel.org/linux-media/20240116115002.2265367-1-colin.i.king@gmail.com
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: dvb-frontends/dvb-pll: Remove usage of the deprecated ida_simple_xx() API
Christophe JAILLET [Thu, 11 Jan 2024 21:33:44 +0000 (22:33 +0100)]
media: dvb-frontends/dvb-pll: Remove usage of the deprecated ida_simple_xx() API

ida_alloc() and ida_free() should be preferred to the deprecated
ida_simple_get() and ida_simple_remove().

Note that the upper limit of ida_simple_get() is exclusive, but the one of
ida_alloc_max() is inclusive. So a -1 has been added when needed.

Link: https://lore.kernel.org/linux-media/920639b9e05775eea56ecb9cd5ed38ad292a96a8.1705008803.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: cx24110: clean up some coding style issues
XueBing Chen [Thu, 11 Jan 2024 10:58:56 +0000 (11:58 +0100)]
media: cx24110: clean up some coding style issues

Fix the following errors reported by checkpatch:

ERROR: "foo* bar" should be "foo *bar"
ERROR: spaces required around that '=' (ctx:VxV)
ERROR: space required after that ',' (ctx:VxV)

Link: https://lore.kernel.org/linux-media/20240111105856.14655-1-chenxb_99091@126.com
Signed-off-by: XueBing Chen <chenxb_99091@126.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: drivers/media/dvb-core: copy user arrays safely
Philipp Stanner [Thu, 2 Nov 2023 19:16:34 +0000 (20:16 +0100)]
media: drivers/media/dvb-core: copy user arrays safely

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

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

Link: https://lore.kernel.org/linux-media/20231102191633.52592-2-pstanner@redhat.com
Suggested-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Philipp Stanner <pstanner@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: ov08x40: Reduce start streaming time
Jason Chen [Wed, 24 Jan 2024 14:43:01 +0000 (15:43 +0100)]
media: ov08x40: Reduce start streaming time

Because video duration involves calculating the streaming time, and i2c
communication incurs too many XTALK register settings every 4 bytes with
i2c START and STOP.

So we have opted switch to the i2c burst method.
This method involves writing the XTALK registers in the order of
the register block.

The start streaming time can be reduced from around 400ms to 150ms

[Sakari Ailus: Drop unneeded dev_dbg().]

Signed-off-by: Jason Chen <jason.z.chen@intel.com>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agoRevert "media: ov08x40: Reduce start streaming time"
Sakari Ailus [Sun, 4 Feb 2024 21:50:12 +0000 (23:50 +0200)]
Revert "media: ov08x40: Reduce start streaming time"

This reverts commit feb8831be9d468ee961289c6a275536a1ee0011c.

Commit feb8831be9d468ee961289c6a275536a1ee0011c contained unintentional
changes to Documentation/devicetree/bindings/media/video-interfaces.yaml
and arch/arm/boot/dts/ti/omap/omap3-n9.dts. Revert the entire patch.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: nxp: imx8-isi: Factor out a variable
Ricardo Ribalda [Sun, 28 Jan 2024 16:13:56 +0000 (16:13 +0000)]
media: nxp: imx8-isi: Factor out a variable

gcc-11 seems to believe that the coeffs variable can be used
uninitialized. Refactor the code and remove the cscen variable to
convince gcc that we are doing a good job.

drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c:218:20: warning: 'coeffs' may be used uninitialized in this function [-Wmaybe-uninitialized]

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://lore.kernel.org/r/20240128-gcc-11-warnings-v1-1-52bbdf492049@chromium.org
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: nxp: imx8-isi: Mark all crossbar sink pads as MUST_CONNECT
Laurent Pinchart [Mon, 15 Jan 2024 02:16:29 +0000 (04:16 +0200)]
media: nxp: imx8-isi: Mark all crossbar sink pads as MUST_CONNECT

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>