summaryrefslogtreecommitdiff
path: root/drivers/media/video/s5p-fimc/fimc-core.c
AgeCommit message (Collapse)Author
2012-08-15[media] rename drivers/media/video as .../platformMauro Carvalho Chehab
The remaining drivers are mostly platform drivers. Name the dir to reflect it. It makes sense to latter break it into a few other dirs. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-07-14Merge branch 'v4l_for_linus' into staging/for_v3.6Mauro Carvalho Chehab
* v4l_for_linus: (31 commits) [media] Revert "[media] V4L: JPEG class documentation corrections" [media] s5p-fimc: Add missing FIMC-LITE file operations locking [media] omap3isp: preview: Fix contrast and brightness handling [media] omap3isp: preview: Fix output size computation depending on input format [media] winbond-cir: Initialise timeout, driver_type and allowed_protos [media] winbond-cir: Fix txandrx module info [media] cx23885: Silence unknown command warnings [media] cx23885: add support for HVR-1255 analog (cx23888 variant) [media] cx23885: make analog support work for HVR_1250 (cx23885 variant) [media] cx25840: fix vsrc/hsrc usage on cx23888 designs [media] cx25840: fix regression in HVR-1800 analog audio [media] cx25840: fix regression in analog support hue/saturation controls [media] cx25840: fix regression in HVR-1800 analog support [media] s5p-mfc: Fixed setup of custom controls in decoder and encoder [media] cx231xx: don't DMA to random addresses [media] em28xx: fix em28xx-rc load [media] dvb-core: Release semaphore on error path dvb_register_device() [media] s5p-fimc: Stop media entity pipeline if fimc_pipeline_validate fails [media] s5p-fimc: Fix compiler warning in fimc-lite.c [media] s5p-fimc: media_entity_pipeline_start() may fail ...
2012-06-27Merge branch 'v4l_for_linus' into staging/for_v3.6Mauro Carvalho Chehab
* v4l_for_linus: (44 commits) [media] smia: Fix compile failures [media] Fix VIDIOC_DQEVENT docbook entry [media] s5p-fimc: Fix control creation function [media] s5p-mfc: Fix checkpatch error in s5p_mfc_shm.h file [media] s5p-mfc: Fix setting controls [media] v4l/s5p-mfc: added image size align in VIDIOC_TRY_FMT [media] v4l/s5p-mfc: corrected encoder v4l control definitions [media] v4l: mem2mem_testdev: Fix race conditions in driver [media] s5p-mfc: Bug fix of timestamp/timecode copy mechanism [media] cxd2820r: Fix an incorrect modulation type bitmask [media] em28xx: Show a warning if the board does not support remote controls [media] em28xx: Add remote control support for Terratec's Cinergy HTC Stick HD [media] USB: Staging: media: lirc: initialize spinlocks before usage [media] Revert "[media] media: mx2_camera: Fix mbus format handling" [media] bw-qcam: driver and pixfmt documentation fixes [media] cx88: fix firmware load on big-endian systems [media] cx18: support big-endian systems [media] ivtv: fix support for big-endian systems [media] tuner-core: return the frequency range of the correct tuner [media] v4l2-dev.c: fix g_parm regression in determine_valid_ioctls() ... Conflicts: Documentation/DocBook/media/v4l/vidioc-create-bufs.xml drivers/media/video/em28xx/em28xx-cards.c
2012-06-25[media] s5p-fimc: Update to the control handler lock changesSylwester Nawrocki
Commit 77e7c4e624404c6edb5686b3d5f873c6008ed6b0 "v4l: Allow changing control handler lock" changed the lock field of struct v4l2_ctrl_handler to a pointer and this driver wasn't updated properly. This patch fixes following warning: drivers/media/video/s5p-fimc/fimc-core.c: In function ‘fimc_ctrls_activate’: drivers/media/video/s5p-fimc/fimc-core.c:644: warning: passing argument 1 of ‘mutex_lock’ from incompatible pointer type include/linux/mutex.h:152: note: expected ‘struct mutex *’ but argument is of type ‘struct mutex **’ drivers/media/video/s5p-fimc/fimc-core.c:663: warning: passing argument 1 of ‘mutex_unlock’ from incompatible pointer type include/linux/mutex.h:169: note: expected ‘struct mutex *’ but argument is of type ‘struct mutex **’ Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-06-25[media] s5p-fimc: Shorten pixel formats descriptionSylwester Nawrocki
Shorten pixel format descriptions that exceed 32 characters so they're not being truncated when queried from user space. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-06-25[media] s5p-fimc: Honour sizeimage in VIDIOC_S_FMTSylwester Nawrocki
Allow memory buffer size to be increased by means of struct v4l2_pix_plane_format::sizeimage at VIDIOC_S_FMT ioctl. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-06-18[media] s5p-fimc: Fix control creation functionKamil Debski
Fixed the size of the V4L2_CID_COLORFX control cluster. Prior to this fix V4L2_CID_ROTATE was also icluded in the cluster preventing application from enabling rotation. Reported-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Kamil Debski <k.debski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-06-18[media] s5p-fimc: Add missing static storage class specifiersSachin Kamat
Fixes the following sparse warnings: drivers/media/video/s5p-fimc/fimc-lite-reg.c:218:6: warning: symbol 'flite_hw_set_out_order' was not declared. Should it be static? drivers/media/video/s5p-fimc/fimc-mdevice.c:183:5: warning: symbol '__fimc_pipeline_shutdown' was not declared. Should it be static? drivers/media/video/s5p-fimc/fimc-mdevice.c:1013:12: warning: symbol 'fimc_md_init' was not declared. Should it be static? drivers/media/video/s5p-fimc/fimc-mdevice.c:1024:13: warning: symbol 'fimc_md_exit' was not declared. Should it be static? drivers/media/video/s5p-fimc/fimc-core.c:466:5: warning: symbol 'fimc_set_color_effect' was not declared. Should it be static? drivers/media/video/s5p-fimc/fimc-capture.c:1163:5: warning: symbol 'enclosed_rectangle' was not declared. Should it be static? Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-05-20[media] s5p-fimc: Add color effect controlSylwester Nawrocki
Add support for V4L2_CID_COLORFX control at the mem-to-mem and capture video nodes. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-05-20[media] s5p-fimc: Update copyright noticesSylwester Nawrocki
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-05-20[media] s5p-fimc: Make sure an interrupt is properly requestedSylwester Nawrocki
Use dev_name() for requesting an interrupt so we don't get an interrupt requested with same name for multiple device instances. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-05-20[media] s5p-fimc: Minor cleanupsSylwester Nawrocki
Tidy up the variant and driver data handling. Remove the 'samsung_' prefix from some data structures since it doesn't really carry any useful information and makes the names unnecessarily long. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-05-20[media] s5p-fimc: Prefix format enumerations with FIMC_FMT_Sylwester Nawrocki
Prefix the pixel format enumerations with FIMC_FMT_ to make it more clear, especially when used in new IP drivers, like fimc-lite, etc. Also add IO_ prefix in the input/output enumeration. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-05-20[media] s5p-fimc: Refactor the register interface functionsSylwester Nawrocki
Simplify the register API and use FIMC_REG_ prefix for all register definitions for consistency with FIMC-LITE. The unused image effect defines are removed. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-05-20[media] s5p-fimc: Use v4l2_subdev internal ops to register video nodesSylwester Nawrocki
In order to be able to select only FIMC-LITE support, which is added with subsequent patches, the regular FIMC support is now contained only in fimc-core.c, fimc-m2m.c and fimc-capture.c files. The graph and pipeline management is now solely handled in fimc-mdevice.[ch]. This means the FIMC driver can now be excluded with Kconfig option, leaving only FIMC-LITE and allowing this driver to be reused in SoCs that have only FIMC-LITE and no regular FIMC IP. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-05-20[media] s5p-fimc: Move m2m node driver into separate fileSylwester Nawrocki
Virtually no functional changes, just code reordering. This let us to clearly separate all logical functions available in the driver: fimc capture, mem-to-mem, and later fimc-lite capture, ISP features, etc. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-05-15Merge remote-tracking branch 'linus/master' into staging/for_v3.5Mauro Carvalho Chehab
* linus/master: (805 commits) tty: Fix LED error return openvswitch: checking wrong variable in queue_userspace_packet() bonding: Fix LACPDU rx_dropped commit. Linux 3.4-rc7 ARM: EXYNOS: fix ctrlbit for exynos5_clk_pdma1 ARM: EXYNOS: use s5p-timer for UniversalC210 board ARM / mach-shmobile: Invalidate caches when booting secondary cores ARM / mach-shmobile: sh73a0 SMP TWD boot regression fix ARM / mach-shmobile: r8a7779 SMP TWD boot regression fix ARM: mach-shmobile: convert ag5evm to use the generic MMC GPIO hotplug helper ARM: mach-shmobile: convert mackerel to use the generic MMC GPIO hotplug helper MAINTAINERS: Add myself as the cpufreq maintainer dm mpath: check if scsi_dh module already loaded before trying to load dm thin: correct module description dm thin: fix unprotected use of prepared_discards list dm thin: reinstate missing mempool_free in cell_release_singleton gpio/exynos: Fix compiler warnings when non-exynos machines are selected gpio: pch9: Use proper flow type handlers powerpc/irq: Fix another case of lazy IRQ state getting out of sync ks8851: Update link status during link change interrupt ... Conflicts: drivers/media/common/tuners/xc5000.c drivers/media/common/tuners/xc5000.h drivers/usb/gadget/uvc_queue.c
2012-05-14[media] v4l2-dev: add flag to have the core lock all file operationsHans Verkuil
This used to be the default if the lock pointer was set, but now that lock is by default only used for ioctl serialization. Those drivers that already used core locking have this flag set explicitly, except for some drivers where it was obvious that there was no need to serialize any file operations other than ioctl. The drivers that didn't need this flag were: drivers/media/radio/dsbr100.c drivers/media/radio/radio-isa.c drivers/media/radio/radio-keene.c drivers/media/radio/radio-miropcm20.c drivers/media/radio/radio-mr800.c drivers/media/radio/radio-tea5764.c drivers/media/radio/radio-timb.c drivers/media/video/vivi.c sound/i2c/other/tea575x-tuner.c The other drivers that use core locking and where it was not immediately obvious that this flag wasn't needed were changed so that the flag is set together with a comment that that driver needs work to avoid having to set that flag. This will often involve taking the core lock in the fops themselves. Eventually this flag should go and it should not be used in new drivers. There are a few reasons why we want to avoid core locking of non-ioctl fops: in the case of mmap this can lead to a deadlock in rare situations since when mmap is called the mmap_sem is held and it is possible for other parts of the code to take that lock as well (copy_from_user()/copy_to_user() perform a down_read(&mm->mmap_sem) when a page fault occurs). It is very unlikely that that happens since the core lock serializes all fops, but the kernel warns about it if lock validation is turned on. For poll it is also undesirable to take the core lock as that can introduce increased latency. The same is true for read/write. While it was possible to make flags or something to turn on/off taking the core lock for each file operation, in practice it is much simpler to just not take it at all except for ioctl and leave it to the driver to take the lock. There are only a handful fops compared to the zillion ioctls we have. I also wanted to make it obvious which drivers still take the lock for all fops, so that's why I chose to have drivers set it explicitly. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-05-08[media] s5p-fimc: Correct memory allocation for VIDIOC_CREATE_BUFSSylwester Nawrocki
The commit 3b4c34aac7abea4754059084d0eef667a1993ac8 "s5p-fimc: Add support for VIDIOC_PREPARE_BUF/CREATE_BUFS ioctls" added a handler for VIDIOC_CREATE_BUFS ioctl, but the queue_setup callback wasn't updated to properly interpret the pixel format. In this situation memory corruption may happen with VIDIOC_CREATE_BUFS ioctl. Update the queue_setup op to fix this. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-04-10[media] s5p-fimc: Handle sub-device interdependencies using deferred probingSylwester Nawrocki
In this driver there are several entities associated with separate platform or I2C client devices, which may get probed in random order. When the platform device bound to the media device driver is probed all other entity drivers need to be already in place and initialized. If any of them is not, fail the media device probe and return an error indicating we need to be retried once any new driver gets registered. The media device driver probe will not succeed until there are available all needed sub-drivers, as specified in the platform data. While at it, make sure the s5p-csis module (MIPI-CSI receiver driver) does not get unloaded when in use, by guarding its usage with try_module_get/module_put. This patch is a prerequisite for adding the device tree support. It now also allows again to unbind/bind the driver at runtime from user space via sysfs. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-04-10[media] s5p-fimc: Remove unneeded fields from struct fimc_devSylwester Nawrocki
irq is used only locally and num_clocks is constant, so remove them. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-04-10[media] s5p-fimc: Refactor hardware setup for m2m transactionSylwester Nawrocki
Remove redundant H/W setup logic by merging fimc_prepare_config() and the device_run() callback. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-04-10[media] s5p-fimc: Simplify locking by removing the context data structure ↵Sylwester Nawrocki
spinlock Access to the memory-to-memory video node is serialized through a mutex so now there is no point in having per device context structure spinlock. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-03-08[media] s5p-fimc: Convert to the device managed resourcesSylwester Nawrocki
The devm_* functions are used in the platform device probe() for data that is freed on driver removal. The managed device layer takes care of undoing actions taken in the probe callback() and freeing resources on driver detach. This eliminates the need for manually releasing resources and simplifies error handling. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-03-08[media] s5p-fimc: convert to clk_prepare()/clk_unprepare()Sylwester Nawrocki
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-18[media] s5p-fimc: Fix incorrect control ID assignmentSachin Kamat
This patch fixes the mismatch between control IDs (CID) and controls for hflip, vflip and rotate. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-06[media] s5p-fimc: Prevent lock up caused by incomplete H/W initializationSylwester Nawrocki
The following ioctl sequence causes fimc_dma_run() to start processing without complete scaler and DMA initialization which causes missing interrupt and blocking on DQBUF: S_FMT, STREAMON, QBUF, DQBUF, STREAMOFF, STREAMON, QBUF, DQBUF. Fix this regression caused by moving pm_runtime* calls to start/stop_streaming callback by making sure the fimc_m2m_resume() is always invoked when expected. Reported-by: Tomasz Stanislawski <t.stanislaws@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-12-30[media] s5p-fimc: Add support for alpha component configurationSylwester Nawrocki
On Exynos SoCs the FIMC IP allows to configure globally the alpha component of all pixels for V4L2_PIX_FMT_RGB32, V4L2_PIX_FMT_RGB555 and V4L2_PIX_FMT_RGB444 image formats. This patch adds a v4l2 control in order to let the applications control the alpha component value. The alpha value range depends on the pixel format, for RGB32 it's 0..255 (8-bits), for RGB555 - 0..1 (1-bit) and for RGB444 - 0..15 (4-bits). The v4l2 control range is always 0..255 and the alpha component data width is determined by currently set format on the V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE buffer queue. The applications need to match the alpha channel value range and the pixel format since the driver will clamp the alpha component. Depending on fourcc the valid alpha bits are: - V4L2_PIX_FMT_RGB555 [0] - V4L2_PIX_FMT_RGB444 [3:0] - V4L2_PIX_FMT_RGB32 [7:0] When switching to a pixel format with smaller alpha component width the currently set alpha value will be clamped to maximum value valid for current format. When switching to a format with wider alpha the alpha value remains unchanged. The variant description data structure is extended with a new entry so an additional control is created only where really supported by the hardware. V4L2_PIX_FMT_RGB555 and V4L2_PIX_FMT_RGB444 formats are only valid for V4L2_BUF_TYPE_VIDEO_CAPTURE buffer queue. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-11-24[media] s5p-fimc: Use correct fourcc for RGB565 colour formatSylwester Nawrocki
With 16-bit RGB565 colour format pixels are stored by the device in memory in the following order: | b3 | b2 | b1 | b0 | ~+-----+-----+-----+-----+ | R5 G6 B5 | R5 G6 B5 | This corresponds to V4L2_PIX_FMT_RGB565 fourcc, not V4L2_PIX_FMT_RGB565X. This change is required to avoid trouble when setting up video pipeline with the s5p-tv devices, so the colour formats at both devices can be properly matched. Cc: <stable@kernel.org> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-11-24[media] s5p-fimc: Adjust pixel height alignments according to the IP revisionSylwester Nawrocki
Minimum vertical pixel size alignment for input and output DMA and the scaler depend on color format, rotation, the IP instance and revision. Make vertical pixel size of format and crop better fit for each SoC revision and the IP instance by adding min_vsize_align attribute to the FIMC variant data structure. It's now common for the DMA engines and the scaler. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-11-24[media] s5p-fimc: Fix buffer dequeue order issueSylwester Nawrocki
When requested more than 2 buffers the buffer dequeue order was wrong due to erroneous updating FIMC registers in every interrupt handler call. This also fixes regression of resetting the output DMA buffer pointer at wrong time, when some buffers are already queued in hardware. The hardware is reset in the start_streaming callback in order to align the H/W state with the software output buffer pointer (buf_index). Additionally a simple write to S5P_CISCCTRL register is replaced with a read/modification/write to make sure the scaler is not being disabled in fimc_hw_set_scaler(). Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-11-24[media] s5p-fimc: Fix initialization for proper system suspend supportSylwester Nawrocki
ST_LPM bit must not be initially set, so the first resume helper call properly quiesce the device's operation. Also fimc_runtime_suspend() at device remove is unneeded and leads to unbalanced clock disable so remove it. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-11-03[media] V4L: vb2: prepare to support multi-size buffersGuennadi Liakhovetski
In preparation for the forthcoming VIDIOC_CREATE_BUFS ioctl add a "const struct v4l2_format *" argument to the .queue_setup() vb2 operation. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-09-06[media] s5p-fimc: Remove single-planar capability flagsSylwester Nawrocki
The driver supports only multi-planar API and conversion to single-planar API should be done in libv4l2. Remove misleading single planar capability flags to avoid problems in applications and libv4l2. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-09-06[media] s5p-fimc: Correct crop offset alignment on exynos4Sylwester Nawrocki
Horizontal crop offset must be multiple of 2 otherwise color distortion occurs. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-09-06[media] s5p-fimc: Add runtime PM support in the camera capture driverSylwester Nawrocki
Add support for whole pipeline suspend/resume. Sensors must support suspend/resume through s_power subdev operation. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-09-06[media] s5p-fimc: Use consistent names for the buffer list functionsSylwester Nawrocki
Also correct and improve *_queue_add/pop functions description. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-09-06[media] s5p-fimc: Add support for JPEG captureSylwester Nawrocki
Add support for transparent DMA transfer of JPEG data with MIPI-CSI2 USER1 format. In JPEG mode the color effect, scaling and cropping is not supported as well as image rotation and flipping thus these controls are marked as inactive if V4L2_PIX_FMT_JPEG pixel format was selected. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-09-06[media] s5p-fimc: Add subdev for the FIMC processing blockSylwester Nawrocki
Add a subdev to expose the host's scaling and composition functions. The camera frame composition onto an output buffer may be configured through set/get_crop at FIMC.{n} source pad. Additionally allow crop, composition and controls to be modified during streaming. Make sure the default format is set when opening the video capture node. Rename struct fimc_vid_cap::fmt to more relevant 'mf' to avoid confusion. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-09-06[media] s5p-fimc: Convert to use media pipeline operationsSylwester Nawrocki
In the camera capture driver use fimc_pipeline_* calls provided by the media device driver part, in place where v4l2_subdev_call() were used. This way the capture driver don't need to differentiate between various H/W pipeline setups, i.e. if the MIPI-CSI receiver subdev is used or not. Remove the sync_capture_fmt() function instead of which fimc_pipeline_try_format() is introduced in the following patch adding the FIMC capture subdev. The TRY_FMT ioctl function is completed by a subsequent patch adding the capture subdev, so the try_fmt routines can be reused in the subdev and the video node ioctl handlers. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-09-06[media] s5p-fimc: Correct color format enumerationSylwester Nawrocki
Replace fimc_find_format() and find_mbus_format() with single function that can return a pointer to the private format description based on fourcc, media bus code or index in the table. Create separate VIDIOC_ENUM_FMT ioctl handlers for video capture and mem-to-mem video node. This is needed because some formats are valid only for the video capture and some only for the mem-to-mem video node. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-09-06[media] s5p-fimc: Add PM helper function for streaming controlSylwester Nawrocki
Move the camera capture H/W initialization sequence to a separate function. This is needed for reuse in the following runtime PM code. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-09-06[media] s5p-fimc: Convert to the new control frameworkSylwester Nawrocki
Convert the v4l controls code to use the new control framework. fimc_ctrls_activate/deactivate functions are introduced for the transparent DMA transfer mode (JPEG), where the rotation and flipping controls are not supported. The capture video node does not inherit sensors' controls when the subdevs are configured by the user space (user_subdev_api == true). However by default after the driver's initialization the 'user-subdev_api' flag is false and any sensor controls will also be available at the video node. When the pipeline links are disconnected through the media device the FIMC and any sensor inherited controls are destroyed and then again created when the pipeline connection completes. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-09-06[media] s5p-fimc: Conversion to use struct v4l2_fhSylwester Nawrocki
This is a prerequisite for the patch converting the driver to use the control framework. As the capture driver does not use per file handle contexts, two separate ioctl handlers are created for it (vidioc_try_fmt_mplane, and vidioc_g_fmt_mplane) so there is no handlers shared between the memory-to-memory and capture video node. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-09-06[media] s5p-fimc: Add the media device driverSylwester Nawrocki
Add a top level media device driver aggregating FIMC video devnodes, MIPI-CSIS and sensor subdevs. This driver gathers all media entities and creates the possible links between them during initialization. By default some links will be activated to enable access to all available sensors in the system. For example if there are sensors S0, S1 listed in the media device platform data definition they will be by default assigned to FIMC0, FIMC1 respectively, which in turn will corresponds to separate /dev/video?. There is enough FIMC H/W entities to cover all available physical camera interfaces in the system. The fimc media device driver is bound to the "s5p-fimc-md" platform device. Such platform device should be created by board initialization code and camera sensors description array need to be specified as its platform data. The media device driver also implements various video pipeline operations, for enabling subdevs power, streaming, etc., which will be used by the capture video node driver. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-09-06[media] s5p-fimc: Remove v4l2_device from video capture and m2m driverSylwester Nawrocki
Currently there is a v4l2_device instance being registered per each (capture and memory-to-memory) video node created per FIMC H/W instance. This patch is a prerequisite for using the top level v4l2_device instantiated by the media device driver. To retain current debug trace semantic (so it's possible to distinguish between the capture and m2m FIMC) the video_device is used in place of v4l2_device where appropriate. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-09-06[media] s5p-fimc: Remove sclk_cam clock handlingSylwester Nawrocki
There are 2 separate clock outputs available in the SoC for external sensors. These two clocks can be shared among all FIMC entities and there is currently no any arbitration of the clocks in the driver. So make the capture driver not touching these clocks and let them be be properly handled at the media device driver level, enabling proper arbitration between FIMC entities. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-09-06[media] s5p-fimc: Remove registration of video nodes from probe()Sylwester Nawrocki
Do not register video nodes during FIMC device probe. Also make fimc_register_m2m_device() public for use by the media device driver. The video nodes are to be registered during the media device driver initialization, altogether with the subdev devnodes. The video capture nodes need to be registered as last ones when the remaining pipeline elements are already initialized. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-09-06[media] s5p-fimc: Add media entity initializationSylwester Nawrocki
Add intialization of the media entities for video capture and mem-to-mem video nodes. The mem-to-mem entity has no pads whereas the capture entity has single sink pad. Also clean up the video node naming for consistency. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-09-06[media] s5p-fimc: Add runtime PM support in the mem-to-mem driverSylwester Nawrocki
Add runtime PM and system sleep support in the memory-to-memory driver. It's required to enable the FIMC operation on Exynos4 SoCs. This patch prevents system boot failure when the driver is compiled in, as it now tries to access its I/O memory without first enabling the corresponding power domain. The camera capture device suspend/resume is not fully covered, the capture device is just powered on/off during the video node open/close. However this enables it's normal operation on Exynos4 SoCs. [mchehab@redhat.com: fix a small checkpatch error] Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>