]> git.ipfire.org Git - thirdparty/linux.git/log
thirdparty/linux.git
4 weeks agomedia: uvcvideo: Remove stream->is_streaming field
Ricardo Ribalda [Mon, 16 Jun 2025 15:24:41 +0000 (15:24 +0000)] 
media: uvcvideo: Remove stream->is_streaming field

The is_streaming field is used by modular PM to know if the device is
currently streaming or not.

With the transition to vb2 and fop helpers, we can use vb2 functions for
the same functionality. The great benefit is that vb2 already tracks the
streaming state for us.

Reviewed-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250616-uvc-fop-v4-4-250286570ee7@chromium.org
Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 weeks agomedia: uvcvideo: Split uvc_stop_streaming()
Ricardo Ribalda [Mon, 16 Jun 2025 15:24:40 +0000 (15:24 +0000)] 
media: uvcvideo: Split uvc_stop_streaming()

uvc_stop_streaming() is used for meta and video nodes. Split the function
in two to avoid confusion.

Use this opportunity to rename uvc_start_streaming() to
uvc_start_streaming_video(), as it is only called by the video nodes.

Reviewed-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250616-uvc-fop-v4-3-250286570ee7@chromium.org
Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 weeks agomedia: uvcvideo: Handle locks in uvc_queue_return_buffers
Ricardo Ribalda [Mon, 16 Jun 2025 15:24:39 +0000 (15:24 +0000)] 
media: uvcvideo: Handle locks in uvc_queue_return_buffers

Most of the calls to uvc_queue_return_buffers() wrap the call with
spin_lock_irq()/spin_unlock_irq().

Rename uvc_queue_return_buffers to __uvc_queue_return_buffers to
indicate that this is the version that does not handle locks and create
a new version of the function that handles the lock.

Reviewed-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250616-uvc-fop-v4-2-250286570ee7@chromium.org
Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 weeks agomedia: uvcvideo: Use vb2 ioctl and fop helpers
Hans Verkuil [Mon, 16 Jun 2025 15:24:38 +0000 (15:24 +0000)] 
media: uvcvideo: Use vb2 ioctl and fop helpers

When uvc was written the vb2 ioctl and file operation helpers didn't exist.

This patch switches uvc over to those helpers, which removes a lot of
boilerplate code and allows us to drop the 'privileges' scheme, since
that's now handled inside the vb2 helpers.

This makes it possible for uvc to fix the v4l2-compliance streaming tests:
 warn: v4l2-test-formats.cpp(1075): Could not set fmt2

This patch introduces a change on behavior on the uvcdriver to be
aligned with the rest of the subsystem. Now S_INPUT, S_PARM and
S_FORMAT do no grant exclusive ownership of the device.

There are other side effects, some better than others:
- Locking is now more coarse than before, the queue is locked for almost
  every ioctl.
- vidioc_querybuf() can now work when the queue is busy.

Future patches should look into the locking architecture of UVC to
remove one of stream->mutex or queue->mutex.

Reviewed-by: Hans de Goede <hansg@kernel.org>
Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl>
Co-developed-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250616-uvc-fop-v4-1-250286570ee7@chromium.org
Signed-off-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 weeks agomedia: imx8mq-mipi-csi2: Fix error code in imx8mq_mipi_csi_parse_dt()
Dan Carpenter [Wed, 25 Jun 2025 15:22:32 +0000 (10:22 -0500)] 
media: imx8mq-mipi-csi2: Fix error code in imx8mq_mipi_csi_parse_dt()

This was returning IS_ERR() where PTR_ERR() was intended.

Fixes: 642b70d526ab ("media: imx8mq-mipi-csi2: Add support for i.MX8QXP")
Cc: stable@vger.kernel.org
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Rui Miguel Silva <rui.silva@linaro.org>
Link: https://lore.kernel.org/r/9b6c7925-c9c4-44bd-acd5-1ef0e698eb87@sabinyo.mountain
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 weeks agomedia: v4l2-subdev: Remove g_pixelaspect operation
Niklas Söderlund [Sat, 5 Jul 2025 08:37:41 +0000 (10:37 +0200)] 
media: v4l2-subdev: Remove g_pixelaspect operation

There are no consumers or implementations left in tree for the subdevice
operation g_pixelaspect, delete it.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Link: https://lore.kernel.org/r/20250705083741.77517-4-niklas.soderlund+renesas@ragnatech.se
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 weeks agomedia: adv748x: Remove g_pixelaspect implementation
Niklas Söderlund [Sat, 5 Jul 2025 08:37:40 +0000 (10:37 +0200)] 
media: adv748x: Remove g_pixelaspect implementation

There are no consumer left of g_pixelaspect in the tree, remove the
implementation from the adv748x driver in preparation of removing it
from struct v4l2_subdev_video_ops all together.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Link: https://lore.kernel.org/r/20250705083741.77517-3-niklas.soderlund+renesas@ragnatech.se
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 weeks agomedia: adv7180: Remove g_pixelaspect implementation
Niklas Söderlund [Sat, 5 Jul 2025 08:37:39 +0000 (10:37 +0200)] 
media: adv7180: Remove g_pixelaspect implementation

There are no consumer left of g_pixelaspect in the tree, remove the
implementation from the adv7180 driver in preparation of removing it
from struct v4l2_subdev_video_ops all together.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Link: https://lore.kernel.org/r/20250705083741.77517-2-niklas.soderlund+renesas@ragnatech.se
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 weeks agomedia: rcar-csi2: Use the pad version of v4l2_get_link_freq()
Tomi Valkeinen [Fri, 30 May 2025 13:50:30 +0000 (16:50 +0300)] 
media: rcar-csi2: Use the pad version of v4l2_get_link_freq()

The pad-aware version of v4l2_get_link_freq() tries to retrieve the link
frequency from the media bus configuration using the get_mbus_config
operation, and only if the subdevice does not implement this operation
falls back to the old method of getting it using the V4L2_CID_LINK_FREQ
or V4L2_CID_PIXEL_RATE control.

Update the VIN driver to use the pad-aware version to be able to support
subdevices that only provides the link frequency in the media bus
configuration. As the implementation falls back to the old method if the
subdevice doesn't support get_mbus_config, or doesn't provide a link
frequency in the v4l2_mbus_config struct, this is fully backward
compatible.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Link: https://lore.kernel.org/r/20250530-rcar-streams-v3-1-026655df7138@ideasonboard.com
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 weeks agomedia: ivsc: Add MAINTAINERS entry
Sakari Ailus [Mon, 23 Jun 2025 07:06:19 +0000 (10:06 +0300)] 
media: ivsc: Add MAINTAINERS entry

The IVSC drivers seem to have never had a MAINTAINERS entry so add one
now.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Zhang Lixu <lixu.zhang@intel.com>
Acked-by: Bingbu Cao <bingbu.cao@intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 weeks agomedia: staging/ipu7: add CONFIG_PCI dependency
Arnd Bergmann [Wed, 9 Jul 2025 14:57:31 +0000 (16:57 +0200)] 
media: staging/ipu7: add CONFIG_PCI dependency

This driver fails to build when PCI is disabled:

drivers/staging/media/ipu7/ipu7.c: In function 'ipu7_pci_config_setup':
drivers/staging/media/ipu7/ipu7.c:2260:15: error: implicit declaration of function 'pci_enable_msi'; did you mean 'pci_enable_sriov'? [-Wimplicit-function-declaration]
drivers/staging/media/ipu7/ipu7.c:2775:1: error: data definition has no type or storage class [-Werror]
driver(ipu7_pci_driver);
drivers/staging/media/ipu7/ipu7.c:2764:26: error: 'ipu7_pci_driver' defined but not used [-Werror=unused-variable]

Add the required Kconfig dependency.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 weeks agomedia: staging/ipu7: avoid division by 64-bit value
Arnd Bergmann [Wed, 9 Jul 2025 14:56:56 +0000 (16:56 +0200)] 
media: staging/ipu7: avoid division by 64-bit value

On 32-bit targets, this causes a link failure:

x86_64-linux-ld: drivers/staging/media/ipu7/ipu7-isys-csi-phy.o: in function `ipu7_isys_phy_config':
ipu7-isys-csi-phy.c:(.text+0x1509): undefined reference to `__udivdi3'

Note that this does not divide a 64-bit number by a 32-bit one as usual,
but the other way round, which is something that the compiler should
really be able to figure out but does not (as of gcc-15).

A few lines higher, a similar division is done using the incorrect div_u64()
that truncates the 64-bit divisor to 32 bits.

