summaryrefslogtreecommitdiff
path: root/drivers/media/platform/rcar-vin
AgeCommit message (Collapse)Author
2017-12-29media: v4l2-async: simplify v4l2_async_subdev structureMauro Carvalho Chehab
The V4L2_ASYNC_MATCH_FWNODE match criteria requires just one struct to be filled (struct fwnode_handle). The V4L2_ASYNC_MATCH_DEVNAME match criteria requires just a device name. So, it doesn't make sense to enclose those into structs, as the criteria can go directly into the union. That makes easier to document it, as we don't need to document weird senseless structs. At drivers, this makes even clearer about the match criteria. Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Acked-by: Benoit Parrot <bparrot@ti.com> Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Acked-by: Philipp Zabel <p.zabel@pengutronix.de> Acked-by: Hyun Kwon <hyun.kwon@xilinx.com> Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-10-31media: v4l: async: Move async subdev notifier operations to a separate structureLaurent Pinchart
The async subdev notifier .bound(), .unbind() and .complete() operations are function pointers stored directly in the v4l2_async_subdev structure. As the structure isn't immutable, this creates a potential security risk as the function pointers are mutable. To fix this, move the function pointers to a new v4l2_async_subdev_operations structure that can be made const in drivers. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-10-31media: rcar-vin: Use generic parser for parsing fwnode endpointsSakari Ailus
Instead of using a custom driver implementation, use v4l2_async_notifier_parse_fwnode_endpoints() to parse the fwnode endpoints of the device. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-20media: Convert to using %pOF instead of full_nameRob Herring
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>
2017-06-06[media] rcar-vin: fix bug in pixelformat selectionNiklas Söderlund
If the requested pixelformat is not supported fallback to the default format, do not revert the entire format. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-06-06[media] rcar-vin: add missing error check to propagate errorNiklas Söderlund
The return value of __rvin_try_format_source is not checked, add a check and propagate the error. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-06-06[media] rcar-vin: remove subdevice matching from bind and unbind callbacksNiklas Söderlund
There is only one subdevice registered with the async framework so there is no need for the driver to check which subdevice is bound or unbound. Remove these checks since the async framework preforms this. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> [hans.verkuil@cisco.com: fix typo: surce -> source] Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-06-06[media] rcar-vin: refactor and fold in function after stall handling reworkNiklas Söderlund
With the driver stopping and starting the stream each time the driver is stalled rvin_capture_off() can be folded in to the only caller. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-06-06[media] rcar-vin: allow switch between capturing modes when stallingNiklas Söderlund
If userspace can't feed the driver with buffers as fast as the driver consumes them the driver will stop video capturing and wait for more buffers from userspace, the driver is stalled. Once it have been feed one or more free buffers it will recover from the stall and resume capturing. Instead of continue to capture using the same capture mode as before the stall allow the driver to choose between single and continuous mode based on free buffer availability. Do this by stopping capturing when the driver becomes stalled and restart capturing once it continues. By doing this the capture mode will be evaluated each time the driver is recovering from a stall. This behavior is needed to fix a bug where continuous capturing mode is used, userspace is about to stop the stream and is waiting for the last buffers to be returned from the driver and is not queuing any new buffers. In this case the driver becomes stalled when there are only 3 buffers remaining streaming will never resume since the driver is waiting for userspace to feed it more buffers before it can continue streaming. With this fix the driver will then switch to single capture mode for the last 3 buffers and a deadlock is avoided. The issue can be demonstrated using yavta. $ yavta -f RGB565 -s 640x480 -n 4 --capture=10 /dev/video22 Device /dev/video22 opened. Device `R_Car_VIN' on `platform:e6ef1000.video' (driver 'rcar_vin') supports video, capture, without mplanes. Video format set: RGB565 (50424752) 640x480 (stride 1280) field interlaced buffer size 614400 Video format: RGB565 (50424752) 640x480 (stride 1280) field interlaced buffer size 614400 4 buffers requested. length: 614400 offset: 0 timestamp type/source: mono/EoF Buffer 0/0 mapped at address 0xb6cc7000. length: 614400 offset: 614400 timestamp type/source: mono/EoF Buffer 1/0 mapped at address 0xb6c31000. length: 614400 offset: 1228800 timestamp type/source: mono/EoF Buffer 2/0 mapped at address 0xb6b9b000. length: 614400 offset: 1843200 timestamp type/source: mono/EoF Buffer 3/0 mapped at address 0xb6b05000. 0 (0) [-] interlaced 0 614400 B 38.240285 38.240303 12.421 fps ts mono/EoF 1 (1) [-] interlaced 1 614400 B 38.282329 38.282346 23.785 fps ts mono/EoF 2 (2) [-] interlaced 2 614400 B 38.322324 38.322338 25.003 fps ts mono/EoF 3 (3) [-] interlaced 3 614400 B 38.362318 38.362333 25.004 fps ts mono/EoF 4 (0) [-] interlaced 4 614400 B 38.402313 38.402328 25.003 fps ts mono/EoF 5 (1) [-] interlaced 5 614400 B 38.442307 38.442321 25.004 fps ts mono/EoF 6 (2) [-] interlaced 6 614400 B 38.482301 38.482316 25.004 fps ts mono/EoF 7 (3) [-] interlaced 7 614400 B 38.522295 38.522312 25.004 fps ts mono/EoF 8 (0) [-] interlaced 8 614400 B 38.562290 38.562306 25.003 fps ts mono/EoF <blocks forever, waiting for the last buffer> This fix also allow the driver to switch to single capture mode if userspace doesn't feed it buffers fast enough. Or the other way around, if userspace suddenly feeds the driver buffers faster it can switch to continues capturing mode. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-06-06[media] rcar-vin: select capture mode based on free buffersNiklas Söderlund
Instead of selecting single or continuous capture mode based on how many buffers userspace intends to give us select capture mode based on number of free buffers we can allocate to hardware when the stream is started. This change is a prerequisite to enable the driver to switch from continuous to single capture mode (or the other way around) when the driver is stalled by userspace not feeding it buffers as fast as it consumes it. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-06-06[media] rcar-vin: move functions which acts on hardwareNiklas Söderlund
This only moves whole structs, defines and functions around, no code is changed inside any function. The reason for moving this code around is to prepare for refactoring and fixing of a start/stop stream bug without having to use forward declarations. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-06-06[media] rcar-vin: decrease buffers needed to captureNiklas Söderlund
It's possible to grab frames using only one buffer, this should never have been set to anything else then 1. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-06-06[media] rcar-vin: use pad information when verifying media bus formatNiklas Söderlund
Use information about pad index when enumerating mbus codes. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-06-06[media] rcar-vin: move pad lookup to async bound handlerNiklas Söderlund
Information about pads will be needed when enumerating the media bus codes in the async complete handler which is run before rvin_v4l2_probe(). Move the pad lookup to the async bound handler so they are available when needed. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> [hans.verkuil@cisco.com: fix typo: surce -> source] Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-06-06[media] rcar-vin: refactor pad lookup codeNiklas Söderlund
The pad lookup code can be broken out to increase readability and to reduce code duplication. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-06-06[media] rcar-vin: move subdev source and sink pad index to rvin_graph_entityNiklas Söderlund
It makes more sense to store the sink and source pads in struct rvin_graph_entity since that contains other subdevice related information. The data type to store pad information in is unsigned int and not int, change this. While we are at it drop the _idx suffix from the names, this never made sense. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-06-06[media] rcar-vin: fix standard in input enumerationNiklas Söderlund
The driver supports a single input only, which can be either analog or digital. If the subdevice supports dv_timings_cap the input is digital and the driver should not fill in the standard. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-06-06[media] rcar-vin: fix how pads are handled for v4l2 subdevice operationsNiklas Söderlund
The rcar-vin driver only uses one pad, pad number 0. - All v4l2 operations that did not check that the requested operation was for pad 0 have been updated with a check to enforce this. - All v4l2 operations that stored (and later restored) the requested pad before substituting it for the subdevice pad number have been updated to not store the incoming pad and simply restore it to 0 after the subdevice operation is complete. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-06-06[media] rcar-vin: use rvin_reset_format() in S_DV_TIMINGSNiklas Söderlund
Use rvin_reset_format() in rvin_s_dv_timings() instead of just resetting a few fields. This fixes an issue where the field format was not properly set after S_DV_TIMINGS. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-06-06[media] rcar-vin: reset bytesperline and sizeimage when resetting formatNiklas Söderlund
These two were forgotten when refactoring the format reset code. If they are not also reset at the same time as width and height the format returned from G_FMT will not match reality. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-06-06[media] v4l: Switch from V4L2 OF not V4L2 fwnode APISakari Ailus
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>
2016-09-22[media] rcar-vin: add R-Car gen2 fallback compatibility stringSergei Shtylyov
Such fallback string is present in the 'soc_camera' version of the R-Car VIN driver, so need to add it here as well... Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-09-19[media] media: rcar-vin: use sink pad index for DV timingsUlrich Hecht
Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-09-19[media] rcar-vin: implement EDID control ioctlsUlrich Hecht
Adds G_EDID and S_EDID. Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com> Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-09-19[media] media: rcar-vin: add support for V4L2_FIELD_ALTERNATENiklas Söderlund
The HW can capture both ODD and EVEN fields in separate buffers so it's possible to support V4L2_FIELD_ALTERNATE. This patch add support for this mode. At probe time and when S_STD is called the driver will default to use V4L2_FIELD_INTERLACED if the subdevice reports V4L2_FIELD_ALTERNATE. The driver will only change the field type if the subdevice implements G_STD, if not it will keep the default at V4L2_FIELD_ALTERNATE. The user can always explicitly ask for V4L2_FIELD_ALTERNATE in S_FMT and the driver will use that field format. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-09-19[media] media: rcar-vin: fix height for TOP and BOTTOM fieldsNiklas Söderlund
The height used for V4L2_FIELD_TOP and V4L2_FIELD_BOTTOM where wrong. The frames only contain one field so the height should be half of the frame. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-09-19[media] media: rcar-vin: fix bug in scalingNiklas Söderlund
It was not possible to scale beyond the image size of the video source limitation. The output frame would be bigger but the captured image was limited to the size of the video source. The error was that the crop boundary was set after the requested frame size and not the video source size. This patch breaks out the resetting of the crop, compose and format to separate functions so the error wont creep back. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-09-19[media] media: rcar-vin: allow field to be changedNiklas Söderlund
The driver forced whatever field was set by the source subdevice to be used. This patch allows the user to change from the default field. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-09-19[media] media: rcar-vin: make V4L2_FIELD_INTERLACED standard dependentNiklas Söderlund
The field V4L2_FIELD_INTERLACED is standard dependent and should not unconditionally be equivalent to V4L2_FIELD_INTERLACED_TB. This patch adds a check to see if the video standard can be obtained and if it's a 60 Hz format. If the condition is met V4L2_FIELD_INTERLACED is treated as V4L2_FIELD_INTERLACED_BT if not as V4L2_FIELD_INTERLACED_TB. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-09-19[media] adv7180: rcar-vin: change mbus format to UYVYNiklas Söderlund
The media bus format reported by the adv7180 is wrong. Steve Longerbeam posted a patch which changed the format to UYVY8_2X8 with the commit message: Change the media bus format from YUYV8_2X8 to UYVY8_2X8. Colors now look correct when capturing with the i.mx6 backend. The other option is to set the SWPC bit in register 0x27 to swap the Cr and Cb output samples. The rcar-vin driver was developed and tested with the adv7180 and therefor suffers from the same issue, looking for the wrong media bus format. The two errors corrected each other. This patch takes Steve's patch and merge it with a fix for rcar-vin driver. The rcar-vin driver is used used in together with the adv7180 och Koelsch and this ensures it will not break while fixing the adv7180 issue. I checked wit Steve and he was fine with me merging the patches. ADV7180 parts: Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Suggested-by: Steve Longerbeam <steve_longerbeam@mentor.com> Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Tested-by: Tim Harvey <tharvey@gateworks.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-09-19[media] platform: constify vb2_ops structuresJulia Lawall
Check for vb2_ops structures that are only stored in the ops field of a vb2_queue structure. That field is declared const, so vb2_ops structures that have this property can be declared as const also. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @r disable optional_qualifier@ identifier i; position p; @@ static struct vb2_ops i@p = { ... }; @ok@ identifier r.i; struct vb2_queue e; position p; @@ e.ops = &i@p; @bad@ position p != {r.p,ok.p}; identifier r.i; struct vb2_ops e; @@ e@i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct vb2_ops i = { ... }; // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Fabien Dessenne <fabien.dessenne@st.com> Reviewed-by: Jacek Anaszewski <j.anaszewski@samsung.com> Reviewed-by: Benoit Parrot <bparrot@ti.com> [hans.verkuil@cisco.com: dropped soc_camera/rcar_vin.c patch because that driver will be removed] Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-08-24[media] v4l2-subdev: rename cropcap to g_pixelaspectHans Verkuil
The old cropcap video op is now only used to pass the pixelaspect ratio, so rename it. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-08-23[media] rcar-vin: move media bus information to struct rvin_graph_entityNiklas Söderlund
The primary reason for this change is to prepare for Gen3 support where there will be more then one possible video source. Each source will have its own media bus format and code, so it needs to be moved from the per device structure to a structure used to represent an individual connection to a video source. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-08-23[media] rcar-vin: rework how subdevice is found and boundNiklas Söderlund
The original drivers code to find a subdevice by looking in the DT grpah and how the callbacks to the v4l2 async bind framework where poorly written. The most obvious example of badness was the duplication of data in the struct rvin_graph_entity. This patch removes the data duplication, simplifies the parsing of the DT graph and add checks to the v4l2 callbacks. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-08-23[media] rcar-vin: move chip check for pixelformat supportNiklas Söderlund
The check for if the specific pixelformat is supported on the current chip should happen in VIDIOC_S_FMT and VIDIOC_TRY_FMT and not when we try to setup the hardware for streaming. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-08-23[media] rcar-vin: add dependency on MEDIA_CONTROLLERNiklas Söderlund
This is done in preparation for Gen3 support where media controller support will be mandatory for the driver. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-08-23[media] rcar-vin: do not use v4l2_device_call_until_err()Niklas Söderlund
Fix a error from the original driver where v4l2_device_call_until_err() where used for the pad specific v4l2 operation set_fmt. Also fix up the error path from this fix so if there is an error it will be propagated to the caller. The error path label have also been renamed as a result from a nitpicking review comment since we are fixing other issues here. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-08-23[media] rcar-vin: return correct error from platform_get_irq()Niklas Söderlund
Fix a error from the original driver where the wrong error code is returned if the driver fails to get a IRQ number from platform_get_irq(). Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-08-23[media] rcar-vin: rename entity to digitalNiklas Söderlund
When Gen3 support is added to the driver more then one possible video source entity will be possible. Knowing that the name entity is a bad one, rename it to digital since it will deal with the digital input source. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-08-23[media] rcar-vin: arrange enum chip_id in chronological orderNiklas Söderlund
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-08-23[media] rcar-vin: reduce indentation in rvin_s_dv_timings()Niklas Söderlund
Align style with the rest of the driver. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-08-23[media] rcar-vin: fix indentation errors in rcar-v4l2.cNiklas Söderlund
Fix broken indentations and line breaks. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-07-08[media] vb2: replace void *alloc_ctxs by struct device *alloc_devsHans Verkuil
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>
2016-07-08[media] media/platform: convert drivers to use the new vb2_queue dev fieldHans Verkuil
Stop using alloc_ctx and just fill in the device pointer. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Cc: Scott Jiang <scott.jiang.linux@gmail.com> Acked-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-06-28[media] media: rcar-vin: add DV timings supportUlrich Hecht
Adds ioctls DV_TIMINGS_CAP, ENUM_DV_TIMINGS, G_DV_TIMINGS, S_DV_TIMINGS, and QUERY_DV_TIMINGS. Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-06-28[media] media: rcar_vin: Use correct pad number in try_fmtUlrich Hecht
Fix rcar_vin_try_fmt's use of an inappropriate pad number when calling the subdev set_fmt function - for the ADV7612, IDs should be non-zero. Signed-off-by: William Towle <william.towle@codethink.co.uk> Reviewed-by: Rob Taylor <rob.taylor@codethink.co.uk> [ulrich.hecht+renesas@gmail.com: adapted to rcar-vin rewrite] Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-06-28[media] media: rcar-vin: pad-aware driver initialisationUlrich Hecht
Add detection of source pad number for drivers aware of the media controller API, so that rcar-vin can create device nodes to support modern drivers such as adv7604.c (for HDMI on Lager) and the converted adv7180.c (for composite) underneath. Building rcar_vin gains a dependency on CONFIG_MEDIA_CONTROLLER, in line with requirements for building the drivers associated with it. Signed-off-by: William Towle <william.towle@codethink.co.uk> Signed-off-by: Rob Taylor <rob.taylor@codethink.co.uk> [ulrich.hecht+renesas@gmail.com: adapted to rcar-vin rewrite] Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-06-16[media] rcar-vin: get rid of an unused varMauro Carvalho Chehab
drivers/media/platform/rcar-vin/rcar-core.c: In function 'rvin_graph_notify_complete': drivers/media/platform/rcar-vin/rcar-core.c:65:22: warning: variable 'sd' set but not used [-Wunused-but-set-variable] struct v4l2_subdev *sd; ^ Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-06-16[media] rcar-vin: add Renesas R-Car VIN driverNiklas Söderlund
A V4L2 driver for Renesas R-Car VIN driver that do not depend on soc_camera. The driver is heavily based on its predecessor and aims to replace it. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>