]> git.ipfire.org Git - thirdparty/kernel/linux.git/log
thirdparty/kernel/linux.git
4 months agomedia: cx231xx: Remove vidioc_s_ctrl callback
Ricardo Ribalda [Sun, 23 Feb 2025 18:58:12 +0000 (18:58 +0000)] 
media: cx231xx: Remove vidioc_s_ctrl callback

The driver has been converted to the control framework in the past:
commit 88b6ffedd901 ("[media] cx231xx-417: convert to the control
framework").

This function is never called, the core will only use the control
framework instead.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Tested-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 months agomedia: v4l2: Remove vidioc_g_ctrl callback
Ricardo Ribalda [Sun, 23 Feb 2025 18:58:11 +0000 (18:58 +0000)] 
media: v4l2: Remove vidioc_g_ctrl callback

All the drivers either use the control framework or provide a
vidioc_g_ext_ctrls callback. We can remove this callback.

Thanks for your service!

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 months agomedia: v4l2: Remove vidioc_queryctrl callback
Ricardo Ribalda [Sun, 23 Feb 2025 18:58:10 +0000 (18:58 +0000)] 
media: v4l2: Remove vidioc_queryctrl callback

All the drivers either use the control framework or provide a
vidioc_query_ext_ctrl. We can remove this callback to reduce the
temptation of new drivers to implement it.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 months agomedia: atomisp: Remove vidioc_g/s callback
Ricardo Ribalda [Sun, 23 Feb 2025 18:58:09 +0000 (18:58 +0000)] 
media: atomisp: Remove vidioc_g/s callback

The v4l2 ioctl framework can implement vidioc_g/s_ctrl with
vidioc_g/s_ext_ctrl() and we provide those.

These are the last references of vidioc_s/g_ctrl in the codebase. We can
attempt to remove them now.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 months agomedia: atomisp: Replace queryctrl with query_ext_ctrl
Ricardo Ribalda [Sun, 23 Feb 2025 18:58:08 +0000 (18:58 +0000)] 
media: atomisp: Replace queryctrl with query_ext_ctrl

The ioctl framework provides an emulator of queryctrl using
query_ext_ctrl.
Replace our implementation of queryctrl to support both.

Now that we are at it:
- Add comment about missing functionality.
- Remove superfluous clear of reserved[0].
- Remove ret var.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 months agomedia: uvcvideo: Remove vidioc_queryctrl
Ricardo Ribalda [Sun, 23 Feb 2025 18:58:07 +0000 (18:58 +0000)] 
media: uvcvideo: Remove vidioc_queryctrl

It can be implemented by the v4l2 ioctl framework using
vidioc_query_ext_ctrl.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
[hverkuil: rebased]
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 months agomedia: pvrusb2: Remove g/s_ctrl callbacks
Ricardo Ribalda [Sun, 23 Feb 2025 18:58:06 +0000 (18:58 +0000)] 
media: pvrusb2: Remove g/s_ctrl callbacks

The ioctl helpers can emulate g/s_ctrl with g/s_ext_ctrl. Simplify the
code.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 months agomedia: pvrusb2: Convert queryctrl to query_ext_ctrl
Ricardo Ribalda [Sun, 23 Feb 2025 18:58:05 +0000 (18:58 +0000)] 
media: pvrusb2: Convert queryctrl to query_ext_ctrl

The driver was missing support for query_ext_ctrl. Instead of adding a
new callback for it, replace the current implementation of queryctrl and
let the ioctl framework emulate the old function.

Most of the fields are identical, so the change is pretty simple.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 months agomedia: ioctl: Simulate v4l2_queryctrl with v4l2_query_ext_ctrl
Ricardo Ribalda [Sun, 23 Feb 2025 18:58:04 +0000 (18:58 +0000)] 
media: ioctl: Simulate v4l2_queryctrl with v4l2_query_ext_ctrl

v4l2_queryctrl is a subset of v4l2_query_ext_ctrl. If the driver does
not implement v4l2_queryctrl we can implement it with
v4l2_query_ext_ctrl.

Suggested-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 months agomedia: cx231xx: set device_caps for 417
Hans Verkuil [Mon, 24 Feb 2025 13:13:24 +0000 (14:13 +0100)] 
media: cx231xx: set device_caps for 417

The video_device for the MPEG encoder did not set device_caps.

Add this, otherwise the video device can't be registered (you get a
WARN_ON instead).

Not seen before since currently 417 support is disabled, but I found
this while experimenting with it.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 months agomedia: cec: core: allow raw msg transmit while configuring
Hans Verkuil [Mon, 17 Feb 2025 14:53:38 +0000 (15:53 +0100)] 
media: cec: core: allow raw msg transmit while configuring

While the CEC adapter is configuring, it is not possible to transmit a
CEC message with the CEC_MSG_FL_RAW flag set as this is blocked at the
ioctl level. Check if this flag is set, and if so, allow the message to
be transmitted. This is useful for debugging if the display has no
physical address (typically because the HPD is pulled low while in
Standby).

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 months agomedia: cx23885: Add analog support for AVerMedia H789-C PCIe card
Plamen Atanasov [Sun, 2 Jun 2024 15:17:13 +0000 (18:17 +0300)] 
media: cx23885: Add analog support for AVerMedia H789-C PCIe card

This card has the following ICs: Hybrid tuner TDA18271, CX23888 PCIe
bridge/demodulator/decoder (and DVB-T demodulator AF9013S, which is
not within the scope of this patch). It has the following inputs: Tuner,
S-Video, Composite (shared with the luma input of S-Video) and Audio L/R
RCA. VID:PID is 1461:e139. When the patch is applied and the cx23885
kernel module is built and loaded, the following dmesg can be seen:

[  749.677298] cx23885: cx23885 driver version 0.0.4 loaded
[  749.677554] cx23885: CORE cx23885[0]: subsystem: 1461:e139, board: AVerMedia H789-C [card=63,autodetected]
[  749.831841] cx25840 8-0044: cx23888 A/V decoder found @ 0x88 (cx23885[0])
[  750.451676] cx25840 8-0044: loaded v4l-cx23885-avcore-01.fw firmware (16382 bytes)
[  750.488064] tuner: 7-0063: Tuner -1 found with type(s) Radio TV.
[  750.488115] tda18271 7-0063: creating new instance
[  750.490153] tda18271: TDA18271HD/C2 detected @ 7-0063
[  750.805043] cx23885: cx23885[0]: registered device video2 [v4l2]
[  750.805151] cx23885: cx23885[0]: registered device vbi2
[  750.808682] cx23885: cx23885[0]: alsa: registered ALSA audio device
[  750.808693] cx23885: cx23885_dev_checkrevision() Hardware revision = 0xd0
[  750.808700] cx23885: cx23885[0]/0: found at 0000:02:00.0, rev: 4, irq: 18, latency: 0, mmio: 0xddc00000

The card has to be defined in cx23885-cards.c (firmware also has to be
loaded) and cx23885.h. Moreover, audio routing is configured in
cx23885-video.c. Analog tuning, composite, s-video and stereo audio
inputs have been successfully tested with PAL B/G.

Signed-off-by: Plamen Atanasov <tigerment@mail.bg>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: rc: reduce useless padding in struct rc_dev etc
Sean Young [Mon, 1 Jul 2024 09:11:49 +0000 (10:11 +0100)] 
media: rc: reduce useless padding in struct rc_dev etc

