summaryrefslogtreecommitdiffstats
path: root/drivers/media/platform
Commit message (Collapse)AuthorAgeFilesLines
* Replace <asm/uaccess.h> with <linux/uaccess.h> globallyLinus Torvalds2016-12-241-1/+1
| | | | | | | | | | | | | This was entirely automated, using the script by Al: PATT='^[[:blank:]]*#[[:blank:]]*include[[:blank:]]*<asm/uaccess.h>' sed -i -e "s!$PATT!#include <linux/uaccess.h>!" \ $(git grep -l "$PATT"|grep -v ^include/linux/uaccess.h) to do the replacement at the end of the merge window. Requested-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* [media] s5p-mfc: Add support for MFC v8 available in Exynos 5433 SoCsMarek Szyprowski2016-11-301-0/+14
| | | | | | | | | Exynos5433 SoC has MFC v8 hardware module, but it has more complex clock hierarchy, so a new compatible is added. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] s5p-mfc: Rework clock handlingMarek Szyprowski2016-11-303-59/+56
| | | | | | | | | | | This patch changes the code for handling clocks. Now clocks are defined per each device variant, what is a preparation for adding support for Exynos 5433 MFC V8, which has more clocks than all previous versions. Also use devm_clk_get() to simplify cleanup path. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] s5p-mfc: Don't keep clock prepared all the timeMarek Szyprowski2016-11-301-24/+28
| | | | | | | | | | | This patch moves preparation of clocks from s5p_mfc_init_pm() (driver probe) to s5p_mfc_power_on() (start of device operation). This change will allow to use runtime power usage optimization on newer Samsung Exynos platforms (for example Exynos 5433). Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] s5p-mfc: Kill all IS_ERR_OR_NULL in clocks management codeMarek Szyprowski2016-11-301-9/+4
| | | | | | | | | | | | After commit "s5p-mfc: Fix clock management in s5p_mfc_release function" all clocks related functions are called only when MFC device is really available, so there is no additional check needed for NULL gate clocks. This patch simplifies the code and kills IS_ERR_OR_NULL macro usage. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] s5p-mfc: Remove dead conditional codeMarek Szyprowski2016-11-303-48/+5
| | | | | | | | | CONFIG_PM is always enabled on Exynos platforms, so remove dead code related to early development of MFC driver on platform without PM support. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] s5p-mfc: Ensure that clock is disabled before turning power offMarek Szyprowski2016-11-301-2/+4
| | | | | | | | | | Move clock disabling before turning power off. This will enable later to add calls to clk_prepare/unprepare in the s5p_mfc_power_off() function to avoid keeping clocks prepared all the time when driver is bound. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] s5p-mfc: Remove special clock rate managementMarek Szyprowski2016-11-301-2/+0
| | | | | | | | | | The maximum rate of special clock depends on SoC variant and should be set in device tree via assigned-clock-rates property, so remove the code which forces special clock to 200MHz. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] s5p-mfc: Use printk_ratelimited for reporting ioctl errorsMarek Szyprowski2016-11-303-2/+8
| | | | | | | | | | Some applications don't check error codes from QBUF/DQBUF ioctls, so don't spam kernel log with errors if they fall into endless loop trying to queue next buffer after a failure. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] s5p-mfc: Set DMA_ATTR_ALLOC_SINGLE_PAGESDouglas Anderson2016-11-301-0/+11
| | | | | | | | | | | | | | | | | | | | We do video allocation all the time and we need it to be fast. Plus TLB efficiency isn't terribly important for video. That means we want to set DMA_ATTR_ALLOC_SINGLE_PAGES. See also the previous change (commit 14d3ae2efeed "ARM: dma-mapping: Use DMA_ATTR_ALLOC_SINGLE_PAGES hint to optimize allocation"). [m.szyprowski: rebased patch onto v4.9-rc1 and adapted changes to latest videbuf2 changes, this simplifies code changes to only set proper dma attribute flag and comment the reason for it, added commit id of arch/arm/mm patch] Signed-off-by: Douglas Anderson <dianders@chromium.org> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] vivid: Set color_enc on HSV formatsRicardo Ribalda2016-11-291-0/+2
| | | | | | | | | HSV formats were missing the color encoding, which leads to an invalid ycbcr_enc value during get_fmt and try_fmt. Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] cec: pass parent device in register(), not allocate()Hans Verkuil2016-11-293-8/+5
| | | | | | | | | | | | | | The cec_allocate_adapter function doesn't need the parent device, only the cec_register_adapter function needs it. Drop the cec_devnode parent field, since devnode.dev.parent can be used instead. This change makes the framework consistent with other frameworks where the parent device is not used until the device is registered. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] DaVinci-VPFE-Capture: fix error handlingArnd Bergmann2016-11-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | A recent cleanup had the right idea to remove the initialization of the error variable, but missed the actual benefit of that, which is that we get warnings if there is a bug in it. Now we get a warning about a bug that was introduced by this cleanup: drivers/media/platform/davinci/vpfe_capture.c: In function 'vpfe_probe': drivers/media/platform/davinci/vpfe_capture.c:1992:9: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized] This adds the missing initialization that the warning is about, and another one that was preexisting and that we did not get a warning for. That second bug has existed since the driver was first added. Fixes: efb74461f5a6 ("[media] DaVinci-VPFE-Capture: Delete an unnecessary variable initialisation in vpfe_probe()") Fixes: 7da8a6cb3e5b ("V4L/DVB (12248): v4l: vpfe capture bridge driver for DM355 and DM6446") [mchehab@s-opensource.com: fix a merge conflict] Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] v4l: rcar_fdp1: add FCP dependencyArnd Bergmann2016-11-251-0/+1
| | | | | | | | | | | | | | | | | | | | | Commit 4710b752e029 ("[media] v4l: Add Renesas R-Car FDP1 Driver") in the v4l-dvb tree adds CONFIG_VIDEO_RENESAS_FDP1. It calls into the FCP driver, but when there is no dependency, FCP might be a module while FDP1 is built-in. We have the same logic in VIDEO_RENESAS_VSP1, which also depends on FCP not being a module when it is built-in itself. drivers/media/platform/rcar_fdp1.o: In function `fdp1_pm_runtime_resume': rcar_fdp1.c:(.text.fdp1_pm_runtime_resume+0x78): undefined reference to `rcar_fcp_enable' drivers/media/platform/rcar_fdp1.o: In function `fdp1_pm_runtime_suspend': rcar_fdp1.c:(.text.fdp1_pm_runtime_suspend+0x14): undefined reference to `rcar_fcp_disable' drivers/media/platform/rcar_fdp1.o: In function `fdp1_probe': rcar_fdp1.c:(.text.fdp1_probe+0x15c): undefined reference to `rcar_fcp_get' Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] v4l: rcar_fdp1: mark PM functions as __maybe_unusedArnd Bergmann2016-11-251-2/+2
| | | | | | | | | | | | | | The new driver produces a warning when CONFIG_PM is disabled: platform/rcar_fdp1.c:2408:12: error: 'fdp1_pm_runtime_resume' defined but not used [-Werror=unused-function] platform/rcar_fdp1.c:2399:12: error: 'fdp1_pm_runtime_suspend' defined but not used [-Werror=unused-function] This marks the two functions as __maybe_unused. Fixes: 4710b752e029 ("[media] v4l: Add Renesas R-Car FDP1 Driver") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] ti-vpe: get rid of some smatch warningsMauro Carvalho Chehab2016-11-221-3/+15
| | | | | | | | | | | | | | | | | | | | | When compiled on i386, it produces several warnings: ./arch/x86/include/asm/bitops.h:457:22: warning: asm output is not an lvalue ./arch/x86/include/asm/bitops.h:457:22: warning: asm output is not an lvalue ./arch/x86/include/asm/bitops.h:457:22: warning: asm output is not an lvalue ./arch/x86/include/asm/bitops.h:457:22: warning: asm output is not an lvalue ./arch/x86/include/asm/bitops.h:457:22: warning: asm output is not an lvalue ./arch/x86/include/asm/bitops.h:457:22: warning: asm output is not an lvalue I suspect that some gcc optimization could be causing the asm code to be incorrectly generated. Splitting it into two macro calls fix the issues and gets us rid of 6 smatch warnings, with is a good thing. As it should not cause any troubles, as we're basically doing the same thing, let's apply such change to vpe.c. Cc: Benoit Parrot <bparrot@ti.com> Cc: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] vpdma: remove vpdma_enable_list_notify_irq()Mauro Carvalho Chehab2016-11-221-16/+0
| | | | | | | | | | | | | | | | | | | | | | | | Despite being exported, there's no prototype for it at the headers, as warned by sparse: Fixes this sparse warning: drivers/media/platform/ti-vpe/vpdma.c:1000:6: warning: no previous prototype for 'vpdma_enable_list_notify_irq' [-Wmissing-prototypes] void vpdma_enable_list_notify_irq(struct vpdma_data *vpdma, int irq_num, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ Worse than that, it is not even used, as making it static it would produce: drivers/media/platform/ti-vpe/vpdma.c:1000:13: warning: 'vpdma_enable_list_notify_irq' defined but not used [-Wunused-function] static void vpdma_enable_list_notify_irq(struct vpdma_data *vpdma, int irq_num, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ So, let's just get rid of the dead code. If needed in the future, someone could re-add it. Cc: Benoit Parrot <bparrot@ti.com> Cc: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] vpfe_capture: fix compiler warningHans Verkuil2016-11-221-1/+3
| | | | | | | | | | | | | davinci/vpfe_capture.c: In function 'vpfe_probe': davinci/vpfe_capture.c:1992:9: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized] return ret; ^~~ This is indeed correct, so if the kmalloc fails set ret to -ENOMEM. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media: ti-vpe: vpe: Add proper support single and multi-plane bufferBenoit Parrot2016-11-221-10/+48
| | | | | | | | | | | | | | | | | | | | The VPE was restricting the number of plane per buffer based on the fact that if a particular format had color separation it was meant to need 2 planes. However NV12/NV16 are color separate format which are meant to be presented in a single contiguous buffer/plane. It could also be presented in a multi-plane as well if need be. So we must support both modes for more flexibility. The number of plane requested by user space was previously ignored and was therefore always overwritten. The driver now use the requested num plane as hint to calculate needed offset when required. Signed-off-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media: ti-vpe: csc: Add debug support for multi-instanceBenoit Parrot2016-11-221-0/+2
| | | | | | | | | | Since there might be more then one instance it is better to show the base address when dumping registers to help with debugging. Signed-off-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media: ti-vpe: Make colorspace converter library into its own moduleBenoit Parrot2016-11-225-6/+22
| | | | | | | | | In preparation to add colorspace conversion support to VIP, we need to turn csc.c into its own kernel module. Signed-off-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media: ti-vpe: vpdma: Add RAW8 and RAW16 data typesBenoit Parrot2016-11-222-0/+29
| | | | | | | | | | | | | | | | Add RAW8 and RAW16 data type to VPDMA. To handle RAW format we are re-using the YUV CBY422 vpdma data type so that we use the vpdma to re-order the incoming bytes, as the VIP parser assumes that the first byte presented on the bus is the MSB of a 2 bytes value. RAW8 handles from 1 to 8 bits. RAW16 handles from 9 to 16 bits. Signed-off-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media: ti-vpe: vpe: Make sure frame size dont exceed scaler capacityBenoit Parrot2016-11-222-17/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | When scaler is to be used we need to make sure that the input and output frame size do not exceed the maximum frame sizes that the scaler h/w can handle otherwise streaming stall as the scaler cannot proceed. The scaler buffer is limited to 2047 pixels (i.e. 11 bits) when attempting anything larger (2048 for example) the scaler stalls. Realistically in an mem2mem device we can only check for this type of issue when start_streaming is called. We can't do it during the try_fmt/s_fmt because we do not have all of the info needed at that point. So instead when start_streaming is called we need to check that the input and output frames size do not exceed the scaler's capability. The only time larger frame size are allowed is when the input frame szie is the same as the output frame size. Now in the case where we need to fail, start_streaming must return all previously queued buffer back otherwise the vb2 framework will issue kernel WARN messages. In this case we also give an error message. Signed-off-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media: ti-vpe: scaler: Add debug support for multi-instanceBenoit Parrot2016-11-221-0/+2
| | | | | | | | | | Since there might be more then one instance it is better to show the base address when dumping registers to help with debugging. Signed-off-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media: ti-vpe: Make scaler library into its own moduleBenoit Parrot2016-11-225-6/+23
| | | | | | | | | | | | | | In preparation to add scaler support into VIP we need to turn sc.c into its own kernel module. Add support for multiple SC memory block as VIP contains 2 scaler instances. This is done by passing the resource name to sc_create() and modify the vpe invocation accordingly. Signed-off-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media: ti-vpe: vpe: Enable DMABUF exportBenoit Parrot2016-11-221-0/+1
| | | | | | | | Allow VPE to be able to export DMA buffer. Signed-off-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media: ti-vpe: vpe: Fix line stride for output motion vectorNikhil Devshatwar2016-11-221-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | For deinterlacing operation, VPE hardware uses motion vectors. MV calculated in the previous iteration are used for next interation. Therefore driver allocates two motion vectors in ping-pong fashion. For every transaction, one MV is DMAed in and one is DMAed out. All the outbound DMAs (DMA to memory) use output parameters, but as the motion vectors is generated purely out of input fields, it should use the input parameters for DMA. Fix the add_out_dtd to use source q_data for creating descriptor. If the output size is greater than input stride, without this change, MV DMA may overwrite the buffer causing memory corruption. This CRITICAL fix ensures that the motion vector DMA descriptor is created based on the attributes with which the buffer was allocated. Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com> Signed-off-by: Ravikumar Kattekola <rk@ti.com> Signed-off-by: Ravi Babu <ravibabu@ti.com> Signed-off-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media: ti-vpe: vpdma: Use bidirectional cached buffersNikhil Devshatwar2016-11-221-2/+3
| | | | | | | | | | | | | | | | | | | VPDMA buffer will be used by CPU as well as by the VPDMA. CPU will write/update the VPDMA descriptors containing data about the video buffer DMA addresses. VPDMA will write the "write descriptor" containing the data about the DMA operation. When mapping/unmapping the buffer, driver has to take care of WriteBack and invalidation of the cache so that all the coherency is maintained from both directions. Use DMA_BIDIRECTIONAL to maintain coherency between CPU and VPDMA. Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com> Signed-off-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media: ti-vpe: vpdma: Fix race condition for firmware loadingNikhil Devshatwar2016-11-223-17/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | vpdma_create API is supposed to allocated the struct vpdma_data and return it to the driver. Also, it would call the callback function when the VPDMA firmware is loaded. Typically, VPE driver have following function call: dev->vpdma = vpdma_create(pdev, firmware_load_callback); And the callback implementation would continue the probe further. Also, the dev->vpdma is accessed from the callback implementation. This may lead to race condition between assignment of dev->vpdma and the callback function being triggered. This would lead to kernel crash because of NULL pointer access. Fix this by passing a driver wrapped &vpdma_data instead of allocating inside vpdma_create. Change the vpdma_create prototype accordingly and fix return paths. Also, update the VPE driver to use the updated API and initialize the dev->vpdma before hand so that the race condition is avoided. Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com> Signed-off-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media: ti-vpe: vpe: Fix vb2 buffer cleanupBenoit Parrot2016-11-221-2/+60
| | | | | | | | | | | | | | | | When stop_streaming is called we need to cleanup the queued vb2 buffers properly. This was not previously being done which caused kernel warning when the application using the resources was killed. Kernel warnings were also generated on successful completion of a de-interlacing case as well as upon aborting a conversion. Make sure every vb2 buffers is properly handled in all cases. Signed-off-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media: ti-vpe: sc: Fix incorrect optimizationNikhil Devshatwar2016-11-222-12/+0
| | | | | | | | | | | | | | | | | | | Current scaler library implementation of sc_set_hs_coeffs and sc_set_vs_coeffs tries to return immediately if the calculated coefficient index is already being used. As the same scaler block is going to be used for all the VPE contexts, even if the calculated index is same, the parameters have to be reconfigured for each of the context. Because of this, when multiple contexts use the same coefficients, all other contexts would have zero scaling coefficients. Fix this and also remove the unnecessary hs_index and vs_index fields. Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com> Signed-off-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media: ti-vpe: vpdma: RGB data type yield inverted dataBenoit Parrot2016-11-221-20/+29
| | | | | | | | | | | | | The VPDMA RGB data type definition have been updated to match with Errata i839. But some of the ARGB definition appeared to be wrong in the document also. As they would yield RGBA instead. They have been corrected based on experimentation. Signed-off-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media: ti-vpe: vpdma: Corrected YUV422 data type labelBenoit Parrot2016-11-224-13/+38
| | | | | | | | | | | | | | | | | | The YUV data type definition below are taken from both the TRM and i839 Errata information. Use the correct data type considering byte reordering of components. Added the 2 missing YUV422 variant. Also since the single use of "C" in the 422 case to mean "Cr" (i.e. V component). It was decided to explicitly label them CR to remove any confusion. Bear in mind that the type label refer to the memory packed order (LSB - MSB). Signed-off-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media: ti-vpe: vpe: Added MODULE_DEVICE_TABLE hintBenoit Parrot2016-11-221-0/+1
| | | | | | | | | | ti_vpe module currently does not get loaded automatically. Added MODULE_DEVICE_TABLE hint to the driver to assist. Signed-off-by: Benoit Parrot <bparrot@ti.com> Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media: ti-vpe: vpdma: allocate and maintain hwlistNikhil Devshatwar2016-11-222-0/+53
| | | | | | | | | | | | | | | | | VPDMA block used in ti-vip and ti-vpe modules have support for up to 8 hardware descriptor lists. A descriptor list can be submitted to any of the 8 lists (as long as it's not busy). When multiple clients want to transfer data in parallel, its easier to allocate one list per client and let it use it. This way, the list numbers need not be hard-coded into the driver. Add support for allocating hwlist and maintain them with a priv data. Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com> Signed-off-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media: ti-vpe: vpe: Add RGB565 and RGB5551 supportNikhil Devshatwar2016-11-221-2/+20
| | | | | | | | | | | | | | VPE hardware can generate output in RGB565 or in RGB5551 format. Add these formats in the supported format list for CAPTURE stream. Also, for RGB5551 format, the alpha component is not processed, so the alpha value is taken from the default color. Set the default color to make alpha component full when the dst format is of RGB color space. Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com> Signed-off-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media: ti-vpe: vpe: Post next descriptor only for list complete IRQNikhil Devshatwar2016-11-221-0/+9
| | | | | | | | | | | | | | | | | vpe_irq checks for the possible interrupt sources and prints the errors for the DEI_ERROR and DS_UV interrupts. But it also post the next descriptor list irrespective of whichever interrupt has occurred. Because of this, driver may release the buffers even before DMA is complete and also schedule next descriptor list. Fix this by _actually_ handling the IRQ only when ListComplete IRQ occurs. Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com> Signed-off-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media: ti-vpe: vpe: Setup srcdst parameters in start_streamingNikhil Devshatwar2016-11-221-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | For deinterlacing operation, each operation needs 2 fields in the history. This is achieved by holding three buffers in ctx->src_vbs[0,1,2] (f,f-1,f-2) This is achieved by using the ctx->sequence which gets reset via the s_fmt ioctl. These buffers are dequeued in stream OFF by calling free_vbs() But the corresponding references aren't removed anywhere. When application tries to stream ON and OFF continuously, s_fmt ioctl won't be called and it won't setup the srcdst parameters. Setting source/destination parameters in stream ON ioctl would make sure that the context is re-initialized before it is being used by the driver. Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com> Signed-off-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media: ti-vpe: vpe: configure line mode separatelyNikhil Devshatwar2016-11-221-8/+17
| | | | | | | | | | | | | | | | | | | | | | | Current driver configures the line mode of the DEI clients from the open function directly. Even if the newly created context is not yet scheduled, it updates some of the VPDMA registers. This causes a problem in multi instance use case where just opening the m2m device second time causes the running job to stall. This happens especially if the source buffers used are NV12. While all other configuration is being written to context specific shadow registers, only line mode configuration is happening directly. As there is no shadow register for line mode configuration, it's better to separate the config_mode setting and line_mode setting. Call the new "set_line_modes" functions only when actually loading the mmrs. This makes sure that no non-running job will write to the registers directly. Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com> Signed-off-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media: ti-vpe: vpdma: Clear IRQs for individual listsNikhil Devshatwar2016-11-223-5/+6
| | | | | | | | | | | VPDMA IRQs are registered for multiple lists When clearing an IRQ for a list interrupt, all the IRQs for the individual lists are to be cleared separately. Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com> Signed-off-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media: ti-vpe: vpdma: Make list post atomic operationNikhil Devshatwar2016-11-222-0/+5
| | | | | | | | | | | | | | | | | | | | Writing to the "VPDMA list attribute" register is considered as a list post. This informs the VPDMA firmware to load the list from the address which should be taken from the "VPDMA list address" register. As these two register writes are dependent, it is important that the two writes happen in atomic manner. This ensures multiple slices (which share same VPDMA) can post lists asynchronously and all of them point to the correct addresses. Slightly modified to implementation for the original patch to use spin_lock instead of mutex as the list post is also called from interrupt context. Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com> Signed-off-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media: ti-vpe: vpdma: Add abort channel desc and cleanup APIsNikhil Devshatwar2016-11-222-0/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Whenever VPDMA processes a data descriptor of a list, it processes it and sets up the channel for the DMA transaction. List manager holds the descriptor in the list until the DMA is complete. If sync_on_channel descriptor, or another descriptor for the same channel is present in the FIFO, list manager keeps them until the current channel is free. When the capture stream is closed suddenly while there are pending descriptors in the FIFO (streamON failed, application killed), it would keep the VPDMA in a busy state. Any further list post would fail with EBUSY. To avoid this, drivers need to stop the current processing list and cleanup all the resources VPDMA has taken and also clear the internal FSM of list manager. The state machine is cleared by issuing channel specific abort descriptor. Therefore, the vpdma_list_cleanup accepts an array of channels for which abort_channel descriptors should be posted. It is driver's responsibility to post for all the channels or the channels which were used in the last context. Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com> Signed-off-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media: ti-vpe: vpdma: Add support for setting max width heightNikhil Devshatwar2016-11-224-44/+62
| | | | | | | | | | | | | | | | | | | Add a helper function to be able to set the maximum VPDMA transfer size to limit potential buffer overrun. Added enums for max_width and max_height fields of the outbound data descriptor. Changed vpdma_add_out_dtd to accept two more arguments for max width and height. Make use of different max width & height sets for different of capture module (i.e. slices). Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com> Signed-off-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media: ti-vpe: Free vpdma buffers in vpe_releaseHarinarayan Bhatta2016-11-221-0/+3
| | | | | | | | | | | | Free vpdma buffers in vpe_release. Otherwise it was generating random backtrace. Signed-off-by: Harinarayan Bhatta <harinarayan@ti.com> Signed-off-by: Somnath Mukherjee <somnath@ti.com> Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com> Signed-off-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media: ti-vpe: vpe: Return NULL for invalid buffer typeNikhil Devshatwar2016-11-221-1/+1
| | | | | | | | | | | | | | | get_q_data can be called with different values for type e.g. vpe_try_crop calls it with the buffer type which gets passed from user space Framework doesn't check wheather its correct type or not If user space passes wrong type, kernel should not crash. Return NULL when the passed type is invalid. Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com> Signed-off-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media: ti-vpe: Increasing max buffer height and widthHarinarayan Bhatta2016-11-221-2/+2
| | | | | | | | | | Increasing max buffer height and width to allow for padded buffers. Signed-off-by: Harinarayan Bhatta <harinarayan@ti.com> Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com> Signed-off-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media: ti-vpe: Add support for SEQ_TB buffersNikhil Devshatwar2016-11-221-22/+103
| | | | | | | | | | | | | | | | | | The video source can generate the data in the SEQ_TB buffer format. In the case of TI SoC, the IVA_HD can generate the interlaced content in the SEQ_TB buffer format. This is the format where the top and bottom field data can be contained in a single buffer. For example, for NV12, interlaced format, the data in Y buffer will be arranged as Y-top followed by Y-bottom. And likewise for UV plane. Also, queuing one buffer of SEQ_TB is equivalent to queuing two different buffers for top and bottom fields. Driver needs to take care of this when handling source buffer lists. Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com> Signed-off-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media: ti-vpe: vpe: Do not perform job transaction atomicallyNikhil Devshatwar2016-11-221-16/+16
| | | | | | | | | | | | | | | | | | | | | | | Current VPE driver does not start the job until all the buffers for a transaction are queued. When running in multiple context, this might increase the processing latency. Alternate solution would be to try to continue the same context as long as buffers for the transaction are ready; else switch the context. This may increase number of context switches but it reduces latency significantly. In this approach, the job_ready always succeeds as long as there are buffers on the CAPTURE and OUTPUT stream. Processing may start immediately as the first 2 iterations don't need extra source buffers. Shift all the source buffers after each iteration and remove the oldest buffer. Also, with this removes the constraint of pre buffering 3 buffers before call to STREAMON in case of de-interlacing. Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com> Signed-off-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media: ti-vpe: Use line average de-interlacing for first 2 framesArchit Taneja2016-11-221-2/+31
| | | | | | | | | | | | | | | | | | | | | The motion detection block requires 3 fields to create the motion vector data. This means that using the default method the first progressive frame is only generated after 3rd field is consumed. Hence by default for N input field we would generate N - 2 progressive frames. In order to generate N progressive frames from N fields we use the line averaging mode of the de-interlacer for the first 2 fields and then revert back to the preferred Edge Directed Interpolation method (using the motion vector). Thus creating 2 line averaged frames + N - 2 motion based frames for a total of N frames. Signed-off-by: Archit Taneja <archit@ti.com> Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com> Signed-off-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media: ti-vpe: vpdma: Fix bus error when vpdma is writing a descriptorBenoit Parrot2016-11-221-2/+3
| | | | | | | | | | | | On DRA7 since l3_noc event are being reported it was found that when the write descriptor was being written it was consistently causing bus error events. The write address was improperly programmed. Signed-off-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>