summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* media: v4l2-ctrls: add support for dynamically allocated arrays.Hans Verkuil2022-07-155-71/+272
| | | | | | | | | | | | | | | Implement support for dynamically allocated arrays. Most of the changes concern keeping track of the number of elements of the array and the number of elements allocated for the array and reallocating memory if needed. Acked-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> Acked-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Tested-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> Tested-by: Jernej Skrabec <jernej.skrabec@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: videodev2.h: add V4L2_CTRL_FLAG_DYNAMIC_ARRAYHans Verkuil2022-07-153-0/+10
| | | | | | | | | | | | | | | | | | | | | | Add a new flag that indicates that this control is a dynamically sized array. Also document this flag. Currently dynamically sized arrays are limited to one dimensional arrays, but that might change in the future if there is a need for it. The initial use-case of dynamic arrays are stateless codecs. A frame can be divided in many slices, so you want to provide an array containing slice information for each slice. Typically the number of slices is small, but the standard allow for hundreds or thousands of slices. Dynamic arrays are a good solution since sizing the array for the worst case would waste substantial amounts of memory. Acked-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Tested-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> Tested-by: Jernej Skrabec <jernej.skrabec@gmail.com> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: venus: set ubwc configuration on specific video hardwareVikash Garodia2022-07-156-0/+63
| | | | | | | | | | | | UBWC configuration parameters would vary across video hardware generations. At the same time, driver is expected to configure these parameters, without relying on video firmware to use the default configurations. Setting the configuration parameters for sc7280. Signed-off-by: Vikash Garodia <quic_vgarodia@quicinc.com> Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: venus: venus_helper_get_bufreq(): req is never NULLHans Verkuil2022-07-151-4/+2
| | | | | | | | | | | | | Fix a smatch error: drivers/media/platform/qcom/venus/helpers.c: drivers/media/platform/qcom/venus/helpers.c:678 venus_helper_get_bufreq() error: we previously assumed 'req' could be null (see line 674) After checking how venus_helper_get_bufreq() is called it is clear that req is never NULL, so just drop the checks. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: ov5693: add ov5693_of_match, dts supportTommaso Merciai2022-07-151-0/+7
| | | | | | | | | | Add ov5693_of_match. Device tree support Signed-off-by: Tommaso Merciai <tommaso.merciai@amarulasolutions.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Daniel Scally <djrscally@gmail.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: dt-bindings: ov5693: document YAML bindingTommaso Merciai2022-07-152-0/+125
| | | | | | | | | | Add documentation of device tree in YAML schema for the OV5693 CMOS image sensor from Omnivision Signed-off-by: Tommaso Merciai <tommaso.merciai@amarulasolutions.com> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: ov5693: add support for acpi clock-frequency propTommaso Merciai2022-07-151-5/+17
| | | | | | | | | | | Add support for ACPI-based platforms that specify the clock frequency by using the "clock-frequency" property instead of specifying a clock provider reference Signed-off-by: Tommaso Merciai <tommaso.merciai@amarulasolutions.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: ov5693: rename clk into xvclkTommaso Merciai2022-07-151-10/+10
| | | | | | | | | | Rename clk pdata pointer into xvclk (system clock input). Same for clk_rate into xvclk_rate. This is more explicit Signed-off-by: Tommaso Merciai <tommaso.merciai@amarulasolutions.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: ov5693: add dvdd into ov5693_supply_names arrayTommaso Merciai2022-07-151-0/+1
| | | | | | | | | | | Add missing "dvdd" (Digital circuit power) entry into ov5693_supply_names array Signed-off-by: Tommaso Merciai <tommaso.merciai@amarulasolutions.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Daniel Scally <djrscally@gmail.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: ov5693: count num_supplies using array_sizeTommaso Merciai2022-07-151-8/+7
| | | | | | | | | | | | Instead of hardcode OV5693_NUM_SUPPLIES in a define is better use ARRAY_SIZE function to count the number of supplies from ov5693_supply_names array Signed-off-by: Tommaso Merciai <tommaso.merciai@amarulasolutions.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Daniel Scally <djrscally@gmail.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: entity: Use dedicated data link iteratorDaniel Scally2022-07-151-3/+3
| | | | | | | | | | | Where iteration over links for an entity is clearly assuming that all of those links are data links, use the new iterator to guarantee that assumption is met. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Daniel Scally <djrscally@gmail.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: entity: Add iterator for entity data linksDaniel Scally2022-07-152-0/+46
| | | | | | | | | | | | Iterating over the links for an entity is a somewhat common need through the media subsystem, but generally the assumption is that they will all be data links. To meet that assumption add a new macro that iterates through an entity's links and skips non-data links. Signed-off-by: Daniel Scally <djrscally@gmail.com> Reviewed-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>
* media: mt9p031: Implement crop bounds get selectionMarek Vasut2022-07-151-5/+15
| | | | | | | | | | | Implement V4L2_SEL_TGT_CROP_BOUNDS query in get_selection subdev op for this sensor. This is required e.g. to bind it to STM32MP15x DCMI. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Stefan Riedmueller <s.riedmueller@phytec.de> Reviewed-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>
* media: stm32: dcmi: Fix subdev op call with uninitialized stateTomi Valkeinen2022-07-151-12/+2
| | | | | | | | | | | | | | | | | stm32-dcmi calls its source subdev with v4l2_subdev_call() using a v4l2_subdev_state constructed on stack. This means that init_cfg is never called for that state, and a source subdev that depends on the init_cfg call may break. A new macro has been added for this particular purpose, which properly initializes the state, so let's use v4l2_subdev_call_state_try() here. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Tested-by: Marek Vasut <marex@denx.de> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: subdev: Add v4l2_subdev_call_state_try() macroTomi Valkeinen2022-07-151-0/+34
| | | | | | | | | | | | | | | | | | | | | Add a helper macro for the situations where a non-MC driver needs to call a state-operation (operation which takes a subdev state as a parameter) in try-context in another subdev. The macro allocates a new subdev state for the called subdev and frees the state afterwards. An example use case is a media platform driver testing if a v4l2_subdev_format would be accepted by a source subdev. This should not be used in MC drivers. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Tested-by: Marek Vasut <marex@denx.de> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: ar0521: fix Kconfig: VIDEO_V4L2 -> VIDEO_DEVHans Verkuil2022-07-151-1/+1
| | | | | | | | | VIDEO_V4L2 no longer exists, instead use VIDEO_DEV. Without this change this driver cannot be selected. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: Replace dependency on VIDEO_V4L2_SUBDEV_API with selectLaurent Pinchart2022-07-153-4/+10
| | | | | | | | | | | | The VIDEO_V4L2_SUBDEV_API Kconfig symbol is mostly selected automatically, with a a handful of drivers still using it as a dependency. Fix them to use selection, and drop the symbol title text to not expose it for manual selection. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: ov7251: add missing disable functions on error in ov7251_set_power_on()Yang Yingliang2022-07-151-0/+2
| | | | | | | | | | | | Add the missing gpiod_set_value_cansleep() and clk_disable_unprepare() before return from ov7251_set_power_on() in the error handling case. Fixes: 9e1d3012cc10 ("media: i2c: Remove .s_power() from ov7251") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: sunxi: Depend on GENERIC_PHY_MIPI_DPHYSakari Ailus2022-07-152-0/+2
| | | | | | | | | | The sun6i-mipi-csi2 and sun6i-a83t-mipi-csi2 drivers depend on the generic MIPI D-PHY support. Select it. This fixes a linking problem when either of these drivers is enabled and GENERIC_PHY_MIPI_DPHY is disabled. 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>
* media: v4l2: Sanitize colorspace values in the frameworkLaurent Pinchart2022-07-151-13/+58
| | | | | | | | | | Extend the format sanitization code in the framework to handle invalid values for the colorspace-related fields. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: v4l2: Make colorspace validity checks more future-proofLaurent Pinchart2022-07-152-3/+25
| | | | | | | | | | | | | The helper functions that test validity of colorspace-related fields use the last value of the corresponding enums. This isn't very future-proof, as there's a high chance someone adding a new value may forget to update the helpers. Add new "LAST" entries to the enumerations to improve this, and keep them private to the kernel. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: vivid: Add support for the new YUVA and YUVX formatsLaurent Pinchart2022-07-151-0/+15
| | | | | | | | | | Extend vivid to support the newly added YUVA and YUVX pixel formats through the TPG. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: v4l2-tpg: Add support for the new YUVA and YUVX formatsLaurent Pinchart2022-07-151-0/+6
| | | | | | | | | | Extend the TPG to support generating the newly added YUVA and YUVX pixel formats. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: v4l: Add packed YUV 4:4:4 YUVA and YUVX pixel formatsLaurent Pinchart2022-07-153-0/+24
| | | | | | | | | | | The new YUVA and YUVX are permutations of the existing AYUV and XYUV formats. They are use by the NXP i.MX8 ISI hardware. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: mediatek: vcodec: Make encoder capability fields fit requirementsChen-Yu Tsai2022-07-152-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This partially reverts commit fd9f8050e355d7fd1e126cd207b06c96cde7f783, and changes things so that the capability string fields of the encoder conform to their requirements. The driver name field should contain the actual driver name, not some otherwise unused string macro from the driver. To make this clear, copy the name from the driver's name field. The card name for the video encoder previously held a static platform name that was fixed to match MT8173. This obviously doesn't make sense for newer chips. Since commit fd9f8050e355 ("media: mediatek: vcodec: Change encoder v4l2 capability value"), this field was changed to hold the driver's name, or "mtk-vcodec-dec". This doesn't make much sense either, since this still doesn't reflect what chip this is. Instead, fill in the card name with "MTxxxx video encoder" with the proper chip number. Since commit f2d8b6917f3b ("media: v4l: ioctl: Set bus_info in v4l_querycap()"), the V4L2 core provides a default value for the bus_info field for platform and PCI devices. This value will match the default value for media devices added by commit cef699749f37 ("media: mc: Set bus_info in media_device_init()"). These defaults are stable and device-specific. Drop the custom capability bus_info from the mtk-vcodec encoder driver, and use the defaults. As this patch removes the last usage of MTK_VCODEC_DRV_NAME, remove the macro as well. Fixes: fd9f8050e355 ("media: mediatek: vcodec: Change encoder v4l2 capability value") Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: mediatek: vcodec: Make decoder capability fields fit requirementsChen-Yu Tsai2022-07-151-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This partially reverts commit a8a7a278c56ad3b4ddd4db9a960e0537d032b0b3, and changes things so that the capability string fields of the decoder conform to their requirements. This recent change caused ChromeOS's decoder to no longer function. This is due to ChromeOS using the driver name field to match the video device with its accompanying media device. After the change, they no longer matched. The driver name field should contain the actual driver name, not some otherwise unused string macro from the driver. To make this clear, copy the name from the driver's name field. The card name for the video decoder previously held a static platform name that was fixed to match MT8173. This obviously doesn't make sense for newer chips. Since commit a8a7a278c56a ("media: mediatek: vcodec: Change decoder v4l2 capability value"), this field was changed to hold the driver's name, or "mtk-vcodec-dec". This doesn't make much sense either, since this still doesn't reflect what chip this is. Instead, fill in the card name with "MTxxxx video decoder" with the proper chip number. Since commit f2d8b6917f3b ("media: v4l: ioctl: Set bus_info in v4l_querycap()"), the V4L2 core provides a default value for the bus_info field for platform and PCI devices. This value will match the default value for media devices added by commit cef699749f37 ("media: mc: Set bus_info in media_device_init()"). These defaults are stable and device-specific. Drop the custom capability bus_info from the mtk-vcodec decoder driver, and use the defaults. This also fixes the long standing issue where the media device used for the stateless decoder didn't have its bus_info set, and would never match its accompanying video device. Fixes: a8a7a278c56a ("media: mediatek: vcodec: Change decoder v4l2 capability value") Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: lirc: ensure lirc device receives repeatsMarko Mäkelä2022-07-151-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Pressing a button on a remote control unit will typically lead to messages being sent several times per second until the button is released. Some remote control units indicate long key presses by sending special "repeat" messages, for which the protocol driver calls rc_repeat(). Other units repeat the same message over and over, which will be handled by calling rc_keydown(). The function rc_keydown() never set the LIRC "repeat" flag to distinguish repeated messages that were sent due to a long keypress, and messages sent due to repeated short keypresses. While a user-space program may implement special logic to distinguish long keypresses, it is much simpler to be able to rely on the flag. Commit de142c32410649e64d44928505ffad2176a96a9e ("media: lirc: implement reading scancode") would never set the LIRC_SCANCODE_FLAG_REPEAT flag. Commit b66218fddfd29f315a103db811152ab0c95fb054 ("media: lirc: ensure lirc device receives nec repeats") fixed it up for rc_repeat() but not rc_keydown(). Signed-off-by: Marko Mäkelä <marko.makela@iki.fi> Co-developed-by: Sean Young <sean@mess.org> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: ati-remote: remove private err() macroOliver Neukum2022-07-151-6/+5
| | | | | | | | Drivers should use dev_err() Signed-off-by: Oliver Neukum <oneukum@suse.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: igorplugusb: use correct size pass to igorplugusb_probe()Yang Yingliang2022-07-151-2/+2
| | | | | | | | | | | After 'buf_in' change to pointer, the sizeof() is not correct buffer size, it should be MAX_PACKET. Fixes: b3f820b905c9 ("media: igorplugusb: respect DMA coherency") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: vimc: documentation for lensYunke Cao2022-07-152-0/+23
| | | | | | | | | Add documentation for vimc-lens. Add a lens into the vimc topology graph. Signed-off-by: Yunke Cao <yunkec@google.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: vimc: use data link entities enum to index the ent_config arrayDaniel Oakley2022-07-151-11/+11
| | | | | | | | | | | | | | Future additions to the ent_config[] could break the association between the index of the struct vimc_ent_config entries in the ent_config[] array, and the index defined by the enum proposed in the previous patch. Using designated initializers solves this by linking the 2 together clearly in code and prevents the array not reflecting the enum. There is no functional change intended. Suggested-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Daniel Oakley <daniel.oakley@ideasonboard.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: vimc: enumerate data link entities for clarityDaniel Oakley2022-07-151-8/+28
| | | | | | | | | | | | The data_links array was hard to read and understand. By implementing enumerated vimc data link entities, clarity has been improved when defining data_links. This therefore should help new programmers to understand the codebase better. There is no functional change intended. Suggested-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Daniel Oakley <daniel.oakley@ideasonboard.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: vimc: expand the names of vimc entity typesDaniel Oakley2022-07-157-648/+652
| | | | | | | | | | | | When introducing the lens controller, it became apparent that the vimc entity type names were hard to understand, e.g. vimc_len_type refers to the lens. The names of the vimc entity types have been expanded to make the code easier to understand. There is no functional change intended. Suggested-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Daniel Oakley <daniel.oakley@ideasonboard.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: vimc: add ancillary lensYunke Cao2022-07-154-21/+170
| | | | | | | | | | | | | | | | | | | | | | | | Add lens to vimc driver and link them with sensors using ancillary links. Provides an example of ancillary link usage.The lens supports FOCUS_ABSOLUTE control. Test example: With default vimc topology > media-ctl -p Media controller API version 5.18.0 ... - entity 28: Lens A (0 pad, 0 link) type V4L2 subdev subtype Lens flags 0 device node name /dev/v4l-subdev6 - entity 29: Lens B (0 pad, 0 link) type V4L2 subdev subtype Lens flags 0 device node name /dev/v4l-subdev7 > v4l2-ctl -d /dev/v4l-subdev7 -C focus_absolute focus_absolute: 0 Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Yunke Cao <yunkec@google.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: v4l: async: Also match secondary fwnode endpointsSakari Ailus2022-07-151-14/+21
| | | | | | | | | | | | | For camera sensor devices the firmware information of which comes from non-DT (or some ACPI variants), the kernel makes the information visible to the drivers in a form similar to DT. This takes place through device's secondary fwnodes, in which case also the secondary fwnode needs to be heterogenously (endpoint vs. device) matched. Fixes: 1f391df44607 ("media: v4l2-async: Use endpoints in __v4l2_async_nf_add_fwnode_remote()") Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: amphion: only insert the first sequence startcode for vc1l formatMing Qian2022-07-084-2/+10
| | | | | | | | | | | | | | | | | For format V4L2_PIX_FMT_VC1_ANNEX_L, the amphion vpu requires driver to help insert some custom startcode before sequence and frame. but only the first sequence startcode is needed, the extra startcode will cause decoding error. So after seek, we don't need to insert the sequence startcode. In other words, for V4L2_PIX_FMT_VC1_ANNEX_L, the vpu doesn't support dynamic resolution change. Fixes: 145e936380edb ("media: amphion: implement malone decoder rpc interface") Signed-off-by: Ming Qian <ming.qian@nxp.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: amphion: sync buffer status with firmware during abortMing Qian2022-07-081-0/+9
| | | | | | | | | | 1. prevent to allocate buffer to firmware during abort 2. release buffer when clear the slots Fixes: 6de8d628df6ef ("media: amphion: add v4l2 m2m vpu decoder stateful driver") Signed-off-by: Ming Qian <ming.qian@nxp.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: hantro: Fix RK3399 H.264 format advertisingEzequiel Garcia2022-07-081-7/+53
| | | | | | | | | | | | | | | | Commit 1f82f2df523cb ("media: hantro: Enable H.264 on Rockchip VDPU2") enabled H.264 on some SoCs with VDPU2 cores. This had the side-effect of exposing H.264 coded format as supported on RK3399. Fix this and clarify how the codec is explicitly disabled on RK3399 on this driver. Fixes: 1f82f2df523cb ("media: hantro: Enable H.264 on Rockchip VDPU2") Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Tested-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: docs: Remove extraneous \endgroup from P010 tableAkira Yokosawa2022-07-081-3/+0
| | | | | | | | | | | | | | | | | The \endgroup command at the bottom of a table added in commit 5374d8fb75f3 ("media: Add P010 video format") doesn't have a corresponding \begingroup command preceding it. This imbalance causes an build error in "make pdfdocs". Fix the issue by removing it. Signed-off-by: Akira Yokosawa <akiyks@gmail.com> Fixes: 5374d8fb75f3 ("media: Add P010 video format") Cc: Benjamin Gaignard <benjamin.gaignard@collabora.com> Cc: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: dt-bindings: media: samsung,s5pv210-jpeg: convert to dtschemaKrzysztof Kozlowski2022-07-083-16/+124
| | | | | | | | | | | | | | | | Convert the Samsung SoC JPEG codec bindings to DT schema. The original bindings were quite old and incomplete, so change during conversion: 1. Add typical (already used) properties like iommus and power domains. 2. Document samsung,exynos4212-jpeg compatible (already used in DTS and driver). 3. List clocks per each variant. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: amphion: defer setting last_buffer_dequeued until resolution changes ↵Ming Qian2022-07-082-15/+23
| | | | | | | | | | | | | | | | | | | | | | | | | are processed Don't set last_buffer_dequeued during dynamic resolution change, otherwise it may be cleared in handling resolution change, as streamoff may be called in dynamic resolution change. Normally, this does not happen. But we encounter a special testcase, User issue V4L2_DEC_CMD_STOP after enqueue one buffer that only contains codec config header, but not any frame data. So VPU report the parsed resolution, then report the eos event. So driver should notify user to handle resolution change first, after it's handled, set the last_buffer_dequeued. then the user can exit decoding normally. Otherwise the user may be stalled. Fixes: 6de8d628df6ef ("media: amphion: add v4l2 m2m vpu decoder stateful driver") Signed-off-by: Ming Qian <ming.qian@nxp.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: mediatek: vcodec: Initialize decoder parameters for each instanceChen-Yu Tsai2022-07-081-1/+2
| | | | | | | | | | | | | | | | | The decoder parameters are stored in each instance's context data. This needs to be initialized per-instance, but a previous fix incorrectly changed it to only be initialized for the first opened instance. This resulted in subsequent instances not correctly signaling the requirement for the Requests API. Fix this by calling the initializing function outside of the v4l2_fh_is_singular() conditional block. Fixes: faddaa735c20 ("media: mediatek: vcodec: Initialize decoder parameters after getting dec_capability") Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Reviewed-by: Yunfei Dong <yunfei.dong@mediatek.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: mediatek: vcodec: decoder: Embed framesize inside mtk_video_fmtChen-Yu Tsai2022-07-084-82/+22
| | | | | | | | | | | | | | | | | | | | | Right now the decoder maintains two separate lists for supported pixel formats and frame sizes. Getting the supported frame sizes for the current set format is a bit convoluted, requiring a search through the separate frame size list. The frame sizes are used to clamp and align requested resolutions. Instead, the frame size structure could be embedded inside the pixel format structure. Getting one also gets the other. And since the the driver already keeps pointers to the current set format, getting the frame sizes becomes straightforward. Do just that. Move v4l2_frmsize_stepwise inside mtk_video_fmt, and get rid of mtk_codec_framesizes. Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: mediatek: vcodec: decoder: Drop max_{width,height} from mtk_vcodec_ctxChen-Yu Tsai2022-07-082-13/+0
| | | | | | | | | | | | | | | | | | | | This partially reverts commit b018be06f3c7 ("media: mediatek: vcodec: Read max resolution from dec_capability"). After the previous patches: - media: mediatek: vcodec: decoder: Fix 4K frame size enumeration - media: mediatek: vcodec: decoder: Skip alignment for default resolution - media: mediatek: vcodec: decoder: Fix resolution clamping in TRY_FMT the max_{width,height} fields in |struct mtk_vcodec_ctx| no longer have any real users. Remove them. Fixes: b018be06f3c7 ("media: mediatek: vcodec: Read max resolution from dec_capability") Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: mediatek: vcodec: decoder: Fix resolution clamping in TRY_FMTChen-Yu Tsai2022-07-081-12/+36
| | | | | | | | | | | | | | | | | | | | | | In commit b018be06f3c7 ("media: mediatek: vcodec: Read max resolution from dec_capability"), TRY_FMT clamps the resolution to the maximum that was previously set either by default 1080p or the limit set by a previous S_FMT call. This does not make sense when doing TRY_FMT for the output side, which may have different capabilities. Instead, for the output side, find the maximum resolution based on the pixel format requested. For the capture side, find the maximum resolution based on the currently set output format. The maximum resolution is found from the list of per-format frame sizes, so the patch "media: mediatek: vcodec: dec: Fix 4K frame size enumeration" is needed. Fixes: b018be06f3c7 ("media: mediatek: vcodec: Read max resolution from dec_capability") Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: mediatek: vcodec: decoder: Skip alignment for default resolutionChen-Yu Tsai2022-07-081-7/+0
| | | | | | | | | | | | | The default resolution of 64x64 is already aligned, according to the call to v4l_bound_align_image() in mtk_vcodec_dec_set_default_params(). Drop the redundant v4l_bound_align_image() call. This also removes one usage of ctx->max_{width,height}. Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: mediatek: vcodec: decoder: Fix 4K frame size enumerationChen-Yu Tsai2022-07-082-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | This partially reverts commit b018be06f3c7 ("media: mediatek: vcodec: Read max resolution from dec_capability"). In this commit, the maximum resolution ended up being a function of both the firmware capability and the current set format. However, frame size enumeration for output (coded) formats should not depend on the format set, but should return supported resolutions for the format requested by userspace. Fix this so that the driver returns the supported resolutions correctly, even if the instance only has default settings, or if the output format is currently set to VP8F, which does not support 4K. This adds an copy of special casing for !VP8 and 4K support. The other existing copy will be removed when .max_{width,height} are removed from |struct mtk_vcodec_ctx| in a subsequent patch. Fixes: b018be06f3c7 ("media: mediatek: vcodec: Read max resolution from dec_capability") Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: mediatek: vcodec: decoder: Const-ify stepwise_fhdChen-Yu Tsai2022-07-081-1/+1
| | | | | | | | | | | stepwise_fhd is the reference framesize variable, and should not be altered. Make it constant. Fixes: ("76250b48de79 media: mediatek: vcodec: Getting supported decoder format types") Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: staging: media: imx: imx7-media-csi: Drop usage of shared helpersLaurent Pinchart2022-07-081-2/+0
| | | | | | | | | | None of the shared helpers are used anymore. Make this official by dropping inclusion of imx-media.h. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: staging: media: imx: imx7-media-csi: Drop V4L2 events supportLaurent Pinchart2022-07-081-16/+0
| | | | | | | | | | | The only event that the driver allows subscribing to, V4L2_EVENT_IMX_FRAME_INTERVAL_ERROR, is never generated. Drop events support. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>