Reorder the fields in these structs so that we waste less space due to
padding. pahole shows that lirc_fh is 8 bytes smaller, and rc_dev is 32
bytes smaller.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: rcar-csi2: Convert to .{enable|disable}_streams
Tomi Valkeinen [Mon, 20 Jan 2025 13:10:43 +0000 (15:10 +0200)] 
media: rcar-csi2: Convert to .{enable|disable}_streams

Drop the legacy .s_stream and convert to .{enable|disable}_streams.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: rcar-isp: Convert to .{enable|disable}_streams
Tomi Valkeinen [Mon, 20 Jan 2025 13:10:42 +0000 (15:10 +0200)] 
media: rcar-isp: Convert to .{enable|disable}_streams

Drop the legacy .s_stream and convert to .{enable|disable}_streams.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: rcar-isp: Convert to subdev state
Tomi Valkeinen [Mon, 20 Jan 2025 13:10:41 +0000 (15:10 +0200)] 
media: rcar-isp: Convert to subdev state

Convert to subdev state. This allows us to drop the internal mutex and
risp_get_pad_format(), and add streams support in the future.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: rcar-csi2: Use v4l2_subdev_{enable|disable}_streams()
Tomi Valkeinen [Mon, 20 Jan 2025 13:10:40 +0000 (15:10 +0200)] 
media: rcar-csi2: Use v4l2_subdev_{enable|disable}_streams()

Use v4l2_subdev_{enable|disable}_streams() instead of calling s_stream
op directly. This allows the called subdev to drop the legacy s_stream
op.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: rcar-isp: Use v4l2_subdev_{enable|disable}_streams()
Tomi Valkeinen [Mon, 20 Jan 2025 13:10:39 +0000 (15:10 +0200)] 
media: rcar-isp: Use v4l2_subdev_{enable|disable}_streams()

Use v4l2_subdev_{enable|disable}_streams() instead of calling s_stream
op directly. This allows the called subdev to drop the legacy s_stream
op.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: rcar-vin: Use v4l2_subdev_{enable|disable}_streams()
Tomi Valkeinen [Mon, 20 Jan 2025 13:10:38 +0000 (15:10 +0200)] 
media: rcar-vin: Use v4l2_subdev_{enable|disable}_streams()

Use v4l2_subdev_{enable|disable}_streams() instead of calling s_stream
op directly. This allows the called subdev to drop the legacy s_stream
op.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: rcar-csi2: Use v4l2_get_link_freq()
Tomi Valkeinen [Mon, 20 Jan 2025 13:10:37 +0000 (15:10 +0200)] 
media: rcar-csi2: Use v4l2_get_link_freq()

Instead of directly using V4L2_CID_PIXEL_RATE and calculating the mbps
from that, use v4l2_get_link_freq(), which also supports
V4L2_CID_LINK_FREQ.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: rcar-isp: Add RAW8, RAW10 and RAW12 formats
Tomi Valkeinen [Mon, 20 Jan 2025 13:10:36 +0000 (15:10 +0200)] 
media: rcar-isp: Add RAW8, RAW10 and RAW12 formats

Add RAW8, RAW10 and RAW12 formats.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: rcar-csi2: Add RAW10 and RAW12 formats
Tomi Valkeinen [Mon, 20 Jan 2025 13:10:35 +0000 (15:10 +0200)] 
media: rcar-csi2: Add RAW10 and RAW12 formats

Add RAW10 and RAW12 formats. We only need to add the entries to the
rcar_csi2_format list.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: rcar-csi2: Move Y8 entry to a better place
Tomi Valkeinen [Mon, 20 Jan 2025 13:10:34 +0000 (15:10 +0200)] 
media: rcar-csi2: Move Y8 entry to a better place

Move the Y8 entry before Y10, so that the entries are in a bit more
logical order.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: ov08x40: Log chip ID when identifying the chip
Hans de Goede [Sat, 1 Mar 2025 11:48:30 +0000 (12:48 +0100)] 
media: ov08x40: Log chip ID when identifying the chip

Debug log the chip ID after successfully identifying the chip, this is
useful to see if the identification is done on probe() time or if it is
delayed till the first stream on.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: ov08x40: Fix value of reset GPIO when requesting it
Hans de Goede [Sat, 1 Mar 2025 11:48:29 +0000 (12:48 +0100)] 
media: ov08x40: Fix value of reset GPIO when requesting it

We should put/leave the sensor in reset when requesting the GPIO, after
requesting it there are 2 possible scenarios and having the GPIO driven
low is no good in either scenario:

1. The sensor was in ACPI D0 before probe() runs, in this case
   ov08x40_power_on() + ov08x40_identify_module() will run immediately
   after requesting the GPIO and ov08x40_power_on() starts with driving
   the GPIO high. So if the GPIO was already high it will very shortly
   be driven low, more of a spike to low then actually properly be driven
   low. Which may leave the sensor in a confused state.

   If we request the GPIO to be high at request time then power_on() will
   driver it high again (no-op) and then sleep for 1-2 ms, so no spike.

2. The sensor was in ACPI D3 / off before probe(), in this case probe()
   leaves the sensor alone. But when the sensor is off its reset line
   should be driven high not low.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: imx335: Set vblank immediately
Paul Elder [Fri, 28 Feb 2025 09:17:31 +0000 (18:17 +0900)] 
media: imx335: Set vblank immediately

When the vblank v4l2 control is set, it does not get written to the
hardware unless exposure is also changed. Change the behavior such that
the vblank is written immediately when the control is set, as setting
the vblank without changing the exposure is a valid use case (such as
for changing the frame rate).

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: ipu6: Drop unused ipu6_dma_get_sgtable()
Sakari Ailus [Tue, 25 Feb 2025 08:54:14 +0000 (10:54 +0200)] 
media: ipu6: Drop unused ipu6_dma_get_sgtable()

ipu6_dma_get_sgtable() is now unused. Drop it.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Reviewed-by: Bingbu Cao <bingbu.cao@intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: i2c: ov9282: add AEC Manual register definition
Richard Leitner [Tue, 25 Feb 2025 13:08:41 +0000 (14:08 +0100)] 
media: i2c: ov9282: add AEC Manual register definition

Add #define's for the "AEC MANUAL" (0x3503) register and its
values/flags. Use those in the registers single usage within the
`common_regs` struct.

All values are based on the OV9281 datasheet v1.01 (09.18.2015).

Signed-off-by: Richard Leitner <richard.leitner@linux.dev>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: i2c: ov9282: use register definitions
Richard Leitner [Tue, 25 Feb 2025 13:08:40 +0000 (14:08 +0100)] 
media: i2c: ov9282: use register definitions

For better readability use already available register definitions in
hard-coded common and mode register structs.

Signed-off-by: Richard Leitner <richard.leitner@linux.dev>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: vgxy61: Replace nested min() with single min3()
Qasim Ijaz [Tue, 25 Feb 2025 12:59:37 +0000 (12:59 +0000)] 
media: vgxy61: Replace nested min() with single min3()

Use min3() macro instead of nesting min() to simplify the return
statement.

Signed-off-by: Qasim Ijaz <qasdev00@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: i2c: imx219: Only use higher LLP_MIN for binned resolutions
Jai Luthra [Fri, 21 Feb 2025 10:52:15 +0000 (16:22 +0530)] 
media: i2c: imx219: Only use higher LLP_MIN for binned resolutions

The LLP_MIN of 3560 is only needed to fix artefacts seen with binned
resolutions. As increasing the LLP reduces the highest possible
framerate by ~3%, use the old default minimum of 3448 if we are not
doing 2x2 analog binning.

