summaryrefslogtreecommitdiff
path: root/drivers/staging/media/imx/imx-ic-prp.c
AgeCommit message (Collapse)Author
2019-10-10media: imx: Move pads init to probeSteve Longerbeam
If a subdevice is unregistered and then registered again without the driver being removed and re-probed (which will happen when the media device is removed and re-probed without also removing/re-probing the subdevice), media_device_register_entity() is called with a non-zero entity->num_pads, and then the subdevice's .registered callback calls media_entity_pads_init(). Thus the subdevice's pad objects are added to the media device pad list twice, causing list corruption. One way to fix this would be to create media_entity_pads_destroy(), and call it in the subdevice's .unregistered callback. But calling media_entity_pads_init() in the .registered callbacks was done for legacy reasons and is no longer necessary, so move the call to media_entity_pads_init() into the subdevice's probe functions. This fixes the duplicate pad obejcts in the media device pad list. Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2019-07-15Merge tag 'drm-next-2019-07-16' of git://anongit.freedesktop.org/drm/drmLinus Torvalds
Pull drm updates from Dave Airlie: "The biggest thing in this is the AMD Navi GPU support, this again contains a bunch of header files that are large. These are the new AMD RX5700 GPUs that just recently became available. New drivers: - ST-Ericsson MCDE driver - Ingenic JZ47xx SoC UAPI change: - HDR source metadata property Core: - HDR inforframes and EDID parsing - drm hdmi infoframe unpacking - remove prime sg_table caching into dma-buf - New gem vram helpers to reduce driver code - Lots of drmP.h removal - reservation fencing fix - documentation updates - drm_fb_helper_connector removed - mode name command handler rewrite fbcon: - Remove the fbcon notifiers ttm: - forward progress fixes dma-buf: - make mmap call optional - debugfs refcount fixes - dma-fence free with pending signals fix - each dma-buf gets an inode Panels: - Lots of additional panel bindings amdgpu: - initial navi10 support - avoid hw reset - HDR metadata support - new thermal sensors for vega asics - RAS fixes - use HMM rather than MMU notifier - xgmi topology via kfd - SR-IOV fixes - driver reload fixes - DC use a core bpc attribute - Aux fixes for DC - Bandwidth calc updates for DC - Clock handling refactor - kfd VEGAM support vmwgfx: - Coherent memory support changes i915: - HDR Support - HDMI i2c link - Icelake multi-segmented gamma support - GuC firmware update - Mule Creek Canyon PCH support for EHL - EHL platform updtes - move i915.alpha_support to i915.force_probe - runtime PM refactoring - VBT parsing refactoring - DSI fixes - struct mutex dependency reduction - GEM code reorg mali-dp: - Komeda driver features msm: - dsi vs EPROBE_DEFER fixes - msm8998 snapdragon 835 support - a540 gpu support - mdp5 and dpu interconnect support exynos: - drmP.h removal tegra: - misc fixes tda998x: - audio support improvements - pixel repeated mode support - quantisation range handling corrections - HDMI vendor info fix armada: - interlace support fix - overlay/video plane register handling refactor - add gamma support rockchip: - RX3328 support panfrost: - expose perf counters via hidden ioctls vkms: - enumerate CRC sources list ast: - rework BO handling mgag200: - rework BO handling dw-hdmi: - suspend/resume support rcar-du: - R8A774A1 Soc Support - LVDS dual-link mode support - Additional formats - Misc fixes omapdrm: - DSI command mode display support stm - fb modifier support - runtime PM support sun4i: - use vmap ops vc4: - binner bo binding rework v3d: - compute shader support - resync/sync fixes - job management refactoring lima: - NULL pointer in irq handler fix - scheduler default timeout virtio: - fence seqno support - trace events bochs: - misc fixes tc458767: - IRQ/HDP handling sii902x: - HDMI audio support atmel-hlcdc: - misc fixes meson: - zpos support" * tag 'drm-next-2019-07-16' of git://anongit.freedesktop.org/drm/drm: (1815 commits) Revert "Merge branch 'vmwgfx-next' of git://people.freedesktop.org/~thomash/linux into drm-next" Revert "mm: adjust apply_to_pfn_range interface for dropped token." mm: adjust apply_to_pfn_range interface for dropped token. drm/amdgpu/navi10: add uclk activity sensor drm/amdgpu: properly guard the generic discovery code drm/amdgpu: add missing documentation on new module parameters drm/amdgpu: don't invalidate caches in RELEASE_MEM, only do the writeback drm/amd/display: avoid 64-bit division drm/amdgpu/psp11: simplify the ucode register logic drm/amdgpu: properly guard DC support in navi code drm/amd/powerplay: vega20: fix uninitialized variable use drm/amd/display: dcn20: include linux/delay.h amdgpu: make pmu support optional drm/amd/powerplay: Zero initialize current_rpm in vega20_get_fan_speed_percent drm/amd/powerplay: Zero initialize freq in smu_v11_0_get_current_clk_freq drm/amd/powerplay: Use memset to initialize metrics structs drm/amdgpu/mes10.1: Fix header guard drm/amd/powerplay: add temperature sensor support for navi10 drm/amdgpu: fix scheduler timeout calc drm/amdgpu: Prepare for hmm_range_register API change (v2) ...
2019-06-14media: imx: Try colorimetry at both sink and source padsSteve Longerbeam
Retask imx_media_fill_default_mbus_fields() to try colorimetry parameters, renaming it to to imx_media_try_colorimetry(), and call it at both sink and source pad try_fmt's. The unrelated check for uninitialized field value is moved out to appropriate places in each subdev try_fmt. The IC now supports Rec.709 and BT.601 Y'CbCr encoding, and both limited and full range quantization for both YUV and RGB space, so allow those for pipelines that route through the IC. Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com> Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2019-05-28media: staging/imx: Improve pipeline searchingSteve Longerbeam
Export find_pipeline_pad(), renaming to imx_media_pipeline_pad(), and extend its functionality to allow searching for video devices in the enabled pipeline in addition to sub-devices. As part of this: - Rename imx_media_find_mipi_csi2_channel() to imx_media_pipeline_csi2_channel(). - Remove imx_media_find_upstream_pad(), it is redundant now. - Rename imx_media_find_upstream_subdev() to imx_media_pipeline_subdev() with an additional boolean argument for searching upstream or downstream. - Add imx_media_pipeline_video_device() which is analogous to imx_media_pipeline_subdev() but searches for video devices. - Remove imxmd pointer arg from all of the functions above, it was never used in those functions. With that change the i.MX5/6 CSI, VDIC, and IC sub-devices no longer require the media_device. Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2019-05-28media: staging/imx: Switch to sync registration for IPU subdevsSteve Longerbeam
Because the IPU sub-devices VDIC and IC are not present in the device-tree, platform devices were created for them instead. This allowed these sub-devices to be added to the media device's async notifier and registered asynchronously along with the other sub-devices that do have a device-tree presence (CSI and devices external to the IPU and SoC). But that approach isn't really necessary. The IPU sub-devices don't actually require a backing device (sd->dev is allowed to be NULL). And that approach can't get around the fact that the IPU sub-devices are not part of a device hierarchy, which makes it awkward to retrieve the parent IPU of these devices. By registering them synchronously, they can be registered from the CSI async bound notifier, so the init function for them can be given the CSI subdev, who's dev->parent is the IPU. That is a somewhat cleaner way to retrieve the parent IPU. So convert to synchronous registration for the VDIC and IC task sub-devices, at the time a CSI sub-device is bound. There is no longer a backing device for them (sd->dev is NULL), but that's ok. Also set the VDIC/IC sub-device owner as the IPU, so that a reference can be taken on the IPU module. Since the VDIC and IC task drivers are no longer platform drivers, they are now statically linked to imx-media module. Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2019-04-03staging: media: imx: add proper SPDX identifiers on files that did not have ↵Greg Kroah-Hartman
them. There were a few files for the imx media drivers that did not have SPDX identifiers on them, so fix that up. At the same time, remove the "free form" text that specified the license of the file, as that is impossible for any tool to properly parse. Cc: Philipp Zabel <p.zabel@pengutronix.de> Cc: Mauro Carvalho Chehab <mchehab@kernel.org> Cc: Shawn Guo <shawnguo@kernel.org> Cc: Sascha Hauer <s.hauer@pengutronix.de> Cc: Fabio Estevam <festevam@gmail.com> Cc: NXP Linux Team <linux-imx@nxp.com> Cc: linux-media@vger.kernel.org Acked-by: Steve Longerbeam <slongerbeam@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-18media: staging/imx: rearrange group id to take in account IPURui Miguel Silva
Some imx system do not have IPU, so prepare the imx media drivers to support this kind of devices. Rename the group ids to include an _IPU_ prefix, add a new group id to support systems with only a CSI without IPU, and also rename the create internal links to make it clear that only systems with IPU have internal subdevices. Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2019-02-07media: imx: Validate frame intervals before settingSteve Longerbeam
In the .s_frame_interval() subdev op, don't accept or set a frame interval with a zero numerator or denominator. This fixes a v4l2-compliance failure: fail: v4l2-test-formats.cpp(1146): cap->timeperframe.numerator == 0 || cap->timeperframe.denominator == 0 test VIDIOC_G/S_PARM: FAIL Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-02-26media: staging/imx: Implement init_cfg subdev pad opSteve Longerbeam
Implement the init_cfg pad op in all imx-media subdevices. The try formats are initialized to the current active formats on all pads. Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-15media: staging/imx: remove static subdev arraysSteve Longerbeam
For more complex OF graphs, there will be more async subdevices registered. Remove the static subdev[IMX_MEDIA_MAX_SUBDEVS] array, so that imx-media places no limits on the number of async subdevs that can be added and registered. There were two uses for 'struct imx_media_subdev'. First was to act as the async subdev list to be passed to v4l2_async_notifier_register(). Second was to aid in inheriting subdev controls to the capture devices, and this is done by creating a list of capture devices that can be reached from a subdev's source pad. So 'struct imx_media_subdev' also contained a static array of 'struct imx_media_pad' for placing the capture device lists at each pad. 'struct imx_media_subdev' has been completely removed. Instead, at async completion, allocate an array of 'struct imx_media_pad' and attach it to the subdev's host_priv pointer, in order to support subdev controls inheritance. Likewise, remove static async_ptrs[IMX_MEDIA_MAX_SUBDEVS] array. Instead, allocate a 'struct imx_media_async_subdev' when forming the async list, and add it to an asd_list list_head in imx_media_add_async_subdev(). At async completion, allocate the asd pointer list and pull the asd's off asd_list for v4l2_async_notifier_register(). Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-10-27media: imx: Fix VDIC CSI1 selectionTim Harvey
When using VDIC with CSI1, make sure to select the correct CSI in IPU_CONF. Fixes: f0d9c8924e2c3376 ("[media] media: imx: Add IC subdev drivers") Suggested-by: Marek Vasut <marex@denx.de> Signed-off-by: Tim Harvey <tharvey@gateworks.com> Acked-by: Steve Longerbeam <steve_longerbeam@mentor.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2017-06-20[media] media: imx: Drop warning upon multiple S_STREAM disable callsMarek Vasut
Calling S_STREAM OFF multiple times on a video device is valid, although dubious, practice. Instead of warning about it and setting stream count lower than zero, just ignore the subsequent S_STREAM calls and correct the stream count to zero. Signed-off-by: Marek Vasut <marex@denx.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-06-20[media] media: imx: set and propagate default field, colorimetrySteve Longerbeam
This patch adds a call to imx_media_fill_default_mbus_fields() in the *_try_fmt() functions at the sink pads, to set empty field order and colorimetry parameters. If the field order is set to ANY, choose the currently set field order at the sink pad. If the colorspace is set to DEFAULT, choose the current colorspace at the sink pad. If any of xfer_func, ycbcr_enc or quantization are set to DEFAULT, either choose the current sink pad setting, or the default setting for the new colorspace, if non-DEFAULT colorspace was given. If a format is destined to be routed through the Image Converter, fixed quantization and Y`CbCr encoding must be set. Colorimetry is also propagated from sink to source pads anywhere this has not already been done. Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-06-20[media] media: imx: Add IC subdev driversSteve Longerbeam
This is a set of three media entity subdevice drivers for the i.MX Image Converter: - Pre-process Router: Takes input frames from CSI0, CSI1, or VDIC. Two output pads enable either or both of the preprocess tasks below. If the input is from one of the CSIs, both proprocess task links can be enabled to process frames from that CSI simultaneously. If the input is the VDIC, only the Pre-processing Viewfinder task link can be enabled. - Pre-processing Encode task: video frames are routed directly from the CSI and can be scaled, color-space converted, and rotated. Scaled output is limited to 1024x1024 resolution. Output frames are routed to the prpenc capture device. - Pre-processing Viewfinder task: this task can perform the same conversions as the pre-process encode task, but in addition can be used for hardware motion compensated deinterlacing. Frames can come either directly from the CSI or from the VDIC. Scaled output is limited to 1024x1024 resolution. Output frames are routed to the prpvf capture device. Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>