]> git.ipfire.org Git - thirdparty/kernel/linux.git/log
thirdparty/kernel/linux.git
5 months agomedia: adv7511-v4l2: add support for the EEODB
Hans Verkuil [Mon, 27 Jan 2025 11:03:13 +0000 (12:03 +0100)] 
media: adv7511-v4l2: add support for the EEODB

Support the HDMI Forum EDID Extension Override Data Block
by using the new v4l2_num_edid_blocks helper function.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
5 months agomedia: v4l2-dv-timings: add v4l2_num_edid_blocks() helper
Hans Verkuil [Mon, 27 Jan 2025 11:03:12 +0000 (12:03 +0100)] 
media: v4l2-dv-timings: add v4l2_num_edid_blocks() helper

This new function determines how many blocks the EDID has.
Traditionally the number of extension blocks is read from
the EDID at offset 126, but this can be overridden by the
HDMI Forum EDID Extension Override Data Block. So check
that as well in this helper.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
5 months agomedia: radio-aztech.c: fix old email in comment
Hans Verkuil [Tue, 7 Jan 2025 09:14:43 +0000 (10:14 +0100)] 
media: radio-aztech.c: fix old email in comment

Fix a wrong email address. It's only used in a comment, but it's easy
enough to fix.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
5 months agomedia: test-drivers: vivid: don't call schedule in loop
Hans Verkuil [Mon, 9 Dec 2024 15:00:16 +0000 (16:00 +0100)] 
media: test-drivers: vivid: don't call schedule in loop

Artem reported that the CPU load was 100% when capturing from
vivid at low resolution with ffmpeg.

This was caused by:

while (time_is_after_jiffies(cur_jiffies + wait_jiffies) &&
       !kthread_should_stop())
        schedule();

If there are no other processes running that can be scheduled,
then this is basically a busy-loop.

Change it to wait_event_interruptible_timeout() which doesn't
have that problem.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Reported-by: Artem S. Tashkinov <aros@gmx.com>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219570
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
5 months agomedia: dw9719: Add DW9761 support
Hans de Goede [Tue, 5 Nov 2024 20:36:58 +0000 (21:36 +0100)] 
media: dw9719: Add DW9761 support

Add support for the DW9761 VCM controller, which is very similar to
the DW9719.

The new support is based on
drivers/external_drivers/camera/drivers/media/i2c/micam/dw9761.c
from the Xiaomi kernel sources for the Mi Pad 2.

The DW9761 support has been tested on a Xiaomi Mi Pad 2 tablet and
DW9719 support has been tested (to avoid regressions) on a Microsoft
Surface Go tablet.

Link: https://github.com/MiCode/Xiaomi_Kernel_OpenSource/
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: André Apitzsch <git@apitzsch.eu>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: qcom: camss: switch CSID to defined MIPI CSI data type IDs
Vladimir Zapolskiy [Wed, 25 Dec 2024 20:57:48 +0000 (22:57 +0200)] 
media: qcom: camss: switch CSID to defined MIPI CSI data type IDs

Remove redefined image data type IDs taken directly from the MIPI CSI-2
specification. Non-functional change.

Signed-off-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: i2c: imx219: Scale the pixel rate for analog binning
Jai Luthra [Tue, 4 Feb 2025 07:04:40 +0000 (12:34 +0530)] 
media: i2c: imx219: Scale the pixel rate for analog binning

When the analog binning mode is used for high framerate operation, the
pixel rate is effectively doubled. Account for this when setting up the
pixel clock rate, and applying the vblank and exposure controls.

The previous logic only used analog binning for RAW8, but normal binning
limits the framerate on RAW10 480p [1]. So with this patch we switch to
using special binning (with 2x pixel rate) wherever possible.

[1]: https://github.com/raspberrypi/linux/issues/5493

Co-developed-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Co-developed-by: Vinay Varma <varmavinaym@gmail.com>
Signed-off-by: Vinay Varma <varmavinaym@gmail.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>
5 months agomedia: i2c: imx219: Increase minimum LLP to fix blocky artefacts
Jai Luthra [Tue, 4 Feb 2025 07:04:39 +0000 (12:34 +0530)] 
media: i2c: imx219: Increase minimum LLP to fix blocky artefacts

The sensor's internal ADC supports a minimum line length of 3448 pixels,
which may be too small to use with analog binning, where ADC operates on
two lines together. Switch to a higher minimum line length of 3560
pixels to fix the blocky artefacts seen with analog binning [1].

To keep the same default framerate as before for all the modes, lower
the default fll value to compensate for the increase in llp.

[1]: https://github.com/raspberrypi/rpicam-apps/issues/281#issuecomment-1082894118

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>
5 months agomedia: i2c: imx219: make HBLANK r/w to allow longer exposures
Dave Stevenson [Tue, 4 Feb 2025 07:04:38 +0000 (12:34 +0530)] 
media: i2c: imx219: make HBLANK r/w to allow longer exposures

The HBLANK control was read-only, and always configured such that the
sensor line length register was 3448. This limited the maximum exposure
time that could be achieved to around 1.26 secs.

Make HBLANK read/write so that the line time can be extended, and
thereby allow longer exposures (and slower frame rates). Retain the
overall line length setting when changing modes rather than resetting it
to a default.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
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>
5 months agomedia: i2c: imx219: Rename VTS to FRM_LENGTH
Jai Luthra [Tue, 4 Feb 2025 07:04:37 +0000 (12:34 +0530)] 
media: i2c: imx219: Rename VTS to FRM_LENGTH

The IMX219 datasheet refers to the vertical length + blanking as
FRM_LENGTH instead of VTS.

Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.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>
5 months agomedia: i2c: imx219: Correct the minimum vblanking value
David Plowman [Tue, 4 Feb 2025 07:04:36 +0000 (12:34 +0530)] 
media: i2c: imx219: Correct the minimum vblanking value

The datasheet for this sensor documents the minimum vblanking as being
32 lines. It does fix some problems with occasional black lines at the
bottom of images (tested on Raspberry Pi).

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.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>
5 months agomedia: imx219: Adjust PLL settings based on the number of MIPI lanes
Dave Stevenson [Thu, 23 Jan 2025 15:37:49 +0000 (15:37 +0000)] 
media: imx219: Adjust PLL settings based on the number of MIPI lanes

Commit ceddfd4493b3 ("media: i2c: imx219: Support four-lane operation")
added support for device tree to allow configuration of the sensor to
use 4 lanes with a link frequency of 363MHz, and amended the advertised
pixel rate to 280.8MPix/s.

However it didn't change any of the PLL settings, so actually it would
have been running overclocked in the MIPI block, and with the frame
rate and exposure calculations being wrong as the pixel rate was
unchanged.

The pixel rate and link frequency advertised were taken from the "Clock
Setting Example" section of the datasheet. However those are based on an
external clock of 12MHz, and are unachievable with a clock of 24MHz - it
seems PREPLLCLK_VT_DIV and PREPLLCK_OP_DIV can ONLY be set via the
automatic configuration documented in "9-1-2 EXCK_FREQ setting depend on
INCK frequency", not by writing the registers.
The closest we can get with a 24MHz clock is 281.6MPix/s and 364MHz.

Dropping all support for the 363MHz link frequency would cause problems
for existing users, so allow it, but log a warning that the requested
value is being changed to the supported one.