Also restore the fll_def value for non-binned modes in the modes
definition to restore the default mode framerate to 30fps.

Suggested-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Link: https://lore.kernel.org/linux-media/CAPY8ntC1-S6zKtDvmc6EgyxP+j6rTShuG8Dr8PKb9XQr2PeS_w@mail.gmail.com/
Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: i2c: imx219: Use subdev state to calculate binning and pixelrate
Jai Luthra [Fri, 21 Feb 2025 10:52:14 +0000 (16:22 +0530)] 
media: i2c: imx219: Use subdev state to calculate binning and pixelrate

The pixel rate and binning calculations need the format and resolution
of the sensor, so pass the v4l2 subdev state directly instead of always
operating on the active state.

Suggested-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Link: https://lore.kernel.org/linux-media/sejl7xskif6rlpdsg3jhczjwe5gi6rs53ehbyka6omv2zeg7qq@4iis7i2lla5p/
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: i2c: imx219: Simplify binning mode
Jai Luthra [Fri, 21 Feb 2025 10:52:13 +0000 (16:22 +0530)] 
media: i2c: imx219: Simplify binning mode

The imx219_get_binning() function currently returns two separate pieces
of information, the return value is the binning mode enum, and the bin_h
and bin_v references are updated with whether to perform binning in
horizontal and vertical dimensions.

It is simpler to combine both of these pieces of information, and
directly update the bin_h and bin_v references with the register value
that we will write to the sensor, which includes if the binning is
digital or analog mode, thus allowing us to remove the superfluous
binning mode enum.

This is only a style change for the driver, with no functionality
updated.

Suggested-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Link: https://lore.kernel.org/linux-media/ubuuob7mb3o5bxoumrxv4rufutgk3lvdmdery6d3bfc6rytfti@tcchhlechzzp/
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: i2c: imx283: Drop runtime suspend/resume functions
Tarang Raval [Mon, 24 Feb 2025 11:05:54 +0000 (16:35 +0530)] 
media: i2c: imx283: Drop runtime suspend/resume functions

The imx283_runtime_suspend and imx283_runtime_resume functions
simply call imx283_power_off and imx283_power_on, respectively.
Since these functions do not add any additional logic, they are
unnecessary and can be removed.

Signed-off-by: Tarang Raval <tarang.raval@siliconsignals.io>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: i2c: imx219: remove context around case
Cosmin Tanislav [Thu, 20 Feb 2025 14:06:35 +0000 (16:06 +0200)] 
media: i2c: imx219: remove context around case

There are no longer variable declarations here, the context is useless.

Signed-off-by: Cosmin Tanislav <demonsingur@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: i2c: imx214: Fix uninitialized variable in imx214_set_ctrl()
Dan Carpenter [Tue, 18 Feb 2025 13:05:50 +0000 (16:05 +0300)] 
media: i2c: imx214: Fix uninitialized variable in imx214_set_ctrl()

You can't pass uninitialized "ret" variables to cci_write().  It has to
start as zero.

Fixes: 4f0aeba4f155 ("media: i2c: imx214: Convert to CCI register access helpers")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: André Apitzsch <git@apitzsch.eu>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: omap3isp: Use syscon_regmap_lookup_by_phandle_args
Krzysztof Kozlowski [Sun, 12 Jan 2025 13:46:47 +0000 (14:46 +0100)] 
media: omap3isp: Use syscon_regmap_lookup_by_phandle_args

Use syscon_regmap_lookup_by_phandle_args() which is a wrapper over
syscon_regmap_lookup_by_phandle() combined with getting the syscon
argument.  Except simpler code this annotates within one line that given
phandle has arguments, so grepping for code would be easier.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: omap3isp: Handle ARM dma_iommu_mapping
Robin Murphy [Mon, 28 Oct 2024 17:58:36 +0000 (17:58 +0000)] 
media: omap3isp: Handle ARM dma_iommu_mapping

It's no longer practical for the OMAP IOMMU driver to trick
arm_setup_iommu_dma_ops() into ignoring its presence, so let's use the
same tactic as other IOMMU API users on 32-bit ARM and explicitly kick
the arch code's dma_iommu_mapping out of the way to avoid problems.

Fixes: 4720287c7bf7 ("iommu: Remove struct iommu_ops *iommu from arch_setup_dma_ops()")
Cc: stable@vger.kernel.org
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Tested-by: Sicelo A. Mhlongo <absicsz@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: intel/ipu6: set the dev_parent of video device to pdev
Bingbu Cao [Fri, 14 Feb 2025 10:52:38 +0000 (18:52 +0800)] 
media: intel/ipu6: set the dev_parent of video device to pdev

The bus_info in v4l2_capability of IPU6 isys v4l2_dev is missing.
The driver didn't set the dev_parent of v4l2_dev, its parent is set
to its parent auxdev which is neither platform nor PCI device, thus
media_set_bus_info() will not set the bus_info of v4l2_capability, then
`v4l2-ctl --all` cannot show the bus_info.

This patch fixes it by setting the dev_parent of video_device and v4l2
framework can detect the device type and set the bus_info instead.

Fixes: 3c1dfb5a69cf ("media: intel/ipu6: input system video nodes and buffer queues")
Cc: stable@vger.kernel.org
Signed-off-by: Hidenori Kobayashi <hidenorik@chromium.org>
Signed-off-by: Bingbu Cao <bingbu.cao@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: uvcvideo: Drop the uvc_driver structure
Laurent Pinchart [Sun, 23 Feb 2025 15:01:32 +0000 (17:01 +0200)] 
media: uvcvideo: Drop the uvc_driver structure

