summaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/omap3isp
Commit message (Collapse)AuthorAgeFilesLines
* media: omap3isp: fix uninitialized variable useArnd Bergmann2017-08-271-1/+1
| | | | | | | | | | | | | | | | | | | | A debug printk statement was copied incorrectly into the new csi1 parser code and causes a warning there: drivers/media/platform/omap3isp/isp.c: In function 'isp_probe': include/linux/dynamic_debug.h:134:3: error: 'i' may be used uninitialized in this function [-Werror=maybe-uninitialized] Since there is only one lane, the index is never set. This changes the debug print to always print a zero instead, keeping the original format of the message. Fixes: 9211434bad30 ("media: omap3isp: Parse CSI1 configuration from the device tree") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: Convert to using %pOF instead of full_nameRob Herring2017-08-201-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that we have a custom printf format specifier, convert users of full_name to use %pOF instead. This is preparation to remove storing of the full path string for each node. Signed-off-by: Rob Herring <robh@kernel.org> Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com> Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Cc: Kyungmin Park <kyungmin.park@samsung.com> Cc: Andrzej Hajda <a.hajda@samsung.com> Cc: Mauro Carvalho Chehab <mchehab@kernel.org> Cc: Songjun Wu <songjun.wu@microchip.com> Cc: Kukjin Kim <kgene@kernel.org> Cc: Krzysztof Kozlowski <krzk@kernel.org> Cc: Javier Martinez Canillas <javier@osg.samsung.com> Cc: Minghsiu Tsai <minghsiu.tsai@mediatek.com> Cc: Houlong Wei <houlong.wei@mediatek.com> Cc: Andrew-CT Chen <andrew-ct.chen@mediatek.com> Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Cc: Hyun Kwon <hyun.kwon@xilinx.com> Cc: Michal Simek <michal.simek@xilinx.com> Cc: "Sören Brinkmann" <soren.brinkmann@xilinx.com> Cc: linux-arm-kernel@lists.infradead.org Cc: linux-samsung-soc@vger.kernel.org Cc: linux-mediatek@lists.infradead.org Cc: linux-renesas-soc@vger.kernel.org Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: omap3isp: Quit using struct v4l2_subdev.host_priv fieldSakari Ailus2017-08-206-37/+25Star
| | | | | | | | | | | | | | | struct v4l2_subdev.host_priv is intended to be used by another driver. This is hardly good design but back in the days of platform data was a quick hack to get things done. As the sub-device specific bus information can be stored to the ISP driver specific struct allocated along with v4l2_async_subdev, keep the information there and only there. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: omap3isp: csiphy: Don't assume the CSI receiver is a CSI2 moduleSakari Ailus2017-08-204-30/+27Star
| | | | | | | | | | | | | | | | | The CSI PHY is associated with a CSI receiver. The code assumes this receiver is a CSI2 module and relies on the CSI2 module object heavily to access the ISP or pipeline objects. However, the receiver could also be a CSI1/CCP2 module. Pass a new CSI receiver entity pointer to the CSI PHY acquire function, and replace all hardcoded usage of the CSI2 module with that CSI receiver entity. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> # on Beagleboard-xM + MPT9P031 Acked-by: Pavel Machek <pavel@ucw.cz> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: omap3isp: Always initialise isp and mutex for csiphy1Sakari Ailus2017-08-201-2/+3
| | | | | | | | The PHY is still relevant for CCP2. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> # on Beagleboard-xM + MPT9P031 Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: omap3isp: Correctly set IO_OUT_SEL and VP_CLK_POL for CCP2 modePavel Machek2017-08-202-2/+9
| | | | | | | | | | ISP CSI1 module needs all the bits correctly set to work. Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> Signed-off-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> # on Beagleboard-xM + MPT9P031 Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: omap3isp: Parse CSI1 configuration from the device treePavel Machek2017-08-202-27/+79
| | | | | | | | | | | Add support for parsing CSI1 configuration. Signed-off-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> # on Beagleboard-xM + MPT9P031 Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: v4l: omap3isp: Get the parallel bus type from DTLaurent Pinchart2017-07-263-7/+4Star
| | | | | | | | | | | | The OMAP3 ISP supports both external and embedded BT.656 synchronization for parallel buses. It currently gets the bus type information from the source subdev through the .g_mbus_config() operation, but should instead get it from DT as that's the authoritative source of bus configuration information. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: omap3isp: Ignore endpoints with invalid configurationSakari Ailus2017-07-191-3/+5
| | | | | | | | | | | If endpoint has an invalid configuration, ignore it instead of happily proceeding to use it nonetheless. Ignoring such an endpoint is better than failing since there could be multiple endpoints, only some of which are bad. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Tested-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: omap3isp: Return -EPROBE_DEFER if the required regulators can't be ↵Pavel Machek2017-07-192-1/+7
| | | | | | | | | | | | obtained If regulator returns -EPROBE_DEFER, we need to return it too, so that omap3isp will be re-probed when regulator is ready. Signed-off-by: Pavel Machek <pavel@ucw.cz> 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@s-opensource.com>
* media: omap3isp: add CSI1 supportPavel Machek2017-07-192-7/+13
| | | | | | | | | | | CSI-2 PHY power management is only needed for major version 15 of the ISP. Additionally, set the CCP2 PHY for previous ISP versions as well. These changes are necessary for CCP2 support. Signed-off-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: omap3isp: Explicitly set the number of CSI-2 lanes used in lane cfgSakari Ailus2017-07-193-6/+18
| | | | | | | | | | The omap3isp driver extracts the CSI-2 lane configuration from the V4L2 fwnode endpoint but misses the number of lanes itself. Get this information and use it in PHY configuration. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Tested-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: omap3isp: Destroy CSI-2 phy mutexes in error and module removalSakari Ailus2017-07-193-2/+11
| | | | | | | | | | The CSI-2 phy driver did initialise mutexes in its init function but there was no corresponding cleanup function destroying them. Fix that. Also clean up ISP module initialisation a little. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Tested-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: omap3isp: Check for valid port in endpointsSakari Ailus2017-07-191-1/+1
| | | | | | | | | Check that we do have a valid port in an endpoint, return an error if not. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> Tested-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] v4l: Switch from V4L2 OF not V4L2 fwnode APISakari Ailus2017-06-061-23/+26
| | | | | | | | | | | | Switch users of the v4l2_of_ APIs to the more generic v4l2_fwnode_ APIs. Async OF matching is replaced by fwnode matching and OF matching support is removed. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Acked-by: Benoit Parrot <bparrot@ti.com> # i2c/ov2569.c, am437x/am437x-vpfe.c and ti-vpe/cal.c Tested-by: Hans Verkuil <hans.verkuil@cisco.com> # Atmel sama5d3 board + ov2640 sensor Tested-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* omap3isp: Remove iommu_group related codeSuman Anna2017-04-202-18/+0Star
| | | | | | | | | | | The OMAP IOMMU driver has added the support for IOMMU groups internally, and the ISP device is automatically linked to the appropriate IOMMU group. So, remove the explicit function calls that creates/deletes an iommu_group and adds the ISP device to this group. Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Suman Anna <s-anna@ti.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
* [media] v4l: omap3isp: Clean up file handle in open() and release()Shailendra Verma2017-01-311-0/+2
| | | | | | | | | Both functions initialize the file handle with v4l2_fh_init() and thus need to call clean up with v4l2_fh_exit() as appropriate. Fix it. Signed-off-by: Shailendra Verma <shailendra.v@samsung.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] omap3isp: Use a local media device pointer insteadSakari Ailus2017-01-301-1/+1
| | | | | | | | | The function has a local variable that points to the media device; use that instead of finding the media device under the entity. 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@s-opensource.com>
* [media] media: Rename graph and pipeline structs and functionsSakari Ailus2017-01-271-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The media_entity_pipeline_start() and media_entity_pipeline_stop() functions are renamed as media_pipeline_start() and media_pipeline_stop(), respectively. The reason is two-fold: the pipeline struct is, rightly, already called media_pipeline (rather than media_entity_pipeline) and what this really is about is a pipeline. A pipeline consists of entities --- and, well, other objects embedded in these entities. As the pipeline object will be in the future moved from entities to pads in order to support multiple pipelines through a single entity, do the renaming now. Similarly, functions operating on struct media_entity_graph as well as the struct itself are renamed by dropping the "entity_" part from the prefix of the function family and the data structure. The graph traversal which is what the functions are about is not specifically about entities only and will operate on pads for the same reason as the media pipeline. The patch has been generated using the following command: git grep -l media_entity |xargs perl -i -pe ' s/media_entity_pipeline/media_pipeline/g; s/media_entity_graph/media_graph/g' And a few manual edits related to line start alignment and line wrapping. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] v4l: omap3isp: Use dma_request_chan_by_mask() to request the DMA channelPeter Ujfalusi2016-11-161-13/+15
| | | | | | | | | | | | | | | When requesting the DMA channel it was mandatory that we do not have DMA resource nor valid DMA channel via DT. In this case the dma_request_slave_channel_compat() would fall back and request any channel with SW trigger. The same can be achieved with the dma_request_chan_by_mask() without the misleading use of the DMAengine API - implying that the omap3isp does need to have DMA resource or valid dma binding in DT. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] v4l: omap3isp: Fix OF node double put when parsing OF graphLaurent Pinchart2016-11-161-10/+9Star
| | | | | | | | | | | | | | When parsing the graph the driver loops over all endpoints using of_graph_get_next_endpoint(). The function handles reference counting of the passed and returned nodes, so the returned node's reference count must not be decreased manually in the normal path. Move the offending of_node_put() call to the error path that requires manual reference count handling. Reported-by: H. Nikolaus Schaller <hns@goldelico.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] omap3isp: don't break long linesMauro Carvalho Chehab2016-10-217-50/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Due to the 80-cols restrictions, and latter due to checkpatch warnings, several strings were broken into multiple lines. This is not considered a good practice anymore, as it makes harder to grep for strings at the source code. As we're right now fixing other drivers due to KERN_CONT, we need to be able to identify what printk strings don't end with a "\n". It is a way easier to detect those if we don't break long lines. So, join those continuation lines. The patch was generated via the script below, and manually adjusted if needed. </script> use Text::Tabs; while (<>) { if ($next ne "") { $c=$_; if ($c =~ /^\s+\"(.*)/) { $c2=$1; $next =~ s/\"\n$//; $n = expand($next); $funpos = index($n, '('); $pos = index($c2, '",'); if ($funpos && $pos > 0) { $s1 = substr $c2, 0, $pos + 2; $s2 = ' ' x ($funpos + 1) . substr $c2, $pos + 2; $s2 =~ s/^\s+//; $s2 = ' ' x ($funpos + 1) . $s2 if ($s2 ne ""); print unexpand("$next$s1\n"); print unexpand("$s2\n") if ($s2 ne ""); } else { print "$next$c2\n"; } $next=""; next; } else { print $next; } $next=""; } else { if (m/\"$/) { if (!m/\\n\"$/) { $next=$_; next; } } } print $_; } </script> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media: Move media_device link_notify operation to an ops structureLaurent Pinchart2016-09-091-1/+5
| | | | | | | | | | | This will allow adding new operations without increasing the media_device structure size for drivers that don't implement any media device operation. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] v4l2: remove g/s_crop from video opsHans Verkuil2016-08-241-31/+57
| | | | | | | | | | | | | | Replace all calls to g/s_crop by calls to the get/set_selection pad ops. Remove the old g/s_crop video ops since they are now no longer used. The cropcap video op is now only used to pass pixelaspect information, and is only needed if the pixelaspect is not 1:1. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] vb2: replace void *alloc_ctxs by struct device *alloc_devsHans Verkuil2016-07-081-1/+1
| | | | | | | | | | | | | | | | Make this a proper typed array. Drop the old allocate context code since that is no longer used. Note that the memops functions now get a struct device pointer instead of the struct device ** that was there initially (actually a void pointer to a struct containing only a struct device pointer). This code is now a lot cleaner. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Cc: Sakari Ailus <sakari.ailus@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media/platform: convert drivers to use the new vb2_queue dev fieldHans Verkuil2016-07-082-11/+2Star
| | | | | | | | | | | Stop using alloc_ctx and just fill in the device pointer. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Cc: Mikhail Ulyanov <mikhail.ulyanov@cogentembedded.com> Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Cc: Jonathan Corbet <corbet@lwn.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media: Rename is_media_entity_v4l2_io to ↵Laurent Pinchart2016-04-131-1/+1
| | | | | | | | | | | | | | | | | | | | is_media_entity_v4l2_video_device All users of is_media_entity_v4l2_io() (the exynos4-is, omap3isp, davince_vpfe and omap4iss drivers and the v4l2-mc power management code) use the function to check whether entities are video_device instances, either to ensure they can cast the entity to a struct video_device, or to count the number of video nodes users. The purpose of the function is thus to identify whether the media entity instance is an instance of the video_device object, not to check whether it can perform I/O. Rename it accordingly, we will introduce a more specific is_media_entity_v4l2_io() check when needed. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] v4l: omap3isp: Use V4L2 graph PM operationsSakari Ailus2016-03-034-225/+6Star
| | | | | | | | | | Power on devices represented by entities in the graph through the pipeline state using V4L2 graph PM operations instead of what was in the omap3isp driver. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] omap3isp: Check v4l2_of_parse_endpoint() return valueJavier Martinez Canillas2016-02-011-1/+4
| | | | | | | | | The v4l2_of_parse_endpoint() function can fail so check the return value. Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] v4l: omap3isp: Fix data lane shift configurationLaurent Pinchart2016-01-253-6/+6
| | | | | | | | | | The data-shift DT property speficies the number of bits to be shifted, but the driver still interprets the value as a multiple of two bits as used by now removed platform data support. Fix it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] v4l: omap3isp: preview: Mark output buffer done firstSakari Ailus2016-01-251-7/+7
| | | | | | | | | | | | | | The sequence number counter is incremented on each output buffer, and that incremented value is used as the sequence number of that buffer. The input buffer sequence numbering is based just on reading the same counter. If the input buffer is marked done first, its sequence number ends up being that of the output buffer - 1. This is how the resizer works as well. Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] v4l: omap3isp: Fix handling platform_get_irq resultAndrzej Hajda2016-01-251-2/+3
| | | | | | | | | | | | | The function can return negative value. The problem has been detected using proposed semantic patch scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1]. [1]: http://permalink.gmane.org/gmane.linux.kernel/2046107 Signed-off-by: Andrzej Hajda <a.hajda@samsung.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] v4l: omap3isp: use vb2_buffer_state enum for vb2 buffer stateLad, Prabhakar2016-01-251-4/+6
| | | | | | | | | | | | | | use the vb2_buffer_state enum for assigning the state of the vb2 buffer, along side making isp_pipeline_state state variable local to the block. This fixes the following sparse warning as well: drivers/media/platform/omap3isp/ispvideo.c:497:35: warning: mixing different enum types drivers/media/platform/omap3isp/ispvideo.c:497:35: int enum isp_pipeline_state versus drivers/media/platform/omap3isp/ispvideo.c:497:35: int enum vb2_buffer_state Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] v4l: omap3isp: Return buffers back to videobuf2 if pipeline streamon ↵Sakari Ailus2016-01-251-14/+32
| | | | | | | | | | | fails When the video buffer queue was stopped before the stream source was started in omap3isp_streamon(), the buffers were not returned back to videobuf2. Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] v4l: omap3isp: Move starting the sensor from streamon IOCTL handler ↵Sakari Ailus2016-01-251-19/+30
| | | | | | | | | | | | to VB2 QOP Move the starting of the sensor from the VIDIOC_STREAMON handler to the videobuf2 queue op start_streaming. This avoids failing starting the stream after vb2_streamon() has already finished. Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] v4l: omap3isp: Fix module autoloadingJavier Martinez Canillas2016-01-251-0/+1
| | | | | | | | | | Platform drivers needs to export the OF id table and this be built into the module or udev will not have the necessary information to autoload the driver module when the device is registered via OF. Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] v4l: omap3isp: Use media entity enumeration interfaceSakari Ailus2016-01-115-19/+33
| | | | | | | | Instead of using a bitmap directly in a driver, use the new media entity enumeration interface to perform the same. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] v4l: omap3isp: Use the new media graph walk interfaceSakari Ailus2016-01-114-27/+61
| | | | | | | | The media graph walk requires initialisation and cleanup soon. Update the users to perform the soon necessary API calls. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] media-device: split media initialization and registrationJavier Martinez Canillas2016-01-111-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | The media device node is registered and so made visible to user-space before entities are registered and links created which means that the media graph obtained by user-space could be only partially enumerated if that happens too early before all the graph has been created. To avoid this race condition, split the media init and registration in separate functions and only register the media device node when all the pending subdevices have been registered, either explicitly by the driver or asynchronously using v4l2_async_register_subdev(). The media_device_register() had a check for drivers not filling dev and model fields but all drivers in mainline set them and not doing it will be a driver bug so change the function return to void and add a BUG_ON() for dev being NULL instead. Also, add a media_device_cleanup() function that will destroy the graph_mutex that is initialized in media_device_init(). [mchehab@osg.samsung.com: Fix compilation if !CONFIG_MEDIA_CONTROLLER and remove two warnings added by this changeset] Suggested-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] omap3isp: consistently use v4l2_dev var in complete notifierJavier Martinez Canillas2016-01-111-1/+1
| | | | | | | | | | | | | The isp_subdev_notifier_complete() complete callback defines a struct v4l2_device *v4l2_dev to avoid needing two level of indirections to access the V4L2 subdevs but the var is not always used when possible as when calling v4l2_device_register_subdev_nodes(). So change that to consistently use the defined v4l2_dev pointer var. Suggested-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] omap3isp: rename single labels to just errorJavier Martinez Canillas2016-01-112-4/+4
| | | | | | | | | | | | | Commit bc36b30fe06b ("[media] omap3isp: separate links creation from entities init") moved the link creation logic from the entities init functions and so removed the error_link labels from the error paths. But after that, some functions have a single error label so it makes more sense to rename the label to just "error" in thi case. Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] omap3isp: remove pads prefix from isp_create_pads_links()Javier Martinez Canillas2016-01-111-4/+8
| | | | | | | | | | | | | | The function that creates the links between ISP internal and external entities is called isp_create_pads_links() but the "pads" prefix is redundant since the driver doesn't handle any other kind of link so it can just be removed. While being there, fix the function's kernel-doc since is not using a proper format. Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] omap3isp: remove per ISP module link creation functionsJavier Martinez Canillas2016-01-1111-108/+35Star
| | | | | | | | | | | | | | | The entities to video nodes links were created on separate functions for each ISP module but since the only thing that these functions do is to call media_create_pad_link(), there's no need for that indirection level and all link creation logic can be just inlined in the caller function. Also, since the only possible failure for the link creation is a memory allocation, there is no need for error messages since the core already reports a very verbose message in that case. Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] media: use unsigned for pad indexMauro Carvalho Chehab2016-01-115-5/+5
| | | | | | | | The pad index is unsigned. Replace the occurences of it where pertinent. Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] media framework: rename pads init function to media_entity_pads_init()Mauro Carvalho Chehab2016-01-117-7/+7
| | | | | | | | | | | | | | | | | With the MC next gen rework, what's left for media_entity_init() is to just initialize the PADs. However, certain devices, like a FLASH led/light doesn't have any input or output PAD. So, there's no reason why calling media_entity_init() would be mandatory. Also, despite its name, what this function actually does is to initialize the PADs data. So, rename it to media_entity_pads_init() in order to reflect that. The media entity actual init happens during entity register, at media_device_register_entity(). We should move init of num_links and num_backlinks to it. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] omap3/omap4/davinci: get rid of MEDIA_ENT_T_V4L2_SUBDEV abuseMauro Carvalho Chehab2016-01-115-21/+46
| | | | | | | | | | | | | | On omap3/omap4/davinci drivers, MEDIA_ENT_T_V4L2_SUBDEV macro is abused in order to "simplify" the pad checks. Basically, it does a logical or of this macro, in order to check for a local index and if the entity is either a subdev or not. As we'll get rid of MEDIA_ENT_T_V4L2_SUBDEV macro, replace it by 2 << 16 where it occurs, and add a note saying that the code there is actually a hack. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] media: use macros to check for V4L2 subdev entitiesMauro Carvalho Chehab2016-01-112-12/+9Star
| | | | | | | | | | | | | | | | | | Instead of relying on media subtype, use the new macros to detect if an entity is a subdev or an A/V DMA entity. Please note that most drivers assume that there's just AV_DMA or V4L2 subdevs. This is not true anymore, as we've added MC support for DVB, and there are plans to add support for ALSA and FB/DRM too. Ok, on the current pipelines supported by those drivers, just V4L stuff are there, but, assuming that some day a pipeline that also works with other subsystems will ever added, it is better to add explicit checks for the AV_DMA stuff. Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] omap3isp: create links after all subdevs have been boundJavier Martinez Canillas2016-01-111-8/+15
| | | | | | | | | | | | | | | | | | The omap3isp driver parses the graph endpoints to know how many subdevices needs to be registered async and register notifiers callbacks for to know when these are bound and when the async registrations are completed. Currently the entities pad are linked with the correct ISP input interface when the subdevs are bound but it happens before entitities are registered with the media device so that won't work now that the entity links list is initialized on device registration. So instead creating the pad links when the subdevice is bound, create them on the complete callback once all the subdevices have been bound but only try to create for the ones that have a bus configuration set during bound. Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] omap3isp: separate links creation from entities initJavier Martinez Canillas2016-01-1111-104/+185
| | | | | | | | | | | | | | The omap3isp driver initializes the entities and creates the pads links before the entities are registered with the media device. This does not work now that object IDs are used to create links so the media_device has to be set. Split out the pads links creation from the entity initialization so the links are created after the entities have been registered with the media device. Suggested-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] media: use entity.graph_obj.mdev instead of .parentJavier Martinez Canillas2016-01-112-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The struct media_entity has a .parent field that stores a pointer to the parent struct media_device. But recently a media_gobj was embedded into the entities and since struct media_gojb already has a pointer to a struct media_device in the .mdev field, the .parent field becomes redundant and can be removed. This patch replaces all the usage of .parent by .graph_obj.mdev so that field will become unused and can be removed on a later patch. No functional changes. The transformation was made using the following coccinelle spatch: @@ struct media_entity *me; @@ - me->parent + me->graph_obj.mdev @@ struct media_entity *link; @@ - link->source->entity->parent + link->source->entity->graph_obj.mdev @@ struct exynos_video_entity *ve; @@ - ve->vdev.entity.parent + ve->vdev.entity.graph_obj.mdev Suggested-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>