summaryrefslogtreecommitdiffstats
path: root/drivers/staging/media/imx
Commit message (Collapse)AuthorAgeFilesLines
* media: imx7-media-csi: get csi upstream endpointRui Miguel Silva2019-06-211-0/+8
| | | | | | | | | | When the upstream endpoint is neither a mux nor a CSI2 module, just get the source pad directly upstream from the CSI. Reported-by: Sebastien Szymanski <sebastien.szymanski@armadeus.com> Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
* media: Revert "media: staging/imx: Allow driver to build if COMPILE_TEST is ↵Fabio Estevam2019-06-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | enabled" Commit 020bc7354a6e ("media: staging/imx: Allow driver to build if COMPILE_TEST is enabled") incorrectly assumed that the imx media driver had no build time dependency with IMX_IPUV3_CORE. Building on x86_64 without IMX_IPUV3_CORE causes lots of build errors such as: All these definitions come from the imx ipu3 core driver, so make sure that imx media depends on IMX_IPUV3_CORE. This reverts commit 020bc7354a6ebec980e0aedf5bedf57b42f93aca. Reported-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Fabio Estevam <festevam@gmail.com> Acked-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
* media: imx7-media-csi: Remove unneeded error messageFabio Estevam2019-06-051-3/+1
| | | | | | | | | | In case of ioremap failure, the core code will take care of printing the error message, so there is no need for having a local error message in the driver. Signed-off-by: Fabio Estevam <festevam@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
* media: imx7-media-csi: Use u32 for storing register readsFabio Estevam2019-06-051-13/+13
| | | | | | | | | | | The CSI registers are 32-bit, so using u32 type is more suitable for storing the values from register reads. Switch from 'unsigned long' to 'u32' type. Signed-off-by: Fabio Estevam <festevam@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
* media: imx7-media-csi: Use functions instead of macrosFabio Estevam2019-06-051-4/+10
| | | | | | | | | | | | | Currently there is a macro for reading and another macro for writing to the CSI registers. Functions can do parameter type checking, which leads to a safer code, so switch from macro to function implementation. Signed-off-by: Fabio Estevam <festevam@gmail.com> Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
* media: imx7-mipi-csis: Remove extra blank lineFabio Estevam2019-06-051-1/+0
| | | | | | | | | Checkpatch reports an extra blank line, so remove such unneeded line. Signed-off-by: Fabio Estevam <festevam@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
* media: imx7-mipi-csis: Remove unneeded 'ret' initializationFabio Estevam2019-06-051-1/+1
| | | | | | | | | | | | | There is no need for initializing the 'ret' variable as it will be assigned at: ret = mipi_csis_parse_dt(pdev, state); Remove the unneeded initialization. Signed-off-by: Fabio Estevam <festevam@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
* media: imx7-mipi-csis: Propagate the error if clock enabling failsFabio Estevam2019-06-051-7/+7
| | | | | | | | | | | | | Currently the return value from clk_bulk_prepare_enable() is checked, but it is not propagate it in the case of failure. Fix it and also move the error message to the caller of mipi_csis_clk_enable(). Signed-off-by: Fabio Estevam <festevam@gmail.com> Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
* media: staging/imx: fix two NULL vs IS_ERR() bugsDan Carpenter2019-06-032-4/+4
| | | | | | | | | | | The imx_media_pipeline_pad() function return NULL pointers on error, it never returns error pointers. Fixes: 3ef46bc97ca2 ("media: staging/imx: Improve pipeline searching") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
* media: imx7-media-csi: Change imx7_csi_enable() to voidFabio Estevam2019-05-281-4/+1
| | | | | | | | | | | imx7_csi_enable() always return 0 and its return value is never checked, so convert it to void. Signed-off-by: Fabio Estevam <festevam@gmail.com> Tested-by: Rui Miguel Silva <rmfrfs@gmail.com> Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
* media: imx7-media-csi: Check the return value from clk_prepare_enable()Fabio Estevam2019-05-281-4/+10
| | | | | | | | | | | clk_prepare_enable() may fail, so we should better check its return value and propagate it in the case of error. Signed-off-by: Fabio Estevam <festevam@gmail.com> Tested-by: Rui Miguel Silva <rmfrfs@gmail.com> Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
* media: imx7-media-csi: Remove unneeded breakFabio Estevam2019-05-281-1/+0
| | | | | | | | | | | Remove unneeded 'break' right after the 'return' statement as pointed out by checkpatch. Signed-off-by: Fabio Estevam <festevam@gmail.com> Tested-by: Rui Miguel Silva <rmfrfs@gmail.com> Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
* media: imx7-media-csi: Propagate the correct error for devm_request_irq()Fabio Estevam2019-05-281-1/+0
| | | | | | | | | | | In the case of devm_request_irq() failure, let's propagate the real error code instead of a fake one. Signed-off-by: Fabio Estevam <festevam@gmail.com> Tested-by: Rui Miguel Silva <rmfrfs@gmail.com> Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
* media: imx7-media-csi: Propagate the correct error for platform_get_irq()Fabio Estevam2019-05-281-1/+1
| | | | | | | | | | | In the case of platform_get_irq() failure, let's propagate the real error code instead of a fake one. Signed-off-by: Fabio Estevam <festevam@gmail.com> Tested-by: Rui Miguel Silva <rmfrfs@gmail.com> Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
* media: imx7-media-csi: Use devm_platform_ioremap_resource()Fabio Estevam2019-05-281-5/+3
| | | | | | | | | | | | | Use devm_platform_ioremap_resource() to simplify the code a bit. While at it, propagate the real error value in case of devm_platform_ioremap_resource() failure. Signed-off-by: Fabio Estevam <festevam@gmail.com> Tested-by: Rui Miguel Silva <rmfrfs@gmail.com> Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
* media: imx7-media-csi: Acquire a single clockFabio Estevam2019-05-281-43/+8
| | | | | | | | | | | As per the i.MX7D Reference Manual only the MCLK is used for the CSI block, so only handle this single clock. Signed-off-by: Fabio Estevam <festevam@gmail.com> Tested-by: Rui Miguel Silva <rmfrfs@gmail.com> Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
* media: staging/imx: Don't set driver data for v4l2_devSteve Longerbeam2019-05-282-7/+5
| | | | | | | | | | | | | | The media device is already available via multiple methods, there is no need to set driver data for v4l2_dev to the media device. In imx_media_link_notify(), get media device from link->graph_obj.mdev. In imx_media_capture_device_register(), get media device from v4l2_dev->mdev. 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>
* media: staging/imx: Improve pipeline searchingSteve Longerbeam2019-05-2810-93/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* media: staging/imx: Re-organize modulesSteve Longerbeam2019-05-287-358/+369
| | | | | | | | | | | | | | | | | | | | | | Re-organize modules, and which objects are linked into those modules, so that: - imx6-media (renamed from imx-media) is the media driver module for imx5/6 only, and has no symbol exports. - imx6-media-csi (renamed from imx-media-csi) is the subdev driver module for imx5/6 CSI. It is now linked direcly with imx-media-fim, since only the imx5/6 CSI makes use of the frame interval monitor. - imx-media-common now only contains common code between imx5/6 and imx7 media drivers. It contains imx-media-utils, imx-media-of, imx-media-dev-common, and imx-media-capture. In order to acheive that, some functions common to imx5/6 and imx7 have been moved out of imx-media-dev.c and into imx-media-dev-common.c. 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>
* media: staging/imx: Remove capture_device_set_formatSteve Longerbeam2019-05-285-67/+55
| | | | | | | | | | | | Don't propagate the source pad format to the connected capture device. It's now the responsibility of userspace to call VIDIOC_S_FMT on the capture device to ensure the capture format and compose rectangle are compatible with the connected source. To check this, validate the capture format with the source before streaming starts. 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>
* media: Revert "media: imx: Set capture compose rectangle in ↵Steve Longerbeam2019-05-286-40/+25
| | | | | | | | | | | | | | | capture_device_set_format" Revert this commit, as imx_media_capture_device_set_format() will be removed. The arguments to mx_media_mbus_fmt_to_pix_fmt() and imx_media_capture_device_set_format() in imx7_csi_set_fmt() are also reverted. This reverts commit 5964cbd8692252615370b77eb96764dd70c2f837. 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>
* media: staging/imx: Move add_video_device into capture_device_registerSteve Longerbeam2019-05-286-29/+11
| | | | | | | | | Move imx_media_add_video_device() into imx_media_capture_device_register(). Also the former has no error conditions to convert to void. 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>
* media: staging/imx: Pass device to alloc/free_dma_bufSteve Longerbeam2019-05-285-23/+22
| | | | | | | | | | | Allocate and free a DMA coherent buffer in imx_media_alloc/free_dma_buf() from the given device. This allows DMA alloc and free using a device that is backed by real hardware, which for the imx5/6/7 CSI is the CSI unit, and for the internal IPU sub-devices, is the parent IPU. 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>
* media: staging/imx: Switch to sync registration for IPU subdevsSteve Longerbeam2019-05-2813-539/+327
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* media: Revert "media: staging/imx: add media device to capture register"Steve Longerbeam2019-05-285-8/+7
| | | | | | | | | | | | The imx6-specific subdevs that register a capture device will no longer hold a reference to the media device, so this commit must be reverted. This reverts commit 16204b8a1c1af77725533b77936e6c73953486ae. 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>
* media: staging: media: imx: fix Unneeded variable: "ret". Return "0"Hariprasad Kelam2019-05-281-2/+1
| | | | | | | | | | | | fix below warning reported by coccichec drivers/staging/media/imx/imx-media-capture.c:617:5-8: Unneeded variable: "ret". Return "0" on line 630 Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com> Reviewed-by: Fabio Estevam <festevam@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
* media: imx7_mipi_csis: fix racy entity pads initRui Miguel Silva2019-05-281-8/+16
| | | | | | | | | | | | | Setting the media entity pads after the async register subdev can be racy with probe complete callback. So, make sure that the media pads are initialized before the probe complete is called. For that move the media entity pads initialization to the registered subdev internal operation. Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
* media: staging/imx: Allow driver to build if COMPILE_TEST is enabledJavier Martinez Canillas2019-05-231-1/+1
| | | | | | | | | | | The driver has runtime but no build time dependency with IMX_IPUV3_CORE, so can be built for testing purposes if COMPILE_TEST option is enabled. This is useful to have more build coverage and make sure that the driver is not affected by changes that could cause build regressions. Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
* Merge tag 'media/v5.2-1' of ↵Linus Torvalds2019-05-165-7/+8
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media Pull media fixes from Mauro Carvalho Chehab: "Some fixes for some platform drivers (rockchip, atmel, omap, daVinci, tegra-cec, coda and rcar). Also includes a fix on one of the V4L2 uAPI doc, explaining a border case" * tag 'media/v5.2-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: media: rockchip/vpu: Fix/re-order probe-error/remove path media: rockchip/vpu: Initialize mdev->bus_info media: rockchip/vpu: Get vdev from the file arg in vidioc_querycap() media: rockchip/vpu: Add missing dont_use_autosuspend() calls media: rockchip/vpu: Do not request id 0 for our video device media: tegra-cec: fix cec_notifier_parse_hdmi_phandle return check media: davinci/vpbe: array underflow in vpbe_enum_outputs() media: field-order.rst: clarify FIELD_ANY and FIELD_NONE media: staging/imx: add media device to capture register media: rcar-csi2: Propagate the FLD signal for NTSC and PAL media: rcar-csi2: restart CSI-2 link if error is detected media: omap_vout: potential buffer overflow in vidioc_dqbuf() media: coda: fix unset field and fail on invalid field in buf_prepare media: atmel: atmel-isc: fix asd memory allocation media: atmel: atmel-isc: fix INIT_WORK misplacement media: atmel: atmel-isc: limit incoming pixels per frame
| * media: staging/imx: add media device to capture registerRui Miguel Silva2019-05-085-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When register the capture media device it is assumed that the device data is the media device. In the imx6 case is but in the imx7 is not case. The device data is the csi structure. Add the explicit argument of the media device that we want to associate with the capture device. Reported-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org> Acked-by: Steve Longerbeam <slongerbeam@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> [hverkuil-cisco@xs4all.nl: fix checkpatch alignment warning] Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
* | Merge tag 'media/v5.1-2' of ↵Linus Torvalds2019-05-0811-103/+111
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media Pull media updates from Mauro Carvalho Chehab: - remove the deprecated Zoran driver from staging - new I2C driver: ST MIPID02 CSI-2 camera bridge - new platform driver: Amlogic Meson AO CEC G12A Controller - add support for USB audio via the media controller - au0828 driver is now supported via the media controller on both on media and on usbaudio - new kernel test for the media device allocator - add support for stateless decoder at vicodec driver - lots of other driver improvements fixes and cleanups * tag 'media/v5.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (218 commits) media: dt-bindings: aspeed-video: Add missing memory-region property media: platform: Aspeed: Make reserved memory optional media: platform: Aspeed: Remove use of reset line media: stm32-dcmi: return appropriate error codes during probe media: vsp1: Add support for missing 16-bit RGB555 formats media: vsp1: Add support for missing 16-bit RGB444 formats media: vsp1: Add support for missing 32-bit RGB formats media: v4l: Add definitions for missing 16-bit RGB555 formats media: v4l: Add definitions for missing 16-bit RGB4444 formats media: v4l: Add definitions for missing 32-bit RGB formats media: zoran: remove deprecated driver media: MAINTAINERS: Update AO CEC with ao-cec-g12a driver media: platform: meson: Add Amlogic Meson G12A AO CEC Controller driver media: dt-bindings: media: meson-ao-cec: Add G12A AO-CEC-B Compatible media: cros-ec-cec: decrement HDMI device refcount media: seco-cec: decrement HDMI device refcount media: tegra_cec: use new cec_notifier_parse_hdmi_phandle helper media: stih_cec: use new cec_notifier_parse_hdmi_phandle helper media: s5p_cec: use new cec_notifier_parse_hdmi_phandle helper media: meson: ao-cec: use new cec_notifier_parse_hdmi_phandle helper ...
| * media: staging: media: imx: imx7-mipi-csis: simplify getting .driver_dataWolfram Sang2019-04-221-4/+2
| | | | | | | | | | | | | | | | | | | | | | We should get 'driver_data' from 'struct device' directly. Going via platform_device is an unneeded step back and forth. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com> Reviewed-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
| * media: staging: use strscpy() instead of strlcpy()Mauro Carvalho Chehab2019-03-291-2/+2
| | | | | | | | | | | | | | | | | | There are a few left overs at staging which were still using the deprecated strlcpy() function. Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Reviewed-by: Mukesh Ojha <mojha@codeaurora.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
| * media: replace strncpy() by strscpy()Mauro Carvalho Chehab2019-03-292-2/+2
| | | | | | | | | | | | | | | | | | | | | | The strncpy() function is being deprecated upstream. Replace it by the safer strscpy(). While here, replace a few occurences of strlcpy() that were recently added to also use strscpy(). Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
| * media: staging: media: imx7-mipi-csis: fix debugfs compilationArnd Bergmann2019-03-291-14/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When CONFIG_DEBUGFS is enabled, we get a warning about an incorrect section annotation that can lead to undefined behavior: WARNING: vmlinux.o(.text+0xd3c7c4): Section mismatch in reference from the function mipi_csis_probe() to the function .init.text:mipi_csis_debugfs_init() The function mipi_csis_probe() references the function __init mipi_csis_debugfs_init(). This is often because mipi_csis_probe lacks a __init annotation or the annotation of mipi_csis_debugfs_init is wrong. The same function for an unknown reason has a different version for !CONFIG_DEBUGFS, which does not have this problem, but behaves the same way otherwise (it does nothing when debugfs is disabled). Consolidate the two versions, using the correct section from one version, and the implementation from the other. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
| * media: staging/imx: Fix inconsistent long line breaksLucas Leonardo Ciancaglini2019-03-291-8/+9
| | | | | | | | | | | | | | | | | | Small readability changes to make the breaking of some lines cleaner. Signed-off-by: Lucas Leonardo Ciancaglini <leociancalucas@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
| * media: Kconfig files: use the right help coding styleMauro Carvalho Chehab2019-03-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | Checkpatch wants to use 'help' instead of '---help---': WARNING: prefer 'help' over '---help---' for new help texts Let's change it globally at the media subsystem, as otherwise people would keep using the old way. Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
| * media: imx: vdic: Fix wrong CSI group IDSteve Longerbeam2019-03-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | The i.MX7 capture support forgot to change the group ID for the CSI to the IPU CSI in VDIC sub-device, it was left at the i.MX7 CSI group ID. Fixes: 67673ed55084 ("media: staging/imx: rearrange group id to take in account IPU") Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
| * media: imx7-media-csi: don't store a floating pointerRui Miguel Silva2019-03-191-1/+3
| | | | | | | | | | | | | | | | | | | | | | if imx7_csi_try_fmt() fails, cc variable won't be initialized and csi->cc[sdformat->pad] would be pointing to a random location. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
| * media: staging/imx7: Fix an error code in mipi_csis_clk_get()Dan Carpenter2019-03-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | We accidentally return IS_ERR(), which is 1, instead of the PTR_ERR() which is the negative error code. Fixes: 7807063b862b ("media: staging/imx7: add MIPI CSI-2 receiver subdev for i.MX7") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
| * media: imx: Don't register IPU subdevs/links if CSI port missingSteve Longerbeam2019-03-195-46/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The second IPU internal sub-devices were being registered and links to them created even when the second IPU is not present. This is wrong for i.MX6 S/DL and i.MX53 which have only a single IPU. Fixes: e130291212df5 ("[media] media: Add i.MX media core driver") Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Cc: stable@vger.kernel.org Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
| * media: imx: Rename functions that add IPU-internal subdevsSteve Longerbeam2019-03-195-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | For the functions that add and remove the internal IPU subdevice descriptors, rename them to make clear they are the subdevs internal to the IPU. Also rename the platform data structure for the internal IPU subdevices. No functional changes. Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com> Acked-by: Philipp Zabel <p.zabel@pengutronix.de> Cc: stable@vger.kernel.org Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
| * media: imx: Clear fwnode link struct for each endpoint iterationSteve Longerbeam2019-03-191-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In imx_media_create_csi_of_links(), the 'struct v4l2_fwnode_link' must be cleared for each endpoint iteration, otherwise if the remote port has no "reg" property, link.remote_port will not be reset to zero. This was discovered on the i.MX53 SMD board, since the OV5642 connects directly to ipu1_csi0 and has a single source port with no "reg" property. Fixes: 621b08eabcddb ("media: staging/imx: remove static media link arrays") Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com> Cc: stable@vger.kernel.org Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
| * media: imx: csi: Allow unknown nearest upstream entitiesSteve Longerbeam2019-03-191-4/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On i.MX6, the nearest upstream entity to the CSI can only be the CSI video muxes or the Synopsys DW MIPI CSI-2 receiver. However the i.MX53 has no CSI video muxes or a MIPI CSI-2 receiver. So allow for the nearest upstream entity to the CSI to be something other than those. Fixes: bf3cfaa712e5c ("media: staging/imx: get CSI bus type from nearest upstream entity") Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com> Cc: stable@vger.kernel.org Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
| * media: imx7: fix smatch errorHans Verkuil2019-03-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Fixes this smatch error: drivers/staging/media/imx/imx7-mipi-csis.c:716 mipi_csis_set_fmt() error: we previously assumed 'fmt' could be null (see line 709) fmt is never NULL, so remove the 'fmt &&' condition. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
| * media: imx: vdic: Restore default case to prepare_vdi_in_buffers()Steve Longerbeam2019-03-191-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Restore a default case to prepare_vdi_in_buffers() to fix the following smatch errors: drivers/staging/media/imx/imx-media-vdic.c:236 prepare_vdi_in_buffers() error: uninitialized symbol 'prev_phys'. drivers/staging/media/imx/imx-media-vdic.c:237 prepare_vdi_in_buffers() error: uninitialized symbol 'curr_phys'. drivers/staging/media/imx/imx-media-vdic.c:238 prepare_vdi_in_buffers() error: uninitialized symbol 'next_phys'. Fixes: 6e537b58de772 ("media: imx: vdic: rely on VDIC for correct field order") Reported-by: Hans Verkuil <hverkuil@xs4all.nl> 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>
* | staging: media: imx: add proper SPDX identifiers on files that did not have ↵Greg Kroah-Hartman2019-04-0314-70/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | staging: add missing SPDX lines to Kconfig filesGreg Kroah-Hartman2019-04-031-0/+1
| | | | | | | | | | | | | | | | There are a few remaining drivers/staging/*/Kconfig files that do not have SPDX identifiers in them. Add the correct GPL-2.0 identifier to them to make scanning tools happy. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | staging: media: imx: Replace list_entry with list_for_each_entry_safeSanjana Sanikommu2019-04-011-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Challenge suggested by coccinelle. Replace use of the combination of list_empty() and list_entry() with list_for_each_entry_safe() to simplify the code. Issue found using below Coccinelle script. @@ expression E1; identifier I1, I2; type T; iterator name list_for_each_entry_safe; @@ T *I1; + T *tmp; ... - while (list_empty(&E1) == 0) + list_for_each_entry_safe (I1, tmp, &E1, I2) { ...when != T *I1; - I1 = list_entry(E1.next, T, I2); ... } Signed-off-by: Sanjana Sanikommu <sanjana99reddy99@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | Staging: media: imx: mipi-csi2: Remove unnecessary error messagesBhanusree Pola2019-03-261-3/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The function devm_ioremap already prints error message when there is no enough memory. Remove print statements that give error messages Issue found using coccinelle The following semantic patch is used to solve this: <smpl> @@ expression x; constant char[] C; identifier f; @@ x = (\(kmalloc\|devm_kzalloc\|kmalloc_array\|devm_ioremap\| usb_alloc_urb\|alloc_netdev\|dev_alloc_skb\)(...)); if(x==NULL) { ... ( -f(C,...); | -f(...,C); ) ... } </smpl> Signed-off-by: Bhanusree Pola <bhanusreemahesh@gmail.com> Reviewed-by: Fabio Estevam <festevam@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>