The uvc_driver structure used to contain more fields, but those got
removed in commit ba2fa99668bb ("[media] uvcvideo: Hardcode the
index/selector relationship for XU controls"). The structure is now just
a wrapper around usb_driver. Drop it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: uvcvideo: Add quirk for Actions UVC05
Ricardo Ribalda [Tue, 10 Dec 2024 10:48:14 +0000 (10:48 +0000)] 
media: uvcvideo: Add quirk for Actions UVC05

Actions UVC05 is a HDMI to USB dongle that implements the UVC protocol.

When the device suspends, its firmware seems to enter a weird mode when it
does not produce more frames.

Add the device to the quirk list to disable autosuspend.

Bus 001 Device 007: ID 1de1:f105 Actions Microelectronics Co. Display
 capture-UVC05
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass          239 Miscellaneous Device
  bDeviceSubClass         2 [unknown]
  bDeviceProtocol         1 Interface Association
  bMaxPacketSize0        64
  idVendor           0x1de1 Actions Microelectronics Co.
  idProduct          0xf105 Display capture-UVC05
  bcdDevice            4.09
  iManufacturer           1 Actions Micro
  iProduct                2 Display capture-UVC05
  iSerial                 3 -1005308387
  bNumConfigurations      1

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://lore.kernel.org/r/20241210-uvc-hdmi-suspend-v1-1-01f5dec023ea@chromium.org
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: uvcvideo: document UVC v1.5 ROI
Yunke Cao [Mon, 3 Feb 2025 11:55:53 +0000 (11:55 +0000)] 
media: uvcvideo: document UVC v1.5 ROI

Added documentation of V4L2_CID_UVC_REGION_OF_INTEREST_RECT and
V4L2_CID_UVC_REGION_OF_INTEREST_AUTO.

An example of a userspace implementing this feature can be found at:
https://chromium.googlesource.com/chromiumos/platform2/+/refs/heads/release-R121-15699.B/camera/hal/usb/

Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Signed-off-by: Yunke Cao <yunkec@google.com>
Tested-by: Yunke Cao <yunkec@google.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250203-uvc-roi-v17-17-5900a9fed613@chromium.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: uvcvideo: implement UVC v1.5 ROI
Yunke Cao [Mon, 3 Feb 2025 11:55:52 +0000 (11:55 +0000)] 
media: uvcvideo: implement UVC v1.5 ROI

Implement support for ROI as described in UVC 1.5:
4.2.2.1.20 Digital Region of Interest (ROI) Control

ROI control is implemented using V4L2 control API as
two UVC-specific controls:
V4L2_CID_UVC_REGION_OF_INTEREST_RECT and
V4L2_CID_UVC_REGION_OF_INTEREST_AUTO.

Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Yunke Cao <yunkec@google.com>
Reviewed-by: Yunke Cao <yunkec@google.com>
Tested-by: Yunke Cao <yunkec@google.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250203-uvc-roi-v17-16-5900a9fed613@chromium.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
[hverkuil: fix control names: "Of" -> "of", "Controls" -> "Ctrls"]

4 months agomedia: uvcvideo: Add sanity check to uvc_ioctl_xu_ctrl_map
Ricardo Ribalda [Mon, 3 Feb 2025 11:55:51 +0000 (11:55 +0000)] 
media: uvcvideo: Add sanity check to uvc_ioctl_xu_ctrl_map

Do not process unknown data types.

Tested-by: Yunke Cao <yunkec@google.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250203-uvc-roi-v17-15-5900a9fed613@chromium.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: uvcvideo: Introduce uvc_mapping_v4l2_size
Ricardo Ribalda [Mon, 3 Feb 2025 11:55:50 +0000 (11:55 +0000)] 
media: uvcvideo: Introduce uvc_mapping_v4l2_size

Centralize the calculation for the v4l2_size of a mapping.

Reviewed-by: Yunke Cao <yunkec@google.com>
Tested-by: Yunke Cao <yunkec@google.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250203-uvc-roi-v17-14-5900a9fed613@chromium.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: uvcvideo: let v4l2_query_v4l2_ctrl() work with v4l2_query_ext_ctrl
Ricardo Ribalda [Mon, 3 Feb 2025 11:55:49 +0000 (11:55 +0000)] 
media: uvcvideo: let v4l2_query_v4l2_ctrl() work with v4l2_query_ext_ctrl

v4l2_query_ext_ctrl contains information that is missing in
v4l2_queryctrl, like elem_size and elems.

With this change we can handle all the element_size information inside
uvc_ctrl.c.

Now that we are at it, remove the memset of the reserved fields, the
v4l2 ioctl handler should do that for us.

There is no functional change expected from this change.

Reviewed-by: Yunke Cao <yunkec@google.com>
Tested-by: Yunke Cao <yunkec@google.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250203-uvc-roi-v17-13-5900a9fed613@chromium.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: uvcvideo: support V4L2_CTRL_WHICH_MIN/MAX_VAL
Yunke Cao [Mon, 3 Feb 2025 11:55:48 +0000 (11:55 +0000)] 
media: uvcvideo: support V4L2_CTRL_WHICH_MIN/MAX_VAL

Add support for V4L2_CTRL_WHICH_MIN/MAX_VAL in uvc driver.
It is needed for the V4L2_CID_UVC_REGION_OF_INTEREST_RECT control.

Signed-off-by: Yunke Cao <yunkec@google.com>
Tested-by: Yunke Cao <yunkec@google.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250203-uvc-roi-v17-12-5900a9fed613@chromium.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: uvcvideo: Factor out query_boundaries from query_ctrl
Ricardo Ribalda [Mon, 3 Feb 2025 11:55:47 +0000 (11:55 +0000)] 
media: uvcvideo: Factor out query_boundaries from query_ctrl

Split the function in two parts. queryctrl_boundaries will be used in
future patches.

No functional change expected from this patch.

Reviewed-by: Yunke Cao <yunkec@google.com>
Tested-by: Yunke Cao <yunkec@google.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250203-uvc-roi-v17-11-5900a9fed613@chromium.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: uvcvideo: add support for compound controls
Yunke Cao [Mon, 3 Feb 2025 11:55:46 +0000 (11:55 +0000)] 
media: uvcvideo: add support for compound controls

This patch adds support for compound controls. This is required to
support controls that cannot be represented with a s64 data, such as the
Region of Interest.

Signed-off-by: Yunke Cao <yunkec@google.com>
Tested-by: Yunke Cao <yunkec@google.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250203-uvc-roi-v17-10-5900a9fed613@chromium.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: uvcvideo: Factor out clamping from uvc_ctrl_set
Ricardo Ribalda [Mon, 3 Feb 2025 11:55:45 +0000 (11:55 +0000)] 
media: uvcvideo: Factor out clamping from uvc_ctrl_set

Move the logic to a separated function. Do not expect any change.
This is a preparation for supporting compound controls.

Reviewed-by: Yunke Cao <yunkec@google.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Yunke Cao <yunkec@google.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250203-uvc-roi-v17-9-5900a9fed613@chromium.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: uvcvideo: Support any size for mapping get/set
Ricardo Ribalda [Mon, 3 Feb 2025 11:55:44 +0000 (11:55 +0000)] 
media: uvcvideo: Support any size for mapping get/set

Right now, we only support mappings for v4l2 controls with a max size of
s32. This patch modifies the prototype of get/set so it can support any
size.

This is done to prepare for compound controls.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Yunke Cao <yunkec@google.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Yunke Cao <yunkec@google.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250203-uvc-roi-v17-8-5900a9fed613@chromium.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: uvcvideo: uvc_ioctl_(g|s)_ext_ctrls: handle NoP case
Ricardo Ribalda [Mon, 3 Feb 2025 11:55:43 +0000 (11:55 +0000)] 
media: uvcvideo: uvc_ioctl_(g|s)_ext_ctrls: handle NoP case

If nothing needs to be done. Exit early.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Yunke Cao <yunkec@google.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250203-uvc-roi-v17-7-5900a9fed613@chromium.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: uvcvideo: refactor uvc_ioctl_g_ext_ctrls
Ricardo Ribalda [Mon, 3 Feb 2025 11:55:42 +0000 (11:55 +0000)] 
media: uvcvideo: refactor uvc_ioctl_g_ext_ctrls

We want to support fetching the min and max values with g_ext_ctrls,
this patch is a preparation for that.

Instead of abusing uvc_query_v4l2_ctrl(), add an extra parameter to
uvc_ctrl_get, so it can support fetching the default value.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Yunke Cao <yunkec@google.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250203-uvc-roi-v17-6-5900a9fed613@chromium.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: uvcvideo: Handle uvc menu translation inside uvc_set_le_value
Ricardo Ribalda [Mon, 3 Feb 2025 11:55:41 +0000 (11:55 +0000)] 
media: uvcvideo: Handle uvc menu translation inside uvc_set_le_value

Be consistent with uvc_get_le_value() and do the menu translation there.

Note that in this case, the refactor does not provide much... but
consistency is a nice feature.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Yunke Cao <yunkec@google.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250203-uvc-roi-v17-5-5900a9fed613@chromium.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: uvcvideo: Handle uvc menu translation inside uvc_get_le_value
Ricardo Ribalda [Mon, 3 Feb 2025 11:55:40 +0000 (11:55 +0000)] 
media: uvcvideo: Handle uvc menu translation inside uvc_get_le_value

map->get() gets a value from an uvc_control in "UVC format" and converts
it to a value that can be consumed by v4l2.

Instead of using a special get function for V4L2_CTRL_TYPE_MENU, we
were converting from uvc_get_le_value in two different places.

Move the conversion to uvc_get_le_value().

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Yunke Cao <yunkec@google.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250203-uvc-roi-v17-4-5900a9fed613@chromium.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: vivid: Add a rectangle control
Yunke Cao [Mon, 3 Feb 2025 11:55:39 +0000 (11:55 +0000)] 
media: vivid: Add a rectangle control

This control represents a generic read/write rectangle.
It supports V4L2_CTRL_WHICH_MIN/MAX_VAL.

Signed-off-by: Yunke Cao <yunkec@google.com>
Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl>
Tested-by: Yunke Cao <yunkec@google.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250203-uvc-roi-v17-3-5900a9fed613@chromium.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: v4l2-ctrls: add support for V4L2_CTRL_WHICH_MIN/MAX_VAL
Hans Verkuil [Mon, 3 Feb 2025 11:55:38 +0000 (11:55 +0000)] 
media: v4l2-ctrls: add support for V4L2_CTRL_WHICH_MIN/MAX_VAL

Add the capability of retrieving the min and max values of a
compound control.

[Ricardo: Added static to v4l2_ctrl_type_op_(maximum|minimum) proto]
[Ricardo: Fix documentation]

Signed-off-by: Yunke Cao <yunkec@google.com>
Tested-by: Yunke Cao <yunkec@google.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250203-uvc-roi-v17-2-5900a9fed613@chromium.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
[hverkuil: fix small alignment checkpatch warning]

4 months agomedia: v4l2_ctrl: Add V4L2_CTRL_TYPE_RECT
Yunke Cao [Mon, 3 Feb 2025 11:55:37 +0000 (11:55 +0000)] 
media: v4l2_ctrl: Add V4L2_CTRL_TYPE_RECT

Add p_rect to struct v4l2_ext_control with basic support in
v4l2-ctrls.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Signed-off-by: Yunke Cao <yunkec@google.com>
Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl>
Tested-by: Yunke Cao <yunkec@google.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250203-uvc-roi-v17-1-5900a9fed613@chromium.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: venus: hfi: add a check to handle OOB in sfr region
Vikash Garodia [Thu, 20 Feb 2025 17:20:11 +0000 (22:50 +0530)] 
media: venus: hfi: add a check to handle OOB in sfr region

sfr->buf_size is in shared memory and can be modified by malicious user.
OOB write is possible when the size is made higher than actual sfr data
buffer. Cap the size to allocated size for such cases.

Cc: stable@vger.kernel.org
Fixes: d96d3f30c0f2 ("[media] media: venus: hfi: add Venus HFI files")
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Vikash Garodia <quic_vgarodia@quicinc.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: venus: hfi: add check to handle incorrect queue size
Vikash Garodia [Thu, 20 Feb 2025 17:20:10 +0000 (22:50 +0530)] 
media: venus: hfi: add check to handle incorrect queue size

qsize represents size of shared queued between driver and video
firmware. Firmware can modify this value to an invalid large value. In
such situation, empty_space will be bigger than the space actually
available. Since new_wr_idx is not checked, so the following code will
result in an OOB write.
...
qsize = qhdr->q_size

if (wr_idx >= rd_idx)
 empty_space = qsize - (wr_idx - rd_idx)
....
if (new_wr_idx < qsize) {
 memcpy(wr_ptr, packet, dwords << 2) --> OOB write

Add check to ensure qsize is within the allocated size while
reading and writing packets into the queue.

Cc: stable@vger.kernel.org
Fixes: d96d3f30c0f2 ("[media] media: venus: hfi: add Venus HFI files")
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Vikash Garodia <quic_vgarodia@quicinc.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: venus: hfi_parser: refactor hfi packet parsing logic
Vikash Garodia [Thu, 20 Feb 2025 17:20:09 +0000 (22:50 +0530)] 
media: venus: hfi_parser: refactor hfi packet parsing logic

words_count denotes the number of words in total payload, while data
points to payload of various property within it. When words_count
reaches last word, data can access memory beyond the total payload. This
can lead to OOB access. With this patch, the utility api for handling
individual properties now returns the size of data consumed. Accordingly
remaining bytes are calculated before parsing the payload, thereby
eliminates the OOB access possibilities.

Cc: stable@vger.kernel.org
Fixes: 1a73374a04e5 ("media: venus: hfi_parser: add common capability parser")
Signed-off-by: Vikash Garodia <quic_vgarodia@quicinc.com>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: venus: hfi_parser: add check to avoid out of bound access
Vikash Garodia [Thu, 20 Feb 2025 17:20:08 +0000 (22:50 +0530)] 
media: venus: hfi_parser: add check to avoid out of bound access

There is a possibility that init_codecs is invoked multiple times during
manipulated payload from video firmware. In such case, if codecs_count
can get incremented to value more than MAX_CODEC_NUM, there can be OOB
access. Reset the count so that it always starts from beginning.

Cc: stable@vger.kernel.org
Fixes: 1a73374a04e5 ("media: venus: hfi_parser: add common capability parser")
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Vikash Garodia <quic_vgarodia@quicinc.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: visl: Fix ERANGE error when setting enum controls
Nicolas Dufresne [Tue, 10 Dec 2024 21:02:53 +0000 (16:02 -0500)] 
media: visl: Fix ERANGE error when setting enum controls

The visl driver supports both frame and slice mode, with and without a
start-code. But, the range and default for these enum controls was not
set, which currently limits the decoder to enums with a value of 0. Fix
this by setting the decoder mode and start code controls for both the
H.264 and HEVC codecs.

Fixes: 0c078e310b6d ("media: visl: add virtual stateless decoder driver")
Cc: stable@vger.kernel.org
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: nuvoton: Fix reference handling of ece_pdev
Ricardo Ribalda [Mon, 24 Feb 2025 07:03:55 +0000 (07:03 +0000)] 
media: nuvoton: Fix reference handling of ece_pdev

When we obtain a reference to of a platform_device, we need to release
it via put_device.

Found by cocci:
./platform/nuvoton/npcm-video.c:1677:3-9: ERROR: missing put_device; call of_find_device_by_node on line 1667, but without a corresponding object release within this function.
./platform/nuvoton/npcm-video.c:1684:3-9: ERROR: missing put_device; call of_find_device_by_node on line 1667, but without a corresponding object release within this function.
./platform/nuvoton/npcm-video.c:1690:3-9: ERROR: missing put_device; call of_find_device_by_node on line 1667, but without a corresponding object release within this function.
./platform/nuvoton/npcm-video.c:1694:1-7: ERROR: missing put_device; call of_find_device_by_node on line 1667, but without a corresponding object release within this function.

Instead of manually calling put_device, use the __free macros.

Cc: stable@vger.kernel.org
Fixes: 46c15a4ff1f4 ("media: nuvoton: Add driver for NPCM video capture and encoding engine")
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: nuvoton: Fix reference handling of ece_node
Ricardo Ribalda [Mon, 24 Feb 2025 07:03:54 +0000 (07:03 +0000)] 
media: nuvoton: Fix reference handling of ece_node

Make sure all the code paths call of_node_put().

Instead of manually calling of_node_put, use the __free macros/helpers.

Cc: stable@vger.kernel.org
Fixes: 46c15a4ff1f4 ("media: nuvoton: Add driver for NPCM video capture and encoding engine")
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: adv7180: Disable test-pattern control on adv7180
Niklas Söderlund [Fri, 21 Feb 2025 23:09:07 +0000 (00:09 +0100)] 
media: adv7180: Disable test-pattern control on adv7180

The register that enables selecting a test-pattern to be outputted in
free-run mode (FREE_RUN_PAT_SEL[2:0]) is only available on adv7280 based
devices, not the adv7180 based ones.

Add a flag to mark devices that are capable of generating test-patterns,
and those that are not. And only register the control on supported
devices.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: mgb4: Fix switched CMT frequency range "magic values" sets
Martin Tůma [Fri, 21 Feb 2025 12:07:43 +0000 (13:07 +0100)] 
media: mgb4: Fix switched CMT frequency range "magic values" sets

The reason why this passed unnoticed is that most infotainment systems
use frequencies near enough the middle (50MHz) where both sets work.

Fixes: 0ab13674a9bd ("media: pci: mgb4: Added Digiteq Automotive MGB4 driver")
Cc: stable@vger.kernel.org
Signed-off-by: Martin Tůma <martin.tuma@digiteqautomotive.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: mgb4: Fix CMT registers update logic
Martin Tůma [Fri, 21 Feb 2025 12:07:42 +0000 (13:07 +0100)] 
media: mgb4: Fix CMT registers update logic

The CMT "magic values" registers must be updated while the CMT reset
registers are active.

Fixes: 0ab13674a9bd ("media: pci: mgb4: Added Digiteq Automotive MGB4 driver")
Cc: stable@vger.kernel.org
Signed-off-by: Martin Tůma <martin.tuma@digiteqautomotive.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: cx23885: Remove unused netup_eeprom_write
Dr. David Alan Gilbert [Thu, 20 Feb 2025 16:55:16 +0000 (16:55 +0000)] 
media: cx23885: Remove unused netup_eeprom_write

netup_eeprom_write() was added in 2009 by
commit b45c0551f94d ("V4L/DVB (10797): Add EEPROM code for NetUP Dual
DVB-S2 CI card.")
but has remained unused.

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: hi556: remove redundant assignment to variable enable
Colin Ian King [Wed, 5 Feb 2025 11:40:08 +0000 (11:40 +0000)] 
media: hi556: remove redundant assignment to variable enable

The variable enable is being assigned a value that is never read
afterwards. The assignment is redundant and can be removed.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: tc358746: fix locking issue
Matthias Fend [Tue, 21 Jan 2025 09:56:55 +0000 (10:56 +0100)] 
media: tc358746: fix locking issue

In tc358746_link_validate() an attempt is made to get the state lock of the
subdev, but since this is already held by the calling function
v4l2_subdev_link_validate(), this leads to a deadlock.
Another problem is that this function queries the link frequency of the
source device. Since some image sensors use the lock of the v4l2 control
handler as a state lock, which is already held at this point, a deadlock
can also occur here.
Move the calculation of the FIFO size from tc358746_link_validate() to
tc358746_apply_misc_config() to avoid the deadlocks mentioned.

Signed-off-by: Matthias Fend <matthias.fend@emfend.at>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: tc358746: improve calculation of the D-PHY timing registers
Matthias Fend [Tue, 7 Jan 2025 16:07:01 +0000 (17:07 +0100)] 
media: tc358746: improve calculation of the D-PHY timing registers

When calculating D-PHY registers, using data rates that are not multiples
of 16 can lead to precision loss in division operations. This can result in
register values that produce timing violations against the MIPI standard.

An example:
cfg->hs_clk_rate = 294MHz
hf_clk = 18

If the desired value in cfg->init is 100us, which is the minimum allowed
value, then the LINEINITCNT register is calculated as 1799. But since the
actual clock is 18.375MHz instead of 18MHz, this setting results in a time
that is shorter than 100us and thus violates the standard. The correct
value for LINEINITCNT would be 1837.

Improve the precision of calculations by using Hz instead of MHz as unit.

Signed-off-by: Matthias Fend <matthias.fend@emfend.at>
Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: tc358746: add support for 8/10/12/14-bit RAW Bayer formats
Matthias Fend [Tue, 7 Jan 2025 16:07:00 +0000 (17:07 +0100)] 
media: tc358746: add support for 8/10/12/14-bit RAW Bayer formats

The TC358746 supports RAW formats with 8, 10, 12, and 14-bit depths. Since
pixel data is transported transparently without modifying the pixel
arrangement, all Bayer patterns (RGGB, BGGR, GRBG, GBRG) are supported.

Signed-off-by: Matthias Fend <matthias.fend@emfend.at>
Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: platform: allgro-dvt: unregister v4l2_device on the error path
Joe Hattori [Thu, 5 Dec 2024 02:06:21 +0000 (11:06 +0900)] 
media: platform: allgro-dvt: unregister v4l2_device on the error path

In allegro_probe(), the v4l2 device is not unregistered in the error
path, which results in a memory leak. Fix it by calling
v4l2_device_unregister() before returning error.

Fixes: d74d4e2359ec ("media: allegro: move driver out of staging")
Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Reviewed-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: verisilicon: VP9: Fix typo
Benjamin Gaignard [Mon, 20 Jan 2025 08:13:42 +0000 (09:13 +0100)] 
media: verisilicon: VP9: Fix typo

Change headres_size to headers_size.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: verisilicon: HEVC: Initialize start_bit field
Benjamin Gaignard [Mon, 20 Jan 2025 08:10:52 +0000 (09:10 +0100)] 
media: verisilicon: HEVC: Initialize start_bit field

The HEVC driver needs to set the start_bit field explicitly to avoid
causing corrupted frames when the VP9 decoder is used in parallel. The
reason for this problem is that the VP9 and the HEVC decoder share this
register.

Fixes: cb5dd5a0fa51 ("media: hantro: Introduce G2/HEVC decoder")
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Tested-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: tuners: Constify struct tunertype, tuner_range and tuner_params
Christophe JAILLET [Tue, 27 Aug 2024 19:57:58 +0000 (21:57 +0200)] 
media: tuners: Constify struct tunertype, tuner_range and tuner_params

'struct tunertype', 'struct tuner_range' and 'struct tuner_params' are not
modified in this driver.

Constifying these structures moves some data to a read-only section, so
increase overall security.

On a x86_64, with allmodconfig:
Before:
======
   2877    8554       0   11431    2ca7 drivers/media/tuners/tuner-types.o

After:
=====
   text    data     bss     dec     hex filename
  11421      48       0   11469    2ccd drivers/media/tuners/tuner-types.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: dvb-usb-v2: Constify struct i2c_algorithm
Christophe JAILLET [Sat, 7 Sep 2024 20:30:42 +0000 (22:30 +0200)] 
media: dvb-usb-v2: Constify struct i2c_algorithm

'struct i2c_algorithm' are not modified in these drivers.

Constifying this structure moves some data to a read-only section, so
increase overall security, especially when the structure holds some
function pointers.

More over, dvb_usb_device_properties->i2c_algo seems to only be copied in
i2c_adapter->algo, which is already a "const struct i2c_algorithm".
This is done in dvb_usbv2_i2c_init()

On a x86_64, with allmodconfig, as an example:
Before:
======
   text    data     bss     dec     hex filename
  35366    5832      36   41234    a112 drivers/media/usb/dvb-usb-v2/af9015.o

After:
=====
   text    data     bss     dec     hex filename
  35430    5768      36   41234    a112 drivers/media/usb/dvb-usb-v2/af9015.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: dvb-usb: Constify struct i2c_algorithm
Christophe JAILLET [Sat, 7 Sep 2024 20:36:29 +0000 (22:36 +0200)] 
media: dvb-usb: Constify struct i2c_algorithm

'struct i2c_algorithm' are not modified in these drivers.

Constifying this structure moves some data to a read-only section, so
increase overall security, especially when the structure holds some
function pointers.

More over, dvb_usb_device_properties->i2c_algo seems to only be copied in
i2c_adapter->algo, which is already a "const struct i2c_algorithm".
This is done in dvb_usb_i2c_init()

On a x86_64, with allmodconfig, as an example:
Before:
======
   text    data     bss     dec     hex filename
  30571    5916      36   36523    8eab drivers/media/usb/dvb-usb/af9005.o

After:
=====
   text    data     bss     dec     hex filename
  30667    5852      36   36555    8ecb drivers/media/usb/dvb-usb/af9005.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: dibx000_common: Constify struct i2c_algorithm
Christophe JAILLET [Sun, 8 Sep 2024 08:21:00 +0000 (10:21 +0200)] 
media: dibx000_common: Constify struct i2c_algorithm

'struct i2c_algorithm' is not modified in this driver.

Constifying this structure moves some data to a read-only section, so
increase overall security, especially when the structure holds some
function pointers.

To do so, the prototype of i2c_adapter_init() has to be updated as well.

On a x86_64, with allmodconfig:
Before:
======
   text    data     bss     dec     hex filename
  17213     932      20   18165    46f5 drivers/media/dvb-frontends/dibx000_common.o

After:
=====
   text    data     bss     dec     hex filename
  17490     660      20   18170    46fa drivers/media/dvb-frontends/dibx000_common.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agostaging: media: imx: vdic: Drop unused prepare_vdi_in_buffers()
Marek Vasut [Thu, 3 Oct 2024 12:27:30 +0000 (14:27 +0200)] 
staging: media: imx: vdic: Drop unused prepare_vdi_in_buffers()

This function is unused and unlikely to be used in the near future.
Remove it.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: qcom: camss: Add sm845 named power-domain support
Caleb Connolly [Sun, 8 Dec 2024 04:00:48 +0000 (23:00 -0500)] 
media: qcom: camss: Add sm845 named power-domain support

Declare power-domain names "top", "ife0" and "ife1" eponymously for the
power-domains TITAN_TOP_GDSC, IFE_0_GDSC and IFE_1_GDSC respectively.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
Signed-off-by: David Heidelberg <david@ixit.cz>
Acked-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: cx231xx: Convert enum into a define
Ricardo Ribalda [Mon, 2 Dec 2024 15:47:15 +0000 (15:47 +0000)] 
media: cx231xx: Convert enum into a define

The code is running arithmetics with the enum, which when not done with
care makes the compiler a bit nervous.

Because those enums are only used as defines (no argument or variable
from that enumeration type), convert it into a define and move on.

It is required to build with llvm 9 without these warnings:
drivers/media/usb/cx231xx/cx231xx-pcb-cfg.c:673:17: warning: bitwise operation between different enumeration types ('enum TS_PORT' and 'enum POWE_TYPE') [-Wenum-enum-conversion]
drivers/media/usb/cx231xx/cx231xx-pcb-cfg.c:680:21: warning: bitwise operation between different enumeration types ('enum AVDEC_STATUS' and 'enum POWE_TYPE') [-Wenum-enum-conversion]
drivers/media/usb/cx231xx/cx231xx-pcb-cfg.c:687:21: warning: bitwise operation between different enumeration types ('enum AVDEC_STATUS' and 'enum POWE_TYPE') [-Wenum-enum-conversion]
drivers/media/usb/cx231xx/cx231xx-pcb-cfg.c:702:17: warning: bitwise operation between different enumeration types ('enum TS_PORT' and 'enum POWE_TYPE') [-Wenum-enum-conversion]
drivers/media/usb/cx231xx/cx231xx-pcb-cfg.c:709:21: warning: bitwise operation between different enumeration types ('enum TS_PORT' and 'enum POWE_TYPE') [-Wenum-enum-conversion]
drivers/media/usb/cx231xx/cx231xx-pcb-cfg.c:718:21: warning: bitwise operation between different enumeration types ('enum AVDEC_STATUS' and 'enum POWE_TYPE') [-Wenum-enum-conversion]
drivers/media/usb/cx231xx/cx231xx-pcb-cfg.c:727:21: warning: bitwise operation between different enumeration types ('enum AVDEC_STATUS' and 'enum TS_PORT') [-Wenum-enum-conversion]
drivers/media/usb/cx231xx/cx231xx-pcb-cfg.c:737:21: warning: bitwise operation between different enumeration types ('enum AVDEC_STATUS' and 'enum TS_PORT') [-Wenum-enum-conversion]
drivers/media/usb/cx231xx/cx231xx-pcb-cfg.c:749:21: warning: bitwise operation between different enumeration types ('enum AVDEC_STATUS' and 'enum TS_PORT') [-Wenum-enum-conversion]

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
[hverkuil: fix a tiny typo in the commit log]

5 months agomedia: cx23885: add simple suspend/resume
Matthias Schwarzott [Tue, 31 Dec 2024 09:37:25 +0000 (10:37 +0100)] 
media: cx23885: add simple suspend/resume

After suspend-to-memory or suspend-to-disk, additional chips are no longer
reachable via i2c. Trying to tune to DVB-C on a cx23885 based
Hauppauge WinTV-HVR-4400-HD:

  si2165 8-0064: could not set chip_mode
  tda18271: performing RF tracking filter calibration

This patch implements the simplest possible suspend/resume that is
enough to tune to dvb-c channel after resume.
Afterwards dmesg looks like this:

  si2165 8-0064: downloading firmware from file 'dvb-demod-si2165.fw' \
    size=5768
  si2165 8-0064: si2165_upload_firmware: extracted patch_version=0x9a, \
    block_count=0x27, crc_expected=0xcc0a
  si2165 8-0064: fw load finished
  tda18271: performing RF tracking filter calibration
  tda18271: RF tracking filter calibration complete

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: coda: Add system resume interface
Xiaolei Wang [Sat, 21 Dec 2024 03:14:55 +0000 (11:14 +0800)] 
media: coda: Add system resume interface

When the system goes into sleep mode, the dependent
power will be turned off, so when the system resumes,
coda_hw_init() needs to be called, otherwise it will
get 'CODA PIC_RUN timeout' after resuming.

Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: dvb-usb: Constify struct usb_device_id
Christophe JAILLET [Sun, 5 Jan 2025 21:19:57 +0000 (22:19 +0100)] 
media: dvb-usb: Constify struct usb_device_id

'struct usb_device_id' is not modified in these drivers.

Constifying this structure moves some data to a read-only section, so
increase overall security.

In order to do that, struct dvb_usb_device_description (in dvb-usb.h) also
needs to be updated.

On a x86_64, with allmodconfig, as an example:
Before:
======
   text    data     bss     dec     hex filename
   1983    4240       4    6227    1853 drivers/media/usb/dvb-usb/a800.o

After:
=====
   text    data     bss     dec     hex filename
   2079    4144       4    6227    1853 drivers/media/usb/dvb-usb/a800.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: dt-bindings: adv7180: Document the 'interrupts' property
Fabio Estevam [Mon, 13 Jan 2025 10:51:02 +0000 (07:51 -0300)] 
media: dt-bindings: adv7180: Document the 'interrupts' property

The ADV7180 family of chips have an INTRQ pin that can be connected
to a SoC GPIO.

Allow the 'interrupts' property to be described to fix the following
dt-schema warning:

'interrupt-parent', 'interrupts' do not match any of the regexes: 'pinctrl-[0-9]+'

Signed-off-by: Fabio Estevam <festevam@denx.de>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: usb: use kmalloc_array() to replace kmalloc()
Zhang Heng [Tue, 14 Jan 2025 01:12:55 +0000 (09:12 +0800)] 
media: usb: use kmalloc_array() to replace kmalloc()

Use kmalloc_array() to replace kmalloc() with multiplication.
kmalloc_array() has multiply overflow check, which will be safer.

Signed-off-by: Zhang Heng <zhangheng@kylinos.cn>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: pwc: remove useless header files
Zhang Heng [Fri, 17 Jan 2025 09:55:30 +0000 (17:55 +0800)] 
media: pwc: remove useless header files

It was originally intended to introduce simple_strtol,
but since commit a081c3400ff2 ("[media] pwc: Remove dev_hint
module parameter"), that simple_strtol has been removed,
so in order to prevent disputes, the header file should be removed.

Signed-off-by: Zhang Heng <zhangheng@kylinos.cn>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
[hverkuil: fixed small typos in commit log]

5 months agomedia: i2c: adv748x: Fix test pattern selection mask
Niklas Söderlund [Tue, 21 Jan 2025 20:44:00 +0000 (21:44 +0100)] 
media: i2c: adv748x: Fix test pattern selection mask

The mask to select the test-pattern in register ADV748X_SDP_FRP is
incorrect, it's the lower 3 bits which controls the pattern. The
GENMASK() macro is used incorrectly and the generated mask is 0x0e
instead of 0x07.

The result is that not all test patterns are selectable, and that in
some cases the wrong test pattern is activated. Fix this by correcting
the GENMASK().

Fixes: 3e89586a64df ("media: i2c: adv748x: add adv748x driver")
Cc: stable@vger.kernel.org
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
[hverkuil: fixed tiny typo in commit log: my -> by]

5 months agomedia: mgb4: Added support for additional GMSL modules variants
Martin Tůma [Mon, 27 Jan 2025 15:59:56 +0000 (16:59 +0100)] 
media: mgb4: Added support for additional GMSL modules variants

Added support for GMSL modules variants 3 and 4. Variant 3 is the same as
variant 2 from the driver's point of view. Variant 4 has "hardwired" daisy
chain loopback outputs and thus missing the v4l2 outputs.

Signed-off-by: Martin Tůma <martin.tuma@digiteqautomotive.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: admin-guide: add mgb4 GMSL modules variants description
Martin Tůma [Mon, 27 Jan 2025 15:59:57 +0000 (16:59 +0100)] 
media: admin-guide: add mgb4 GMSL modules variants description

Document the (new) mgb4 GMSL modules variants.

Signed-off-by: Martin Tůma <martin.tuma@digiteqautomotive.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agoDocumentation: media: fix spelling error in the HDMI CEC documentation
Chandra Pratap [Tue, 28 Jan 2025 08:50:12 +0000 (14:20 +0530)] 
Documentation: media: fix spelling error in the HDMI CEC documentation

Correct the erroneous spelling of 'responsible' in
Documentation/admin-guide/media/cec.rst. This fixes all errors
pointed out by codespell in the file.

Signed-off-by: Chandra Pratap <chandrapratap3519@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: video-i2c: Use HWMON_CHANNEL_INFO macro to simplify code
Huisong Li [Mon, 10 Feb 2025 03:48:42 +0000 (11:48 +0800)] 
media: video-i2c: Use HWMON_CHANNEL_INFO macro to simplify code

Use HWMON_CHANNEL_INFO macro to simplify code.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: mediatek: vcodec: Fix a resource leak related to the scp device in FW initiali...
Jiasheng Jiang [Tue, 18 Feb 2025 18:58:09 +0000 (18:58 +0000)] 
media: mediatek: vcodec: Fix a resource leak related to the scp device in FW initialization

On Mediatek devices with a system companion processor (SCP) the mtk_scp
structure has to be removed explicitly to avoid a resource leak.
Free the structure in case the allocation of the firmware structure fails
during the firmware initialization.

Fixes: 53dbe0850444 ("media: mtk-vcodec: potential null pointer deference in SCP")
Cc: stable@vger.kernel.org
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: uapi: rkisp1-config: Fix typo in extensible params example
Niklas Söderlund [Wed, 12 Feb 2025 16:50:53 +0000 (17:50 +0100)] 
media: uapi: rkisp1-config: Fix typo in extensible params example

The define used for the version in the example diagram does not match what
is defined in enum rksip1_ext_param_buffer_version, nor the description
above it. Correct the typo to make it clear which define to use.

Fixes: e9d05e9d5db1 ("media: uapi: rkisp1-config: Add extensible params format")
Cc: stable@vger.kernel.org
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: dt-bindings: aspeed,video-engine: Convert to json schema
Jammy Huang [Thu, 13 Feb 2025 01:53:38 +0000 (09:53 +0800)] 
media: dt-bindings: aspeed,video-engine: Convert to json schema

Convert aspeed-video.txt to yaml format.
Update aspeed-video.txt to aspeed,video-engine.yaml in MAINTAINER file.

Signed-off-by: Jammy Huang <jammy_huang@aspeedtech.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agodt-bindings: media: st,stmipid02: correct lane-polarities maxItems
Alain Volmat [Mon, 10 Feb 2025 10:04:31 +0000 (11:04 +0100)] 
dt-bindings: media: st,stmipid02: correct lane-polarities maxItems

The MIPID02 can use up to 2 data lanes which leads to having a maximum
item number of 3 for the lane-polarities since this also contains the
clock lane.

CC: stable@vger.kernel.org
Fixes: c2741cbe7f8a ("dt-bindings: media: st,stmipid02: Convert the text bindings to YAML")
Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: iris: rename module file
Arnd Bergmann [Wed, 19 Feb 2025 08:01:53 +0000 (09:01 +0100)] 
media: iris: rename module file

Build-testing on x86 showed two modules with conflicting "iris.ko"
names after the addition of the qualcomm driver:

   error: the following would cause module name conflict:
     arch/x86/platform/iris/iris.ko
     drivers/media/platform/qcom/iris/iris.ko

Since this a new module, nothing should rely on the name yet, so
rename this one to a more specific "qcom-iris.ko".

Fixes: 38506cb7e8d2 ("media: iris: add platform driver for iris video device")
Cc: Shérab <Sebastien.Hinderer@ens-lyon.org> # for x86 iris
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: mtk-vcodec: venc: avoid -Wenum-compare-conditional warning
Arnd Bergmann [Fri, 18 Oct 2024 15:21:10 +0000 (15:21 +0000)] 
media: mtk-vcodec: venc: avoid -Wenum-compare-conditional warning

This is one of three clang warnings about incompatible enum types
in a conditional expression:

drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_if.c:597:29: error: conditional expression between different enumeration types ('enum scp_ipi_id' and 'enum ipi_id') [-Werror,-Wenum-compare-conditional]
  597 |         inst->vpu_inst.id = is_ext ? SCP_IPI_VENC_H264 : IPI_VENC_H264;
      |                                    ^ ~~~~~~~~~~~~~~~~~   ~~~~~~~~~~~~~

The code is correct, so just rework it to avoid the warning.

Fixes: 0dc4b3286125 ("media: mtk-vcodec: venc: support SCP firmware")
Cc: stable@vger.kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Alexandre Courbot <acourbot@google.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>