Fixes: ceddfd4493b3 ("media: i2c: imx219: Support four-lane operation")
Cc: stable@vger.kernel.org
Co-developed-by: Peyton Howe <peyton.howe@bellsouth.net>
Signed-off-by: Peyton Howe <peyton.howe@bellsouth.net>
Signed-off-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>
5 months agomedia: i2c: imx415: Link frequencies are not exclusive to num lanes
Dave Stevenson [Wed, 29 Jan 2025 15:03:51 +0000 (15:03 +0000)] 
media: i2c: imx415: Link frequencies are not exclusive to num lanes

The link frequencies are equally valid in 2 or 4 lane modes, but
they change the hmax_min value for the mode as the MIPI block
has to have sufficient time to send the pixel data for each line.

Remove the association with number of lanes, and add hmax_min
configuration for both lane options.

Reviewed-by: Michael Riesch <michael.riesch@wolfvision.net>
Reviewed-by: Gerald Loacker <gerald.loacker@wolfvision.net>
Signed-off-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>
5 months agomedia: i2c: imx415: Make HBLANK controllable and in consistent units
Dave Stevenson [Wed, 29 Jan 2025 15:03:50 +0000 (15:03 +0000)] 
media: i2c: imx415: Make HBLANK controllable and in consistent units

The control of HMAX documented in the datasheet is consistent
with being in terms of a scaled INCK, being always 72MHz or
74.25MHz. It is NOT link frequency dependent, but the minimum
value for HMAX is dictated by the link frequency.

If PIXEL_RATE is defined as being 12 times the 72 or 74.25MHz,
and all values are scaled down again when writing HMAX, then
the numbers all work out regardless of INCK or link frequency.
Retain an hmax_min (set to the same value as the previous fixed
hmax register value) to set as the default value to avoid changing
the behaviour for existing users.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Michael Riesch <michael.riesch@wolfvision.net>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: i2c: imx415: Add read/write control of VBLANK
Dave Stevenson [Wed, 29 Jan 2025 15:03:49 +0000 (15:03 +0000)] 
media: i2c: imx415: Add read/write control of VBLANK

This also requires that the ranges for the exposure control
are updated.

Reviewed-by: Michael Riesch <michael.riesch@wolfvision.net>
Signed-off-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>
5 months agomedia: v4l: Convert the users of v4l2_get_link_freq to call it on a pad
Sakari Ailus [Mon, 16 Dec 2024 09:25:31 +0000 (11:25 +0200)] 
media: v4l: Convert the users of v4l2_get_link_freq to call it on a pad

Call v4l2_get_link_freq() on a pad, instead of a control handler. This way
we can soon convert v4l2_get_link_freq() to be callable only on a pad and
remove the compatibility code.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Naushir Patuck <naush@raspberrypi.com> # rp1-cfe
Acked-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com> # st-mipid02
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: ivsc: csi: Obtain link frequency from the media pad
Sakari Ailus [Thu, 16 May 2024 12:25:39 +0000 (15:25 +0300)] 
media: ivsc: csi: Obtain link frequency from the media pad

Support the use of the media pad for obtaining the link frequency.
Similarly, call the v4l2_get_link_freq() on the media pad, not on the
remote's control handler.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: intel/ipu6: Obtain link frequency from the remote subdev pad
Sakari Ailus [Mon, 29 Apr 2024 09:19:40 +0000 (12:19 +0300)] 
media: intel/ipu6: Obtain link frequency from the remote subdev pad

Obtain the link frequency from the sub-device's pad instead of a control
handler. This allows obtaining it using the get_mbus_config() sub-device
pad op which is the only method supported by the IVSC driver.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: v4l: Memset argument to 0 before calling get_mbus_config pad op
Sakari Ailus [Mon, 16 Dec 2024 08:48:49 +0000 (10:48 +0200)] 
media: v4l: Memset argument to 0 before calling get_mbus_config pad op

Memset the config argument to get_mbus_config V4L2 sub-device pad
operation to zero before calling the operation. This ensures the callers
don't need to bother with it nor the implementations need to set all
fields that may not be relevant to them.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: Documentation: Receiver drivers should call v4l2_get_link_freq()
Sakari Ailus [Mon, 16 Dec 2024 08:26:22 +0000 (10:26 +0200)] 
media: Documentation: Receiver drivers should call v4l2_get_link_freq()

Document that receiver drivers should call v4l2_get_link_freq() to obtain
the link frequency.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: Documentation: tx-rx: Move transmitter control out of CSI-2 part
Sakari Ailus [Mon, 16 Dec 2024 08:10:40 +0000 (10:10 +0200)] 
media: Documentation: tx-rx: Move transmitter control out of CSI-2 part

The subsection on stopping the transmitter belongs to the generic part and
is not specific to CSI-2. Move it out of the CSI-2 section.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: Documentation: Update link frequency driver documentation
Sakari Ailus [Thu, 16 May 2024 12:25:38 +0000 (15:25 +0300)] 
media: Documentation: Update link frequency driver documentation

Add the get_mbus_config() as the means for conveying the link frequency
towards the receiver drivers.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: v4l: Support obtaining link frequency via get_mbus_config
Sakari Ailus [Mon, 29 Apr 2024 08:44:22 +0000 (11:44 +0300)] 
media: v4l: Support obtaining link frequency via get_mbus_config

Add link_freq field to struct v4l2_mbus_config in order to pass the link
frequency to the receiving sub-device.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: v4l: Support passing media pad argument to v4l2_get_link_freq()
Sakari Ailus [Mon, 29 Apr 2024 08:38:23 +0000 (11:38 +0300)] 
media: v4l: Support passing media pad argument to v4l2_get_link_freq()

v4l2_get_link_freq() accepts a V4L2 control handler for now, but it needs
to take struct media_pad argument in order to obtain the link frequency
using get_mbus_config() pad op. Prepare for this by allowing struct
media_pad as well.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: pci: ipu6: drop vb2_ops_wait_prepare/finish
Hans Verkuil [Tue, 28 Jan 2025 15:02:53 +0000 (16:02 +0100)] 
media: pci: ipu6: drop vb2_ops_wait_prepare/finish

