aboutsummaryrefslogtreecommitdiff
path: root/include/media
AgeCommit message (Collapse)AuthorFilesLines
2024-05-04media: cec.h: Fix kerneldocGravatar Ricardo Ribalda 1-0/+1
is_claiming_log_addrs documentation was missing. fix this kernel-doc warning: include/media/cec.h:296: warning: Function parameter or struct member 'is_claiming_log_addrs' not described in 'cec_adapter' Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-05-02media: cec: core: avoid recursive cec_claim_log_addrsGravatar Hans Verkuil 1-0/+1
Keep track if cec_claim_log_addrs() is running, and return -EBUSY if it is when calling CEC_ADAP_S_LOG_ADDRS. This prevents a case where cec_claim_log_addrs() could be called while it was still in progress. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Reported-by: Yang, Chenyuan <cy54@illinois.edu> Closes: https://lore.kernel.org/linux-media/PH7PR11MB57688E64ADE4FE82E658D86DA09EA@PH7PR11MB5768.namprd11.prod.outlook.com/ Fixes: ca684386e6e2 ("[media] cec: add HDMI CEC framework (api)") Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2024-04-30media: cec: cec.h: 2.1 ms -> 2100 msGravatar Hans Verkuil 1-1/+1
The transfer timeout is 2100 ms, not 2.1 ms. Fix this in the kerneldoc comment. Link: https://lore.kernel.org/linux-media/17cd1a67-3966-237c-2e0d-2d3ae618f915@xs4all.nl Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2024-04-29media: ipu6: Add PCI device table headerGravatar Sakari Ailus 1-0/+28
Add a header for the PCI device table of all IPU6 devices. This will be used by the IPU bridge as well so place the table in a header. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-04-29media: v4l: subdev: Add len_routes field to struct v4l2_subdev_routingGravatar Sakari Ailus 1-0/+2
The len_routes field is used to tell the size of the routes array in struct v4l2_subdev_routing. This way the number of routes returned from S_ROUTING IOCTL may be larger than the number of routes provided, in case there are more routes returned by the driver. Note that this uAPI is still disabled in the code, so this change can safely be done. Anyone who manually patched the code to enable this uAPI must update their code. The patch also increases the number of reserved fields in struct v4l2_subdev_routing. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-04-29media: v4l: subdev: Add a function to lock two sub-device states, use itGravatar Sakari Ailus 1-0/+40
Add two new functions, v4l2_subdev_lock_states() and v4l2_subdev_unclock_states(), to acquire and release the state of two sub-devices. They differ from calling v4l2_subdev_{un,}lock_state() so that if the two states share the same lock, the lock is acquired only once. Also use the new functions in v4l2_subdev_link_validate(). Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Julien Massot <julien.massot@collabora.com> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-04-26media: v4l: async: Set owner for async sub-devicesGravatar Sakari Ailus 1-1/+3
Set the owner field of the async sub-devices by making v4l2_async_register_subdev() a macro and obtaining THIS_MODULE that way. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2024-04-26media: v4l: Set sub-device's owner field to the caller's moduleGravatar Sakari Ailus 1-2/+5
Set a sub-device's owner field to the caller's module, provided as an argument to the function. v4l2_device_register_subdev() becomes a macro passing THIS_MODULE to the __v4l2_device_register_subdev() function. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2024-04-10media: mc: Add nop implementations of media_device_{init,cleanup}Gravatar Sakari Ailus 1-0/+6
To support compilation with Media controller disabled, drivers were required to conditionally call media_device_init and media_device_cleanup. Add nop implementations of both so drivers don't need to care (or at least care less). Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-04-09media: v4l2-subdev: Remove non-pad dv timing callbacksGravatar Paweł Anikiel 1-14/+0
After the conversion of dv timing calls to use a pad argument is done, remove the old callbacks. Update the subdev ioctl handlers to use the new callbacks. Signed-off-by: Paweł Anikiel <panikiel@google.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-04-09media: v4l2-subdev: Add pad versions of dv timing subdev callsGravatar Paweł Anikiel 1-0/+14
Currently, subdev dv timing calls (i.e. g/s/query_dv_timings) are video ops without a pad argument. This is a problem if the subdevice can have different dv timings for each pad (e.g. a DisplayPort receiver with multiple virtual channels). To solve this, change these calls to include a pad argument, and put them into pad ops. Keep the old ones temporarily to make the switch easier. Signed-off-by: Paweł Anikiel <panikiel@google.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-03-25media: v4l2: Add mem2mem helpers for REMOVE_BUFS ioctlGravatar Benjamin Gaignard 1-0/+2
Create v4l2-mem2mem helpers for VIDIOC_REMOVE_BUFS ioctl and make test drivers use it. Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> Reviewed-by: Mauro Carvalho Chehab <mchehab@kernel.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-03-25media: v4l2: Add REMOVE_BUFS ioctlGravatar Benjamin Gaignard 3-0/+16
VIDIOC_REMOVE_BUFS ioctl allows to remove buffers from a queue. The number of buffers to remove in given by count field of struct v4l2_remove_buffers and the range start at the index specified in the same structure. Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> Reviewed-by: Mauro Carvalho Chehab <mchehab@kernel.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> [hverkuil: vidioc-remove-bufs.rst: mention no bufs are freed on error]
2024-03-25media: core: Add bitmap manage bufs array entriesGravatar Benjamin Gaignard 1-7/+11
Add a bitmap field to know which of bufs array entries are used or not. Remove no more used num_buffers field from queue structure. Use bitmap_find_next_zero_area() to find the first possible range when creating new buffers to fill the gaps. If no suitable range is found try to allocate less buffers than requested. Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> Acked-by: Mauro Carvalho Chehab <mchehab@kernel.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-03-25media: core: Rework how create_buf index returned value is computedGravatar Benjamin Gaignard 1-1/+4
When REMOVE_BUFS will be introduced holes could created in bufs array. To be able to reuse these unused indices reworking how create->index is set is mandatory. Let __vb2_queue_alloc() decide which first index is correct and forward this to the caller. Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> Acked-by: Mauro Carvalho Chehab <mchehab@kernel.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-03-25media: videobuf2: Add min_reqbufs_allocation field to vb2_queue structureGravatar Benjamin Gaignard 1-1/+14
Add 'min_reqbufs_allocation' field in the vb2_queue structure so drivers can specify the minimum number of buffers to allocate when calling VIDIOC_REQBUFS. When initializing the queue, v4l2 core makes sure that the following constraints are respected: - the minimum number of buffers to allocate must be at least 2 because one buffer is used by the hardware while the other is being processed by userspace. -if the driver needs 'min_queued_buffers' in the queue before calling start_streaming(), then the minimum requirement is 'min_queued_buffers + 1' to keep at least one buffer available for userspace. Simplify __vb2_init_fileio() by using 'min_reqbufs_allocation' directly to avoid duplicating the minimum number of buffers to allocate computation. Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> Reviewed-by: Mauro Carvalho Chehab <mchehab@kernel.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-03-25media: videobuf2: Update vb2_is_busy() logicGravatar Benjamin Gaignard 1-1/+3
Do not rely on the number of allocated buffers to know if the queue is busy but on a flag set when at least one buffer has been allocated by REQBUFS or CREATE_BUFS ioctl. The flag is reset when REQBUFS is called with count = 0 or the file handle is closed. This is needed because remove buffers feature will be able to remove all the buffers from a queue while streaming so relying on the number of allocated buffers in the queue won't be possible. Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> Reviewed-by: Mauro Carvalho Chehab <mchehab@kernel.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-03-15Merge tag 'media/v6.9-1' of ↵Gravatar Linus Torvalds 4-15/+40
git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media Pull media updates from Mauro Carvalho Chehab: - DVB budget legacy API was finally documented. It took only 20+ years to get some documentation about it... - hantro driver has gained support for STM32MP25 VDEC/VENC - rkisp1 has gained support for i.MX8MP - atomisp got rid of two items from its todo list. Still 5 items pending for moving it out of staging - lots of driver fixes, cleanups and improvements * tag 'media/v6.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (252 commits) media: rcar-isp: Disallow unbind of devices media: usbtv: Remove useless locks in usbtv_video_free() media: mediatek: vcodec: avoid -Wcast-function-type-strict warning media: ttpci: fix two memleaks in budget_av_attach media: go7007: fix a memleak in go7007_load_encoder media: dvb-frontends: avoid stack overflow warnings with clang media: pvrusb2: fix uaf in pvr2_context_set_notify media: usb: s2255: Refactor s2255_get_fx2fw media: ti: j721e-csi2rx: Convert to platform remove callback returning void media: stm32-dcmipp: Convert to platform remove callback returning void media: nxp: imx8-isi: Convert to platform remove callback returning void media: nuvoton: Convert to platform remove callback returning void media: chips-media: wave5: Convert to platform remove callback returning void media: chips-media: wave5: Remove unnecessary semicolons media: i2c: imx290: Fix IMX920 typo media: platform: replace of_graph_get_next_endpoint() media: i2c: replace of_graph_get_next_endpoint() media: ivsc: csi: Make use of sub-device state media: ivsc: csi: Swap SINK and SOURCE pads media: ipu-bridge: Serialise calls to IPU bridge init ...
2024-02-16media: videobuf2: Add missing doc comment for waiting_in_dqbufGravatar Andrzej Pietrasiewicz 1-5/+8
While at it rearrange other comments to match the order of struct members. Fixes: d65842f7126a ("media: vb2: add waiting_in_dqbuf flag") Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com> Acked-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-02-08media: v4l2-subdev: Follow renaming of SPI "master" to "controller"Gravatar Uwe Kleine-König 1-3/+3
In commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"") some functions and struct members were renamed. To not break all drivers compatibility macros were provided. To be able to remove these compatibility macros push the renaming into v4l2_spi_new_subdev(). Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/b6e3a53ce75dfb8a21a5958a381070944dfa0875.1707324794.git.u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-05media: mc: Add num_links flag to media_padGravatar Laurent Pinchart 1-0/+2
Maintain a counter of the links connected to a pad in the media_pad structure. This helps checking if a pad is connected to anything, which will be used in the pipeline building code. Cc: stable@vger.kernel.org # 6.1 Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-02-05media: v4l2-common.h: kerneldoc: correctly format return valuesGravatar Hans Verkuil 1-8/+9
Building the kerneldoc resulted in two errors: Documentation/media/driver-api/v4l2-common:6: ./include/media/v4l2-common.h:566: ERROR: Unexpected indentation. Documentation/media/driver-api/v4l2-common:6: ./include/media/v4l2-common.h:567: WARNING: Block quote ends without a blank line; unexpected unindent. Format v4l2_link_freq_to_bitmap according to the kerneldoc standard. The v4l2_fill_pixfmt_mp function also had incorrect return value formatting, although that didn't report an error/warning, but it looked ugly in the generated documentation. So fix that one as well. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Fixes: a68e88e2cf9e ("media: v4l: Add a helper for setting up link-frequencies control") Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
2024-02-05media: cec.h: Fix kerneldocGravatar Ricardo Ribalda 1-2/+0
The fields are gone, remove their documentation. Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> Reviewed-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-02-05media: videobuf2: Fix doc commentGravatar Andrzej Pietrasiewicz 1-1/+1
The documented struct member is called "planes" rather than "vb2_plane". While at it, make the comments order follow struct members order. Fixes: 2b1413245550 ("media: vb2-core: Improve kernel-doc markups") Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com> Acked-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-02-01media: v4l: Add a helper for setting up link-frequencies controlGravatar Sakari Ailus 1-0/+25
Add a helper for obtaining supported link frequencies in form most drivers need them. The result is a bitmap of supported controls. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2024-01-22media: media-entity.h: fix Excess kernel-doc description warningsGravatar Randy Dunlap 1-4/+0
Remove the @major: and @minor: lines to prevent the kernel-doc warnings: include/media/media-entity.h:376: warning: Excess struct member 'major' description in 'media_entity' include/media/media-entity.h:376: warning: Excess struct member 'minor' description in 'media_entity' Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: videobuf2: core: Rename min_buffers_needed field in vb2_queueGravatar Benjamin Gaignard 1-3/+6
Rename min_buffers_needed into min_queued_buffers and update the documentation about it. Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> [hverkuil: Drop the change where min_queued_buffers + 1 buffers would be] [hverkuil: allocated. Now this patch only renames this field instead of making] [hverkuil: a functional change as well.] [hverkuil: Renamed 3 remaining min_buffers_needed occurrences.]
2023-12-13media: v4l2-subdev: Store frame interval in subdev stateGravatar Laurent Pinchart 1-0/+43
Subdev states store all standard pad configuration data, except for frame intervals. Fix it by adding interval fields in the v4l2_subdev_pad_config and v4l2_subdev_stream_config structures, with corresponding accessor functions and a helper function to implement the .get_frame_interval() operation. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: v4l2-subdev: Turn .[gs]_frame_interval into pad operationsGravatar Laurent Pinchart 2-12/+14
The subdev .[gs]_frame_interval are video operations, but they operate on pads (and even on streams). Not only is this confusing, it causes practical issues for drivers as the operations don't receive a subdev state pointer, requiring manual state handling. To improve the situation, turn the operations into pad operations, and extend them to receive a state pointer like other pad operations. While at it, rename the operations to .[gs]et_frame_interval at the same time to match the naming scheme of other pad operations. This isn't strictly necessary, but given that all drivers using those operations need to be modified, handling the rename separately would generate more churn for very little gain (if at all). Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> # for imx-media Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> # for tegra-video Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: v4l: subdev: Move out subdev state lock macros outside ↵Gravatar Tomi Valkeinen 1-83/+83
CONFIG_MEDIA_CONTROLLER The subdev state locking macros and macros to get the active state are currently behind CONFIG_MEDIA_CONTROLLER. This makes sense, as there can be no subdev state without MC. However, we have code paths common to MC and non-MC cases which call subdev operations that have subdev state as a parameter. In the non-MC case the state parameter would always be NULL. Thus it makes sense to allow, e.g.: v4l2_subdev_call_state_active(sd, pad, get_fmt, fmt) which for non-MC case would call the subdev passing NULL as the state. This currently fails: https://lore.kernel.org/oe-kbuild-all/202312061101.PLrz5NnJ-lkp@intel.com/ Fix the issue by moving the related macros to be outside CONFIG_MEDIA_CONTROLLER. The v4l2_subdev_lock_state() and v4l2_subdev_unlock_state() macros will crash if given NULL as the state, but the other macros behave correctly even when there's no active state, and they will only call the lock/unlock macros if there is a state. An alternative fix would be to make another version of v4l2_subdev_call_state_try() with ifdefs, which would not use any state macros and would always pass NULL as the state. But having two version of a macro/function is always more confusing than having just one, so I went this way. So, this fixes the v4l2_subdev_call_state_active() macro. But we also have v4l2_subdev_call_state_try(). It would be possible to fix that macro by additionally creating "no-op" variants of the state alloc and free functions. However, v4l2_subdev_call_state_try() is only used by a single driver (stm32-dcmi), which selects MC, and the macro is supposed to be removed as soon as the users have been converted away from the macro. Thus I have not touched the state alloc/free functions, and I think it makes sense to keep alloc/free functions available only if there's actually something that can be allocated or freed. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Link: https://lore.kernel.org/r/20231208-v4l2-state-mc-fix-v1-1-a0c8162557c6@ideasonboard.com Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: v4l2-cci: Add support for little-endian encoded registersGravatar Alexander Stein 1-0/+5
Some sensors, e.g. Sony IMX290, are using little-endian registers. Add support for those by encoding the endianness into Bit 20 of the register address. Fixes: af73323b9770 ("media: imx290: Convert to new CCI register access helpers") Cc: stable@vger.kernel.org Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> [Sakari Ailus: Fixed commit message.] Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-04media: v4l: cci: Add macros to obtain register width and addressGravatar Sakari Ailus 1-0/+5
Add CCI_REG_WIDTH() macro to obtain register width in bits and similarly, CCI_REG_WIDTH_BYTES() to obtain it in bytes. Also add CCI_REG_ADDR() macro to obtain the address of a register. Use both macros in v4l2-cci.c, too. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-04media: v4l: cci: Add driver-private bit definitionsGravatar Sakari Ailus 1-0/+5
Provide a few bits for drivers to store private information on register definitions. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-04media: v4l: cci: Include linux/bits.hGravatar Sakari Ailus 1-0/+1
linux/bits.h is needed for GENMASK(). Include it. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-04media: v4l2-subdev: Rename .init_cfg() operation to .init_state()Gravatar Laurent Pinchart 1-3/+4
The subdev .init_cfg() operation is affected by two issues: - It has long been extended to initialize a whole v4l2_subdev_state instead of just a v4l2_subdev_pad_config, but its name has stuck around. - Despite operating on a whole subdev state and not being directly exposed to the subdev users (either in-kernel or through the userspace API), .init_cfg() is categorized as a subdev pad operation. This participates in making the subdev API confusing for new developers. Fix it by renaming the operation to .init_state(), and make it a subdev internal operation. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Michael Riesch <michael.riesch@wolfvision.net> # for imx415 Acked-by: Shuah Khan <skhan@linuxfoundation.org> # for vimc Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> [Sakari Ailus: Resolved a conflict in Renesas vsp1 driver.] Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-11-23media: v4l: subdev: Remove stream-unaware sub-device state accessGravatar Sakari Ailus 1-77/+0
Remove stream-unaware sub-device state access functions and macros. These are no longer used. [Sakari Ailus: Resolve a minor conflict in removed code.] Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2023-11-23media: v4l: subdev: Always compile sub-device state access functionsGravatar Sakari Ailus 1-64/+64
Compile sub-device state information access functions v4l2_subdev_state_get_{format,crop,compose} unconditionally as they are now also used by plain V4L2 drivers. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2023-11-23media: v4l: subdev: Make stream argument optional in state access functionsGravatar Sakari Ailus 1-9/+40
The sub-device state access functions take three arguments: sub-device state, pad and stream. The stream is not relevant for the majority of drivers and having to specify 0 for the stream is considered a nuisance. Provide a two-argument macros for these state access functions to cover the needs of stream-unaware users. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2023-11-23media: v4l: subdev: Rename sub-device state information access functionsGravatar Sakari Ailus 1-10/+9
Rename the sub-devices state information access functions, removing "_stream" from them and replacing "format" by "ffmt". This makes them shorter and so more convenient to use. No other sets of functions will be needed to access this information. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2023-11-23media: v4l: subdev: Also return pads array information on stream functionsGravatar Sakari Ailus 1-3/+6
There are two sets of functions that return information from sub-device state, one for stream-unaware users and another for stream-aware users. Add support for stream-aware functions to return format, crop and compose information from pad-based array that are functionally equivalent to the old, stream-unaware ones. Also check state is non-NULL, in order to guard against old drivers potentially calling this with NULL state for active formats or selection rectangles. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2023-11-23media: v4l: subdev: Store the sub-device in the sub-device stateGravatar Sakari Ailus 1-0/+2
Store the sub-device in the sub-device state. This will be needed in e.g. validating pad number when retrieving information for non-stream-aware users. There are expected to be more needs for this in the future. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2023-11-23media: v4l2-subdev: Fix references to pad configGravatar Laurent Pinchart 1-1/+1
V4L2 subdev operations have moved from operating on a v4l2_subdev_pad_config to a v4l2_subdev_state a long time ago. Fix the few remaining incorrect references to pad config in the documentation. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2023-11-23media: v4l2-subdev: Drop outdated comment for v4l2_subdev_pad_configGravatar Laurent Pinchart 1-4/+0
The v4l2_subdev_pad_config structure is not passed to subdev operations anymore. Drop an outdated comment to refers to that old mechanism. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2023-11-23media: v4l2-subdev: Rename pad config 'try_*' fieldsGravatar Laurent Pinchart 1-18/+15
The try_fmt, try_crop and try_compose fields of the v4l2_subdev_pad_config structure are misnamed (for historical reason) as they also store data for the subdev active configuration. Rename them to format, crop and compose respectively and update the accessor helpers. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2023-11-23media: v4l2-mem2mem.h: fix typo in commentGravatar Deborah Brouwer 1-1/+1
The comment describing the function v4l2_m2m_last_src_buf() says that this function returns the last destination buffer when it actually returns the last source buffer. Fix the comment so that it is accurate. Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2023-11-23media: cec: core: count low-drive, error and arb-lost conditionsGravatar Hans Verkuil 1-2/+20
Count how many Low Drive, Error and Arbitration Lost transmit status errors occurred, and expose that in debugfs. Also log the first 8 transmits that result in Low Drive or Error conditions. That really should not happen with well-behaved CEC devices and good HDMI cables. This is useful to detect and debug HDMI cable issues. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2023-11-23media: media videobuf2: Be more flexible on the number of queue stored buffersGravatar Benjamin Gaignard 1-1/+11
Add 'max_num_buffers' field in vb2_queue struct to let drivers decide how many buffers could be stored in a queue. This require 'bufs' array to be allocated at queue init time and freed when releasing the queue. By default VB2_MAX_FRAME remains the limit. Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2023-11-23media: videobuf2: Add helper to get queue number of buffersGravatar Benjamin Gaignard 1-1/+10
In the future a side effect of introducing DELETE_BUFS ioctl is the create of 'holes' (i.e. unused buffers) in bufs arrays. To know which entries of the bufs arrays are used a bitmap will be added in struct vb2_queue. That will also mean that the number of buffers will be computed given the number of bit set in this bitmap. To smoothly allow this evolution all drives must stop using directly num_buffers field from struct vb2_queue. Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2023-11-23media: videobuf2: Use vb2_buffer instead of indexGravatar Benjamin Gaignard 1-8/+8
Directly use vb2_buffer pointer instead of index inside queue array. Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2023-11-16media: v4l2: Add ignore_streaming flagGravatar Sebastian Fricke 1-0/+7
Add a new flag to the `struct v4l2_m2m_dev` to toggle whether a queue must be streaming in order to allow queuing jobs to the ready queue. Currently, both queues (CAPTURE & OUTPUT) must be streaming in order to allow adding new jobs. This behavior limits the usability of M2M for some drivers, as these have to be able, to perform analysis of the sequence to ensure, that userspace prepares the CAPTURE queue correctly. Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>