aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-02-05media: mc: Expand MUST_CONNECT flag to always require an enabled linkLaurent Pinchart2-16/+48
The MEDIA_PAD_FL_MUST_CONNECT flag indicates that the pad requires an enabled link to stream, but only if it has any link at all. This makes little sense, as if a pad is part of a pipeline, there are very few use cases for an active link to be mandatory only if links exist at all. A review of in-tree drivers confirms they all need an enabled link for pads marked with the MEDIA_PAD_FL_MUST_CONNECT flag. Expand the scope of the flag by rejecting pads that have no links at all. This requires modifying the pipeline build code to add those pads to the pipeline. Cc: [email protected] # 6.1 Signed-off-by: Laurent Pinchart <[email protected]> Acked-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-02-05media: mc: Rename pad variable to clarify intentLaurent Pinchart1-5/+6
The pad local variable in the media_pipeline_explore_next_link() function is used to store the pad through which the entity has been reached. Rename it to origin to reflect that and make the code easier to read. This will be even more important in subsequent commits when expanding the function with additional logic. Cc: [email protected] # 6.1 Signed-off-by: Laurent Pinchart <[email protected]> Acked-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-02-05media: mc: Add num_links flag to media_padLaurent Pinchart2-0/+8
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: [email protected] # 6.1 Signed-off-by: Laurent Pinchart <[email protected]> Acked-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-02-05media: nxp: imx8-isi: Check whether crossbar pad is non-NULL before accessMarek Vasut1-1/+7
When translating source to sink streams in the crossbar subdev, the driver tries to locate the remote subdev connected to the sink pad. The remote pad may be NULL, if userspace tries to enable a stream that ends at an unconnected crossbar sink. When that occurs, the driver dereferences the NULL pad, leading to a crash. Prevent the crash by checking if the pad is NULL before using it, and return an error if it is. Cc: [email protected] # 6.1 Fixes: cf21f328fcaf ("media: nxp: Add i.MX8 ISI driver") Signed-off-by: Marek Vasut <[email protected]> Reviewed-by: Kieran Bingham <[email protected]> Reviewed-by: Fabio Estevam <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Laurent Pinchart <[email protected]> Acked-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-02-05media: mc: Fix flags handling when creating pad linksLaurent Pinchart1-1/+6
The media_create_pad_link() function doesn't correctly clear reject link type flags, nor does it set the DATA_LINK flag. It only works because the MEDIA_LNK_FL_DATA_LINK flag's value is 0. Fix it by returning an error if any link type flag is set. This doesn't introduce any regression, as nobody calls the media_create_pad_link() function with link type flags (easily checked by grepping for the flag in the source code, there are very few hits). Set the MEDIA_LNK_FL_DATA_LINK explicitly, which is a no-op that the compiler will optimize out, but is still useful to make the code more explicit and easier to understand. Cc: [email protected] # 6.1 Signed-off-by: Laurent Pinchart <[email protected]> Acked-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-02-05media: mc: Add local pad to pipeline regardless of the link stateLaurent Pinchart1-9/+9
When building pipelines by following links, the media_pipeline_explore_next_link() function only traverses enabled links. The remote pad of a disabled link is not added to the pipeline, and neither is the local pad. While the former is correct as disabled links should not be followed, not adding the local pad breaks processing of the MEDIA_PAD_FL_MUST_CONNECT flag. The MEDIA_PAD_FL_MUST_CONNECT flag is checked in the __media_pipeline_start() function that iterates over all pads after populating the pipeline. If the pad is not present, the check gets skipped, rendering it useless. Fix this by adding the local pad of all links regardless of their state, only skipping the remote pad for disabled links. Cc: [email protected] # 6.1 Fixes: ae219872834a ("media: mc: entity: Rewrite media_pipeline_start()") Reported-by: Frieder Schrempf <[email protected]> Closes: https://lore.kernel.org/linux-media/[email protected] Signed-off-by: Laurent Pinchart <[email protected]> Acked-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-02-05media: media-devnode: make media_bus_type constRicardo B. Marliere1-1/+1
Now that the driver core can properly handle constant struct bus_type, move the media_bus_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime. Cc: Greg Kroah-Hartman <[email protected]> Suggested-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Ricardo B. Marliere <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-02-05media: cec: make cec_bus_type constRicardo B. Marliere1-1/+1
Now that the driver core can properly handle constant struct bus_type, move the cec_bus_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime. Cc: Greg Kroah-Hartman <[email protected]> Suggested-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Ricardo B. Marliere <[email protected]> Reviewed-by: Greg Kroah-Hartman <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-02-05documentation: media: vivid: Modify typo in documentationDorcas Anono Litunya1-1/+1
Correct the default value of node_type vivid parameter to 0xe1d3d. Signed-off-by: Dorcas Anono Litunya <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-02-05media: dt-bindings: techwell,tw9900: Fix port schema refRob Herring1-1/+1
The port@0 node doesn't define any extra properties in the port or endpoint nodes, so the $ref should be to "/properties/port" instead as it restricts extra properties. Fixes: 0f82ffa9a295 ("media: dt-bindings: media: i2c: Add bindings for TW9900") Signed-off-by: Rob Herring <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-02-05media: atomisp: don't use sizeof(NULL)Hans Verkuil1-1/+1
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 <[email protected]>
2024-02-05media: atomisp: make dbgopt staticHans Verkuil1-1/+1
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 <[email protected]>
2024-02-05media: v4l2-common.h: kerneldoc: correctly format return valuesHans Verkuil1-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 <[email protected]> Fixes: a68e88e2cf9e ("media: v4l: Add a helper for setting up link-frequencies control") Acked-by: Sakari Ailus <[email protected]>
2024-02-05media: v4l2-mem2mem: fix a memleak in v4l2_m2m_register_entityZhipeng Lu1-2/+8
The entity->name (i.e. name) is allocated in v4l2_m2m_register_entity but isn't freed in its following error-handling paths. This patch adds such deallocation to prevent memleak of entity->name. Fixes: be2fff656322 ("media: add helpers for memory-to-memory media controller") Signed-off-by: Zhipeng Lu <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-02-05media: v4l2-tpg: fix some memleaks in tpg_allocZhipeng Lu1-10/+42
In tpg_alloc, resources should be deallocated in each and every error-handling paths, since they are allocated in for statements. Otherwise there would be memleaks because tpg_free is called only when tpg_alloc return 0. Fixes: 63881df94d3e ("[media] vivid: add the Test Pattern Generator") Signed-off-by: Zhipeng Lu <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-02-05MAINTAINERS: Add entry for Samsung MFC DT SchemaAakarsh Jain1-0/+1
Add device tree schema entry for Samsung MFC. Signed-off-by: Aakarsh Jain <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-02-05media: staging: meson: Fix kerneldocRicardo Ribalda1-1/+0
Remove documentation from missing field. Signed-off-by: Ricardo Ribalda <[email protected]> Reviewed-by: Randy Dunlap <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-02-05media: dvb-usb: Fix kerneldocRicardo Ribalda1-2/+0
Remove kerneldoc from missing fields. Signed-off-by: Ricardo Ribalda <[email protected]> Reviewed-by: Randy Dunlap <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-02-05media: samsung: s5p-mfc: Fix kerneldocRicardo Ribalda1-1/+0
Remove doc from missing fields. Signed-off-by: Ricardo Ribalda <[email protected]> Reviewed-by: Randy Dunlap <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-02-05media: samsung: exynos4-is: Fix kerneldocRicardo Ribalda1-3/+0
Remove doc from missing fields. Signed-off-by: Ricardo Ribalda <[email protected]> Reviewed-by: Randy Dunlap <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-02-05media: qcom: venus: Fix kerneldocRicardo Ribalda1-1/+0
Remove doc for missing field. Signed-off-by: Ricardo Ribalda <[email protected]> Reviewed-by: Randy Dunlap <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-02-05media: verisilicon: Fix kerneldocRicardo Ribalda1-1/+0
The field is not part of the structure. Remove the doc. Signed-off-by: Ricardo Ribalda <[email protected]> Reviewed-by: Randy Dunlap <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-02-05media: mediatek: vcodec: Fix kerneldocRicardo Ribalda3-3/+0
Those fields have been removed. They do not need to be documented. Signed-off-by: Ricardo Ribalda <[email protected]> Reviewed-by: Randy Dunlap <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-02-05media: mediatek: jpeg: Fix kerneldocRicardo Ribalda1-1/+0
The field is gone, remove the documentation for it. Signed-off-by: Ricardo Ribalda <[email protected]> Reviewed-by: Randy Dunlap <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-02-05media: i2c: adv748: Fix kerneldocRicardo Ribalda1-1/+0
The field is gone, remove the documentation. Signed-off-by: Ricardo Ribalda <[email protected]> Reviewed-by: Randy Dunlap <[email protected]> Reviewed-by: Kieran Bingham <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-02-05media: i2c: css-quirk.h: Fix kerneldocRicardo Ribalda1-4/+4
Kerneldoc does not seem to understand that embed doc: drivers/media/i2c/ccs/ccs-quirk.h:50: warning: Excess struct member 'write' description in 'ccs_quirk' drivers/media/i2c/ccs/ccs-quirk.h:50: warning: Excess struct member 'reg' description in 'ccs_quirk' drivers/media/i2c/ccs/ccs-quirk.h:50: warning: Excess struct member 'val' description in 'ccs_quirk' Convert into a standard doc. Signed-off-by: Ricardo Ribalda <[email protected]> Reviewed-by: Randy Dunlap <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-02-05media: pci: dt315.h: Fix kerneldocRicardo Ribalda1-1/+0
The field is gone, remove it. Signed-off-by: Ricardo Ribalda <[email protected]> Reviewed-by: Randy Dunlap <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-02-05media: cec.h: Fix kerneldocRicardo Ribalda1-2/+0
The fields are gone, remove their documentation. Signed-off-by: Ricardo Ribalda <[email protected]> Reviewed-by: Randy Dunlap <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-02-05media: videodev2.h: Fix kerneldocRicardo Ribalda1-16/+16
Named nested unions need their prefix: https://www.kernel.org/doc/html/latest/doc-guide/kernel-doc.html#nested-structs-unions Signed-off-by: Ricardo Ribalda <[email protected]> Reviewed-by: Randy Dunlap <[email protected]> Tested-by: Randy Dunlap <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-02-05media: cec: core: remove length check of Timer StatusNini Song1-14/+0
The valid_la is used to check the length requirements, including special cases of Timer Status. If the length is shorter than 5, that means no Duration Available is returned, the message will be forced to be invalid. However, the description of Duration Available in the spec is that this parameter may be returned when these cases, or that it can be optionally return when these cases. The key words in the spec description are flexible choices. Remove the special length check of Timer Status to fit the spec which is not compulsory about that. Signed-off-by: Nini Song <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-02-05media: v4l2-ctrls: show all owned controls in log_statusHans Verkuil1-5/+13
VIDIOC_LOG_STATUS will log the controls owned by the driver. But the code didn't take into account the case where a single driver creates multiple control handlers. A good example is the vivid driver, but others use it as well. Modify v4l2_ctrl_handler_log_status() so that it really shows all controls owned by this driver. Signed-off-by: Hans Verkuil <[email protected]>
2024-02-05media: cx231xx: controls are from another device, mark thisHans Verkuil1-1/+1
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 controls come from the cx25840 subdev. Signed-off-by: Hans Verkuil <[email protected]>
2024-02-05media: em28xx: annotate unchecked call to media_device_register()Nikita Zhandarovich1-0/+4
Static analyzers generate alerts for an unchecked call to `media_device_register()`. However, in this case, the device will work reliably without the media controller API. Add a comment above the call to prevent future unnecessary changes. Suggested-by: Mauro Carvalho Chehab <[email protected]> Fixes: 37ecc7b1278f ("[media] em28xx: add media controller support") Signed-off-by: Nikita Zhandarovich <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-02-05media: videobuf2: Fix doc commentAndrzej Pietrasiewicz1-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 <[email protected]> Acked-by: Tomasz Figa <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-02-05media: adv7180: Fix cppcheck errorsBhavin Sharma1-2/+2
ERROR: else should follow close brace '}' Signed-off-by: Bhavin Sharma <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-02-05media: xc4000: Fix atomicity violation in xc4000_get_frequencyGui-Dong Han1-2/+2
In xc4000_get_frequency(): *freq = priv->freq_hz + priv->freq_offset; The code accesses priv->freq_hz and priv->freq_offset without holding any lock. In xc4000_set_params(): // Code that updates priv->freq_hz and priv->freq_offset ... xc4000_get_frequency() and xc4000_set_params() may execute concurrently, risking inconsistent reads of priv->freq_hz and priv->freq_offset. Since these related data may update during reading, it can result in incorrect frequency calculation, leading to atomicity violations. This possible bug is found by an experimental static analysis tool developed by our team, BassCheck[1]. This tool analyzes the locking APIs to extract function pairs that can be concurrently executed, and then analyzes the instructions in the paired functions to identify possible concurrency bugs including data races and atomicity violations. The above possible bug is reported when our tool analyzes the source code of Linux 6.2. To address this issue, it is proposed to add a mutex lock pair in xc4000_get_frequency() to ensure atomicity. With this patch applied, our tool no longer reports the possible bug, with the kernel configuration allyesconfig for x86_64. Due to the lack of associated hardware, we cannot test the patch in runtime testing, and just verify it according to the code logic. [1] https://sites.google.com/view/basscheck/ Fixes: 4c07e32884ab ("[media] xc4000: Fix get_frequency()") Cc: [email protected] Reported-by: BassCheck <[email protected]> Signed-off-by: Gui-Dong Han <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-02-05media: verisilicon: Fix some typosrenjun wang3-3/+3
Function hantro_g1_h264_dec_prepare_table() does not exist, should be replaced with hantro_h264_dec_init(). The register name av1_ulticore_tile_col confused sometimes, although not be used corrently. The correct name should be av1_multicore_tile_col. Signed-off-by: renjun wang <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-02-05media: vidioc-subdev-g-client-cap.rst: document struct ↵Hans Verkuil1-0/+15
v4l2_subdev_client_capability The struct v4l2_subdev_client_capability was never actually documented, only the capability flags were documented. Add this. Signed-off-by: Hans Verkuil <[email protected]>
2024-02-05media: pci: cx23885: check cx23885_vdev_init() returnHans Verkuil1-0/+8
cx23885_vdev_init() can return a NULL pointer, but that pointer is used in the next line without a check. Add a NULL pointer check and go to the error unwind if it is NULL. Signed-off-by: Hans Verkuil <[email protected]> Reported-by: Sicong Huang <[email protected]>
2024-02-05media: tc358746: fix the pll calculating functionDuc-Long, Le1-2/+2
Following formula of Pll_clk in 5.2 section, 50th page of TC358746AXBG/748XBG/748IXBG Functional Specification Rev 1.1 document. The formula of fout is as below: fout = refclk * mul / (prediv * postdiv) Remove "p" to avoid using 2 times of prediv in pll calculating function. Signed-off-by: Duc-Long, Le <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-02-01media: ov08x40: Reduce start streaming timeJason Chen3-1154/+59
Because video duration involves calculating the streaming time, and i2c communication incurs too many XTALK register settings every 4 bytes with i2c START and STOP. So we have opted switch to the i2c burst method. This method involves writing the XTALK registers in the order of the register block. The start streaming time can be reduced from around 400ms to 150ms [Sakari Ailus: Drop unneeded dev_dbg().] Signed-off-by: Jason Chen <[email protected]> Reviewed-by: Sergey Senozhatsky <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2024-02-01media: ov08x40: Modify the tline calculation in different modesJason Chen1-15/+51
ov08x40 quad bayer sensor ISP has the following work modes: - normal mode: full size - 2x2 binned mode: binning size In normal and binned modes, different tline calculations are applied. - normal mode: Tline value needs to be doubled as per the vendor's update. Tline time = 2 * HTS / SCLK Exposure unit : 1 * HTS = 0.5 Tline - 2x2 binned mode: Tline time = 1 * HTS / SCLK Exposure unit : 1 * HTS = 1 Tline Signed-off-by: Jason Chen <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2024-02-01media: ov08x40: Avoid sensor probing in D0 stateJason Chen1-11/+21
When the system enters the D0 state and attempt to probe the device, another component, such as LED, will also be pulled high due to the hardware design. It's advisable to keep the device being probed in a different D state. Signed-off-by: Jason Chen <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2024-02-01media: imx355: Use v4l2_link_freq_to_bitmap helperSakari Ailus1-39/+14
Use the v4l2_link_freq_to_bitmap() helper to figure out which driver-supported link freq can be used on a given system. Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2024-02-01media: imx319: Use v4l2_link_freq_to_bitmap helperSakari Ailus1-39/+14
Use the v4l2_link_freq_to_bitmap() helper to figure out which driver-supported link freq can be used on a given system. Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2024-02-01media: imx334: Use v4l2_link_freq_to_bitmap helperSakari Ailus1-29/+12
Use the v4l2_link_freq_to_bitmap() helper to figure out which driver-supported link frequencies can be used on a given system. Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2024-02-01media: v4l: Add a helper for setting up link-frequencies controlSakari Ailus2-0/+72
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 <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2024-02-01media: i2c: isl7998x: convert to use maple tree register cacheBo Liu1-1/+1
The maple tree register cache is based on a much more modern data structure than the rbtree cache and makes optimisation choices which are probably more appropriate for modern systems than those made by the rbtree cache. Signed-off-by: Bo Liu <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2024-02-01media: i2c: max2175: convert to use maple tree register cacheBo Liu1-1/+1
The maple tree register cache is based on a much more modern data structure than the rbtree cache and makes optimisation choices which are probably more appropriate for modern systems than those made by the rbtree cache. Signed-off-by: Bo Liu <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2024-02-01media: i2c: tvp5150: convert to use maple tree register cacheBo Liu1-1/+1
The maple tree register cache is based on a much more modern data structure than the rbtree cache and makes optimisation choices which are probably more appropriate for modern systems than those made by the rbtree cache. Signed-off-by: Bo Liu <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>