aboutsummaryrefslogtreecommitdiff
path: root/drivers/media
AgeCommit message (Collapse)AuthorFilesLines
2023-04-15media: cec: core: not all messages were passed on when monitoringHans Verkuil1-2/+5
The valid_la boolean is used to check if the destination logical address is either 15 (broadcast) or our logical address. If it is for another logical address, then only adapters that have the CEC_CAP_MONITOR_ALL capability can pass it on. However, it is also used to do more detailed validity checks, such as whether the message was broadcast when it should have been directed, or vice versa, in which case the message must be ignored according to the spec. But that should not apply to monitoring. Add a new bool that just checks the LA and nothing else. Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-04-14Merge branches 'iommu/fixes', 'arm/allwinner', 'arm/exynos', 'arm/mediatek', ↵Joerg Roedel3-14/+0
'arm/omap', 'arm/renesas', 'arm/rockchip', 'arm/smmu', 'ppc/pamu', 'unisoc', 'x86/vt-d', 'x86/amd', 'core' and 'platform-remove_new' into next
2023-04-13media: verisilicon: Fix crash when probing encoderBenjamin Gaignard1-7/+3
ctx->vpu_dst_fmt is no more initialized before calling hantro_try_fmt() so assigne it to vpu_fmt led to crash the kernel. Like for decoder case use 'fmt' as format for encoder and clean up the code. Signed-off-by: Benjamin Gaignard <[email protected]> Tested-by: Marek Szyprowski <[email protected]> Fixes: db6f68b51e5c ("media: verisilicon: Do not set context src/dst formats in reset functions") Signed-off-by: Hans Verkuil <[email protected]>
2023-04-13media: mediatek: vcodec: Remove the setting for dma_maskYong Wu2-11/+0
In order to simplify the masters to set their respective dma masks, MTK IOMMU helps to centralize the processing. Because all the dma ranges is set in IOMMU, IOMMU knows well the dma mask requirements of masters. After this patch, the masters(codec here) code does not need care dma-ranges/dma_mask related information. Cc: Tiffany Lin <[email protected]> Cc: Andrew-CT Chen <[email protected]> Cc: Yunfei Dong <[email protected]> Cc: Mauro Carvalho Chehab <[email protected]> Cc: irui wang <[email protected]> Signed-off-by: Yong Wu <[email protected]> Acked-by: Hans Verkuil <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
2023-04-13media: mtk-jpegdec: Remove the setting for dma_maskYong Wu1-3/+0
In order to simplify the masters to set their respective dma masks, MTK IOMMU helps to centralize the processing. Because all the dma ranges is set in IOMMU, IOMMU knows well the dma mask requirements of masters. After this patch, the masters code does not need care dma-ranges/dma_mask related information. Cc: Bin Liu <[email protected]> Cc: Mauro Carvalho Chehab <[email protected]> Cc: kyrie wu <[email protected]> Signed-off-by: Yong Wu <[email protected]> Acked-by: Hans Verkuil <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
2023-04-12media: Use designated initializers for all subdev pad opsLaurent Pinchart3-6/+9
Structures passed to subdev pad operations are all zero-initialized when declaring variables. In most cases, this is done with designated initializers to initialize some of the fields to specific values, but in a minority of cases the structures are zero-initialized by assigning them to '{ 0 }' or '{ }'. Improve coding style consistency by using designated initializers where possible, always initializing the 'which' field. Signed-off-by: Laurent Pinchart <[email protected]> Acked-by: Sakari Ailus <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Kieran Bingham <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-12media: Prefer designated initializers over memset for subdev pad opsLaurent Pinchart6-36/+37
Structures passed to subdev pad operations are all zero-initialized, but not always with the same kind of code constructs. While most drivers used designated initializers, which zero all the fields that are not specified, when declaring variables, some use memset(). Those two methods lead to the same end result, and, depending on compiler optimizations, may even be completely equivalent, but they're not consistent. Improve coding style consistency by using designated initializers instead of calling memset(). Where applicable, also move the variables to inner scopes of for loops to ensure correct initialization in all iterations. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Lad Prabhakar <[email protected]> # For am437x Acked-by: Sakari Ailus <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Kieran Bingham <[email protected]> Reviewed-by: Philipp Zabel <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-12media: Zero-initialize all structures passed to subdev pad operationsLaurent Pinchart15-62/+92
Several drivers call subdev pad operations, passing structures that are not fully zeroed. While the drivers initialize the fields they care about explicitly, this results in reserved fields having uninitialized values. Future kernel API changes that make use of those fields thus risk breaking proper driver operation in ways that could be hard to detect. To avoid this, make the code more robust by zero-initializing all the structures passed to subdev pad operation. Maintain a consistent coding style by preferring designated initializers (which zero-initialize all the fields that are not specified) over memset() where possible, and make variable declarations local to inner scopes where applicable. One notable exception to this rule is in the ipu3 driver, where a memset() is needed as the structure is not a local variable but a function parameter provided by the caller. Not all fields of those structures can be initialized when declaring the variables, as the values for those fields are computed later in the code. Initialize the 'which' field in all cases, and other fields when the variable declaration is so close to the v4l2_subdev_call() call that it keeps all the context easily visible when reading the code, to avoid hindering readability. Signed-off-by: Laurent Pinchart <[email protected]> Acked-by: Shuah Khan <[email protected]> # For vimc Reviewed-by: Lad Prabhakar <[email protected]> # For am437x Acked-by: Sakari Ailus <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Kieran Bingham <[email protected]> Reviewed-by: Philipp Zabel <[email protected]> # For drivers/staging/media/imx/ Signed-off-by: Hans Verkuil <[email protected]>
2023-04-12media: imx-jpeg: Fix incorrect indentationLaurent Pinchart1-4/+3
Variable initialization code in notify_src_chg() is incorrectly indented. Fix it. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-12media: Fix indentation issues introduced by subdev-wide state structLaurent Pinchart7-19/+19
Commit 0d346d2a6f54 ("media: v4l2-subdev: add subdev-wide state struct") applied a large media tree-wide change produced by coccinelle. It was so large that a set of identical indentation issues went unnoticed during review. Fix them. While at it, and because it's easy to review both changes together, add a trailing comma for the last (and only) struct member initialization of the related structures, to avoid future changes should new fields need to be initialized. Fixes: 0d346d2a6f54 ("media: v4l2-subdev: add subdev-wide state struct") Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-12media: venus: Correct P010 buffer alignmentFritz Koenig2-3/+8
According to msm_media_info.h the correct alignment for the stride of P010 buffers is 128. Signed-off-by: Fritz Koenig <[email protected]> Reviewed-by: Vikash Garodia <[email protected]> Signed-off-by: Stanimir Varbanov <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-12venus: venc: add handling for VIDIOC_ENCODER_CMDDikshita Agarwal2-0/+77
Add handling for below commands in encoder: 1. V4L2_ENC_CMD_STOP 2. V4L2_ENC_CMD_START Signed-off-by: Dikshita Agarwal <[email protected]> Signed-off-by: Stanimir Varbanov <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-12venus: Add support for min/max qp range.Viswanath Boma3-8/+74
Currently QP range set from client is not communicated to video firmware. Add support for the QP range HFI to set the same to firmware. Signed-off-by: Viswanath Boma <[email protected]> Signed-off-by: Vikash Garodia <[email protected]> Signed-off-by: Stanimir Varbanov <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-12media: venus: dec: Fix capture formats enumeration orderJavier Martinez Canillas1-4/+4
Commit 9593126dae3e ("media: venus: Add a handling of QC08C compressed format") and commit cef92b14e653 ("media: venus: Add a handling of QC10C compressed format") added support for the QC08C and QC10C compressed formats respectively. But these also caused a regression, because the new formats where added at the beginning of the vdec_formats[] array and the vdec_inst_init() function sets the default format output and capture using fixed indexes of that array: static void vdec_inst_init(struct venus_inst *inst) { ... inst->fmt_out = &vdec_formats[8]; inst->fmt_cap = &vdec_formats[0]; ... } Since now V4L2_PIX_FMT_NV12 is not the first entry in the array anymore, the default capture format is not set to that as it was done before. Both commits changed the first index to keep inst->fmt_out default format set to V4L2_PIX_FMT_H264, but did not update the latter to keep .fmt_out default format set to V4L2_PIX_FMT_NV12. Rather than updating the index to the current V4L2_PIX_FMT_NV12 position, let's reorder the entries so that this format is the first entry again. This would also make VIDIOC_ENUM_FMT report the V4L2_PIX_FMT_NV12 format with an index 0 as it did before the QC08C and QC10C formats were added. Fixes: 9593126dae3e ("media: venus: Add a handling of QC08C compressed format") Fixes: cef92b14e653 ("media: venus: Add a handling of QC10C compressed format") Signed-off-by: Javier Martinez Canillas <[email protected]> Signed-off-by: Stanimir Varbanov <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-12venus: Fix for H265 decoding failure.Viswanath Boma1-2/+2
Aligned the mismatch of persist1 and scratch1 buffer calculation, as per the firmware requirements. Signed-off-by: Vikash Garodia <[email protected]> Signed-off-by: Viswanath Boma <[email protected]> Tested-by: Nathan Hebert <[email protected]> Signed-off-by: Stanimir Varbanov <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-12media: venus: dec: Fix handling of the start cmdMichał Krawczyk1-0/+8
The decoder driver should clear the last_buffer_dequeued flag of the capture queue upon receiving V4L2_DEC_CMD_START. The last_buffer_dequeued flag is set upon receiving EOS (which always happens upon receiving V4L2_DEC_CMD_STOP). Without this patch, after issuing the V4L2_DEC_CMD_STOP and V4L2_DEC_CMD_START, the vb2_dqbuf() function will always fail, even if the buffers are completed by the hardware. Fixes: beac82904a87 ("media: venus: make decoder compliant with stateful codec API") Signed-off-by: Michał Krawczyk <[email protected]> Signed-off-by: Stanimir Varbanov <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-12media: rc: gpio-ir-recv: Fix support for wake-upFlorian Fainelli1-0/+2
The driver was intended from the start to be a wake-up source for the system, however due to the absence of a suitable call to device_set_wakeup_capable(), the device_may_wakeup() call used to decide whether to enable the GPIO interrupt as a wake-up source would never happen. Lookup the DT standard "wakeup-source" property and call device_init_wakeup() to ensure the device is flagged as being wakeup capable. Reported-by: Matthew Lear <[email protected]> Fixes: fd0f6851eb46 ("[media] rc: Add support for GPIO based IR Receiver driver") Signed-off-by: Florian Fainelli <[email protected]> Signed-off-by: Sean Young <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-11media: i2c: imx290: Add missing \n on dev_err_probe() messageAlexander Stein1-1/+1
Also dev_err_probe message require a trailing \n. Signed-off-by: Alexander Stein <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-11media: ccs: Differentiate SMIA and MIPI vendors in static dataSakari Ailus1-19/+55
MIPI CCS uses a 16-bit MIPI manufacturer identifier for firmware filenames compared to older 8-bit identifier used by SMIA. The requested firmware files used the MIPI manufacturer ID even for SMIA compliant devices, effectively making the manufacturer ID 0. While CCS static data is a feature of CCS 1.1, it has no hardware dependencies. Making this feature available for SMIA devices helps adding support for them and avoids requesting ill-generated CCS static data file names. The files are named as: ccs/smiapp-module-vv-mmmm-rrrr.fw, ccs/smiapp-sensor-vv-mmmm-rr.fw and ccs/smia-sensor-vv-mmmm-rr.fw where vv is the manufacturer ID, mmmm is the model ID and rr or rrrr is the revision number. Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-11media: ccs: Apply module manufacturer hack on non-CCS devices onlySakari Ailus1-13/+12
Some modules don't have any model identification information in the register address space. The driver as a SMIA++ driver attempted to use sensor information in this case. This workaround is definitely not for CCS devices. Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-11media: ccs: Support 16-bit sensor revision number registerSakari Ailus1-1/+5
Read 16-bit sensor revision number if the 8-bit register has value 0. Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-11media: ccs: Add V4L2 controls from propertiesSakari Ailus1-1/+11
Add V4L2 controls (currently CAMERA_SENSOR_ROTATION and CAMERA_SENSOR_ORIENTATION) from properties. Signed-off-by: Sakari Ailus <[email protected]> Reviewed-by: Jacopo Mondi <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-11media: ccs: Align flipping behaviour with other driversSakari Ailus2-54/+0
No longer mirror flipping controls if the sensor is mounted upside down. This way the behaviour of the flipping controls and rotation of the sensor are aligned with the rest of the drivers. Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-11media: imx258: Remove mandatory 180 degrees rotationJacopo Mondi1-8/+0
The "rotation" fwnode device property is intended to allow specify the sensor's physical mounting rotation, so that it can be exposed through the read-only V4L2_CID_CAMERA_SENSOR_ROTATION control and applications can decide how to compensate for that. The imx258 driver has read-only VFLIP and HFLIP enabled, resulting in a 180 degrees image rotation being produced by the sensor. But this doesn't imply that the physical mounting rotation should match the driver's implementation. Now that the driver registers V4L2_CID_CAMERA_SENSOR_ROTATION and V4L2_CID_HFLIP/VFLIP correctly, userspace has all the required information to handle the rotation correctly, hence it is not necessary to require the 'rotation' property to be fixed to 180 degrees in DTS. Signed-off-by: Jacopo Mondi <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-11media: imx258: Register H/V flip controlsJacopo Mondi1-1/+13
Register controls for V4L2_CID_HFLIP and V4L2_CID_VFLIP. The controls are registered as read-only and enabled by default, as the driver embeds a 180 degrees rotation in its programming sequences and only supports that mode of operations. Signed-off-by: Jacopo Mondi <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-11media: ipu3-cio2: support more camera sensors in cio2-bridgeBingbu Cao1-0/+8
Add more camera sensors into the supported camera sensors list to make cio2-bridge to support more camera sensors. Signed-off-by: Bingbu Cao <[email protected]> Reviewed-by: Daniel Scally <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-11media: hi556: add 2592x1444 resolutionJim Lai1-2/+148
Adding additional cropped 2592x1444 resolution for QHD output from Hi556 sensor Also implement the get_selection pad operation for the Hi556 sensor driver. The supported targets report the sensor's native size, the crop default rectangle and the crop rectangle. Signed-off-by: Jim Lai <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-11media: venus: drop unused opp_table field documentationKrzysztof Kozlowski1-1/+0
The struct venus_format does not have a "opp_table" field. Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-11media: renesas: fdp1: remove R-Car H3 ES1.* handlingWolfram Sang1-4/+0
R-Car H3 ES1.* was only available to an internal development group and needed a lot of quirks and workarounds. These become a maintenance burden now, so our development group decided to remove upstream support and disable booting for this SoC. Public users only have ES2 onwards. Reviewed-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Wolfram Sang <[email protected]> Reviewed-by: Kieran Bingham <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-11media: rcar-vin: csi2: remove R-Car H3 ES1.* handlingWolfram Sang1-12/+3
R-Car H3 ES1.* was only available to an internal development group and needed a lot of quirks and workarounds. These become a maintenance burden now, so our development group decided to remove upstream support and disable booting for this SoC. Public users only have ES2 onwards. Reviewed-by: Laurent Pinchart <[email protected]> Reviewed-by: Niklas Söderlund <[email protected]> Signed-off-by: Wolfram Sang <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-11media: rcar-vin: remove R-Car H3 ES1.* handlingWolfram Sang1-36/+0
R-Car H3 ES1.* was only available to an internal development group and needed a lot of quirks and workarounds. These become a maintenance burden now, so our development group decided to remove upstream support and disable booting for this SoC. Public users only have ES2 onwards. Reviewed-by: Laurent Pinchart <[email protected]> Reviewed-by: Niklas Söderlund <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Wolfram Sang <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-11media: Use of_property_present() for testing DT property presenceRob Herring4-4/+4
It is preferred to use typed property access functions (i.e. of_property_read_<type> functions) rather than low-level of_get_property/of_find_property functions for reading properties. As part of this, convert of_get_property/of_find_property calls to the recently added of_property_present() helper when we just want to test for presence of a property and nothing more. Signed-off-by: Rob Herring <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-11media: ipu3-cio2: support multiple sensors and VCMs with same HIDBingbu Cao2-5/+13
In current cio2-bridge, it is using the hid name to register software node and software node will create kobject and sysfs entry according to the node name, if there are multiple sensors and VCMs which are sharing same HID name, it will cause the software nodes registration failure: sysfs: cannot create duplicate filename '/kernel/software_nodes/dw9714' ... Call Trace: software_node_register_nodes cio2_bridge_init ... kobject_add_internal failed for dw9714 with -EEXIST, don't try to register things with the same name in the same directory. One solution is appending the sensor link(Mipi Port) in SSDB as suffix of the node name to fix this problem. Signed-off-by: Bingbu Cao <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-11media: Accept non-subdev sinks in v4l2_create_fwnode_links_to_pad()Laurent Pinchart1-9/+6
The v4l2_create_fwnode_links_to_pad() helper requires the sink pad passed to it to belong to a subdev. This requirement can be lifted easily. Make the function usable for non-subdev sinks, which allows using it with video_device sinks. Signed-off-by: Laurent Pinchart <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-11media: i2c: adv7604: Fix range of hue controlLaurent Pinchart1-1/+1
The ADV7604, ADV7611 and ADV7612 software manuals document the CP_HUE value differently: - For ADV7604 and ADV7611, the hue is specified as an unsigned 8-bit value, and calculated as (CP_HUE[7:0] * 180) / 256 - 90 with the range set to [-90°, 90°]. Additionally, the values 0x00, 0x0f and 0xff are documented as corresponding to -90°, 0° and 90° respectively. - For ADV7612, the hue is specified as a signed 8-bit value in the range [0°, 360°[ without any formula. Additionally, the value 0x00 is documented as corresponding to 0°. The ADV7604 and ADV7611 documentation is clearly wrong as the example values don't correspond to the formula. Furthermore, the [-90°, 90°] range seems incorrect as it would cover only half of the hue space. The ADV7612 documentation is better, although the range should likely be [-180°, 180°[ if the value is signed. Given that the values wrap around, this makes no difference in practice. The hue values have been verified on ADV7612 to follow the documentation. There is a high chance they do as well on ADV7604 and ADV7611. In any case, all software manuals document the register as 8-bit, so the current range of the V4L2 hue control [0, 128] is not correct. Expand it to cover the full 8-bit space, using unsigned values to avoid breaking any application that may rely on 128 being a valid value. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Hans Verkuil <[email protected]> Tested-by: Hans Verkuil <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-11media: i2c: adv7604: Enable video adjustmentLaurent Pinchart1-0/+3
The video adjustments (contrast, brightness, saturation and hue) are ignored by default by the device when the VID_ADJ_EN bit is clear. The corresponding V4L2 controls exposed by the drivers have thus no effect. Fix this by setting the VID_ADJ_EN bit. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Hans Verkuil <[email protected]> Tested-by: Hans Verkuil <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-11media: i2c: ov2685: Make reset gpio optionalLuca Weiss1-1/+1
In some setups XSHUTDOWN is connected to DOVDD when it's unused, therefore treat the reset gpio as optional. Reviewed-by: Jacopo Mondi <[email protected]> Signed-off-by: Luca Weiss <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-11media: mc-device: remove unnecessary __must_checkJason Kim2-9/+3
In the file mc-device.c, the function media_device_register_entity_notify() does not need to have the __must_check attribute since it returns only a value of 0. Therefore, we can remove this attribute and change the function's return type. Signed-off-by: Jason Kim <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-11media: hi846: Fix memleak in hi846_init_controls()Wei Chen1-3/+8
hi846_init_controls doesn't clean the allocated ctrl_hdlr in case there is a failure, which causes memleak. Add v4l2_ctrl_handler_free to free the resource properly. Fixes: e8c0882685f9 ("media: i2c: add driver for the SK Hynix Hi-846 8M pixel camera") Signed-off-by: Wei Chen <[email protected]> Reviewed-by: Martin Kepplinger <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-11media: ov8856: Do not check for for module versionRicardo Ribalda1-40/+0
It the device is probed in non-zero ACPI D state, the module identification is delayed until the first streamon. The module identification has two parts: deviceID and version. To rea the version we have to enable OTP read. This cannot be done during streamon, becase it modifies REG_MODE_SELECT. Since the driver has the same behaviour for all the module versions, do not read the module version from the sensor's OTP. Cc: [email protected] Fixes: 0e014f1a8d54 ("media: ov8856: support device probe in non-zero ACPI D state") Signed-off-by: Ricardo Ribalda <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-11media: i2c: ov7670: Use the devm_clk_get_optional() helperChristophe JAILLET1-8/+3
Use devm_clk_get_optional() instead of hand writing it. This saves some loC and improves the semantic. Signed-off-by: Christophe JAILLET <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-11media: v4l: async: Return async sub-devices to subnotifier listSakari Ailus1-5/+8
When an async notifier is unregistered, the async sub-devices in the notifier's done list will disappear with the notifier. However this is currently also done to the sub-notifiers that remain registered. Their sub-devices only need to be unbound while the async sub-devices themselves need to be returned to the sub-notifier's waiting list. Do this now. Fixes: 2cab00bb076b ("media: v4l: async: Allow binding notifiers to sub-devices") Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-11media: imx: imx7-media-csi: Fail on invalid type in VIDIOC_G_SELECTIONAlexander Stein1-0/+3
This device only supports video capture, so bail out if invalid selection type is passed. Signed-off-by: Alexander Stein <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Reviewed-by: Rui Miguel Silva <[email protected]> Signed-off-by: Laurent Pinchart <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-11media: imx: imx7-media-csi: Fix mbus framefmt field initAlexander Stein1-0/+1
'field' is zero-initialized to V4L2_FIELD_ANY, which is an invalid value to return to userspace. Instead default to non-interleaving. Signed-off-by: Alexander Stein <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Reviewed-by: Rui Miguel Silva <[email protected]> Signed-off-by: Laurent Pinchart <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-11media: imx: imx7-media-csi: Fix error handling in imx7_csi_async_register()Frieder Schrempf1-10/+13
The CSI requires a connected source subdev to operate. If fwnode_graph_get_endpoint_by_id() fails and returns NULL, there is no point in going on. Print an error message and abort instead. Also we don't need to check for an existing asd. Any failure of v4l2_async_nf_add_fwnode_remote() should abort the probe. Suggested-by: Laurent Pinchart <[email protected]> Signed-off-by: Frieder Schrempf <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Laurent Pinchart <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-11media: rkisp1: Implement ENUM_FRAMESIZESPaul Elder1-0/+30
Implement VIDIOC_ENUM_FRAMESIZES for the rkisp1 capture devices. Signed-off-by: Paul Elder <[email protected]> Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Dafna Hirschfeld <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-11media: rkisp1: Add NV16M and NV61M to output formatsPaul Elder1-0/+22
Add support for NV16M and NV61M as output formats. As NV16, NV61, NV12M and NV21M are already supported, the infrastructure is already in place to support NV16M and NV61M, so it is sufficient to simply add relevant entries to the list of output formats. Signed-off-by: Paul Elder <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Dafna Hirschfeld <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-11media: rcar_fdp1: Fix refcount leak in probe and remove functionMiaoqian Lin1-3/+8
rcar_fcp_get() take reference, which should be balanced with rcar_fcp_put(). Add missing rcar_fcp_put() in fdp1_remove and the error paths of fdp1_probe() to fix this. Fixes: 4710b752e029 ("[media] v4l: Add Renesas R-Car FDP1 Driver") Signed-off-by: Miaoqian Lin <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Laurent Pinchart <[email protected]> [hverkuil: resolve merge conflict, remove() is now void] Signed-off-by: Hans Verkuil <[email protected]>
2023-04-11media: vsp1: Add underrun debug printTomi Valkeinen4-1/+17
Print underrun interrupts with ratelimited print. Note that we don't enable the underrun interrupt. If we have underruns, we don't want to get flooded with interrupts about them. It's enough to see that an underrun happened at the end of a frame. Signed-off-by: Tomi Valkeinen <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Laurent Pinchart <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-04-11media: vsp1: Replace vb2_is_streaming() with vb2_start_streaming_called()Laurent Pinchart1-1/+1
The vsp1 driver uses the vb2_is_streaming() function in its .buf_queue() handler to check if the .start_streaming() operation has been called, and decide whether to just add the buffer to an internal queue, or also trigger a hardware run. vb2_is_streaming() relies on the vb2_queue structure's streaming field, which used to be set only after calling the .start_streaming() operation. Commit a10b21532574 ("media: vb2: add (un)prepare_streaming queue ops") changed this, setting the .streaming field in vb2_core_streamon() before enqueuing buffers to the driver and calling .start_streaming(). This broke the vsp1 driver which now believes that .start_streaming() has been called when it hasn't, leading to a crash: [ 881.058705] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000020 [ 881.067495] Mem abort info: [ 881.070290] ESR = 0x0000000096000006 [ 881.074042] EC = 0x25: DABT (current EL), IL = 32 bits [ 881.079358] SET = 0, FnV = 0 [ 881.082414] EA = 0, S1PTW = 0 [ 881.085558] FSC = 0x06: level 2 translation fault [ 881.090439] Data abort info: [ 881.093320] ISV = 0, ISS = 0x00000006 [ 881.097157] CM = 0, WnR = 0 [ 881.100126] user pgtable: 4k pages, 48-bit VAs, pgdp=000000004fa51000 [ 881.106573] [0000000000000020] pgd=080000004f36e003, p4d=080000004f36e003, pud=080000004f7ec003, pmd=0000000000000000 [ 881.117217] Internal error: Oops: 0000000096000006 [#1] PREEMPT SMP [ 881.123494] Modules linked in: rcar_fdp1 v4l2_mem2mem [ 881.128572] CPU: 0 PID: 1271 Comm: yavta Tainted: G B 6.2.0-rc1-00023-g6c94e2e99343 #556 [ 881.138061] Hardware name: Renesas Salvator-X 2nd version board based on r8a77965 (DT) [ 881.145981] pstate: 400000c5 (nZcv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 881.152951] pc : vsp1_dl_list_add_body+0xa8/0xe0 [ 881.157580] lr : vsp1_dl_list_add_body+0x34/0xe0 [ 881.162206] sp : ffff80000c267710 [ 881.165522] x29: ffff80000c267710 x28: ffff000010938ae8 x27: ffff000013a8dd98 [ 881.172683] x26: ffff000010938098 x25: ffff000013a8dc00 x24: ffff000010ed6ba8 [ 881.179841] x23: ffff00000faa4000 x22: 0000000000000000 x21: 0000000000000020 [ 881.186998] x20: ffff00000faa4000 x19: 0000000000000000 x18: 0000000000000000 [ 881.194154] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000 [ 881.201309] x14: 0000000000000000 x13: 746e696174206c65 x12: ffff70000157043d [ 881.208465] x11: 1ffff0000157043c x10: ffff70000157043c x9 : dfff800000000000 [ 881.215622] x8 : ffff80000ab821e7 x7 : 00008ffffea8fbc4 x6 : 0000000000000001 [ 881.222779] x5 : ffff80000ab821e0 x4 : ffff70000157043d x3 : 0000000000000020 [ 881.229936] x2 : 0000000000000020 x1 : ffff00000e4f6400 x0 : 0000000000000000 [ 881.237092] Call trace: [ 881.239542] vsp1_dl_list_add_body+0xa8/0xe0 [ 881.243822] vsp1_video_pipeline_run+0x270/0x2a0 [ 881.248449] vsp1_video_buffer_queue+0x1c0/0x1d0 [ 881.253076] __enqueue_in_driver+0xbc/0x260 [ 881.257269] vb2_start_streaming+0x48/0x200 [ 881.261461] vb2_core_streamon+0x13c/0x280 [ 881.265565] vb2_streamon+0x3c/0x90 [ 881.269064] vsp1_video_streamon+0x2fc/0x3e0 [ 881.273344] v4l_streamon+0x50/0x70 [ 881.276844] __video_do_ioctl+0x2bc/0x5d0 [ 881.280861] video_usercopy+0x2a8/0xc80 [ 881.284704] video_ioctl2+0x20/0x40 [ 881.288201] v4l2_ioctl+0xa4/0xc0 [ 881.291525] __arm64_sys_ioctl+0xe8/0x110 [ 881.295543] invoke_syscall+0x68/0x190 [ 881.299303] el0_svc_common.constprop.0+0x88/0x170 [ 881.304105] do_el0_svc+0x4c/0xf0 [ 881.307430] el0_svc+0x4c/0xa0 [ 881.310494] el0t_64_sync_handler+0xbc/0x140 [ 881.314773] el0t_64_sync+0x190/0x194 [ 881.318450] Code: d50323bf d65f03c0 91008263 f9800071 (885f7c60) [ 881.324551] ---[ end trace 0000000000000000 ]--- [ 881.329173] note: yavta[1271] exited with preempt_count 1 A different regression report sent to the linux-media mailing list ([1]) was answered with a claim that the vb2_is_streaming() function has never been meant for this purpose. The document of the function, as well as of the struct vb2_queue streaming field, is sparse, so this claim may be hard to verify. The information needed by the vsp1 driver to decide how to process queued buffers is also available from the vb2_start_streaming_called() function. Use it instead of vb2_is_streaming() to fix the problem. [1] https://lore.kernel.org/linux-media/[email protected]/ Fixes: a10b21532574 ("media: vb2: add (un)prepare_streaming queue ops") Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Hans Verkuil <[email protected]> Tested-by: Duy Nguyen <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>