Change both to use the safe but slow div64_u64() helper.

Fixes: a516d36bdc3d ("media: staging/ipu7: add IPU7 input system device driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 weeks agomedia: i2c: imx290: Remove unneeded assignment of subdev device pointer
Niklas Söderlund [Thu, 3 Jul 2025 21:42:06 +0000 (23:42 +0200)] 
media: i2c: imx290: Remove unneeded assignment of subdev device pointer

The core helper v4l2_i2c_subdev_init() already assignees the subdevices
dev pointer to the device associated with the i2c client passed to it.
And 'imx290->dev' is assigned to '&client->dev' already in probe before
calling imx290_subdev_init().

Remove the duplicated open-coded assignment in the driver, there is no
reason to do it twice.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 weeks agomedia: ov2659: Fix memory leaks in ov2659_probe()
Zhang Shurong [Sat, 5 Jul 2025 16:31:09 +0000 (00:31 +0800)] 
media: ov2659: Fix memory leaks in ov2659_probe()

ov2659_probe() doesn't properly free control handler resources in failure
paths, causing memory leaks. Add v4l2_ctrl_handler_free() to prevent these
memory leaks and reorder the ctrl_handler assignment for better code flow.

Fixes: c4c0283ab3cd ("[media] media: i2c: add support for omnivision's ov2659 sensor")
Cc: stable@vger.kernel.org
Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 weeks agomedia: ti: j721e-csi2rx: fix list_del corruption
Julien Massot [Mon, 30 Jun 2025 10:46:43 +0000 (12:46 +0200)] 
media: ti: j721e-csi2rx: fix list_del corruption

If ti_csi2rx_start_dma() fails in ti_csi2rx_dma_callback(), the buffer is
marked done with VB2_BUF_STATE_ERROR but is not removed from the DMA queue.
This causes the same buffer to be retried in the next iteration, resulting
in a double list_del() and eventual list corruption.

Fix this by removing the buffer from the queue before calling
vb2_buffer_done() on error.

This resolves a crash due to list_del corruption:
[   37.811243] j721e-csi2rx 30102000.ticsi2rx: Failed to queue the next buffer for DMA
[   37.832187]  slab kmalloc-2k start ffff00000255b000 pointer offset 1064 size 2048
[   37.839761] list_del corruption. next->prev should be ffff00000255bc28, but was ffff00000255d428. (next=ffff00000255b428)
[   37.850799] ------------[ cut here ]------------
[   37.855424] kernel BUG at lib/list_debug.c:65!
[   37.859876] Internal error: Oops - BUG: 00000000f2000800 [#1]  SMP
[   37.866061] Modules linked in: i2c_dev usb_f_rndis u_ether libcomposite dwc3 udc_core usb_common aes_ce_blk aes_ce_cipher ghash_ce gf128mul sha1_ce cpufreq_dt dwc3_am62 phy_gmii_sel sa2ul
[   37.882830] CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Not tainted 6.16.0-rc3+ #28 VOLUNTARY
[   37.890851] Hardware name: Bosch STLA-GSRV2-B0 (DT)
[   37.895737] pstate: 600000c5 (nZCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[   37.902703] pc : __list_del_entry_valid_or_report+0xdc/0x114
[   37.908390] lr : __list_del_entry_valid_or_report+0xdc/0x114
[   37.914059] sp : ffff800080003db0
[   37.917375] x29: ffff800080003db0 x28: 0000000000000007 x27: ffff800080e50000
[   37.924521] x26: 0000000000000000 x25: ffff0000016abb50 x24: dead000000000122
[   37.931666] x23: ffff0000016abb78 x22: ffff0000016ab080 x21: ffff800080003de0
[   37.938810] x20: ffff00000255bc00 x19: ffff00000255b800 x18: 000000000000000a
[   37.945956] x17: 20747562202c3832 x16: 6362353532303030 x15: 0720072007200720
[   37.953101] x14: 0720072007200720 x13: 0720072007200720 x12: 00000000ffffffea
[   37.960248] x11: ffff800080003b18 x10: 00000000ffffefff x9 : ffff800080f5b568
[   37.967396] x8 : ffff800080f5b5c0 x7 : 0000000000017fe8 x6 : c0000000ffffefff
[   37.974542] x5 : ffff00000fea6688 x4 : 0000000000000000 x3 : 0000000000000000
[   37.981686] x2 : 0000000000000000 x1 : ffff800080ef2b40 x0 : 000000000000006d
[   37.988832] Call trace:
[   37.991281]  __list_del_entry_valid_or_report+0xdc/0x114 (P)
[   37.996959]  ti_csi2rx_dma_callback+0x84/0x1c4
[   38.001419]  udma_vchan_complete+0x1e0/0x344
[   38.005705]  tasklet_action_common+0x118/0x310
[   38.010163]  tasklet_action+0x30/0x3c
[   38.013832]  handle_softirqs+0x10c/0x2e0
[   38.017761]  __do_softirq+0x14/0x20
[   38.021256]  ____do_softirq+0x10/0x20
[   38.024931]  call_on_irq_stack+0x24/0x60
[   38.028873]  do_softirq_own_stack+0x1c/0x40
[   38.033064]  __irq_exit_rcu+0x130/0x15c
[   38.036909]  irq_exit_rcu+0x10/0x20
[   38.040403]  el1_interrupt+0x38/0x60
[   38.043987]  el1h_64_irq_handler+0x18/0x24
[   38.048091]  el1h_64_irq+0x6c/0x70
[   38.051501]  default_idle_call+0x34/0xe0 (P)
[   38.055783]  do_idle+0x1f8/0x250
[   38.059021]  cpu_startup_entry+0x34/0x3c
[   38.062951]  rest_init+0xb4/0xc0
[   38.066186]  console_on_rootfs+0x0/0x6c
[   38.070031]  __primary_switched+0x88/0x90
[   38.074059] Code: b00037e0 91378000 f9400462 97e9bf49 (d4210000)
[   38.080168] ---[ end trace 0000000000000000 ]---
[   38.084795] Kernel panic - not syncing: Oops - BUG: Fatal exception in interrupt
[   38.092197] SMP: stopping secondary CPUs
[   38.096139] Kernel Offset: disabled
[   38.099631] CPU features: 0x0000,00002000,02000801,0400420b
[   38.105202] Memory Limit: none
[   38.108260] ---[ end Kernel panic - not syncing: Oops - BUG: Fatal exception in interrupt ]---

Fixes: b4a3d877dc92 ("media: ti: Add CSI2RX support for J721E")
Cc: stable@vger.kernel.org
Suggested-by: Sjoerd Simons <sjoerd@collabora.com>
Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
Signed-off-by: Julien Massot <julien.massot@collabora.com>
Reviewed-by: Jai Luthra <jai.luthra@linux.dev>
Tested-by: Dirk Behme <dirk.behme@de.bosch.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 weeks agomedia: hi556: correct the test pattern configuration
Bingbu Cao [Mon, 30 Jun 2025 09:04:20 +0000 (17:04 +0800)] 
media: hi556: correct the test pattern configuration

Hynix hi556 support 8 test pattern modes:
hi556_test_pattern_menu[] = {
{
"Disabled",
"Solid Colour",
"100% Colour Bars",
"Fade To Grey Colour Bars",
"PN9",
"Gradient Horizontal",
"Gradient Vertical",
"Check Board",
"Slant Pattern",
}

The test pattern is set by a 8-bit register according to the
specification.
+--------+-------------------------------+
| BIT[0] |  Solid color                  |
+--------+-------------------------------+
| BIT[1] |  Color bar                    |
+--------+-------------------------------+
| BIT[2] |  Fade to grey color bar       |
+--------+-------------------------------+
| BIT[3] |  PN9                          |
+--------+-------------------------------+
| BIT[4] |  Gradient horizontal          |
+--------+-------------------------------+
| BIT[5] |  Gradient vertical            |
+--------+-------------------------------+
| BIT[6] |  Check board                  |
+--------+-------------------------------+
| BIT[7] |  Slant pattern                |
+--------+-------------------------------+
Based on function above, current test pattern programming is wrong.
This patch fixes it by 'BIT(pattern - 1)'. If pattern is 0, driver
will disable the test pattern generation and set the pattern to 0.

Fixes: e62138403a84 ("media: hi556: Add support for Hi-556 sensor")
Cc: stable@vger.kernel.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 weeks agomedia: i2c: Automatically select common options for lens drivers
Hans de Goede [Thu, 3 Jul 2025 15:03:15 +0000 (17:03 +0200)] 
media: i2c: Automatically select common options for lens drivers

In commit 7d3c7d2a2914 ("media: i2c: Add a camera sensor top level menu")
a top level menu was added for sensor drivers so that all sensor drivers
would depend on I2C and so that MEDIA_CONTROLLER, V4L2_FWNODE and
VIDEO_V4L2_SUBDEV_API would be automatically selected for all sensor
drivers.

All lens drivers must depend on I2C and VIDEO_DEV and must select
MEDIA_CONTROLLER, V4L2_FWNODE and VIDEO_V4L2_SUBDEV_API and most already
do, but e.g. VIDEO_V4L2_SUBDEV_API is not consistenly selected.

Change the "Lens drivers" menu into a menuconfig option with
the necessary depends and selects. This ensures that these options are
depended on / selected consistently and simplifies the Kconfig snippets
for the various lens voice coil drivers.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202411061152.VKd9JYpa-lkp@intel.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>
4 weeks agomedia: hi556: Support full range of power rails
Hans de Goede [Sat, 31 May 2025 19:05:34 +0000 (21:05 +0200)] 
media: hi556: Support full range of power rails

Use regulator_bulk_* to get the array of potential power rails for
the hi556.

Previously the driver only supported avdd as only avdd is used on IPU6
designs. But other designs may also need the driver to control the other
power rails and the new INT3472 handshake support also makes use of
dvdd on IPU6 designs.

Link: https://bugzilla.redhat.com/show_bug.cgi?id=2368506
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>
4 weeks agomedia: hi556: Fix reset GPIO timings
Hans de Goede [Sat, 31 May 2025 19:05:33 +0000 (21:05 +0200)] 
media: hi556: Fix reset GPIO timings

probe() requests the reset GPIO to be set to high when getting it.
Immeditately after this hi556_resume() is called and sets the GPIO low.

If the GPIO was low before requesting it this will result in the GPIO
only very briefly spiking high and the sensor not being properly reset.
The same problem also happens on back to back runtime suspend + resume.

Fix this by adding a sleep of 2 ms in hi556_resume() before setting
the GPIO low (if there is a reset GPIO).

The final sleep is kept unconditional, because if there is e.g. no reset
GPIO but a controllable clock then the sensor also needs some time after
enabling the clock.

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>
4 weeks agomedia: v4l2-common: Add the missing Raw Bayer pixel formats
Mehdi Djait [Mon, 23 Jun 2025 13:51:16 +0000 (15:51 +0200)] 
media: v4l2-common: Add the missing Raw Bayer pixel formats

Add the Raw Bayer pixel formats infos for:
10-bit packed Bayer formats
12-bit packed Bayer formats
14-bit Bayer formats
14-bit packed Bayer formats
16-bit Bayer formats

Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 weeks agomedia: uapi: videodev2: Fix comment for 12-bit packed Bayer formats
Mehdi Djait [Mon, 23 Jun 2025 13:51:15 +0000 (15:51 +0200)] 
media: uapi: videodev2: Fix comment for 12-bit packed Bayer formats

For 12-bit packed Bayer formats: every two consecutive samples are
packed into three bytes. Fix the corresponding comment.

Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 weeks agomedia: ti: j721e-csi2rx: Allow passing cache hints from user-space
Devarsh Thakkar [Wed, 12 Mar 2025 11:21:40 +0000 (16:51 +0530)] 
media: ti: j721e-csi2rx: Allow passing cache hints from user-space

User-space can provide cache hints to enable software managed cache
operations or skip certain cache operations using memory flags and buffer
flags. This is useful for SoCs such as AM62px which do not support
hardware cache coherency.

This is tested on AM62px with yavta capture by passing
V4L2_MEMORY_FLAG_NON_COHERENT while using VIDIOC_REQBUFS and
V4L2_BUF_FLAG_NO_CACHE_CLEAN while using VIDIOC_QBUF and ~5x reduction in
memcpy time is seen for copying captured frame to DDR.

Link: https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1452545/am62p-the-ads6311-radar-camera-has-lost-frame-capture/5580472#5580472
Signed-off-by: Devarsh Thakkar <devarsht@ti.com>
Acked-by: Jai Luthra <jai.luthra@linux.dev>
[Sakari Ailus: Reword and rewrap the commit message a little.]
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 weeks agomedia: cadence: csi2rx: Enable csi2rx_err_irq interrupt and add support for VIDIOC_LO...
Yemike Abhilash Chandra [Wed, 16 Apr 2025 12:19:38 +0000 (17:49 +0530)] 
media: cadence: csi2rx: Enable csi2rx_err_irq interrupt and add support for VIDIOC_LOG_STATUS

Enable the csi2rx_err_irq interrupt to record any errors during streaming
and also add support for VIDIOC_LOG_STATUS ioctl. This allows users to
retrieve detailed error information during streaming, including FIFO
overflow, packet errors, and ECC errors.

Signed-off-by: Yemike Abhilash Chandra <y-abhilashchandra@ti.com>
Reviewed-by: Changhuang Liang <changhuang.liang@starfivetech.com>
Tested-by: Jai Luthra <jai.luthra@linux.dev>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 weeks agodt-bindings: media: cdns,csi2rx.yaml: Add optional interrupts for cdns-csi2rx
Yemike Abhilash Chandra [Wed, 16 Apr 2025 12:19:37 +0000 (17:49 +0530)] 
dt-bindings: media: cdns,csi2rx.yaml: Add optional interrupts for cdns-csi2rx

The Cadence CSI2RX IP exposes 2 interrupts [0] 12.7 camera subsystem.
So, add support for optional interrupts and interrupt-names properties.

[0]: http://www.ti.com/lit/pdf/spruil1

Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Jai Luthra <jai.luthra@linux.dev>
Signed-off-by: Yemike Abhilash Chandra <y-abhilashchandra@ti.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 weeks agomedia: v4l2-subdev: Add debug prints to v4l2_subdev_collect_streams()
Sakari Ailus [Tue, 3 Jun 2025 21:57:57 +0000 (00:57 +0300)] 
media: v4l2-subdev: Add debug prints to v4l2_subdev_collect_streams()

Print streams found by v4l2_subdev_collect_streams() at debug level. This
could be useful in debugging drivers, userspace programs or the framework
itself.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 weeks agomedia: v4l2-subdev: Print early in v4l2_subdev_{enable,disable}_streams()
Sakari Ailus [Tue, 3 Jun 2025 21:32:36 +0000 (00:32 +0300)] 
media: v4l2-subdev: Print early in v4l2_subdev_{enable,disable}_streams()

Print debug messages early in v4l2_subdev_enable_streams() and
v4l2_subdev_disable_streams(), before sanity checks take place. This can
help figuring out why something goes wrong, in driver development or
otherwise.

Also print the name of the sub-device where streaming is to be enabled or
disabled.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 weeks agomedia: v4l: Make media_entity_to_video_device() NULL-safe
Sakari Ailus [Wed, 11 Jun 2025 12:40:42 +0000 (15:40 +0300)] 
media: v4l: Make media_entity_to_video_device() NULL-safe

Make media_entity_to_video_device(NULL) return NULL, instead of an invalid
pointer value.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 weeks agomedia: ipu6: isys: Set minimum height to 1
Sakari Ailus [Fri, 9 May 2025 15:47:36 +0000 (18:47 +0300)] 
media: ipu6: isys: Set minimum height to 1

For image data generally 2 seems like a minimum height that surely won't
cause any issues, but some sensors have metadata the height of which is
just one line. Set the minimum height to 1.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 weeks agomedia: ipu6: isys: Use correct pads for xlate_streams()
Sakari Ailus [Mon, 2 Jun 2025 21:08:51 +0000 (00:08 +0300)] 
media: ipu6: isys: Use correct pads for xlate_streams()

The pad argument to v4l2_subdev_state_xlate_streams() is incorrect, static
pad number is used for the source pad even though the pad number is
dependent on the stream. Fix it.

Fixes: 3a5c59ad926b ("media: ipu6: Rework CSI-2 sub-device streaming control")
Cc: stable@vger.kernel.org
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 weeks agomedia: vivid: fix wrong pixel_array control size
Hans Verkuil [Sun, 6 Jul 2025 10:55:40 +0000 (12:55 +0200)] 
media: vivid: fix wrong pixel_array control size

The pixel_array control size was calculated incorrectly:
the dimensions were swapped (dims[0] should be the height), and the
values should be the width or height divided by PIXEL_ARRAY_DIV
and rounded up. So don't use roundup, but use DIV_ROUND_UP instead.

This bug is harmless in the sense that nothing will break, except that
it consumes way too much memory for this control.

Fixes: 6bc7643d1b9c ("media: vivid: add pixel_array test control")
Cc: <stable@vger.kernel.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks ago.mailmap: update Hans Verkuil's email addresses
Hans Verkuil [Tue, 24 Jun 2025 06:30:46 +0000 (08:30 +0200)] 
.mailmap: update Hans Verkuil's email addresses

Use hverkuil@kernel.org as the main address for kernel work.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: atomisp: Remove custom sysfs attributes from atomisp_drvfs.c
Abdelrahman Fekry [Fri, 4 Jul 2025 16:10:51 +0000 (19:10 +0300)] 
media: atomisp: Remove custom sysfs attributes from atomisp_drvfs.c

Continue the cleanup of the AtomISP driver, as discussed with Hans and Andy
in [1].

Tackle TODO item: "Remove custom sysfs files created by atomisp_drvfs.c":
- Remove the sysfs attributes `dbglvl`, `dbgfun`, and `dbgopt`.
- Delete their associated show/store handler functions.
- Remove the corresponding attribute group definitions.

Link: https://lore.kernel.org/all/836dc6b6-2821-47fc-8f24-0838f979af76@kernel.org/
Suggested-by: Hans de Goede <hansg@kernel.org>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Abdelrahman Fekry <abdelrahmanfekry375@gmail.com>
Link: https://lore.kernel.org/r/20250704161051.16733-1-abdelrahmanfekry375@gmail.com
[hansg@kernel.org: Completely remove the now empty atomisp_drvfs files]
Reviewed-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: atomisp: Fix premature setting of HMM_BO_DEVICE_INITED flag
Abdelrahman Fekry [Sat, 28 Jun 2025 05:25:36 +0000 (08:25 +0300)] 
media: atomisp: Fix premature setting of HMM_BO_DEVICE_INITED flag

The HMM_BO_DEVICE_INITED flag was being set in hmm_bo_device_init()
before key initialization steps like kmem_cache_create(),
kmem_cache_alloc(), and __bo_init().

This means that if any of these steps fail, the flag remains set,
misleading other parts of the driver (e.g. hmm_bo_alloc())
into thinking the device is initialized. This could lead
to undefined behavior or invalid memory use.

Additionally, since __bo_init() is called from inside
hmm_bo_device_init() after the flag was already set, its internal
check for HMM_BO_DEVICE_INITED is redundant.

- Move the flag assignment to the end after all allocations succeed.
- Remove redundant check of the flag inside __bo_init()

See the link [1] below for a backtrace which happens when deliberately
triggering the problem of the flag getting set too early.

Link: https://lore.kernel.org/linux-media/CAGn2d8ONZpOHXex8kjeUDgRPiMqKp8vZ=xhGbEDGphV1t7ZEFw@mail.gmail.com/
Signed-off-by: Abdelrahman Fekry <abdelrahmanfekry375@gmail.com>
Link: https://lore.kernel.org/r/20250628052536.43737-1-abdelrahmanfekry375@gmail.com
Reviewed-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: atomisp: Remove debug sysfs attributes active_bo and free_bo
Abdelrahman Fekry [Fri, 27 Jun 2025 10:06:04 +0000 (13:06 +0300)] 
media: atomisp: Remove debug sysfs attributes active_bo and free_bo

The sysfs attributes active_bo and free_bo expose internal buffer
state used only for debugging purposes. These are not part of
any standard kernel ABI, and need to be removed before this
driver may be moved out of drivers/staging.

- Remove active_bo and free_bo attributes
- Remove group registration calls form hmm_init() and hmm_cleanup()

Suggested-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Abdelrahman Fekry <abdelrahmanfekry375@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/20250627100604.29061-1-abdelrahmanfekry375@gmail.com
Reviewed-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: atomisp: Remove no more used macros from math_support.h
Andy Shevchenko [Mon, 19 May 2025 15:46:49 +0000 (18:46 +0300)] 
media: atomisp: Remove no more used macros from math_support.h

After recent cleanups the few macros become unused. Remove them.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20250519155028.526453-4-andriy.shevchenko@linux.intel.com
Reviewed-by: Hans de Goede <hansg@kernel.org>
Tested-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: atomisp: Replace macros from math_support.h
Andy Shevchenko [Mon, 19 May 2025 15:46:48 +0000 (18:46 +0300)] 
media: atomisp: Replace macros from math_support.h

Replace rarely used macros by generic ones from Linux kernel headers.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20250519155028.526453-3-andriy.shevchenko@linux.intel.com
Reviewed-by: Hans de Goede <hansg@kernel.org>
Tested-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: atomisp: Remove unused header
Andy Shevchenko [Mon, 19 May 2025 15:46:47 +0000 (18:46 +0300)] 
media: atomisp: Remove unused header

There are some unused definitions that are using macros from
math_support.h. In order to have cleaner future changes, remove them first.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20250519155028.526453-2-andriy.shevchenko@linux.intel.com
Reviewed-by: Hans de Goede <hansg@kernel.org>
Tested-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: atomisp: ov2722: Fix struct definition style
Thomas Andreatta [Thu, 19 Jun 2025 08:44:24 +0000 (10:44 +0200)] 
media: atomisp: ov2722: Fix struct definition style

Reorder const qualifier in array declaration.

Signed-off-by: Thomas Andreatta <thomas.andreatta2000@gmail.com>
Link: https://lore.kernel.org/r/20250619084420.146151-4-thomas.andreatta2000@gmail.com
Reviewed-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: atomisp: gc2235: Fix struct definition style
Thomas Andreatta [Thu, 19 Jun 2025 08:44:22 +0000 (10:44 +0200)] 
media: atomisp: gc2235: Fix struct definition style

Reorder const qualifier in array declaration.

Signed-off-by: Thomas Andreatta <thomas.andreatta2000@gmail.com>
Link: https://lore.kernel.org/r/20250619084420.146151-3-thomas.andreatta2000@gmail.com
Reviewed-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: atomisp: gc0310: Remove redundant debug message
Thomas Andreatta [Thu, 19 Jun 2025 08:44:20 +0000 (10:44 +0200)] 
media: atomisp: gc0310: Remove redundant debug message

Checkpatch fix: deleted `dev_dbg()` printing the name of the function.
                ftrace can be used instead.

Signed-off-by: Thomas Andreatta <thomas.andreatta2000@gmail.com>
Link: https://lore.kernel.org/r/20250619084420.146151-2-thomas.andreatta2000@gmail.com
Reviewed-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: atomisp: gc0310: Drop gc0310_g_skip_frames()
Hans de Goede [Sat, 17 May 2025 11:41:05 +0000 (13:41 +0200)] 
media: atomisp: gc0310: Drop gc0310_g_skip_frames()

The g_skip_frames sensor-op is obsolete, drop it.

Signed-off-by: Hans de Goede <hansg@kernel.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20250517114106.43494-23-hansg@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: atomisp: gc0310: Drop gc0310_get_frame_interval()
Hans de Goede [Sat, 17 May 2025 11:41:04 +0000 (13:41 +0200)] 
media: atomisp: gc0310: Drop gc0310_get_frame_interval()

On raw camera sensors the framerate is controlled through vblank
(and optional) hblank controls.

Having a get_frame_interval makes no sense in this case, drop it.

Signed-off-by: Hans de Goede <hansg@kernel.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20250517114106.43494-22-hansg@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: atomisp: gc0310: runtime-PM fixes
Hans de Goede [Sat, 17 May 2025 11:41:03 +0000 (13:41 +0200)] 
media: atomisp: gc0310: runtime-PM fixes

The i2c-client's power-domain has already been powered up when probe()
gets called. So e.g. ACPI resources for regulators and clks have
already been enabled and only the GPIOs need to be set to the on state.

Instead of calling pm_runtime_set_suspended() while the domain is
already powered up and then have detect() do a pm_runtime_get()
to set the GPIOs do the following:

1. Call gc0310_power_on() to only set the GPIOs
2. Set the device's runtime-PM state to active instead of suspended
3. Avoid the device getting suspended as soon as pm_runtime_enable()
   gets called by calling pm_runtime_get() before _enable(), this means
   moving the pm_runtime_get() / _put() from detect() to probe ()

This fixes power_on() not getting called when runtime-PM is not
enabled in the Kconfig and this keeps the sensor powered-up while
registering it avoiding unnecessary power cycles.

Also modify gc0310_remove() to power-off the device if it is in
active state when gc0310_remove() runs.

Signed-off-by: Hans de Goede <hansg@kernel.org>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20250517114106.43494-21-hansg@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: atomisp: gc0310: Move and rename suspend/resume functions
Hans de Goede [Sat, 17 May 2025 11:41:02 +0000 (13:41 +0200)] 
media: atomisp: gc0310: Move and rename suspend/resume functions

Move the suspend()/resume() functions to above gc0310_detect() and rename
the functions to power_off()/power_on().

No functional changes, this is a preparation patch for reworking
the runtime-pm handling in probe() and remove().

Signed-off-by: Hans de Goede <hansg@kernel.org>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20250517114106.43494-20-hansg@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: atomisp: gc0310: Switch to using sd.active_state fmt
Hans de Goede [Sat, 17 May 2025 11:41:01 +0000 (13:41 +0200)] 
media: atomisp: gc0310: Switch to using sd.active_state fmt

Stop having a v4l2_mbus_framefmt mode.fmt driver-data member to store
the fmt for the active-state, instead use sd.active_state fmt.

This also removes the need for gc0310_get_pad_format() since
v4l2_subdev_state_get_format() now will return the correct
v4l2_mbus_framefmt for all whence values.

Instead of switching gc0310_set_fmt() from gc0310_get_pad_format() to
v4l2_subdev_state_get_format() just drop it entirely since there is only
1 fixed mode. Otherwise the new gc0310_set_fmt() would be 100% the same
as v4l2_subdev_get_fmt() after this.

Signed-off-by: Hans de Goede <hansg@kernel.org>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20250517114106.43494-19-hansg@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: atomisp: gc0310: Use v4l2_subdev_get_fmt() as v4l2_subdev_pad_ops.get_fmt()
Hans de Goede [Sat, 17 May 2025 11:41:00 +0000 (13:41 +0200)] 
media: atomisp: gc0310: Use v4l2_subdev_get_fmt() as v4l2_subdev_pad_ops.get_fmt()

Now that the sd-state's fmt is properly initialized by
internal_ops.init_state(), the driver can be safely switched
to v4l2_subdev_get_fmt().

Signed-off-by: Hans de Goede <hansg@kernel.org>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20250517114106.43494-18-hansg@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: atomisp: gc0310: Implement internal_ops.init_state
Hans de Goede [Sat, 17 May 2025 11:40:59 +0000 (13:40 +0200)] 
media: atomisp: gc0310: Implement internal_ops.init_state

Implement internal_ops.init_state to fill in the v4l2_mbus_framefmt
struct in newly allocated sd-state structs.

Signed-off-by: Hans de Goede <hansg@kernel.org>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20250517114106.43494-17-hansg@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: atomisp: gc0310: Switch to using the sub-device state lock
Hans de Goede [Sat, 17 May 2025 11:40:58 +0000 (13:40 +0200)] 
media: atomisp: gc0310: Switch to using the sub-device state lock

Switch to using the sub-device state lock and properly call
v4l2_subdev_init_finalize() / v4l2_subdev_cleanup() on probe() /
remove().

Signed-off-by: Hans de Goede <hansg@kernel.org>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20250517114106.43494-16-hansg@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: atomisp: gc0310: Switch to {enable,disable}_streams
Hans de Goede [Sat, 17 May 2025 11:40:57 +0000 (13:40 +0200)] 
media: atomisp: gc0310: Switch to {enable,disable}_streams

Switch from s_stream() to enable_streams() and disable_streams() pad
operations. They are preferred and required for streams support.

Signed-off-by: Hans de Goede <hansg@kernel.org>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20250517114106.43494-15-hansg@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: atomisp: gc0310: Remove unused is_streaming variable
Hans de Goede [Sat, 17 May 2025 11:40:56 +0000 (13:40 +0200)] 
media: atomisp: gc0310: Remove unused is_streaming variable

is_streaming is only set and never read, drop it.

Signed-off-by: Hans de Goede <hansg@kernel.org>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20250517114106.43494-14-hansg@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: atomisp: gc0310: Fix power on/off sleep times
Hans de Goede [Sat, 17 May 2025 11:40:55 +0000 (13:40 +0200)] 
media: atomisp: gc0310: Fix power on/off sleep times

Reduce the unnecessary long msleep(100) done on stream start to 10 ms and
move this to gc0310_resume() so that it is also done on the initial
power-up done by gc0310_detect(), which should fix gc0310_detect()
sometimes failing.

While at it switch the sleeps from msleep() / usleep_range() to fsleep().

Signed-off-by: Hans de Goede <hansg@kernel.org>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20250517114106.43494-13-hansg@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: atomisp: gc0310: Add check_hwcfg() function
Hans de Goede [Sat, 17 May 2025 11:40:54 +0000 (13:40 +0200)] 
media: atomisp: gc0310: Add check_hwcfg() function

Add a check_hwcfg() function to check if the external clk-freq, CSI
link-freq and lane-count match the driver's expectations.

Signed-off-by: Hans de Goede <hansg@kernel.org>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20250517114106.43494-12-hansg@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: atomisp: gc0310: Limit max exposure value to mode-height + vblank
Hans de Goede [Sun, 6 Jul 2025 09:53:53 +0000 (11:53 +0200)] 
media: atomisp: gc0310: Limit max exposure value to mode-height + vblank

When an exposure value > (mode-height + vblank) gets set the sensor will
automatically increase vblank, lowering the framerate.

This is not desirable, limit exposure the maximum exposure to mode-height +
vblank to avoid the unwanted framerate slowdown.

Signed-off-by: Hans de Goede <hansg@kernel.org>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20250517114106.43494-11-hdegoede@redhat.com
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: atomisp: gc0310: Add camera orientation and sensor rotation controls
Hans de Goede [Sun, 6 Jul 2025 09:53:40 +0000 (11:53 +0200)] 
media: atomisp: gc0310: Add camera orientation and sensor rotation controls

Add camera orientation and sensor rotation controls using
the v4l2_fwnode_device_parse() and v4l2_ctrl_new_fwnode_properties()
helpers.

Signed-off-by: Hans de Goede <hansg@kernel.org>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20250517114106.43494-10-hdegoede@redhat.com
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: atomisp: gc0310: Add vblank and hblank controls
Hans de Goede [Sun, 6 Jul 2025 09:53:24 +0000 (11:53 +0200)] 
media: atomisp: gc0310: Add vblank and hblank controls

Add support for the vblank and hblank controls, these controls
are mandatory for using the sensor driver with libcamera.

Signed-off-by: Hans de Goede <hansg@kernel.org>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20250517114106.43494-9-hdegoede@redhat.com
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: atomisp: gc0310: Add link-frequency and pixelrate controls
Hans de Goede [Sun, 6 Jul 2025 09:53:15 +0000 (11:53 +0200)] 
media: atomisp: gc0310: Add link-frequency and pixelrate controls

Add support for the pixelrate control as expected by libcamera,
while at it also add the link-frequency control.

Signed-off-by: Hans de Goede <hansg@kernel.org>
Link: https://lore.kernel.org/r/20250517114106.43494-8-hdegoede@redhat.com
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: atomisp: gc0310: Add selection API support
Hans de Goede [Sun, 6 Jul 2025 09:47:22 +0000 (11:47 +0200)] 
media: atomisp: gc0310: Add selection API support

Add support for the selection API as expected by libcamera.

Note the driver only supports a single fixed resolution and
no cropping, so this is a simple read-only implementation.

Signed-off-by: Hans de Goede <hansg@kernel.org>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20250517114106.43494-7-hdegoede@redhat.com
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: atomisp: gc0310: Use V4L2_CID_ANALOGUE_GAIN for gain control
Hans de Goede [Fri, 4 Jul 2025 20:54:19 +0000 (22:54 +0200)] 
media: atomisp: gc0310: Use V4L2_CID_ANALOGUE_GAIN for gain control

Use V4L2_CID_ANALOGUE_GAIN for gain control, as expected by userspace.

Signed-off-by: Hans de Goede <hansg@kernel.org>
Link: https://lore.kernel.org/r/20250517114106.43494-6-hdegoede@redhat.com
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: atomisp: gc0310: Switch to CCI register access helpers
Hans de Goede [Fri, 4 Jul 2025 19:20:16 +0000 (21:20 +0200)] 
media: atomisp: gc0310: Switch to CCI register access helpers

Switch the GC0310 driver over to the CCI register access helpers.

While at it also add a _REG prefix to all register address defines
to make clear they are register addresses and group register value
defines together with the address definition.

Signed-off-by: Hans de Goede <hansg@kernel.org>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20250517114106.43494-5-hdegoede@redhat.com
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: atomisp: gc0310: Modify vblank value to run at 30 fps
Hans de Goede [Fri, 4 Jul 2025 19:18:27 +0000 (21:18 +0200)] 
media: atomisp: gc0310: Modify vblank value to run at 30 fps

Currently the sensor is running 30.9 fps, increase vblank
to have it actually run at 30.0 fps.

Signed-off-by: Hans de Goede <hansg@kernel.org>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20250517114106.43494-4-hdegoede@redhat.com
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: atomisp: gc0310: Drop unused GC0310_FOCAL_LENGTH_NUM define
Hans de Goede [Fri, 4 Jul 2025 19:18:15 +0000 (21:18 +0200)] 
media: atomisp: gc0310: Drop unused GC0310_FOCAL_LENGTH_NUM define

Drop the unused GC0310_FOCAL_LENGTH_NUM define, the focal-length
is a property of the sensor-module, not of the raw sensor itself.

Signed-off-by: Hans de Goede <hansg@kernel.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20250517114106.43494-3-hdegoede@redhat.com
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: atomisp: gc0310: Rename "dev" function variable to "sensor"
Hans de Goede [Fri, 4 Jul 2025 19:17:29 +0000 (21:17 +0200)] 
media: atomisp: gc0310: Rename "dev" function variable to "sensor"

Many functions on the gc0310 driver use a function local variable called
"dev" but these variable's type is not "struct device *" type as one would
expect based on the name. Instead they point to the gc0310 driver data
struct.

Rename these variables to sensor to make their purpose more clear.

Signed-off-by: Hans de Goede <hansg@kernel.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20250517114106.43494-2-hdegoede@redhat.com
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: atomisp: Fix ia_css_vf.host.c coding style
Pablo [Sat, 3 May 2025 20:00:30 +0000 (17:00 -0300)] 
media: atomisp: Fix ia_css_vf.host.c coding style

Fix a coding style:
"ERROR: that open brace { should be on the previous line"
issue reported in ia_css_vf.host.c:94.

Signed-off-by: Pablo <pablo@pablo.ct.ws>
Link: https://lore.kernel.org/r/20250503200030.5982-1-pablo@pablo.ct.ws
Signed-off-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: atomisp: Switch to int3472 driver sensor GPIO mapping code
Hans de Goede [Fri, 4 Jul 2025 09:24:02 +0000 (11:24 +0200)] 
media: atomisp: Switch to int3472 driver sensor GPIO mapping code

Replace the duplicate code for calling the special Intel camera sensor GPIO
type _DSM (79234640-9e10-4fea-a5c1-b5aa8b19756f) and mapping GPIOs to
the sensor with a call to int3472_discrete_parse_crs() from the int3472
driver.

Besides avoiding code duplication the int3472 version of the code also
supports more features, like mapping the powerdown GPIO to a regulator on
the mt9m114 which is necessary to make the camera on the Asus T100TA work.

Signed-off-by: Hans de Goede <hansg@kernel.org>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Link: https://lore.kernel.org/r/20250507184737.154747-7-hdegoede@redhat.com
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: atomisp: Fix "stop stream timeout." error
Hans de Goede [Fri, 4 Jul 2025 09:21:34 +0000 (11:21 +0200)] 
media: atomisp: Fix "stop stream timeout." error

Commit c7194b21809e ("media: atomisp: On streamoff wait for buffers owned
by the CSS to be given back") added draining of the CSS buffer queue to
the beginning of atomisp_stop_stream().

But it turns out that when telling the CSS to stop streaming it needs at
least 1 buffer queued, because the CSS firmware waits for a frame to be
completed before stopping and without buffers it cannot complete a frame.

At the end of atomisp_stop_stream() it is always safe to return buffer
ownership to the videobuf2-core. Either atomisp_css_stop() has successfully
stopped the stream; or the atomisp_reset() later on which power-cycles
the ISP will definitely have stopped the stream.

Drop the draining of the CSS buffer queue to fix the "stop stream timeout."
error and move the atomisp_flush_video_pipe() call after atomisp_reset(),
passing false for the warn_on_css_frames flag since some buffers still
being marked as owned by the CSS expected on stream off.

Also increase the timeout in destroy_stream(), since this waits for
the last frame to be completed this can take longer then 40 ms. When e.g.
using a framerate of 15 fps, this could take 66ms, make the timeout 200 ms
to be on the safe side.

Signed-off-by: Hans de Goede <hansg@kernel.org>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20250505210008.152659-6-hdegoede@redhat.com
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: atomisp: Always free MIPI / CSI-receiver buffers from ia_css_uninit()
Hans de Goede [Fri, 4 Jul 2025 09:21:08 +0000 (11:21 +0200)] 
media: atomisp: Always free MIPI / CSI-receiver buffers from ia_css_uninit()

The atomisp interrupt handling will free the MIPI / CSI-receiver buffers
when processing a frame-completion event if the stop_requested flag is set,
but only in the ISP2400 / BYT, not in the ISP2401 / CHT case.

There are 2 problems with this:

1. Since this is only done in the BYT case the "mipi frames are not freed."
   warning always triggers on CHT devices.

2. There are 2 stop_requested flags, ia_css_pipe.stop_requested and
   ia_css_pipeline.stop_requested. The ISR checks the ia_css_pipe flag,
   but atomisp_css_stop() sets the ia_css_pipeline.stop_requested flag.
   So even on BYT freeing the buffers from the ISR never happens.

   This likely is a good thing since the buffers get freed on the first
   frame completion event and there might be multiple frames queued up.

Fix things by completely dropping the freeing of the MIPI buffers from
the ISR as well as the stop_requested flag always freeing the buffers
from ia_css_uninit().

Also drop the warning since this now always is expected behavior.

Note that ia_css_uninit() get called whenever streaming is stopped
through atomisp_stop_stream() calling atomisp_reset() so the buffers
are still freed whenever streaming is stopped.

Signed-off-by: Hans de Goede <hansg@kernel.org>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20250505210008.152659-5-hdegoede@redhat.com
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: atomisp: Stop pipeline on atomisp_css_start() failure
Hans de Goede [Fri, 4 Jul 2025 09:20:56 +0000 (11:20 +0200)] 
media: atomisp: Stop pipeline on atomisp_css_start() failure

atomisp_start_streaming() starts the media pipeline before calling
atomisp_css_start(). On atomisp_css_start() failures stop the pipeline
before returning the error.

Signed-off-by: Hans de Goede <hansg@kernel.org>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20250505210008.152659-4-hdegoede@redhat.com
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: atomisp: Properly stop the ISP stream on sensor streamon errors
Hans de Goede [Fri, 4 Jul 2025 09:20:46 +0000 (11:20 +0200)] 
media: atomisp: Properly stop the ISP stream on sensor streamon errors

When v4l2_subdev_call(sensor, s_stream, 1) fails atomisp_start_streaming()
was not properly returning the buffer ownership back to the videobuf2-core
code, resulting in:

[ 1318.153447] ------------[ cut here ]------------
[ 1318.153499] WARNING: CPU: 0 PID: 4856 at drivers/media/common/videobuf2/videobuf2-core.c:1803 vb2_start_streaming+0xcb/0x160 [videobuf2_common]
...
[ 1318.154551] Call Trace:
[ 1318.154560]  <TASK>
[ 1318.154571]  ? __warn.cold+0xb7/0x14a
[ 1318.154591]  ? vb2_start_streaming+0xcb/0x160 [videobuf2_common]
[ 1318.154617]  ? report_bug+0xe0/0x180
[ 1318.154640]  ? handle_bug+0x5e/0xa0
[ 1318.154652]  ? exc_invalid_op+0x14/0x70
[ 1318.154665]  ? asm_exc_invalid_op+0x16/0x20
[ 1318.154697]  ? vb2_start_streaming+0xcb/0x160 [videobuf2_common]
[ 1318.154723]  ? vb2_start_streaming+0x70/0x160 [videobuf2_common]
[ 1318.154748]  vb2_core_streamon+0xa2/0x100 [videobuf2_common]

The sensor streamon call is the last thing that atomisp_start_streaming()
does and it was failing to undo all of the previous steps in general.

Refactor atomisp_stop_streaming() into an atomisp_stop_stream() helper and
call that on sensor streamon failure to properly clean things up.

Signed-off-by: Hans de Goede <hansg@kernel.org>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20250505210008.152659-3-hdegoede@redhat.com
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: atomisp: Move atomisp_stop_streaming() above atomisp_start_streaming()
Hans de Goede [Fri, 4 Jul 2025 09:20:30 +0000 (11:20 +0200)] 
media: atomisp: Move atomisp_stop_streaming() above atomisp_start_streaming()

Move atomisp_stop_streaming() above atomisp_start_streaming(), this is
a preparation patch for making atomisp_start_streaming() properly cleanup
if starting the sensor stream fails.

No functional change, only moving a block of code up.

Signed-off-by: Hans de Goede <hansg@kernel.org>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20250505210008.152659-2-hdegoede@redhat.com
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: cec: cec-gpio: reading hpd/5v is allowed to sleep
Hans Verkuil [Mon, 30 Jun 2025 11:08:50 +0000 (13:08 +0200)] 
media: cec: cec-gpio: reading hpd/5v is allowed to sleep

Reading the hpd or 5v gpios is something that can sleep, so rework
the code to allow this.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: cec: cec-gpio: rename functions
Hans Verkuil [Mon, 30 Jun 2025 11:08:49 +0000 (13:08 +0200)] 
media: cec: cec-gpio: rename functions

Ensure that the interrupt function names clearly state for which
gpio they are (cec/hpd/5v). No functional changes.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agoDocumentation: media: cec: update error inj doc
Hans Verkuil [Mon, 30 Jun 2025 11:08:48 +0000 (13:08 +0200)] 
Documentation: media: cec: update error inj doc

Document rx-no-low-drive and the new support to inject
glitches.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: cec: core: add rx-no-low-drive setting
Hans Verkuil [Mon, 30 Jun 2025 11:08:47 +0000 (13:08 +0200)] 
media: cec: core: add rx-no-low-drive setting

If rx-no-low-drive is set, then the CEC pin framework will disable
the detection of situations where a Low Drive has to be generated.

So if this is set, then we will never generate Low Drives.

This helps testing whether other CEC devices generate Low Drive
pulses by ensuring it is not us that is generating them.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: cec: core: add glitch error injection
Hans Verkuil [Mon, 30 Jun 2025 11:08:46 +0000 (13:08 +0200)] 
media: cec: core: add glitch error injection

This adds support for inserting 'glitches' after a falling and/or
rising edge. This tests what happens when there are little voltage
spikes after falling or rising edges, which can be caused due to
noise or reflections on the CEC line.

A proper CEC implementation will deglitch this, but a poor implementation
can create a Low Drive pulse in response, effectively making CEC unusable.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 weeks agomedia: i2c: adv7604/tc358743/tda1997x: HPD low for HZ / 7
Hans Verkuil [Wed, 25 Jun 2025 06:35:36 +0000 (08:35 +0200)] 
media: i2c: adv7604/tc358743/tda1997x: HPD low for HZ / 7

When the EDID is updated, the hotplug detect signal must remain low for
100 ms minimum. Currently these three drivers use that exact minimum,
but some HDMI transmitters need the HPD to be low for a bit longer
before they detect that they need to read the EDID again.

Experience shows that HZ / 7 (= 143 ms) is a good value.

So change HZ / 10 to HZ / 7.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
5 weeks agomedia: ipu7: Drop IPU8 PCI ID for now
Sakari Ailus [Thu, 3 Jul 2025 14:53:19 +0000 (17:53 +0300)] 
media: ipu7: Drop IPU8 PCI ID for now

This driver is intended for IPU7 at the moment so drop the IPU8 PCI ID.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 weeks agomedia: staging/ipu7: add Makefile, Kconfig and to-do file for IPU7
Bingbu Cao [Thu, 29 May 2025 04:13:23 +0000 (12:13 +0800)] 
media: staging/ipu7: add Makefile, Kconfig and to-do file for IPU7

Add Kconfig and Makefile for IPU7 driver and also update
the Makefile to build the IPU7 driver.

Also add a to-do file to list the TODOs.

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>
5 weeks agoMAINTAINERS: add maintainers for Intel IPU7 input system driver
Bingbu Cao [Thu, 29 May 2025 04:13:22 +0000 (12:13 +0800)] 
MAINTAINERS: add maintainers for Intel IPU7 input system driver

Update MAINTAINERS file for Intel IPU7 input system staging driver.

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>
5 weeks agomedia: staging/ipu7: add IPU7 input system device driver
Bingbu Cao [Thu, 29 May 2025 04:13:21 +0000 (12:13 +0800)] 
media: staging/ipu7: add IPU7 input system device driver

The main input system driver mainly cover the basic hardware setup, v4l2
devices registration, firmware stream interfaces and interrupt handling.

Input system CSI2 receiver is exposed as a v4l2 sub-device. Each CSI2
sub-device represent one single CSI2 hardware port which be linked with
external sub-device such camera sensor by linked with ISYS CSI2's sink
pad. The CSI2 source pad is linked to the sink pad of video capture device.

Register V4L2 video device and setup the VB2 queues to support video
capture. Video streaming callback will trigger the input system driver to
construct a input system stream configuration for firmware based on data
type and stream ID and then queue buffers to firmware to do capture.

IPU7 CSI-2 D-PHY hardware is a Synopsys DWC MIPI CSI2 Rx IP, the driver
program the DPHY to receive MIPI data from camera sensors.

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>
5 weeks agomedia: staging/ipu7: add IPU7 firmware ABI headers
Bingbu Cao [Thu, 29 May 2025 04:13:20 +0000 (12:13 +0800)] 
media: staging/ipu7: add IPU7 firmware ABI headers

IPU7 firmware defines the ABIs between firmware and software, this
patch adds a series of ABI headers.

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>
5 weeks agomedia: staging/ipu7: add firmware parse, syscom interface and boot
Bingbu Cao [Thu, 29 May 2025 04:13:19 +0000 (12:13 +0800)] 
media: staging/ipu7: add firmware parse, syscom interface and boot

IPU7 irmware is generated and released as signed Code Partition
Directory (CPD) format file which is aligned with the SPI flash code
partition definition. The driver parses the CPD based on the layout.

Syscom is an inter-process(or) communication mechanism between an IPU and
host. Syscom uses message queues for message exchange between IPU and
host. Each message queue has its consumer and producer, host queue
messages to firmware as the producer and then firmware to dequeue the
messages as consumer and vice versa. IPU and host use shared registers or
memory to reside the read and write indices which are updated by consumer
and producer.

IPU7 firmware defined its boot sequence, driver setup the boot
configuration and program the boot parameters to start and run
the firmware.

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>
5 weeks agomedia: staging/ipu7: add IPU7 DMA APIs and MMU mapping
Bingbu Cao [Thu, 29 May 2025 04:13:18 +0000 (12:13 +0800)] 
media: staging/ipu7: add IPU7 DMA APIs and MMU mapping

The Intel IPU7 has internal microprocessor which runs the firmware
The microprocessor accesses system DRAM by its internal 32-bit virtual
address space. Driver should setup the MMU table and expose the DMA
APIs for memory buffer mapping.

This patch adds the IPU MMU and a DMA mapping implementation to setup
the internal MMU hardware.

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>
5 weeks agomedia: staging/ipu7: add Intel IPU7 PCI device driver
Bingbu Cao [Thu, 29 May 2025 04:13:17 +0000 (12:13 +0800)] 
media: staging/ipu7: add Intel IPU7 PCI device driver

Intel Image Processing Unit 7th Gen includes input and processing systems
and the hardware presents itself as a single PCI device in system same
as IPU6.

The IPU7 PCI device driver basically does PCI configurations, basic
hardware configuration by its buttress interfaces, loads the
firmware binary, register the auxiliary device which serve for the ISYS
device driver.

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>
5 weeks agomedia: qcom: camss: Remove extraneous -supply postfix on supply names
Bryan O'Donoghue [Thu, 26 Jun 2025 01:24:33 +0000 (02:24 +0100)] 
media: qcom: camss: Remove extraneous -supply postfix on supply names

The -supply postfix is wrong but wasn't noticed on the CRD devices or
indeed the Dell devices, however on Lenovo devices the error comes up.

Fixes: 1830cf0f56c3 ("media: qcom: camss: Add x1e80100 specific support")
Cc: stable@vger.kernel.org
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
[bod: reworded commit log per Konrad's feedback]
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 weeks agoMAINTAINERS: add myself as a CAMSS patch reviewer
Vladimir Zapolskiy [Tue, 13 May 2025 14:23:53 +0000 (17:23 +0300)] 
MAINTAINERS: add myself as a CAMSS patch reviewer

Add myself as a review of Qualcomm CAMSS subsystem patches.

Signed-off-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Acked-by: Bryan O'Donoghue <bod@kernel.org>
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 weeks agomedia: qcom: camss: simplify camss_subdev_notifier_complete() function
Vladimir Zapolskiy [Tue, 13 May 2025 14:23:50 +0000 (17:23 +0300)] 
media: qcom: camss: simplify camss_subdev_notifier_complete() function

For sake of code simplicity and readability reduce the function code by
one level of indentation, the change is non-functional.

Signed-off-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
[bod: Fixed indentation error]
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 weeks agomedia: qcom: camss: register camss media device before subdevices
Vladimir Zapolskiy [Tue, 13 May 2025 14:23:48 +0000 (17:23 +0300)] 
media: qcom: camss: register camss media device before subdevices

A media device can and at least for sake of simplicity should be registered
before V4L2 devices including the ones added on async completion.

The change removes the second and out of camss_probe() media device
registration path, and it allows to get a working ISP media device
independently from connected or not sensor devices.

Signed-off-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Acked-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 weeks agomedia: qcom: camss: remove duplicated csiphy_formats_sc7280 data
Vladimir Zapolskiy [Tue, 13 May 2025 14:23:46 +0000 (17:23 +0300)] 
media: qcom: camss: remove duplicated csiphy_formats_sc7280 data

It's sufficient to have just one previously set csiphy_formats_sdm845 data.

Signed-off-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 weeks agomedia: qcom: camss: cleanup media device allocated resource on error path
Vladimir Zapolskiy [Tue, 13 May 2025 14:23:45 +0000 (17:23 +0300)] 
media: qcom: camss: cleanup media device allocated resource on error path

A call to media_device_init() requires media_device_cleanup() counterpart
to complete cleanup and release any allocated resources.

This has been done in the driver .remove() right from the beginning, but
error paths on .probe() shall also be fixed.

Fixes: a1d7c116fcf7 ("media: camms: Add core files")
Cc: stable@vger.kernel.org
Signed-off-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 weeks agomedia: qcom: camss: csiphy-3ph: Fix inadvertent dropping of SDM660/SDM670 phy init
Bryan O'Donoghue [Thu, 12 Jun 2025 08:07:15 +0000 (09:07 +0100)] 
media: qcom: camss: csiphy-3ph: Fix inadvertent dropping of SDM660/SDM670 phy init

The moving of init sequence hook from gen2() to subdev_init() doesn't
account for gen1 devices such as SDM660 and SDM670. The switch should find
the right offset for gen2 PHYs only, not reject gen1. Remove the default
error case to restore gen1 CSIPHY support.

Cc: stable@vger.kernel.org
Fixes: fbce0ca24c3a ("media: qcom: camss: csiphy-3ph: Move CSIPHY variables to data field inside csiphy struct")
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 weeks agomedia: qcom: camss: Power pipeline only when streaming
Richard Acayan [Mon, 26 May 2025 23:28:39 +0000 (19:28 -0400)] 
media: qcom: camss: Power pipeline only when streaming

The libcamera plugin for Pipewire may keep an open file descriptor to
the video device, even while streaming. This simplifies its operation,
as it only needs to keep track of a number instead of a file path. When
the video device is open but not streaming, the pipeline can be powered
off. Move the pipeline power management to the prepare_streaming and
unprepare_streaming functions.

Signed-off-by: Richard Acayan <mailingradian@gmail.com>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 weeks agodt-bindings: media: qcom,x1e80100-camss: Fix isp unit address
Vladimir Zapolskiy [Tue, 24 Jun 2025 09:42:53 +0000 (12:42 +0300)] 
dt-bindings: media: qcom,x1e80100-camss: Fix isp unit address

According to the devicetree specification a unit address shall match
the first address value of the reg property.

Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 weeks agodt-bindings: media: qcom,x1e80100-camss: Remove clock-lanes port property
Vladimir Zapolskiy [Fri, 2 May 2025 20:41:42 +0000 (23:41 +0300)] 
dt-bindings: media: qcom,x1e80100-camss: Remove clock-lanes port property

Since clock lanes under CSIPHY are hard-wired and non-selectable,
it makes sense to remove this port property.

The change follows the same logic as found in commit 336136e197e2
("media: dt-bindings: media: camss: Remove clock-lane property").

Signed-off-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 weeks agodt-bindings: media: qcom,x1e80100-camss: Add optional bus-type property
Vladimir Zapolskiy [Fri, 2 May 2025 20:41:41 +0000 (23:41 +0300)] 
dt-bindings: media: qcom,x1e80100-camss: Add optional bus-type property

Since CSIPHY IP on modern Qualcomm SoCs supports D-PHY and C-PHY
interfaces, it might be necessary to specify it explicitly for some
particular devices.

Signed-off-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 weeks agodt-bindings: media: qcom,x1e80100-camss: Tighten the property regex pattern
Vladimir Zapolskiy [Fri, 2 May 2025 20:41:40 +0000 (23:41 +0300)] 
dt-bindings: media: qcom,x1e80100-camss: Tighten the property regex pattern

There are 4 CSIPHY ports on X1E80100, it'd be preferred to tinker a too
loose the regexp, which covers all these port names.

Signed-off-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Acked-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 weeks agomedia: iris: Fix opp scaling of power domains
Akhil P Oommen [Wed, 11 Jun 2025 05:43:44 +0000 (11:13 +0530)] 
media: iris: Fix opp scaling of power domains

Pass PD_FLAG_REQUIRED_OPP flag to allow opp framework to scale the rpmpd
power domains.

Signed-off-by: Akhil P Oommen <akhilpo@oss.qualcomm.com>
Reviewed-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 weeks agomedia: iris: Add codec specific check for VP9 decoder drain handling
Dikshita Agarwal [Fri, 9 May 2025 08:39:12 +0000 (14:09 +0530)] 
media: iris: Add codec specific check for VP9 decoder drain handling

Add a codec specific for the VP9 decoder to ensure that a non-null
buffer is sent to the firmware during drain. The firmware enforces a
check for VP9 decoder that the number of buffers queued and dequeued on
the output plane should match. When a null buffer is sent, the firmware
does not return a response for it, leading to a count mismatch and an
assertion failure from the firmware.

Acked-by: Vikash Garodia <quic_vgarodia@quicinc.com>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-HDK
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8650-QRD
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8650-HDK
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
Tested-by: Vikash Garodia <quic_vgarodia@quicinc.com> # on sa8775p-ride
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 weeks agomedia: iris: Add internal buffer calculation for HEVC and VP9 decoders
Dikshita Agarwal [Fri, 9 May 2025 08:39:11 +0000 (14:09 +0530)] 
media: iris: Add internal buffer calculation for HEVC and VP9 decoders

Add internal buffer count and size calculations for HEVC and VP9
decoders.

Acked-by: Vikash Garodia <quic_vgarodia@quicinc.com>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-HDK
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8650-QRD
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8650-HDK
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
Tested-by: Vikash Garodia <quic_vgarodia@quicinc.com> # on sa8775p-ride
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
[hverkuil: add __maybe_unused to size_mp2d_lb_fe_top_data]

5 weeks agomedia: iris: Set mandatory properties for HEVC and VP9 decoders.
Dikshita Agarwal [Fri, 9 May 2025 08:39:10 +0000 (14:09 +0530)] 
media: iris: Set mandatory properties for HEVC and VP9 decoders.

Subscribe and set mandatory properties to the firmware for HEVC and VP9
decoders.

Acked-by: Vikash Garodia <quic_vgarodia@quicinc.com>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-HDK
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8650-QRD
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8650-HDK
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
Tested-by: Vikash Garodia <quic_vgarodia@quicinc.com> # on sa8775p-ride
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
5 weeks agomedia: iris: Add platform capabilities for HEVC and VP9 decoders
Dikshita Agarwal [Fri, 9 May 2025 08:39:09 +0000 (14:09 +0530)] 
media: iris: Add platform capabilities for HEVC and VP9 decoders

Add platform capabilities for HEVC and VP9 codecs in decoder driver
with related hooks.

Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Acked-by: Vikash Garodia <quic_vgarodia@quicinc.com>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-HDK
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8650-QRD
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8650-HDK
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
Tested-by: Vikash Garodia <quic_vgarodia@quicinc.com> # on sa8775p-ride
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>