Re: My Microdia (SN9C201) webcam doesn't work properly in Linux anymore
Hi, On 03/06/2012 01:44 AM, Xavion wrote: Hi Guys Thanks very much for the follow-up emails. Our time-zone differences prevented me from replying sooner. I'm guessing you guys are both in Europe, whereas I'm down and across in Australia. As I plan to use this webcam for home security, I would prefer to keep the JPEG quality at or above 90% if possible. This is because it'd be difficult enough to see a burglar's face clearly at 640x480 with lossless quality. The good news is that the nasty errors I was getting yesterday have magically disappeared overnight! That is likely because the scene you're pointing at (or the lighting conditions) have changed, not all pictures compress equally well with JPEG. If you point the camera at the same scene as when you were getting these errors (with similar, good, lighting conditions) you'll likely see those errors re-surface. All I'm seeing today (at 90% and 75% quality) is what look to be non-fatal errors, since Motion seems to work correctly. root@Desktop /etc/motion # tail /var/log/kernel.log Mar 6 08:34:17 Desktop kernel: [ 7240.125167] gspca_main: ISOC data error: [0] len=0, status=-18 Mar 6 08:34:17 Desktop kernel: [ 7240.125172] gspca_main: ISOC data error: [1] len=0, status=-18 Mar 6 08:36:40 Desktop kernel: [ 7382.545241] gspca_main: ISOC data error: [0] len=0, status=-18 Mar 6 08:36:40 Desktop kernel: [ 7382.545246] gspca_main: ISOC data error: [1] len=0, status=-18 Mar 6 08:37:46 Desktop kernel: [ 7448.680301] gspca_sn9c20x: Set 640x480 Mar 6 08:40:12 Desktop kernel: [ 7594.685124] gspca_main: ISOC data error: [0] len=0, status=-18 Mar 6 08:40:12 Desktop kernel: [ 7594.685129] gspca_main: ISOC data error: [1] len=0, status=-18 Mar 6 08:42:37 Desktop kernel: [ 7739.715758] gspca_sn9c20x: Set 640x480 Mar 6 08:46:06 Desktop kernel: [ 7948.598533] gspca_main: ISOC data error: [0] len=0, status=-18 Mar 6 08:46:06 Desktop kernel: [ 7948.598538] gspca_main: ISOC data error: [1] len=0, status=-18 Hmm, error -18 is EXDEV, which according to Documentation/usb/error-codes.txt is: -EXDEV ISO transfer only partially completed (only set in iso_frame_desc[n].status, not urb-status) I've seen those before, and I think we should simply ignore them rather then log an error for them. Jean-Francois, what do you think? In fairness to Motion, the default JPEG quality listed in its configuration file is only 75%. I had upped this to 90% for clarity, but subsequently reverting to the default configuration file didn't stop these errors. That is a different JPG setting, that is the compression quality for the JPEG's motion saves to disk if it detects motion. We're are talking about the compression quality of the JPEG's going over the USB wire, which is controller by the driver, not by motion. They also remained after I increased the three vga_mode ratios to 6 / 8 or changed Line 2093 of sn9c20x.c to sd-quality = 75;. You mean the -18 error remain, right, that is expected, the ratios / sd-quality only fix the errors you were seeing previously. Entering either of the following commands before starting Motion didn't make any difference either. export LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so export LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so The other thing I'm wondering about is how to force SXGA (1280x1024) mode to be used. I've set the 'width' and 'height' variables in the Motion configuration file correctly, but I still see the following kernel output: Mar 6 08:37:46 Desktop kernel: [ 7448.680301] gspca_sn9c20x: Set 640x480 I should note that Motion defaults to V4L2_PIX_FMT_YUV420 in its configuration file, which is what I'd been using until now. From the look of the code in the sn9c20x.c file, I must use V4L2_PIX_FMT_SBGGR8 to get the 1280x1024 resolution. For sxga mode you will need to use libv4l, but I doubt if your camera supports it at all, most don't. What does dmesg say immediately after unplugging and replugging the camera? Regards, Hans -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 24/34] omap3isp: Assume media_entity_pipeline_start may fail
Hi Laurent, On Mon, Mar 05, 2012 at 12:26:44PM +0100, Laurent Pinchart wrote: Hi Sakari, Thanks for the patch. On Friday 02 March 2012 19:30:32 Sakari Ailus wrote: Since media_entity_pipeline_start() now does link validation, it may actually fail. Perform the error handling. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi --- drivers/media/video/omap3isp/ispvideo.c | 53 +-- 1 files changed, 29 insertions(+), 24 deletions(-) diff --git a/drivers/media/video/omap3isp/ispvideo.c b/drivers/media/video/omap3isp/ispvideo.c index b0d541b..f2621bc 100644 --- a/drivers/media/video/omap3isp/ispvideo.c +++ b/drivers/media/video/omap3isp/ispvideo.c @@ -997,14 +997,16 @@ isp_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type) pipe-l3_ick = clk_get_rate(video-isp-clock[ISP_CLK_L3_ICK]); pipe-max_rate = pipe-l3_ick; - media_entity_pipeline_start(video-video.entity, pipe-pipe); + ret = media_entity_pipeline_start(video-video.entity, pipe-pipe); + if (ret 0) + goto err_media_entity_pipeline_start; /* Verify that the currently configured format matches the output of * the connected subdev. */ ret = isp_video_check_format(video, vfh); if (ret 0) - goto error; + goto err_isp_video_check_format; video-bpl_padding = ret; video-bpl_value = vfh-format.fmt.pix.bytesperline; @@ -1021,7 +1023,7 @@ isp_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type) } else { if (far_end == NULL) { ret = -EPIPE; - goto error; + goto err_isp_video_check_format; } state = ISP_PIPELINE_STREAM_INPUT | ISP_PIPELINE_IDLE_INPUT; @@ -1032,7 +1034,7 @@ isp_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type) /* Validate the pipeline and update its state. */ ret = isp_video_validate_pipeline(pipe); if (ret 0) - goto error; + goto err_isp_video_check_format; pipe-error = false; @@ -1054,7 +1056,7 @@ isp_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type) ret = omap3isp_video_queue_streamon(vfh-queue); if (ret 0) - goto error; + goto err_isp_video_check_format; /* In sensor-to-memory mode, the stream can be started synchronously * to the stream on command. In memory-to-memory mode, it will be @@ -1064,32 +1066,35 @@ isp_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type) ret = omap3isp_pipeline_set_stream(pipe, ISP_PIPELINE_STREAM_CONTINUOUS); if (ret 0) - goto error; + goto err_omap3isp_set_stream; spin_lock_irqsave(video-queue-irqlock, flags); if (list_empty(video-dmaqueue)) video-dmaqueue_flags |= ISP_VIDEO_DMAQUEUE_UNDERRUN; spin_unlock_irqrestore(video-queue-irqlock, flags); } -error: - if (ret 0) { - omap3isp_video_queue_streamoff(vfh-queue); - media_entity_pipeline_stop(video-video.entity); - if (video-isp-pdata-set_constraints) - video-isp-pdata-set_constraints(video-isp, false); - /* The DMA queue must be emptied here, otherwise CCDC interrupts -* that will get triggered the next time the CCDC is powered up -* will try to access buffers that might have been freed but -* still present in the DMA queue. This can easily get triggered -* if the above omap3isp_pipeline_set_stream() call fails on a -* system with a free-running sensor. -*/ - INIT_LIST_HEAD(video-dmaqueue); - video-queue = NULL; - } + video-streaming = 1; + + mutex_unlock(video-stream_lock); + return 0; - if (!ret) - video-streaming = 1; +err_omap3isp_set_stream: + omap3isp_video_queue_streamoff(vfh-queue); +err_isp_video_check_format: + media_entity_pipeline_stop(video-video.entity); +err_media_entity_pipeline_start: Could you please shorten the labels a bit (err_set_stream, err_check_format and err_pipeline_start for instance) ? Fixed. + if (video-isp-pdata-set_constraints) + video-isp-pdata-set_constraints(video-isp, false); + /* The DMA queue must be emptied here, otherwise CCDC +* interrupts that will get triggered the next time the CCDC +* is powered up will try to access buffers that might have +* been freed but still present in the DMA queue. This can +* easily get triggered if the above +* omap3isp_pipeline_set_stream() call fails on a system with +* a free-running sensor. Please reindent the text to the 80 columns limits. I can
dma-buf feature tree: working model
Hi all, Since the inclusion of dma-buf buffer sharing framework in 3.3 (thanks to Dave Airlie primarily), I have been volunteered to be its maintainer. Obviously there is a need for some simple rules about the dma-buf feature tree, so here we are: - there will be a 'for-next' branch for (N+1), which will open around -Nrc1, and close about 1-2 weeks before the (N+1)merge opens. - there will be a 'fixes' branch, which will take fixes after the for-next pull request is sent upstream. - after -rc2, regression fixes only. - after -rc4/5, only revert and disable patches. The real fix should then be targeted at for-next. - to stop me from pushing useless stuff, I will merge my own patches only after sufficient review on our mailing lists. If you see me breaking this rule, please shout out at me _publicly_ at the top of your voice. Being a 'first-time-maintainer', I am very willing to learn on-the-job, though I might still take cover under the 'first-time-maintainer' umbrella [for sometime :)] for any stupid acts I might commit. The tree resides at: git://git.linaro.org/people/sumitsemwal/linux-dma-buf.git At present, the mailing lists are: linux-media@vger.kernel.org, dri-de...@lists.freedesktop.org, linaro-mm-...@lists.linaro.org, in addition to lkml. Comments, flames and suggestions highly welcome. (I have been 'influenced' quite a bit from Daniel Vetter's model for the drm/i915 -next tree [thank you, DanVet!], but any errors/omissions are entirely mine.) Thanks and regards, ~Sumit. -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/3] dma-buf: add support for kernel cpu access
Hi Daniel, On Tue, Mar 6, 2012 at 12:27 AM, Daniel Vetter daniel.vet...@ffwll.ch wrote: On Fri, Mar 2, 2012 at 23:24, Rob Clark robdcl...@gmail.com wrote: Perhaps we should check somewhere for required dmabuf ops fxns (like kmap_atomic here), rather than just calling unconditionally what might be a null ptr. At least put it in the WARN_ON(), but it might be nicer to catch a missing required fxns at export time, rather than waiting for an importer to try and call it. Less likely that way, for newly added required functions go unnoticed. (same comment applies below for the non-atomic variant.. and possibly some other existing dmabuf ops) Agreed, I'll rework the patch to do that when rebasing onto Sumit's latest tree. In addition, you'd not need to check for !dmabuf-ops since the export should already catch it. As I sent in the other mail a while back, could you please rebase on for-next at git://git.linaro.org/people/sumitsemwal/linux-dma-buf.git Best regards, ~Sumit. -Daniel -- -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFCv2 PATCH 0/9] Integration of videobuf2 with dmabuf
Hello everyone, This patchset is an incremental patch to patchset created by Sumit Semwal [1]. The patches are dedicated to help find a better solution for support of buffer sharing by V4L2 API. It is expected to start discussion on the final installment for dma-buf in vb2-dma-contig allocator. Current version of the patches contain little documentation. It is going to be fixed after achieving consensus about design for buffer exporting. Moreover the API between vb2-core and the allocator should be revised. The patches were successfully tested to cooperate with EXYNOS DRM driver using DMABUF mechanism. Please note, that the amount of changes to vb2-dma-contig.c was significant making the difference patch very difficult to read. The patchset makes use of dma_get_pages extension for DMA API, which is posted on a top of dma-mapping patches by Marek Szyprowski [4] [5]. The tree, that contains all needed patches, can be found here [6]. v2: - extended VIDIOC_EXPBUF argument from integer memoffset to struct v4l2_exportbuffer - added patch that breaks DMABUF spec on (un)map_atachment callcacks but allows to work with existing implementation of DMABUF prime in DRM - all dma-contig code refactoring patches were squashed - bugfixes v1: List of changes since [1]. - support for DMA api extension dma_get_pages, the function is used to retrieve pages used to create DMA mapping. - small fixes/code cleanup to videobuf2 - added prepare and finish callbacks to vb2 allocators, it is used keep consistency between dma-cpu acess to the memory (by Marek Szyprowski) - support for exporting of DMABUF buffer in V4L2 and Videobuf2, originated from [3]. - support for dma-buf exporting in vb2-dma-contig allocator - support for DMABUF for s5p-tv and s5p-fimc (capture interface) drivers, originated from [3] - changed handling for userptr buffers (by Marek Szyprowski, Andrzej Pietrasiewicz) - let mmap method to use dma_mmap_writecombine call (by Marek Szyprowski) [1] http://thread.gmane.org/gmane.linux.drivers.video-input-infrastructure/42966/focus=42968 [2] https://lkml.org/lkml/2011/12/26/29 [3] http://thread.gmane.org/gmane.linux.drivers.video-input-infrastructure/36354/focus=36355 [4] http://thread.gmane.org/gmane.linux.kernel.cross-arch/12819 [5] http://git.infradead.org/users/kmpark/linux-2.6-samsung/shortlog/refs/heads/3.3-rc5-dma-v7 [6] http://git.infradead.org/users/kmpark/linux-2.6-samsung/shortlog/refs/heads/3.3-rc5-vb2-dma-contig-dmabuf-drm Sumit Semwal (1): v4l: vb2: Add dma-contig allocator as dma_buf user Tomasz Stanislawski (8): v4l: vb2: fixes for DMABUF support v4l: vb2-dma-contig: update and code refactoring v4l: add buffer exporting via dmabuf v4l: vb2: add buffer exporting via dmabuf v4l: vb2-dma-contig: add support for DMABUF exporting v4l: vb2-dma-contig: change map/unmap behaviour v4l: fimc: integrate capture i-face with dmabuf v4l: s5p-tv: mixer: integrate with dmabuf drivers/media/video/Kconfig |1 + drivers/media/video/s5p-fimc/fimc-capture.c | 11 +- drivers/media/video/s5p-tv/Kconfig |1 + drivers/media/video/s5p-tv/mixer_video.c| 12 +- drivers/media/video/v4l2-compat-ioctl32.c |1 + drivers/media/video/v4l2-ioctl.c| 11 + drivers/media/video/videobuf2-core.c| 88 +++- drivers/media/video/videobuf2-dma-contig.c | 717 --- include/linux/videodev2.h | 20 + include/media/v4l2-ioctl.h |2 + include/media/videobuf2-core.h |8 +- 11 files changed, 779 insertions(+), 93 deletions(-) -- 1.7.5.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFCv2 PATCH 2/9] v4l: vb2-dma-contig: update and code refactoring
This patch combines updates and fixes to dma-contig allocator. Moreover the allocator code was refactored. The most important changes are: - functions were reordered - move compression of scatterlist to separete function - add support for multichunk but contiguous scatterlists - simplified implementation of vb2-dma-contig context structure - let mmap method to use dma_mmap_writecombine - add support for scatterlist in userptr mode Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com [mmap method] Signed-off-by: Andrzej Pietrasiewicz andrze...@samsung.com [scatterlist in userptr mode] Signed-off-by: Kamil Debski k.deb...@samsung.com [bugfixing] Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com [core refactoring, helper functions] Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com --- drivers/media/video/videobuf2-dma-contig.c | 495 +++- 1 files changed, 414 insertions(+), 81 deletions(-) diff --git a/drivers/media/video/videobuf2-dma-contig.c b/drivers/media/video/videobuf2-dma-contig.c index f17ad98..c1dc043 100644 --- a/drivers/media/video/videobuf2-dma-contig.c +++ b/drivers/media/video/videobuf2-dma-contig.c @@ -10,173 +10,506 @@ * the Free Software Foundation. */ +#include linux/dma-buf.h +#include linux/dma-mapping.h #include linux/module.h +#include linux/scatterlist.h +#include linux/sched.h #include linux/slab.h -#include linux/dma-mapping.h #include media/videobuf2-core.h #include media/videobuf2-memops.h -struct vb2_dc_conf { - struct device *dev; -}; - struct vb2_dc_buf { - struct vb2_dc_conf *conf; + struct device *dev; void*vaddr; - dma_addr_t dma_addr; unsigned long size; - struct vm_area_struct *vma; - atomic_trefcount; + dma_addr_t dma_addr; + struct sg_table *dma_sgt; + enum dma_data_direction dma_dir; + + /* MMAP related */ struct vb2_vmarea_handler handler; + atomic_trefcount; + struct sg_table *sgt_base; + + /* USERPTR related */ + struct vm_area_struct *vma; }; -static void vb2_dma_contig_put(void *buf_priv); +/*/ +/*scatterlist table functions*/ +/*/ -static void *vb2_dma_contig_alloc(void *alloc_ctx, unsigned long size) +static struct sg_table *vb2_dc_pages_to_sgt(struct page **pages, + unsigned long n_pages, size_t offset, size_t offset2) { - struct vb2_dc_conf *conf = alloc_ctx; - struct vb2_dc_buf *buf; + struct sg_table *sgt; + int i, j; /* loop counters */ + int cur_page, chunks; + int ret; + struct scatterlist *s; - buf = kzalloc(sizeof *buf, GFP_KERNEL); - if (!buf) + sgt = kzalloc(sizeof *sgt, GFP_KERNEL); + if (!sgt) return ERR_PTR(-ENOMEM); - buf-vaddr = dma_alloc_coherent(conf-dev, size, buf-dma_addr, - GFP_KERNEL); - if (!buf-vaddr) { - dev_err(conf-dev, dma_alloc_coherent of size %ld failed\n, - size); - kfree(buf); + /* compute number of chunks */ + chunks = 1; + for (i = 1; i n_pages; ++i) + if (pages[i] != pages[i - 1] + 1) + ++chunks; + + ret = sg_alloc_table(sgt, chunks, GFP_KERNEL); + if (ret) { + kfree(sgt); return ERR_PTR(-ENOMEM); } - buf-conf = conf; - buf-size = size; - - buf-handler.refcount = buf-refcount; - buf-handler.put = vb2_dma_contig_put; - buf-handler.arg = buf; + /* merging chunks and putting them into the scatterlist */ + cur_page = 0; + for_each_sg(sgt-sgl, s, sgt-orig_nents, i) { + size_t size = PAGE_SIZE; + + for (j = cur_page + 1; j n_pages; ++j) { + if (pages[j] != pages[j - 1] + 1) + break; + size += PAGE_SIZE; + } + + /* cut offset if chunk starts at the first page */ + if (cur_page == 0) + size -= offset; + /* cut offset2 if chunk ends at the last page */ + if (j == n_pages) + size -= offset2; + + sg_set_page(s, pages[cur_page], size, offset); + offset = 0; + cur_page = j; + } - atomic_inc(buf-refcount); + return sgt; +} - return buf; +static void vb2_dc_release_sgtable(struct sg_table *sgt) +{ + sg_free_table(sgt); + kfree(sgt); } -static void
[RFCv2 PATCH 5/9] v4l: vb2: add buffer exporting via dmabuf
This patch adds extension to videobuf2-core. It allow to export a mmap buffer as a file descriptor. Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com --- drivers/media/video/videobuf2-core.c | 64 ++ include/media/videobuf2-core.h |2 + 2 files changed, 66 insertions(+), 0 deletions(-) diff --git a/drivers/media/video/videobuf2-core.c b/drivers/media/video/videobuf2-core.c index e7df560..41c4bf8 100644 --- a/drivers/media/video/videobuf2-core.c +++ b/drivers/media/video/videobuf2-core.c @@ -1553,6 +1553,70 @@ int vb2_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, bool nonblocking) } EXPORT_SYMBOL_GPL(vb2_dqbuf); +static int __find_plane_by_offset(struct vb2_queue *q, unsigned long off, + unsigned int *_buffer, unsigned int *_plane); + +/** + * vb2_expbuf() - Export a buffer as a file descriptor + * @q: videobuf2 queue + * @b: export buffer structure passed from userspace to vidioc_expbuf + * handler in driver + * + * The return values from this function are intended to be directly returned + * from vidioc_expbuf handler in driver. + */ +int vb2_expbuf(struct vb2_queue *q, struct v4l2_exportbuffer *eb) +{ + struct vb2_buffer *vb = NULL; + struct vb2_plane *vb_plane; + unsigned int buffer, plane; + int ret; + struct dma_buf *dbuf; + + if (q-memory != V4L2_MEMORY_MMAP) { + dprintk(1, Queue is not currently set up for mmap\n); + return -EINVAL; + } + + if (!q-mem_ops-get_dmabuf) { + dprintk(1, Queue does not support DMA buffer exporting\n); + return -EINVAL; + } + + /* +* Find the plane corresponding to the offset passed by userspace. +*/ + ret = __find_plane_by_offset(q, eb-mem_offset, buffer, plane); + if (ret) { + dprintk(1, invalid offset %u\n, eb-mem_offset); + return ret; + } + + vb = q-bufs[buffer]; + vb_plane = vb-planes[plane]; + + dbuf = call_memop(q, get_dmabuf, vb_plane-mem_priv); + if (IS_ERR_OR_NULL(dbuf)) { + dprintk(1, Failed to export buffer %d, plane %d\n, + buffer, plane); + return -EINVAL; + } + + ret = dma_buf_fd(dbuf); + if (ret 0) { + dprintk(3, buffer %d, plane %d failed to export (%d)\n, + buffer, plane, ret); + return ret; + } + + dprintk(3, buffer %d, plane %d exported as %d descriptor\n, + buffer, plane, ret); + eb-fd = ret; + + return 0; +} +EXPORT_SYMBOL_GPL(vb2_expbuf); + /** * __vb2_queue_cancel() - cancel and stop (pause) streaming * diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h index 412c6a4..548252b 100644 --- a/include/media/videobuf2-core.h +++ b/include/media/videobuf2-core.h @@ -79,6 +79,7 @@ struct vb2_mem_ops { void(*prepare)(void *buf_priv); void(*finish)(void *buf_priv); void(*put)(void *buf_priv); + struct dma_buf *(*get_dmabuf)(void *buf_priv); void*(*get_userptr)(void *alloc_ctx, unsigned long vaddr, unsigned long size, int write); @@ -348,6 +349,7 @@ int vb2_queue_init(struct vb2_queue *q); void vb2_queue_release(struct vb2_queue *q); int vb2_qbuf(struct vb2_queue *q, struct v4l2_buffer *b); +int vb2_expbuf(struct vb2_queue *q, struct v4l2_exportbuffer *eb); int vb2_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, bool nonblocking); int vb2_streamon(struct vb2_queue *q, enum v4l2_buf_type type); -- 1.7.5.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFCv2 PATCH 7/9] v4l: vb2-dma-contig: change map/unmap behaviour
The DMABUF documentation says that the map_dma_buf callback should return scatterlist that is mapped into a caller's address space. In practice, almost none of existing implementations of DMABUF exporter does it. This patch breaks the DMABUF specification in order to allow exchange DMABUF buffers between other APIs like DRM. Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com --- drivers/media/video/videobuf2-dma-contig.c | 64 1 files changed, 27 insertions(+), 37 deletions(-) diff --git a/drivers/media/video/videobuf2-dma-contig.c b/drivers/media/video/videobuf2-dma-contig.c index d95b23a..32bb16b 100644 --- a/drivers/media/video/videobuf2-dma-contig.c +++ b/drivers/media/video/videobuf2-dma-contig.c @@ -315,11 +315,6 @@ static int vb2_dc_mmap(void *buf_priv, struct vm_area_struct *vma) /* DMABUF ops for exporters */ /*/ -struct vb2_dc_attachment { - struct sg_table sgt; - enum dma_data_direction dir; -}; - static int vb2_dc_dmabuf_ops_attach(struct dma_buf *dbuf, struct device *dev, struct dma_buf_attachment *dbuf_attach) { @@ -330,17 +325,13 @@ static int vb2_dc_dmabuf_ops_attach(struct dma_buf *dbuf, struct device *dev, static void vb2_dc_dmabuf_ops_detach(struct dma_buf *dbuf, struct dma_buf_attachment *db_attach) { - struct vb2_dc_attachment *attach = db_attach-priv; - struct sg_table *sgt; + struct sg_table *sgt = db_attach-priv; - if (!attach) + if (!sgt) return; - sgt = attach-sgt; - - dma_unmap_sg(db_attach-dev, sgt-sgl, sgt-nents, attach-dir); sg_free_table(sgt); - kfree(attach); + kfree(sgt); db_attach-priv = NULL; } @@ -349,26 +340,22 @@ static struct sg_table *vb2_dc_dmabuf_ops_map( { struct dma_buf *dbuf = db_attach-dmabuf; struct vb2_dc_buf *buf = dbuf-priv; - struct vb2_dc_attachment *attach = db_attach-priv; - struct sg_table *sgt; + struct sg_table *sgt = db_attach-priv; struct scatterlist *rd, *wr; int i, ret; /* return previously mapped sg table */ - if (attach) - return attach-sgt; + if (sgt) + return sgt; - attach = kzalloc(sizeof *attach, GFP_KERNEL); - if (!attach) + sgt = kzalloc(sizeof *sgt, GFP_KERNEL); + if (!sgt) return ERR_PTR(-ENOMEM); - sgt = attach-sgt; - attach-dir = dir; - /* copying the buf-base_sgt to attachment */ ret = sg_alloc_table(sgt, buf-sgt_base-orig_nents, GFP_KERNEL); if (ret) { - kfree(attach); + kfree(sgt); return ERR_PTR(-ENOMEM); } @@ -380,16 +367,7 @@ static struct sg_table *vb2_dc_dmabuf_ops_map( wr = sg_next(wr); } - /* mapping new sglist to the client */ - ret = dma_map_sg(db_attach-dev, sgt-sgl, sgt-orig_nents, dir); - if (ret = 0) { - printk(KERN_ERR failed to map scatterlist\n); - sg_free_table(sgt); - kfree(attach); - return ERR_PTR(-EIO); - } - - db_attach-priv = attach; + db_attach-priv = sgt; return sgt; } @@ -623,7 +601,7 @@ static int vb2_dc_map_dmabuf(void *mem_priv) struct vb2_dc_buf *buf = mem_priv; struct sg_table *sgt; unsigned long contig_size; - int ret = 0; + int ret = -EFAULT; if (WARN_ON(!buf-db_attach)) { printk(KERN_ERR trying to pin a non attached buffer\n); @@ -642,12 +620,20 @@ static int vb2_dc_map_dmabuf(void *mem_priv) return -EINVAL; } + /* mapping new sglist to the client */ + sgt-nents = dma_map_sg(buf-dev, sgt-sgl, sgt-orig_nents, + buf-dma_dir); + if (sgt-nents = 0) { + printk(KERN_ERR failed to map scatterlist\n); + goto fail_map_attachment; + } + /* checking if dmabuf is big enough to store contiguous chunk */ contig_size = vb2_dc_get_contiguous_size(sgt); if (contig_size buf-size) { - printk(KERN_ERR contiguous chunk of dmabuf is too small\n); - ret = -EFAULT; - goto fail_map; + printk(KERN_ERR contiguous chunk of dmabuf is too small + %lu/%lu bytes\n, contig_size, buf-size); + goto fail_map_sg; } buf-dma_addr = sg_dma_address(sgt-sgl); @@ -655,7 +641,10 @@ static int vb2_dc_map_dmabuf(void *mem_priv) return 0; -fail_map: +fail_map_sg: + dma_unmap_sg(buf-dev, sgt-sgl, sgt-nents, buf-dma_dir); + +fail_map_attachment: dma_buf_unmap_attachment(buf-db_attach, sgt); return ret; @@ -676,6 +665,7 @@ static void vb2_dc_unmap_dmabuf(void *mem_priv)
[RFCv2 PATCH 9/9] v4l: s5p-tv: mixer: integrate with dmabuf
Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com --- drivers/media/video/s5p-tv/Kconfig |1 + drivers/media/video/s5p-tv/mixer_video.c | 12 +++- 2 files changed, 12 insertions(+), 1 deletions(-) diff --git a/drivers/media/video/s5p-tv/Kconfig b/drivers/media/video/s5p-tv/Kconfig index f248b28..2e80126 100644 --- a/drivers/media/video/s5p-tv/Kconfig +++ b/drivers/media/video/s5p-tv/Kconfig @@ -10,6 +10,7 @@ config VIDEO_SAMSUNG_S5P_TV bool Samsung TV driver for S5P platform (experimental) depends on PLAT_S5P PM_RUNTIME depends on EXPERIMENTAL + select DMA_SHARED_BUFFER default n ---help--- Say Y here to enable selecting the TV output devices for diff --git a/drivers/media/video/s5p-tv/mixer_video.c b/drivers/media/video/s5p-tv/mixer_video.c index f7ca5cc..f08edbf 100644 --- a/drivers/media/video/s5p-tv/mixer_video.c +++ b/drivers/media/video/s5p-tv/mixer_video.c @@ -697,6 +697,15 @@ static int mxr_dqbuf(struct file *file, void *priv, struct v4l2_buffer *p) return vb2_dqbuf(layer-vb_queue, p, file-f_flags O_NONBLOCK); } +static int mxr_expbuf(struct file *file, void *priv, + struct v4l2_exportbuffer *eb) +{ + struct mxr_layer *layer = video_drvdata(file); + + mxr_dbg(layer-mdev, %s:%d\n, __func__, __LINE__); + return vb2_expbuf(layer-vb_queue, eb); +} + static int mxr_streamon(struct file *file, void *priv, enum v4l2_buf_type i) { struct mxr_layer *layer = video_drvdata(file); @@ -724,6 +733,7 @@ static const struct v4l2_ioctl_ops mxr_ioctl_ops = { .vidioc_querybuf = mxr_querybuf, .vidioc_qbuf = mxr_qbuf, .vidioc_dqbuf = mxr_dqbuf, + .vidioc_expbuf = mxr_expbuf, /* Streaming control */ .vidioc_streamon = mxr_streamon, .vidioc_streamoff = mxr_streamoff, @@ -1074,7 +1084,7 @@ struct mxr_layer *mxr_base_layer_create(struct mxr_device *mdev, layer-vb_queue = (struct vb2_queue) { .type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, - .io_modes = VB2_MMAP | VB2_USERPTR, + .io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF, .drv_priv = layer, .buf_struct_size = sizeof(struct mxr_buffer), .ops = mxr_video_qops, -- 1.7.5.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFCv2 PATCH 4/9] v4l: add buffer exporting via dmabuf
This patch adds extension to V4L2 api. It allow to export a mmap buffer as file descriptor. New ioctl VIDIOC_EXPBUF is added. It takes a buffer offset used by mmap and return a file descriptor on success. Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com --- drivers/media/video/v4l2-compat-ioctl32.c |1 + drivers/media/video/v4l2-ioctl.c | 11 +++ include/linux/videodev2.h | 20 include/media/v4l2-ioctl.h|2 ++ 4 files changed, 34 insertions(+), 0 deletions(-) diff --git a/drivers/media/video/v4l2-compat-ioctl32.c b/drivers/media/video/v4l2-compat-ioctl32.c index e6f67aa..fd157cb 100644 --- a/drivers/media/video/v4l2-compat-ioctl32.c +++ b/drivers/media/video/v4l2-compat-ioctl32.c @@ -954,6 +954,7 @@ long v4l2_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg) case VIDIOC_S_FBUF32: case VIDIOC_OVERLAY32: case VIDIOC_QBUF32: + case VIDIOC_EXPBUF: case VIDIOC_DQBUF32: case VIDIOC_STREAMON32: case VIDIOC_STREAMOFF32: diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c index 74cab51..a125016 100644 --- a/drivers/media/video/v4l2-ioctl.c +++ b/drivers/media/video/v4l2-ioctl.c @@ -207,6 +207,7 @@ static const char *v4l2_ioctls[] = { [_IOC_NR(VIDIOC_S_FBUF)] = VIDIOC_S_FBUF, [_IOC_NR(VIDIOC_OVERLAY)] = VIDIOC_OVERLAY, [_IOC_NR(VIDIOC_QBUF)] = VIDIOC_QBUF, + [_IOC_NR(VIDIOC_EXPBUF)] = VIDIOC_EXPBUF, [_IOC_NR(VIDIOC_DQBUF)]= VIDIOC_DQBUF, [_IOC_NR(VIDIOC_STREAMON)] = VIDIOC_STREAMON, [_IOC_NR(VIDIOC_STREAMOFF)]= VIDIOC_STREAMOFF, @@ -938,6 +939,16 @@ static long __video_do_ioctl(struct file *file, dbgbuf(cmd, vfd, p); break; } + case VIDIOC_EXPBUF: + { + struct v4l2_exportbuffer *p = arg; + + if (!ops-vidioc_expbuf) + break; + + ret = ops-vidioc_expbuf(file, fh, p); + break; + } case VIDIOC_DQBUF: { struct v4l2_buffer *p = arg; diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index bb6844e..e71c787 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -680,6 +680,25 @@ struct v4l2_buffer { #define V4L2_BUF_FLAG_NO_CACHE_INVALIDATE 0x0800 #define V4L2_BUF_FLAG_NO_CACHE_CLEAN 0x1000 +/** + * struct v4l2_exportbuffer - export of video buffer as DMABUF file descriptor + * + * @fd:file descriptor associated with DMABUF (set by driver) + * @mem_offset:for non-multiplanar buffers with memory == V4L2_MEMORY_MMAP; + * offset from the start of the device memory for this plane, + * (or a cookie that should be passed to mmap() as offset) + * + * Contains data used for exporting a video buffer as DMABUF file + * descriptor. Uses the same 'cookie' as mmap() syscall. All reserved fields + * must be set to zero. + */ +struct v4l2_exportbuffer { + __u32 fd; + __u32 reserved0; + __u32 mem_offset; + __u32 reserved[13]; +}; + /* * O V E R L A Y P R E V I E W */ @@ -2303,6 +2322,7 @@ struct v4l2_create_buffers { #define VIDIOC_S_FBUF _IOW('V', 11, struct v4l2_framebuffer) #define VIDIOC_OVERLAY _IOW('V', 14, int) #define VIDIOC_QBUF_IOWR('V', 15, struct v4l2_buffer) +#define VIDIOC_EXPBUF _IOWR('V', 16, struct v4l2_exportbuffer) #define VIDIOC_DQBUF _IOWR('V', 17, struct v4l2_buffer) #define VIDIOC_STREAMON _IOW('V', 18, int) #define VIDIOC_STREAMOFF_IOW('V', 19, int) diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h index 4df031a..d8716c6f 100644 --- a/include/media/v4l2-ioctl.h +++ b/include/media/v4l2-ioctl.h @@ -120,6 +120,8 @@ struct v4l2_ioctl_ops { int (*vidioc_reqbufs) (struct file *file, void *fh, struct v4l2_requestbuffers *b); int (*vidioc_querybuf)(struct file *file, void *fh, struct v4l2_buffer *b); int (*vidioc_qbuf)(struct file *file, void *fh, struct v4l2_buffer *b); + int (*vidioc_expbuf) (struct file *file, void *fh, + struct v4l2_exportbuffer *e); int (*vidioc_dqbuf) (struct file *file, void *fh, struct v4l2_buffer *b); int (*vidioc_create_bufs)(struct file *file, void *fh, struct v4l2_create_buffers *b); -- 1.7.5.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFCv2 PATCH 1/9] v4l: vb2: fixes for DMABUF support
This patch contains fixes to DMABUF support in vb2-core. - fixes number of arguments of call_memop macro - fixes setup of plane length - fixes handling of error pointers Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com --- drivers/media/video/videobuf2-core.c | 24 +++- include/media/videobuf2-core.h |6 +++--- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/drivers/media/video/videobuf2-core.c b/drivers/media/video/videobuf2-core.c index 951cb56..e7df560 100644 --- a/drivers/media/video/videobuf2-core.c +++ b/drivers/media/video/videobuf2-core.c @@ -118,7 +118,7 @@ static void __vb2_buf_dmabuf_put(struct vb2_buffer *vb) void *mem_priv = vb-planes[plane].mem_priv; if (mem_priv) { - call_memop(q, plane, detach_dmabuf, mem_priv); + call_memop(q, detach_dmabuf, mem_priv); dma_buf_put(vb-planes[plane].dbuf); vb-planes[plane].dbuf = NULL; vb-planes[plane].mem_priv = NULL; @@ -905,6 +905,8 @@ static int __fill_vb2_buffer(struct vb2_buffer *vb, const struct v4l2_buffer *b, } if (b-memory == V4L2_MEMORY_DMABUF) { for (plane = 0; plane vb-num_planes; ++plane) { + v4l2_planes[plane].bytesused = + b-m.planes[plane].bytesused; v4l2_planes[plane].m.fd = b-m.planes[plane].m.fd; } } @@ -1052,17 +1054,13 @@ static int __qbuf_dmabuf(struct vb2_buffer *vb, const struct v4l2_buffer *b) if (IS_ERR_OR_NULL(dbuf)) { dprintk(1, qbuf: invalid dmabuf fd for plane %d\n, plane); - ret = PTR_ERR(dbuf); + ret = -EINVAL; goto err; } - /* this doesn't get filled in until __fill_vb2_buffer(), -* since it isn't known until after dma_buf_get().. -*/ - planes[plane].length = dbuf-size; - /* Skip the plane if already verified */ if (dbuf == vb-planes[plane].dbuf) { + planes[plane].length = dbuf-size; dma_buf_put(dbuf); continue; } @@ -1072,7 +1070,7 @@ static int __qbuf_dmabuf(struct vb2_buffer *vb, const struct v4l2_buffer *b) /* Release previously acquired memory if present */ if (vb-planes[plane].mem_priv) { - call_memop(q, plane, detach_dmabuf, + call_memop(q, detach_dmabuf, vb-planes[plane].mem_priv); dma_buf_put(vb-planes[plane].dbuf); } @@ -1080,8 +1078,8 @@ static int __qbuf_dmabuf(struct vb2_buffer *vb, const struct v4l2_buffer *b) vb-planes[plane].mem_priv = NULL; /* Acquire each plane's memory */ - mem_priv = q-mem_ops-attach_dmabuf( - q-alloc_ctx[plane], dbuf); + mem_priv = call_memop(q, attach_dmabuf, q-alloc_ctx[plane], + dbuf, q-plane_sizes[plane], write); if (IS_ERR(mem_priv)) { dprintk(1, qbuf: failed acquiring dmabuf memory for plane %d\n, plane); @@ -1089,6 +1087,7 @@ static int __qbuf_dmabuf(struct vb2_buffer *vb, const struct v4l2_buffer *b) goto err; } + planes[plane].length = dbuf-size; vb-planes[plane].dbuf = dbuf; vb-planes[plane].mem_priv = mem_priv; } @@ -1098,8 +1097,7 @@ static int __qbuf_dmabuf(struct vb2_buffer *vb, const struct v4l2_buffer *b) * the buffer(s).. */ for (plane = 0; plane vb-num_planes; ++plane) { - ret = q-mem_ops-map_dmabuf( - vb-planes[plane].mem_priv, write); + ret = call_memop(q, map_dmabuf, vb-planes[plane].mem_priv); if (ret) { dprintk(1, qbuf: failed mapping dmabuf memory for plane %d\n, plane); @@ -1527,7 +1525,7 @@ int vb2_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, bool nonblocking) */ if (q-memory == V4L2_MEMORY_DMABUF) for (plane = 0; plane vb-num_planes; ++plane) - call_memop(q, plane, unmap_dmabuf, + call_memop(q, unmap_dmabuf, vb-planes[plane].mem_priv); switch (vb-state) { diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h index d8b8171..412c6a4 100644 ---
[RFCv2 PATCH 6/9] v4l: vb2-dma-contig: add support for DMABUF exporting
This patch adds support for exporting a dma-contig buffer using DMABUF interface. Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com --- drivers/media/video/videobuf2-dma-contig.c | 128 1 files changed, 128 insertions(+), 0 deletions(-) diff --git a/drivers/media/video/videobuf2-dma-contig.c b/drivers/media/video/videobuf2-dma-contig.c index 746dd5f..d95b23a 100644 --- a/drivers/media/video/videobuf2-dma-contig.c +++ b/drivers/media/video/videobuf2-dma-contig.c @@ -31,6 +31,7 @@ struct vb2_dc_buf { /* MMAP related */ struct vb2_vmarea_handler handler; atomic_trefcount; + struct dma_buf *dma_buf; struct sg_table *sgt_base; /* USERPTR related */ @@ -194,6 +195,8 @@ static void vb2_dc_put(void *buf_priv) if (!atomic_dec_and_test(buf-refcount)) return; + if (buf-dma_buf) + dma_buf_put(buf-dma_buf); vb2_dc_release_sgtable(buf-sgt_base); dma_free_coherent(buf-dev, buf-size, buf-vaddr, buf-dma_addr); @@ -309,6 +312,130 @@ static int vb2_dc_mmap(void *buf_priv, struct vm_area_struct *vma) } /*/ +/* DMABUF ops for exporters */ +/*/ + +struct vb2_dc_attachment { + struct sg_table sgt; + enum dma_data_direction dir; +}; + +static int vb2_dc_dmabuf_ops_attach(struct dma_buf *dbuf, struct device *dev, + struct dma_buf_attachment *dbuf_attach) +{ + /* nothing to be done */ + return 0; +} + +static void vb2_dc_dmabuf_ops_detach(struct dma_buf *dbuf, + struct dma_buf_attachment *db_attach) +{ + struct vb2_dc_attachment *attach = db_attach-priv; + struct sg_table *sgt; + + if (!attach) + return; + + sgt = attach-sgt; + + dma_unmap_sg(db_attach-dev, sgt-sgl, sgt-nents, attach-dir); + sg_free_table(sgt); + kfree(attach); + db_attach-priv = NULL; +} + +static struct sg_table *vb2_dc_dmabuf_ops_map( + struct dma_buf_attachment *db_attach, enum dma_data_direction dir) +{ + struct dma_buf *dbuf = db_attach-dmabuf; + struct vb2_dc_buf *buf = dbuf-priv; + struct vb2_dc_attachment *attach = db_attach-priv; + struct sg_table *sgt; + struct scatterlist *rd, *wr; + int i, ret; + + /* return previously mapped sg table */ + if (attach) + return attach-sgt; + + attach = kzalloc(sizeof *attach, GFP_KERNEL); + if (!attach) + return ERR_PTR(-ENOMEM); + + sgt = attach-sgt; + attach-dir = dir; + + /* copying the buf-base_sgt to attachment */ + ret = sg_alloc_table(sgt, buf-sgt_base-orig_nents, GFP_KERNEL); + if (ret) { + kfree(attach); + return ERR_PTR(-ENOMEM); + } + + rd = buf-sgt_base-sgl; + wr = sgt-sgl; + for (i = 0; i sgt-orig_nents; ++i) { + sg_set_page(wr, sg_page(rd), rd-length, rd-offset); + rd = sg_next(rd); + wr = sg_next(wr); + } + + /* mapping new sglist to the client */ + ret = dma_map_sg(db_attach-dev, sgt-sgl, sgt-orig_nents, dir); + if (ret = 0) { + printk(KERN_ERR failed to map scatterlist\n); + sg_free_table(sgt); + kfree(attach); + return ERR_PTR(-EIO); + } + + db_attach-priv = attach; + + return sgt; +} + +static void vb2_dc_dmabuf_ops_unmap(struct dma_buf_attachment *db_attach, + struct sg_table *sgt) +{ + /* nothing to be done here */ +} + +static void vb2_dc_dmabuf_ops_release(struct dma_buf *dbuf) +{ + /* drop reference obtained in vb2_dc_get_dmabuf */ + vb2_dc_put(dbuf-priv); +} + +static struct dma_buf_ops vb2_dc_dmabuf_ops = { + .attach = vb2_dc_dmabuf_ops_attach, + .detach = vb2_dc_dmabuf_ops_detach, + .map_dma_buf = vb2_dc_dmabuf_ops_map, + .unmap_dma_buf = vb2_dc_dmabuf_ops_unmap, + .release = vb2_dc_dmabuf_ops_release, +}; + +static struct dma_buf *vb2_dc_get_dmabuf(void *buf_priv) +{ + struct vb2_dc_buf *buf = buf_priv; + struct dma_buf *dbuf; + + if (buf-dma_buf) + return buf-dma_buf; + + /* dmabuf keeps reference to vb2 buffer */ + atomic_inc(buf-refcount); + dbuf = dma_buf_export(buf, vb2_dc_dmabuf_ops, buf-size, 0); + if (IS_ERR(dbuf)) { + atomic_dec(buf-refcount); + return NULL; + } + + buf-dma_buf = dbuf; + + return dbuf; +} + +/*/ /* callbacks for USERPTR buffers */ /*/ @@ -603,6 +730,7 @@ static void *vb2_dc_attach_dmabuf(void *alloc_ctx, struct
[RFCv2 PATCH 8/9] v4l: fimc: integrate capture i-face with dmabuf
Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com --- drivers/media/video/Kconfig |1 + drivers/media/video/s5p-fimc/fimc-capture.c | 11 ++- 2 files changed, 11 insertions(+), 1 deletions(-) diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 9495b6a..c9963f0 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig @@ -1099,6 +1099,7 @@ config VIDEO_SAMSUNG_S5P_FIMC VIDEO_V4L2_SUBDEV_API EXPERIMENTAL select VIDEOBUF2_DMA_CONTIG select V4L2_MEM2MEM_DEV + select DMA_SHARED_BUFFER ---help--- This is a v4l2 driver for Samsung S5P and EXYNOS4 camera host interface and video postprocessor. diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c b/drivers/media/video/s5p-fimc/fimc-capture.c index a9e9653..7ecc36b 100644 --- a/drivers/media/video/s5p-fimc/fimc-capture.c +++ b/drivers/media/video/s5p-fimc/fimc-capture.c @@ -1011,6 +1011,14 @@ static int fimc_cap_qbuf(struct file *file, void *priv, return vb2_qbuf(fimc-vid_cap.vbq, buf); } +static int fimc_cap_expbuf(struct file *file, void *priv, + struct v4l2_exportbuffer *eb) +{ + struct fimc_dev *fimc = video_drvdata(file); + + return vb2_expbuf(fimc-vid_cap.vbq, eb); +} + static int fimc_cap_dqbuf(struct file *file, void *priv, struct v4l2_buffer *buf) { @@ -1081,6 +1089,7 @@ static const struct v4l2_ioctl_ops fimc_capture_ioctl_ops = { .vidioc_qbuf= fimc_cap_qbuf, .vidioc_dqbuf = fimc_cap_dqbuf, + .vidioc_expbuf = fimc_cap_expbuf, .vidioc_streamon= fimc_cap_streamon, .vidioc_streamoff = fimc_cap_streamoff, @@ -1463,7 +1472,7 @@ int fimc_register_capture_device(struct fimc_dev *fimc, q = fimc-vid_cap.vbq; memset(q, 0, sizeof(*q)); q-type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; - q-io_modes = VB2_MMAP | VB2_USERPTR; + q-io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF; q-drv_priv = fimc-vid_cap.ctx; q-ops = fimc_capture_qops; q-mem_ops = vb2_dma_contig_memops; -- 1.7.5.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 2/2] v4l2: add new pixel formats supported on dm365
Hi Manju, On Mon, Mar 05, 2012 at 07:45:18AM +, Hadli, Manjunath wrote: On Sun, Mar 04, 2012 at 20:49:36, Sakari Ailus wrote: On Tue, Feb 07, 2012 at 03:35:14PM +0530, Manjunath Hadli wrote: add new macro V4L2_PIX_FMT_SGRBG10ALAW8 and associated formats to represent Bayer format frames compressed by A-LAW algorithm, add V4L2_PIX_FMT_UV8 to represent storage of C data (UV interleaved) only. Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com --- .../DocBook/media/v4l/pixfmt-srggb10alaw8.xml | 34 +++ Documentation/DocBook/media/v4l/pixfmt-uv8.xml | 62 Documentation/DocBook/media/v4l/pixfmt.xml |2 + include/linux/videodev2.h |9 +++ 4 files changed, 107 insertions(+), 0 deletions(-) create mode 100644 Documentation/DocBook/media/v4l/pixfmt-srggb10alaw8.xml create mode 100644 Documentation/DocBook/media/v4l/pixfmt-uv8.xml diff --git a/Documentation/DocBook/media/v4l/pixfmt-srggb10alaw8.xml b/Documentation/DocBook/media/v4l/pixfmt-srggb10alaw8.xml new file mode 100644 index 000..b20f525 --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-srggb10alaw8.xml @@ -0,0 +1,34 @@ + refentry + refmeta + refentrytitle + V4L2_PIX_FMT_SRGGB10ALAW8 ('aRA8'), + V4L2_PIX_FMT_SGBRG10ALAW8 ('aGA8'), + V4L2_PIX_FMT_SGRBG10ALAW8 ('agA8'), + V4L2_PIX_FMT_SBGGR10ALAW8 ('aBA8'), + /refentrytitle + manvol; + /refmeta + refnamediv + refname id=V4L2-PIX-FMT-SRGGB10ALAW8 + constantV4L2_PIX_FMT_SRGGB10ALAW8/constant + /refname + refname id=V4L2-PIX-FMT-SGRBG10ALAW8 + constantV4L2_PIX_FMT_SGRBG10ALAW8/constant + /refname + refname id=V4L2-PIX-FMT-SGBRG10ALAW8 + constantV4L2_PIX_FMT_SGBRG10ALAW8/constant + /refname The order here is different than earlier. I had taken a reference from your v3 patch series (v4l: Add DPCM compressed formats). Do you want me to change it? It certainly shouldn't be that way. I'll fix it for the next version. Regards, -- Sakari Ailus e-mail: sakari.ai...@iki.fi jabber/XMPP/Gmail: sai...@retiisi.org.uk -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 09/34] v4l: Add subdev selections documentation
Hi Laurent, On Mon, Mar 05, 2012 at 12:47:26PM +0100, Laurent Pinchart wrote: Hi Sakari, Thanks for the patch. Thanks for the comments! On Friday 02 March 2012 19:30:17 Sakari Ailus wrote: Add documentation for V4L2 subdev selection API. This changes also experimental V4L2 subdev API so that scaling now works through selection API only. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi [snip] diff --git a/Documentation/DocBook/media/v4l/dev-subdev.xml b/Documentation/DocBook/media/v4l/dev-subdev.xml index 0916a73..ef99da1 100644 --- a/Documentation/DocBook/media/v4l/dev-subdev.xml +++ b/Documentation/DocBook/media/v4l/dev-subdev.xml [snip] + paraThe scaling operation changes the size of the image by + scaling it to new dimensions. The scaling ratio isn't specified + explicitly, but is implied from the original and scaled image + sizes. Both sizes are represented by v4l2-rect;./para + + paraScaling support is optional. When supported by a subdev, + the crop rectangle on the subdev's sink pad is scaled to the + size configured using sub-subdev-g-selection; and + constantV4L2_SUBDEV_SEL_COMPOSE_ACTIVE/constant selection + target on the same pad. If the subdev supports scaling but no s/no/not/ (my bad, typo in my previous review) + composing, the top and left values are not used and must always + be set to zero./para s/// (don't copy the text blindly ;-)) Fixed. +section + titleOrder of configuration and format propagation/title + + paraInside subdevs, the order of image processing steps will + always be from the sink pad towards the source pad. This is also + reflected in the order in which the configuration must be + performed by the user: the changes made will be propagated to + any subsequent stages. If this behaviour is not desired, the + user must set + constantV4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG/constant flag. This + flag causes that no propagation of the changes are allowed in + any circumstances. This may also cause the accessed rectangle to + be adjusted by the driver, depending on the properties of the + underlying hardware. Some drivers may not support this + flag./para Haven't we agreed that supporting the flag should be mandatory ? Yes, but it may have been after I sent the patchset. Nevertheless, it's fixed now. + paraThe coordinates to a step always refer to the active size + of the previous step. The exception to this rule is the source + compose rectangle, which refers to the sink compose bounds + rectangle --- if it is supported by the hardware./para [snip] diff --git a/Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml b/Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml new file mode 100644 index 000..da1cc4f --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml [snip] +section + titleTypes of selection targets/title + + paraThe are two types of selection targets: active and bounds. s/The/There/ Fixed. Regards, -- Sakari Ailus e-mail: sakari.ai...@iki.fi jabber/XMPP/Gmail: sai...@retiisi.org.uk -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/5] MT9M032 and MT9P031 sensor patches
Hi everybody, Here are the MT9M032 and MT9P031 sensor patches that I'd like to push for v3.4. The mt9m032 is a new driver originally written by Martin Hostettler. I've taken over maintenance of the code and posted several enhancements patches to the list previously. This version is the result of those patches squashed into the original code. Danny Kukawka (1): mt9p031: Remove duplicate media/v4l2-subdev.h include Laurent Pinchart (3): mt9p031: Remove unused xskip and yskip fields in struct mt9p031 v4l: Aptina-style sensor PLL support mt9p031: Use generic PLL setup code Martin Hostettler (1): v4l: Add driver for Micron MT9M032 camera sensor drivers/media/video/Kconfig | 12 + drivers/media/video/Makefile |5 + drivers/media/video/aptina-pll.c | 174 drivers/media/video/aptina-pll.h | 56 +++ drivers/media/video/mt9m032.c| 823 ++ drivers/media/video/mt9p031.c| 67 ++-- include/media/mt9m032.h | 36 ++ 7 files changed, 1133 insertions(+), 40 deletions(-) create mode 100644 drivers/media/video/aptina-pll.c create mode 100644 drivers/media/video/aptina-pll.h create mode 100644 drivers/media/video/mt9m032.c create mode 100644 include/media/mt9m032.h -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/5] mt9p031: Remove unused xskip and yskip fields in struct mt9p031
The fields are set but never used, remove them. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/video/mt9p031.c |4 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/drivers/media/video/mt9p031.c b/drivers/media/video/mt9p031.c index dd937df..52dd9f8 100644 --- a/drivers/media/video/mt9p031.c +++ b/drivers/media/video/mt9p031.c @@ -114,8 +114,6 @@ struct mt9p031 { struct mt9p031_platform_data *pdata; struct mutex power_lock; /* lock to protect power_count */ int power_count; - u16 xskip; - u16 yskip; const struct mt9p031_pll_divs *pll; @@ -784,8 +782,6 @@ static int mt9p031_open(struct v4l2_subdev *subdev, struct v4l2_subdev_fh *fh) format-field = V4L2_FIELD_NONE; format-colorspace = V4L2_COLORSPACE_SRGB; - mt9p031-xskip = 1; - mt9p031-yskip = 1; return mt9p031_set_power(subdev, 1); } -- 1.7.3.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/5] mt9p031: Remove duplicate media/v4l2-subdev.h include
From: Danny Kukawka danny.kuka...@bisect.de drivers/media/video/mt9p031.c included 'media/v4l2-subdev.h' twice, remove the duplicate. Signed-off-by: Danny Kukawka danny.kuka...@bisect.de Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/video/mt9p031.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/drivers/media/video/mt9p031.c b/drivers/media/video/mt9p031.c index 93c3ec7..dd937df 100644 --- a/drivers/media/video/mt9p031.c +++ b/drivers/media/video/mt9p031.c @@ -19,7 +19,6 @@ #include linux/log2.h #include linux/pm.h #include linux/slab.h -#include media/v4l2-subdev.h #include linux/videodev2.h #include media/mt9p031.h -- 1.7.3.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/5] mt9p031: Use generic PLL setup code
Compute the PLL parameters at runtime using the generic Aptina PLL helper. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/video/Kconfig |1 + drivers/media/video/mt9p031.c | 62 ++--- 2 files changed, 28 insertions(+), 35 deletions(-) diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 7867b0b..666836d 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig @@ -473,6 +473,7 @@ config VIDEO_OV7670 config VIDEO_MT9P031 tristate Aptina MT9P031 support depends on I2C VIDEO_V4L2 VIDEO_V4L2_SUBDEV_API + select VIDEO_APTINA_PLL ---help--- This is a Video4Linux2 sensor-level driver for the Aptina (Micron) mt9p031 5 Mpixel camera. diff --git a/drivers/media/video/mt9p031.c b/drivers/media/video/mt9p031.c index 52dd9f8..3bcd14b 100644 --- a/drivers/media/video/mt9p031.c +++ b/drivers/media/video/mt9p031.c @@ -27,6 +27,8 @@ #include media/v4l2-device.h #include media/v4l2-subdev.h +#include aptina-pll.h + #define MT9P031_PIXEL_ARRAY_WIDTH 2752 #define MT9P031_PIXEL_ARRAY_HEIGHT 2004 @@ -97,14 +99,6 @@ #define MT9P031_TEST_PATTERN_RED 0xa2 #define MT9P031_TEST_PATTERN_BLUE 0xa3 -struct mt9p031_pll_divs { - u32 ext_freq; - u32 target_freq; - u8 m; - u8 n; - u8 p1; -}; - struct mt9p031 { struct v4l2_subdev subdev; struct media_pad pad; @@ -115,7 +109,7 @@ struct mt9p031 { struct mutex power_lock; /* lock to protect power_count */ int power_count; - const struct mt9p031_pll_divs *pll; + struct aptina_pll pll; /* Registers cache */ u16 output_control; @@ -183,33 +177,31 @@ static int mt9p031_reset(struct mt9p031 *mt9p031) 0); } -/* - * This static table uses ext_freq and vdd_io values to select suitable - * PLL dividers m, n and p1 which have been calculated as specifiec in p36 - * of Aptina's mt9p031 datasheet. New values should be added here. - */ -static const struct mt9p031_pll_divs mt9p031_divs[] = { - /* ext_freq target_freq m n p1 */ - {2100, 4800, 26, 2, 6} -}; - -static int mt9p031_pll_get_divs(struct mt9p031 *mt9p031) +static int mt9p031_pll_setup(struct mt9p031 *mt9p031) { + static const struct aptina_pll_limits limits = { + .ext_clock_min = 600, + .ext_clock_max = 2700, + .int_clock_min = 200, + .int_clock_max = 1350, + .out_clock_min = 18000, + .out_clock_max = 36000, + .pix_clock_max = 9600, + .n_min = 1, + .n_max = 64, + .m_min = 16, + .m_max = 255, + .p1_min = 1, + .p1_max = 128, + }; + struct i2c_client *client = v4l2_get_subdevdata(mt9p031-subdev); - int i; + struct mt9p031_platform_data *pdata = mt9p031-pdata; - for (i = 0; i ARRAY_SIZE(mt9p031_divs); i++) { - if (mt9p031_divs[i].ext_freq == mt9p031-pdata-ext_freq - mt9p031_divs[i].target_freq == mt9p031-pdata-target_freq) { - mt9p031-pll = mt9p031_divs[i]; - return 0; - } - } + mt9p031-pll.ext_clock = pdata-ext_freq; + mt9p031-pll.pix_clock = pdata-target_freq; - dev_err(client-dev, Couldn't find PLL dividers for ext_freq = %d, - target_freq = %d\n, mt9p031-pdata-ext_freq, - mt9p031-pdata-target_freq); - return -EINVAL; + return aptina_pll_calculate(client-dev, limits, mt9p031-pll); } static int mt9p031_pll_enable(struct mt9p031 *mt9p031) @@ -223,11 +215,11 @@ static int mt9p031_pll_enable(struct mt9p031 *mt9p031) return ret; ret = mt9p031_write(client, MT9P031_PLL_CONFIG_1, - (mt9p031-pll-m 8) | (mt9p031-pll-n - 1)); + (mt9p031-pll.m 8) | (mt9p031-pll.n - 1)); if (ret 0) return ret; - ret = mt9p031_write(client, MT9P031_PLL_CONFIG_2, mt9p031-pll-p1 - 1); + ret = mt9p031_write(client, MT9P031_PLL_CONFIG_2, mt9p031-pll.p1 - 1); if (ret 0) return ret; @@ -900,7 +892,7 @@ static int mt9p031_probe(struct i2c_client *client, mt9p031-format.field = V4L2_FIELD_NONE; mt9p031-format.colorspace = V4L2_COLORSPACE_SRGB; - ret = mt9p031_pll_get_divs(mt9p031); + ret = mt9p031_pll_setup(mt9p031); done: if (ret 0) { -- 1.7.3.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at
Re: [PATCH v4 16/34] media: Collect entities that are part of the pipeline before link validation
Hi Laurent, On Mon, Mar 05, 2012 at 12:13:39PM +0100, Laurent Pinchart wrote: On Friday 02 March 2012 19:30:24 Sakari Ailus wrote: Make information available which entities are part of the pipeline before link_validate() ops are being called. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi --- drivers/media/media-entity.c | 23 --- include/media/media-entity.h |1 + 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c index d6d0e81..55f66c6 100644 --- a/drivers/media/media-entity.c +++ b/drivers/media/media-entity.c @@ -220,12 +220,19 @@ __must_check int media_entity_pipeline_start(struct media_entity *entity, struct media_device *mdev = entity-parent; struct media_entity_graph graph; struct media_entity *entity_err = entity; + struct { + struct media_entity *entity; + struct media_link *link; + } to_validate[MEDIA_ENTITY_ENUM_MAX_DEPTH]; + int nto_validate = 0; int ret; mutex_lock(mdev-graph_mutex); media_entity_graph_walk_start(graph, entity); + pipe-entities = 0; + while ((entity = media_entity_graph_walk_next(graph))) { unsigned int i; @@ -237,6 +244,8 @@ __must_check int media_entity_pipeline_start(struct media_entity *entity, if (entity-stream_count 1) continue; + pipe-entities |= 1 entity-id; + if (!entity-ops || !entity-ops-link_validate) continue; @@ -251,12 +260,20 @@ __must_check int media_entity_pipeline_start(struct media_entity *entity, if (link-sink-entity != entity) continue; - ret = entity-ops-link_validate(link); - if (ret 0 ret != -ENOIOCTLCMD) - goto error; + BUG_ON(nto_validate = MEDIA_ENTITY_ENUM_MAX_DEPTH); + to_validate[nto_validate].entity = entity; + to_validate[nto_validate].link = link; + nto_validate++; } } + for (nto_validate--; nto_validate = 0; nto_validate--) { + ret = to_validate[nto_validate].entity-ops- + link_validate(to_validate[nto_validate].link); + if (ret 0 ret != -ENOIOCTLCMD) + goto error; + } + mutex_unlock(mdev-graph_mutex); return 0; diff --git a/include/media/media-entity.h b/include/media/media-entity.h index 0c16f51..bbfc8f2 100644 --- a/include/media/media-entity.h +++ b/include/media/media-entity.h @@ -27,6 +27,7 @@ #include linux/media.h struct media_pipeline { + u32 entities; This assume there will be no more than 32 entities. I don't think that's a safe assumption, especially with ALSA devices. I'm not sure I would put this in the media controller core just yet. Based our discussion online, I'm dropping this patch and replacing it with another which is specific to the omap3isp driver. Cheers, -- Sakari Ailus e-mail: sakari.ai...@iki.fi jabber/XMPP/Gmail: sai...@retiisi.org.uk -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 5/5] v4l: Add driver for Micron MT9M032 camera sensor
From: Martin Hostettler mar...@neutronstar.dyndns.org The MT9M032 is a parallel 1.6MP sensor from Micron controlled through I2C. The driver creates a V4L2 subdevice. It currently supports cropping, gain, exposure and v/h flipping controls in monochrome mode with an external pixel clock. Signed-off-by: Martin Hostettler mar...@neutronstar.dyndns.org --- drivers/media/video/Kconfig |8 + drivers/media/video/Makefile |1 + drivers/media/video/mt9m032.c | 823 + include/media/mt9m032.h | 36 ++ 4 files changed, 868 insertions(+), 0 deletions(-) create mode 100644 drivers/media/video/mt9m032.c create mode 100644 include/media/mt9m032.h diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 666836d..2611708 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig @@ -947,6 +947,14 @@ config SOC_CAMERA_MT9M001 This driver supports MT9M001 cameras from Micron, monochrome and colour models. +config VIDEO_MT9M032 + tristate MT9M032 camera sensor support + depends on I2C VIDEO_V4L2 + select VIDEO_APTINA_PLL + help + This driver supports MT9M032 cameras from Micron, monochrome + models only. + config SOC_CAMERA_MT9M111 tristate mt9m111, mt9m112 and mt9m131 support depends on SOC_CAMERA I2C diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index d1304e1..8e037e9 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile @@ -82,6 +82,7 @@ obj-$(CONFIG_VIDEO_AS3645A) += as3645a.o obj-$(CONFIG_SOC_CAMERA_IMX074)+= imx074.o obj-$(CONFIG_SOC_CAMERA_MT9M001) += mt9m001.o +obj-$(CONFIG_VIDEO_MT9M032) += mt9m032.o obj-$(CONFIG_SOC_CAMERA_MT9M111) += mt9m111.o obj-$(CONFIG_SOC_CAMERA_MT9T031) += mt9t031.o obj-$(CONFIG_SOC_CAMERA_MT9T112) += mt9t112.o diff --git a/drivers/media/video/mt9m032.c b/drivers/media/video/mt9m032.c new file mode 100644 index 000..8c69099 --- /dev/null +++ b/drivers/media/video/mt9m032.c @@ -0,0 +1,823 @@ +/* + * Driver for MT9M032 CMOS Image Sensor from Micron + * + * Copyright (C) 2010-2011 Lund Engineering + * Contact: Gil Lund gwl...@lundeng.com + * Author: Martin Hostettler mar...@neutronstar.dyndns.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#include linux/delay.h +#include linux/i2c.h +#include linux/init.h +#include linux/kernel.h +#include linux/math64.h +#include linux/module.h +#include linux/slab.h +#include linux/v4l2-mediabus.h + +#include media/media-entity.h +#include media/mt9m032.h +#include media/v4l2-ctrls.h +#include media/v4l2-device.h +#include media/v4l2-subdev.h + +#include aptina-pll.h + +#define MT9M032_CHIP_VERSION 0x00 +#define MT9M032_CHIP_VERSION_VALUE 0x1402 +#define MT9M032_ROW_START 0x01 +#define MT9M032_COLUMN_START 0x02 +#define MT9M032_ROW_SIZE 0x03 +#define MT9M032_COLUMN_SIZE0x04 +#define MT9M032_HBLANK 0x05 +#define MT9M032_VBLANK 0x06 +#define MT9M032_SHUTTER_WIDTH_HIGH 0x08 +#define MT9M032_SHUTTER_WIDTH_LOW 0x09 +#define MT9M032_PIX_CLK_CTRL 0x0a +#define MT9M032_PIX_CLK_CTRL_INV_PIXCLK0x8000 +#define MT9M032_RESTART0x0b +#define MT9M032_RESET 0x0d +#define MT9M032_PLL_CONFIG10x11 +#define MT9M032_PLL_CONFIG1_OUTDIV_MASK0x3f +#define MT9M032_PLL_CONFIG1_MUL_SHIFT 8 +#define MT9M032_READ_MODE1 0x1e +#define MT9M032_READ_MODE2 0x20 +#define MT9M032_READ_MODE2_VFLIP_SHIFT 15 +#define MT9M032_READ_MODE2_HFLIP_SHIFT 14 +#define MT9M032_READ_MODE2_ROW_BLC 0x40 +#define MT9M032_GAIN_GREEN10x2b +#define MT9M032_GAIN_BLUE 0x2c +#define MT9M032_GAIN_RED 0x2d +#define MT9M032_GAIN_GREEN20x2e + +/* write only */ +#define MT9M032_GAIN_ALL 0x35 +#define MT9M032_GAIN_DIGITAL_MASK 0x7f +#define MT9M032_GAIN_DIGITAL_SHIFT 8 +#define MT9M032_GAIN_AMUL_SHIFT6
[PATCH 3/5] v4l: Aptina-style sensor PLL support
Add a generic helper function to compute PLL parameters for PLL found in several Aptina sensors. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/video/Kconfig |3 + drivers/media/video/Makefile |4 + drivers/media/video/aptina-pll.c | 174 ++ drivers/media/video/aptina-pll.h | 56 4 files changed, 237 insertions(+), 0 deletions(-) create mode 100644 drivers/media/video/aptina-pll.c create mode 100644 drivers/media/video/aptina-pll.h diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 9495b6a..7867b0b 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig @@ -459,6 +459,9 @@ config VIDEO_AK881X comment Camera sensor devices +config VIDEO_APTINA_PLL + tristate + config VIDEO_OV7670 tristate OmniVision OV7670 sensor support depends on I2C VIDEO_V4L2 diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index 563443c..d1304e1 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile @@ -22,6 +22,10 @@ endif obj-$(CONFIG_VIDEO_V4L2_COMMON) += v4l2-common.o +# Helper modules + +obj-$(CONFIG_VIDEO_APTINA_PLL) += aptina-pll.o + # All i2c modules must come first: obj-$(CONFIG_VIDEO_TUNER) += tuner.o diff --git a/drivers/media/video/aptina-pll.c b/drivers/media/video/aptina-pll.c new file mode 100644 index 000..0bd3813 --- /dev/null +++ b/drivers/media/video/aptina-pll.c @@ -0,0 +1,174 @@ +/* + * Aptina Sensor PLL Configuration + * + * Copyright (C) 2012 Laurent Pinchart laurent.pinch...@ideasonboard.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#include linux/device.h +#include linux/gcd.h +#include linux/kernel.h +#include linux/lcm.h +#include linux/module.h + +#include aptina-pll.h + +int aptina_pll_calculate(struct device *dev, +const struct aptina_pll_limits *limits, +struct aptina_pll *pll) +{ + unsigned int mf_min; + unsigned int mf_max; + unsigned int p1_min; + unsigned int p1_max; + unsigned int p1; + unsigned int div; + + dev_dbg(dev, PLL: ext clock %u pix clock %u\n, + pll-ext_clock, pll-pix_clock); + + if (pll-ext_clock limits-ext_clock_min || + pll-ext_clock limits-ext_clock_max) { + dev_err(dev, pll: invalid external clock frequency.\n); + return -EINVAL; + } + + if (pll-pix_clock == 0 || pll-pix_clock limits-pix_clock_max) { + dev_err(dev, pll: invalid pixel clock frequency.\n); + return -EINVAL; + } + + /* Compute the multiplier M and combined N*P1 divisor. */ + div = gcd(pll-pix_clock, pll-ext_clock); + pll-m = pll-pix_clock / div; + div = pll-ext_clock / div; + + /* We now have the smallest M and N*P1 values that will result in the +* desired pixel clock frequency, but they might be out of the valid +* range. Compute the factor by which we should multiply them given the +* following constraints: +* +* - minimum/maximum multiplier +* - minimum/maximum multiplier output clock frequency assuming the +* minimum/maximum N value +* - minimum/maximum combined N*P1 divisor +*/ + mf_min = DIV_ROUND_UP(limits-m_min, pll-m); + mf_min = max(mf_min, limits-out_clock_min / +(pll-ext_clock / limits-n_min * pll-m)); + mf_min = max(mf_min, limits-n_min * limits-p1_min / div); + mf_max = limits-m_max / pll-m; + mf_max = min(mf_max, limits-out_clock_max / + (pll-ext_clock / limits-n_max * pll-m)); + mf_max = min(mf_max, DIV_ROUND_UP(limits-n_max * limits-p1_max, div)); + + dev_dbg(dev, pll: mf min %u max %u\n, mf_min, mf_max); + if (mf_min mf_max) { + dev_err(dev, pll: no valid combined N*P1 divisor.\n); + return -EINVAL; + } + + /* +* We're looking for the highest acceptable P1 value for which a +* multiplier factor MF exists that fulfills the following conditions: +* +* 1. p1 is in the [p1_min, p1_max] range given by the limits and is +*even +* 2. mf is in the [mf_min, mf_max] range computed
Re: [PATCH 3/5] v4l: Aptina-style sensor PLL support
Hi Laurent, On Tue, Mar 06, 2012 at 01:09:44PM +0100, Laurent Pinchart wrote: Add a generic helper function to compute PLL parameters for PLL found in several Aptina sensors. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Acked-by: Sakari Ailus sakari.ai...@iki.fi -- Sakari Ailus e-mail: sakari.ai...@iki.fi jabber/XMPP/Gmail: sai...@retiisi.org.uk -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: mx3-camera
Hi Alex (adding v4l and Sascha to CC) On Tue, 6 Mar 2012, Alex Gershgorin wrote: Hi Guennadi, I'm working on I.MX35 PDK platform with use 3.3.0-rc6 version of the Linux Kernel. Here is my Kernel boot message Linux video capture interface: v2.00 mx3-camera: probe of mx3-camera.0 failed with error -2 This error comes from probe function of mx3 camera host driver. Precisely in this part of the code: mx3_cam-clk = clk_get(pdev-dev, NULL); if (IS_ERR(mx3_cam-clk)) { err = PTR_ERR(mx3_cam-clk); goto eclkget; } I think, the reason is, that the i.MX35 platform doesn't register a camera clock, similar to i.MX31 (arch/arm/mach-imx/clock-imx31.c): _REGISTER_CLOCK(mx3-camera.0, NULL, csi_clk) Thanks Guennadi I will be glad for any help. Regards, Alex Gershgorin --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: mx3-camera
Thanks Guennadi, Hi Alex (adding v4l and Sascha to CC) On Tue, 6 Mar 2012, Alex Gershgorin wrote: Hi Guennadi, I'm working on I.MX35 PDK platform with use 3.3.0-rc6 version of the Linux Kernel. Here is my Kernel boot message Linux video capture interface: v2.00 mx3-camera: probe of mx3-camera.0 failed with error -2 This error comes from probe function of mx3 camera host driver. Precisely in this part of the code: mx3_cam-clk = clk_get(pdev-dev, NULL); if (IS_ERR(mx3_cam-clk)) { err = PTR_ERR(mx3_cam-clk); goto eclkget; } I think, the reason is, that the i.MX35 platform doesn't register a camera clock, similar to i.MX31 (arch/arm/mach-imx/clock-imx31.c): _REGISTER_CLOCK(mx3-camera.0, NULL, csi_clk) In i.MX35 (arch/arm/mach-imx/clock-imx35.c) it looks like this: _REGISTER_CLOCK(NULL, csi, csi_clk) I will be glad for any help. Regards, Alex Gershgorin -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] ivtv: Fix build warning
Am 04.03.2012 19:25, schrieb Larry Finger: In driver ivtv, there is a mismatch between the type of the radio module parameter and the storage variable, which leads to the following warning: CC [M] drivers/media/video/ivtv/ivtv-driver.o drivers/media/video/ivtv/ivtv-driver.c: In function ‘__check_radio’: drivers/media/video/ivtv/ivtv-driver.c:142: warning: return from incompatible pointer type drivers/media/video/ivtv/ivtv-driver.c: At top level: drivers/media/video/ivtv/ivtv-driver.c:142: warning: initialization from incompatible pointer type Signed-off-by: Larry Finger larry.fin...@lwfinger.net See my already twice send patches: http://thread.gmane.org/gmane.linux.kernel/1246476 Danny -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: mx3-camera
On Tue, Mar 6, 2012 at 10:22 AM, Alex Gershgorin al...@meprolight.com wrote: In i.MX35 (arch/arm/mach-imx/clock-imx35.c) it looks like this: _REGISTER_CLOCK(NULL, csi, csi_clk) Yes, I will submit a patch to fix this. Regards, Fabio Estevam -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: mx3-camera
On Tue, 6 Mar 2012, Alex Gershgorin wrote: Thanks Guennadi, Hi Alex (adding v4l and Sascha to CC) On Tue, 6 Mar 2012, Alex Gershgorin wrote: Hi Guennadi, I'm working on I.MX35 PDK platform with use 3.3.0-rc6 version of the Linux Kernel. Here is my Kernel boot message Linux video capture interface: v2.00 mx3-camera: probe of mx3-camera.0 failed with error -2 This error comes from probe function of mx3 camera host driver. Precisely in this part of the code: mx3_cam-clk = clk_get(pdev-dev, NULL); if (IS_ERR(mx3_cam-clk)) { err = PTR_ERR(mx3_cam-clk); goto eclkget; } I think, the reason is, that the i.MX35 platform doesn't register a camera clock, similar to i.MX31 (arch/arm/mach-imx/clock-imx31.c): _REGISTER_CLOCK(mx3-camera.0, NULL, csi_clk) In i.MX35 (arch/arm/mach-imx/clock-imx35.c) it looks like this: _REGISTER_CLOCK(NULL, csi, csi_clk) Right, so, you'll have to convert it to a suitable form, test and submit to Sascha;-) Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: mx3-camera
From: Alex Gershgorin Sent: Tuesday, March 06, 2012 3:22 PM To: Guennadi Liakhovetski Cc: linux-ker...@vger.kernel.org; Linux Media Mailing List; Sascha Hauer Subject: RE: mx3-camera Thanks Guennadi, Hi Alex (adding v4l and Sascha to CC) On Tue, 6 Mar 2012, Alex Gershgorin wrote: Hi Guennadi, I'm working on I.MX35 PDK platform with use 3.3.0-rc6 version of the Linux Kernel. Here is my Kernel boot message Linux video capture interface: v2.00 mx3-camera: probe of mx3-camera.0 failed with error -2 This error comes from probe function of mx3 camera host driver. Precisely in this part of the code: mx3_cam-clk = clk_get(pdev-dev, NULL); if (IS_ERR(mx3_cam-clk)) { err = PTR_ERR(mx3_cam-clk); goto eclkget; } I think, the reason is, that the i.MX35 platform doesn't register a camera clock, similar to i.MX31 (arch/arm/mach-imx/clock-imx31.c): _REGISTER_CLOCK(mx3-camera.0, NULL, csi_clk) In i.MX35 (arch/arm/mach-imx/clock-imx35.c) it looks like this: _REGISTER_CLOCK(NULL, csi, csi_clk) You were right, it should be _REGISTER_CLOCK(mx3-camera.0, NULL, csi_clk) I checked, now this error not appear :-) I will be glad for any help. Regards, Alex Gershgorin -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/2] as102: fix regression in kernel 3.3
When I first tried the as102 driver in the 3.3 kernel, I was pleased to notice that finally my stick was able to tune VHF channels. It never worked in VHF even with the original Kernellabs driver. But a few days ago a linux user from Melbourne, Ryley, contacted me to let me know he had a completely different experience: his Elgato stick was able to tune VHF channels with the 3.2 driver, but not with the 3.3 one. Ryley tracked down the issue to this patch: http://patchwork.linuxtv.org/patch/8332/ In that patch, #pragma pack(1) is replaced with __packed attributes, but it is not complete. Patch 1 fixes the regression. It also fixes the issue reported by Ryley, and his Elgato sticks works again with VHF channels. But this patch also breaks again VHF tuning with my reference design stick. So I investigated the real effect of the regression: it turned out that the only struct really affected was as10x_fw_context. The as10x_fw_context command is only used in two functions: as10x_cmd_set_context() and as10x_cmd_get_context(). as10x_cmd_get_context() is not used anywhere in the driver. as10x_cmd_set_context() is only used in one place in the driver: in function as102_fe_ts_bus_ctrl (file as102_fe.c, line 252): if (acquire) { if (elna_enable) as10x_cmd_set_context(dev-bus_adap, 1010, 0xC0); . So the command is only used to enable the eLNA (Low Noise Amplifier). In kernel 3.3, the command failed silently due to bad formatting, so the eLNA amplifier was never enabled. But disabling the eLNA amplifier is not optimal even for my stick, so I played with the eLNA configuration value (hardcoded to 0xC0 in the original code). I found that for my stick the optimal value is 0xA0. Patch 2 introduces device specific eLNA configuration values. With this patch, all as102 sticks should work out-of-the-box with both UHF and VHF channels. Gianluca Gennari (2): as102: add __packed attribute to structs defined inside packed structs as102: set optimal eLNA config values for each device drivers/staging/media/as102/as102_drv.h |2 +- drivers/staging/media/as102/as102_fe.c |2 +- drivers/staging/media/as102/as102_fw.h |2 +- drivers/staging/media/as102/as102_usb_drv.c | 15 +- drivers/staging/media/as102/as10x_cmd.h | 80 +- drivers/staging/media/as102/as10x_types.h |2 +- 6 files changed, 58 insertions(+), 45 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] as102: add __packed attribute to structs defined inside packed structs
This patch fixes a regression in kernel 3.3 due to this patch: http://patchwork.linuxtv.org/patch/8332/ That patch changes #pragma pack(1) with __packed attributes, but it is not complete. In fact, in the as102 driver there are a lot of structs/unions defined inside other structs/unions. When the __packed attribute is applied only on the external struct, it will not affect the internal struct definitions. So the regression is fixed by specifiying the __packed attribute also on the internal structs. This patch should go into 3.3, as it fixes a regression introduced in the new kernel version. Signed-off-by: Gianluca Gennari gennar...@gmail.com Signed-off-by: Ryley Angus ran...@student.unimelb.edu.au --- drivers/staging/media/as102/as102_fw.h|2 +- drivers/staging/media/as102/as10x_cmd.h | 80 ++-- drivers/staging/media/as102/as10x_types.h |2 +- 3 files changed, 42 insertions(+), 42 deletions(-) diff --git a/drivers/staging/media/as102/as102_fw.h b/drivers/staging/media/as102/as102_fw.h index bd21f05..4bfc684 100644 --- a/drivers/staging/media/as102/as102_fw.h +++ b/drivers/staging/media/as102/as102_fw.h @@ -29,7 +29,7 @@ struct as10x_fw_pkt_t { union { unsigned char request[2]; unsigned char length[2]; - } u; + } __packed u; struct as10x_raw_fw_pkt raw; } __packed; diff --git a/drivers/staging/media/as102/as10x_cmd.h b/drivers/staging/media/as102/as10x_cmd.h index 4ea249e..e21ec6c 100644 --- a/drivers/staging/media/as102/as10x_cmd.h +++ b/drivers/staging/media/as102/as10x_cmd.h @@ -99,14 +99,14 @@ union as10x_turn_on { struct { /* request identifier */ uint16_t proc_id; - } req; + } __packed req; /* response */ struct { /* response identifier */ uint16_t proc_id; /* error */ uint8_t error; - } rsp; + } __packed rsp; } __packed; union as10x_turn_off { @@ -114,14 +114,14 @@ union as10x_turn_off { struct { /* request identifier */ uint16_t proc_id; - } req; + } __packed req; /* response */ struct { /* response identifier */ uint16_t proc_id; /* error */ uint8_t err; - } rsp; + } __packed rsp; } __packed; union as10x_set_tune { @@ -131,14 +131,14 @@ union as10x_set_tune { uint16_t proc_id; /* tune params */ struct as10x_tune_args args; - } req; + } __packed req; /* response */ struct { /* response identifier */ uint16_t proc_id; /* response error */ uint8_t error; - } rsp; + } __packed rsp; } __packed; union as10x_get_tune_status { @@ -146,7 +146,7 @@ union as10x_get_tune_status { struct { /* request identifier */ uint16_t proc_id; - } req; + } __packed req; /* response */ struct { /* response identifier */ @@ -155,7 +155,7 @@ union as10x_get_tune_status { uint8_t error; /* tune status */ struct as10x_tune_status sts; - } rsp; + } __packed rsp; } __packed; union as10x_get_tps { @@ -163,7 +163,7 @@ union as10x_get_tps { struct { /* request identifier */ uint16_t proc_id; - } req; + } __packed req; /* response */ struct { /* response identifier */ @@ -172,7 +172,7 @@ union as10x_get_tps { uint8_t error; /* tps details */ struct as10x_tps tps; - } rsp; + } __packed rsp; } __packed; union as10x_common { @@ -180,14 +180,14 @@ union as10x_common { struct { /* request identifier */ uint16_t proc_id; - } req; + } __packed req; /* response */ struct { /* response identifier */ uint16_t proc_id; /* response error */ uint8_t error; - } rsp; + } __packed rsp; } __packed; union as10x_add_pid_filter { @@ -201,7 +201,7 @@ union as10x_add_pid_filter { uint8_t stream_type; /* PID index in filter table */ uint8_t idx; - } req; + } __packed req; /* response */ struct { /* response identifier */ @@ -210,7 +210,7 @@ union as10x_add_pid_filter { uint8_t error; /* Filter id */ uint8_t filter_id; - } rsp; + } __packed rsp; } __packed; union as10x_del_pid_filter { @@ -220,14 +220,14 @@ union as10x_del_pid_filter { uint16_t proc_id; /* PID to remove */
[PATCH 2/2] as102: set optimal eLNA config values for each device
Ryley and me tested several eLNA configuration values with both a rooftop and a portable antenna. Ryley fuond out that the best value for his Elgato stick is indeed the current default value 0xC0. Instead, my stick is not capable of tuning VHF channels with 0xC0. With 0x80, VHF works but the tuner sensitivity with the portable antenna is poor. Instead, the value 0xA0 works with VHF and also gives good performance with both the rooftop and the portable antenna. So we concluded that devices built on the reference design work best with 0xA0, while custom designs (Elgato, PCTV) seem to require 0xC0. I also removed the unused parameter minor in struct as102_dev_t. Signed-off-by: Gianluca Gennari gennar...@gmail.com Signed-off-by: Ryley Angus ran...@student.unimelb.edu.au --- drivers/staging/media/as102/as102_drv.h |2 +- drivers/staging/media/as102/as102_fe.c |2 +- drivers/staging/media/as102/as102_usb_drv.c | 15 ++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/staging/media/as102/as102_drv.h b/drivers/staging/media/as102/as102_drv.h index 957f0ed..b0e5a23 100644 --- a/drivers/staging/media/as102/as102_drv.h +++ b/drivers/staging/media/as102/as102_drv.h @@ -76,7 +76,7 @@ struct as102_dev_t { struct as10x_bus_adapter_t bus_adap; struct list_head device_entry; struct kref kref; - unsigned long minor; + uint8_t elna_cfg; struct dvb_adapter dvb_adap; struct dvb_frontend dvb_fe; diff --git a/drivers/staging/media/as102/as102_fe.c b/drivers/staging/media/as102/as102_fe.c index bdc5a38..9f2c610 100644 --- a/drivers/staging/media/as102/as102_fe.c +++ b/drivers/staging/media/as102/as102_fe.c @@ -265,7 +265,7 @@ static int as102_fe_ts_bus_ctrl(struct dvb_frontend *fe, int acquire) if (acquire) { if (elna_enable) - as10x_cmd_set_context(dev-bus_adap, 1010, 0xC0); + as10x_cmd_set_context(dev-bus_adap, CONTEXT_LNA, dev-elna_cfg); ret = as10x_cmd_turn_on(dev-bus_adap); } else { diff --git a/drivers/staging/media/as102/as102_usb_drv.c b/drivers/staging/media/as102/as102_usb_drv.c index d775be0..8b7357e 100644 --- a/drivers/staging/media/as102/as102_usb_drv.c +++ b/drivers/staging/media/as102/as102_usb_drv.c @@ -57,6 +57,17 @@ static const char * const as102_device_names[] = { NULL /* Terminating entry */ }; +/* eLNA configuration: devices built on the reference design work best + with 0xA0, while custom designs seem to require 0xC0 */ +static uint8_t const as102_elna_cfg[] = { + 0xA0, + 0xC0, + 0xC0, + 0xA0, + 0xA0, + 0x00 /* Terminating entry */ +}; + struct usb_driver as102_usb_driver = { .name = DRIVER_FULL_NAME, .probe = as102_usb_probe, @@ -369,8 +380,10 @@ static int as102_usb_probe(struct usb_interface *intf, /* Assign the user-friendly device name */ for (i = 0; i (sizeof(as102_usb_id_table) / sizeof(struct usb_device_id)); i++) { - if (id == as102_usb_id_table[i]) + if (id == as102_usb_id_table[i]) { as102_dev-name = as102_device_names[i]; + as102_dev-elna_cfg = as102_elna_cfg[i]; + } } if (as102_dev-name == NULL) -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V2]NEXT:drivers:staging:media Fix comments and some typos in staging/media/*
From: Justin P. Mattock justinmatt...@gmail.com linux-next: I like to spend some time reading code, in doing so I have found some typos in some of the comments. The patch below fixes what I have found. Signed-off-by: Justin P. Mattock justinmatt...@gmail.com --- drivers/staging/media/Kconfig |2 +- drivers/staging/media/as102/as102_drv.c|2 +- drivers/staging/media/as102/as102_fe.c |4 ++-- drivers/staging/media/go7007/go7007-v4l2.c |8 drivers/staging/media/lirc/lirc_serial.c |2 +- drivers/staging/media/solo6x10/Kconfig |2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/staging/media/Kconfig b/drivers/staging/media/Kconfig index 7e5caa3..4f4b7d6 100644 --- a/drivers/staging/media/Kconfig +++ b/drivers/staging/media/Kconfig @@ -6,7 +6,7 @@ menuconfig STAGING_MEDIA don't have the normal Linux kernel quality level. Most of them don't follow properly the V4L, DVB and/or RC API's, so, they won't likely work fine with the existing applications. - That also means that, one fixed, their API's will change to match + That also means that, once fixed, their API's will change to match the existing ones. If you wish to work on these drivers, to help improve them, or diff --git a/drivers/staging/media/as102/as102_drv.c b/drivers/staging/media/as102/as102_drv.c index aae0505..ea4f992 100644 --- a/drivers/staging/media/as102/as102_drv.c +++ b/drivers/staging/media/as102/as102_drv.c @@ -27,7 +27,7 @@ #include linux/uaccess.h #include linux/usb.h -/* header file for Usb device driver*/ +/* header file for usb device driver*/ #include as102_drv.h #include as102_fw.h #include dvbdev.h diff --git a/drivers/staging/media/as102/as102_fe.c b/drivers/staging/media/as102/as102_fe.c index bdc5a38..57daa8c 100644 --- a/drivers/staging/media/as102/as102_fe.c +++ b/drivers/staging/media/as102/as102_fe.c @@ -337,7 +337,7 @@ int as102_dvb_register_fe(struct as102_dev_t *as102_dev, strncpy(dvb_fe-ops.info.name, as102_dev-name, sizeof(dvb_fe-ops.info.name)); - /* register dbvb frontend */ + /* register dvb frontend */ errno = dvb_register_frontend(dvb_adap, dvb_fe); if (errno == 0) dvb_fe-tuner_priv = as102_dev; @@ -349,7 +349,7 @@ static void as10x_fe_copy_tps_parameters(struct dtv_frontend_properties *fe_tps, struct as10x_tps *as10x_tps) { - /* extract consteallation */ + /* extract constellation */ switch (as10x_tps-modulation) { case CONST_QPSK: fe_tps-modulation = QPSK; diff --git a/drivers/staging/media/go7007/go7007-v4l2.c b/drivers/staging/media/go7007/go7007-v4l2.c index 2b27d8d..f916586 100644 --- a/drivers/staging/media/go7007/go7007-v4l2.c +++ b/drivers/staging/media/go7007/go7007-v4l2.c @@ -1050,15 +1050,15 @@ static int vidioc_s_parm(struct file *filp, void *priv, return 0; } -/* VIDIOC_ENUMSTD on go7007 were used for enumberating the supported fps and +/* VIDIOC_ENUMSTD on go7007 were used for enumerating the supported fps and its resolution, when the device is not connected to TV. - This were an API abuse, probably used by the lack of specific IOCTL's to - enumberate it, by the time the driver were written. + This is were an API abuse, probably used by the lack of specific IOCTL's to + enumerate it, by the time the driver was written. However, since kernel 2.6.19, two new ioctls (VIDIOC_ENUM_FRAMEINTERVALS and VIDIOC_ENUM_FRAMESIZES) were added for this purpose. - The two functions bellow implements the newer ioctls + The two functions below implement the newer ioctls */ static int vidioc_enum_framesizes(struct file *filp, void *priv, struct v4l2_frmsizeenum *fsize) diff --git a/drivers/staging/media/lirc/lirc_serial.c b/drivers/staging/media/lirc/lirc_serial.c index 8dd8897..97352cf 100644 --- a/drivers/staging/media/lirc/lirc_serial.c +++ b/drivers/staging/media/lirc/lirc_serial.c @@ -1282,7 +1282,7 @@ MODULE_PARM_DESC(iommap, physical base for memory mapped I/O /* * some architectures (e.g. intel xscale) align the 8bit serial registers * on 32bit word boundaries. - * See linux-kernel/serial/8250.c serial_in()/out() + * See linux-kernel/drivers/tty/serial/8250/8250.c serial_in()/out() */ module_param(ioshift, int, S_IRUGO); MODULE_PARM_DESC(ioshift, shift I/O register offset (0 = no shift)); diff --git a/drivers/staging/media/solo6x10/Kconfig b/drivers/staging/media/solo6x10/Kconfig index 03dcac4..63352de 100644 --- a/drivers/staging/media/solo6x10/Kconfig +++ b/drivers/staging/media/solo6x10/Kconfig @@ -5,4 +5,4 @@ config SOLO6X10 select SND_PCM ---help--- This driver supports the Softlogic based MPEG-4 and h.264 codec - codec cards. + cards. -- 1.7.5.4 -- To
Re: [PATCH 5/5] v4l: Add driver for Micron MT9M032 camera sensor
Hi Laurent, Thanks for the patch. On Tue, Mar 06, 2012 at 01:09:46PM +0100, Laurent Pinchart wrote: From: Martin Hostettler mar...@neutronstar.dyndns.org The MT9M032 is a parallel 1.6MP sensor from Micron controlled through I2C. The driver creates a V4L2 subdevice. It currently supports cropping, gain, exposure and v/h flipping controls in monochrome mode with an external pixel clock. Signed-off-by: Martin Hostettler mar...@neutronstar.dyndns.org --- drivers/media/video/Kconfig |8 + drivers/media/video/Makefile |1 + drivers/media/video/mt9m032.c | 823 + include/media/mt9m032.h | 36 ++ 4 files changed, 868 insertions(+), 0 deletions(-) create mode 100644 drivers/media/video/mt9m032.c create mode 100644 include/media/mt9m032.h diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 666836d..2611708 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig @@ -947,6 +947,14 @@ config SOC_CAMERA_MT9M001 This driver supports MT9M001 cameras from Micron, monochrome and colour models. +config VIDEO_MT9M032 + tristate MT9M032 camera sensor support + depends on I2C VIDEO_V4L2 + select VIDEO_APTINA_PLL + help + This driver supports MT9M032 cameras from Micron, monochrome + models only. + config SOC_CAMERA_MT9M111 tristate mt9m111, mt9m112 and mt9m131 support depends on SOC_CAMERA I2C diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index d1304e1..8e037e9 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile @@ -82,6 +82,7 @@ obj-$(CONFIG_VIDEO_AS3645A) += as3645a.o obj-$(CONFIG_SOC_CAMERA_IMX074) += imx074.o obj-$(CONFIG_SOC_CAMERA_MT9M001) += mt9m001.o +obj-$(CONFIG_VIDEO_MT9M032) += mt9m032.o obj-$(CONFIG_SOC_CAMERA_MT9M111) += mt9m111.o obj-$(CONFIG_SOC_CAMERA_MT9T031) += mt9t031.o obj-$(CONFIG_SOC_CAMERA_MT9T112) += mt9t112.o diff --git a/drivers/media/video/mt9m032.c b/drivers/media/video/mt9m032.c new file mode 100644 index 000..8c69099 --- /dev/null +++ b/drivers/media/video/mt9m032.c @@ -0,0 +1,823 @@ +/* + * Driver for MT9M032 CMOS Image Sensor from Micron + * + * Copyright (C) 2010-2011 Lund Engineering + * Contact: Gil Lund gwl...@lundeng.com + * Author: Martin Hostettler mar...@neutronstar.dyndns.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#include linux/delay.h +#include linux/i2c.h +#include linux/init.h +#include linux/kernel.h +#include linux/math64.h +#include linux/module.h +#include linux/slab.h +#include linux/v4l2-mediabus.h + +#include media/media-entity.h +#include media/mt9m032.h +#include media/v4l2-ctrls.h +#include media/v4l2-device.h +#include media/v4l2-subdev.h + +#include aptina-pll.h + +#define MT9M032_CHIP_VERSION 0x00 +#define MT9M032_CHIP_VERSION_VALUE 0x1402 +#define MT9M032_ROW_START0x01 +#define MT9M032_COLUMN_START 0x02 +#define MT9M032_ROW_SIZE 0x03 +#define MT9M032_COLUMN_SIZE 0x04 +#define MT9M032_HBLANK 0x05 +#define MT9M032_VBLANK 0x06 +#define MT9M032_SHUTTER_WIDTH_HIGH 0x08 +#define MT9M032_SHUTTER_WIDTH_LOW0x09 +#define MT9M032_PIX_CLK_CTRL 0x0a +#define MT9M032_PIX_CLK_CTRL_INV_PIXCLK 0x8000 +#define MT9M032_RESTART 0x0b +#define MT9M032_RESET0x0d +#define MT9M032_PLL_CONFIG1 0x11 +#define MT9M032_PLL_CONFIG1_OUTDIV_MASK 0x3f +#define MT9M032_PLL_CONFIG1_MUL_SHIFT8 +#define MT9M032_READ_MODE1 0x1e +#define MT9M032_READ_MODE2 0x20 +#define MT9M032_READ_MODE2_VFLIP_SHIFT 15 +#define MT9M032_READ_MODE2_HFLIP_SHIFT 14 +#define MT9M032_READ_MODE2_ROW_BLC 0x40 +#define MT9M032_GAIN_GREEN1 0x2b +#define MT9M032_GAIN_BLUE0x2c +#define MT9M032_GAIN_RED 0x2d +#define MT9M032_GAIN_GREEN2 0x2e + +/* write only */ +#define
Re: [PATCH v4 08/34] v4l: Add subdev selections documentation: svg and dia files
On Mon, Mar 05, 2012 at 12:07:30PM +0100, Laurent Pinchart wrote: Hi Sakari, Thanks for the patch. This version is more readable. What about also making the red lines dotted/dashed ? Done. -- Sakari Ailus e-mail: sakari.ai...@iki.fi jabber/XMPP/Gmail: sai...@retiisi.org.uk -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
V4L2 MFC video decoding example application
Hi, I would like to inform you that the example application for the MFC driver has been prepared and was today released to the open source. The application demonstrates how to setup and handle video stream decoding. It uses MFC for video decoding and FIMC for post processing (color conversion and scaling). The resulting image is displayed using the frame buffer. The main goal was releasing a simple and easy to understand example application. I hope that it will prove useful and clear. The code can be found here: http://git.infradead.org/users/kmpark/public-apps/tree/HEAD:/v4l2-mfc-example Best wishes, -- Kamil Debski Linux Platform Group Samsung Poland RD Center The above message is intended solely for the named addressee and may contain trade secret, industrial technology or privileged and confidential information otherwise protected under applicable law. Any unauthorized dissemination, distribution, copying or use of the information contained in this communication is strictly prohibited. If you have received this communication in error, please notify sender by email and delete this communication immediately. Powyższa wiadomość przeznaczona jest wyłącznie dla adresata niniejszej wiadomości i może zawierać informacje będące tajemnicą handlową, tajemnicą przedsiębiorstwa oraz informacje o charakterze poufnym chronione obowiązującymi przepisami prawa. Jakiekolwiek nieuprawnione ich rozpowszechnianie, dystrybucja, kopiowanie lub użycie informacji zawartych w powyższej wiadomości jest zabronione. Jeśli otrzymałeś powyższą wiadomość omyłkowo, uprzejmie proszę poinformuj o tym fakcie drogą mailową nadawcę tej wiadomości oraz niezwłocznie usuń powyższą wiadomość ze swojego komputera.
Re: [PATCH v4 04/34] v4l: VIDIOC_SUBDEV_S_SELECTION and VIDIOC_SUBDEV_G_SELECTION IOCTLs
On Mon, Mar 05, 2012 at 11:59:22AM +0100, Laurent Pinchart wrote: Hi Sakari, Thanks for the patch. On Friday 02 March 2012 19:30:12 Sakari Ailus wrote: Add support for VIDIOC_SUBDEV_S_SELECTION and VIDIOC_SUBDEV_G_SELECTION IOCTLs. They replace functionality provided by VIDIOC_SUBDEV_S_CROP and VIDIOC_SUBDEV_G_CROP IOCTLs and also add new functionality (composing). VIDIOC_SUBDEV_G_CROP and VIDIOC_SUBDEV_S_CROP continue to be supported. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi Except for the ACTIVE name, Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Maybe we could discuss this on IRC with Tomasz ? Tomasz wasn't online when I checked. How about CURRENT? -- Sakari Ailus e-mail: sakari.ai...@iki.fi jabber/XMPP/Gmail: sai...@retiisi.org.uk -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 5/5] v4l: Add driver for Micron MT9M032 camera sensor
Hi Sakari, Thanks for the review. On Tuesday 06 March 2012 17:04:04 Sakari Ailus wrote: On Tue, Mar 06, 2012 at 01:09:46PM +0100, Laurent Pinchart wrote: From: Martin Hostettler mar...@neutronstar.dyndns.org The MT9M032 is a parallel 1.6MP sensor from Micron controlled through I2C. The driver creates a V4L2 subdevice. It currently supports cropping, gain, exposure and v/h flipping controls in monochrome mode with an external pixel clock. Signed-off-by: Martin Hostettler mar...@neutronstar.dyndns.org [snip] diff --git a/drivers/media/video/mt9m032.c b/drivers/media/video/mt9m032.c new file mode 100644 index 000..8c69099 --- /dev/null +++ b/drivers/media/video/mt9m032.c [snip] +struct mt9m032 { + struct v4l2_subdev subdev; + struct media_pad pad; + struct mt9m032_platform_data *pdata; + + struct v4l2_ctrl_handler ctrls; + struct { + struct v4l2_ctrl *hflip; + struct v4l2_ctrl *vflip; + }; + + bool streaming; + + int pix_clock; unsigned? No comment ;-) I'll fix this. + struct v4l2_mbus_framefmt format; + struct v4l2_rect crop; + struct v4l2_fract frame_interval; +}; [snip] +static unsigned long mt9m032_row_time(struct mt9m032 *sensor, int width) +{ + int effective_width; unsigned, this width? ... + u64 ns; + + effective_width = width + 716; /* emperical value */ + ns = div_u64(((u64)10) * effective_width, sensor-pix_clock); + dev_dbg(to_dev(sensor), MT9M032 line time: %llu ns\n, ns); The sensor is using rows internally for exposure as is SMIA++ sensor. Should we use a different control or the same? Some sensors also provide additional fine exposure control, which is in pixels. It doesn't make sense to change the fine exposure time except in very special situations, i.e. normally it's 0. I would prefer keeping the same control for now. We have enough new features to introduce already :-) + return ns; +} + +static int mt9m032_update_timing(struct mt9m032 *sensor, +struct v4l2_fract *interval) +{ + struct i2c_client *client = v4l2_get_subdevdata(sensor-subdev); + struct v4l2_rect *crop = sensor-crop; + unsigned long row_time; + unsigned int min_vblank; + unsigned int vblank; + + if (!interval) + interval = sensor-frame_interval; + + row_time = mt9m032_row_time(sensor, crop-width); + + vblank = div_u64(10ULL * interval-numerator, +((u64)interval-denominator) * row_time) + - crop-height; + + if (vblank MT9M032_MAX_BLANKING_ROWS) { + /* hardware limits to 11 bit values */ + interval-denominator = 1000; + interval-numerator = + div_u64((crop-height + MT9M032_MAX_BLANKING_ROWS) * + (u64)row_time * interval-denominator, + 10ULL); + vblank = div_u64(10ULL * interval-numerator, +((u64)interval-denominator) * row_time) + - crop-height; + } + /* enforce minimal 1.6ms blanking time. */ + min_vblank = 160 / row_time; + vblank = clamp_t(unsigned int, vblank, min_vblank, +MT9M032_MAX_BLANKING_ROWS); + + return mt9m032_write(client, MT9M032_VBLANK, vblank); +} You'd get rid of these calculations with the new sensor control interface. I'm fine with you starting to support that later on but that would change the user space API for this driver. Is that an issue? I don't see that as an issue. We still need the generic library so the applications still can use these drivers as in the past. [snip] +static int mt9m032_set_pad_format(struct v4l2_subdev *subdev, + struct v4l2_subdev_fh *fh, + struct v4l2_subdev_format *fmt) +{ + struct mt9m032 *sensor = to_mt9m032(subdev); + + if (sensor-streaming) + return -EBUSY; Setting try formats should succeed while streaming, shouldn't it? Yes. I'll fix that. + /* Scaling is not supported, the format is thus fixed. */ + return mt9m032_get_pad_format(subdev, fh, fmt); +} [snip] +static int mt9m032_set_crop(struct v4l2_subdev *subdev, + struct v4l2_subdev_fh *fh, + struct v4l2_subdev_crop *crop) +{ + struct mt9m032 *sensor = to_mt9m032(subdev); + struct v4l2_mbus_framefmt *format; + struct v4l2_rect *__crop; + struct v4l2_rect rect; + + if (sensor-streaming) + return -EBUSY; Same for crop. Will fix too. Selection API support would be nice here. Sure, once that gets in mainline :-) + rect.top = clamp(crop-rect.top, 0, +MT9M032_HEIGHT - MT9M032_MINIMALSIZE) ~1; + rect.left = clamp(crop-rect.left, 0, +
Re: [PATCH] ivtv: Fix build warning
On 03/06/2012 07:29 AM, Danny Kukawka wrote: Am 04.03.2012 19:25, schrieb Larry Finger: In driver ivtv, there is a mismatch between the type of the radio module parameter and the storage variable, which leads to the following warning: CC [M] drivers/media/video/ivtv/ivtv-driver.o drivers/media/video/ivtv/ivtv-driver.c: In function ‘__check_radio’: drivers/media/video/ivtv/ivtv-driver.c:142: warning: return from incompatible pointer type drivers/media/video/ivtv/ivtv-driver.c: At top level: drivers/media/video/ivtv/ivtv-driver.c:142: warning: initialization from incompatible pointer type Signed-off-by: Larry Fingerlarry.fin...@lwfinger.net See my already twice send patches: http://thread.gmane.org/gmane.linux.kernel/1246476 Thanks for the link, and the information that the warning is being fixed. Larry -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 5/5] v4l: Add driver for Micron MT9M032 camera sensor
Hi Laurent, On Tue, Mar 06, 2012 at 05:08:01PM +0100, Laurent Pinchart wrote: ... +struct mt9m032 { + struct v4l2_subdev subdev; + struct media_pad pad; + struct mt9m032_platform_data *pdata; + + struct v4l2_ctrl_handler ctrls; + struct { + struct v4l2_ctrl *hflip; + struct v4l2_ctrl *vflip; + }; + + bool streaming; + + int pix_clock; unsigned? No comment ;-) I'll fix this. :-) + struct v4l2_mbus_framefmt format; + struct v4l2_rect crop; + struct v4l2_fract frame_interval; +}; [snip] +static unsigned long mt9m032_row_time(struct mt9m032 *sensor, int width) +{ + int effective_width; unsigned, this width? ... + u64 ns; + + effective_width = width + 716; /* emperical value */ + ns = div_u64(((u64)10) * effective_width, sensor-pix_clock); + dev_dbg(to_dev(sensor), MT9M032 line time: %llu ns\n, ns); The sensor is using rows internally for exposure as is SMIA++ sensor. Should we use a different control or the same? Some sensors also provide additional fine exposure control, which is in pixels. It doesn't make sense to change the fine exposure time except in very special situations, i.e. normally it's 0. I would prefer keeping the same control for now. We have enough new features to introduce already :-) I'm fine with that. I agree we have more changes I would have hoped for, so let's not try to make more. + return ns; +} + +static int mt9m032_update_timing(struct mt9m032 *sensor, + struct v4l2_fract *interval) +{ + struct i2c_client *client = v4l2_get_subdevdata(sensor-subdev); + struct v4l2_rect *crop = sensor-crop; + unsigned long row_time; + unsigned int min_vblank; + unsigned int vblank; + + if (!interval) + interval = sensor-frame_interval; + + row_time = mt9m032_row_time(sensor, crop-width); + + vblank = div_u64(10ULL * interval-numerator, + ((u64)interval-denominator) * row_time) +- crop-height; + + if (vblank MT9M032_MAX_BLANKING_ROWS) { + /* hardware limits to 11 bit values */ + interval-denominator = 1000; + interval-numerator = + div_u64((crop-height + MT9M032_MAX_BLANKING_ROWS) * + (u64)row_time * interval-denominator, + 10ULL); + vblank = div_u64(10ULL * interval-numerator, + ((u64)interval-denominator) * row_time) +- crop-height; + } + /* enforce minimal 1.6ms blanking time. */ + min_vblank = 160 / row_time; + vblank = clamp_t(unsigned int, vblank, min_vblank, + MT9M032_MAX_BLANKING_ROWS); + + return mt9m032_write(client, MT9M032_VBLANK, vblank); +} You'd get rid of these calculations with the new sensor control interface. I'm fine with you starting to support that later on but that would change the user space API for this driver. Is that an issue? I don't see that as an issue. It's agreed then. ... +static int mt9m032_set_exposure(struct mt9m032 *sensor, s32 val) +{ + struct i2c_client *client = v4l2_get_subdevdata(sensor-subdev); + int shutter_width; + u16 high_val, low_val; + int ret; What's the unit of the exposure control? I'd use lines but I think this driver uses something else. The driver seems to use microseconds. I'm thinking about switching that to lines. What's your opinion ? It would probably simplify the driver and lessen the number of the changes that need to be done later on when switching over to the new sensor control interface, also to the user space interface. That said, before the user can get the pixel clock through the pixel rate control it's not possible to set the exposure time in seconds in a generic way. ... +struct mt9m032_platform_data { + u32 ext_clock; + u32 pix_clock; + int invert_pixclock; unsigned? bool ? Ack. Cheers, -- Sakari Ailus e-mail: sakari.ai...@iki.fi jabber/XMPP/Gmail: sai...@retiisi.org.uk -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 0/5] MT9M032 and MT9P031 sensor patches
Hi, Here's the second version of the MT9M032 and MT9P031 sensor patches for v3.4. Compared to v1, only patch 5/5 has been changed to incorporate Sakari's comments. I've modified the exposure control to use line units instead of microseconds, renamed various constants to mimic the MT9P031 driver and moved the hflip/vflip cluster creation after checking for control handler errors. Danny Kukawka (1): mt9p031: Remove duplicate media/v4l2-subdev.h include Laurent Pinchart (3): mt9p031: Remove unused xskip and yskip fields in struct mt9p031 v4l: Aptina-style sensor PLL support mt9p031: Use generic PLL setup code Martin Hostettler (1): v4l: Add driver for Micron MT9M032 camera sensor drivers/media/video/Kconfig | 12 + drivers/media/video/Makefile |5 + drivers/media/video/aptina-pll.c | 174 drivers/media/video/aptina-pll.h | 56 +++ drivers/media/video/mt9m032.c| 819 ++ drivers/media/video/mt9p031.c| 67 ++-- include/media/mt9m032.h | 36 ++ 7 files changed, 1129 insertions(+), 40 deletions(-) create mode 100644 drivers/media/video/aptina-pll.c create mode 100644 drivers/media/video/aptina-pll.h create mode 100644 drivers/media/video/mt9m032.c create mode 100644 include/media/mt9m032.h -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 1/5] mt9p031: Remove duplicate media/v4l2-subdev.h include
From: Danny Kukawka danny.kuka...@bisect.de drivers/media/video/mt9p031.c included 'media/v4l2-subdev.h' twice, remove the duplicate. Signed-off-by: Danny Kukawka danny.kuka...@bisect.de Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/video/mt9p031.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/drivers/media/video/mt9p031.c b/drivers/media/video/mt9p031.c index 93c3ec7..dd937df 100644 --- a/drivers/media/video/mt9p031.c +++ b/drivers/media/video/mt9p031.c @@ -19,7 +19,6 @@ #include linux/log2.h #include linux/pm.h #include linux/slab.h -#include media/v4l2-subdev.h #include linux/videodev2.h #include media/mt9p031.h -- 1.7.3.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 5/5] v4l: Add driver for Micron MT9M032 camera sensor
From: Martin Hostettler mar...@neutronstar.dyndns.org The MT9M032 is a parallel 1.6MP sensor from Micron controlled through I2C. The driver creates a V4L2 subdevice. It currently supports cropping, gain, exposure and v/h flipping controls in monochrome mode with an external pixel clock. Signed-off-by: Martin Hostettler mar...@neutronstar.dyndns.org [Lots of clean up, fixes and enhancements] Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/video/Kconfig |8 + drivers/media/video/Makefile |1 + drivers/media/video/mt9m032.c | 825 + include/media/mt9m032.h | 36 ++ 4 files changed, 870 insertions(+), 0 deletions(-) create mode 100644 drivers/media/video/mt9m032.c create mode 100644 include/media/mt9m032.h diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 666836d..2611708 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig @@ -947,6 +947,14 @@ config SOC_CAMERA_MT9M001 This driver supports MT9M001 cameras from Micron, monochrome and colour models. +config VIDEO_MT9M032 + tristate MT9M032 camera sensor support + depends on I2C VIDEO_V4L2 + select VIDEO_APTINA_PLL + help + This driver supports MT9M032 cameras from Micron, monochrome + models only. + config SOC_CAMERA_MT9M111 tristate mt9m111, mt9m112 and mt9m131 support depends on SOC_CAMERA I2C diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index d1304e1..8e037e9 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile @@ -82,6 +82,7 @@ obj-$(CONFIG_VIDEO_AS3645A) += as3645a.o obj-$(CONFIG_SOC_CAMERA_IMX074)+= imx074.o obj-$(CONFIG_SOC_CAMERA_MT9M001) += mt9m001.o +obj-$(CONFIG_VIDEO_MT9M032) += mt9m032.o obj-$(CONFIG_SOC_CAMERA_MT9M111) += mt9m111.o obj-$(CONFIG_SOC_CAMERA_MT9T031) += mt9t031.o obj-$(CONFIG_SOC_CAMERA_MT9T112) += mt9t112.o diff --git a/drivers/media/video/mt9m032.c b/drivers/media/video/mt9m032.c new file mode 100644 index 000..e8e966a --- /dev/null +++ b/drivers/media/video/mt9m032.c @@ -0,0 +1,825 @@ +/* + * Driver for MT9M032 CMOS Image Sensor from Micron + * + * Copyright (C) 2010-2011 Lund Engineering + * Contact: Gil Lund gwl...@lundeng.com + * Author: Martin Hostettler mar...@neutronstar.dyndns.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#include linux/delay.h +#include linux/i2c.h +#include linux/init.h +#include linux/kernel.h +#include linux/math64.h +#include linux/module.h +#include linux/slab.h +#include linux/v4l2-mediabus.h + +#include media/media-entity.h +#include media/mt9m032.h +#include media/v4l2-ctrls.h +#include media/v4l2-device.h +#include media/v4l2-subdev.h + +#include aptina-pll.h + +/* + * width and height include active boundary and black parts + * + * column0- 15 active boundry + * column 16-1455 image + * column 1456-1471 active boundry + * column 1472-1599 black + * + * row 0- 51 black + * row 53- 59 active boundry + * row 60-1139 image + * row1140-1147 active boundry + * row1148-1151 black + */ + +#define MT9M032_PIXEL_ARRAY_WIDTH 1600 +#define MT9M032_PIXEL_ARRAY_HEIGHT 1152 + +#define MT9M032_CHIP_VERSION 0x00 +#defineMT9M032_CHIP_VERSION_VALUE 0x1402 +#define MT9M032_ROW_START 0x01 +#defineMT9M032_ROW_START_MIN 0 +#defineMT9M032_ROW_START_MAX 1152 +#defineMT9M032_ROW_START_DEF 60 +#define MT9M032_COLUMN_START 0x02 +#defineMT9M032_COLUMN_START_MIN0 +#defineMT9M032_COLUMN_START_MAX1600 +#defineMT9M032_COLUMN_START_DEF16 +#define MT9M032_ROW_SIZE 0x03 +#defineMT9M032_ROW_SIZE_MIN32 +#defineMT9M032_ROW_SIZE_MAX1152 +#defineMT9M032_ROW_SIZE_DEF1080 +#define MT9M032_COLUMN_SIZE0x04 +#define
[PATCH v2 4/5] mt9p031: Use generic PLL setup code
Compute the PLL parameters at runtime using the generic Aptina PLL helper. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/video/Kconfig |1 + drivers/media/video/mt9p031.c | 62 ++--- 2 files changed, 28 insertions(+), 35 deletions(-) diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 7867b0b..666836d 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig @@ -473,6 +473,7 @@ config VIDEO_OV7670 config VIDEO_MT9P031 tristate Aptina MT9P031 support depends on I2C VIDEO_V4L2 VIDEO_V4L2_SUBDEV_API + select VIDEO_APTINA_PLL ---help--- This is a Video4Linux2 sensor-level driver for the Aptina (Micron) mt9p031 5 Mpixel camera. diff --git a/drivers/media/video/mt9p031.c b/drivers/media/video/mt9p031.c index 52dd9f8..3bcd14b 100644 --- a/drivers/media/video/mt9p031.c +++ b/drivers/media/video/mt9p031.c @@ -27,6 +27,8 @@ #include media/v4l2-device.h #include media/v4l2-subdev.h +#include aptina-pll.h + #define MT9P031_PIXEL_ARRAY_WIDTH 2752 #define MT9P031_PIXEL_ARRAY_HEIGHT 2004 @@ -97,14 +99,6 @@ #define MT9P031_TEST_PATTERN_RED 0xa2 #define MT9P031_TEST_PATTERN_BLUE 0xa3 -struct mt9p031_pll_divs { - u32 ext_freq; - u32 target_freq; - u8 m; - u8 n; - u8 p1; -}; - struct mt9p031 { struct v4l2_subdev subdev; struct media_pad pad; @@ -115,7 +109,7 @@ struct mt9p031 { struct mutex power_lock; /* lock to protect power_count */ int power_count; - const struct mt9p031_pll_divs *pll; + struct aptina_pll pll; /* Registers cache */ u16 output_control; @@ -183,33 +177,31 @@ static int mt9p031_reset(struct mt9p031 *mt9p031) 0); } -/* - * This static table uses ext_freq and vdd_io values to select suitable - * PLL dividers m, n and p1 which have been calculated as specifiec in p36 - * of Aptina's mt9p031 datasheet. New values should be added here. - */ -static const struct mt9p031_pll_divs mt9p031_divs[] = { - /* ext_freq target_freq m n p1 */ - {2100, 4800, 26, 2, 6} -}; - -static int mt9p031_pll_get_divs(struct mt9p031 *mt9p031) +static int mt9p031_pll_setup(struct mt9p031 *mt9p031) { + static const struct aptina_pll_limits limits = { + .ext_clock_min = 600, + .ext_clock_max = 2700, + .int_clock_min = 200, + .int_clock_max = 1350, + .out_clock_min = 18000, + .out_clock_max = 36000, + .pix_clock_max = 9600, + .n_min = 1, + .n_max = 64, + .m_min = 16, + .m_max = 255, + .p1_min = 1, + .p1_max = 128, + }; + struct i2c_client *client = v4l2_get_subdevdata(mt9p031-subdev); - int i; + struct mt9p031_platform_data *pdata = mt9p031-pdata; - for (i = 0; i ARRAY_SIZE(mt9p031_divs); i++) { - if (mt9p031_divs[i].ext_freq == mt9p031-pdata-ext_freq - mt9p031_divs[i].target_freq == mt9p031-pdata-target_freq) { - mt9p031-pll = mt9p031_divs[i]; - return 0; - } - } + mt9p031-pll.ext_clock = pdata-ext_freq; + mt9p031-pll.pix_clock = pdata-target_freq; - dev_err(client-dev, Couldn't find PLL dividers for ext_freq = %d, - target_freq = %d\n, mt9p031-pdata-ext_freq, - mt9p031-pdata-target_freq); - return -EINVAL; + return aptina_pll_calculate(client-dev, limits, mt9p031-pll); } static int mt9p031_pll_enable(struct mt9p031 *mt9p031) @@ -223,11 +215,11 @@ static int mt9p031_pll_enable(struct mt9p031 *mt9p031) return ret; ret = mt9p031_write(client, MT9P031_PLL_CONFIG_1, - (mt9p031-pll-m 8) | (mt9p031-pll-n - 1)); + (mt9p031-pll.m 8) | (mt9p031-pll.n - 1)); if (ret 0) return ret; - ret = mt9p031_write(client, MT9P031_PLL_CONFIG_2, mt9p031-pll-p1 - 1); + ret = mt9p031_write(client, MT9P031_PLL_CONFIG_2, mt9p031-pll.p1 - 1); if (ret 0) return ret; @@ -900,7 +892,7 @@ static int mt9p031_probe(struct i2c_client *client, mt9p031-format.field = V4L2_FIELD_NONE; mt9p031-format.colorspace = V4L2_COLORSPACE_SRGB; - ret = mt9p031_pll_get_divs(mt9p031); + ret = mt9p031_pll_setup(mt9p031); done: if (ret 0) { -- 1.7.3.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at
[PATCH v2 3/5] v4l: Aptina-style sensor PLL support
Add a generic helper function to compute PLL parameters for PLL found in several Aptina sensors. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Acked-by: Sakari Ailus sakari.ai...@iki.fi --- drivers/media/video/Kconfig |3 + drivers/media/video/Makefile |4 + drivers/media/video/aptina-pll.c | 174 ++ drivers/media/video/aptina-pll.h | 56 4 files changed, 237 insertions(+), 0 deletions(-) create mode 100644 drivers/media/video/aptina-pll.c create mode 100644 drivers/media/video/aptina-pll.h diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 9495b6a..7867b0b 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig @@ -459,6 +459,9 @@ config VIDEO_AK881X comment Camera sensor devices +config VIDEO_APTINA_PLL + tristate + config VIDEO_OV7670 tristate OmniVision OV7670 sensor support depends on I2C VIDEO_V4L2 diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index 563443c..d1304e1 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile @@ -22,6 +22,10 @@ endif obj-$(CONFIG_VIDEO_V4L2_COMMON) += v4l2-common.o +# Helper modules + +obj-$(CONFIG_VIDEO_APTINA_PLL) += aptina-pll.o + # All i2c modules must come first: obj-$(CONFIG_VIDEO_TUNER) += tuner.o diff --git a/drivers/media/video/aptina-pll.c b/drivers/media/video/aptina-pll.c new file mode 100644 index 000..0bd3813 --- /dev/null +++ b/drivers/media/video/aptina-pll.c @@ -0,0 +1,174 @@ +/* + * Aptina Sensor PLL Configuration + * + * Copyright (C) 2012 Laurent Pinchart laurent.pinch...@ideasonboard.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#include linux/device.h +#include linux/gcd.h +#include linux/kernel.h +#include linux/lcm.h +#include linux/module.h + +#include aptina-pll.h + +int aptina_pll_calculate(struct device *dev, +const struct aptina_pll_limits *limits, +struct aptina_pll *pll) +{ + unsigned int mf_min; + unsigned int mf_max; + unsigned int p1_min; + unsigned int p1_max; + unsigned int p1; + unsigned int div; + + dev_dbg(dev, PLL: ext clock %u pix clock %u\n, + pll-ext_clock, pll-pix_clock); + + if (pll-ext_clock limits-ext_clock_min || + pll-ext_clock limits-ext_clock_max) { + dev_err(dev, pll: invalid external clock frequency.\n); + return -EINVAL; + } + + if (pll-pix_clock == 0 || pll-pix_clock limits-pix_clock_max) { + dev_err(dev, pll: invalid pixel clock frequency.\n); + return -EINVAL; + } + + /* Compute the multiplier M and combined N*P1 divisor. */ + div = gcd(pll-pix_clock, pll-ext_clock); + pll-m = pll-pix_clock / div; + div = pll-ext_clock / div; + + /* We now have the smallest M and N*P1 values that will result in the +* desired pixel clock frequency, but they might be out of the valid +* range. Compute the factor by which we should multiply them given the +* following constraints: +* +* - minimum/maximum multiplier +* - minimum/maximum multiplier output clock frequency assuming the +* minimum/maximum N value +* - minimum/maximum combined N*P1 divisor +*/ + mf_min = DIV_ROUND_UP(limits-m_min, pll-m); + mf_min = max(mf_min, limits-out_clock_min / +(pll-ext_clock / limits-n_min * pll-m)); + mf_min = max(mf_min, limits-n_min * limits-p1_min / div); + mf_max = limits-m_max / pll-m; + mf_max = min(mf_max, limits-out_clock_max / + (pll-ext_clock / limits-n_max * pll-m)); + mf_max = min(mf_max, DIV_ROUND_UP(limits-n_max * limits-p1_max, div)); + + dev_dbg(dev, pll: mf min %u max %u\n, mf_min, mf_max); + if (mf_min mf_max) { + dev_err(dev, pll: no valid combined N*P1 divisor.\n); + return -EINVAL; + } + + /* +* We're looking for the highest acceptable P1 value for which a +* multiplier factor MF exists that fulfills the following conditions: +* +* 1. p1 is in the [p1_min, p1_max] range given by the limits and is +*even +* 2.
[PATCH v2 2/5] mt9p031: Remove unused xskip and yskip fields in struct mt9p031
The fields are set but never used, remove them. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/video/mt9p031.c |4 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/drivers/media/video/mt9p031.c b/drivers/media/video/mt9p031.c index dd937df..52dd9f8 100644 --- a/drivers/media/video/mt9p031.c +++ b/drivers/media/video/mt9p031.c @@ -114,8 +114,6 @@ struct mt9p031 { struct mt9p031_platform_data *pdata; struct mutex power_lock; /* lock to protect power_count */ int power_count; - u16 xskip; - u16 yskip; const struct mt9p031_pll_divs *pll; @@ -784,8 +782,6 @@ static int mt9p031_open(struct v4l2_subdev *subdev, struct v4l2_subdev_fh *fh) format-field = V4L2_FIELD_NONE; format-colorspace = V4L2_COLORSPACE_SRGB; - mt9p031-xskip = 1; - mt9p031-yskip = 1; return mt9p031_set_power(subdev, 1); } -- 1.7.3.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 04/34] v4l: VIDIOC_SUBDEV_S_SELECTION and VIDIOC_SUBDEV_G_SELECTION IOCTLs
On Tuesday 06 March 2012 17:50:36 Sakari Ailus wrote: On Mon, Mar 05, 2012 at 11:59:22AM +0100, Laurent Pinchart wrote: On Friday 02 March 2012 19:30:12 Sakari Ailus wrote: Add support for VIDIOC_SUBDEV_S_SELECTION and VIDIOC_SUBDEV_G_SELECTION IOCTLs. They replace functionality provided by VIDIOC_SUBDEV_S_CROP and VIDIOC_SUBDEV_G_CROP IOCTLs and also add new functionality (composing). VIDIOC_SUBDEV_G_CROP and VIDIOC_SUBDEV_S_CROP continue to be supported. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi Except for the ACTIVE name, Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Maybe we could discuss this on IRC with Tomasz ? Tomasz wasn't online when I checked. How about CURRENT? Sounds good to me. Let's see if Tomasz will be online tomorrow ;-) -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 0/5] MT9M032 and MT9P031 sensor patches
Hi, I've missed a 64-bit division issue in v2. Here's a v3 that fixes that. Sorry for the noise. Danny Kukawka (1): mt9p031: Remove duplicate media/v4l2-subdev.h include Laurent Pinchart (3): mt9p031: Remove unused xskip and yskip fields in struct mt9p031 v4l: Aptina-style sensor PLL support mt9p031: Use generic PLL setup code Martin Hostettler (1): v4l: Add driver for Micron MT9M032 camera sensor drivers/media/video/Kconfig | 12 + drivers/media/video/Makefile |5 + drivers/media/video/aptina-pll.c | 174 drivers/media/video/aptina-pll.h | 56 +++ drivers/media/video/mt9m032.c| 825 ++ drivers/media/video/mt9p031.c| 67 ++-- include/media/mt9m032.h | 36 ++ 7 files changed, 1135 insertions(+), 40 deletions(-) create mode 100644 drivers/media/video/aptina-pll.c create mode 100644 drivers/media/video/aptina-pll.h create mode 100644 drivers/media/video/mt9m032.c create mode 100644 include/media/mt9m032.h -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 1/5] mt9p031: Remove duplicate media/v4l2-subdev.h include
From: Danny Kukawka danny.kuka...@bisect.de drivers/media/video/mt9p031.c included 'media/v4l2-subdev.h' twice, remove the duplicate. Signed-off-by: Danny Kukawka danny.kuka...@bisect.de Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/video/mt9p031.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/drivers/media/video/mt9p031.c b/drivers/media/video/mt9p031.c index 93c3ec7..dd937df 100644 --- a/drivers/media/video/mt9p031.c +++ b/drivers/media/video/mt9p031.c @@ -19,7 +19,6 @@ #include linux/log2.h #include linux/pm.h #include linux/slab.h -#include media/v4l2-subdev.h #include linux/videodev2.h #include media/mt9p031.h -- 1.7.3.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 3/5] v4l: Aptina-style sensor PLL support
Add a generic helper function to compute PLL parameters for PLL found in several Aptina sensors. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Acked-by: Sakari Ailus sakari.ai...@iki.fi --- drivers/media/video/Kconfig |3 + drivers/media/video/Makefile |4 + drivers/media/video/aptina-pll.c | 174 ++ drivers/media/video/aptina-pll.h | 56 4 files changed, 237 insertions(+), 0 deletions(-) create mode 100644 drivers/media/video/aptina-pll.c create mode 100644 drivers/media/video/aptina-pll.h diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 9495b6a..7867b0b 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig @@ -459,6 +459,9 @@ config VIDEO_AK881X comment Camera sensor devices +config VIDEO_APTINA_PLL + tristate + config VIDEO_OV7670 tristate OmniVision OV7670 sensor support depends on I2C VIDEO_V4L2 diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index 563443c..d1304e1 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile @@ -22,6 +22,10 @@ endif obj-$(CONFIG_VIDEO_V4L2_COMMON) += v4l2-common.o +# Helper modules + +obj-$(CONFIG_VIDEO_APTINA_PLL) += aptina-pll.o + # All i2c modules must come first: obj-$(CONFIG_VIDEO_TUNER) += tuner.o diff --git a/drivers/media/video/aptina-pll.c b/drivers/media/video/aptina-pll.c new file mode 100644 index 000..0bd3813 --- /dev/null +++ b/drivers/media/video/aptina-pll.c @@ -0,0 +1,174 @@ +/* + * Aptina Sensor PLL Configuration + * + * Copyright (C) 2012 Laurent Pinchart laurent.pinch...@ideasonboard.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#include linux/device.h +#include linux/gcd.h +#include linux/kernel.h +#include linux/lcm.h +#include linux/module.h + +#include aptina-pll.h + +int aptina_pll_calculate(struct device *dev, +const struct aptina_pll_limits *limits, +struct aptina_pll *pll) +{ + unsigned int mf_min; + unsigned int mf_max; + unsigned int p1_min; + unsigned int p1_max; + unsigned int p1; + unsigned int div; + + dev_dbg(dev, PLL: ext clock %u pix clock %u\n, + pll-ext_clock, pll-pix_clock); + + if (pll-ext_clock limits-ext_clock_min || + pll-ext_clock limits-ext_clock_max) { + dev_err(dev, pll: invalid external clock frequency.\n); + return -EINVAL; + } + + if (pll-pix_clock == 0 || pll-pix_clock limits-pix_clock_max) { + dev_err(dev, pll: invalid pixel clock frequency.\n); + return -EINVAL; + } + + /* Compute the multiplier M and combined N*P1 divisor. */ + div = gcd(pll-pix_clock, pll-ext_clock); + pll-m = pll-pix_clock / div; + div = pll-ext_clock / div; + + /* We now have the smallest M and N*P1 values that will result in the +* desired pixel clock frequency, but they might be out of the valid +* range. Compute the factor by which we should multiply them given the +* following constraints: +* +* - minimum/maximum multiplier +* - minimum/maximum multiplier output clock frequency assuming the +* minimum/maximum N value +* - minimum/maximum combined N*P1 divisor +*/ + mf_min = DIV_ROUND_UP(limits-m_min, pll-m); + mf_min = max(mf_min, limits-out_clock_min / +(pll-ext_clock / limits-n_min * pll-m)); + mf_min = max(mf_min, limits-n_min * limits-p1_min / div); + mf_max = limits-m_max / pll-m; + mf_max = min(mf_max, limits-out_clock_max / + (pll-ext_clock / limits-n_max * pll-m)); + mf_max = min(mf_max, DIV_ROUND_UP(limits-n_max * limits-p1_max, div)); + + dev_dbg(dev, pll: mf min %u max %u\n, mf_min, mf_max); + if (mf_min mf_max) { + dev_err(dev, pll: no valid combined N*P1 divisor.\n); + return -EINVAL; + } + + /* +* We're looking for the highest acceptable P1 value for which a +* multiplier factor MF exists that fulfills the following conditions: +* +* 1. p1 is in the [p1_min, p1_max] range given by the limits and is +*even +* 2.
[PATCH v3 5/5] v4l: Add driver for Micron MT9M032 camera sensor
From: Martin Hostettler mar...@neutronstar.dyndns.org The MT9M032 is a parallel 1.6MP sensor from Micron controlled through I2C. The driver creates a V4L2 subdevice. It currently supports cropping, gain, exposure and v/h flipping controls in monochrome mode with an external pixel clock. Signed-off-by: Martin Hostettler mar...@neutronstar.dyndns.org [Lots of clean up, fixes and enhancements] Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/video/Kconfig |8 + drivers/media/video/Makefile |1 + drivers/media/video/mt9m032.c | 825 + include/media/mt9m032.h | 36 ++ 4 files changed, 870 insertions(+), 0 deletions(-) create mode 100644 drivers/media/video/mt9m032.c create mode 100644 include/media/mt9m032.h diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 666836d..2611708 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig @@ -947,6 +947,14 @@ config SOC_CAMERA_MT9M001 This driver supports MT9M001 cameras from Micron, monochrome and colour models. +config VIDEO_MT9M032 + tristate MT9M032 camera sensor support + depends on I2C VIDEO_V4L2 + select VIDEO_APTINA_PLL + help + This driver supports MT9M032 cameras from Micron, monochrome + models only. + config SOC_CAMERA_MT9M111 tristate mt9m111, mt9m112 and mt9m131 support depends on SOC_CAMERA I2C diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index d1304e1..8e037e9 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile @@ -82,6 +82,7 @@ obj-$(CONFIG_VIDEO_AS3645A) += as3645a.o obj-$(CONFIG_SOC_CAMERA_IMX074)+= imx074.o obj-$(CONFIG_SOC_CAMERA_MT9M001) += mt9m001.o +obj-$(CONFIG_VIDEO_MT9M032) += mt9m032.o obj-$(CONFIG_SOC_CAMERA_MT9M111) += mt9m111.o obj-$(CONFIG_SOC_CAMERA_MT9T031) += mt9t031.o obj-$(CONFIG_SOC_CAMERA_MT9T112) += mt9t112.o diff --git a/drivers/media/video/mt9m032.c b/drivers/media/video/mt9m032.c new file mode 100644 index 000..c3d69aa --- /dev/null +++ b/drivers/media/video/mt9m032.c @@ -0,0 +1,825 @@ +/* + * Driver for MT9M032 CMOS Image Sensor from Micron + * + * Copyright (C) 2010-2011 Lund Engineering + * Contact: Gil Lund gwl...@lundeng.com + * Author: Martin Hostettler mar...@neutronstar.dyndns.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#include linux/delay.h +#include linux/i2c.h +#include linux/init.h +#include linux/kernel.h +#include linux/math64.h +#include linux/module.h +#include linux/slab.h +#include linux/v4l2-mediabus.h + +#include media/media-entity.h +#include media/mt9m032.h +#include media/v4l2-ctrls.h +#include media/v4l2-device.h +#include media/v4l2-subdev.h + +#include aptina-pll.h + +/* + * width and height include active boundary and black parts + * + * column0- 15 active boundry + * column 16-1455 image + * column 1456-1471 active boundry + * column 1472-1599 black + * + * row 0- 51 black + * row 53- 59 active boundry + * row 60-1139 image + * row1140-1147 active boundry + * row1148-1151 black + */ + +#define MT9M032_PIXEL_ARRAY_WIDTH 1600 +#define MT9M032_PIXEL_ARRAY_HEIGHT 1152 + +#define MT9M032_CHIP_VERSION 0x00 +#defineMT9M032_CHIP_VERSION_VALUE 0x1402 +#define MT9M032_ROW_START 0x01 +#defineMT9M032_ROW_START_MIN 0 +#defineMT9M032_ROW_START_MAX 1152 +#defineMT9M032_ROW_START_DEF 60 +#define MT9M032_COLUMN_START 0x02 +#defineMT9M032_COLUMN_START_MIN0 +#defineMT9M032_COLUMN_START_MAX1600 +#defineMT9M032_COLUMN_START_DEF16 +#define MT9M032_ROW_SIZE 0x03 +#defineMT9M032_ROW_SIZE_MIN32 +#defineMT9M032_ROW_SIZE_MAX1152 +#defineMT9M032_ROW_SIZE_DEF1080 +#define MT9M032_COLUMN_SIZE0x04 +#define
[PATCH v3 2/5] mt9p031: Remove unused xskip and yskip fields in struct mt9p031
The fields are set but never used, remove them. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/video/mt9p031.c |4 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/drivers/media/video/mt9p031.c b/drivers/media/video/mt9p031.c index dd937df..52dd9f8 100644 --- a/drivers/media/video/mt9p031.c +++ b/drivers/media/video/mt9p031.c @@ -114,8 +114,6 @@ struct mt9p031 { struct mt9p031_platform_data *pdata; struct mutex power_lock; /* lock to protect power_count */ int power_count; - u16 xskip; - u16 yskip; const struct mt9p031_pll_divs *pll; @@ -784,8 +782,6 @@ static int mt9p031_open(struct v4l2_subdev *subdev, struct v4l2_subdev_fh *fh) format-field = V4L2_FIELD_NONE; format-colorspace = V4L2_COLORSPACE_SRGB; - mt9p031-xskip = 1; - mt9p031-yskip = 1; return mt9p031_set_power(subdev, 1); } -- 1.7.3.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 4/5] mt9p031: Use generic PLL setup code
Compute the PLL parameters at runtime using the generic Aptina PLL helper. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/video/Kconfig |1 + drivers/media/video/mt9p031.c | 62 ++--- 2 files changed, 28 insertions(+), 35 deletions(-) diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 7867b0b..666836d 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig @@ -473,6 +473,7 @@ config VIDEO_OV7670 config VIDEO_MT9P031 tristate Aptina MT9P031 support depends on I2C VIDEO_V4L2 VIDEO_V4L2_SUBDEV_API + select VIDEO_APTINA_PLL ---help--- This is a Video4Linux2 sensor-level driver for the Aptina (Micron) mt9p031 5 Mpixel camera. diff --git a/drivers/media/video/mt9p031.c b/drivers/media/video/mt9p031.c index 52dd9f8..3bcd14b 100644 --- a/drivers/media/video/mt9p031.c +++ b/drivers/media/video/mt9p031.c @@ -27,6 +27,8 @@ #include media/v4l2-device.h #include media/v4l2-subdev.h +#include aptina-pll.h + #define MT9P031_PIXEL_ARRAY_WIDTH 2752 #define MT9P031_PIXEL_ARRAY_HEIGHT 2004 @@ -97,14 +99,6 @@ #define MT9P031_TEST_PATTERN_RED 0xa2 #define MT9P031_TEST_PATTERN_BLUE 0xa3 -struct mt9p031_pll_divs { - u32 ext_freq; - u32 target_freq; - u8 m; - u8 n; - u8 p1; -}; - struct mt9p031 { struct v4l2_subdev subdev; struct media_pad pad; @@ -115,7 +109,7 @@ struct mt9p031 { struct mutex power_lock; /* lock to protect power_count */ int power_count; - const struct mt9p031_pll_divs *pll; + struct aptina_pll pll; /* Registers cache */ u16 output_control; @@ -183,33 +177,31 @@ static int mt9p031_reset(struct mt9p031 *mt9p031) 0); } -/* - * This static table uses ext_freq and vdd_io values to select suitable - * PLL dividers m, n and p1 which have been calculated as specifiec in p36 - * of Aptina's mt9p031 datasheet. New values should be added here. - */ -static const struct mt9p031_pll_divs mt9p031_divs[] = { - /* ext_freq target_freq m n p1 */ - {2100, 4800, 26, 2, 6} -}; - -static int mt9p031_pll_get_divs(struct mt9p031 *mt9p031) +static int mt9p031_pll_setup(struct mt9p031 *mt9p031) { + static const struct aptina_pll_limits limits = { + .ext_clock_min = 600, + .ext_clock_max = 2700, + .int_clock_min = 200, + .int_clock_max = 1350, + .out_clock_min = 18000, + .out_clock_max = 36000, + .pix_clock_max = 9600, + .n_min = 1, + .n_max = 64, + .m_min = 16, + .m_max = 255, + .p1_min = 1, + .p1_max = 128, + }; + struct i2c_client *client = v4l2_get_subdevdata(mt9p031-subdev); - int i; + struct mt9p031_platform_data *pdata = mt9p031-pdata; - for (i = 0; i ARRAY_SIZE(mt9p031_divs); i++) { - if (mt9p031_divs[i].ext_freq == mt9p031-pdata-ext_freq - mt9p031_divs[i].target_freq == mt9p031-pdata-target_freq) { - mt9p031-pll = mt9p031_divs[i]; - return 0; - } - } + mt9p031-pll.ext_clock = pdata-ext_freq; + mt9p031-pll.pix_clock = pdata-target_freq; - dev_err(client-dev, Couldn't find PLL dividers for ext_freq = %d, - target_freq = %d\n, mt9p031-pdata-ext_freq, - mt9p031-pdata-target_freq); - return -EINVAL; + return aptina_pll_calculate(client-dev, limits, mt9p031-pll); } static int mt9p031_pll_enable(struct mt9p031 *mt9p031) @@ -223,11 +215,11 @@ static int mt9p031_pll_enable(struct mt9p031 *mt9p031) return ret; ret = mt9p031_write(client, MT9P031_PLL_CONFIG_1, - (mt9p031-pll-m 8) | (mt9p031-pll-n - 1)); + (mt9p031-pll.m 8) | (mt9p031-pll.n - 1)); if (ret 0) return ret; - ret = mt9p031_write(client, MT9P031_PLL_CONFIG_2, mt9p031-pll-p1 - 1); + ret = mt9p031_write(client, MT9P031_PLL_CONFIG_2, mt9p031-pll.p1 - 1); if (ret 0) return ret; @@ -900,7 +892,7 @@ static int mt9p031_probe(struct i2c_client *client, mt9p031-format.field = V4L2_FIELD_NONE; mt9p031-format.colorspace = V4L2_COLORSPACE_SRGB; - ret = mt9p031_pll_get_divs(mt9p031); + ret = mt9p031_pll_setup(mt9p031); done: if (ret 0) { -- 1.7.3.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at
[PATCH v5 0/35] V4L2 subdev and sensor control changes, SMIA++ driver and N9 camera board code
Hi everyone, This the fifth version of my patchset that contains: - Integer menu controls [2], - Selection IOCTL for subdevs [3], - Sensor control changes [5,7], - link_validate() media entity and V4L2 subdev pad ops, - OMAP 3 ISP driver improvements [4], - SMIA++ sensor driver, - rm680/rm696 board code (a.k.a Nokia N9 and N950) and - Other V4L2 and media improvements (see individual patches) The Docbook documentation in HTML format can be found in [15] (v3 documentation available in [11] and v4 in [13]). The issue with ACTIVE target names still needs to be addressed. The current proposal is CURRENT. To be discussed on IRC. Changes to version 4 [16]: - V4L2 / V4L2 subdev - Documentation - Spelling fixes - Red lines in diagrams dotted instead of solid - Proper ordering of raw bayer formats - SMIA++ driver - PLL code separated from the actual driver - Source pads are always zero now - Error handling fixes in nvm reading - Try format pixel code handling fixes - Miscellaneous code cleanups - Media controller - Dropped the patch to find entities; moved to omap3isp driver instead - OMAP 3 ISP - Find out external entity's pad number, don't assume zero (new patch) - Small cleanups - Entities in pipeline stored in struct isp_pipeline Changes to version 3 [12] include: - OMAP 3 ISP - Rework ISP driver patches - Remove code from isp_video_pipeline_validate in same patch as the functionality is added elsewhere (old patch to remove leftovers dropped) - isp_video_streamon() error handling cleanups - All pipeline validation performed before any s_straem subdev ops - Resizer data rate check moved to link validation - CCDC rate checked in isp_video_check_external_subdeva() - Formats checked during link validation - Remove means to set pixel rate (new patch) - Don't set link_validate pad ops where the default is sufficient - Media controller - media_entity_pipeline_start() collects information on entities in pipeline - link validation error handling fix - V4L2 / V4L2 subdev - Less confusing selection example diagrams - Selection documentation improvements (as also suggested by Laurent) - SMIA++ driver - Fixes according to Laurent's suggestions [14] - Locking fixes and power handling cleanups Changes to version 2 [10] include: - V4L2 - Image source controls - Documentation no longer refers to pixel clock in v4l2_mbus_framefmt (this should have been the last reference to those!!) - Capitalise first letters in control names - Selections - Use hex numbers for targets - Return NULL instead of invalid pointer when accessing non-existend pads in v4l2_subdev_get_try_{format,crop,compose} (new patch) - Put link validation definitions in v4l2-subdev.h behind #ifdef CONFIG_MEDIA_CONTROLLER ... #endif - Spelling fixes (selections and 4cc guidelines) - Change vdev_to_v4l2_subdev() return type to struct v4l2_subdev * (new patch) - SMIA++ driver - Clock tree calculation fixes - Control handler setup usage fixes at smiapp_open() - Don't access non-existent pads Changes to version 1 [8] include: - OMAP 3 ISP driver - Swapped order of csi receiver's lane definitions - Rewrote omap 3 isp link validation patches almost completely - Information on connected external entity collected to isp_pipeline - Information collected during link checking and used at streamon - Media entity link validation - Error handling fixes - SMIA++ driver - Selection API bugfixes - Report correct pixel order right from boot - Move link rate control to subdev connected to subdev external to the sensor (e.g. ISP's CSI-2 receiver) - Introduce proper serialisation - Deny changing some controls when streaming (flipping and link rate) - Control handler setup moved from streamon time to first subdev open - There is no source compose target - Bugfixes - Media bus pixel codes - Documentation fix for dpcm compressed formats - Added patch for 4CC guidelines (raw bayer only for now) - Selections - Improved selections documentation - Added more selections examples - Compose target is not available on source pads anymore [9] - Dropped default targets - V4L2 - Add documentation on link_validate() - link_validate() and relater functions depends on CONFIG_MEDIA_CONTROLLER - Skip link validation for links on which stream_count was non-zero - Do not validate link if entity's stream count is non-zero - Use v4l2_subdev_link_validate_default() if no link_validate pad op is set - Allow changing control handler mutex: this enables a driver to provide multiple subdevs but use only one mutex. Default mutex (part of struct v4l2_ctrl_handler) is set in v4l2_ctrl_handler_init(). - Split image source class into two: image source and image processing Changes to the RFC v1 [6] include: - Integer controls: - Target Linux 3.4 instead of 3.3 - Proper control type check in
[PATCH v5 04/35] v4l: VIDIOC_SUBDEV_S_SELECTION and VIDIOC_SUBDEV_G_SELECTION IOCTLs
Add support for VIDIOC_SUBDEV_S_SELECTION and VIDIOC_SUBDEV_G_SELECTION IOCTLs. They replace functionality provided by VIDIOC_SUBDEV_S_CROP and VIDIOC_SUBDEV_G_CROP IOCTLs and also add new functionality (composing). VIDIOC_SUBDEV_G_CROP and VIDIOC_SUBDEV_S_CROP continue to be supported. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/video/v4l2-subdev.c | 42 include/linux/v4l2-subdev.h | 41 include/media/v4l2-subdev.h | 21 +++--- 3 files changed, 90 insertions(+), 14 deletions(-) diff --git a/drivers/media/video/v4l2-subdev.c b/drivers/media/video/v4l2-subdev.c index 6fe88e9..7d22538 100644 --- a/drivers/media/video/v4l2-subdev.c +++ b/drivers/media/video/v4l2-subdev.c @@ -35,14 +35,9 @@ static int subdev_fh_init(struct v4l2_subdev_fh *fh, struct v4l2_subdev *sd) { #if defined(CONFIG_VIDEO_V4L2_SUBDEV_API) - /* Allocate try format and crop in the same memory block */ - fh-try_fmt = kzalloc((sizeof(*fh-try_fmt) + sizeof(*fh-try_crop)) - * sd-entity.num_pads, GFP_KERNEL); - if (fh-try_fmt == NULL) + fh-pad = kzalloc(sizeof(*fh-pad) * sd-entity.num_pads, GFP_KERNEL); + if (fh-pad == NULL) return -ENOMEM; - - fh-try_crop = (struct v4l2_rect *) - (fh-try_fmt + sd-entity.num_pads); #endif return 0; } @@ -50,9 +45,8 @@ static int subdev_fh_init(struct v4l2_subdev_fh *fh, struct v4l2_subdev *sd) static void subdev_fh_free(struct v4l2_subdev_fh *fh) { #if defined(CONFIG_VIDEO_V4L2_SUBDEV_API) - kfree(fh-try_fmt); - fh-try_fmt = NULL; - fh-try_crop = NULL; + kfree(fh-pad); + fh-pad = NULL; #endif } @@ -293,6 +287,34 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg) return v4l2_subdev_call(sd, pad, enum_frame_interval, subdev_fh, fie); } + + case VIDIOC_SUBDEV_G_SELECTION: { + struct v4l2_subdev_selection *sel = arg; + + if (sel-which != V4L2_SUBDEV_FORMAT_TRY + sel-which != V4L2_SUBDEV_FORMAT_ACTIVE) + return -EINVAL; + + if (sel-pad = sd-entity.num_pads) + return -EINVAL; + + return v4l2_subdev_call( + sd, pad, get_selection, subdev_fh, sel); + } + + case VIDIOC_SUBDEV_S_SELECTION: { + struct v4l2_subdev_selection *sel = arg; + + if (sel-which != V4L2_SUBDEV_FORMAT_TRY + sel-which != V4L2_SUBDEV_FORMAT_ACTIVE) + return -EINVAL; + + if (sel-pad = sd-entity.num_pads) + return -EINVAL; + + return v4l2_subdev_call( + sd, pad, set_selection, subdev_fh, sel); + } #endif default: return v4l2_subdev_call(sd, core, ioctl, cmd, arg); diff --git a/include/linux/v4l2-subdev.h b/include/linux/v4l2-subdev.h index ed29cbb..4c63e51 100644 --- a/include/linux/v4l2-subdev.h +++ b/include/linux/v4l2-subdev.h @@ -123,6 +123,43 @@ struct v4l2_subdev_frame_interval_enum { __u32 reserved[9]; }; +#define V4L2_SUBDEV_SEL_FLAG_SIZE_GE (1 0) +#define V4L2_SUBDEV_SEL_FLAG_SIZE_LE (1 1) +#define V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG (1 2) + +/* active cropping area */ +#define V4L2_SUBDEV_SEL_TGT_CROP_ACTIVE0x +/* cropping bounds */ +#define V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS0x0002 +/* current composing area */ +#define V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTIVE 0x0100 +/* composing bounds */ +#define V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS 0x0102 + + +/** + * struct v4l2_subdev_selection - selection info + * + * @which: either V4L2_SUBDEV_FORMAT_ACTIVE or V4L2_SUBDEV_FORMAT_TRY + * @pad: pad number, as reported by the media API + * @target: selection target, used to choose one of possible rectangles + * @flags: constraint flags + * @r: coordinates of the selection window + * @reserved: for future use, set to zero for now + * + * Hardware may use multiple helper windows to process a video stream. + * The structure is used to exchange this selection areas between + * an application and a driver. + */ +struct v4l2_subdev_selection { + __u32 which; + __u32 pad; + __u32 target; + __u32 flags; + struct v4l2_rect r; + __u32 reserved[8]; +}; + #define VIDIOC_SUBDEV_G_FMT_IOWR('V', 4, struct v4l2_subdev_format) #define VIDIOC_SUBDEV_S_FMT_IOWR('V', 5, struct v4l2_subdev_format) #define VIDIOC_SUBDEV_G_FRAME_INTERVAL \ @@ -137,5 +174,9 @@ struct v4l2_subdev_frame_interval_enum { _IOWR('V', 75, struct
[PATCH v5 02/35] v4l: Document integer menu controls
Signed-off-by: Sakari Ailus sakari.ai...@iki.fi Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- Documentation/DocBook/media/v4l/compat.xml | 10 + Documentation/DocBook/media/v4l/v4l2.xml |6 +++ .../DocBook/media/v4l/vidioc-queryctrl.xml | 39 +++- 3 files changed, 53 insertions(+), 2 deletions(-) diff --git a/Documentation/DocBook/media/v4l/compat.xml b/Documentation/DocBook/media/v4l/compat.xml index c93298f..8cd5c96 100644 --- a/Documentation/DocBook/media/v4l/compat.xml +++ b/Documentation/DocBook/media/v4l/compat.xml @@ -2400,6 +2400,16 @@ details./para /orderedlist /section +section + titleV4L2 in Linux 3.4/title + orderedlist +listitem + paraAdded integer menus, the new type will be + V4L2_CTRL_TYPE_INTEGER_MENU./para +/listitem + /orderedlist +/section + section id=other titleRelation of V4L2 to other Linux multimedia APIs/title diff --git a/Documentation/DocBook/media/v4l/v4l2.xml b/Documentation/DocBook/media/v4l/v4l2.xml index dcf9e33..ff11a13 100644 --- a/Documentation/DocBook/media/v4l/v4l2.xml +++ b/Documentation/DocBook/media/v4l/v4l2.xml @@ -128,6 +128,12 @@ structs, ioctls) must be noted in more detail in the history chapter applications. -- revision + revnumber3.4/revnumber + date2012-01-26/date + authorinitialssa/authorinitials + revremarkAdded V4L2_CTRL_TYPE_INTEGER_MENU./revremark + /revision + revision revnumber3.3/revnumber date2012-01-11/date authorinitialshv/authorinitials diff --git a/Documentation/DocBook/media/v4l/vidioc-queryctrl.xml b/Documentation/DocBook/media/v4l/vidioc-queryctrl.xml index 36660d3..505f020 100644 --- a/Documentation/DocBook/media/v4l/vidioc-queryctrl.xml +++ b/Documentation/DocBook/media/v4l/vidioc-queryctrl.xml @@ -215,11 +215,12 @@ the array to zero./entry table pgwide=1 frame=none id=v4l2-querymenu titlestruct structnamev4l2_querymenu/structname/title - tgroup cols=3 + tgroup cols=4 cs-str; tbody valign=top row entry__u32/entry + entry/entry entrystructfieldid/structfield/entry entryIdentifies the control, set by the application from the respective v4l2-queryctrl; @@ -227,18 +228,38 @@ from the respective v4l2-queryctrl; /row row entry__u32/entry + entry/entry entrystructfieldindex/structfield/entry entryIndex of the menu item, starting at zero, set by the application./entry /row row + entryunion/entry + entry/entry + entry/entry + entry/entry + /row + row + entry/entry entry__u8/entry entrystructfieldname/structfield[32]/entry entryName of the menu item, a NUL-terminated ASCII -string. This information is intended for the user./entry +string. This information is intended for the user. This field is valid +for constantV4L2_CTRL_FLAG_MENU/constant type controls./entry + /row + row + entry/entry + entry__s64/entry + entrystructfieldvalue/structfield/entry + entry + Value of the integer menu item. This field is valid for + constantV4L2_CTRL_FLAG_INTEGER_MENU/constant type + controls. +/entry /row row entry__u32/entry + entry/entry entrystructfieldreserved/structfield/entry entryReserved for future extensions. Drivers must set the array to zero./entry @@ -292,6 +313,20 @@ the menu items can be enumerated with the constantVIDIOC_QUERYMENU/constant ioctl./entry /row row + entryconstantV4L2_CTRL_TYPE_INTEGER_MENU/constant/entry + entryge; 0/entry + entry1/entry + entryN-1/entry + entry + The control has a menu of N choices. The values of the + menu items can be enumerated with the + constantVIDIOC_QUERYMENU/constant ioctl. This is + similar to constantV4L2_CTRL_TYPE_MENU/constant + except that instead of strings, the menu items are + signed 64-bit integers. +/entry + /row + row entryconstantV4L2_CTRL_TYPE_BITMASK/constant/entry entry0/entry entryn/a/entry -- 1.7.2.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 19/35] omap3isp: Support additional in-memory compressed bayer formats
This also prevents accessing NULL pointer in csi2_try_format(). Signed-off-by: Sakari Ailus sakari.ai...@iki.fi Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/video/omap3isp/ispvideo.c | 13 + 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/drivers/media/video/omap3isp/ispvideo.c b/drivers/media/video/omap3isp/ispvideo.c index b020700..c191f13 100644 --- a/drivers/media/video/omap3isp/ispvideo.c +++ b/drivers/media/video/omap3isp/ispvideo.c @@ -46,6 +46,10 @@ * Helper functions */ +/* + * NOTE: When adding new media bus codes, always remember to add + * corresponding in-memory formats to the table below!!! + */ static struct isp_format_info formats[] = { { V4L2_MBUS_FMT_Y8_1X8, V4L2_MBUS_FMT_Y8_1X8, V4L2_MBUS_FMT_Y8_1X8, V4L2_MBUS_FMT_Y8_1X8, @@ -68,9 +72,18 @@ static struct isp_format_info formats[] = { { V4L2_MBUS_FMT_SRGGB8_1X8, V4L2_MBUS_FMT_SRGGB8_1X8, V4L2_MBUS_FMT_SRGGB8_1X8, V4L2_MBUS_FMT_SRGGB8_1X8, V4L2_PIX_FMT_SRGGB8, 8, }, + { V4L2_MBUS_FMT_SBGGR10_DPCM8_1X8, V4L2_MBUS_FMT_SBGGR10_DPCM8_1X8, + V4L2_MBUS_FMT_SBGGR10_1X10, 0, + V4L2_PIX_FMT_SBGGR10DPCM8, 8, }, + { V4L2_MBUS_FMT_SGBRG10_DPCM8_1X8, V4L2_MBUS_FMT_SGBRG10_DPCM8_1X8, + V4L2_MBUS_FMT_SGBRG10_1X10, 0, + V4L2_PIX_FMT_SGBRG10DPCM8, 8, }, { V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8, V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8, V4L2_MBUS_FMT_SGRBG10_1X10, 0, V4L2_PIX_FMT_SGRBG10DPCM8, 8, }, + { V4L2_MBUS_FMT_SRGGB10_DPCM8_1X8, V4L2_MBUS_FMT_SRGGB10_DPCM8_1X8, + V4L2_MBUS_FMT_SRGGB10_1X10, 0, + V4L2_PIX_FMT_SRGGB10DPCM8, 8, }, { V4L2_MBUS_FMT_SBGGR10_1X10, V4L2_MBUS_FMT_SBGGR10_1X10, V4L2_MBUS_FMT_SBGGR10_1X10, V4L2_MBUS_FMT_SBGGR8_1X8, V4L2_PIX_FMT_SBGGR10, 10, }, -- 1.7.2.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 25/35] omap3isp: Collect entities that are part of the pipeline
Collect entities which are part of the pipeline into a single bit mask. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi --- drivers/media/video/omap3isp/ispvideo.c |9 + drivers/media/video/omap3isp/ispvideo.h |1 + 2 files changed, 10 insertions(+), 0 deletions(-) diff --git a/drivers/media/video/omap3isp/ispvideo.c b/drivers/media/video/omap3isp/ispvideo.c index d34f690..4bc9cca 100644 --- a/drivers/media/video/omap3isp/ispvideo.c +++ b/drivers/media/video/omap3isp/ispvideo.c @@ -970,6 +970,8 @@ isp_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type) { struct isp_video_fh *vfh = to_isp_video_fh(fh); struct isp_video *video = video_drvdata(file); + struct media_entity_graph graph; + struct media_entity *entity; enum isp_pipeline_state state; struct isp_pipeline *pipe; struct isp_video *far_end; @@ -992,6 +994,8 @@ isp_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type) pipe = video-video.entity.pipe ? to_isp_pipeline(video-video.entity) : video-pipe; + pipe-entities = 0; + if (video-isp-pdata-set_constraints) video-isp-pdata-set_constraints(video-isp, true); pipe-l3_ick = clk_get_rate(video-isp-clock[ISP_CLK_L3_ICK]); @@ -1001,6 +1005,11 @@ isp_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type) if (ret 0) goto err_pipeline_start; + entity = video-video.entity; + media_entity_graph_walk_start(graph, entity); + while ((entity = media_entity_graph_walk_next(graph))) + pipe-entities |= 1 entity-id; + /* Verify that the currently configured format matches the output of * the connected subdev. */ diff --git a/drivers/media/video/omap3isp/ispvideo.h b/drivers/media/video/omap3isp/ispvideo.h index d91bdb91..0423c9d 100644 --- a/drivers/media/video/omap3isp/ispvideo.h +++ b/drivers/media/video/omap3isp/ispvideo.h @@ -96,6 +96,7 @@ struct isp_pipeline { enum isp_pipeline_stream_state stream_state; struct isp_video *input; struct isp_video *output; + u32 entities; unsigned long l3_ick; unsigned int max_rate; atomic_t frame_number; -- 1.7.2.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 09/35] v4l: Add subdev selections documentation
Add documentation for V4L2 subdev selection API. This changes also experimental V4L2 subdev API so that scaling now works through selection API only. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi --- Documentation/DocBook/media/Makefile |4 +- Documentation/DocBook/media/v4l/compat.xml |9 + Documentation/DocBook/media/v4l/dev-subdev.xml | 202 +++-- Documentation/DocBook/media/v4l/v4l2.xml | 17 ++- .../media/v4l/vidioc-subdev-g-selection.xml| 228 5 files changed, 433 insertions(+), 27 deletions(-) create mode 100644 Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml diff --git a/Documentation/DocBook/media/Makefile b/Documentation/DocBook/media/Makefile index 6628b4b..3625209 100644 --- a/Documentation/DocBook/media/Makefile +++ b/Documentation/DocBook/media/Makefile @@ -70,6 +70,8 @@ IOCTLS = \ VIDIOC_SUBDEV_ENUM_MBUS_CODE \ VIDIOC_SUBDEV_ENUM_FRAME_SIZE \ VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL \ + VIDIOC_SUBDEV_G_SELECTION \ + VIDIOC_SUBDEV_S_SELECTION \ TYPES = \ $(shell perl -ne 'print $$1 if /^typedef\s+[^\s]+\s+([^\s]+)\;/' $(srctree)/include/linux/videodev2.h) \ @@ -193,7 +195,7 @@ DVB_DOCUMENTED = \ # install_media_images = \ - $(Q)cp $(OBJIMGFILES) $(MEDIA_OBJ_DIR)/media_api + $(Q)cp $(OBJIMGFILES) $(MEDIA_SRC_DIR)/v4l/*.svg $(MEDIA_OBJ_DIR)/media_api $(MEDIA_OBJ_DIR)/%: $(MEDIA_SRC_DIR)/%.b64 $(Q)base64 -d $ $@ diff --git a/Documentation/DocBook/media/v4l/compat.xml b/Documentation/DocBook/media/v4l/compat.xml index 8cd5c96..603fa4ad 100644 --- a/Documentation/DocBook/media/v4l/compat.xml +++ b/Documentation/DocBook/media/v4l/compat.xml @@ -2407,6 +2407,11 @@ details./para paraAdded integer menus, the new type will be V4L2_CTRL_TYPE_INTEGER_MENU./para /listitem +listitem + paraAdded selection API for V4L2 subdev interface: + VIDIOC-SUBDEV-G-SELECTION; and + VIDIOC-SUBDEV-S-SELECTION;./para +/listitem /orderedlist /section @@ -2523,6 +2528,10 @@ ioctls./para listitem paraSelection API. xref linkend=selection-api //para /listitem +listitem + paraSub-device selection API: VIDIOC-SUBDEV-G-SELECTION; + and VIDIOC-SUBDEV-S-SELECTION; ioctls./para +/listitem /itemizedlist /section diff --git a/Documentation/DocBook/media/v4l/dev-subdev.xml b/Documentation/DocBook/media/v4l/dev-subdev.xml index 0916a73..f4c623e 100644 --- a/Documentation/DocBook/media/v4l/dev-subdev.xml +++ b/Documentation/DocBook/media/v4l/dev-subdev.xml @@ -76,11 +76,12 @@ wordaswordformat/wordasword means the combination of media bus data format, frame width and frame height./para/note -paraImage formats are typically negotiated on video capture and output -devices using the link linkend=cropcropping and scaling/link ioctls. -The driver is responsible for configuring every block in the video pipeline -according to the requested format at the pipeline input and/or -output./para +paraImage formats are typically negotiated on video capture and +output devices using the format and link +linkend=vidioc-subdev-g-selectionselection/link ioctls. The +driver is responsible for configuring every block in the video +pipeline according to the requested format at the pipeline input +and/or output./para paraFor complex devices, such as often found in embedded systems, identical image sizes at the output of a pipeline can be achieved using @@ -276,11 +277,11 @@ /section section - titleCropping and scaling/title + titleSelections: cropping, scaling and composition/title paraMany sub-devices support cropping frames on their input or output pads (or possible even on both). Cropping is used to select the area of - interest in an image, typically on a video sensor or video decoder. It can + interest in an image, typically on an image sensor or a video decoder. It can also be used as part of digital zoom implementations to select the area of the image that will be scaled up./para @@ -288,26 +289,179 @@ v4l2-rect; by the coordinates of the top left corner and the rectangle size. Both the coordinates and sizes are expressed in pixels./para - paraThe crop rectangle is retrieved and set using the - VIDIOC-SUBDEV-G-CROP; and VIDIOC-SUBDEV-S-CROP; ioctls. Like for pad - formats, drivers store try and active crop rectangles. The format - negotiation mechanism applies to crop settings as well./para - - paraOn input pads, cropping is applied relatively to the current pad - format. The pad format represents the image size as received by the - sub-device from the previous block in the pipeline, and the crop rectangle - represents the
[PATCH v5 18/35] v4l: Allow changing control handler lock
Allow choosing the lock used by the control handler. This may be handy sometimes when a driver providing multiple subdevs does not want to use several locks to serialise its functions. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi --- drivers/media/video/adp1653.c|8 +++--- drivers/media/video/v4l2-ctrls.c | 39 +++-- drivers/media/video/vivi.c |4 +- include/media/v4l2-ctrls.h |9 +-- 4 files changed, 32 insertions(+), 28 deletions(-) diff --git a/drivers/media/video/adp1653.c b/drivers/media/video/adp1653.c index 12eedf4..becaba4 100644 --- a/drivers/media/video/adp1653.c +++ b/drivers/media/video/adp1653.c @@ -283,19 +283,19 @@ adp1653_init_device(struct adp1653_flash *flash) return -EIO; } - mutex_lock(flash-ctrls.lock); + mutex_lock(flash-ctrls.lock); /* Reset faults before reading new ones. */ flash-fault = 0; rval = adp1653_get_fault(flash); - mutex_unlock(flash-ctrls.lock); + mutex_unlock(flash-ctrls.lock); if (rval 0) { dev_err(client-dev, faults detected: 0x%1.1x\n, rval); return -EIO; } - mutex_lock(flash-ctrls.lock); + mutex_lock(flash-ctrls.lock); rval = adp1653_update_hw(flash); - mutex_unlock(flash-ctrls.lock); + mutex_unlock(flash-ctrls.lock); if (rval) { dev_err(client-dev, adp1653_update_hw failed at %s\n, __func__); diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c index 1cbf97f..c38055f 100644 --- a/drivers/media/video/v4l2-ctrls.c +++ b/drivers/media/video/v4l2-ctrls.c @@ -1153,7 +1153,8 @@ static inline int handler_set_err(struct v4l2_ctrl_handler *hdl, int err) int v4l2_ctrl_handler_init(struct v4l2_ctrl_handler *hdl, unsigned nr_of_controls_hint) { - mutex_init(hdl-lock); + hdl-lock = hdl-_lock; + mutex_init(hdl-lock); INIT_LIST_HEAD(hdl-ctrls); INIT_LIST_HEAD(hdl-ctrl_refs); hdl-nr_of_buckets = 1 + nr_of_controls_hint / 8; @@ -1174,7 +1175,7 @@ void v4l2_ctrl_handler_free(struct v4l2_ctrl_handler *hdl) if (hdl == NULL || hdl-buckets == NULL) return; - mutex_lock(hdl-lock); + mutex_lock(hdl-lock); /* Free all nodes */ list_for_each_entry_safe(ref, next_ref, hdl-ctrl_refs, node) { list_del(ref-node); @@ -1191,7 +1192,7 @@ void v4l2_ctrl_handler_free(struct v4l2_ctrl_handler *hdl) hdl-buckets = NULL; hdl-cached = NULL; hdl-error = 0; - mutex_unlock(hdl-lock); + mutex_unlock(hdl-lock); } EXPORT_SYMBOL(v4l2_ctrl_handler_free); @@ -1256,9 +1257,9 @@ static struct v4l2_ctrl_ref *find_ref_lock( struct v4l2_ctrl_ref *ref = NULL; if (hdl) { - mutex_lock(hdl-lock); + mutex_lock(hdl-lock); ref = find_ref(hdl, id); - mutex_unlock(hdl-lock); + mutex_unlock(hdl-lock); } return ref; } @@ -1305,7 +1306,7 @@ static int handler_new_ref(struct v4l2_ctrl_handler *hdl, INIT_LIST_HEAD(new_ref-node); - mutex_lock(hdl-lock); + mutex_lock(hdl-lock); /* Add immediately at the end of the list if the list is empty, or if the last element in the list has a lower ID. @@ -1335,7 +1336,7 @@ insert_in_hash: hdl-buckets[bucket] = new_ref; unlock: - mutex_unlock(hdl-lock); + mutex_unlock(hdl-lock); return 0; } @@ -1421,9 +1422,9 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl, kfree(ctrl); return NULL; } - mutex_lock(hdl-lock); + mutex_lock(hdl-lock); list_add_tail(ctrl-node, hdl-ctrls); - mutex_unlock(hdl-lock); + mutex_unlock(hdl-lock); return ctrl; } @@ -1540,7 +1541,7 @@ int v4l2_ctrl_add_handler(struct v4l2_ctrl_handler *hdl, return 0; if (hdl-error) return hdl-error; - mutex_lock(add-lock); + mutex_lock(add-lock); list_for_each_entry(ctrl, add-ctrls, node) { /* Skip handler-private controls. */ if (ctrl-is_private) @@ -1552,7 +1553,7 @@ int v4l2_ctrl_add_handler(struct v4l2_ctrl_handler *hdl, if (ret) break; } - mutex_unlock(add-lock); + mutex_unlock(add-lock); return ret; } EXPORT_SYMBOL(v4l2_ctrl_add_handler); @@ -1716,11 +1717,11 @@ void v4l2_ctrl_handler_log_status(struct v4l2_ctrl_handler *hdl, len = strlen(prefix); if (len prefix[len - 1] != ' ') colon = : ; - mutex_lock(hdl-lock); + mutex_lock(hdl-lock); list_for_each_entry(ctrl, hdl-ctrls, node) if (!(ctrl-flags V4L2_CTRL_FLAG_DISABLED))
[PATCH v5 35/35] rm680: Add camera init
From: Sakari Ailus sakari.ai...@maxwell.research.nokia.com This currently introduces an extra file to the arch/arm/mach-omap2 directory: board-rm680-camera.c. Keeping the device tree in mind, the context of the file could be represented as static data with one exception: the external clock to the sensor. This external clock is provided by the OMAP 3 SoC and required by the sensor. The issue is that the clock originates from the ISP and not from PRCM block as the other clocks and thus is not supported by the clock framework. Otherwise the sensor driver could just clk_get() and clk_enable() it, just like the regulators and gpios. Signed-off-by: Sakari Ailus sakari.ai...@maxwell.research.nokia.com Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- arch/arm/mach-omap2/Makefile |3 +- arch/arm/mach-omap2/board-rm680-camera.c | 375 ++ arch/arm/mach-omap2/board-rm680.c| 38 +++ 3 files changed, 415 insertions(+), 1 deletions(-) create mode 100644 arch/arm/mach-omap2/board-rm680-camera.c diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index fc9b238..f92cc92 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile @@ -206,7 +206,8 @@ obj-$(CONFIG_MACH_OMAP3_PANDORA)+= board-omap3pandora.o obj-$(CONFIG_MACH_OMAP_3430SDP)+= board-3430sdp.o obj-$(CONFIG_MACH_NOKIA_N8X0) += board-n8x0.o obj-$(CONFIG_MACH_NOKIA_RM680) += board-rm680.o \ - sdram-nokia.o + sdram-nokia.o \ + board-rm680-camera.o obj-$(CONFIG_MACH_NOKIA_RX51) += board-rx51.o \ sdram-nokia.o \ board-rx51-peripherals.o \ diff --git a/arch/arm/mach-omap2/board-rm680-camera.c b/arch/arm/mach-omap2/board-rm680-camera.c new file mode 100644 index 000..4306118 --- /dev/null +++ b/arch/arm/mach-omap2/board-rm680-camera.c @@ -0,0 +1,375 @@ +/** + * arch/arm/mach-omap2/board-rm680-camera.c + * + * Copyright (C) 2010--2012 Nokia Corporation + * Contact: Sakari Ailus sakari.ai...@maxwell.research.nokia.com + * + * Based on board-rx71-camera.c by Vimarsh Zutshi + * Based on board-rx51-camera.c by Sakari Ailus + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ + +#include linux/delay.h +#include linux/gpio.h +#include linux/i2c.h +#include linux/mm.h +#include linux/platform_device.h +#include linux/videodev2.h + +#include asm/mach-types.h +#include plat/omap-pm.h + +#include media/omap3isp.h +#include media/smiapp.h + +#include ../../../drivers/media/video/omap3isp/isp.h +#include devices.h + +#define SEC_CAMERA_RESET_GPIO 97 + +#define RM680_PRI_SENSOR 1 +#define RM680_PRI_LENS 2 +#define RM680_SEC_SENSOR 3 +#define MAIN_CAMERA_XCLK ISP_XCLK_A +#define SEC_CAMERA_XCLKISP_XCLK_B + +/* + * + * Main Camera Module EXTCLK + * Used by the sensor and the actuator driver. + * + */ +static struct camera_xclk { + u32 hz; + u32 lock; + u8 xclksel; +} cameras_xclk; + +static DEFINE_MUTEX(lock_xclk); + +static int rm680_update_xclk(struct v4l2_subdev *subdev, u32 hz, u32 which, +u8 xclksel) +{ + struct isp_device *isp = v4l2_dev_to_isp_device(subdev-v4l2_dev); + int ret; + + mutex_lock(lock_xclk); + + if (which == RM680_SEC_SENSOR) { + if (cameras_xclk.xclksel == MAIN_CAMERA_XCLK) { + ret = -EBUSY; + goto done; + } + } else { + if (cameras_xclk.xclksel == SEC_CAMERA_XCLK) { + ret = -EBUSY; + goto done; + } + } + + if (hz) { /* Turn on */ + cameras_xclk.lock |= which; + if (cameras_xclk.hz == 0) { + isp-platform_cb.set_xclk(isp, hz, xclksel); + cameras_xclk.hz = hz; + cameras_xclk.xclksel = xclksel; + } + } else {/* Turn off */ + cameras_xclk.lock = ~which; + if (cameras_xclk.lock == 0) { + isp-platform_cb.set_xclk(isp, 0, xclksel); +
[PATCH v5 31/35] omap3isp: Configure CSI-2 phy based on platform data
Configure CSI-2 phy based on platform data in the ISP driver. For that, the new V4L2_CID_IMAGE_SOURCE_PIXEL_RATE control is used. Previously the same was configured from the board code. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/video/omap3isp/isp.h |3 - drivers/media/video/omap3isp/ispcsiphy.c | 168 +- drivers/media/video/omap3isp/ispcsiphy.h | 10 -- 3 files changed, 97 insertions(+), 84 deletions(-) diff --git a/drivers/media/video/omap3isp/isp.h b/drivers/media/video/omap3isp/isp.h index 964ab1b..7533a40 100644 --- a/drivers/media/video/omap3isp/isp.h +++ b/drivers/media/video/omap3isp/isp.h @@ -126,9 +126,6 @@ struct isp_reg { struct isp_platform_callback { u32 (*set_xclk)(struct isp_device *isp, u32 xclk, u8 xclksel); - int (*csiphy_config)(struct isp_csiphy *phy, -struct isp_csiphy_dphy_cfg *dphy, -struct isp_csiphy_lanes_cfg *lanes); }; /* diff --git a/drivers/media/video/omap3isp/ispcsiphy.c b/drivers/media/video/omap3isp/ispcsiphy.c index 5be37ce..902477d 100644 --- a/drivers/media/video/omap3isp/ispcsiphy.c +++ b/drivers/media/video/omap3isp/ispcsiphy.c @@ -28,41 +28,13 @@ #include linux/device.h #include linux/regulator/consumer.h +#include ../../../../arch/arm/mach-omap2/control.h + #include isp.h #include ispreg.h #include ispcsiphy.h /* - * csiphy_lanes_config - Configuration of CSIPHY lanes. - * - * Updates HW configuration. - * Called with phy-mutex taken. - */ -static void csiphy_lanes_config(struct isp_csiphy *phy) -{ - unsigned int i; - u32 reg; - - reg = isp_reg_readl(phy-isp, phy-cfg_regs, ISPCSI2_PHY_CFG); - - for (i = 0; i phy-num_data_lanes; i++) { - reg = ~(ISPCSI2_PHY_CFG_DATA_POL_MASK(i + 1) | -ISPCSI2_PHY_CFG_DATA_POSITION_MASK(i + 1)); - reg |= (phy-lanes.data[i].pol - ISPCSI2_PHY_CFG_DATA_POL_SHIFT(i + 1)); - reg |= (phy-lanes.data[i].pos - ISPCSI2_PHY_CFG_DATA_POSITION_SHIFT(i + 1)); - } - - reg = ~(ISPCSI2_PHY_CFG_CLOCK_POL_MASK | -ISPCSI2_PHY_CFG_CLOCK_POSITION_MASK); - reg |= phy-lanes.clk.pol ISPCSI2_PHY_CFG_CLOCK_POL_SHIFT; - reg |= phy-lanes.clk.pos ISPCSI2_PHY_CFG_CLOCK_POSITION_SHIFT; - - isp_reg_writel(phy-isp, reg, phy-cfg_regs, ISPCSI2_PHY_CFG); -} - -/* * csiphy_power_autoswitch_enable * @enable: Sets or clears the autoswitch function enable flag. */ @@ -107,46 +79,31 @@ static int csiphy_set_power(struct isp_csiphy *phy, u32 power) } /* - * csiphy_dphy_config - Configure CSI2 D-PHY parameters. - * - * Called with phy-mutex taken. + * TCLK values are OK at their reset values */ -static void csiphy_dphy_config(struct isp_csiphy *phy) -{ - u32 reg; - - /* Set up ISPCSIPHY_REG0 */ - reg = isp_reg_readl(phy-isp, phy-phy_regs, ISPCSIPHY_REG0); - - reg = ~(ISPCSIPHY_REG0_THS_TERM_MASK | -ISPCSIPHY_REG0_THS_SETTLE_MASK); - reg |= phy-dphy.ths_term ISPCSIPHY_REG0_THS_TERM_SHIFT; - reg |= phy-dphy.ths_settle ISPCSIPHY_REG0_THS_SETTLE_SHIFT; - - isp_reg_writel(phy-isp, reg, phy-phy_regs, ISPCSIPHY_REG0); - - /* Set up ISPCSIPHY_REG1 */ - reg = isp_reg_readl(phy-isp, phy-phy_regs, ISPCSIPHY_REG1); - - reg = ~(ISPCSIPHY_REG1_TCLK_TERM_MASK | -ISPCSIPHY_REG1_TCLK_MISS_MASK | -ISPCSIPHY_REG1_TCLK_SETTLE_MASK); - reg |= phy-dphy.tclk_term ISPCSIPHY_REG1_TCLK_TERM_SHIFT; - reg |= phy-dphy.tclk_miss ISPCSIPHY_REG1_TCLK_MISS_SHIFT; - reg |= phy-dphy.tclk_settle ISPCSIPHY_REG1_TCLK_SETTLE_SHIFT; +#define TCLK_TERM 0 +#define TCLK_MISS 1 +#define TCLK_SETTLE14 - isp_reg_writel(phy-isp, reg, phy-phy_regs, ISPCSIPHY_REG1); -} - -static int csiphy_config(struct isp_csiphy *phy, -struct isp_csiphy_dphy_cfg *dphy, -struct isp_csiphy_lanes_cfg *lanes) +static int omap3isp_csiphy_config(struct isp_csiphy *phy) { + struct isp_csi2_device *csi2 = phy-csi2; + struct isp_pipeline *pipe = to_isp_pipeline(csi2-subdev.entity); + struct isp_v4l2_subdevs_group *subdevs = pipe-external-host_priv; + struct isp_csiphy_lanes_cfg *lanes; + int csi2_ddrclk_khz; unsigned int used_lanes = 0; unsigned int i; + u32 reg; + + if (subdevs-interface == ISP_INTERFACE_CCP2B_PHY1 + || subdevs-interface == ISP_INTERFACE_CCP2B_PHY2) + lanes = subdevs-bus.ccp2.lanecfg; + else + lanes = subdevs-bus.csi2.lanecfg; /* Clock and data lanes verification */ - for (i = 0; i phy-num_data_lanes; i++) { + for (i = 0; i csi2-phy-num_data_lanes; i++) { if (lanes-data[i].pol 1 ||
[PATCH v5 33/35] omap3isp: Find source pad from external entity
No longer assume pad number 0 is the source pad of the external entity. Find the source pad from the external entity and use it instead. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi --- drivers/media/video/omap3isp/isp.c | 13 - 1 files changed, 12 insertions(+), 1 deletions(-) diff --git a/drivers/media/video/omap3isp/isp.c b/drivers/media/video/omap3isp/isp.c index f54953d..0718b0a 100644 --- a/drivers/media/video/omap3isp/isp.c +++ b/drivers/media/video/omap3isp/isp.c @@ -1744,6 +1744,7 @@ static int isp_register_entities(struct isp_device *isp) struct media_entity *input; unsigned int flags; unsigned int pad; + unsigned int i; sensor = isp_register_subdev_group(isp, subdevs-subdevs); if (sensor == NULL) @@ -1791,7 +1792,17 @@ static int isp_register_entities(struct isp_device *isp) goto done; } - ret = media_entity_create_link(sensor-entity, 0, input, pad, + for (i = 0; i sensor-entity.num_pads; i++) + if (sensor-entity.pads[i].flags MEDIA_PAD_FL_SOURCE) + break; + if (i == sensor-entity.num_pads) { + dev_err(isp-dev, + no source pads in external entities\n); + ret = -EINVAL; + goto done; + } + + ret = media_entity_create_link(sensor-entity, i, input, pad, flags); if (ret 0) goto done; -- 1.7.2.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 27/35] omap3isp: Introduce isp_video_check_external_subdevs()
isp_video_check_external_subdevs() will retrieve external subdev's bits-per-pixel and pixel rate for the use of other ISP subdevs at streamon time. isp_video_check_external_subdevs() is called after pipeline validation. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi --- drivers/media/video/omap3isp/ispvideo.c | 75 +++ 1 files changed, 75 insertions(+), 0 deletions(-) diff --git a/drivers/media/video/omap3isp/ispvideo.c b/drivers/media/video/omap3isp/ispvideo.c index 4bc9cca..ef5c770 100644 --- a/drivers/media/video/omap3isp/ispvideo.c +++ b/drivers/media/video/omap3isp/ispvideo.c @@ -934,6 +934,77 @@ isp_video_dqbuf(struct file *file, void *fh, struct v4l2_buffer *b) file-f_flags O_NONBLOCK); } +static int isp_video_check_external_subdevs(struct isp_pipeline *pipe) +{ + struct isp_device *isp = + container_of(pipe, struct isp_video, pipe)-isp; + struct media_entity *ents[] = { + isp-isp_csi2a.subdev.entity, + isp-isp_csi2c.subdev.entity, + isp-isp_ccp2.subdev.entity, + isp-isp_ccdc.subdev.entity + }; + struct media_pad *source_pad; + struct media_entity *source = NULL; + struct media_entity *sink; + struct v4l2_subdev_format fmt; + struct v4l2_ext_controls ctrls; + struct v4l2_ext_control ctrl; + int i; + int ret = 0; + + for (i = 0; i ARRAY_SIZE(ents); i++) { + /* Is the entity part of the pipeline? */ + if (!(pipe-entities (1 ents[i]-id))) + continue; + + /* ISP entities have always sink pad == 0. Find source. */ + source_pad = media_entity_remote_source(ents[i]-pads[0]); + + if (source_pad == NULL) + continue; + + source = source_pad-entity; + sink = ents[i]; + break; + } + + if (!source || media_entity_type(source) != MEDIA_ENT_T_V4L2_SUBDEV) + return 0; + + pipe-external = media_entity_to_v4l2_subdev(source); + + fmt.pad = source_pad-index; + fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE; + ret = v4l2_subdev_call(media_entity_to_v4l2_subdev(sink), + pad, get_fmt, NULL, fmt); + BUG_ON(ret 0); + + pipe-external_bpp = omap3isp_video_format_info( + fmt.format.code)-bpp; + + memset(ctrls, 0, sizeof(ctrls)); + memset(ctrl, 0, sizeof(ctrl)); + + ctrl.id = V4L2_CID_PIXEL_RATE; + + ctrls.ctrl_class = V4L2_CTRL_ID2CLASS(ctrl.id); + ctrls.count = 1; + ctrls.controls = ctrl; + + ret = v4l2_g_ext_ctrls(pipe-external-ctrl_handler, ctrls); + if (ret 0) { + dev_warn(isp-dev, +no pixel rate control in subdev %s\n, +pipe-external-name); + return ret; + } + + pipe-external_rate = ctrl.value64; + + return 0; +} + /* * Stream management * @@ -1010,6 +1081,10 @@ isp_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type) while ((entity = media_entity_graph_walk_next(graph))) pipe-entities |= 1 entity-id; + ret = isp_video_check_external_subdevs(pipe); + if (ret 0) + goto err_check_format; + /* Verify that the currently configured format matches the output of * the connected subdev. */ -- 1.7.2.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 26/35] omap3isp: Add information on external subdev to struct isp_pipeline
Add pointer to external subdev, pixel rate of the external subdev and bpp of the format to struct isp_pipeline. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/video/omap3isp/ispvideo.h |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/drivers/media/video/omap3isp/ispvideo.h b/drivers/media/video/omap3isp/ispvideo.h index 0423c9d..8c16156 100644 --- a/drivers/media/video/omap3isp/ispvideo.h +++ b/drivers/media/video/omap3isp/ispvideo.h @@ -103,6 +103,9 @@ struct isp_pipeline { bool do_propagation; /* of frame number */ bool error; struct v4l2_fract max_timeperframe; + struct v4l2_subdev *external; + unsigned int external_rate; + unsigned int external_bpp; }; #define to_isp_pipeline(__e) \ -- 1.7.2.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 29/35] omap3isp: Default link validation for ccp2, csi2, preview and resizer
Use default link validation for ccp2, csi2, preview and resizer. On ccp2, csi2 and ccdc we also collect information on external subdevs as one may be connected to those entities. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/video/omap3isp/ispccp2.c|1 + drivers/media/video/omap3isp/ispcsi2.c|1 + drivers/media/video/omap3isp/isppreview.c |1 + drivers/media/video/omap3isp/ispresizer.c |1 + 4 files changed, 4 insertions(+), 0 deletions(-) diff --git a/drivers/media/video/omap3isp/ispccp2.c b/drivers/media/video/omap3isp/ispccp2.c index 70ddbf3..41e807f 100644 --- a/drivers/media/video/omap3isp/ispccp2.c +++ b/drivers/media/video/omap3isp/ispccp2.c @@ -1021,6 +1021,7 @@ static int ccp2_link_setup(struct media_entity *entity, /* media operations */ static const struct media_entity_operations ccp2_media_ops = { .link_setup = ccp2_link_setup, + .link_validate = v4l2_subdev_link_validate, }; /* diff --git a/drivers/media/video/omap3isp/ispcsi2.c b/drivers/media/video/omap3isp/ispcsi2.c index fcb5168..d2e1c92 100644 --- a/drivers/media/video/omap3isp/ispcsi2.c +++ b/drivers/media/video/omap3isp/ispcsi2.c @@ -1181,6 +1181,7 @@ static int csi2_link_setup(struct media_entity *entity, /* media operations */ static const struct media_entity_operations csi2_media_ops = { .link_setup = csi2_link_setup, + .link_validate = v4l2_subdev_link_validate, }; void omap3isp_csi2_unregister_entities(struct isp_csi2_device *csi2) diff --git a/drivers/media/video/omap3isp/isppreview.c b/drivers/media/video/omap3isp/isppreview.c index 6d0fb2c..8545f0b 100644 --- a/drivers/media/video/omap3isp/isppreview.c +++ b/drivers/media/video/omap3isp/isppreview.c @@ -2076,6 +2076,7 @@ static int preview_link_setup(struct media_entity *entity, /* media operations */ static const struct media_entity_operations preview_media_ops = { .link_setup = preview_link_setup, + .link_validate = v4l2_subdev_link_validate, }; void omap3isp_preview_unregister_entities(struct isp_prev_device *prev) diff --git a/drivers/media/video/omap3isp/ispresizer.c b/drivers/media/video/omap3isp/ispresizer.c index 6958a9e..0fc6525 100644 --- a/drivers/media/video/omap3isp/ispresizer.c +++ b/drivers/media/video/omap3isp/ispresizer.c @@ -1603,6 +1603,7 @@ static int resizer_link_setup(struct media_entity *entity, /* media operations */ static const struct media_entity_operations resizer_media_ops = { .link_setup = resizer_link_setup, + .link_validate = v4l2_subdev_link_validate, }; void omap3isp_resizer_unregister_entities(struct isp_res_device *res) -- 1.7.2.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 20/35] omap3isp: Move definitions required by board code under include/media.
XCLK definitions are often required by the board code. Move them to public include file. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/video/omap3isp/isp.h |4 include/media/omap3isp.h |4 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/video/omap3isp/isp.h b/drivers/media/video/omap3isp/isp.h index d96603e..2e78041 100644 --- a/drivers/media/video/omap3isp/isp.h +++ b/drivers/media/video/omap3isp/isp.h @@ -237,10 +237,6 @@ void omap3isp_configure_bridge(struct isp_device *isp, const struct isp_parallel_platform_data *pdata, unsigned int shift); -#define ISP_XCLK_NONE 0 -#define ISP_XCLK_A 1 -#define ISP_XCLK_B 2 - struct isp_device *omap3isp_get(struct isp_device *isp); void omap3isp_put(struct isp_device *isp); diff --git a/include/media/omap3isp.h b/include/media/omap3isp.h index 042849a..3f4928d 100644 --- a/include/media/omap3isp.h +++ b/include/media/omap3isp.h @@ -29,6 +29,10 @@ struct i2c_board_info; struct isp_device; +#define ISP_XCLK_NONE 0 +#define ISP_XCLK_A 1 +#define ISP_XCLK_B 2 + enum isp_interface_type { ISP_INTERFACE_PARALLEL, ISP_INTERFACE_CSI2A_PHY2, -- 1.7.2.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 30/35] omap3isp: Move CCDC link validation to ccdc_link_validate()
Perform CCDC link validation in ccdc_link_validate() instead of isp_video_validate_pipeline(). Also perform maximum data rate check in isp_video_check_external_subdevs(). Signed-off-by: Sakari Ailus sakari.ai...@iki.fi --- drivers/media/video/omap3isp/ispccdc.c | 65 + drivers/media/video/omap3isp/ispvideo.c | 94 --- 2 files changed, 76 insertions(+), 83 deletions(-) diff --git a/drivers/media/video/omap3isp/ispccdc.c b/drivers/media/video/omap3isp/ispccdc.c index cd1bf6d..84f230e 100644 --- a/drivers/media/video/omap3isp/ispccdc.c +++ b/drivers/media/video/omap3isp/ispccdc.c @@ -2000,6 +2000,69 @@ static int ccdc_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, } /* + * Decide whether desired output pixel code can be obtained with + * the lane shifter by shifting the input pixel code. + * @in: input pixelcode to shifter + * @out: output pixelcode from shifter + * @additional_shift: # of bits the sensor's LSB is offset from CAMEXT[0] + * + * return true if the combination is possible + * return false otherwise + */ +static bool ccdc_is_shiftable(enum v4l2_mbus_pixelcode in, + enum v4l2_mbus_pixelcode out, + unsigned int additional_shift) +{ + const struct isp_format_info *in_info, *out_info; + + if (in == out) + return true; + + in_info = omap3isp_video_format_info(in); + out_info = omap3isp_video_format_info(out); + + if ((in_info-flavor == 0) || (out_info-flavor == 0)) + return false; + + if (in_info-flavor != out_info-flavor) + return false; + + return in_info-bpp - out_info-bpp + additional_shift = 6; +} + +static int ccdc_link_validate(struct v4l2_subdev *sd, + struct media_link *link, + struct v4l2_subdev_format *source_fmt, + struct v4l2_subdev_format *sink_fmt) +{ + struct isp_ccdc_device *ccdc = v4l2_get_subdevdata(sd); + unsigned long parallel_shift; + + /* Check if the two ends match */ + if (source_fmt-format.width != sink_fmt-format.width || + source_fmt-format.height != sink_fmt-format.height) + return -EPIPE; + + /* We've got a parallel sensor here. */ + if (ccdc-input == CCDC_INPUT_PARALLEL) { + struct isp_parallel_platform_data *pdata = + ((struct isp_v4l2_subdevs_group *) + media_entity_to_v4l2_subdev(link-source-entity) + -host_priv)-bus.parallel; + parallel_shift = pdata-data_lane_shift * 2; + } else { + parallel_shift = 0; + } + + /* Lane shifter may be used to drop bits on CCDC sink pad */ + if (!ccdc_is_shiftable(source_fmt-format.code, + sink_fmt-format.code, parallel_shift)) + return -EPIPE; + + return 0; +} + +/* * ccdc_init_formats - Initialize formats on all pads * @sd: ISP CCDC V4L2 subdevice * @fh: V4L2 subdev file handle @@ -2041,6 +2104,7 @@ static const struct v4l2_subdev_pad_ops ccdc_v4l2_pad_ops = { .enum_frame_size = ccdc_enum_frame_size, .get_fmt = ccdc_get_format, .set_fmt = ccdc_set_format, + .link_validate = ccdc_link_validate, }; /* V4L2 subdev operations */ @@ -2150,6 +2214,7 @@ static int ccdc_link_setup(struct media_entity *entity, /* media operations */ static const struct media_entity_operations ccdc_media_ops = { .link_setup = ccdc_link_setup, + .link_validate = v4l2_subdev_link_validate, }; void omap3isp_ccdc_unregister_entities(struct isp_ccdc_device *ccdc) diff --git a/drivers/media/video/omap3isp/ispvideo.c b/drivers/media/video/omap3isp/ispvideo.c index 6d4ad87..51075b3 100644 --- a/drivers/media/video/omap3isp/ispvideo.c +++ b/drivers/media/video/omap3isp/ispvideo.c @@ -130,37 +130,6 @@ omap3isp_video_format_info(enum v4l2_mbus_pixelcode code) } /* - * Decide whether desired output pixel code can be obtained with - * the lane shifter by shifting the input pixel code. - * @in: input pixelcode to shifter - * @out: output pixelcode from shifter - * @additional_shift: # of bits the sensor's LSB is offset from CAMEXT[0] - * - * return true if the combination is possible - * return false otherwise - */ -static bool isp_video_is_shiftable(enum v4l2_mbus_pixelcode in, - enum v4l2_mbus_pixelcode out, - unsigned int additional_shift) -{ - const struct isp_format_info *in_info, *out_info; - - if (in == out) - return true; - - in_info = omap3isp_video_format_info(in); - out_info = omap3isp_video_format_info(out); - - if ((in_info-flavor == 0) || (out_info-flavor == 0)) - return false; - - if (in_info-flavor != out_info-flavor) - return false; - - return
[PATCH v5 32/35] omap3isp: Add resizer data rate configuration to resizer_link_validate
The configuration of many other blocks depend on resizer maximum data rate. Get the value from resizer at link validation time. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi --- drivers/media/video/omap3isp/ispresizer.c | 15 drivers/media/video/omap3isp/ispvideo.c | 54 - 2 files changed, 15 insertions(+), 54 deletions(-) diff --git a/drivers/media/video/omap3isp/ispresizer.c b/drivers/media/video/omap3isp/ispresizer.c index 0fc6525..dda49cb 100644 --- a/drivers/media/video/omap3isp/ispresizer.c +++ b/drivers/media/video/omap3isp/ispresizer.c @@ -1494,6 +1494,20 @@ static int resizer_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, return 0; } +static int resizer_link_validate(struct v4l2_subdev *sd, +struct media_link *link, +struct v4l2_subdev_format *source_fmt, +struct v4l2_subdev_format *sink_fmt) +{ + struct isp_res_device *res = v4l2_get_subdevdata(sd); + struct isp_pipeline *pipe = to_isp_pipeline(sd-entity); + + omap3isp_resizer_max_rate(res, pipe-max_rate); + + return v4l2_subdev_link_validate_default(sd, link, +source_fmt, sink_fmt); +} + /* * resizer_init_formats - Initialize formats on all pads * @sd: ISP resizer V4L2 subdevice @@ -1532,6 +1546,7 @@ static const struct v4l2_subdev_pad_ops resizer_v4l2_pad_ops = { .set_fmt = resizer_set_format, .get_crop = resizer_g_crop, .set_crop = resizer_s_crop, + .link_validate = resizer_link_validate, }; /* subdev operations */ diff --git a/drivers/media/video/omap3isp/ispvideo.c b/drivers/media/video/omap3isp/ispvideo.c index 51075b3..d9dd279 100644 --- a/drivers/media/video/omap3isp/ispvideo.c +++ b/drivers/media/video/omap3isp/ispvideo.c @@ -253,55 +253,6 @@ isp_video_far_end(struct isp_video *video) return far_end; } -/* - * Validate a pipeline by checking both ends of all links for format - * discrepancies. - * - * Compute the minimum time per frame value as the maximum of time per frame - * limits reported by every block in the pipeline. - * - * Return 0 if all formats match, or -EPIPE if at least one link is found with - * different formats on its two ends or if the pipeline doesn't start with a - * video source (either a subdev with no input pad, or a non-subdev entity). - */ -static int isp_video_validate_pipeline(struct isp_pipeline *pipe) -{ - struct isp_device *isp = pipe-output-isp; - struct media_pad *pad; - struct v4l2_subdev *subdev; - - subdev = isp_video_remote_subdev(pipe-output, NULL); - if (subdev == NULL) - return -EPIPE; - - while (1) { - /* Retrieve the sink format */ - pad = subdev-entity.pads[0]; - if (!(pad-flags MEDIA_PAD_FL_SINK)) - break; - - /* Update the maximum frame rate */ - if (subdev == isp-isp_res.subdev) - omap3isp_resizer_max_rate(isp-isp_res, - pipe-max_rate); - - /* Retrieve the source format. Return an error if no source -* entity can be found, and stop checking the pipeline if the -* source entity isn't a subdev. -*/ - pad = media_entity_remote_source(pad); - if (pad == NULL) - return -EPIPE; - - if (media_entity_type(pad-entity) != MEDIA_ENT_T_V4L2_SUBDEV) - break; - - subdev = media_entity_to_v4l2_subdev(pad-entity); - } - - return 0; -} - static int __isp_video_get_format(struct isp_video *video, struct v4l2_format *format) { @@ -1043,11 +994,6 @@ isp_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type) pipe-output = far_end; } - /* Validate the pipeline and update its state. */ - ret = isp_video_validate_pipeline(pipe); - if (ret 0) - goto err_check_format; - pipe-error = false; spin_lock_irqsave(pipe-lock, flags); -- 1.7.2.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 23/35] omap3isp: Assume media_entity_pipeline_start may fail
Since media_entity_pipeline_start() now does link validation, it may actually fail. Perform the error handling. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi --- drivers/media/video/omap3isp/ispvideo.c | 52 -- 1 files changed, 28 insertions(+), 24 deletions(-) diff --git a/drivers/media/video/omap3isp/ispvideo.c b/drivers/media/video/omap3isp/ispvideo.c index b0d541b..d34f690 100644 --- a/drivers/media/video/omap3isp/ispvideo.c +++ b/drivers/media/video/omap3isp/ispvideo.c @@ -997,14 +997,16 @@ isp_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type) pipe-l3_ick = clk_get_rate(video-isp-clock[ISP_CLK_L3_ICK]); pipe-max_rate = pipe-l3_ick; - media_entity_pipeline_start(video-video.entity, pipe-pipe); + ret = media_entity_pipeline_start(video-video.entity, pipe-pipe); + if (ret 0) + goto err_pipeline_start; /* Verify that the currently configured format matches the output of * the connected subdev. */ ret = isp_video_check_format(video, vfh); if (ret 0) - goto error; + goto err_check_format; video-bpl_padding = ret; video-bpl_value = vfh-format.fmt.pix.bytesperline; @@ -1021,7 +1023,7 @@ isp_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type) } else { if (far_end == NULL) { ret = -EPIPE; - goto error; + goto err_check_format; } state = ISP_PIPELINE_STREAM_INPUT | ISP_PIPELINE_IDLE_INPUT; @@ -1032,7 +1034,7 @@ isp_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type) /* Validate the pipeline and update its state. */ ret = isp_video_validate_pipeline(pipe); if (ret 0) - goto error; + goto err_check_format; pipe-error = false; @@ -1054,7 +1056,7 @@ isp_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type) ret = omap3isp_video_queue_streamon(vfh-queue); if (ret 0) - goto error; + goto err_check_format; /* In sensor-to-memory mode, the stream can be started synchronously * to the stream on command. In memory-to-memory mode, it will be @@ -1064,32 +1066,34 @@ isp_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type) ret = omap3isp_pipeline_set_stream(pipe, ISP_PIPELINE_STREAM_CONTINUOUS); if (ret 0) - goto error; + goto err_set_stream; spin_lock_irqsave(video-queue-irqlock, flags); if (list_empty(video-dmaqueue)) video-dmaqueue_flags |= ISP_VIDEO_DMAQUEUE_UNDERRUN; spin_unlock_irqrestore(video-queue-irqlock, flags); } -error: - if (ret 0) { - omap3isp_video_queue_streamoff(vfh-queue); - media_entity_pipeline_stop(video-video.entity); - if (video-isp-pdata-set_constraints) - video-isp-pdata-set_constraints(video-isp, false); - /* The DMA queue must be emptied here, otherwise CCDC interrupts -* that will get triggered the next time the CCDC is powered up -* will try to access buffers that might have been freed but -* still present in the DMA queue. This can easily get triggered -* if the above omap3isp_pipeline_set_stream() call fails on a -* system with a free-running sensor. -*/ - INIT_LIST_HEAD(video-dmaqueue); - video-queue = NULL; - } + video-streaming = 1; + + mutex_unlock(video-stream_lock); + return 0; - if (!ret) - video-streaming = 1; +err_set_stream: + omap3isp_video_queue_streamoff(vfh-queue); +err_check_format: + media_entity_pipeline_stop(video-video.entity); +err_pipeline_start: + if (video-isp-pdata-set_constraints) + video-isp-pdata-set_constraints(video-isp, false); + /* The DMA queue must be emptied here, otherwise CCDC interrupts that +* will get triggered the next time the CCDC is powered up will try to +* access buffers that might have been freed but still present in the +* DMA queue. This can easily get triggered if the above +* omap3isp_pipeline_set_stream() call fails on a system with a +* free-running sensor. +*/ + INIT_LIST_HEAD(video-dmaqueue); + video-queue = NULL; mutex_unlock(video-stream_lock); return ret; -- 1.7.2.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 21/35] omap3: add definition for CONTROL_CAMERA_PHY_CTRL
This register is available only in OMAP3630. The original patch was submitted by Vimarsh Zutshi. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- arch/arm/mach-omap2/control.h |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h index 0ba68d3..f3acf09 100644 --- a/arch/arm/mach-omap2/control.h +++ b/arch/arm/mach-omap2/control.h @@ -183,6 +183,7 @@ #define OMAP3630_CONTROL_FUSE_OPP120_VDD1 (OMAP2_CONTROL_GENERAL + 0x0120) #define OMAP3630_CONTROL_FUSE_OPP50_VDD2(OMAP2_CONTROL_GENERAL + 0x0128) #define OMAP3630_CONTROL_FUSE_OPP100_VDD2 (OMAP2_CONTROL_GENERAL + 0x012C) +#define OMAP3630_CONTROL_CAMERA_PHY_CTRL (OMAP2_CONTROL_GENERAL + 0x02f0) /* OMAP44xx control efuse offsets */ #define OMAP44XX_CONTROL_FUSE_IVA_OPP500x22C -- 1.7.2.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 22/35] omap3isp: Move setting constaints above media_entity_pipeline_start
The clock rate for l3_ick will soon be read during pipeline validation which is now part of media_entity_pipeline_start(). For that reason we set constraints earlier on. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/video/omap3isp/ispvideo.c | 14 +++--- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/media/video/omap3isp/ispvideo.c b/drivers/media/video/omap3isp/ispvideo.c index c191f13..b0d541b 100644 --- a/drivers/media/video/omap3isp/ispvideo.c +++ b/drivers/media/video/omap3isp/ispvideo.c @@ -304,8 +304,6 @@ static int isp_video_validate_pipeline(struct isp_pipeline *pipe) struct v4l2_subdev *subdev; int ret; - pipe-max_rate = pipe-l3_ick; - subdev = isp_video_remote_subdev(pipe-output, NULL); if (subdev == NULL) return -EPIPE; @@ -993,6 +991,12 @@ isp_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type) */ pipe = video-video.entity.pipe ? to_isp_pipeline(video-video.entity) : video-pipe; + + if (video-isp-pdata-set_constraints) + video-isp-pdata-set_constraints(video-isp, true); + pipe-l3_ick = clk_get_rate(video-isp-clock[ISP_CLK_L3_ICK]); + pipe-max_rate = pipe-l3_ick; + media_entity_pipeline_start(video-video.entity, pipe-pipe); /* Verify that the currently configured format matches the output of @@ -1025,10 +1029,6 @@ isp_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type) pipe-output = far_end; } - if (video-isp-pdata-set_constraints) - video-isp-pdata-set_constraints(video-isp, true); - pipe-l3_ick = clk_get_rate(video-isp-clock[ISP_CLK_L3_ICK]); - /* Validate the pipeline and update its state. */ ret = isp_video_validate_pipeline(pipe); if (ret 0) @@ -1074,9 +1074,9 @@ isp_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type) error: if (ret 0) { omap3isp_video_queue_streamoff(vfh-queue); + media_entity_pipeline_stop(video-video.entity); if (video-isp-pdata-set_constraints) video-isp-pdata-set_constraints(video-isp, false); - media_entity_pipeline_stop(video-video.entity); /* The DMA queue must be emptied here, otherwise CCDC interrupts * that will get triggered the next time the CCDC is powered up * will try to access buffers that might have been freed but -- 1.7.2.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 05/35] v4l: vdev_to_v4l2_subdev() should have return type struct v4l2_subdev *
vdev_to_v4l2_subdev() should return struct v4l2_subdev *, not void *. Fix this. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- include/media/v4l2-subdev.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index feab950..bcaf6b8 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -545,7 +545,7 @@ struct v4l2_subdev { #define media_entity_to_v4l2_subdev(ent) \ container_of(ent, struct v4l2_subdev, entity) #define vdev_to_v4l2_subdev(vdev) \ - video_get_drvdata(vdev) + ((struct v4l2_subdev *)video_get_drvdata(vdev)) /* * Used for storing subdev information per file handle -- 1.7.2.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 14/35] v4l: Add DPCM compressed raw bayer pixel formats
Add three other colour orders for 10-bit to 8-bit DPCM compressed raw bayer pixel formats. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi --- Documentation/DocBook/media/v4l/pixfmt-srggb10.xml |2 +- .../DocBook/media/v4l/pixfmt-srggb10dpcm8.xml | 29 Documentation/DocBook/media/v4l/pixfmt.xml |1 + include/linux/videodev2.h |3 ++ 4 files changed, 34 insertions(+), 1 deletions(-) create mode 100644 Documentation/DocBook/media/v4l/pixfmt-srggb10dpcm8.xml diff --git a/Documentation/DocBook/media/v4l/pixfmt-srggb10.xml b/Documentation/DocBook/media/v4l/pixfmt-srggb10.xml index 7b27409..c1c62a9 100644 --- a/Documentation/DocBook/media/v4l/pixfmt-srggb10.xml +++ b/Documentation/DocBook/media/v4l/pixfmt-srggb10.xml @@ -1,4 +1,4 @@ -refentry +refentry id=pixfmt-srggb10 refmeta refentrytitleV4L2_PIX_FMT_SRGGB10 ('RG10'), V4L2_PIX_FMT_SGRBG10 ('BA10'), diff --git a/Documentation/DocBook/media/v4l/pixfmt-srggb10dpcm8.xml b/Documentation/DocBook/media/v4l/pixfmt-srggb10dpcm8.xml new file mode 100644 index 000..80937f1 --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-srggb10dpcm8.xml @@ -0,0 +1,29 @@ +refentry + refmeta + refentrytitle +V4L2_PIX_FMT_SRGGB10DPCM8 ('bBA8'), +V4L2_PIX_FMT_SGBRG10DPCM8 ('bGA8'), +V4L2_PIX_FMT_SGRBG10DPCM8 ('BD10'), +V4L2_PIX_FMT_SBGGR10DPCM8 ('bRA8'), +/refentrytitle + manvol; + /refmeta + refnamediv + refname id=V4L2-PIX-FMT-SRGGB10DPCM8constantV4L2_PIX_FMT_SRGGB10DPCM8/constant/refname + refname id=V4L2-PIX-FMT-SGBRG10DPCM8constantV4L2_PIX_FMT_SGBRG10DPCM8/constant/refname + refname id=V4L2-PIX-FMT-SGRBG10DPCM8constantV4L2_PIX_FMT_SGRBG10DPCM8/constant/refname + refname id=V4L2-PIX-FMT-SBGGR10DPCM8constantV4L2_PIX_FMT_SBGGR10DPCM8/constant/refname + refpurpose10-bit Bayer formats compressed to 8 bits/refpurpose + /refnamediv + refsect1 + titleDescription/title + + paraThe following four pixel formats are raw sRGB / Bayer formats + with 10 bits per colour compressed to 8 bits each, using DPCM + compression. DPCM, differential pulse-code modulation, is lossy. + Each colour component consumes 8 bits of memory. In other respects + this format is similar to xref + linkend=pixfmt-srggb10./xref/para + + /refsect1 +/refentry diff --git a/Documentation/DocBook/media/v4l/pixfmt.xml b/Documentation/DocBook/media/v4l/pixfmt.xml index 31eaae2..74d4fcd 100644 --- a/Documentation/DocBook/media/v4l/pixfmt.xml +++ b/Documentation/DocBook/media/v4l/pixfmt.xml @@ -673,6 +673,7 @@ access the palette, this must be done with ioctls of the Linux framebuffer API. sub-srggb8; sub-sbggr16; sub-srggb10; +sub-srggb10dpcm8; sub-srggb12; /section diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index f46350e..76f3153 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -378,7 +378,10 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_SGRBG12 v4l2_fourcc('B', 'A', '1', '2') /* 12 GRGR.. BGBG.. */ #define V4L2_PIX_FMT_SRGGB12 v4l2_fourcc('R', 'G', '1', '2') /* 12 RGRG.. GBGB.. */ /* 10bit raw bayer DPCM compressed to 8 bits */ +#define V4L2_PIX_FMT_SBGGR10DPCM8 v4l2_fourcc('b', 'B', 'A', '8') +#define V4L2_PIX_FMT_SGBRG10DPCM8 v4l2_fourcc('b', 'G', 'A', '8') #define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0') +#define V4L2_PIX_FMT_SRGGB10DPCM8 v4l2_fourcc('b', 'R', 'A', '8') /* * 10bit raw bayer, expanded to 16 bits * rrgg ggbb... -- 1.7.2.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 12/35] v4l: Image processing control class
Add control class for image processing controls. The control class deals with controls processing image, for example digital gain or noise filtering, which can be present in any part of the pipeline. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi --- Documentation/DocBook/media/v4l/controls.xml | 82 .../DocBook/media/v4l/vidioc-g-ext-ctrls.xml |6 ++ drivers/media/video/v4l2-ctrls.c | 13 +++ include/linux/videodev2.h |8 ++ 4 files changed, 109 insertions(+), 0 deletions(-) diff --git a/Documentation/DocBook/media/v4l/controls.xml b/Documentation/DocBook/media/v4l/controls.xml index 2257db4..4ca03f1 100644 --- a/Documentation/DocBook/media/v4l/controls.xml +++ b/Documentation/DocBook/media/v4l/controls.xml @@ -3524,4 +3524,86 @@ interface and may change in the future./para /section +section id=image-process-controls + titleImage Process Control Reference/title + + note + titleExperimental/title + + paraThis is an link + linkend=experimentalexperimental/link interface and may + change in the future./para + /note + + para + The Image Source control class is intended for low-level control of + image processing functions. Unlike + constantV4L2_CID_IMAGE_SOURCE_CLASS/constant, the controls in + this class affect processing the image, and do not control capturing + of it. + /para + + table pgwide=1 frame=none id=image-process-control-id + titleImage Source Control IDs/title + + tgroup cols=4 + colspec colname=c1 colwidth=1* / + colspec colname=c2 colwidth=6* / + colspec colname=c3 colwidth=2* / + colspec colname=c4 colwidth=6* / + spanspec namest=c1 nameend=c2 spanname=id / + spanspec namest=c2 nameend=c4 spanname=descr / + thead + row + entry spanname=id align=leftID/entry + entry align=leftType/entry + /rowrow rowsep=1entry spanname=descr align=leftDescription/entry + /row + /thead + tbody valign=top + rowentry/entry/row + row + entry spanname=idconstantV4L2_CID_IMAGE_PROC_CLASS/constant/entry + entryclass/entry + /row + row + entry spanname=descrThe IMAGE_PROC class descriptor./entry + /row + row + entry spanname=idconstantV4L2_CID_LINK_FREQ/constant/entry + entryinteger menu/entry + /row + row + entry spanname=descrData bus frequency. Together with the + media bus pixel code, bus type (clock cycles per sample), the + data bus frequency defines the pixel rate + (constantV4L2_CID_PIXEL_RATE/constant) in the + pixel array (or possibly elsewhere, if the device is not an + image sensor). The frame rate can be calculated from the pixel + clock, image width and height and horizontal and vertical + blanking. While the pixel rate control may be defined elsewhere + than in the subdev containing the pixel array, the frame rate + cannot be obtained from that information. This is because only + on the pixel array it can be assumed that the vertical and + horizontal blanking information is exact: no other blanking is + allowed in the pixel array. The selection of frame rate is + performed by selecting the desired horizontal and vertical + blanking. The unit of this control is Hz. /entry + /row + row + entry spanname=idconstantV4L2_CID_PIXEL_RATE/constant/entry + entry64-bit integer/entry + /row + row + entry spanname=descrPixel rate in the source pads of + the subdev. This control is read-only and its unit is + pixels / second. + /entry + /row + rowentry/entry/row + /tbody + /tgroup + /table + +/section /section diff --git a/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml b/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml index f420034..f41a2f5 100644 --- a/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml +++ b/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml @@ -271,6 +271,12 @@ These controls are described in xref source controls. These controls are described in xref linkend=image-source-controls /./entry /row + row + entryconstantV4L2_CTRL_CLASS_IMAGE_PROC/constant/entry + entry0x9e/entry entryThe class containing image + processing controls. These controls are described in xref + linkend=image-process-controls /./entry + /row /tbody /tgroup /table diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c index 3ca6bc7..1cbf97f 100644 --- a/drivers/media/video/v4l2-ctrls.c
[PATCH v5 24/35] omap3isp: Add lane configuration to platform data
Add lane configuration (order of clock and data lane) to platform data on both CCP2 and CSI-2. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/video/omap3isp/ispcsiphy.h | 15 ++- include/media/omap3isp.h | 25 + 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/drivers/media/video/omap3isp/ispcsiphy.h b/drivers/media/video/omap3isp/ispcsiphy.h index 9596dc6..e93a661 100644 --- a/drivers/media/video/omap3isp/ispcsiphy.h +++ b/drivers/media/video/omap3isp/ispcsiphy.h @@ -27,22 +27,11 @@ #ifndef OMAP3_ISP_CSI_PHY_H #define OMAP3_ISP_CSI_PHY_H +#include media/omap3isp.h + struct isp_csi2_device; struct regulator; -struct csiphy_lane { - u8 pos; - u8 pol; -}; - -#define ISP_CSIPHY2_NUM_DATA_LANES 2 -#define ISP_CSIPHY1_NUM_DATA_LANES 1 - -struct isp_csiphy_lanes_cfg { - struct csiphy_lane data[ISP_CSIPHY2_NUM_DATA_LANES]; - struct csiphy_lane clk; -}; - struct isp_csiphy_dphy_cfg { u8 ths_term; u8 ths_settle; diff --git a/include/media/omap3isp.h b/include/media/omap3isp.h index 3f4928d..4d94be5 100644 --- a/include/media/omap3isp.h +++ b/include/media/omap3isp.h @@ -91,6 +91,29 @@ enum { }; /** + * struct isp_csiphy_lane: CCP2/CSI2 lane position and polarity + * @pos: position of the lane + * @pol: polarity of the lane + */ +struct isp_csiphy_lane { + u8 pos; + u8 pol; +}; + +#define ISP_CSIPHY1_NUM_DATA_LANES 1 +#define ISP_CSIPHY2_NUM_DATA_LANES 2 + +/** + * struct isp_csiphy_lanes_cfg - CCP2/CSI2 lane configuration + * @data: Configuration of one or two data lanes + * @clk: Clock lane configuration + */ +struct isp_csiphy_lanes_cfg { + struct isp_csiphy_lane data[ISP_CSIPHY2_NUM_DATA_LANES]; + struct isp_csiphy_lane clk; +}; + +/** * struct isp_ccp2_platform_data - CCP2 interface platform data * @strobe_clk_pol: Strobe/clock polarity * 0 - Non Inverted, 1 - Inverted @@ -109,6 +132,7 @@ struct isp_ccp2_platform_data { unsigned int ccp2_mode:1; unsigned int phy_layer:1; unsigned int vpclk_div:2; + struct isp_csiphy_lanes_cfg lanecfg; }; /** @@ -119,6 +143,7 @@ struct isp_ccp2_platform_data { struct isp_csi2_platform_data { unsigned crc:1; unsigned vpclk_div:2; + struct isp_csiphy_lanes_cfg lanecfg; }; struct isp_subdev_i2c_board_info { -- 1.7.2.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 06/35] v4l: Check pad number in get try pointer functions
Unify functions to get try pointers and validate the pad number accessed by the user. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- include/media/v4l2-subdev.h | 30 +- 1 files changed, 13 insertions(+), 17 deletions(-) diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index bcaf6b8..7e85035 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -565,23 +565,19 @@ struct v4l2_subdev_fh { container_of(fh, struct v4l2_subdev_fh, vfh) #if defined(CONFIG_VIDEO_V4L2_SUBDEV_API) -static inline struct v4l2_mbus_framefmt * -v4l2_subdev_get_try_format(struct v4l2_subdev_fh *fh, unsigned int pad) -{ - return fh-pad[pad].try_fmt; -} - -static inline struct v4l2_rect * -v4l2_subdev_get_try_crop(struct v4l2_subdev_fh *fh, unsigned int pad) -{ - return fh-pad[pad].try_crop; -} - -static inline struct v4l2_rect * -v4l2_subdev_get_try_compose(struct v4l2_subdev_fh *fh, unsigned int pad) -{ - return fh-pad[pad].try_compose; -} +#define __V4L2_SUBDEV_MK_GET_TRY(rtype, fun_name, field_name) \ + static inline struct rtype *\ + v4l2_subdev_get_try_##fun_name(struct v4l2_subdev_fh *fh, \ + unsigned int pad)\ + { \ + BUG_ON(unlikely(pad = vdev_to_v4l2_subdev( \ + fh-vfh.vdev)-entity.num_pads)); \ + return fh-pad[pad].field_name;\ + } + +__V4L2_SUBDEV_MK_GET_TRY(v4l2_mbus_framefmt, format, try_fmt) +__V4L2_SUBDEV_MK_GET_TRY(v4l2_rect, crop, try_compose) +__V4L2_SUBDEV_MK_GET_TRY(v4l2_rect, compose, try_compose) #endif extern const struct v4l2_file_operations v4l2_subdev_fops; -- 1.7.2.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 11/35] v4l: Image source control class
Add image source control class. This control class is intended to contain low level controls which deal with control of the image capture process --- the A/D converter in image sensors, for example. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi --- Documentation/DocBook/media/v4l/controls.xml | 86 .../DocBook/media/v4l/vidioc-g-ext-ctrls.xml |6 ++ drivers/media/video/v4l2-ctrls.c |7 ++ include/linux/videodev2.h |9 ++ 4 files changed, 108 insertions(+), 0 deletions(-) diff --git a/Documentation/DocBook/media/v4l/controls.xml b/Documentation/DocBook/media/v4l/controls.xml index 3f3d2e2..2257db4 100644 --- a/Documentation/DocBook/media/v4l/controls.xml +++ b/Documentation/DocBook/media/v4l/controls.xml @@ -3438,4 +3438,90 @@ interface and may change in the future./para /table /section + +section id=image-source-controls + titleImage Source Control Reference/title + + note + titleExperimental/title + + paraThis is an link + linkend=experimentalexperimental/link interface and may + change in the future./para + /note + + para + The Image Source control class is intended for low-level + control of image source devices such as image sensors. The + devices feature an analogue to digital converter and a bus + transmitter to transmit the image data out of the device. + /para + + table pgwide=1 frame=none id=image-source-control-id + titleImage Source Control IDs/title + + tgroup cols=4 + colspec colname=c1 colwidth=1* / + colspec colname=c2 colwidth=6* / + colspec colname=c3 colwidth=2* / + colspec colname=c4 colwidth=6* / + spanspec namest=c1 nameend=c2 spanname=id / + spanspec namest=c2 nameend=c4 spanname=descr / + thead + row + entry spanname=id align=leftID/entry + entry align=leftType/entry + /rowrow rowsep=1entry spanname=descr align=leftDescription/entry + /row + /thead + tbody valign=top + rowentry/entry/row + row + entry spanname=idconstantV4L2_CID_IMAGE_SOURCE_CLASS/constant/entry + entryclass/entry + /row + row + entry spanname=descrThe IMAGE_SOURCE class descriptor./entry + /row + row + entry spanname=idconstantV4L2_CID_VBLANK/constant/entry + entryinteger/entry + /row + row + entry spanname=descrVertical blanking. The idle period + after every frame during which no image data is produced. + The unit of vertical blanking is a line. Every line has + length of the image width plus horizontal blanking at the + pixel rate defined by + constantV4L2_CID_PIXEL_RATE/constant control in the + same sub-device./entry + /row + row + entry spanname=idconstantV4L2_CID_HBLANK/constant/entry + entryinteger/entry + /row + row + entry spanname=descrHorizontal blanking. The idle + period after every line of image data during which no + image data is produced. The unit of horizontal blanking is + pixels./entry + /row + row + entry spanname=idconstantV4L2_CID_ANALOGUE_GAIN/constant/entry + entryinteger/entry + /row + row + entry spanname=descrAnalogue gain is gain affecting + all colour components in the pixel matrix. The gain + operation is performed in the analogue domain before A/D + conversion. + /entry + /row + rowentry/entry/row + /tbody + /tgroup + /table + +/section + /section diff --git a/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml b/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml index b17a7aa..f420034 100644 --- a/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml +++ b/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml @@ -265,6 +265,12 @@ These controls are described in xref These controls are described in xref linkend=flash-controls /./entry /row + row + entryconstantV4L2_CTRL_CLASS_IMAGE_SOURCE/constant/entry + entry0x9d/entry entryThe class containing image + source controls. These controls are described in xref + linkend=image-source-controls /./entry + /row /tbody /tgroup /table diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c index f0484bd..3ca6bc7 100644 --- a/drivers/media/video/v4l2-ctrls.c +++ b/drivers/media/video/v4l2-ctrls.c @@ -623,6 +623,12 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_FLASH_CHARGE: return Charge; case V4L2_CID_FLASH_READY: return Ready to Strobe; +
[PATCH v5 07/35] v4l: Support s_crop and g_crop through s/g_selection
Fall back to s_selection if s_crop isn't implemented by a driver. Same for g_selection / g_crop. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/video/v4l2-subdev.c | 37 +++-- 1 files changed, 35 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/v4l2-subdev.c b/drivers/media/video/v4l2-subdev.c index 7d22538..eda34cd 100644 --- a/drivers/media/video/v4l2-subdev.c +++ b/drivers/media/video/v4l2-subdev.c @@ -228,6 +228,8 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg) case VIDIOC_SUBDEV_G_CROP: { struct v4l2_subdev_crop *crop = arg; + struct v4l2_subdev_selection sel; + int rval; if (crop-which != V4L2_SUBDEV_FORMAT_TRY crop-which != V4L2_SUBDEV_FORMAT_ACTIVE) @@ -236,11 +238,27 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg) if (crop-pad = sd-entity.num_pads) return -EINVAL; - return v4l2_subdev_call(sd, pad, get_crop, subdev_fh, crop); + rval = v4l2_subdev_call(sd, pad, get_crop, subdev_fh, crop); + if (rval != -ENOIOCTLCMD) + return rval; + + memset(sel, 0, sizeof(sel)); + sel.which = crop-which; + sel.pad = crop-pad; + sel.target = V4L2_SUBDEV_SEL_TGT_CROP_ACTIVE; + + rval = v4l2_subdev_call( + sd, pad, get_selection, subdev_fh, sel); + + crop-rect = sel.r; + + return rval; } case VIDIOC_SUBDEV_S_CROP: { struct v4l2_subdev_crop *crop = arg; + struct v4l2_subdev_selection sel; + int rval; if (crop-which != V4L2_SUBDEV_FORMAT_TRY crop-which != V4L2_SUBDEV_FORMAT_ACTIVE) @@ -249,7 +267,22 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg) if (crop-pad = sd-entity.num_pads) return -EINVAL; - return v4l2_subdev_call(sd, pad, set_crop, subdev_fh, crop); + rval = v4l2_subdev_call(sd, pad, set_crop, subdev_fh, crop); + if (rval != -ENOIOCTLCMD) + return rval; + + memset(sel, 0, sizeof(sel)); + sel.which = crop-which; + sel.pad = crop-pad; + sel.target = V4L2_SUBDEV_SEL_TGT_CROP_ACTIVE; + sel.r = crop-rect; + + rval = v4l2_subdev_call( + sd, pad, set_selection, subdev_fh, sel); + + crop-rect = sel.r; + + return rval; } case VIDIOC_SUBDEV_ENUM_MBUS_CODE: { -- 1.7.2.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 17/35] v4l: Implement v4l2_subdev_link_validate()
v4l2_subdev_link_validate() is the default op for validating a link. In V4L2 subdev context, it is used to call a pad op which performs the proper link check without much extra work. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- Documentation/video4linux/v4l2-framework.txt | 12 + drivers/media/video/v4l2-subdev.c| 64 ++ include/media/v4l2-subdev.h | 12 + 3 files changed, 88 insertions(+), 0 deletions(-) diff --git a/Documentation/video4linux/v4l2-framework.txt b/Documentation/video4linux/v4l2-framework.txt index f06c563..9d341bc 100644 --- a/Documentation/video4linux/v4l2-framework.txt +++ b/Documentation/video4linux/v4l2-framework.txt @@ -312,6 +312,18 @@ If the subdev driver intends to process video and integrate with the media framework, it must implement format related functionality using v4l2_subdev_pad_ops instead of v4l2_subdev_video_ops. +In that case, the subdev driver may set the link_validate field to provide +its own link validation function. The link validation function is called for +every link in the pipeline where both of the ends of the links are V4L2 +sub-devices. The driver is still responsible for validating the correctness +of the format configuration between sub-devices and video nodes. + +If link_validate op is not set, the default function +v4l2_subdev_link_validate_default() is used instead. This function ensures +that width, height and the media bus pixel code are equal on both source and +sink of the link. Subdev drivers are also free to use this function to +perform the checks mentioned above in addition to their own checks. + A device (bridge) driver needs to register the v4l2_subdev with the v4l2_device: diff --git a/drivers/media/video/v4l2-subdev.c b/drivers/media/video/v4l2-subdev.c index eda34cd..507cde2 100644 --- a/drivers/media/video/v4l2-subdev.c +++ b/drivers/media/video/v4l2-subdev.c @@ -387,6 +387,70 @@ const struct v4l2_file_operations v4l2_subdev_fops = { .poll = subdev_poll, }; +#ifdef CONFIG_MEDIA_CONTROLLER +int v4l2_subdev_link_validate_default(struct v4l2_subdev *sd, + struct media_link *link, + struct v4l2_subdev_format *source_fmt, + struct v4l2_subdev_format *sink_fmt) +{ + if (source_fmt-format.width != sink_fmt-format.width + || source_fmt-format.height != sink_fmt-format.height + || source_fmt-format.code != sink_fmt-format.code) + return -EINVAL; + + return 0; +} +EXPORT_SYMBOL_GPL(v4l2_subdev_link_validate_default); + +static int +v4l2_subdev_link_validate_get_format(struct media_pad *pad, +struct v4l2_subdev_format *fmt) +{ + switch (media_entity_type(pad-entity)) { + case MEDIA_ENT_T_V4L2_SUBDEV: + fmt-which = V4L2_SUBDEV_FORMAT_ACTIVE; + fmt-pad = pad-index; + return v4l2_subdev_call(media_entity_to_v4l2_subdev( + pad-entity), + pad, get_fmt, NULL, fmt); + default: + WARN(1, Driver bug! Wrong media entity type %d, entity %s\n, +media_entity_type(pad-entity), pad-entity-name); + /* Fall through */ + case MEDIA_ENT_T_DEVNODE_V4L: + return -EINVAL; + } +} + +int v4l2_subdev_link_validate(struct media_link *link) +{ + struct v4l2_subdev *sink; + struct v4l2_subdev_format sink_fmt, source_fmt; + int rval; + + rval = v4l2_subdev_link_validate_get_format( + link-source, source_fmt); + if (rval 0) + return 0; + + rval = v4l2_subdev_link_validate_get_format( + link-sink, sink_fmt); + if (rval 0) + return 0; + + sink = media_entity_to_v4l2_subdev(link-sink-entity); + + rval = v4l2_subdev_call(sink, pad, link_validate, link, + source_fmt, sink_fmt); + if (rval != -ENOIOCTLCMD) + return rval; + + return v4l2_subdev_link_validate_default( + sink, link, source_fmt, sink_fmt); +} +EXPORT_SYMBOL_GPL(v4l2_subdev_link_validate); +#endif /* CONFIG_MEDIA_CONTROLLER */ + void v4l2_subdev_init(struct v4l2_subdev *sd, const struct v4l2_subdev_ops *ops) { INIT_LIST_HEAD(sd-list); diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 7e85035..1c2318b 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -470,6 +470,11 @@ struct v4l2_subdev_pad_ops { struct v4l2_subdev_selection *sel); int (*set_selection)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, struct v4l2_subdev_selection *sel); +#ifdef
[PATCH v5 13/35] v4l: Document raw bayer 4CC codes
Document guidelines how 4CC codes should be named. Only raw bayer is included currently. Other formats should be documented later on. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi --- Documentation/video4linux/4CCs.txt | 32 1 files changed, 32 insertions(+), 0 deletions(-) create mode 100644 Documentation/video4linux/4CCs.txt diff --git a/Documentation/video4linux/4CCs.txt b/Documentation/video4linux/4CCs.txt new file mode 100644 index 000..41241af --- /dev/null +++ b/Documentation/video4linux/4CCs.txt @@ -0,0 +1,32 @@ +Guidelines for Linux4Linux pixel format 4CCs + + +Guidelines for Video4Linux 4CC codes defined using v4l2_fourcc() are +specified in this document. First of the characters defines the nature of +the pixel format, compression and colour space. The interpretation of the +other three characters depends on the first one. + +Existing 4CCs may not obey these guidelines. + +Formats +=== + +Raw bayer +- + +The following first characters are used by raw bayer formats: + + B: raw bayer, uncompressed + b: raw bayer, DPCM compressed + a: A-law compressed + u: u-law compressed + +2nd character: pixel order + B: BGGR + G: GBRG + g: GRBG + R: RGGB + +3rd character: uncompressed bits-per-pixel 0--9, A-- + +4th character: compressed bits-per-pixel 0--9, A-- -- 1.7.2.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 16/35] v4l: Improve sub-device documentation for pad ops
Document that format related configuration is done through pad ops in case the driver does use the media framework. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- Documentation/video4linux/v4l2-framework.txt |9 + 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/Documentation/video4linux/v4l2-framework.txt b/Documentation/video4linux/v4l2-framework.txt index 659b2ba..f06c563 100644 --- a/Documentation/video4linux/v4l2-framework.txt +++ b/Documentation/video4linux/v4l2-framework.txt @@ -262,11 +262,16 @@ struct v4l2_subdev_video_ops { ... }; +struct v4l2_subdev_pad_ops { + ... +}; + struct v4l2_subdev_ops { const struct v4l2_subdev_core_ops *core; const struct v4l2_subdev_tuner_ops *tuner; const struct v4l2_subdev_audio_ops *audio; const struct v4l2_subdev_video_ops *video; + const struct v4l2_subdev_pad_ops *video; }; The core ops are common to all subdevs, the other categories are implemented @@ -303,6 +308,10 @@ Don't forget to cleanup the media entity before the sub-device is destroyed: media_entity_cleanup(sd-entity); +If the subdev driver intends to process video and integrate with the media +framework, it must implement format related functionality using +v4l2_subdev_pad_ops instead of v4l2_subdev_video_ops. + A device (bridge) driver needs to register the v4l2_subdev with the v4l2_device: -- 1.7.2.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 15/35] media: Add link_validate() op to check links to the sink pad
The purpose of the link_validate() op is to allow an entity driver to ensure that the properties of the pads at the both ends of the link are suitable for starting the pipeline. link_validate is called on sink pads on active links which belong to the active part of the graph. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- Documentation/media-framework.txt | 19 ++ drivers/media/media-entity.c | 50 +++- include/media/media-entity.h |5 ++- 3 files changed, 70 insertions(+), 4 deletions(-) diff --git a/Documentation/media-framework.txt b/Documentation/media-framework.txt index 3a0f879..8028754 100644 --- a/Documentation/media-framework.txt +++ b/Documentation/media-framework.txt @@ -335,6 +335,9 @@ the media_entity pipe field. Calls to media_entity_pipeline_start() can be nested. The pipeline pointer must be identical for all nested calls to the function. +media_entity_pipeline_start() may return an error. In that case, it will +clean up any the changes it did by itself. + When stopping the stream, drivers must notify the entities with media_entity_pipeline_stop(struct media_entity *entity); @@ -351,3 +354,19 @@ If other operations need to be disallowed on streaming entities (such as changing entities configuration parameters) drivers can explicitly check the media_entity stream_count field to find out if an entity is streaming. This operation must be done with the media_device graph_mutex held. + + +Link validation +--- + +Link validation is performed by media_entity_pipeline_start() for any +entity which has sink pads in the pipeline. The +media_entity::link_validate() callback is used for that purpose. In +link_validate() callback, entity driver should check that the properties of +the source pad of the connected entity and its own sink pad match. It is up +to the type of the entity (and in the end, the properties of the hardware) +what matching actually means. + +Subsystems should facilitate link validation by providing subsystem specific +helper functions to provide easy access for commonly needed information, and +in the end provide a way to use driver-specific callbacks. diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c index 056138f..d6d0e81 100644 --- a/drivers/media/media-entity.c +++ b/drivers/media/media-entity.c @@ -214,23 +214,69 @@ EXPORT_SYMBOL_GPL(media_entity_graph_walk_next); * pipeline pointer must be identical for all nested calls to * media_entity_pipeline_start(). */ -void media_entity_pipeline_start(struct media_entity *entity, -struct media_pipeline *pipe) +__must_check int media_entity_pipeline_start(struct media_entity *entity, +struct media_pipeline *pipe) { struct media_device *mdev = entity-parent; struct media_entity_graph graph; + struct media_entity *entity_err = entity; + int ret; mutex_lock(mdev-graph_mutex); media_entity_graph_walk_start(graph, entity); while ((entity = media_entity_graph_walk_next(graph))) { + unsigned int i; + entity-stream_count++; WARN_ON(entity-pipe entity-pipe != pipe); entity-pipe = pipe; + + /* Already streaming --- no need to check. */ + if (entity-stream_count 1) + continue; + + if (!entity-ops || !entity-ops-link_validate) + continue; + + for (i = 0; i entity-num_links; i++) { + struct media_link *link = entity-links[i]; + + /* Is this pad part of an enabled link? */ + if (!(link-flags MEDIA_LNK_FL_ENABLED)) + continue; + + /* Are we the sink or not? */ + if (link-sink-entity != entity) + continue; + + ret = entity-ops-link_validate(link); + if (ret 0 ret != -ENOIOCTLCMD) + goto error; + } } mutex_unlock(mdev-graph_mutex); + + return 0; + +error: + /* +* Link validation on graph failed. We revert what we did and +* return the error. +*/ + media_entity_graph_walk_start(graph, entity_err); + + while ((entity_err = media_entity_graph_walk_next(graph))) { + entity_err-stream_count--; + if (entity_err-stream_count == 0) + entity_err-pipe = NULL; + } + + mutex_unlock(mdev-graph_mutex); + + return ret; } EXPORT_SYMBOL_GPL(media_entity_pipeline_start); diff --git a/include/media/media-entity.h b/include/media/media-entity.h index 29e7bba..0c16f51 100644 ---
[PATCH v5 10/35] v4l: Mark VIDIOC_SUBDEV_G_CROP and VIDIOC_SUBDEV_S_CROP obsolete
These two IOCTLS are obsoleted by VIDIOC_SUBDEV_G_SELECTION and VIDIOC_SUBDEV_S_SELECTION. Mark them obsolete. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- Documentation/DocBook/media/v4l/compat.xml |7 +++ .../DocBook/media/v4l/vidioc-subdev-g-crop.xml |9 ++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Documentation/DocBook/media/v4l/compat.xml b/Documentation/DocBook/media/v4l/compat.xml index 603fa4ad..ebfe47e 100644 --- a/Documentation/DocBook/media/v4l/compat.xml +++ b/Documentation/DocBook/media/v4l/compat.xml @@ -2547,6 +2547,13 @@ interfaces and should not be implemented in new drivers./para constantVIDIOC_S_MPEGCOMP/constant ioctls. Use Extended Controls, xref linkend=extended-controls /./para /listitem +listitem + paraconstantVIDIOC_SUBDEV_G_CROP/constant and + constantVIDIOC_SUBDEV_S_CROP/constant ioctls. Use + constantVIDIOC_SUBDEV_G_SELECTION/constant and + constantVIDIOC_SUBDEV_S_SELECTION/constant, xref + linkend=vidioc-subdev-g-selection /./para +/listitem /itemizedlist /section /section diff --git a/Documentation/DocBook/media/v4l/vidioc-subdev-g-crop.xml b/Documentation/DocBook/media/v4l/vidioc-subdev-g-crop.xml index 0619732..4cddd78 100644 --- a/Documentation/DocBook/media/v4l/vidioc-subdev-g-crop.xml +++ b/Documentation/DocBook/media/v4l/vidioc-subdev-g-crop.xml @@ -58,9 +58,12 @@ titleDescription/title note - titleExperimental/title - paraThis is an link linkend=experimentalexperimental/link - interface and may change in the future./para + titleObsolete/title + + paraThis is an link linkend=obsoleteobsolete/link + interface and may be removed in the future. It is superseded by + link linkend=vidioc-subdev-g-selectionthe selection + API/link./para /note paraTo retrieve the current crop rectangle applications set the -- 1.7.2.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 01/35] v4l: Introduce integer menu controls
Create a new control type called V4L2_CTRL_TYPE_INTEGER_MENU. Integer menu controls are just like menu controls but the menu items are 64-bit integers rather than strings. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Tested-by: Sylwester Nawrocki s.nawro...@samsung.com --- drivers/media/video/v4l2-ctrls.c | 74 +- include/linux/videodev2.h|6 +++- include/media/v4l2-ctrls.h |6 +++- 3 files changed, 67 insertions(+), 19 deletions(-) diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c index 9091172..f0484bd 100644 --- a/drivers/media/video/v4l2-ctrls.c +++ b/drivers/media/video/v4l2-ctrls.c @@ -828,7 +828,8 @@ static void fill_event(struct v4l2_event *ev, struct v4l2_ctrl *ctrl, u32 change ev-u.ctrl.value64 = ctrl-cur.val64; ev-u.ctrl.minimum = ctrl-minimum; ev-u.ctrl.maximum = ctrl-maximum; - if (ctrl-type == V4L2_CTRL_TYPE_MENU) + if (ctrl-type == V4L2_CTRL_TYPE_MENU + || ctrl-type == V4L2_CTRL_TYPE_INTEGER_MENU) ev-u.ctrl.step = 1; else ev-u.ctrl.step = ctrl-step; @@ -1059,10 +1060,13 @@ static int validate_new_int(const struct v4l2_ctrl *ctrl, s32 *pval) return 0; case V4L2_CTRL_TYPE_MENU: + case V4L2_CTRL_TYPE_INTEGER_MENU: if (val ctrl-minimum || val ctrl-maximum) return -ERANGE; - if (ctrl-qmenu[val][0] == '\0' || - (ctrl-menu_skip_mask (1 val))) + if (ctrl-menu_skip_mask (1 val)) + return -EINVAL; + if (ctrl-type == V4L2_CTRL_TYPE_MENU + ctrl-qmenu[val][0] == '\0') return -EINVAL; return 0; @@ -1090,6 +1094,7 @@ static int validate_new(const struct v4l2_ctrl *ctrl, struct v4l2_ext_control *c case V4L2_CTRL_TYPE_INTEGER: case V4L2_CTRL_TYPE_BOOLEAN: case V4L2_CTRL_TYPE_MENU: + case V4L2_CTRL_TYPE_INTEGER_MENU: case V4L2_CTRL_TYPE_BITMASK: case V4L2_CTRL_TYPE_BUTTON: case V4L2_CTRL_TYPE_CTRL_CLASS: @@ -1319,7 +1324,8 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl, const struct v4l2_ctrl_ops *ops, u32 id, const char *name, enum v4l2_ctrl_type type, s32 min, s32 max, u32 step, s32 def, - u32 flags, const char * const *qmenu, void *priv) + u32 flags, const char * const *qmenu, + const s64 *qmenu_int, void *priv) { struct v4l2_ctrl *ctrl; unsigned sz_extra = 0; @@ -1332,6 +1338,7 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl, (type == V4L2_CTRL_TYPE_INTEGER step == 0) || (type == V4L2_CTRL_TYPE_BITMASK max == 0) || (type == V4L2_CTRL_TYPE_MENU qmenu == NULL) || + (type == V4L2_CTRL_TYPE_INTEGER_MENU qmenu_int == NULL) || (type == V4L2_CTRL_TYPE_STRING max == 0)) { handler_set_err(hdl, -ERANGE); return NULL; @@ -1342,6 +1349,7 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl, } if ((type == V4L2_CTRL_TYPE_INTEGER || type == V4L2_CTRL_TYPE_MENU || +type == V4L2_CTRL_TYPE_INTEGER_MENU || type == V4L2_CTRL_TYPE_BOOLEAN) (def min || def max)) { handler_set_err(hdl, -ERANGE); @@ -1376,7 +1384,10 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl, ctrl-minimum = min; ctrl-maximum = max; ctrl-step = step; - ctrl-qmenu = qmenu; + if (type == V4L2_CTRL_TYPE_MENU) + ctrl-qmenu = qmenu; + else if (type == V4L2_CTRL_TYPE_INTEGER_MENU) + ctrl-qmenu_int = qmenu_int; ctrl-priv = priv; ctrl-cur.val = ctrl-val = ctrl-default_value = def; @@ -1403,6 +1414,7 @@ struct v4l2_ctrl *v4l2_ctrl_new_custom(struct v4l2_ctrl_handler *hdl, struct v4l2_ctrl *ctrl; const char *name = cfg-name; const char * const *qmenu = cfg-qmenu; + const s64 *qmenu_int = cfg-qmenu_int; enum v4l2_ctrl_type type = cfg-type; u32 flags = cfg-flags; s32 min = cfg-min; @@ -1414,18 +1426,24 @@ struct v4l2_ctrl *v4l2_ctrl_new_custom(struct v4l2_ctrl_handler *hdl, v4l2_ctrl_fill(cfg-id, name, type, min, max, step, def, flags); - is_menu = (cfg-type == V4L2_CTRL_TYPE_MENU); + is_menu = (cfg-type == V4L2_CTRL_TYPE_MENU || + cfg-type == V4L2_CTRL_TYPE_INTEGER_MENU); if (is_menu) WARN_ON(step); else
[PATCH v5 03/35] vivi: Add an integer menu test control
Add an integer menu test control for the vivi driver. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/video/vivi.c | 22 ++ 1 files changed, 22 insertions(+), 0 deletions(-) diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c index 5e8b071..d75a1e4 100644 --- a/drivers/media/video/vivi.c +++ b/drivers/media/video/vivi.c @@ -177,6 +177,7 @@ struct vivi_dev { struct v4l2_ctrl *menu; struct v4l2_ctrl *string; struct v4l2_ctrl *bitmask; + struct v4l2_ctrl *int_menu; spinlock_t slock; struct mutex mutex; @@ -503,6 +504,10 @@ static void vivi_fillbuff(struct vivi_dev *dev, struct vivi_buffer *buf) dev-boolean-cur.val, dev-menu-qmenu[dev-menu-cur.val], dev-string-cur.string); + snprintf(str, sizeof(str), integer_menu %lld, value %d , + dev-int_menu-qmenu_int[dev-int_menu-cur.val], + dev-int_menu-cur.val); + gen_text(dev, vbuf, line++ * 16, 16, str); mutex_unlock(dev-ctrl_handler.lock); gen_text(dev, vbuf, line++ * 16, 16, str); if (dev-button_pressed) { @@ -1165,6 +1170,22 @@ static const struct v4l2_ctrl_config vivi_ctrl_bitmask = { .step = 0, }; +static const s64 vivi_ctrl_int_menu_values[] = { + 1, 1, 2, 3, 5, 8, 13, 21, 42, +}; + +static const struct v4l2_ctrl_config vivi_ctrl_int_menu = { + .ops = vivi_ctrl_ops, + .id = VIVI_CID_CUSTOM_BASE + 7, + .name = Integer menu, + .type = V4L2_CTRL_TYPE_INTEGER_MENU, + .min = 1, + .max = 8, + .def = 4, + .menu_skip_mask = 0x02, + .qmenu_int = vivi_ctrl_int_menu_values, +}; + static const struct v4l2_file_operations vivi_fops = { .owner = THIS_MODULE, .open = v4l2_fh_open, @@ -1275,6 +1296,7 @@ static int __init vivi_create_instance(int inst) dev-menu = v4l2_ctrl_new_custom(hdl, vivi_ctrl_menu, NULL); dev-string = v4l2_ctrl_new_custom(hdl, vivi_ctrl_string, NULL); dev-bitmask = v4l2_ctrl_new_custom(hdl, vivi_ctrl_bitmask, NULL); + dev-int_menu = v4l2_ctrl_new_custom(hdl, vivi_ctrl_int_menu, NULL); if (hdl-error) { ret = hdl-error; goto unreg_dev; -- 1.7.2.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v5 08/35] v4l: Add subdev selections documentation: svg and dia files
Hi Sakari, Thanks for the patch. On Tuesday 06 March 2012 18:32:49 Sakari Ailus wrote: Add svga and dia files for V4L2 subdev selections documentation. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 04/34] v4l: VIDIOC_SUBDEV_S_SELECTION and VIDIOC_SUBDEV_G_SELECTION IOCTLs
On 03/06/2012 05:27 PM, Laurent Pinchart wrote: On Tuesday 06 March 2012 17:50:36 Sakari Ailus wrote: On Mon, Mar 05, 2012 at 11:59:22AM +0100, Laurent Pinchart wrote: On Friday 02 March 2012 19:30:12 Sakari Ailus wrote: Add support for VIDIOC_SUBDEV_S_SELECTION and VIDIOC_SUBDEV_G_SELECTION IOCTLs. They replace functionality provided by VIDIOC_SUBDEV_S_CROP and VIDIOC_SUBDEV_G_CROP IOCTLs and also add new functionality (composing). VIDIOC_SUBDEV_G_CROP and VIDIOC_SUBDEV_S_CROP continue to be supported. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi Except for the ACTIVE name, Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Maybe we could discuss this on IRC with Tomasz ? Tomasz wasn't online when I checked. How about CURRENT? Sounds good to me. Let's see if Tomasz will be online tomorrow ;-) Hi, What do you think about ACTIVE - ACTUAL? Similar word with the same number of letters :) Regards, TS -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v5 09/35] v4l: Add subdev selections documentation
Hi Sakari, Thanks for the patch. On Tuesday 06 March 2012 18:32:50 Sakari Ailus wrote: Add documentation for V4L2 subdev selection API. This changes also experimental V4L2 subdev API so that scaling now works through selection API only. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com (pending a possible rename of ACTIVE to something else) -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v5 23/35] omap3isp: Assume media_entity_pipeline_start may fail
Hi Sakari, Thanks for the patch. On Tuesday 06 March 2012 18:33:04 Sakari Ailus wrote: Since media_entity_pipeline_start() now does link validation, it may actually fail. Perform the error handling. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Lockup on second streamon with omap3-isp
Hi, I have a custom dm3730 board, running a 3.2.0 kernel. The board is equipped with an aptina MT9J sensor on parallel interface. Whenever I try to run yavta twice, the second run leads to a soft lockup in omap3isp_video_queue_streamon (see below) What can I do / test to debug this issue ? # get.vga Device /dev/video2 opened. Device `OMAP3 ISP CCDC output' on `media' is a video capture device. Video format set: SGRBG8 (47425247) 640x480 (stride 640) buffer size 307200 Video format: SGRBG8 (47425247) 640x480 (stride 640) buffer size 307200 3 buffers requested. length: 307200 offset: 0 Buffer 0 mapped at address 0x4023e000. length: 307200 offset: 307200 Buffer 1 mapped at address 0x4034d000. length: 307200 offset: 614400 Buffer 2 mapped at address 0x40444000. 0 (0) [-] 4294967295 307200 bytes 100.397705 100.397796 7.817 fps 1 (1) [-] 4294967295 307200 bytes 100.495666 100.495788 10.208 fps 2 (2) [-] 4294967295 307200 bytes 100.593658 100.593750 10.205 fps 3 (0) [-] 4294967295 307200 bytes 100.691619 100.691741 10.208 fps 4 (1) [-] 4294967295 307200 bytes 100.789611 100.789703 10.205 fps 5 (2) [-] 4294967295 307200 bytes 100.887573 100.887695 10.208 fps 6 (0) [-] 4294967295 307200 bytes 100.985565 100.985656 10.205 fps 7 (1) [-] 4294967295 307200 bytes 101.083526 101.083709 10.208 fps 8 (2) [-] 4294967295 307200 bytes 101.181488 101.181610 10.208 fps 9 (0) [-] 4294967295 307200 bytes 101.279480 101.279571 10.205 fps Captured 10 frames in 1.009796 seconds (9.902989 fps, 3042198.137254 B/s). 3 buffers released. [1]+ Done httpd # get.vga Device /dev/video2 opened. Device `OMAP3 ISP CCDC output' on `media' is a video capture device. Video format set: SGRBG8 (47425247) 640x480 (stride 640) buffer size 307200 Video format: SGRBG8 (47425247) 640x480 (stride 640) buffer size 307200 3 buffers requested. length: 307200 offset: 0 Buffer 0 mapped at address 0x40285000. length: 307200 offset: 307200 Buffer 1 mapped at address 0x40314000. length: 307200 offset: 614400 Buffer 2 mapped at address 0x403bb000. BUG: soft lockup - CPU#0 stuck for 22s! [yavta:495] Modules linked in: ks8851_mll omap3_isp fpgacam(O) Pid: 495, comm:yavta CPU: 0Tainted: G O (3.2.0 #52) PC is at __do_softirq+0x50/0x110 LR is at __do_softirq+0x38/0x110 pc : [c003746c]lr : [c0037454]psr: 2113 sp : ce8e5c88 ip : cf406140 fp : r10: cee90800 r9 : 000a r8 : ce8e4000 r7 : 0002 r6 : r5 : r4 : 0025 r3 : c044e580 r2 : r1 : 0002 r0 : Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user Control: 10c5387d Table: 8e858019 DAC: 0015 [c00123b0] (unwind_backtrace+0x0/0xec) from [c00646c4] (watchdog_timer_fn+0xd8/0x128) [c00646c4] (watchdog_timer_fn+0xd8/0x128) from [c004e640] (__run_hrtimer+0x68/0xe4) [c004e640] (__run_hrtimer+0x68/0xe4) from [c004e8b0] (hrtimer_interrupt+0x11c/0x2a4) [c004e8b0] (hrtimer_interrupt+0x11c/0x2a4) from [c0018f44] (omap2_gp_timer_interrupt+0x24/0x34) [c0018f44] (omap2_gp_timer_interrupt+0x24/0x34) from [c0064df8] (handle_irq_event_percpu+0x28/0x110) [c0064df8] (handle_irq_event_percpu+0x28/0x110) from [c0064f34] (handle_irq_event+0x54/0x74) [c0064f34] (handle_irq_event+0x54/0x74) from [c00676f8] (handle_level_irq+0xb4/0x100) [c00676f8] (handle_level_irq+0xb4/0x100) from [c0064a28] (generic_handle_irq+0x28/0x30) [c0064a28] (generic_handle_irq+0x28/0x30) from [c000e570] (handle_IRQ+0x60/0x84) [c000e570] (handle_IRQ+0x60/0x84) from [c000d874] (__irq_svc+0x34/0x98) [c000d874] (__irq_svc+0x34/0x98) from [c003746c] (__do_softirq+0x50/0x110) [c003746c] (__do_softirq+0x50/0x110) from [c00376f0] (irq_exit+0x48/0x9c)omap3isp_video_queue_streamon [c00376f0] (irq_exit+0x48/0x9c) from [c000e574] (handle_IRQ+0x64/0x84) [c000e574] (handle_IRQ+0x64/0x84) from [c000d874] (__irq_svc+0x34/0x98) [c000d874] (__irq_svc+0x34/0x98) from [bf007864] (+0x6c/0xa0 [omap3_isp]) [bf007864] (omap3isp_video_queue_streamon+0x6c/0xa0 [omap3_isp]) from [bf0096cc] (isp_video_streamon+0x178/0x258 [omap3_isp]) [bf0096cc] (isp_video_streamon+0x178/0x258 [omap3_isp]) from [c022cae4] (__video_do_ioctl+0x1b9c/0x4894) [c022cae4] (__video_do_ioctl+0x1b9c/0x4894) from [c022ae08] (video_usercopy+0x1b8/0x298) [c022ae08] (video_usercopy+0x1b8/0x298) from [c0229d48] (v4l2_ioctl+0x68/0x114) [c0229d48] (v4l2_ioctl+0x68/0x114) from [c00a2514] (vfs_ioctl+0x20/0x3c) [c00a2514] (vfs_ioctl+0x20/0x3c) from [c00a2d9c] (do_vfs_ioctl+0x1ac/0x1c4) [c00a2d9c] (do_vfs_ioctl+0x1ac/0x1c4) from [c00a2de8] (sys_ioctl+0x34/0x54) [c00a2de8] (sys_ioctl+0x34/0x54) from [c000dcc0] (ret_fast_syscall+0x0/0x30) Kernel panic - not syncing: softlockup: hung tasks -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: rtl2830: __udivdi3 undefined
On Sun, Mar 4, 2012 at 23:19, Gianluca Gennari gennar...@gmail.com wrote: Probably the best solution is to use div_u64. The following patch fixed the warning on my 32 bit system. Signed-off-by: Gianluca Gennari gennar...@gmail.com Thanks, that fixes it (div_u64() is do_div() on 32-bit). Acked-by: Geert Uytterhoeven ge...@linux-m68k.org --- drivers/media/dvb/frontends/rtl2830.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/media/dvb/frontends/rtl2830.c b/drivers/media/dvb/frontends/rtl2830.c index f971d94..45196c5 100644 --- a/drivers/media/dvb/frontends/rtl2830.c +++ b/drivers/media/dvb/frontends/rtl2830.c @@ -244,7 +244,7 @@ static int rtl2830_init(struct dvb_frontend *fe) num = priv-cfg.if_dvbt % priv-cfg.xtal; num *= 0x40; - num /= priv-cfg.xtal; + num = div_u64(num, priv-cfg.xtal); num = -num; if_ctl = num 0x3f; dbg(%s: if_ctl=%08x, __func__, if_ctl); Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say programmer or something like that. -- Linus Torvalds -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
cron job: media_tree daily build: WARNINGS
This message is generated daily by a cron job that builds media_tree for the kernels and architectures in the list below. Results of the daily build of media_tree: date:Tue Mar 6 19:00:18 CET 2012 git hash:e8ca6d20a65d9d94693a0ed99b12d95b882dc859 gcc version: i686-linux-gcc (GCC) 4.6.2 host hardware:x86_64 host os: 3.1-2.slh.1-amd64 linux-git-arm-eabi-enoxys: WARNINGS linux-git-arm-eabi-omap: WARNINGS linux-git-armv5-ixp: WARNINGS linux-git-i686: WARNINGS linux-git-m32r: WARNINGS linux-git-mips: WARNINGS linux-git-powerpc64: WARNINGS linux-git-x86_64: WARNINGS linux-2.6.31.12-i686: WARNINGS linux-2.6.32.6-i686: WARNINGS linux-2.6.33-i686: WARNINGS linux-2.6.34-i686: WARNINGS linux-2.6.35.3-i686: WARNINGS linux-2.6.36-i686: WARNINGS linux-2.6.37-i686: WARNINGS linux-2.6.38.2-i686: WARNINGS linux-2.6.39.1-i686: WARNINGS linux-3.0-i686: WARNINGS linux-3.1-i686: WARNINGS linux-3.2.1-i686: WARNINGS linux-3.3-rc1-i686: WARNINGS linux-2.6.31.12-x86_64: WARNINGS linux-2.6.32.6-x86_64: WARNINGS linux-2.6.33-x86_64: WARNINGS linux-2.6.34-x86_64: WARNINGS linux-2.6.35.3-x86_64: WARNINGS linux-2.6.36-x86_64: WARNINGS linux-2.6.37-x86_64: WARNINGS linux-2.6.38.2-x86_64: WARNINGS linux-2.6.39.1-x86_64: WARNINGS linux-3.0-x86_64: WARNINGS linux-3.1-x86_64: WARNINGS linux-3.2.1-x86_64: WARNINGS linux-3.3-rc1-x86_64: WARNINGS apps: WARNINGS spec-git: WARNINGS sparse: ERRORS Detailed results are available here: http://www.xs4all.nl/~hverkuil/logs/Tuesday.log Full logs are available here: http://www.xs4all.nl/~hverkuil/logs/Tuesday.tar.bz2 The V4L-DVB specification from this daily build is here: http://www.xs4all.nl/~hverkuil/spec/media.html -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 04/34] v4l: VIDIOC_SUBDEV_S_SELECTION and VIDIOC_SUBDEV_G_SELECTION IOCTLs
Hi Tomasz, Tomasz Stanislawski wrote: On 03/06/2012 05:27 PM, Laurent Pinchart wrote: On Tuesday 06 March 2012 17:50:36 Sakari Ailus wrote: On Mon, Mar 05, 2012 at 11:59:22AM +0100, Laurent Pinchart wrote: On Friday 02 March 2012 19:30:12 Sakari Ailus wrote: Add support for VIDIOC_SUBDEV_S_SELECTION and VIDIOC_SUBDEV_G_SELECTION IOCTLs. They replace functionality provided by VIDIOC_SUBDEV_S_CROP and VIDIOC_SUBDEV_G_CROP IOCTLs and also add new functionality (composing). VIDIOC_SUBDEV_G_CROP and VIDIOC_SUBDEV_S_CROP continue to be supported. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi Except for the ACTIVE name, Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Maybe we could discuss this on IRC with Tomasz ? Tomasz wasn't online when I checked. How about CURRENT? Sounds good to me. Let's see if Tomasz will be online tomorrow ;-) Hi, What do you think about ACTIVE - ACTUAL? Similar word with the same number of letters :) Sounds good to me; perhaps even better than CURRENT. I'm fine with either with perhaps a small inclination towards actual. Laurent? Cheers, -- Sakari Ailus sakari.ai...@iki.fi -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 04/34] v4l: VIDIOC_SUBDEV_S_SELECTION and VIDIOC_SUBDEV_G_SELECTION IOCTLs
On Tuesday 06 March 2012 21:55:52 Sakari Ailus wrote: Tomasz Stanislawski wrote: On 03/06/2012 05:27 PM, Laurent Pinchart wrote: On Tuesday 06 March 2012 17:50:36 Sakari Ailus wrote: On Mon, Mar 05, 2012 at 11:59:22AM +0100, Laurent Pinchart wrote: On Friday 02 March 2012 19:30:12 Sakari Ailus wrote: Add support for VIDIOC_SUBDEV_S_SELECTION and VIDIOC_SUBDEV_G_SELECTION IOCTLs. They replace functionality provided by VIDIOC_SUBDEV_S_CROP and VIDIOC_SUBDEV_G_CROP IOCTLs and also add new functionality (composing). VIDIOC_SUBDEV_G_CROP and VIDIOC_SUBDEV_S_CROP continue to be supported. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi Except for the ACTIVE name, Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Maybe we could discuss this on IRC with Tomasz ? Tomasz wasn't online when I checked. How about CURRENT? Sounds good to me. Let's see if Tomasz will be online tomorrow ;-) Hi, What do you think about ACTIVE - ACTUAL? Similar word with the same number of letters :) Sounds good to me; perhaps even better than CURRENT. I'm fine with either with perhaps a small inclination towards actual. Laurent? ACTUAL is good. -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 04/34] v4l: VIDIOC_SUBDEV_S_SELECTION and VIDIOC_SUBDEV_G_SELECTION IOCTLs
Hi Laurent, Laurent Pinchart wrote: On Tuesday 06 March 2012 21:55:52 Sakari Ailus wrote: Tomasz Stanislawski wrote: On 03/06/2012 05:27 PM, Laurent Pinchart wrote: On Tuesday 06 March 2012 17:50:36 Sakari Ailus wrote: On Mon, Mar 05, 2012 at 11:59:22AM +0100, Laurent Pinchart wrote: On Friday 02 March 2012 19:30:12 Sakari Ailus wrote: Add support for VIDIOC_SUBDEV_S_SELECTION and VIDIOC_SUBDEV_G_SELECTION IOCTLs. They replace functionality provided by VIDIOC_SUBDEV_S_CROP and VIDIOC_SUBDEV_G_CROP IOCTLs and also add new functionality (composing). VIDIOC_SUBDEV_G_CROP and VIDIOC_SUBDEV_S_CROP continue to be supported. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi Except for the ACTIVE name, Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Maybe we could discuss this on IRC with Tomasz ? Tomasz wasn't online when I checked. How about CURRENT? Sounds good to me. Let's see if Tomasz will be online tomorrow ;-) Hi, What do you think about ACTIVE - ACTUAL? Similar word with the same number of letters :) Sounds good to me; perhaps even better than CURRENT. I'm fine with either with perhaps a small inclination towards actual. Laurent? ACTUAL is good. I guess that's decided then. I'll prepare the patchset accordingly. Cheers. -- Sakari Ailus sakari.ai...@iki.fi -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 2/5] mt9p031: Remove unused xskip and yskip fields in struct mt9p031
Hi Laurent, Thanks for the patch. Laurent Pinchart wrote: The fields are set but never used, remove them. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/video/mt9p031.c |4 1 files changed, 0 insertions(+), 4 deletions(-) Reviewed-by: Sakari Ailus sakari.ai...@iki.fi -- Sakari Ailus sakari.ai...@iki.fi -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 4/5] mt9p031: Use generic PLL setup code
Thanks for the patch, Laurent! Laurent Pinchart wrote: Compute the PLL parameters at runtime using the generic Aptina PLL helper. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/video/Kconfig |1 + drivers/media/video/mt9p031.c | 62 ++--- 2 files changed, 28 insertions(+), 35 deletions(-) Acked-by: Sakari Ailus sakari.ai...@iki.fi -- Sakari Ailus sakari.ai...@iki.fi -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Technotrend TT-Connect CT 3650 and dvb_ca
Hello Everyone ! I have three DVB-C devices of the type mentioned, connected to my mythtv-server which have been working great for a long time. As my cable provider now are planning to start encrypting all channels, I have bought a Xcrypt CAM module as needed. I soon realised that I needed to upgrade the kernel and are now running kernel /: 3.2.0-17-generic #27-Ubuntu SMP Fri Feb 24 22:03:50 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux/ . When inserting the module everything looks well : /dvb_ca adapter 0: DVB CAM detected and initialised successfully/ The problems start when trying to watch an encrypted channel. I do get a channel lock in myth, so far so good, but no picture... In my syslog I see the following : /dvb_ca adapter 0: CAM tried to send a buffer larger than the link buffer size (32896 255)! dvb_ca adapter 0: CAM tried to send a buffer larger than the ecount size! dvb_ca adapter 0: DVB CAM link initialisation failed :(/ Any ideas on what might be wrong ? Best regards, Johan -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
A second easycap driver implementation
Hello, After some research on v4l2 and videbuf2, and considering that easycap driver is pretty outdated I've decided to start writing a new driver from scratch. I am using the excellent vivi driver and some usb video capture drivers as a starting point. And of course, I'm using the current easycap implementation as a reference (it works pretty well). I have a couple of doubts regarding the development itself (how to trace properly, where to allocate urbs, and such) but perhaps the maintainers prefer to take a look at the code. However, currently the driver is just a skeleton: it does all v4l2 and videobuf2 intialization but it doesn't actually stream video or submit urbs. So, 1. Should I try to have something more finished before submit or can I submit as it is? 2. In any case, how should I submit it? (Considering there is already a working driver). Thanks, Ezequiel. -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html