Since commit 88785982a19d ("media: vb2: use lock if wait_prepare/finish
are NULL") it is no longer needed to set the wait_prepare/finish
vb2_ops callbacks as long as the lock field in vb2_queue is set.

Since the vb2_ops_wait_prepare/finish callbacks already rely on that field,
we can safely drop these callbacks.

This simplifies the code and this is a step towards the goal of deleting
these callbacks.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: i2c: ov7251: Introduce 1 ms delay between regulators and en GPIO
Sakari Ailus [Fri, 17 Jan 2025 14:04:02 +0000 (16:04 +0200)] 
media: i2c: ov7251: Introduce 1 ms delay between regulators and en GPIO

Lift the xshutdown (enable) GPIO 1 ms after enabling the regulators, as
required by the sensor's power-up sequence.

Fixes: d30bb512da3d ("media: Add a driver for the ov7251 camera sensor")
Cc: stable@vger.kernel.org
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: i2c: ov7251: Set enable GPIO low in probe
Sakari Ailus [Fri, 17 Jan 2025 13:38:13 +0000 (15:38 +0200)] 
media: i2c: ov7251: Set enable GPIO low in probe

Set the enable GPIO low when acquiring it.

Fixes: d30bb512da3d ("media: Add a driver for the ov7251 camera sensor")
Cc: stable@vger.kernel.org
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: i2c: imx319: Rectify runtime PM handling probe and remove
Sakari Ailus [Fri, 10 Jan 2025 12:55:59 +0000 (14:55 +0200)] 
media: i2c: imx319: Rectify runtime PM handling probe and remove

Idle the device only after the async sub-device has been successfully
registered. In error handling, set the device's runtime PM status to
suspended only if it has been set to active previously in probe.

Also set the device's runtime PM status to suspended in remove only if it
wasn't so already.

Fixes: 8a89dc62f28c ("media: add imx319 camera sensor driver")
Cc: stable@vger.kernel.org # for >= v6.12
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: i2c: imx219: Rectify runtime PM handling in probe and remove
Sakari Ailus [Fri, 10 Jan 2025 12:53:20 +0000 (14:53 +0200)] 
media: i2c: imx219: Rectify runtime PM handling in probe and remove

Set the device's runtime PM status and enable runtime PM before
registering the async sub-device. This is needed to avoid the case where
the device is runtime PM resumed while runtime PM has not been enabled
yet.

Also set the device's runtime PM status to suspended in remove only if it
wasn't so already.

Fixes: 1283b3b8f82b ("media: i2c: Add driver for Sony IMX219 sensor")
Cc: stable@vger.kernel.org # for >= v6.6
Reviewed-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>
5 months agomedia: i2c: ccs: Set the device's runtime PM status correctly in probe
Sakari Ailus [Fri, 10 Jan 2025 13:54:22 +0000 (15:54 +0200)] 
media: i2c: ccs: Set the device's runtime PM status correctly in probe

Set the device's runtime PM status to suspended in probe error paths where
it was previously set to active.

Fixes: 9447082ae666 ("[media] smiapp: Implement power-on and power-off sequences without runtime PM")
Cc: stable@vger.kernel.org # for >= v5.15
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: i2c: ccs: Set the device's runtime PM status correctly in remove
Sakari Ailus [Fri, 10 Jan 2025 12:50:27 +0000 (14:50 +0200)] 
media: i2c: ccs: Set the device's runtime PM status correctly in remove

Set the device's runtime PM status to suspended in device removal only if
it wasn't suspended already.

Fixes: 9447082ae666 ("[media] smiapp: Implement power-on and power-off sequences without runtime PM")
Cc: stable@vger.kernel.org # for >= v5.15
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: stm32: dcmipp: add has_csi2 & needs_mclk in match data
Alain Volmat [Mon, 13 Jan 2025 08:57:59 +0000 (09:57 +0100)] 
media: stm32: dcmipp: add has_csi2 & needs_mclk in match data

Introduce two variable has_csi and has_mclk within the
match data of the driver in order to know, depending on
the compatible if CSI-2 interface is available and if
the mclk clk should be retrieved.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: stm32: csi: correct unsigned or useless variable settings
Alain Volmat [Mon, 13 Jan 2025 08:57:58 +0000 (09:57 +0100)] 
media: stm32: csi: correct unsigned or useless variable settings

Correct several missing unsigned type missing for loop variables
and also remove useless initialization of variables.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: stm32: csi: remove useless fwnode_graph_get_endpoint call
Alain Volmat [Mon, 13 Jan 2025 08:57:57 +0000 (09:57 +0100)] 
media: stm32: csi: remove useless fwnode_graph_get_endpoint call

The endpoint is already retrieved at the beginning of the function
stm32_csi_parse_dt hence keep the endpoint pointer until the end
instead of getting a new one.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: stm32: csi: simplify enable_streams error handling
Alain Volmat [Mon, 13 Jan 2025 08:57:56 +0000 (09:57 +0100)] 
media: stm32: csi: simplify enable_streams error handling

Put all error handling for VC stop and CSI stop together
to avoid duplication of code.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: stm32: csi: use ARRAY_SIZE to search D-PHY table
Alain Volmat [Mon, 13 Jan 2025 08:57:55 +0000 (09:57 +0100)] 
media: stm32: csi: use ARRAY_SIZE to search D-PHY table

Within stm32_csi_start, use ARRAY_SIZE loop in order to search
for the right setting.
Avoid useless init of lanes_ie / lanes_en.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: stm32: csi: register subdev only at end of probe
Alain Volmat [Mon, 13 Jan 2025 08:57:54 +0000 (09:57 +0100)] 
media: stm32: csi: register subdev only at end of probe

Call v4l2_async_register_subdev only whenever all initialization
are completed at the end of the probe function.
Remove as well useless err_free_priv label by returning directly
upon error.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: stm32: csi: add missing pm_runtime_put on error
Alain Volmat [Mon, 13 Jan 2025 08:57:53 +0000 (09:57 +0100)] 
media: stm32: csi: add missing pm_runtime_put on error

Within the stm32_csi_start function, pm_runtime_put should
be called upon error following pm_runtime_get_sync.
Rework the function error handling by putting a label in
order to have common error handling for all calls requiring
pm_runtime_put.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agodt-bindings: media: clarify stm32 csi & simplify example
Alain Volmat [Mon, 13 Jan 2025 08:57:52 +0000 (09:57 +0100)] 
dt-bindings: media: clarify stm32 csi & simplify example

Clarify the description of the stm32 CSI by mentioning CSI-2 and D-PHY.
Remove the bus-type property from the example since this CSI has a D-PHY,
which is the only bus-type option, making this property redundant.

Acked-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: stm32: dcmipp: correct ret type in dcmipp_graph_notify_bound
Alain Volmat [Mon, 13 Jan 2025 08:57:51 +0000 (09:57 +0100)] 
media: stm32: dcmipp: correct ret type in dcmipp_graph_notify_bound

The ret variable used within the function dcmipp_graph_notify_bound is
wrongly defined as unsigned int while it can also be signed.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: i2c: ov2740: Small cleanups
Sakari Ailus [Fri, 10 Jan 2025 07:36:45 +0000 (09:36 +0200)] 
media: i2c: ov2740: Small cleanups

Small cleanups for the driver, namely removal of OV2740_NUM_SUPPLIES
macro, use of unsigned int for a loop and printing the missing "0x" for a
hexadecimal number.

Co-developed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: i2c: ov2740: Free control handler on error path
Sakari Ailus [Fri, 10 Jan 2025 07:33:33 +0000 (09:33 +0200)] 
media: i2c: ov2740: Free control handler on error path

The control handler wasn't freed if v4l2_fwnode_device_parse() failed. Do
that now.

Co-developed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: i2c: imx214: Fix link frequency validation
AndrĂ© Apitzsch [Fri, 20 Dec 2024 13:26:12 +0000 (14:26 +0100)] 
media: i2c: imx214: Fix link frequency validation

The driver defines IMX214_DEFAULT_LINK_FREQ 480000000, and then
IMX214_DEFAULT_PIXEL_RATE ((IMX214_DEFAULT_LINK_FREQ * 8LL) / 10),
which works out as 384MPix/s. (The 8 is 4 lanes and DDR.)

Parsing the PLL registers with the defined 24MHz input. We're in single
PLL mode, so MIPI frequency is directly linked to pixel rate.  VTCK ends
up being 1200MHz, and VTPXCK and OPPXCK both are 120MHz.  Section 5.3
"Frame rate calculation formula" says "Pixel rate
[pixels/s] = VTPXCK [MHz] * 4", so 120 * 4 = 480MPix/s, which basically
agrees with my number above.

3.1.4. MIPI global timing setting says "Output bitrate = OPPXCK * reg
0x113[7:0]", so 120MHz * 10, or 1200Mbit/s. That would be a link
frequency of 600MHz due to DDR.
That also matches to 480MPix/s * 10bpp / 4 lanes / 2 for DDR.

Keep the previous link frequency for backward compatibility.

Acked-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: André Apitzsch <git@apitzsch.eu>
Fixes: 436190596241 ("media: imx214: Add imx214 camera sensor driver")
Cc: stable@vger.kernel.org
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: i2c: imx214: Add test pattern control
AndrĂ© Apitzsch [Fri, 20 Dec 2024 13:26:10 +0000 (14:26 +0100)] 
media: i2c: imx214: Add test pattern control

This adds V4L2_CID_TEST_PATTERN control support.

Acked-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: André Apitzsch <git@apitzsch.eu>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: i2c: imx214: Verify chip ID
AndrĂ© Apitzsch [Fri, 20 Dec 2024 13:26:09 +0000 (14:26 +0100)] 
media: i2c: imx214: Verify chip ID

Check the chip ID and stop probing if it is no imx214 sensor.

Acked-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: André Apitzsch <git@apitzsch.eu>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: i2c: imx214: Add analogue/digital gain control
AndrĂ© Apitzsch [Fri, 20 Dec 2024 13:26:08 +0000 (14:26 +0100)] 
media: i2c: imx214: Add analogue/digital gain control

The imx214 sensor supports analogue gain up to 8x and digital gain up to
16x. Implement the corresponding controls in the driver. Default gain
values are not modified by this patch.

Acked-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: André Apitzsch <git@apitzsch.eu>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: i2c: imx214: Implement vflip/hflip controls
AndrĂ© Apitzsch [Fri, 20 Dec 2024 13:26:07 +0000 (14:26 +0100)] 
media: i2c: imx214: Implement vflip/hflip controls

The imx214 sensor supports horizontal and vertical flipping. Add
appropriate controls to the driver.

Acked-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: André Apitzsch <git@apitzsch.eu>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: i2c: imx214: Add vblank and hblank controls
AndrĂ© Apitzsch [Fri, 20 Dec 2024 13:26:06 +0000 (14:26 +0100)] 
media: i2c: imx214: Add vblank and hblank controls

Add vblank control to allow changing the framerate /
higher exposure values.

The vblank and hblank controls are needed for libcamera support.

While at it, fix the minimal exposure time according to the datasheet.

Signed-off-by: André Apitzsch <git@apitzsch.eu>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: i2c: imx214: Check number of lanes from device tree
AndrĂ© Apitzsch [Fri, 20 Dec 2024 13:26:05 +0000 (14:26 +0100)] 
media: i2c: imx214: Check number of lanes from device tree

The imx214 camera is capable of either two-lane or four-lane operation.

Currently only the four-lane mode is supported, as proper pixel rates
and link frequences for the two-lane mode are unknown.

Acked-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: André Apitzsch <git@apitzsch.eu>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: i2c: imx214: Drop IMX214_REG_EXPOSURE from mode reg arrays
AndrĂ© Apitzsch [Fri, 20 Dec 2024 13:26:04 +0000 (14:26 +0100)] 
media: i2c: imx214: Drop IMX214_REG_EXPOSURE from mode reg arrays

The IMX214_REG_EXPOSURE is configured twice, once with a hardcoded value
in the mode_<res> registers arrays, and once via v4l2_ctrl_ops. The
latter is enough, drop the former.

Acked-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: André Apitzsch <git@apitzsch.eu>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: i2c: imx214: Replace register addresses with macros
AndrĂ© Apitzsch [Fri, 20 Dec 2024 13:26:03 +0000 (14:26 +0100)] 
media: i2c: imx214: Replace register addresses with macros

Define macros for all the known registers used in the register arrays,
and use them to replace the numerical addresses. This improves
readability.

Acked-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: André Apitzsch <git@apitzsch.eu>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: i2c: imx214: Convert to CCI register access helpers
AndrĂ© Apitzsch [Fri, 20 Dec 2024 13:26:02 +0000 (14:26 +0100)] 
media: i2c: imx214: Convert to CCI register access helpers

Use the new common CCI register access helpers to replace the private
register access helpers in the imx214 driver. This simplifies the driver
by reducing the amount of code.

Acked-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: André Apitzsch <git@apitzsch.eu>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: i2c: imx214: Simplify with dev_err_probe()
AndrĂ© Apitzsch [Fri, 20 Dec 2024 13:26:01 +0000 (14:26 +0100)] 
media: i2c: imx214: Simplify with dev_err_probe()

Error handling in probe() can be a bit simpler with dev_err_probe().

Acked-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: André Apitzsch <git@apitzsch.eu>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: i2c: imx214: Use subdev active state
AndrĂ© Apitzsch [Fri, 20 Dec 2024 13:26:00 +0000 (14:26 +0100)] 
media: i2c: imx214: Use subdev active state

Port the imx214 sensor driver to use the subdev active state.

Move all the format configuration to the subdevice state and simplify
the format handling, locking and initialization.

While at it, simplify imx214_start_streaming() by removing unneeded goto
statements and the corresponding error label.

Signed-off-by: André Apitzsch <git@apitzsch.eu>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: i2c: imx214: Rectify probe error handling related to runtime PM
Sakari Ailus [Fri, 10 Jan 2025 12:36:01 +0000 (14:36 +0200)] 
media: i2c: imx214: Rectify probe error handling related to runtime PM

There were multiple issues in the driver's probe function related to
error handling:

- Device's PM runtime status wasn't reverted to suspended on some errors
  in probe.

- Runtime PM was left enabled for the device on some probe errors.

- Device was left powered on if a probe failure happened or when it
  was removed when it was powered on.

- An extra pm_runtime_set_suspended() was issued in driver's remove
  function when the device was suspended.

Fix these bugs.

Fixes: 436190596241 ("media: imx214: Add imx214 camera sensor driver")
Cc: stable@vger.kernel.org # for >= v6.12
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: André Apitzsch <git@apitzsch.eu>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agoRevert "media: imx214: Fix the error handling in imx214_probe()"
Sakari Ailus [Fri, 10 Jan 2025 08:11:51 +0000 (10:11 +0200)] 
Revert "media: imx214: Fix the error handling in imx214_probe()"

This reverts commit 9bc92332cc3f06fda3c6e2423995ca2da0a7ec9a.

Revert this "fix" as it's not really helpful but makes backporting a
proper fix harder.

Fixes: 9bc92332cc3f ("media: imx214: Fix the error handling in imx214_probe()")
Cc: stable@vger.kernel.org # for >= v6.12
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: ov08x40: Don't log ov08x40_check_hwcfg() errors twice
Hans de Goede [Fri, 20 Dec 2024 14:41:30 +0000 (15:41 +0100)] 
media: ov08x40: Don't log ov08x40_check_hwcfg() errors twice

All ov08x40_check_hwcfg() error-exit paths already log a detailed reason,
logging a second generic "failed to check hwcfg" error is not useful, and
in case of the fwnode check failing with -EPROBE_DEFER this is outright
problematic flooding the log with:

[    4.557059] ov08x40 i2c-OVTI08F4:00: failed to check hwcfg: -517
[    4.559636] ov08x40 i2c-OVTI08F4:00: failed to check hwcfg: -517
etc.

messages.

The one exception to all ov08x40_check_hwcfg() error-exit paths already
logging an error is on v4l2_fwnode_endpoint_alloc_parse() errors.

Make ov08x40_check_hwcfg() log an error in that case too and drop
the duplicate "failed to check hwcfg: %d\n" error logging.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: ov08x40: Add missing '\n' to ov08x40_check_hwcfg() error messages
Hans de Goede [Fri, 20 Dec 2024 14:41:29 +0000 (15:41 +0100)] 
media: ov08x40: Add missing '\n' to ov08x40_check_hwcfg() error messages

A number of dev_err() error messages miss a terminating '\n', add
the missing '\n' to these.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: ov08x40: Add missing ov08x40_identify_module() call on stream-start
Hans de Goede [Fri, 20 Dec 2024 14:41:28 +0000 (15:41 +0100)] 
media: ov08x40: Add missing ov08x40_identify_module() call on stream-start

The driver might skip the ov08x40_identify_module() on probe() based on
the acpi_dev_state_d0() check done in probe().

If the ov08x40_identify_module() call is skipped on probe() it should
be done on the first stream start. Add the missing call.

Note ov08x40_identify_module() will only do something on its first call,
subsequent calls are no-ops.

Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Fixes: b1a42fde6e07 ("media: ov08x40: Avoid sensor probing in D0 state")
Cc: stable@vger.kernel.org
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: ov08x40: Improve ov08x40_[read|write]_reg() error returns
Hans de Goede [Fri, 20 Dec 2024 14:41:27 +0000 (15:41 +0100)] 
media: ov08x40: Improve ov08x40_[read|write]_reg() error returns

Improve ov08x40_[read|write]_reg() error returns, if we got an errno value
from the I2C core use that instead of always returning -EIO.

Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: ov08x40: Improve ov08x40_identify_module() error logging
Hans de Goede [Fri, 20 Dec 2024 14:41:26 +0000 (15:41 +0100)] 
media: ov08x40: Improve ov08x40_identify_module() error logging

ov08x40_identify_module() already logs an error if the read ID mismatches,
so having its caller also log an error results in 2 errors in this case.

Add error logging to the ID register read in ov08x40_identify_module() and
drop the error logging in the caller.

Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: ov08x40: Move ov08x40_identify_module() function up
Hans de Goede [Fri, 20 Dec 2024 14:41:25 +0000 (15:41 +0100)] 
media: ov08x40: Move ov08x40_identify_module() function up

Move the ov08x40_identify_module() function to above ov08x40_set_stream()
this is a preparation patch for adding a missing ov08x40_identify_module()
call to ov08x40_set_stream().

No functional changes, just moving code around.

Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: ov08x40: Get clock on ACPI platforms too
Hans de Goede [Fri, 20 Dec 2024 14:41:24 +0000 (15:41 +0100)] 
media: ov08x40: Get clock on ACPI platforms too

ACPI platforms might also have a clk provider which needs to be controlled,
always try to get a clk using clk_get_optional() and when that fails fall
back to getting the xvclk frequency from the "clock-frequency" property.

Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: ov08x40: Get reset GPIO and regulators on ACPI platforms too
Hans de Goede [Fri, 20 Dec 2024 14:41:23 +0000 (15:41 +0100)] 
media: ov08x40: Get reset GPIO and regulators on ACPI platforms too

ACPI platforms might also have a reset GPIO and regulators, move the code
to get these outside of the if (!is_acpi_node(fwnode)) check.

This also removes the is_acpi_node(fwnode) checks from ov08x40_power_on() /
ov08x40_power_off() both the GPIO hand the clk frameworks functions used
there will happily accept the NULL pointer returned from the optional get()
functions when there is no reset GPIO / no clk.

While moving the code around also at error logging to the error exit
path for getting the reset GPIO.

Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: ov08x40: Move fwnode_graph_get_next_endpoint() call up
Hans de Goede [Fri, 20 Dec 2024 14:41:22 +0000 (15:41 +0100)] 
media: ov08x40: Move fwnode_graph_get_next_endpoint() call up

If the bridge has not yet setup the fwnode-graph then
the fwnode_property_read_u32("clock-frequency") call will fail.

Make the fwnode_graph_get_next_endpoint() call the first call in
ov08x40_check_hwcfg() and return -EPROBE_DEFER if it fails.

Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: ov08x40: Properly turn sensor on/off when runtime-suspended
Hans de Goede [Fri, 20 Dec 2024 14:41:21 +0000 (15:41 +0100)] 
media: ov08x40: Properly turn sensor on/off when runtime-suspended

Commit df1ae2251a50 ("media: ov08x40: Add OF probe support") added support
for a reset GPIO, regulators and a clk provider controlled through new
ov08x40_power_off() and ov08x40_power_on() functions.

But it missed adding a pm ops structure to call these functions on
runtime suspend/resume. Add the missing pm ops and only call
ov08x40_power_off() on remove() when not already runtime-suspended
to avoid unbalanced regulator / clock disable calls.

Fixes: df1ae2251a50 ("media: ov08x40: Add OF probe support")
Cc: stable@vger.kernel.org
Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: hi556: Don't log hi556_check_hwcfg() errors twice
Hans de Goede [Thu, 19 Dec 2024 19:27:33 +0000 (20:27 +0100)] 
media: hi556: Don't log hi556_check_hwcfg() errors twice

All hi556_check_hwcfg() error-exit paths already log a detailed reason,
logging a second generic "failed to check HW configuration" error is not
useful, and in case of the fwnode check failing with -EPROBE_DEFER this
is outright problematic flooding the log with:

[    6.336318] hi556 i2c-INT3537:00: failed to check HW configuration: -517
[    6.339006] hi556 i2c-INT3537:00: failed to check HW configuration: -517
[    6.346293] hi556 i2c-INT3537:00: failed to check HW configuration: -517
[    6.356129] hi556 i2c-INT3537:00: failed to check HW configuration: -517
[    6.380316] hi556 i2c-INT3537:00: failed to check HW configuration: -517
etc.

The one exception to all hi556_check_hwcfg() error-exit paths already
logging an error is on v4l2_fwnode_endpoint_alloc_parse() errors.

Make hi556_check_hwcfg() log an error in that case too and drop
the duplicate "failed to check HW configuration" error logging.

Link: https://bugzilla.redhat.com/show_bug.cgi?id=2307279
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: hi556: Improve error logging when fwnode is not found
Hans de Goede [Thu, 19 Dec 2024 19:27:32 +0000 (20:27 +0100)] 
media: hi556: Improve error logging when fwnode is not found

The hi556 driver waits for the endpoint fwnode to show up in case this
fwnode is created by a bridge-driver.

It does this by returning -EPROBE_DEFER, but it does not use
dev_err_probe() so no reason for deferring gets registered.

After 30 seconds the kernel logs a warning that the probe is still
deferred, which looks like this:

[   33.952052] i2c i2c-INT3537:00: deferred probe pending: (reason unknown)

Use dev_err_probe() when returning -EPROBE_DEFER to register the probe
deferral reason changing the error to:

deferred probe pending: waiting for fwnode graph endpoint

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: hi556: Add missing '\n' to hi556 error messages
Hans de Goede [Thu, 19 Dec 2024 19:27:31 +0000 (20:27 +0100)] 
media: hi556: Add missing '\n' to hi556 error messages

Many hi556 dev_err() error messages miss a terminating '\n', add
the missing '\n' to these.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: hi556: Fix memory leak (on error) in hi556_check_hwcfg()
Hans de Goede [Thu, 19 Dec 2024 19:27:30 +0000 (20:27 +0100)] 
media: hi556: Fix memory leak (on error) in hi556_check_hwcfg()

Commit 7d968b5badfc ("media: hi556: Return -EPROBE_DEFER if no endpoint is
found") moved the v4l2_fwnode_endpoint_alloc_parse() call in
hi556_check_hwcfg() up, but it did not make the error-exit paths between
the old and new call-site use "goto check_hwcfg_error;" to free the bus_cfg
on errors.

Add the missing "goto check_hwcfg_error;" statements to fix a memleak on
early error-exits from hi556_check_hwcfg().

Fixes: 7d968b5badfc ("media: hi556: Return -EPROBE_DEFER if no endpoint is found")
Cc: stable@vger.kernel.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: chips-media: wave5: Fix timeout while testing 10bit hevc fluster
Jackson.lee [Tue, 17 Dec 2024 04:51:25 +0000 (13:51 +0900)] 
media: chips-media: wave5: Fix timeout while testing 10bit hevc fluster

The Wave5 521C variant does not support 10 bit decoding. When 10 bit
decoding support was added for the 515 variant, a section of the code
was removed which returned an error. This removal causes a timeout for
the 521 variant, which was discovered during HEVC 10-bit decoding tests.

Fixes: 143e7ab4d9a0 ("media: chips-media: wave5: support decoding HEVC Main10 profile")
Cc: stable@vger.kernel.org
Signed-off-by: Jackson.lee <jackson.lee@chipsnmedia.com>
Signed-off-by: Nas Chung <nas.chung@chipsnmedia.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: chips-media: wave5: Fix a hang after seeking
Jackson.lee [Tue, 17 Dec 2024 04:51:24 +0000 (13:51 +0900)] 
media: chips-media: wave5: Fix a hang after seeking

While seeking, the driver calls the flush command. Before the flush
command is sent to the VPU, the driver should handle the display buffer
flags and should get all decoded information from the VPU if the VCORE
is running.

Fixes: 9707a6254a8a ("media: chips-media: wave5: Add the v4l2 layer")
Cc: stable@vger.kernel.org
Signed-off-by: Jackson.lee <jackson.lee@chipsnmedia.com>
Signed-off-by: Nas Chung <nas.chung@chipsnmedia.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: chips-media: wave5: Avoid race condition in the interrupt handler
Jackson.lee [Tue, 17 Dec 2024 04:51:23 +0000 (13:51 +0900)] 
media: chips-media: wave5: Avoid race condition in the interrupt handler

In case of multiple active instances, new interrupts can occur as soon
as the current interrupt is cleared. If the driver reads the
instance_info after clearing the interrupt, then there is no guarantee,
that the instance_info is still valid for the current interrupt.

Read the instance_info register for each interrupt before clearing the
interrupt.

Fixes: ed7276ed2fd0 ("media: chips-media: wave5: Add hrtimer based polling support")
Cc: stable@vger.kernel.org
Signed-off-by: Jackson.lee <jackson.lee@chipsnmedia.com>
Signed-off-by: Nas Chung <nas.chung@chipsnmedia.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: chips-media: wave5: Fix gray color on screen
Jackson.lee [Tue, 17 Dec 2024 04:51:22 +0000 (13:51 +0900)] 
media: chips-media: wave5: Fix gray color on screen

When a decoder instance is created, the W5_CMD_ERR_CONCEAL register
should be initialized to 0. Otherwise, gray color is occasionally
displayed on the screen while decoding.

Fixes: 45d1a2b93277 ("media: chips-media: wave5: Add vpuapi layer")
Cc: stable@vger.kernel.org
Signed-off-by: Jackson.lee <jackson.lee@chipsnmedia.com>
Signed-off-by: Nas Chung <nas.chung@chipsnmedia.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: rc: add keymap for Siemens Gigaset RC20 remote
Michael Klein [Thu, 9 Jan 2025 18:55:10 +0000 (19:55 +0100)] 
media: rc: add keymap for Siemens Gigaset RC20 remote

Add keymap for the Siemens Gigaset RC20 remote (RC-5).

Signed-off-by: Michael Klein <michael@fossekall.de>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: streamzap: prevent processing IR data on URB failure
Murad Masimov [Mon, 13 Jan 2025 10:51:31 +0000 (13:51 +0300)] 
media: streamzap: prevent processing IR data on URB failure

If streamzap_callback() receives an urb with any non-critical error
status, i.e. any error code other than -ECONNRESET, -ENOENT or -ESHUTDOWN,
it will try to process IR data, ignoring a possible transfer failure.

Make streamzap_callback() process IR data only when urb->status is 0.
Move processing logic to a separate function to make code cleaner and
more similar to the URB completion handlers in other RC drivers.

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

Fixes: 19770693c354 ("V4L/DVB: staging/lirc: add lirc_streamzap driver")
Cc: stable@vger.kernel.org
Signed-off-by: Murad Masimov <m.masimov@mt-integration.ru>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: streamzap: fix race between device disconnection and urb callback
Murad Masimov [Mon, 13 Jan 2025 10:51:30 +0000 (13:51 +0300)] 
media: streamzap: fix race between device disconnection and urb callback

Syzkaller has reported a general protection fault at function
ir_raw_event_store_with_filter(). This crash is caused by a NULL pointer
dereference of dev->raw pointer, even though it is checked for NULL in
the same function, which means there is a race condition. It occurs due
to the incorrect order of actions in the streamzap_disconnect() function:
rc_unregister_device() is called before usb_kill_urb(). The dev->raw
pointer is freed and set to NULL in rc_unregister_device(), and only
after that usb_kill_urb() waits for in-progress requests to finish.

If rc_unregister_device() is called while streamzap_callback() handler is
not finished, this can lead to accessing freed resources. Thus
rc_unregister_device() should be called after usb_kill_urb().

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

Fixes: 8e9e60640067 ("V4L/DVB: staging/lirc: port lirc_streamzap to ir-core")
Cc: stable@vger.kernel.org
Reported-by: syzbot+34008406ee9a31b13c73@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=34008406ee9a31b13c73
Signed-off-by: Murad Masimov <m.masimov@mt-integration.ru>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: qcom: camss: add support for SDM670 camss
Richard Acayan [Wed, 5 Feb 2025 03:50:16 +0000 (22:50 -0500)] 
media: qcom: camss: add support for SDM670 camss

The camera subsystem for the SDM670 the same as on SDM845 except with
3 CSIPHY ports instead of 4. Add support for the SDM670 camera
subsystem.

Signed-off-by: Richard Acayan <mailingradian@gmail.com>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agodt-bindings: media: camss: Add qcom,sdm670-camss
Richard Acayan [Wed, 5 Feb 2025 03:50:15 +0000 (22:50 -0500)] 
dt-bindings: media: camss: Add qcom,sdm670-camss

As found in the Pixel 3a, the Snapdragon 670 has a camera subsystem with
3 CSIDs and 3 VFEs (including 1 VFE lite). Add this camera subsystem to
the bindings.

Adapted from SC8280XP camera subsystem.

Signed-off-by: Richard Acayan <mailingradian@gmail.com>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: MAINTAINERS: add Qualcomm iris video accelerator driver
Dikshita Agarwal [Fri, 7 Feb 2025 07:55:08 +0000 (13:25 +0530)] 
media: MAINTAINERS: add Qualcomm iris video accelerator driver

Add an entry for the iris video decoder accelerator driver.

Signed-off-by: Vikash Garodia <quic_vgarodia@quicinc.com>
Tested-by: Stefan Schmidt <stefan.schmidt@linaro.org> # x1e80100 (Dell XPS 13 9345)
Reviewed-by: Stefan Schmidt <stefan.schmidt@linaro.org>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-HDK
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: iris: enable video driver probe of SM8250 SoC
Dikshita Agarwal [Fri, 7 Feb 2025 07:55:07 +0000 (13:25 +0530)] 
media: iris: enable video driver probe of SM8250 SoC

Initialize the platform data and enable video driver probe of SM8250
SoC.

Tested-by: Stefan Schmidt <stefan.schmidt@linaro.org> # x1e80100 (Dell XPS 13 9345)
Reviewed-by: Stefan Schmidt <stefan.schmidt@linaro.org>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-HDK
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: iris: add check to allow sub states transitions
Vedang Nagar [Fri, 7 Feb 2025 07:55:06 +0000 (13:25 +0530)] 
media: iris: add check to allow sub states transitions

Based on the design of the state machine, add checks whether the
transition from one sub-state to another is allowed.

Signed-off-by: Vedang Nagar <quic_vnagar@quicinc.com>
Tested-by: Stefan Schmidt <stefan.schmidt@linaro.org> # x1e80100 (Dell XPS 13 9345)
Reviewed-by: Stefan Schmidt <stefan.schmidt@linaro.org>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-HDK
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: iris: implement power scaling for vpu2 and vpu3
Vedang Nagar [Fri, 7 Feb 2025 07:55:05 +0000 (13:25 +0530)] 
media: iris: implement power scaling for vpu2 and vpu3

Implement power scaling including a specific vpu2 and vpu3 calculation
for clock and bus bandwidth, which depends on the hardware
configuration, codec format, resolution and frame rate.

Signed-off-by: Vedang Nagar <quic_vnagar@quicinc.com>
Tested-by: Stefan Schmidt <stefan.schmidt@linaro.org> # x1e80100 (Dell XPS 13 9345)
Reviewed-by: Stefan Schmidt <stefan.schmidt@linaro.org>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-HDK
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: iris: add check whether the video session is supported or not
Vedang Nagar [Fri, 7 Feb 2025 07:55:04 +0000 (13:25 +0530)] 
media: iris: add check whether the video session is supported or not

Based on the hardware capabilities, add a check during start_streaming
and queue_setup, whether the video session is supported by the hardware.

Signed-off-by: Vedang Nagar <quic_vnagar@quicinc.com>
Tested-by: Stefan Schmidt <stefan.schmidt@linaro.org> # x1e80100 (Dell XPS 13 9345)
Reviewed-by: Stefan Schmidt <stefan.schmidt@linaro.org>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-HDK
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: iris: add support for drain sequence
Dikshita Agarwal [Fri, 7 Feb 2025 07:55:03 +0000 (13:25 +0530)] 
media: iris: add support for drain sequence

handle the V4L2_DEC_CMD_STOP by initiating a drain sequence on the
firmware. Process and decode all OUTPUT buffers, that are  queued by the
client, before the VIDIOC_DECODER_CMD() was issued and mark the last
buffer with the V4L2_BUF_FLAG_LAST flag. The decoder is stopped, after
processing the last buffer.

Resume the decoder when one of these operations are issued by the client:
- V4L2_DEC_CMD_START
- pair of VIDIOC_STREAMOFF() and VIDIOC_STREAMON() on the CAPTURE queue
- pair of VIDIOC_STREAMOFF() and VIDIOC_STREAMON() on the OUTPUT queue

Add the handling to resume decoding when client issues
V4L2_DEC_CMD_START to resume decoding after a source change is detected.

Tested-by: Stefan Schmidt <stefan.schmidt@linaro.org> # x1e80100 (Dell XPS 13 9345)
Reviewed-by: Stefan Schmidt <stefan.schmidt@linaro.org>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-HDK
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: iris: handle streamoff/on from client in dynamic resolution change
Dikshita Agarwal [Fri, 7 Feb 2025 07:55:02 +0000 (13:25 +0530)] 
media: iris: handle streamoff/on from client in dynamic resolution change

The decoder is stopped after it completes the dynamic resolution change
sequence. Handle VIDIOC_STREAMOFF() and VIDIOC_STREAMON() on the CAPTURE
queue to resume the decoding process.

Tested-by: Stefan Schmidt <stefan.schmidt@linaro.org> # x1e80100 (Dell XPS 13 9345)
Reviewed-by: Stefan Schmidt <stefan.schmidt@linaro.org>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-HDK
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: iris: add support for dynamic resolution change
Dikshita Agarwal [Fri, 7 Feb 2025 07:55:01 +0000 (13:25 +0530)] 
media: iris: add support for dynamic resolution change

Handle the response sent by the firmware, when a source change is
detected. Read the subscribed parameter to get the changed values. Raise
the source change event to the client and update the instance sub-state.

Mark the last buffer from before the source change with the
V4L2_BUF_FLAG_LAST flag and return to the client.

Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl>
Tested-by: Stefan Schmidt <stefan.schmidt@linaro.org> # x1e80100 (Dell XPS 13 9345)
Reviewed-by: Stefan Schmidt <stefan.schmidt@linaro.org>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-HDK
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: iris: implement vb2 ops for buf_queue and firmware response
Dikshita Agarwal [Fri, 7 Feb 2025 07:55:00 +0000 (13:25 +0530)] 
media: iris: implement vb2 ops for buf_queue and firmware response

Implement the vb2 ops for the buf queue. These are the different buffer
attributes:
BUF_ATTR_DEFERRED - buffer queued by the client but not submitted to
                    firmware.
BUF_ATTR_PENDING_RELEASE - buffers requested to be released from
                           the firmware.
BUF_ATTR_QUEUED - buffers submitted to the firmware.
BUF_ATTR_DEQUEUED - buffers received from the firmware.
BUF_ATTR_BUFFER_DONE - buffers sent back to vb2.

Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl>
Tested-by: Stefan Schmidt <stefan.schmidt@linaro.org> # x1e80100 (Dell XPS 13 9345)
Reviewed-by: Stefan Schmidt <stefan.schmidt@linaro.org>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-HDK
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: iris: allocate, initialize and queue internal buffers
Dikshita Agarwal [Fri, 7 Feb 2025 07:54:59 +0000 (13:24 +0530)] 
media: iris: allocate, initialize and queue internal buffers

Implement the functions for creating, queueing, releasing and destroying
the buffers for internal usage.

Tested-by: Stefan Schmidt <stefan.schmidt@linaro.org> # x1e80100 (Dell XPS 13 9345)
Reviewed-by: Stefan Schmidt <stefan.schmidt@linaro.org>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-HDK
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: iris: subscribe parameters and properties to firmware for hfi_gen2
Vedang Nagar [Fri, 7 Feb 2025 07:54:58 +0000 (13:24 +0530)] 
media: iris: subscribe parameters and properties to firmware for hfi_gen2

For hfi_gen2, subscribe different bitstream parameters on to firmware,
to get notified of a change in any of the subscribed parameters.

Signed-off-by: Vedang Nagar <quic_vnagar@quicinc.com>
Tested-by: Stefan Schmidt <stefan.schmidt@linaro.org> # x1e80100 (Dell XPS 13 9345)
Reviewed-by: Stefan Schmidt <stefan.schmidt@linaro.org>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-HDK
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: iris: implement set properties to firmware during streamon
Vedang Nagar [Fri, 7 Feb 2025 07:54:57 +0000 (13:24 +0530)] 
media: iris: implement set properties to firmware during streamon

During the stream on operation, set some mandatory properties on the
firmware to start a session. Set all v4l2 properties, which are set by
the client, on to firmware, which is prepared with the dependency graph.

Signed-off-by: Vedang Nagar <quic_vnagar@quicinc.com>
Tested-by: Stefan Schmidt <stefan.schmidt@linaro.org> # x1e80100 (Dell XPS 13 9345)
Reviewed-by: Stefan Schmidt <stefan.schmidt@linaro.org>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-HDK
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: iris: implement vb2 streaming ops
Dikshita Agarwal [Fri, 7 Feb 2025 07:54:56 +0000 (13:24 +0530)] 
media: iris: implement vb2 streaming ops

During the stream on operation, send HFI_CMD_START on the capture and
output planes to start processing on the respective planes.

During the stream off operation, send HFI_CMD_STOP to the firmware,
which is a synchronous command. After the response is received by the
firmware, the session is closed on the firmware.

Introduce different states for the instance and state transitions.

IRIS_INST_INIT - video instance is opened.
IRIS_INST_INPUT_STREAMING - stream on is completed on output plane.
IRIS_INST_OUTPUT_STREAMING - stream on is completed on capture plane.
IRIS_INST_STREAMING - stream on is completed on both output and capture
planes.
IRIS_INST_DEINIT - video instance is closed.
IRIS_INST_ERROR - error state.

                   |
                   v
            -------------
  +---------|   INIT    |---------  +
  |         -------------           |
  |            ^    ^               |
  |           /      \              |
  |          /        \             |
  |         v          v            |
  |    -----------    -----------   |
  |   |   INPUT         OUTPUT  |   |
  |---| STREAMING     STREAMING |---|
  |    -----------    -----------   |
  |        ^            ^           |
  |         \          /            |
  |          \        /             |
  |           v      v              |
  |         -------------           |
  |--------|  STREAMING |-----------|
  |         -------------           |
  |               |                 |
  |               |                 |
  |               v                 |
  |          -----------            |
  +-------->|  DEINIT   |<----------+
  |          -----------            |
  |               |                 |
  |               |                 |
  |               v                 |
  |          ----------             |
  +-------->|   ERROR  |<-----------+
             ----------.

Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl>
Tested-by: Stefan Schmidt <stefan.schmidt@linaro.org> # x1e80100 (Dell XPS 13 9345)
Reviewed-by: Stefan Schmidt <stefan.schmidt@linaro.org>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-HDK
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: iris: implement query_cap ioctl
Vedang Nagar [Fri, 7 Feb 2025 07:54:55 +0000 (13:24 +0530)] 
media: iris: implement query_cap ioctl

Implement the query_cap ioctl with the necessary hooks.

Signed-off-by: Vedang Nagar <quic_vnagar@quicinc.com>
Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl>
Tested-by: Stefan Schmidt <stefan.schmidt@linaro.org> # x1e80100 (Dell XPS 13 9345)
Reviewed-by: Stefan Schmidt <stefan.schmidt@linaro.org>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-HDK
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: iris: implement iris v4l2_ctrl_ops
Dikshita Agarwal [Fri, 7 Feb 2025 07:54:54 +0000 (13:24 +0530)] 
media: iris: implement iris v4l2_ctrl_ops

Initialize the control handler by reading the platform specific firmware
capabilities. Capabilities are features, which are supported by a
specific platform (SOC). Each capability is defined with a min, max,
range and default value and a corresponding HFI. Implement s_ctrl and
g_volatile_ctrl ctrl ops.

Co-developed-by: Vedang Nagar <quic_vnagar@quicinc.com>
Signed-off-by: Vedang Nagar <quic_vnagar@quicinc.com>
Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl>
Tested-by: Stefan Schmidt <stefan.schmidt@linaro.org> # x1e80100 (Dell XPS 13 9345)
Reviewed-by: Stefan Schmidt <stefan.schmidt@linaro.org>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-HDK
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: iris: implement subscribe_event and unsubscribe_event ioctls
Vedang Nagar [Fri, 7 Feb 2025 07:54:53 +0000 (13:24 +0530)] 
media: iris: implement subscribe_event and unsubscribe_event ioctls

Implement the subscribe_event and unsubscribe_event iocts with the
necessary hooks.

Signed-off-by: Vedang Nagar <quic_vnagar@quicinc.com>
Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl>
Tested-by: Stefan Schmidt <stefan.schmidt@linaro.org> # x1e80100 (Dell XPS 13 9345)
Reviewed-by: Stefan Schmidt <stefan.schmidt@linaro.org>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-HDK
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: iris: implement enum_fmt and enum_framesizes ioctls
Vedang Nagar [Fri, 7 Feb 2025 07:54:52 +0000 (13:24 +0530)] 
media: iris: implement enum_fmt and enum_framesizes ioctls

Implement the enum_fmt and enum_framesizes ioctls with the necessary
hooks.

Signed-off-by: Vedang Nagar <quic_vnagar@quicinc.com>
Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl>
Tested-by: Stefan Schmidt <stefan.schmidt@linaro.org> # x1e80100 (Dell XPS 13 9345)
Reviewed-by: Stefan Schmidt <stefan.schmidt@linaro.org>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-HDK
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: iris: implement g_selection ioctl
Vedang Nagar [Fri, 7 Feb 2025 07:54:51 +0000 (13:24 +0530)] 
media: iris: implement g_selection ioctl

Implement the g_selection ioctl op in the driver with the necessary
hooks.

Signed-off-by: Vedang Nagar <quic_vnagar@quicinc.com>
Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl>
Tested-by: Stefan Schmidt <stefan.schmidt@linaro.org> # x1e80100 (Dell XPS 13 9345)
Reviewed-by: Stefan Schmidt <stefan.schmidt@linaro.org>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-HDK
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: iris: implement s_fmt, g_fmt and try_fmt ioctls
Vedang Nagar [Fri, 7 Feb 2025 07:54:50 +0000 (13:24 +0530)] 
media: iris: implement s_fmt, g_fmt and try_fmt ioctls

Implement the s_fmt, g_fmt and try_fmt ioctl ops with the necessary
hooks.

Signed-off-by: Vedang Nagar <quic_vnagar@quicinc.com>
Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl>
Tested-by: Stefan Schmidt <stefan.schmidt@linaro.org> # x1e80100 (Dell XPS 13 9345)
Reviewed-by: Stefan Schmidt <stefan.schmidt@linaro.org>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-HDK
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: iris: implement reqbuf ioctl with vb2_queue_setup
Dikshita Agarwal [Fri, 7 Feb 2025 07:54:49 +0000 (13:24 +0530)] 
media: iris: implement reqbuf ioctl with vb2_queue_setup

Implement the reqbuf IOCTL op and the vb2_queue_setup vb2 op in the
driver with necessary hooks.

Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl>
Tested-by: Stefan Schmidt <stefan.schmidt@linaro.org> # x1e80100 (Dell XPS 13 9345)
Reviewed-by: Stefan Schmidt <stefan.schmidt@linaro.org>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-HDK
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 months agomedia: iris: implement power management
Dikshita Agarwal [Fri, 7 Feb 2025 07:54:48 +0000 (13:24 +0530)] 
media: iris: implement power management

Implement runtime power management for iris, including a platform
specific power on/off sequence.

Tested-by: Stefan Schmidt <stefan.schmidt@linaro.org> # x1e80100 (Dell XPS 13 9345)
Reviewed-by: Stefan Schmidt <stefan.schmidt@linaro.org>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-HDK
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>