summaryrefslogtreecommitdiff
path: root/drivers/staging/media
AgeCommit message (Collapse)Author
2024-02-16media: imx: csc/scaler: fix v4l2_ctrl_handler memory leakLucas Stach
Free the memory allocated in v4l2_ctrl_handler_init on release. Fixes: a8ef0488cc59 ("media: imx: add csc/scaler mem2mem device") Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-02-16staging: media: starfive: Set 16 bpp for capture_raw deviceChanghuang Liang
For StarFive JH7110 Camera Subsystem, capture_raw video device output raw10 pixelformat requires 16bit of alignment. Fixes: e080f339c80a ("media: staging: media: starfive: camss: Add capture driver") Signed-off-by: Changhuang Liang <changhuang.liang@starfivetech.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-02-16media: staging: imx: controls are from another device, mark thisHans Verkuil
The last argument of v4l2_ctrl_add_handler() indicates whether the controls you add are from a control handler owned by another driver (true) or from the same driver (false). In this case the last argument was incorrectly set to false. The control handlers are from different devices. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-02-16media: cedrus: h265: Fix configuring bitstream sizeJernej Skrabec
bit_size field holds size of slice, not slice + header. Because of HW quirks, driver can't program in just slice, but also preceding header. But that means that currently used bit_size is wrong (too small). Instead, just use size of whole buffer. There is no harm in doing this. Fixes: 86caab29da78 ("media: cedrus: Add HEVC/H.265 decoding support") Suggested-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com> Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-02-05media: atomisp: don't use sizeof(NULL)Hans Verkuil
Check the size of another pointer instead of NULL. This fixes this smatch warning: drivers/staging/media/atomisp/pci/sh_css.c:3609 ia_css_pipe_enqueue_buffer() warn: sizeof(NUMBER)? Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-02-05media: atomisp: make dbgopt staticHans Verkuil
This fixes a sparse warning: drivers/staging/media/atomisp/pci/atomisp_drvfs.c:40:14: warning: symbol 'dbgopt' was not declared. Should it be static? Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-02-05media: staging: meson: Fix kerneldocRicardo Ribalda
Remove documentation from missing field. 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-01media: atomisp: Update TODOHans de Goede
Remove the TODO items for using the main (drivers/media/i2c) ov2680 and ov5693 drivers and removing the atomisp specific ones, this has been done. Remove the TODO item for gracefully handling missing firmware the "media: atomisp: Bind and do power-management without firmware" changes have fixed this. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2024-02-01media: atomisp: Remove unnecessary msleep(10) from atomisp_mrfld_power() ↵Hans de Goede
error path Remove unnecessary msleep(10) from atomisp_mrfld_power() error-exit path, the success exit from atomisp_mrfld_power() happens if a test succeeds inside the do { } while loop above the msleep(). The error-exit path with the removed msleep is only hit it the power-on is not reflected in the iUNIT ISPSSPM0 status bits after a timeout of 50 ms. Sleeping an extra 10 ms in the timeout path makes little sense. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2024-02-01media: atomisp: Bind and do power-management without firmwareHans de Goede
The ISP needs to be turned off in a special manner for the SoC to be able to reach S0i3 during suspend. When the firmware is missing still bind to the PCI device and run in pm-only mode which takes care of turning the ISP off (including turning it off again if the firmware has turned it on during resume). In this new pm-only mode the atomisp driver works exactly the same as the non-staging, pm-only drivers/platform/x86/intel/atomisp2/pm.c driver. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2024-02-01media: atomisp: Move power-management [un]init into atomisp_pm_[un]init()Hans de Goede
Move the power-management setup and cleanup code into atomisp_pm_[un]init() helper functions. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2024-02-01media: atomisp: Replace atomisp_drvfs attr with using driver.dev_groups attrHans de Goede
sysfs attributes preferably should not be manually be registered but instead the driver.groups / driver.dev_groups driver struct members should be used to have the driver core handle this in a race free manner. Using driver.groups would be the most direct replacement for driver_[add|remove]_file, but some of the attributes actually need access to the struct atomisp_device (*), so as part of modernizing this part of the atomisp driver this change also makes the sysfs attribute device attributes instead of driver attributes. *) Before this change accessing these attributes without the driver having bound would result in a NULL pointer deref, this commit fixes this. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2024-02-01media: atomisp: Fix probe()/remove() power-managementHans de Goede
Fix probe()/remove() power-management: -Currently the driver uses pm_runtime_put_noidle() and relies on userspace to open + close the /dev/video# node at least once to actually turn the ISP off. Replace the pm_runtime_put_noidle() with pm_runtime_put_sync() to make sure that the device is turned off without relying on userspace for this. This also ensures that atomisp_css_init() is run (by atomisp_power_on()) if the first userspace process opening /dev/video# wants to do more then just query the v4l2-caps. As part of this change move the pm setup code in probe() to just before calling v4l2_async_nf_register() which registers the /dev/* nodes, so that the device is left on for the entirety of the probe() function. -Remove the turning off of the atomisp from the exit-error path, the PCI subsystem and subsequent probe() attempts expect the device to be in the on state when probe() fails. This also fixes the atomisp driver causing the system to hang / freeze when its firmware is missing. This freeze is caused by an unidentified bug in the power-off on exit-error code which is now removed. -Make sure that remove() properly powers on the device by replacing pm_runtime_get_noresume() with pm_runtime_get_sync. The PCI subsystem and subsequent probe() attempts expect the device to be in the on state after unbinding the driver. -Note this also swaps the order of put()/allow() and forbid()/get() so that the sync versions actually work by calling allow() before put() and forbid() after get() Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2024-02-01media: atomisp: Group cpu_latency_qos_add_request() call together with other ↵Hans de Goede
PM calls Group the cpu_latency_qos_add_request() call in probe() together with the other PM calls in probe(). This is a preparation patch for futher PM fixes / work. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2024-02-01media: atomisp: Fix atomisp_pci_remove()Hans de Goede
Fix atomisp_pci_remove(): -Remove uninformative "Removing atomisp driver" log message -Add missing devm_free_irq(), atomisp_uninitialize_modules() and pci_free_irq_vectors() calls -Move atomisp_msi_irq_uninit() down so that the remove() order is an exact mirror of the probe() order Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2024-02-01media: atomisp: Fix probe error-exit pathHans de Goede
Fix probe error-exit path: -Add a missing ia_css_unload_firmware() call when v4l2_async_nf_register() fails -Add a missing pm_runtime_forbid() call to undo the pm_runtime_allow() call -Remove the unnecessary pcim_iounmap_regions() those are devm managed so they will get cleaned up automatically on an error exit from probe() -Rename the labels to avoid having multiple labels pointing to the same place in the error-exit path Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2024-02-01media: atomisp: Call pcim_enable_device() and pcim_iomap_regions() laterHans de Goede
ATM the atomisp firmware is not available in linux-firmware, so most users will not have it installed. Move pcim_enable_device() and pcim_iomap_regions() down in atomisp_pci_probe() so that they are never called when the firmware is not there. This is a preparation patch for making the atomisp driver handle missing firmware better. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2024-02-01media: atomisp: Drop is_valid_device() functionHans de Goede
Now that a single build supports both the ISP 2400 and the ISP 2401 this function is no longer necessary. The main probe() already contains a similar switch (id->device & ATOMISP_PCI_DEVICE_SOC_MASK) checking for a known device_id. Move the revision check into the main probe() and drop the is_valid_device() function. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2024-02-01media: atomisp: Remove remaining deferred firmware loading codeHans de Goede
There is a bunch of dead code left from the deferred firmware loading support which was removed in commit 8972ed6ea7a0 ("media: atomisp: Remove deferred firmware loading support"). Remove this dead code: - Remove the skip_fwload module parameter - Remove the now always NULL fw argument from ia_css_init() - Remove the fw_explicitly_loaded boolean from sh_css.c (this was always true now) - Adjust some function kernel-doc comments to match Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2024-02-01media: atomisp: Remove s_routing subdev callHans de Goede
sensor drivers do not implement the s_routing subdev call, so there is no use in calling it. Also the 3 0 arguments are not the arguments which a successful s_routing call is supposed to take. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2024-02-01media: atomisp: Fix spelling mistake in ia_css_acc_types.hDipendra Khadka
codespell reported spelling mistakes in ia_css_acc_types.h as below: ''' ia_css_acc_types.h:87: cummulative ==> cumulative ia_css_acc_types.h:411: descibes ==> describes ''' This patch fixes these spelling mistakes. Word "cummulative" is changed to "accumulation" and "descibes" to "describes". Link: https://lore.kernel.org/r/20231223141157.95501-1-kdipendra88@gmail.com Signed-off-by: Dipendra Khadka <kdipendra88@gmail.com> Reviewed-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2024-02-01media: atomisp: Fix spelling mistake in binary.cDipendra Khadka
codespell reported following spelling mistake in runtime/binary/src as below: ''' ./runtime/binary/src/binary.c:537: spcification ==> specification ''' This patch fixes thisspelling mistake. Link: https://lore.kernel.org/r/20231223091521.85467-1-kdipendra88@gmail.com Signed-off-by: Dipendra Khadka <kdipendra88@gmail.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2024-02-01media: atomisp: Fix spelling mistakes in ia_css_hdr_types.hDipendra Khadka
codespell reported following spelling mistake in ia_css_hdr_types.h below: ''' ./isp/kernels/hdr/ia_css_hdr_types.h:60: paramterers ==> parameters ./isp/kernels/hdr/ia_css_hdr_types.h:62: Currenly ==> Currently ''' This patch fixes these spelling mistakes. Link: https://lore.kernel.org/r/20231223083157.84090-1-kdipendra88@gmail.com Signed-off-by: Dipendra Khadka <kdipendra88@gmail.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2024-02-01media: atomisp: Fix spelling mistakes in ia_css_macc_table.host.cDipendra Khadka
codespell reported following spelling mistake in ia_css_macc_table.host.c below: ''' ./isp/kernels/macc/macc_1.0/ia_css_macc_table.host.c:22: matix ==> matrix ./isp/kernels/macc/macc_1.0/ia_css_macc_table.host.c:39: matix ==> matrix ''' This patch fixes these spelling mistakes. Link: https://lore.kernel.org/r/20231223081354.83318-1-kdipendra88@gmail.com Signed-off-by: Dipendra Khadka <kdipendra88@gmail.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2024-02-01media: atomisp: Fix spelling mistakes in rmgr_vbuf.cDipendra Khadka
codespell reported following spelling mistake in rmgr_vbuf.cas below: ''' ./runtime/rmgr/src/rmgr_vbuf.c:201: succes ==> success ./runtime/rmgr/src/rmgr_vbuf.c:211: succes ==> success ./runtime/rmgr/src/rmgr_vbuf.c:215: succes ==> success ''' This patch fixes these spelling mistakes. It is good to use variable name that gives proper meaning and spelling error free. Link: https://lore.kernel.org/r/20231223072245.81630-1-kdipendra88@gmail.com Signed-off-by: Dipendra Khadka <kdipendra88@gmail.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2024-02-01media: atomisp: Fix spelling mistakes in queue.cDipendra Khadka
codespell reported following spelling mistake in queue.c as below: ''' ./runtime/queue/src/queue.c:126: uncessary ==> unnecessary ./runtime/queue/src/queue.c:183: uncessary ==> unnecessary ''' This patch fixes these spelling mistakes. Link: https://lore.kernel.org/r/20231223071157.81082-1-kdipendra88@gmail.com Signed-off-by: Dipendra Khadka <kdipendra88@gmail.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2024-02-01media: atomisp: Fix spelling mistakes in sh_css_mipi.cDipendra Khadka
codespell reported following spelling mistake in sh_css_mipi.c as below: ''' ./sh_css_mipi.c:177: separatelly ==> separately ./sh_css_mipi.c:540: ofset ==> offset, of set ''' This patch fixes these spelling mistakes by changing "separatelly" to "separately" and "ofset" to "offset". Link: https://lore.kernel.org/r/20231223064152.79712-1-kdipendra88@gmail.com Signed-off-by: Dipendra Khadka <kdipendra88@gmail.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2024-02-01media: atomisp: Fix spelling mistake in ia_css_circbuf.hDipendra Khadka
codespell reported following spelling mistake in ia_css_circbuf.h as below: ''' ./base/circbuf/interface/ia_css_circbuf.h:76: poistion ==> position ''' This patch fixes this spelling mistake. Link: https://lore.kernel.org/r/20231223061647.78669-1-kdipendra88@gmail.com Signed-off-by: Dipendra Khadka <kdipendra88@gmail.com> Acked-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2024-02-01media: atomisp: Fix spelling mistakes in circbuf.cDipendra Khadka
codespell reported following spelling mistakes in circbuf.c as below: ''' ./circbuf.c:27: whehter ==> whether ./circbuf.c:132: offest ==> offset ''' This patch fixes these spelling mistakes. Link: https://lore.kernel.org/r/20231223060422.77789-1-kdipendra88@gmail.com Signed-off-by: Dipendra Khadka <kdipendra88@gmail.com> Acked-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2024-02-01media: atomisp: Fix spelling mistake in isp2400_input_system_global.hDipendra Khadka
The script checkpatch.pl reported a spelling error in isp2400_input_system_global.h as below: ''' WARNING: 'upto' may be misspelled - perhaps 'up to'? //MIPI allows upto 4 channels. ^^^^ ''' This patch corrects a spelling error, changing "upto" to "up to". Link: https://lore.kernel.org/r/20231222201503.2337-1-kdipendra88@gmail.com Signed-off-by: Dipendra Khadka <kdipendra88@gmail.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2024-02-01media: atomisp: Fix repeated "of" in isp2400_input_system_public.hDipendra Khadka
The script checkpatch.pl reported repeated word 'of' in isp2400_input_system_public.h as below: ''' WARNING: Possible repeated word: 'of' /*! Read from a control register PORT[port_ID] of of RECEIVER[ID] ''' This patch removes one 'of'. Link: https://lore.kernel.org/r/20231222194036.1984-1-kdipendra88@gmail.com Signed-off-by: Dipendra Khadka <kdipendra88@gmail.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2024-02-01media: atomisp: Remove redundant assignments to variablesColin Ian King
There are several variables that are being initialized with values that are never read, the assignment are redundant and can be removed. Cleans up cppcheck unreadVariable warnings. Link: https://lore.kernel.org/r/20231219143929.367929-1-colin.i.king@gmail.com Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2024-02-01media: atomisp: Fix a spelling mistake in sh_css_defs.hDipendra Khadka
The script checkpatch.pl reported a spelling error in sh_css_defs.h as below: ''' WARNING: 'upto' may be misspelled - perhaps 'up to'? /* The FPGA system (vec_nelems == 16) only supports upto 5MP */ ^^^^ ''' This patch corrects a spelling error, changing "upto" to "up to". Link: https://lore.kernel.org/r/20231218153200.450148-1-kdipendra88@gmail.com Signed-off-by: Dipendra Khadka <kdipendra88@gmail.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2024-02-01media: atomisp: Fix spelling mistakes in ia_css_irq.hDipendra Khadka
The script checkpatch.pl reported spelling errors in ia_css_irq.h as below: ''' WARNING: Possible repeated word: 'in' /** the input system in in error */ WARNING: Possible repeated word: 'in' /** the input formatter in in error */ WARNING: Possible repeated word: 'in' /** the dma in in error */ ''' This patch corrects spelling errors, changing "in" to "is" in all three comments. Link: https://lore.kernel.org/r/20231218151704.449883-1-kdipendra88@gmail.com Signed-off-by: Dipendra Khadka <kdipendra88@gmail.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2024-02-01media: atomisp: Removed duplicate comment and fixed comment formatJonathan Bergh
Fixed the following issues: * Removed a duplicate comment * Fixed up minor comment format issue Link: https://lore.kernel.org/r/20231014083545.173238-1-bergh.jonathan@gmail.com Signed-off-by: Jonathan Bergh <bergh.jonathan@gmail.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2024-02-01media: atomisp: Refactor sensor crop + fmt settingHans de Goede
There are 3 code-paths all of 3 which need to do: 1. Get try or active state 2. lock state 3. Call atomisp_set_crop() 4. Call v4l2_subdev_call(input->camera, pad, set_fmt, state, fmt) 5. unlock state Change atomisp_set_crop into atomisp_set_crop_and_fmt() which does all of this and change the 3 code-paths which need this to use the new atomisp_set_crop_and_fmt() function. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2024-02-01media: atomisp: Adjust for v4l2_subdev_state handling changes in 6.8Hans de Goede
The atomisp driver emulates a standard v4l2 device, which also works for non media-controller aware applications. Part of this requires making try_fmt calls on the sensor when a normal v4l2 app is making try_fmt calls on the /dev/video# mode. With the recent v4l2_subdev_state handling changes in 6.8 this no longer works, fixing this requires 2 changes: 1. The atomisp code was using its own internal v4l2_subdev_pad_config for this. Replace the internal v4l2_subdev_pad_config with allocating a full v4l2_subdev_state for storing the full try_fmt state. 2. The paths actually setting the fmt or crop selection now need to be passed the v4l2_subdev's active state, so that sensor drivers which are using the v4l2_subdev's active state to store their state keep working. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2024-01-22media: staging: ipu3-imgu: Set fields before media_entity_pads_init()Hidenori Kobayashi
The imgu driver fails to probe with the following message because it does not set the pad's flags before calling media_entity_pads_init(). [ 14.596315] ipu3-imgu 0000:00:05.0: failed initialize subdev media entity (-22) [ 14.596322] ipu3-imgu 0000:00:05.0: failed to register subdev0 ret (-22) [ 14.596327] ipu3-imgu 0000:00:05.0: failed to register pipes (-22) [ 14.596331] ipu3-imgu 0000:00:05.0: failed to create V4L2 devices (-22) Fix the initialization order so that the driver probe succeeds. The ops initialization is also moved together for readability. Fixes: a0ca1627b450 ("media: staging/intel-ipu3: Add v4l2 driver based on media framework") Cc: <stable@vger.kernel.org> # 6.7 Cc: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Hidenori Kobayashi <hidenorik@chromium.org> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-01-22staging: media: ipu3: Remove some excess struct member documentationJonathan Corbet
Remove kerneldoc entries for struct members that do not exist, fixing these warnings: ./drivers/staging/media/ipu3/include/uapi/intel-ipu3.h:2522: warning: Excess struct member 'reserved1' description in 'ipu3_uapi_acc_param' ./drivers/staging/media/ipu3/include/uapi/intel-ipu3.h:2522: warning: Excess struct member 'reserved2' description in 'ipu3_uapi_acc_param' ./drivers/staging/media/ipu3/include/uapi/intel-ipu3.h:2778: warning: Excess struct member '__acc_osys' description in 'ipu3_uapi_flags' Signed-off-by: Jonathan Corbet <corbet@lwn.net> 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_queueBenjamin Gaignard
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: Add which field to struct v4l2_subdev_frame_intervalLaurent Pinchart
Due to a historical mishap, the v4l2_subdev_frame_interval structure is the only part of the V4L2 subdev userspace API that doesn't contain a 'which' field. This prevents trying frame intervals using the subdev 'TRY' state mechanism. Adding a 'which' field is simple as the structure has 8 reserved fields. This would however break userspace as the field is currently set to 0, corresponding to V4L2_SUBDEV_FORMAT_TRY, while the corresponding ioctls currently operate on the 'ACTIVE' state. We thus need to add a new subdev client cap, V4L2_SUBDEV_CLIENT_CAP_INTERVAL_USES_WHICH, to indicate that userspace is aware of this new field. All drivers that implement the subdev .get_frame_interval() and .set_frame_interval() operations are updated to return -EINVAL when operating on the TRY state, preserving the current behaviour. While at it, fix a bad copy&paste in the documentation of the struct v4l2_subdev_frame_interval_enum 'which' field. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> # for imx-media Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> # for tegra-video Reviewed-by: Mauro Carvalho Chehab <mchehab@kernel.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: v4l2-subdev: Turn .[gs]_frame_interval into pad operationsLaurent Pinchart
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-07staging: media: VIDEO_STARFIVE_CAMSS should depend on ARCH_STARFIVEGeert Uytterhoeven
The StarFive Camera Subsystem is only present on the StarFive JH7110 SoC. Hence add a dependency on ARCH_STARFIVE, to prevent asking the user about this driver when configuring a kernel without StarFive SoC support. Fixes: bba185d141b1 ("media: staging: media: starfive: camss: Add core driver") Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Changhuang Liang <changhuang.liang@starfivetech.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-07media: staging: starfive: camss: fix off by one in isp_enum_mbus_code()Dan Carpenter
These > comparisons should be >=. The formats->fmts[] array is either a pointer to isp_formats_sink[] or isp_formats_source[] respectively. Fixes: e57854628f58 ("media: staging: media: starfive: camss: Add ISP driver") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Changhuang Liang <changhuang.liang@starfivetech.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-04media: v4l2-subdev: Rename .init_cfg() operation to .init_state()Laurent Pinchart
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: Switch to stream-aware state functionsSakari Ailus
Switch all drivers accessing sub-device state to use the stream-aware functions. We will soon remove the old ones. This patch has been generated using the following Coccinelle script: ---------8<------------ @@ expression E1, E2, E3; @@ - v4l2_subdev_get_pad_format(E1, E2, E3) + v4l2_subdev_state_get_format(E2, E3) @@ expression E1, E2, E3; @@ - v4l2_subdev_get_pad_crop(E1, E2, E3) + v4l2_subdev_state_get_crop(E2, E3) @@ expression E1, E2, E3; @@ - v4l2_subdev_get_pad_compose(E1, E2, E3) + v4l2_subdev_state_get_compose(E2, E3) @@ expression E1, E2, E3; @@ - v4l2_subdev_get_try_format(E1, E2, E3) + v4l2_subdev_state_get_format(E2, E3) @@ expression E1, E2, E3; @@ - v4l2_subdev_get_try_crop(E1, E2, E3) + v4l2_subdev_state_get_crop(E2, E3) @@ expression E1, E2, E3; @@ - v4l2_subdev_get_try_compose(E1, E2, E3) + v4l2_subdev_state_get_compose(E2, E3) ---------8<------------ Additionally drivers/media/i2c/s5k5baf.c and drivers/media/platform/samsung/s3c-camif/camif-capture.c have been manually changed as Coccinelle didn't. Further local variables have been removed as they became unused as a result of the other changes. Also Coccinelle introduced indentation by space in files drivers/media/i2c/st-mipid02.c and drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c. This has been also corrected. The diff from Coccinelle-generated changes are: > diff --git b/drivers/media/i2c/imx319.c a/drivers/media/i2c/imx319.c > index e549692ff478..420984382173 100644 > --- b/drivers/media/i2c/imx319.c > +++ a/drivers/media/i2c/imx319.c > @@ -2001,7 +2001,6 @@ static int imx319_do_get_pad_format(struct imx319 *imx319, > struct v4l2_subdev_format *fmt) > { > struct v4l2_mbus_framefmt *framefmt; > - struct v4l2_subdev *sd = &imx319->sd; > > if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { > framefmt = v4l2_subdev_state_get_format(sd_state, fmt->pad); > diff --git b/drivers/media/i2c/imx355.c a/drivers/media/i2c/imx355.c > index 96bdde685d65..e1b1d2fc79dd 100644 > --- b/drivers/media/i2c/imx355.c > +++ a/drivers/media/i2c/imx355.c > @@ -1299,7 +1299,6 @@ static int imx355_do_get_pad_format(struct imx355 *imx355, > struct v4l2_subdev_format *fmt) > { > struct v4l2_mbus_framefmt *framefmt; > - struct v4l2_subdev *sd = &imx355->sd; > > if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { > framefmt = v4l2_subdev_state_get_format(sd_state, fmt->pad); > diff --git b/drivers/media/i2c/ov08x40.c a/drivers/media/i2c/ov08x40.c > index ca799bbcfdb7..abbb0b774d43 100644 > --- b/drivers/media/i2c/ov08x40.c > +++ a/drivers/media/i2c/ov08x40.c > @@ -2774,7 +2774,6 @@ static int ov08x40_do_get_pad_format(struct ov08x40 *ov08x, > struct v4l2_subdev_format *fmt) > { > struct v4l2_mbus_framefmt *framefmt; > - struct v4l2_subdev *sd = &ov08x->sd; > > if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { > framefmt = v4l2_subdev_state_get_format(sd_state, fmt->pad); > diff --git b/drivers/media/i2c/ov13858.c a/drivers/media/i2c/ov13858.c > index 7816d9787c61..09387e335d80 100644 > --- b/drivers/media/i2c/ov13858.c > +++ a/drivers/media/i2c/ov13858.c > @@ -1316,7 +1316,6 @@ static int ov13858_do_get_pad_format(struct ov13858 *ov13858, > struct v4l2_subdev_format *fmt) > { > struct v4l2_mbus_framefmt *framefmt; > - struct v4l2_subdev *sd = &ov13858->sd; > > if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { > framefmt = v4l2_subdev_state_get_format(sd_state, fmt->pad); > diff --git b/drivers/media/i2c/ov13b10.c a/drivers/media/i2c/ov13b10.c > index 268cd4b03f9c..c06411d5ee2b 100644 > --- b/drivers/media/i2c/ov13b10.c > +++ a/drivers/media/i2c/ov13b10.c > @@ -1001,7 +1001,6 @@ static int ov13b10_do_get_pad_format(struct ov13b10 *ov13b, > struct v4l2_subdev_format *fmt) > { > struct v4l2_mbus_framefmt *framefmt; > - struct v4l2_subdev *sd = &ov13b->sd; > > if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { > framefmt = v4l2_subdev_state_get_format(sd_state, fmt->pad); > diff --git b/drivers/media/i2c/s5c73m3/s5c73m3-core.c a/drivers/media/i2c/s5c73m3/s5c73m3-core.c > index 47605e36bc60..8f9b5713daf7 100644 > --- b/drivers/media/i2c/s5c73m3/s5c73m3-core.c > +++ a/drivers/media/i2c/s5c73m3/s5c73m3-core.c > @@ -819,7 +819,6 @@ static void s5c73m3_oif_try_format(struct s5c73m3 *state, > struct v4l2_subdev_format *fmt, > const struct s5c73m3_frame_size **fs) > { > - struct v4l2_subdev *sd = &state->sensor_sd; > u32 code; > > switch (fmt->pad) { > diff --git a/drivers/media/i2c/s5k5baf.c b/drivers/media/i2c/s5k5baf.c > index 67da2045f543..03ccfb0e1e11 100644 > --- a/drivers/media/i2c/s5k5baf.c > +++ b/drivers/media/i2c/s5k5baf.c > @@ -1472,14 +1472,11 @@ static int s5k5baf_set_selection(struct v4l2_subdev *sd, > > if (sel->which == V4L2_SUBDEV_FORMAT_TRY) { > rects = (struct v4l2_rect * []) { > - &s5k5baf_cis_rect, > - v4l2_subdev_get_try_crop(sd, sd_state, > - PAD_CIS), > - v4l2_subdev_get_try_compose(sd, sd_state, > - PAD_CIS), > - v4l2_subdev_get_try_crop(sd, sd_state, > - PAD_OUT) > - }; > + &s5k5baf_cis_rect, > + v4l2_subdev_state_get_crop(sd_state, PAD_CIS), > + v4l2_subdev_state_get_compose(sd_state, PAD_CIS), > + v4l2_subdev_state_get_crop(sd_state, PAD_OUT) > + }; > s5k5baf_set_rect_and_adjust(rects, rtype, &sel->r); > return 0; > } > diff --git b/drivers/media/platform/samsung/s3c-camif/camif-capture.c a/drivers/media/platform/samsung/s3c-camif/camif-capture.c > index 295e083f38e8..be58260ea67e 100644 > --- b/drivers/media/platform/samsung/s3c-camif/camif-capture.c > +++ a/drivers/media/platform/samsung/s3c-camif/camif-capture.c > @@ -1216,7 +1216,7 @@ static int s3c_camif_subdev_get_fmt(struct v4l2_subdev *sd, > struct v4l2_mbus_framefmt *mf = &fmt->format; > > if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { > - mf = v4l2_subdev_get_try_format(sd, sd_state, fmt->pad); > + mf = v4l2_subdev_state_get_format(sd_state, fmt->pad); > fmt->format = *mf; > return 0; > } > @@ -1305,7 +1305,7 @@ static int s3c_camif_subdev_set_fmt(struct v4l2_subdev *sd, > __camif_subdev_try_format(camif, mf, fmt->pad); > > if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { > - mf = v4l2_subdev_get_try_format(sd, sd_state, fmt->pad); > + mf = v4l2_subdev_state_get_format(sd_state, fmt->pad); > *mf = fmt->format; > mutex_unlock(&camif->lock); > return 0; > diff --git b/drivers/media/platform/ti/cal/cal-camerarx.c a/drivers/media/platform/ti/cal/cal-camerarx.c > index cea454ed9c20..61433744c6c4 100644 > --- b/drivers/media/platform/ti/cal/cal-camerarx.c > +++ a/drivers/media/platform/ti/cal/cal-camerarx.c > @@ -621,8 +621,6 @@ static int cal_camerarx_sd_enum_mbus_code(struct v4l2_subdev *sd, > struct v4l2_subdev_state *state, > struct v4l2_subdev_mbus_code_enum *code) > { > - struct cal_camerarx *phy = to_cal_camerarx(sd); > - > /* No transcoding, source and sink codes must match. */ > if (cal_rx_pad_is_source(code->pad)) { > struct v4l2_mbus_framefmt *fmt; > diff --git b/drivers/staging/media/imx/imx-ic-prp.c a/drivers/staging/media/imx/imx-ic-prp.c > index dd558fac6477..61d69f19657e 100644 > --- b/drivers/staging/media/imx/imx-ic-prp.c > +++ a/drivers/staging/media/imx/imx-ic-prp.c > @@ -82,8 +82,6 @@ static struct v4l2_mbus_framefmt * > __prp_get_fmt(struct prp_priv *priv, struct v4l2_subdev_state *sd_state, > unsigned int pad, enum v4l2_subdev_format_whence which) > { > - struct imx_ic_priv *ic_priv = priv->ic_priv; > - > if (which == V4L2_SUBDEV_FORMAT_TRY) > return v4l2_subdev_state_get_format(sd_state, pad); > else > diff --git b/drivers/staging/media/imx/imx-ic-prpencvf.c a/drivers/staging/media/imx/imx-ic-prpencvf.c > index 02db7dbb884b..ec73c901079e 100644 > --- b/drivers/staging/media/imx/imx-ic-prpencvf.c > +++ a/drivers/staging/media/imx/imx-ic-prpencvf.c > @@ -790,8 +790,6 @@ static struct v4l2_mbus_framefmt * > __prp_get_fmt(struct prp_priv *priv, struct v4l2_subdev_state *sd_state, > unsigned int pad, enum v4l2_subdev_format_whence which) > { > - struct imx_ic_priv *ic_priv = priv->ic_priv; > - > if (which == V4L2_SUBDEV_FORMAT_TRY) > return v4l2_subdev_state_get_format(sd_state, pad); > else > diff --git a/drivers/media/i2c/st-mipid02.c b/drivers/media/i2c/st-mipid02.c > index 9c9361354c00..b08a249b5fdd 100644 > --- a/drivers/media/i2c/st-mipid02.c > +++ b/drivers/media/i2c/st-mipid02.c > @@ -751,7 +751,7 @@ static void mipid02_set_fmt_source(struct v4l2_subdev *sd, > format->format = bridge->fmt; > else > format->format = *v4l2_subdev_state_get_format(sd_state, > - MIPID02_SINK_0); > + MIPID02_SINK_0); > > /* but code may need to be converted */ > format->format.code = serial_to_parallel_code(format->format.code); > diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c > index 117912d3bfbd..96353648c032 100644 > --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c > +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c > @@ -319,7 +319,7 @@ static void rkisp1_isp_start(struct rkisp1_isp *isp, > rkisp1_write(rkisp1, RKISP1_CIF_ISP_CTRL, val); > > src_fmt = v4l2_subdev_state_get_format(sd_state, > - RKISP1_ISP_PAD_SOURCE_VIDEO); > + RKISP1_ISP_PAD_SOURCE_VIDEO); > src_info = rkisp1_mbus_info_get_by_code(src_fmt->code); > > if (src_info->pixel_enc != V4L2_PIXEL_ENC_BAYER) > @@ -475,9 +475,9 @@ static void rkisp1_isp_set_src_fmt(struct rkisp1_isp *isp, > sink_fmt = v4l2_subdev_state_get_format(sd_state, > RKISP1_ISP_PAD_SINK_VIDEO); > src_fmt = v4l2_subdev_state_get_format(sd_state, > - RKISP1_ISP_PAD_SOURCE_VIDEO); > + RKISP1_ISP_PAD_SOURCE_VIDEO); > src_crop = v4l2_subdev_state_get_crop(sd_state, > - RKISP1_ISP_PAD_SOURCE_VIDEO); > + RKISP1_ISP_PAD_SOURCE_VIDEO); > > /* > * Media bus code. The ISP can operate in pass-through mode (Bayer in, 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: ti: omap4iss: Fix references to pad configLaurent Pinchart
V4L2 subdev operations have moved from operating on a v4l2_subdev_pad_config to a v4l2_subdev_state a long time ago. Fix remaining incorrect references to pad config in comments. 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: tegra-video: Use accessors for pad config 'try_*' fieldsLaurent Pinchart
The 'try_*' fields of the v4l2_subdev_pad_config structure are meant to be accessed through helper functions. Replace direct access with usage of the v4l2_subdev_get_pad_format(), v4l2_subdev_get_pad_crop() and v4l2_subdev_get_pad_compose() helpers. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2023-11-23media: atomisp: Use accessors for pad config 'try_*' fieldsLaurent Pinchart
The 'try_*' fields of the v4l2_subdev_pad_config structure are meant to be accessed through helper functions. Replace direct access with usage of the v4l2_subdev_get_pad_format(), v4l2_subdev_get_pad_crop() and v4l2_subdev_get_pad_compose() 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: atmel-isc: Use accessors for pad config 'try_*' fieldsLaurent Pinchart
The 'try_*' fields of the v4l2_subdev_pad_config structure are meant to be accessed through helper functions. Replace direct access with usage of the v4l2_subdev_get_pad_format(), v4l2_subdev_get_pad_crop() and v4l2_subdev_get_pad_compose() 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>