DVB streaming failed after running tzap
I'm new to this mailing list, so excuse me if I'm posting to the wrong place. I'm using a DiBcom USB module on an Ubuntu 11.04 host. The v4l-dvb drivers were downloaded via git and built on June 13, 2012. Basically, I can watch DVB-T by running mplayer (version SVN-r35003-4.5.2); however, if I ran tzap before launching mplayer, then I would get a series of dvb_streaming_read, attempt N. 6 failed with errno 0 when reading 2048 bytes failure messages. Then I must unplug the DiBcom USB tuner and plug it in again so that I could relaunch mplayer to tune to a DVB-T channel. The console output of running mplayer as well as tzap is as attached below. Has anyone experienced the same problem? == hying@hying-VT3410-8595CMB:~$ gmplayer dvb://CTS MPlayer SVN-r35003-4.5.2 (C) 2000-2012 MPlayer Team Playing dvb://CTS. dvb_tune Freq: 59300 TS file format detected. VIDEO MPEG2(pid=5011) AUDIO MPA(pid=5012) NO SUBS (yet)! PROGRAM N. 0 VIDEO: MPEG2 704x480 (aspect 2) 29.970 fps 15000.0 kbps (1875.0 kbyte/s) == Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family libavcodec version 54.25.100 (internal) Selected video codec: [ffmpeg2] vfm: ffmpeg (FFmpeg MPEG-2) == == Opening audio decoder: [mpg123] MPEG 1.0/2.0/2.5 layers I, II, III AUDIO: 48000 Hz, 2 ch, s16le, 128.0 kbit/8.33% (ratio: 16000-192000) Selected audio codec: [mpg123] afm: mpg123 (MPEG 1.0/2.0/2.5 layers I, II, III) == [AO OSS] audio_setup: Can't open audio device /dev/dsp: No such file or directory AO: [alsa] 48000Hz 2ch s16le (2 bytes per sample) [AO_ALSA] Unable to find simple control 'PCM',0. Starting playback... [VD_FFMPEG] Trying pixfmt=0. Could not find matching colorspace - retrying with -vf scale... Opening video filter: [scale] The selected video_out device is incompatible with this codec. Try appending the scale filter to your filter list, e.g. -vf spp,scale instead of -vf spp. Movie-Aspect is 1.33:1 - prescaling to correct movie aspect. VO: [vdpau] 704x480 = 704x528 Planar YV12 A:42279.3 V:42279.6 A-V: -0.336 ct: 0.000 4/ 4 ??% ??% ??,?% 0 0 [AO_ALSA] Unable to find simple control 'PCM',0. [snip] hying@hying-VT3410-8595CMB:~$ tzap -r -c .tzap/channels.conf CTS using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0' reading channels from file '.tzap/channels.conf' tuning to 59300 Hz video pid 0x1393, audio pid 0x1394 status 0f | signal 6322 | snr 008a | ber 001f | unc | status 1f | signal 614f | snr 0098 | ber | unc | FE_HAS_LOCK status 1f | signal 5f5d | snr 0099 | ber | unc | FE_HAS_LOCK status 1f | signal 5fbf | snr 00a1 | ber | unc | FE_HAS_LOCK status 1f | signal 5f9e | snr 009d | ber | unc | FE_HAS_LOCK status 1f | signal 6027 | snr 009e | ber | unc | FE_HAS_LOCK status 1f | signal 608d | snr 00a1 | ber | unc | FE_HAS_LOCK status 1f | signal 625e | snr 00a1 | ber | unc | FE_HAS_LOCK status 1f | signal 6127 | snr 009f | ber | unc | FE_HAS_LOCK status 1f | signal 60ad | snr 00a2 | ber 0030 | unc | FE_HAS_LOCK status 1f | signal 614f | snr 009e | ber | unc | FE_HAS_LOCK status 1f | signal 6323 | snr 00a3 | ber | unc | FE_HAS_LOCK status 1f | signal 604d | snr 00a4 | ber 0030 | unc | FE_HAS_LOCK status 1f | signal 6294 | snr 009f | ber | unc | FE_HAS_LOCK status 1f | signal 60a9 | snr 009d | ber | unc | FE_HAS_LOCK ^C hying@hying-VT3410-8595CMB:~$ gmplayer dvb://CTS MPlayer SVN-r35003-4.5.2 (C) 2000-2012 MPlayer Team Playing dvb://CTS. dvb_tune Freq: 59300 dvb_streaming_read, attempt N. 6 failed with errno 0 when reading 2048 bytes dvb_streaming_read, attempt N. 5 failed with errno 0 when reading 2048 bytes dvb_streaming_read, attempt N. 4 failed with errno 0 when reading 2048 bytes dvb_streaming_read, attempt N. 3 failed with errno 0 when reading 2048 bytes dvb_streaming_read, attempt N. 2 failed with errno 0 when reading 2048 bytes dvb_streaming_read, attempt N. 1 failed with errno 0 when reading 2048 bytes dvb_streaming_read, return 0 bytes -- 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] v4l/s5p-mfc: corrected encoder v4l control definitions
Patch corrects definition of H264 level control and changes bare numbers to enums in two other cases. Signed-off-by: Andrzej Hajda a.ha...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com --- drivers/media/video/s5p-mfc/s5p_mfc_enc.c | 10 ++ 1 files changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/media/video/s5p-mfc/s5p_mfc_enc.c b/drivers/media/video/s5p-mfc/s5p_mfc_enc.c index acedb20..9c19aa8 100644 --- a/drivers/media/video/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/video/s5p-mfc/s5p_mfc_enc.c @@ -243,12 +243,6 @@ static struct mfc_control controls[] = { .minimum = V4L2_MPEG_VIDEO_H264_LEVEL_1_0, .maximum = V4L2_MPEG_VIDEO_H264_LEVEL_4_0, .default_value = V4L2_MPEG_VIDEO_H264_LEVEL_1_0, - .menu_skip_mask = ~( - (1 V4L2_MPEG_VIDEO_H264_LEVEL_4_1) | - (1 V4L2_MPEG_VIDEO_H264_LEVEL_4_2) | - (1 V4L2_MPEG_VIDEO_H264_LEVEL_5_0) | - (1 V4L2_MPEG_VIDEO_H264_LEVEL_5_1) - ), }, { .id = V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL, @@ -494,7 +488,7 @@ static struct mfc_control controls[] = { .type = V4L2_CTRL_TYPE_MENU, .minimum = V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_UNSPECIFIED, .maximum = V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_EXTENDED, - .default_value = 0, + .default_value = V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_UNSPECIFIED, .menu_skip_mask = 0, }, { @@ -534,7 +528,7 @@ static struct mfc_control controls[] = { .type = V4L2_CTRL_TYPE_MENU, .minimum = V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE, .maximum = V4L2_MPEG_VIDEO_MPEG4_PROFILE_ADVANCED_SIMPLE, - .default_value = 0, + .default_value = V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE, .menu_skip_mask = 0, }, { -- 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] v4l/s5p-mfc: added image size align in VIDIOC_TRY_FMT
Image size for MFC encoder should have size between 8x4 and 1920x1080 with even width and height. Signed-off-by: Andrzej Hajda a.ha...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com --- drivers/media/video/s5p-mfc/s5p_mfc_enc.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/media/video/s5p-mfc/s5p_mfc_enc.c b/drivers/media/video/s5p-mfc/s5p_mfc_enc.c index 9c19aa8..03d8334 100644 --- a/drivers/media/video/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/video/s5p-mfc/s5p_mfc_enc.c @@ -901,6 +901,8 @@ static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f) mfc_err(failed to try output format\n); return -EINVAL; } + v4l_bound_align_image(pix_fmt_mp-width, 8, 1920, 1, + pix_fmt_mp-height, 4, 1080, 1, 0); } else { mfc_err(invalid buf type\n); return -EINVAL; -- 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
RE: [PATCH] v4l/s5p-mfc: added image size align in VIDIOC_TRY_FMT
Hi Andrzej, Thank you for the patch. Best wishes, -- Kamil Debski Linux Platform Group Samsung Poland RD Center -Original Message- From: Andrzej Hajda [mailto:a.ha...@samsung.com] Sent: 14 June 2012 09:11 To: linux-media@vger.kernel.org Cc: Hans Verkuil; Marek Szyprowski; Kamil Debski; Andrzej Hajda; Kyungmin Park Subject: [PATCH] v4l/s5p-mfc: added image size align in VIDIOC_TRY_FMT Image size for MFC encoder should have size between 8x4 and 1920x1080 with even width and height. Signed-off-by: Andrzej Hajda a.ha...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com Acked-by: Kamil Debski k.deb...@samsung.com --- drivers/media/video/s5p-mfc/s5p_mfc_enc.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/media/video/s5p-mfc/s5p_mfc_enc.c b/drivers/media/video/s5p-mfc/s5p_mfc_enc.c index 9c19aa8..03d8334 100644 --- a/drivers/media/video/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/video/s5p-mfc/s5p_mfc_enc.c @@ -901,6 +901,8 @@ static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f) mfc_err(failed to try output format\n); return -EINVAL; } + v4l_bound_align_image(pix_fmt_mp-width, 8, 1920, 1, + pix_fmt_mp-height, 4, 1080, 1, 0); } else { mfc_err(invalid buf type\n); return -EINVAL; -- 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
RE: [PATCH] v4l/s5p-mfc: corrected encoder v4l control definitions
Hi Andrzej, Thank you for the patch. Best wishes, -- Kamil Debski Linux Platform Group Samsung Poland RD Center -Original Message- From: Andrzej Hajda [mailto:a.ha...@samsung.com] Sent: 14 June 2012 09:04 To: linux-media@vger.kernel.org Cc: Hans Verkuil; Marek Szyprowski; Kamil Debski; Andrzej Hajda; Kyungmin Park Subject: [PATCH] v4l/s5p-mfc: corrected encoder v4l control definitions Patch corrects definition of H264 level control and changes bare numbers to enums in two other cases. Signed-off-by: Andrzej Hajda a.ha...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com Acked-by: Kamil Debski k.deb...@samsung.com --- drivers/media/video/s5p-mfc/s5p_mfc_enc.c | 10 ++ 1 files changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/media/video/s5p-mfc/s5p_mfc_enc.c b/drivers/media/video/s5p-mfc/s5p_mfc_enc.c index acedb20..9c19aa8 100644 --- a/drivers/media/video/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/video/s5p-mfc/s5p_mfc_enc.c @@ -243,12 +243,6 @@ static struct mfc_control controls[] = { .minimum = V4L2_MPEG_VIDEO_H264_LEVEL_1_0, .maximum = V4L2_MPEG_VIDEO_H264_LEVEL_4_0, .default_value = V4L2_MPEG_VIDEO_H264_LEVEL_1_0, - .menu_skip_mask = ~( - (1 V4L2_MPEG_VIDEO_H264_LEVEL_4_1) | - (1 V4L2_MPEG_VIDEO_H264_LEVEL_4_2) | - (1 V4L2_MPEG_VIDEO_H264_LEVEL_5_0) | - (1 V4L2_MPEG_VIDEO_H264_LEVEL_5_1) - ), }, { .id = V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL, @@ -494,7 +488,7 @@ static struct mfc_control controls[] = { .type = V4L2_CTRL_TYPE_MENU, .minimum = V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_UNSPECIFIED, .maximum = V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_EXTENDED, - .default_value = 0, + .default_value = V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_UNSPECIFIED, .menu_skip_mask = 0, }, { @@ -534,7 +528,7 @@ static struct mfc_control controls[] = { .type = V4L2_CTRL_TYPE_MENU, .minimum = V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE, .maximum = V4L2_MPEG_VIDEO_MPEG4_PROFILE_ADVANCED_SIMPLE, - .default_value = 0, + .default_value = V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE, .menu_skip_mask = 0, }, { -- 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 v4] scatterlist: add sg_alloc_table_from_pages function
This patch adds a new constructor for an sg table. The table is constructed from an array of struct pages. All contiguous chunks of the pages are merged into a single sg nodes. A user may provide an offset and a size of a buffer if the buffer is not page-aligned. The function is dedicated for DMABUF exporters which often perform conversion from an page array to a scatterlist. Moreover the scatterlist should be squashed in order to save memory and to speed-up the process of DMA mapping using dma_map_sg. The code is based on the patch 'v4l: vb2-dma-contig: add support for scatterlist in userptr mode' and hints from Laurent Pinchart. Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com Acked-by: Daniel Vetter daniel.vet...@ffwll.ch Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com CC: Andrew Morton a...@linux-foundation.org --- v4: - fix typos - add Changelog v3: - use PFNs instead of page pointers to check contiguity v2: - rename sg_table_alloc_by_pages to sg_table_alloc_from_pages - add some comments about error value v1: - initial version --- include/linux/scatterlist.h |4 +++ lib/scatterlist.c | 64 +++ 2 files changed, 68 insertions(+) diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h index ac9586d..7b600da 100644 --- a/include/linux/scatterlist.h +++ b/include/linux/scatterlist.h @@ -214,6 +214,10 @@ void sg_free_table(struct sg_table *); int __sg_alloc_table(struct sg_table *, unsigned int, unsigned int, gfp_t, sg_alloc_fn *); int sg_alloc_table(struct sg_table *, unsigned int, gfp_t); +int sg_alloc_table_from_pages(struct sg_table *sgt, + struct page **pages, unsigned int n_pages, + unsigned long offset, unsigned long size, + gfp_t gfp_mask); size_t sg_copy_from_buffer(struct scatterlist *sgl, unsigned int nents, void *buf, size_t buflen); diff --git a/lib/scatterlist.c b/lib/scatterlist.c index 6096e89..e719adf 100644 --- a/lib/scatterlist.c +++ b/lib/scatterlist.c @@ -319,6 +319,70 @@ int sg_alloc_table(struct sg_table *table, unsigned int nents, gfp_t gfp_mask) EXPORT_SYMBOL(sg_alloc_table); /** + * sg_alloc_table_from_pages - Allocate and initialize an sg table from + *an array of pages + * @sgt: The sg table header to use + * @pages: Pointer to an array of page pointers + * @n_pages: Number of pages in the pages array + * @offset: Offset from start of the first page to the start of a buffer + * @size: Number of valid bytes in the buffer (after offset) + * @gfp_mask: GFP allocation mask + * + * Description: + *Allocate and initialize an sg table from a list of pages. Contiguous + *ranges of the pages are squashed into a single scatterlist node. A user + *may provide an offset at a start and a size of valid data in a buffer + *specified by the page array. The returned sg table is released by + *sg_free_table. + * + * Returns: + * 0 on success, negative error on failure + */ +int sg_alloc_table_from_pages(struct sg_table *sgt, + struct page **pages, unsigned int n_pages, + unsigned long offset, unsigned long size, + gfp_t gfp_mask) +{ + unsigned int chunks; + unsigned int i; + unsigned int cur_page; + int ret; + struct scatterlist *s; + + /* compute number of contiguous chunks */ + chunks = 1; + for (i = 1; i n_pages; ++i) + if (page_to_pfn(pages[i]) != page_to_pfn(pages[i - 1]) + 1) + ++chunks; + + ret = sg_alloc_table(sgt, chunks, gfp_mask); + if (unlikely(ret)) + return ret; + + /* merging chunks and putting them into the scatterlist */ + cur_page = 0; + for_each_sg(sgt-sgl, s, sgt-orig_nents, i) { + unsigned long chunk_size; + unsigned int j; + + /* look for the end of the current chunk */ + for (j = cur_page + 1; j n_pages; ++j) + if (page_to_pfn(pages[j]) != + page_to_pfn(pages[j - 1]) + 1) + break; + + chunk_size = ((j - cur_page) PAGE_SHIFT) - offset; + sg_set_page(s, pages[cur_page], min(size, chunk_size), offset); + size -= chunk_size; + offset = 0; + cur_page = j; + } + + return 0; +} +EXPORT_SYMBOL(sg_alloc_table_from_pages); + +/** * sg_miter_start - start mapping iteration over a sg list * @miter: sg mapping iter to be started * @sgl: sg list to iterate over -- 1.7.9.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
[PATCHv7 00/15] Integration of videobuf2 with dmabuf
Hello everyone, This patchset adds support for DMABUF [2] importing to V4L2 stack. The support for DMABUF exporting was moved to separate patchset due to dependency on patches for DMA mapping redesign by Marek Szyprowski [4]. This patchset depends on new scatterlist constructor [5]. v7: - support for V4L2_MEMORY_DMABUF in v4l2-compact-ioctl32.c - cosmetic fixes to the documentation - added importing for vmalloc because vmap support in dmabuf for 3.5 was pull-requested - support for dmabuf importing for VIVI - resurrect allocation of dma-contig context - remove reference of alloc_ctx in dma-contig buffer - use sg_alloc_table_from_pages - fix DMA scatterlist calls to use orig_nents instead of nents - fix memleak in vb2_dc_sgt_foreach_page (use orig_nents instead of nents) v6: - fixed missing entry in v4l2_memory_names - fixed a bug occuring after get_user_pages failure - fixed a bug caused by using invalid vma for get_user_pages - prepare/finish no longer call dma_sync for dmabuf buffers v5: - removed change of importer/exporter behaviour - fixes vb2_dc_pages_to_sgt basing on Laurent's hints - changed pin/unpin words to lock/unlock in Doc v4: - rebased on mainline 3.4-rc2 - included missing importing support for s5p-fimc and s5p-tv - added patch for changing map/unmap for importers - fixes to Documentation part - coding style fixes - pairing {map/unmap}_dmabuf in vb2-core - fixing variable types and semantic of arguments in videobufb2-dma-contig.c v3: - rebased on mainline 3.4-rc1 - split 'code refactor' patch to multiple smaller patches - squashed fixes to Sumit's patches - patchset is no longer dependant on 'DMA mapping redesign' - separated path for handling IO and non-IO mappings - add documentation for DMABUF importing to V4L - removed all DMABUF exporter related code - removed usage of dma_get_pages extension 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://thread.gmane.org/gmane.linux.drivers.video-input-infrastructure/47983 Laurent Pinchart (2): v4l: vb2-dma-contig: Shorten vb2_dma_contig prefix to vb2_dc v4l: vb2-dma-contig: Reorder functions Marek Szyprowski (2): v4l: vb2: add prepare/finish callbacks to allocators v4l: vb2-dma-contig: add prepare/finish to dma-contig allocator Sumit Semwal (4): v4l: Add DMABUF as a memory type v4l: vb2: add support for shared buffer (dma_buf) v4l: vb: remove warnings about MEMORY_DMABUF v4l: vb2-dma-contig: add support for dma_buf importing Tomasz Stanislawski (7): Documentation: media: description of DMABUF importing in V4L2 v4l: vb2-dma-contig: remove reference of alloc_ctx from a buffer v4l: vb2-dma-contig: add support for scatterlist in userptr mode v4l: vb2-vmalloc: add support for dmabuf importing v4l: vivi: support for dmabuf importing v4l: s5p-tv: mixer: support for dmabuf importing v4l: s5p-fimc: support for dmabuf importing Documentation/DocBook/media/v4l/compat.xml |4 + Documentation/DocBook/media/v4l/io.xml | 179 .../DocBook/media/v4l/vidioc-create-bufs.xml |3 +- Documentation/DocBook/media/v4l/vidioc-qbuf.xml| 15 + Documentation/DocBook/media/v4l/vidioc-reqbufs.xml | 47 +- drivers/media/video/Kconfig|1 + drivers/media/video/s5p-fimc/Kconfig |1 + drivers/media/video/s5p-fimc/fimc-capture.c|2 +- drivers/media/video/s5p-tv/Kconfig |1 + drivers/media/video/s5p-tv/mixer_video.c |2 +- drivers/media/video/v4l2-compat-ioctl32.c | 16 + drivers/media/video/v4l2-ioctl.c |1 + drivers/media/video/videobuf-core.c|4 +
[PATCHv7 04/15] v4l: vb: remove warnings about MEMORY_DMABUF
From: Sumit Semwal sumit.sem...@ti.com Adding DMABUF memory type causes videobuf to complain about not using it in some switch cases. This patch removes these warnings. Signed-off-by: Sumit Semwal sumit.sem...@ti.com Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/video/videobuf-core.c |4 1 file changed, 4 insertions(+) diff --git a/drivers/media/video/videobuf-core.c b/drivers/media/video/videobuf-core.c index ffdf59c..3e3e55f 100644 --- a/drivers/media/video/videobuf-core.c +++ b/drivers/media/video/videobuf-core.c @@ -335,6 +335,9 @@ static void videobuf_status(struct videobuf_queue *q, struct v4l2_buffer *b, case V4L2_MEMORY_OVERLAY: b-m.offset = vb-boff; break; + case V4L2_MEMORY_DMABUF: + /* DMABUF is not handled in videobuf framework */ + break; } b-flags= 0; @@ -411,6 +414,7 @@ int __videobuf_mmap_setup(struct videobuf_queue *q, break; case V4L2_MEMORY_USERPTR: case V4L2_MEMORY_OVERLAY: + case V4L2_MEMORY_DMABUF: /* nothing */ break; } -- 1.7.9.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
[PATCHv7 09/15] v4l: vb2: add prepare/finish callbacks to allocators
From: Marek Szyprowski m.szyprow...@samsung.com This patch adds support for prepare/finish callbacks in VB2 allocators. These callback are used for buffer flushing. Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/video/videobuf2-core.c | 11 +++ include/media/videobuf2-core.h |7 +++ 2 files changed, 18 insertions(+) diff --git a/drivers/media/video/videobuf2-core.c b/drivers/media/video/videobuf2-core.c index f43cfa4..d60ed25 100644 --- a/drivers/media/video/videobuf2-core.c +++ b/drivers/media/video/videobuf2-core.c @@ -845,6 +845,7 @@ void vb2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state) { struct vb2_queue *q = vb-vb2_queue; unsigned long flags; + unsigned int plane; if (vb-state != VB2_BUF_STATE_ACTIVE) return; @@ -855,6 +856,10 @@ void vb2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state) dprintk(4, Done processing on buffer %d, state: %d\n, vb-v4l2_buf.index, vb-state); + /* sync buffers */ + for (plane = 0; plane vb-num_planes; ++plane) + call_memop(q, finish, vb-planes[plane].mem_priv); + /* Add the buffer to the done buffers list */ spin_lock_irqsave(q-done_lock, flags); vb-state = state; @@ -1137,9 +1142,15 @@ err: static void __enqueue_in_driver(struct vb2_buffer *vb) { struct vb2_queue *q = vb-vb2_queue; + unsigned int plane; vb-state = VB2_BUF_STATE_ACTIVE; atomic_inc(q-queued_count); + + /* sync buffers */ + for (plane = 0; plane vb-num_planes; ++plane) + call_memop(q, prepare, vb-planes[plane].mem_priv); + q-ops-buf_queue(vb); } diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h index 859bbaf..d079f92 100644 --- a/include/media/videobuf2-core.h +++ b/include/media/videobuf2-core.h @@ -56,6 +56,10 @@ struct vb2_fileio_data; * dmabuf * @unmap_dmabuf: releases access control to the dmabuf - allocator is notified * that this driver is done using the dmabuf for now + * @prepare: called everytime the buffer is passed from userspace to the + * driver, usefull for cache synchronisation, optional + * @finish:called everytime the buffer is passed back from the driver + * to the userspace, also optional * @vaddr: return a kernel virtual address to a given memory buffer * associated with the passed private structure or NULL if no * such mapping exists @@ -82,6 +86,9 @@ struct vb2_mem_ops { unsigned long size, int write); void(*put_userptr)(void *buf_priv); + void(*prepare)(void *buf_priv); + void(*finish)(void *buf_priv); + void*(*attach_dmabuf)(void *alloc_ctx, struct dma_buf *dbuf, unsigned long size, int write); void(*detach_dmabuf)(void *buf_priv); -- 1.7.9.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
[PATCHv7 11/15] v4l: vb2-dma-contig: add support for dma_buf importing
From: Sumit Semwal sumit.sem...@ti.com This patch makes changes for adding dma-contig as a dma_buf user. It provides function implementations for the {attach, detach, map, unmap}_dmabuf() mem_ops of DMABUF memory type. Signed-off-by: Sumit Semwal sumit.sem...@ti.com Signed-off-by: Sumit Semwal sumit.sem...@linaro.org [author of the original patch] Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com [integration with refactored dma-contig allocator] Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/video/videobuf2-dma-contig.c | 120 +++- 1 file changed, 118 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/videobuf2-dma-contig.c b/drivers/media/video/videobuf2-dma-contig.c index f9286d7..040829b 100644 --- a/drivers/media/video/videobuf2-dma-contig.c +++ b/drivers/media/video/videobuf2-dma-contig.c @@ -10,6 +10,7 @@ * the Free Software Foundation. */ +#include linux/dma-buf.h #include linux/module.h #include linux/scatterlist.h #include linux/sched.h @@ -38,6 +39,9 @@ struct vb2_dc_buf { /* USERPTR related */ struct vm_area_struct *vma; + + /* DMABUF related */ + struct dma_buf_attachment *db_attach; }; /*/ @@ -108,7 +112,8 @@ static void vb2_dc_prepare(void *buf_priv) struct vb2_dc_buf *buf = buf_priv; struct sg_table *sgt = buf-dma_sgt; - if (!sgt) + /* DMABUF exporter will flush the cache for us */ + if (!sgt || buf-db_attach) return; dma_sync_sg_for_device(buf-dev, sgt-sgl, sgt-nents, buf-dma_dir); @@ -119,7 +124,8 @@ static void vb2_dc_finish(void *buf_priv) struct vb2_dc_buf *buf = buf_priv; struct sg_table *sgt = buf-dma_sgt; - if (!sgt) + /* DMABUF exporter will flush the cache for us */ + if (!sgt || buf-db_attach) return; dma_sync_sg_for_cpu(buf-dev, sgt-sgl, sgt-nents, buf-dma_dir); @@ -380,6 +386,112 @@ fail_buf: } /*/ +/* callbacks for DMABUF buffers*/ +/*/ + +static int vb2_dc_map_dmabuf(void *mem_priv) +{ + struct vb2_dc_buf *buf = mem_priv; + struct sg_table *sgt; + unsigned long contig_size; + + if (WARN_ON(!buf-db_attach)) { + printk(KERN_ERR trying to pin a non attached buffer\n); + return -EINVAL; + } + + if (WARN_ON(buf-dma_sgt)) { + printk(KERN_ERR dmabuf buffer is already pinned\n); + return 0; + } + + /* get the associated scatterlist for this buffer */ + sgt = dma_buf_map_attachment(buf-db_attach, buf-dma_dir); + if (IS_ERR_OR_NULL(sgt)) { + printk(KERN_ERR Error getting dmabuf scatterlist\n); + return -EINVAL; + } + + /* 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 is too small %lu/%lu b\n, + contig_size, buf-size); + dma_buf_unmap_attachment(buf-db_attach, sgt, buf-dma_dir); + return -EFAULT; + } + + buf-dma_addr = sg_dma_address(sgt-sgl); + buf-dma_sgt = sgt; + + return 0; +} + +static void vb2_dc_unmap_dmabuf(void *mem_priv) +{ + struct vb2_dc_buf *buf = mem_priv; + struct sg_table *sgt = buf-dma_sgt; + + if (WARN_ON(!buf-db_attach)) { + printk(KERN_ERR trying to unpin a not attached buffer\n); + return; + } + + if (WARN_ON(!sgt)) { + printk(KERN_ERR dmabuf buffer is already unpinned\n); + return; + } + + dma_buf_unmap_attachment(buf-db_attach, sgt, buf-dma_dir); + + buf-dma_addr = 0; + buf-dma_sgt = NULL; +} + +static void vb2_dc_detach_dmabuf(void *mem_priv) +{ + struct vb2_dc_buf *buf = mem_priv; + + /* if vb2 works correctly you should never detach mapped buffer */ + if (WARN_ON(buf-dma_addr)) + vb2_dc_unmap_dmabuf(buf); + + /* detach this attachment */ + dma_buf_detach(buf-db_attach-dmabuf, buf-db_attach); + kfree(buf); +} + +static void *vb2_dc_attach_dmabuf(void *alloc_ctx, struct dma_buf *dbuf, + unsigned long size, int write) +{ + struct vb2_dc_conf *conf = alloc_ctx; + struct vb2_dc_buf *buf; + struct dma_buf_attachment *dba; + + if (dbuf-size size) + return ERR_PTR(-EFAULT); + + buf = kzalloc(sizeof *buf, GFP_KERNEL); + if (!buf) + return ERR_PTR(-ENOMEM); + + buf-dev = conf-dev; + /* create attachment for the dmabuf with the user device */ + dba = dma_buf_attach(dbuf, buf-dev); + if (IS_ERR(dba)) { +
[PATCHv7 10/15] v4l: vb2-dma-contig: add prepare/finish to dma-contig allocator
From: Marek Szyprowski m.szyprow...@samsung.com Add prepare/finish callbacks to vb2-dma-contig allocator. Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com --- drivers/media/video/videobuf2-dma-contig.c | 24 1 file changed, 24 insertions(+) diff --git a/drivers/media/video/videobuf2-dma-contig.c b/drivers/media/video/videobuf2-dma-contig.c index 94f0874..f9286d7 100644 --- a/drivers/media/video/videobuf2-dma-contig.c +++ b/drivers/media/video/videobuf2-dma-contig.c @@ -103,6 +103,28 @@ static unsigned int vb2_dc_num_users(void *buf_priv) return atomic_read(buf-refcount); } +static void vb2_dc_prepare(void *buf_priv) +{ + struct vb2_dc_buf *buf = buf_priv; + struct sg_table *sgt = buf-dma_sgt; + + if (!sgt) + return; + + dma_sync_sg_for_device(buf-dev, sgt-sgl, sgt-nents, buf-dma_dir); +} + +static void vb2_dc_finish(void *buf_priv) +{ + struct vb2_dc_buf *buf = buf_priv; + struct sg_table *sgt = buf-dma_sgt; + + if (!sgt) + return; + + dma_sync_sg_for_cpu(buf-dev, sgt-sgl, sgt-nents, buf-dma_dir); +} + /*/ /*callbacks for MMAP buffers */ /*/ @@ -369,6 +391,8 @@ const struct vb2_mem_ops vb2_dma_contig_memops = { .mmap = vb2_dc_mmap, .get_userptr= vb2_dc_get_userptr, .put_userptr= vb2_dc_put_userptr, + .prepare= vb2_dc_prepare, + .finish = vb2_dc_finish, .num_users = vb2_dc_num_users, }; EXPORT_SYMBOL_GPL(vb2_dma_contig_memops); -- 1.7.9.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
[PATCHv7 13/15] v4l: vivi: support for dmabuf importing
This patch enhances VIVI driver with a support for importing a buffer from DMABUF file descriptors. 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/vivi.c |2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 99937c9..9aa7306 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig @@ -630,6 +630,7 @@ config VIDEO_VIVI depends on FRAMEBUFFER_CONSOLE || STI_CONSOLE select FONT_8x16 select VIDEOBUF2_VMALLOC + select DMA_SHARED_BUFFER default n ---help--- Enables a virtual video driver. This device shows a color bar diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c index 0960d7f..05709cd 100644 --- a/drivers/media/video/vivi.c +++ b/drivers/media/video/vivi.c @@ -1422,7 +1422,7 @@ static int __init vivi_create_instance(int inst) q = dev-vb_vidq; memset(q, 0, sizeof(dev-vb_vidq)); q-type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - q-io_modes = VB2_MMAP | VB2_USERPTR | VB2_READ; + q-io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF | VB2_READ; q-drv_priv = dev; q-buf_struct_size = sizeof(struct vivi_buffer); q-ops = vivi_video_qops; -- 1.7.9.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
[PATCHv7 07/15] v4l: vb2-dma-contig: Reorder functions
From: Laurent Pinchart laurent.pinch...@ideasonboard.com Group functions by buffer type. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/video/videobuf2-dma-contig.c | 92 1 file changed, 54 insertions(+), 38 deletions(-) diff --git a/drivers/media/video/videobuf2-dma-contig.c b/drivers/media/video/videobuf2-dma-contig.c index 20c95da..daac2b2 100644 --- a/drivers/media/video/videobuf2-dma-contig.c +++ b/drivers/media/video/videobuf2-dma-contig.c @@ -25,14 +25,56 @@ struct vb2_dc_conf { struct vb2_dc_buf { 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; + + /* MMAP related */ struct vb2_vmarea_handler handler; + atomic_trefcount; + + /* USERPTR related */ + struct vm_area_struct *vma; }; -static void vb2_dc_put(void *buf_priv); +/*/ +/* callbacks for all buffers */ +/*/ + +static void *vb2_dc_cookie(void *buf_priv) +{ + struct vb2_dc_buf *buf = buf_priv; + + return buf-dma_addr; +} + +static void *vb2_dc_vaddr(void *buf_priv) +{ + struct vb2_dc_buf *buf = buf_priv; + + return buf-vaddr; +} + +static unsigned int vb2_dc_num_users(void *buf_priv) +{ + struct vb2_dc_buf *buf = buf_priv; + + return atomic_read(buf-refcount); +} + +/*/ +/*callbacks for MMAP buffers */ +/*/ + +static void vb2_dc_put(void *buf_priv) +{ + struct vb2_dc_buf *buf = buf_priv; + + if (!atomic_dec_and_test(buf-refcount)) + return; + + dma_free_coherent(buf-dev, buf-size, buf-vaddr, buf-dma_addr); + kfree(buf); +} static void *vb2_dc_alloc(void *alloc_ctx, unsigned long size) { @@ -63,40 +105,6 @@ static void *vb2_dc_alloc(void *alloc_ctx, unsigned long size) return buf; } -static void vb2_dc_put(void *buf_priv) -{ - struct vb2_dc_buf *buf = buf_priv; - - if (atomic_dec_and_test(buf-refcount)) { - dma_free_coherent(buf-dev, buf-size, buf-vaddr, - buf-dma_addr); - kfree(buf); - } -} - -static void *vb2_dc_cookie(void *buf_priv) -{ - struct vb2_dc_buf *buf = buf_priv; - - return buf-dma_addr; -} - -static void *vb2_dc_vaddr(void *buf_priv) -{ - struct vb2_dc_buf *buf = buf_priv; - if (!buf) - return NULL; - - return buf-vaddr; -} - -static unsigned int vb2_dc_num_users(void *buf_priv) -{ - struct vb2_dc_buf *buf = buf_priv; - - return atomic_read(buf-refcount); -} - static int vb2_dc_mmap(void *buf_priv, struct vm_area_struct *vma) { struct vb2_dc_buf *buf = buf_priv; @@ -110,6 +118,10 @@ static int vb2_dc_mmap(void *buf_priv, struct vm_area_struct *vma) vb2_common_vm_ops, buf-handler); } +/*/ +/* callbacks for USERPTR buffers */ +/*/ + static void *vb2_dc_get_userptr(void *alloc_ctx, unsigned long vaddr, unsigned long size, int write) { @@ -148,6 +160,10 @@ static void vb2_dc_put_userptr(void *mem_priv) kfree(buf); } +/*/ +/* DMA CONTIG exported functions */ +/*/ + const struct vb2_mem_ops vb2_dma_contig_memops = { .alloc = vb2_dc_alloc, .put= vb2_dc_put, -- 1.7.9.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
[PATCHv7 12/15] v4l: vb2-vmalloc: add support for dmabuf importing
This patch adds support for importing DMABUF files for vmalloc allocator in Videobuf2. Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com --- drivers/media/video/videobuf2-vmalloc.c | 56 +++ 1 file changed, 56 insertions(+) diff --git a/drivers/media/video/videobuf2-vmalloc.c b/drivers/media/video/videobuf2-vmalloc.c index 6b5ca6c..305032f 100644 --- a/drivers/media/video/videobuf2-vmalloc.c +++ b/drivers/media/video/videobuf2-vmalloc.c @@ -29,6 +29,7 @@ struct vb2_vmalloc_buf { unsigned intn_pages; atomic_trefcount; struct vb2_vmarea_handler handler; + struct dma_buf *dbuf; }; static void vb2_vmalloc_put(void *buf_priv); @@ -206,11 +207,66 @@ static int vb2_vmalloc_mmap(void *buf_priv, struct vm_area_struct *vma) return 0; } +/*/ +/* callbacks for DMABUF buffers*/ +/*/ + +static int vb2_vmalloc_map_dmabuf(void *mem_priv) +{ + struct vb2_vmalloc_buf *buf = mem_priv; + + buf-vaddr = dma_buf_vmap(buf-dbuf); + + return buf-vaddr ? 0 : -EFAULT; +} + +static void vb2_vmalloc_unmap_dmabuf(void *mem_priv) +{ + struct vb2_vmalloc_buf *buf = mem_priv; + + dma_buf_vunmap(buf-dbuf, buf-vaddr); + buf-vaddr = NULL; +} + +static void vb2_vmalloc_detach_dmabuf(void *mem_priv) +{ + struct vb2_vmalloc_buf *buf = mem_priv; + + if (buf-vaddr) + dma_buf_vunmap(buf-dbuf, buf-vaddr); + + kfree(buf); +} + +static void *vb2_vmalloc_attach_dmabuf(void *alloc_ctx, struct dma_buf *dbuf, + unsigned long size, int write) +{ + struct vb2_vmalloc_buf *buf; + + if (dbuf-size size) + return ERR_PTR(-EFAULT); + + buf = kzalloc(sizeof *buf, GFP_KERNEL); + if (!buf) + return ERR_PTR(-ENOMEM); + + buf-dbuf = dbuf; + buf-write = write; + buf-size = size; + + return buf; +} + + const struct vb2_mem_ops vb2_vmalloc_memops = { .alloc = vb2_vmalloc_alloc, .put= vb2_vmalloc_put, .get_userptr= vb2_vmalloc_get_userptr, .put_userptr= vb2_vmalloc_put_userptr, + .map_dmabuf = vb2_vmalloc_map_dmabuf, + .unmap_dmabuf = vb2_vmalloc_unmap_dmabuf, + .attach_dmabuf = vb2_vmalloc_attach_dmabuf, + .detach_dmabuf = vb2_vmalloc_detach_dmabuf, .vaddr = vb2_vmalloc_vaddr, .mmap = vb2_vmalloc_mmap, .num_users = vb2_vmalloc_num_users, -- 1.7.9.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
[PATCHv7 14/15] v4l: s5p-tv: mixer: support for dmabuf importing
This patch enhances s5p-tv with support for DMABUF importing via V4L2_MEMORY_DMABUF memory type. 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 |2 +- 2 files changed, 2 insertions(+), 1 deletion(-) 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 33fde2a..cff974a 100644 --- a/drivers/media/video/s5p-tv/mixer_video.c +++ b/drivers/media/video/s5p-tv/mixer_video.c @@ -1078,7 +1078,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.9.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
[PATCHv7 15/15] v4l: s5p-fimc: support for dmabuf importing
This patch enhances s5p-fimc with support for DMABUF importing via V4L2_MEMORY_DMABUF memory type. Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com Acked-by: Sylwester Nawrocki s.nawro...@samsung.com --- drivers/media/video/s5p-fimc/Kconfig|1 + drivers/media/video/s5p-fimc/fimc-capture.c |2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/s5p-fimc/Kconfig b/drivers/media/video/s5p-fimc/Kconfig index a564f7e..3106026 100644 --- a/drivers/media/video/s5p-fimc/Kconfig +++ b/drivers/media/video/s5p-fimc/Kconfig @@ -14,6 +14,7 @@ config VIDEO_S5P_FIMC depends on I2C select VIDEOBUF2_DMA_CONTIG select V4L2_MEM2MEM_DEV + select DMA_SHARED_BUFFER help This is a V4L2 driver for Samsung S5P and EXYNOS4 SoC camera host interface and video postprocessor (FIMC and FIMC-LITE) devices. diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c b/drivers/media/video/s5p-fimc/fimc-capture.c index 3545745..cd27e33 100644 --- a/drivers/media/video/s5p-fimc/fimc-capture.c +++ b/drivers/media/video/s5p-fimc/fimc-capture.c @@ -1609,7 +1609,7 @@ static 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.9.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
[PATCHv7 05/15] v4l: vb2-dma-contig: Shorten vb2_dma_contig prefix to vb2_dc
From: Laurent Pinchart laurent.pinch...@ideasonboard.com Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/video/videobuf2-dma-contig.c | 36 ++-- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/media/video/videobuf2-dma-contig.c b/drivers/media/video/videobuf2-dma-contig.c index 4b71326..a05784f 100644 --- a/drivers/media/video/videobuf2-dma-contig.c +++ b/drivers/media/video/videobuf2-dma-contig.c @@ -32,9 +32,9 @@ struct vb2_dc_buf { struct vb2_vmarea_handler handler; }; -static void vb2_dma_contig_put(void *buf_priv); +static void vb2_dc_put(void *buf_priv); -static void *vb2_dma_contig_alloc(void *alloc_ctx, unsigned long size) +static void *vb2_dc_alloc(void *alloc_ctx, unsigned long size) { struct vb2_dc_conf *conf = alloc_ctx; struct vb2_dc_buf *buf; @@ -56,7 +56,7 @@ static void *vb2_dma_contig_alloc(void *alloc_ctx, unsigned long size) buf-size = size; buf-handler.refcount = buf-refcount; - buf-handler.put = vb2_dma_contig_put; + buf-handler.put = vb2_dc_put; buf-handler.arg = buf; atomic_inc(buf-refcount); @@ -64,7 +64,7 @@ static void *vb2_dma_contig_alloc(void *alloc_ctx, unsigned long size) return buf; } -static void vb2_dma_contig_put(void *buf_priv) +static void vb2_dc_put(void *buf_priv) { struct vb2_dc_buf *buf = buf_priv; @@ -75,14 +75,14 @@ static void vb2_dma_contig_put(void *buf_priv) } } -static void *vb2_dma_contig_cookie(void *buf_priv) +static void *vb2_dc_cookie(void *buf_priv) { struct vb2_dc_buf *buf = buf_priv; return buf-dma_addr; } -static void *vb2_dma_contig_vaddr(void *buf_priv) +static void *vb2_dc_vaddr(void *buf_priv) { struct vb2_dc_buf *buf = buf_priv; if (!buf) @@ -91,14 +91,14 @@ static void *vb2_dma_contig_vaddr(void *buf_priv) return buf-vaddr; } -static unsigned int vb2_dma_contig_num_users(void *buf_priv) +static unsigned int vb2_dc_num_users(void *buf_priv) { struct vb2_dc_buf *buf = buf_priv; return atomic_read(buf-refcount); } -static int vb2_dma_contig_mmap(void *buf_priv, struct vm_area_struct *vma) +static int vb2_dc_mmap(void *buf_priv, struct vm_area_struct *vma) { struct vb2_dc_buf *buf = buf_priv; @@ -111,7 +111,7 @@ static int vb2_dma_contig_mmap(void *buf_priv, struct vm_area_struct *vma) vb2_common_vm_ops, buf-handler); } -static void *vb2_dma_contig_get_userptr(void *alloc_ctx, unsigned long vaddr, +static void *vb2_dc_get_userptr(void *alloc_ctx, unsigned long vaddr, unsigned long size, int write) { struct vb2_dc_buf *buf; @@ -138,7 +138,7 @@ static void *vb2_dma_contig_get_userptr(void *alloc_ctx, unsigned long vaddr, return buf; } -static void vb2_dma_contig_put_userptr(void *mem_priv) +static void vb2_dc_put_userptr(void *mem_priv) { struct vb2_dc_buf *buf = mem_priv; @@ -150,14 +150,14 @@ static void vb2_dma_contig_put_userptr(void *mem_priv) } const struct vb2_mem_ops vb2_dma_contig_memops = { - .alloc = vb2_dma_contig_alloc, - .put= vb2_dma_contig_put, - .cookie = vb2_dma_contig_cookie, - .vaddr = vb2_dma_contig_vaddr, - .mmap = vb2_dma_contig_mmap, - .get_userptr= vb2_dma_contig_get_userptr, - .put_userptr= vb2_dma_contig_put_userptr, - .num_users = vb2_dma_contig_num_users, + .alloc = vb2_dc_alloc, + .put= vb2_dc_put, + .cookie = vb2_dc_cookie, + .vaddr = vb2_dc_vaddr, + .mmap = vb2_dc_mmap, + .get_userptr= vb2_dc_get_userptr, + .put_userptr= vb2_dc_put_userptr, + .num_users = vb2_dc_num_users, }; EXPORT_SYMBOL_GPL(vb2_dma_contig_memops); -- 1.7.9.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
[PATCHv7 08/15] v4l: vb2-dma-contig: add support for scatterlist in userptr mode
This patch introduces usage of dma_map_sg to map memory behind a userspace pointer to a device as dma-contiguous mapping. This patch contains some of the code kindly provided by Marek Szyprowski m.szyprow...@samsung.com and Kamil Debski k.deb...@samsung.com and Andrzej Pietrasiewicz andrze...@samsung.com. Kind thanks for bug reports from Laurent Pinchart laurent.pinch...@ideasonboard.com and Seung-Woo Kim sw0312@samsung.com. Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/video/videobuf2-dma-contig.c | 229 ++-- 1 file changed, 213 insertions(+), 16 deletions(-) diff --git a/drivers/media/video/videobuf2-dma-contig.c b/drivers/media/video/videobuf2-dma-contig.c index daac2b2..94f0874 100644 --- a/drivers/media/video/videobuf2-dma-contig.c +++ b/drivers/media/video/videobuf2-dma-contig.c @@ -11,6 +11,8 @@ */ #include linux/module.h +#include linux/scatterlist.h +#include linux/sched.h #include linux/slab.h #include linux/dma-mapping.h @@ -27,6 +29,8 @@ struct vb2_dc_buf { void*vaddr; unsigned long size; dma_addr_t dma_addr; + enum dma_data_direction dma_dir; + struct sg_table *dma_sgt; /* MMAP related */ struct vb2_vmarea_handler handler; @@ -37,6 +41,44 @@ struct vb2_dc_buf { }; /*/ +/*scatterlist table functions*/ +/*/ + + +static void vb2_dc_sgt_foreach_page(struct sg_table *sgt, + void (*cb)(struct page *pg)) +{ + struct scatterlist *s; + unsigned int i; + + for_each_sg(sgt-sgl, s, sgt-orig_nents, i) { + struct page *page = sg_page(s); + unsigned int n_pages = PAGE_ALIGN(s-offset + s-length) +PAGE_SHIFT; + unsigned int j; + + for (j = 0; j n_pages; ++j, ++page) + cb(page); + } +} + +static unsigned long vb2_dc_get_contiguous_size(struct sg_table *sgt) +{ + struct scatterlist *s; + dma_addr_t expected = sg_dma_address(sgt-sgl); + unsigned int i; + unsigned long size = 0; + + for_each_sg(sgt-sgl, s, sgt-nents, i) { + if (sg_dma_address(s) != expected) + break; + expected = sg_dma_address(s) + sg_dma_len(s); + size += sg_dma_len(s); + } + return size; +} + +/*/ /* callbacks for all buffers */ /*/ @@ -122,42 +164,197 @@ static int vb2_dc_mmap(void *buf_priv, struct vm_area_struct *vma) /* callbacks for USERPTR buffers */ /*/ +static inline int vma_is_io(struct vm_area_struct *vma) +{ + return !!(vma-vm_flags (VM_IO | VM_PFNMAP)); +} + +static int vb2_dc_get_user_pages(unsigned long start, struct page **pages, + int n_pages, struct vm_area_struct *vma, int write) +{ + if (vma_is_io(vma)) { + unsigned int i; + + for (i = 0; i n_pages; ++i, start += PAGE_SIZE) { + unsigned long pfn; + int ret = follow_pfn(vma, start, pfn); + + if (ret) { + printk(KERN_ERR no page for address %lu\n, + start); + return ret; + } + pages[i] = pfn_to_page(pfn); + } + } else { + int n; + + n = get_user_pages(current, current-mm, start PAGE_MASK, + n_pages, write, 1, pages, NULL); + /* negative error means that no page was pinned */ + n = max(n, 0); + if (n != n_pages) { + printk(KERN_ERR got only %d of %d user pages\n, + n, n_pages); + while (n) + put_page(pages[--n]); + return -EFAULT; + } + } + + return 0; +} + +static void vb2_dc_put_dirty_page(struct page *page) +{ + set_page_dirty_lock(page); + put_page(page); +} + +static void vb2_dc_put_userptr(void *buf_priv) +{ + struct vb2_dc_buf *buf = buf_priv; + struct sg_table *sgt = buf-dma_sgt; + + dma_unmap_sg(buf-dev, sgt-sgl, sgt-orig_nents, buf-dma_dir); + if (!vma_is_io(buf-vma)) + vb2_dc_sgt_foreach_page(sgt, vb2_dc_put_dirty_page); + + sg_free_table(sgt); + kfree(sgt); + vb2_put_vma(buf-vma); + kfree(buf); +} + static void *vb2_dc_get_userptr(void
[PATCHv7 03/15] v4l: vb2: add support for shared buffer (dma_buf)
From: Sumit Semwal sumit.sem...@ti.com This patch adds support for DMABUF memory type in videobuf2. It calls relevant APIs of dma_buf for v4l reqbuf / qbuf / dqbuf operations. For this version, the support is for videobuf2 as a user of the shared buffer; so the allocation of the buffer is done outside of V4L2. [A sample allocator of dma-buf shared buffer is given at [1]] [1]: Rob Clark's DRM: https://github.com/robclark/kernel-omap4/commits/drmplane-dmabuf Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com [original work in the PoC for buffer sharing] Signed-off-by: Sumit Semwal sumit.sem...@ti.com Signed-off-by: Sumit Semwal sumit.sem...@linaro.org Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/video/videobuf2-core.c | 196 +- include/media/videobuf2-core.h | 27 + 2 files changed, 219 insertions(+), 4 deletions(-) diff --git a/drivers/media/video/videobuf2-core.c b/drivers/media/video/videobuf2-core.c index 9d4e9ed..f43cfa4 100644 --- a/drivers/media/video/videobuf2-core.c +++ b/drivers/media/video/videobuf2-core.c @@ -109,6 +109,36 @@ static void __vb2_buf_userptr_put(struct vb2_buffer *vb) } /** + * __vb2_plane_dmabuf_put() - release memory associated with + * a DMABUF shared plane + */ +static void __vb2_plane_dmabuf_put(struct vb2_queue *q, struct vb2_plane *p) +{ + if (!p-mem_priv) + return; + + if (p-dbuf_mapped) + call_memop(q, unmap_dmabuf, p-mem_priv); + + call_memop(q, detach_dmabuf, p-mem_priv); + dma_buf_put(p-dbuf); + memset(p, 0, sizeof *p); +} + +/** + * __vb2_buf_dmabuf_put() - release memory associated with + * a DMABUF shared buffer + */ +static void __vb2_buf_dmabuf_put(struct vb2_buffer *vb) +{ + struct vb2_queue *q = vb-vb2_queue; + unsigned int plane; + + for (plane = 0; plane vb-num_planes; ++plane) + __vb2_plane_dmabuf_put(q, vb-planes[plane]); +} + +/** * __setup_offsets() - setup unique offsets (cookies) for every plane in * every buffer on the queue */ @@ -230,6 +260,8 @@ static void __vb2_free_mem(struct vb2_queue *q, unsigned int buffers) /* Free MMAP buffers or release USERPTR buffers */ if (q-memory == V4L2_MEMORY_MMAP) __vb2_buf_mem_free(vb); + else if (q-memory == V4L2_MEMORY_DMABUF) + __vb2_buf_dmabuf_put(vb); else __vb2_buf_userptr_put(vb); } @@ -352,6 +384,12 @@ static int __fill_v4l2_buffer(struct vb2_buffer *vb, struct v4l2_buffer *b) */ memcpy(b-m.planes, vb-v4l2_planes, b-length * sizeof(struct v4l2_plane)); + + if (q-memory == V4L2_MEMORY_DMABUF) { + unsigned int plane; + for (plane = 0; plane vb-num_planes; ++plane) + b-m.planes[plane].m.fd = 0; + } } else { /* * We use length and offset in v4l2_planes array even for @@ -363,6 +401,8 @@ static int __fill_v4l2_buffer(struct vb2_buffer *vb, struct v4l2_buffer *b) b-m.offset = vb-v4l2_planes[0].m.mem_offset; else if (q-memory == V4L2_MEMORY_USERPTR) b-m.userptr = vb-v4l2_planes[0].m.userptr; + else if (q-memory == V4L2_MEMORY_DMABUF) + b-m.fd = 0; } /* @@ -454,6 +494,20 @@ static int __verify_mmap_ops(struct vb2_queue *q) } /** + * __verify_dmabuf_ops() - verify that all memory operations required for + * DMABUF queue type have been provided + */ +static int __verify_dmabuf_ops(struct vb2_queue *q) +{ + if (!(q-io_modes VB2_DMABUF) || !q-mem_ops-attach_dmabuf || + !q-mem_ops-detach_dmabuf || !q-mem_ops-map_dmabuf || + !q-mem_ops-unmap_dmabuf) + return -EINVAL; + + return 0; +} + +/** * vb2_reqbufs() - Initiate streaming * @q: videobuf2 queue * @req: struct passed from userspace to vidioc_reqbufs handler in driver @@ -486,8 +540,9 @@ int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req) return -EBUSY; } - if (req-memory != V4L2_MEMORY_MMAP -req-memory != V4L2_MEMORY_USERPTR) { + if (req-memory != V4L2_MEMORY_MMAP + req-memory != V4L2_MEMORY_DMABUF + req-memory != V4L2_MEMORY_USERPTR) { dprintk(1, reqbufs: unsupported memory type\n); return -EINVAL; } @@ -516,6 +571,11 @@ int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req) return -EINVAL; } + if (req-memory == V4L2_MEMORY_DMABUF __verify_dmabuf_ops(q)) { + dprintk(1, reqbufs: DMABUF for current setup unsupported\n); + return
[PATCHv7 01/15] v4l: Add DMABUF as a memory type
From: Sumit Semwal sumit.sem...@ti.com Adds DMABUF memory type to v4l framework. Also adds the related file descriptor in v4l2_plane and v4l2_buffer. Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com [original work in the PoC for buffer sharing] Signed-off-by: Sumit Semwal sumit.sem...@ti.com Signed-off-by: Sumit Semwal sumit.sem...@linaro.org Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/video/v4l2-compat-ioctl32.c | 16 drivers/media/video/v4l2-ioctl.c |1 + include/linux/videodev2.h |7 +++ 3 files changed, 24 insertions(+) diff --git a/drivers/media/video/v4l2-compat-ioctl32.c b/drivers/media/video/v4l2-compat-ioctl32.c index 5327ad3..d33ab18 100644 --- a/drivers/media/video/v4l2-compat-ioctl32.c +++ b/drivers/media/video/v4l2-compat-ioctl32.c @@ -348,6 +348,9 @@ static int get_v4l2_plane32(struct v4l2_plane *up, struct v4l2_plane32 *up32, up_pln = compat_ptr(p); if (put_user((unsigned long)up_pln, up-m.userptr)) return -EFAULT; + } else if (memory == V4L2_MEMORY_DMABUF) { + if (copy_in_user(up-m.fd, up32-m.fd, sizeof(int))) + return -EFAULT; } else { if (copy_in_user(up-m.mem_offset, up32-m.mem_offset, sizeof(__u32))) @@ -371,6 +374,11 @@ static int put_v4l2_plane32(struct v4l2_plane *up, struct v4l2_plane32 *up32, if (copy_in_user(up32-m.mem_offset, up-m.mem_offset, sizeof(__u32))) return -EFAULT; + /* For DMABUF, driver might've set up the fd, so copy it back. */ + if (memory == V4L2_MEMORY_DMABUF) + if (copy_in_user(up32-m.fd, up-m.fd, + sizeof(int))) + return -EFAULT; return 0; } @@ -454,6 +462,10 @@ static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user if (get_user(kp-m.offset, up-m.offset)) return -EFAULT; break; + case V4L2_MEMORY_DMABUF: + if (get_user(kp-m.fd, up-m.fd)) + return -EFAULT; + break; } } @@ -518,6 +530,10 @@ static int put_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user if (put_user(kp-m.offset, up-m.offset)) return -EFAULT; break; + case V4L2_MEMORY_DMABUF: + if (put_user(kp-m.fd, up-m.fd)) + return -EFAULT; + break; } } diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c index 91be4e8..31fc2ad 100644 --- a/drivers/media/video/v4l2-ioctl.c +++ b/drivers/media/video/v4l2-ioctl.c @@ -175,6 +175,7 @@ static const char *v4l2_memory_names[] = { [V4L2_MEMORY_MMAP]= mmap, [V4L2_MEMORY_USERPTR] = userptr, [V4L2_MEMORY_OVERLAY] = overlay, + [V4L2_MEMORY_DMABUF] = dmabuf, }; #define prt_names(a, arr) a) = 0) ((a) ARRAY_SIZE(arr))) ? \ diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 370d111..51b20f4 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -185,6 +185,7 @@ enum v4l2_memory { V4L2_MEMORY_MMAP = 1, V4L2_MEMORY_USERPTR = 2, V4L2_MEMORY_OVERLAY = 3, + V4L2_MEMORY_DMABUF = 4, }; /* see also http://vektor.theorem.ca/graphics/ycbcr/ */ @@ -591,6 +592,8 @@ struct v4l2_requestbuffers { * should be passed to mmap() called on the video node) * @userptr: when memory is V4L2_MEMORY_USERPTR, a userspace pointer * pointing to this plane + * @fd:when memory is V4L2_MEMORY_DMABUF, a userspace file + * descriptor associated with this plane * @data_offset: offset in the plane to the start of data; usually 0, * unless there is a header in front of the data * @@ -605,6 +608,7 @@ struct v4l2_plane { union { __u32 mem_offset; unsigned long userptr; + int fd; } m; __u32 data_offset; __u32 reserved[11]; @@ -629,6 +633,8 @@ struct v4l2_plane { * (or a cookie that should be passed to mmap() as offset) * @userptr: for non-multiplanar buffers with memory == V4L2_MEMORY_USERPTR; * a userspace pointer pointing to this buffer + * @fd:for non-multiplanar buffers with memory == V4L2_MEMORY_DMABUF; + * a userspace file descriptor
[PATCHv7 06/15] v4l: vb2-dma-contig: remove reference of alloc_ctx from a buffer
This patch removes a reference to alloc_ctx from an instance of a DMA contiguous buffer. It helps to avoid a risk of a dangling pointer if the context is released while the buffer is still valid. Moreover it removes one dereference step while accessing a device structure. 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 | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/media/video/videobuf2-dma-contig.c b/drivers/media/video/videobuf2-dma-contig.c index a05784f..20c95da 100644 --- a/drivers/media/video/videobuf2-dma-contig.c +++ b/drivers/media/video/videobuf2-dma-contig.c @@ -23,7 +23,7 @@ struct vb2_dc_conf { }; struct vb2_dc_buf { - struct vb2_dc_conf *conf; + struct device *dev; void*vaddr; dma_addr_t dma_addr; unsigned long size; @@ -37,22 +37,21 @@ static void vb2_dc_put(void *buf_priv); static void *vb2_dc_alloc(void *alloc_ctx, unsigned long size) { struct vb2_dc_conf *conf = alloc_ctx; + struct device *dev = conf-dev; struct vb2_dc_buf *buf; buf = kzalloc(sizeof *buf, GFP_KERNEL); if (!buf) return ERR_PTR(-ENOMEM); - buf-vaddr = dma_alloc_coherent(conf-dev, size, buf-dma_addr, - GFP_KERNEL); + buf-vaddr = dma_alloc_coherent(dev, size, buf-dma_addr, GFP_KERNEL); if (!buf-vaddr) { - dev_err(conf-dev, dma_alloc_coherent of size %ld failed\n, - size); + dev_err(dev, dma_alloc_coherent of size %ld failed\n, size); kfree(buf); return ERR_PTR(-ENOMEM); } - buf-conf = conf; + buf-dev = dev; buf-size = size; buf-handler.refcount = buf-refcount; @@ -69,7 +68,7 @@ static void vb2_dc_put(void *buf_priv) struct vb2_dc_buf *buf = buf_priv; if (atomic_dec_and_test(buf-refcount)) { - dma_free_coherent(buf-conf-dev, buf-size, buf-vaddr, + dma_free_coherent(buf-dev, buf-size, buf-vaddr, buf-dma_addr); kfree(buf); } -- 1.7.9.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
[PATCHv7 02/15] Documentation: media: description of DMABUF importing in V4L2
This patch adds description and usage examples for importing DMABUF file descriptor in V4L2. Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com CC: linux-...@vger.kernel.org --- Documentation/DocBook/media/v4l/compat.xml |4 + Documentation/DocBook/media/v4l/io.xml | 179 .../DocBook/media/v4l/vidioc-create-bufs.xml |3 +- Documentation/DocBook/media/v4l/vidioc-qbuf.xml| 15 ++ Documentation/DocBook/media/v4l/vidioc-reqbufs.xml | 47 ++--- 5 files changed, 225 insertions(+), 23 deletions(-) diff --git a/Documentation/DocBook/media/v4l/compat.xml b/Documentation/DocBook/media/v4l/compat.xml index ea42ef8..07a311f 100644 --- a/Documentation/DocBook/media/v4l/compat.xml +++ b/Documentation/DocBook/media/v4l/compat.xml @@ -2587,6 +2587,10 @@ ioctls./para paralink linkend=v4l2-auto-focus-areaconstant V4L2_CID_AUTO_FOCUS_AREA/constant/link control./para /listitem +listitem + paraImporting DMABUF file descriptors as a new IO method described + in xref linkend=dmabuf /./para +/listitem /itemizedlist /section diff --git a/Documentation/DocBook/media/v4l/io.xml b/Documentation/DocBook/media/v4l/io.xml index fd6aca2..f55b0ab 100644 --- a/Documentation/DocBook/media/v4l/io.xml +++ b/Documentation/DocBook/media/v4l/io.xml @@ -472,6 +472,162 @@ rest should be evident./para /footnote/para /section + section id=dmabuf +titleStreaming I/O (DMA buffer importing)/title + +note + titleExperimental/title + paraThis is an link linkend=experimental experimental /link + interface and may change in the future./para +/note + +paraThe DMABUF framework provides a generic mean for sharing buffers between + multiple devices. Device drivers that support DMABUF can export a DMA buffer +to userspace as a file descriptor (known as the exporter role), import a DMA +buffer from userspace using a file descriptor previously exported for a +different or the same device (known as the importer role), or both. This +section describes the DMABUF importer role API in V4L2./para + +paraInput and output devices support the streaming I/O method when the +constantV4L2_CAP_STREAMING/constant flag in the +structfieldcapabilities/structfield field of v4l2-capability; returned by +the VIDIOC-QUERYCAP; ioctl is set. Whether importing DMA buffers through +DMABUF file descriptors is supported is determined by calling the +VIDIOC-REQBUFS; ioctl with the memory type set to +constantV4L2_MEMORY_DMABUF/constant./para + +paraThis I/O method is dedicated for sharing DMA buffers between V4L and +other APIs. Buffers (planes) are allocated by a driver on behalf of the +application, and exported to the application as file descriptors using an API +specific to the allocator driver. Only those file descriptor are exchanged, +these files and meta-information are passed in v4l2-buffer; (or in +v4l2-plane; in the multi-planar API case). The driver must be switched into +DMABUF I/O mode by calling the VIDIOC-REQBUFS; with the desired buffer type. +No buffers (planes) are allocated beforehand, consequently they are not indexed +and cannot be queried like mapped buffers with the +constantVIDIOC_QUERYBUF/constant ioctl./para + +example + titleInitiating streaming I/O with DMABUF file descriptors/title + + programlisting +v4l2-requestbuffers; reqbuf; + +memset (amp;reqbuf, 0, sizeof (reqbuf)); +reqbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; +reqbuf.memory = V4L2_MEMORY_DMABUF; + +if (ioctl (fd, VIDIOC-REQBUFS;, amp;reqbuf) == -1) { + if (errno == EINVAL) + printf (Video capturing or DMABUF streaming is not supported\n); + else + perror (VIDIOC_REQBUFS); + + exit (EXIT_FAILURE); +} + /programlisting +/example + +paraBuffer (plane) file is passed on the fly with the VIDIOC-QBUF; +ioctl. In case of multiplanar buffers, every plane can be associated with a +different DMABUF descriptor.Although buffers are commonly cycled, applications +can pass different DMABUF descriptor at each constantVIDIOC_QBUF/constant +call./para + +example + titleQueueing DMABUF using single plane API/title + + programlisting +int buffer_queue(int v4lfd, int index, int dmafd) +{ + v4l2-buffer; buf; + + memset(amp;buf, 0, sizeof buf); + buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + buf.memory = V4L2_MEMORY_DMABUF; + buf.index = index; + buf.m.fd = dmafd; + + if (ioctl (v4lfd, VIDIOC-QBUF;, amp;buf) == -1) { + perror (VIDIOC_QBUF); + return -1; + } + + return 0; +} + /programlisting +/example + +example + titleQueueing DMABUF using multi plane API/title + + programlisting +int buffer_queue_mp(int v4lfd, int index, int dmafd[], int n_planes) +{ + v4l2-buffer; buf; +
[PATCH 1/4] radio-si470x: Don't unnecesarily read registers on G_TUNER
Reading registers from the pcear USB dongles with the si470x causes a loud pop (and an alsa buffer overrun). Since most radio apps periodically call G_TUNER to update mono/stereo, signal and afc status this leads to the music . pop . music . pop . music - not good. On the internet there is an howto for flashing the pcear with a newer firmware from the silabs reference boardto fix this, but: 1) This howto relies on a special version of the driver which allows firmware flashing 2) We should try to avoid the answer to a bug report being upgrade your firmware, if at all possible 3) Windows does not suffer from the pop sounds After a quick look at the driver I found at that the register reads are not necessary at all, as the device gives us the necessary status through usb interrupt packets, and the driver already uses these! Signed-off-by: Hans de Goede hdego...@redhat.com --- drivers/media/radio/si470x/radio-si470x-common.c | 10 ++ drivers/media/radio/si470x/radio-si470x-usb.c| 12 +--- drivers/media/radio/si470x/radio-si470x.h|1 + 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/media/radio/si470x/radio-si470x-common.c b/drivers/media/radio/si470x/radio-si470x-common.c index d485b79..5dbb897 100644 --- a/drivers/media/radio/si470x/radio-si470x-common.c +++ b/drivers/media/radio/si470x/radio-si470x-common.c @@ -583,14 +583,16 @@ static int si470x_vidioc_g_tuner(struct file *file, void *priv, struct v4l2_tuner *tuner) { struct si470x_device *radio = video_drvdata(file); - int retval; + int retval = 0; if (tuner-index != 0) return -EINVAL; - retval = si470x_get_register(radio, STATUSRSSI); - if (retval 0) - return retval; + if (!radio-status_rssi_auto_update) { + retval = si470x_get_register(radio, STATUSRSSI); + if (retval 0) + return retval; + } /* driver constants */ strcpy(tuner-name, FM); diff --git a/drivers/media/radio/si470x/radio-si470x-usb.c b/drivers/media/radio/si470x/radio-si470x-usb.c index f412f7a..0da5c98 100644 --- a/drivers/media/radio/si470x/radio-si470x-usb.c +++ b/drivers/media/radio/si470x/radio-si470x-usb.c @@ -399,12 +399,16 @@ static void si470x_int_in_callback(struct urb *urb) } } - if ((radio-registers[SYSCONFIG1] SYSCONFIG1_RDS) == 0) + /* Sometimes the device returns len 0 packets */ + if (urb-actual_length != RDS_REPORT_SIZE) goto resubmit; - if (urb-actual_length 0) { + radio-registers[STATUSRSSI] = + get_unaligned_be16(radio-int_in_buffer[1]); + + if ((radio-registers[SYSCONFIG1] SYSCONFIG1_RDS)) { /* Update RDS registers with URB data */ - for (regnr = 0; regnr RDS_REGISTER_NUM; regnr++) + for (regnr = 1; regnr RDS_REGISTER_NUM; regnr++) radio-registers[STATUSRSSI + regnr] = get_unaligned_be16(radio-int_in_buffer[ regnr * RADIO_REGISTER_SIZE + 1]); @@ -480,6 +484,7 @@ resubmit: radio-int_in_running = 0; } } + radio-status_rssi_auto_update = radio-int_in_running; } @@ -560,6 +565,7 @@ static int si470x_start_usb(struct si470x_device *radio) submitting int urb failed (%d)\n, retval); radio-int_in_running = 0; } + radio-status_rssi_auto_update = radio-int_in_running; return retval; } diff --git a/drivers/media/radio/si470x/radio-si470x.h b/drivers/media/radio/si470x/radio-si470x.h index 4921cab..2a0a46f 100644 --- a/drivers/media/radio/si470x/radio-si470x.h +++ b/drivers/media/radio/si470x/radio-si470x.h @@ -161,6 +161,7 @@ struct si470x_device { struct completion completion; bool stci_enabled; /* Seek/Tune Complete Interrupt */ + bool status_rssi_auto_update; /* Does RSSI get updated automatic? */ #if defined(CONFIG_USB_SI470X) || defined(CONFIG_USB_SI470X_MODULE) /* reference to USB and video device */ -- 1.7.10.2 -- 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 3/4] radio-si470x: Lower hardware freq seek signal treshold
The previous value made hardware freq seek not work for me, despite having good reception of almost all Dutch radio stations. Signed-off-by: Hans de Goede hdego...@redhat.com --- drivers/media/radio/si470x/radio-si470x-common.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/radio/si470x/radio-si470x-common.c b/drivers/media/radio/si470x/radio-si470x-common.c index 9f8b675..84ab3d57 100644 --- a/drivers/media/radio/si470x/radio-si470x-common.c +++ b/drivers/media/radio/si470x/radio-si470x-common.c @@ -359,7 +359,7 @@ int si470x_start(struct si470x_device *radio) /* sysconfig 2 */ radio-registers[SYSCONFIG2] = - (0x3f 8) | /* SEEKTH */ + (0x1f 8) | /* SEEKTH */ ((band 6) SYSCONFIG2_BAND) | /* BAND */ ((space 4) SYSCONFIG2_SPACE) | /* SPACE */ 15; /* VOLUME (max) */ -- 1.7.10.2 -- 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/4] radio-si470x: Lower firmware version requirements
With the changes from the previous patches device firmware version 14 + usb microcontroller software version 1 works fine too. Signed-off-by: Hans de Goede hdego...@redhat.com --- drivers/media/radio/si470x/radio-si470x-usb.c |2 +- drivers/media/radio/si470x/radio-si470x.h |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/radio/si470x/radio-si470x-usb.c b/drivers/media/radio/si470x/radio-si470x-usb.c index 66b1ba8..40b963c 100644 --- a/drivers/media/radio/si470x/radio-si470x-usb.c +++ b/drivers/media/radio/si470x/radio-si470x-usb.c @@ -143,7 +143,7 @@ MODULE_PARM_DESC(max_rds_errors, RDS maximum block errors: *1*); * Software/Hardware Versions from Scratch Page **/ #define RADIO_SW_VERSION_NOT_BOOTLOADABLE 6 -#define RADIO_SW_VERSION 7 +#define RADIO_SW_VERSION 1 #define RADIO_HW_VERSION 1 diff --git a/drivers/media/radio/si470x/radio-si470x.h b/drivers/media/radio/si470x/radio-si470x.h index fbf713d..b3b612f 100644 --- a/drivers/media/radio/si470x/radio-si470x.h +++ b/drivers/media/radio/si470x/radio-si470x.h @@ -189,7 +189,7 @@ struct si470x_device { * Firmware Versions **/ -#define RADIO_FW_VERSION 15 +#define RADIO_FW_VERSION 14 -- 1.7.10.2 -- 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/4] radio-si470x: Always use interrupt to wait for tune/seek completion
Since USB receives STATUS_RSSI updates through the interrupt endpoint, there is no need to poll with USB, so get rid of the polling. Note this also changes the order in which the probing of USB devices is done, to avoid si470x_set_chan getting called before the interrupt endpoint is being monitored. Signed-off-by: Hans de Goede hdego...@redhat.com --- drivers/media/radio/si470x/radio-si470x-common.c | 56 +- drivers/media/radio/si470x/radio-si470x-i2c.c|5 +- drivers/media/radio/si470x/radio-si470x-usb.c| 25 ++ drivers/media/radio/si470x/radio-si470x.h|1 - 4 files changed, 28 insertions(+), 59 deletions(-) diff --git a/drivers/media/radio/si470x/radio-si470x-common.c b/drivers/media/radio/si470x/radio-si470x-common.c index 5dbb897..9f8b675 100644 --- a/drivers/media/radio/si470x/radio-si470x-common.c +++ b/drivers/media/radio/si470x/radio-si470x-common.c @@ -164,7 +164,6 @@ MODULE_PARM_DESC(seek_timeout, Seek timeout: *5000*); static int si470x_set_chan(struct si470x_device *radio, unsigned short chan) { int retval; - unsigned long timeout; bool timed_out = 0; /* start tuning */ @@ -174,26 +173,12 @@ static int si470x_set_chan(struct si470x_device *radio, unsigned short chan) if (retval 0) goto done; - /* currently I2C driver only uses interrupt way to tune */ - if (radio-stci_enabled) { - INIT_COMPLETION(radio-completion); - - /* wait till tune operation has completed */ - retval = wait_for_completion_timeout(radio-completion, - msecs_to_jiffies(tune_timeout)); - if (!retval) - timed_out = true; - } else { - /* wait till tune operation has completed */ - timeout = jiffies + msecs_to_jiffies(tune_timeout); - do { - retval = si470x_get_register(radio, STATUSRSSI); - if (retval 0) - goto stop; - timed_out = time_after(jiffies, timeout); - } while (((radio-registers[STATUSRSSI] STATUSRSSI_STC) == 0) -(!timed_out)); - } + /* wait till tune operation has completed */ + INIT_COMPLETION(radio-completion); + retval = wait_for_completion_timeout(radio-completion, + msecs_to_jiffies(tune_timeout)); + if (!retval) + timed_out = true; if ((radio-registers[STATUSRSSI] STATUSRSSI_STC) == 0) dev_warn(radio-videodev.dev, tune does not complete\n); @@ -201,7 +186,6 @@ static int si470x_set_chan(struct si470x_device *radio, unsigned short chan) dev_warn(radio-videodev.dev, tune timed out after %u ms\n, tune_timeout); -stop: /* stop tuning */ radio-registers[CHANNEL] = ~CHANNEL_TUNE; retval = si470x_set_register(radio, CHANNEL); @@ -312,7 +296,6 @@ static int si470x_set_seek(struct si470x_device *radio, unsigned int wrap_around, unsigned int seek_upward) { int retval = 0; - unsigned long timeout; bool timed_out = 0; /* start seeking */ @@ -329,26 +312,12 @@ static int si470x_set_seek(struct si470x_device *radio, if (retval 0) return retval; - /* currently I2C driver only uses interrupt way to seek */ - if (radio-stci_enabled) { - INIT_COMPLETION(radio-completion); - - /* wait till seek operation has completed */ - retval = wait_for_completion_timeout(radio-completion, - msecs_to_jiffies(seek_timeout)); - if (!retval) - timed_out = true; - } else { - /* wait till seek operation has completed */ - timeout = jiffies + msecs_to_jiffies(seek_timeout); - do { - retval = si470x_get_register(radio, STATUSRSSI); - if (retval 0) - goto stop; - timed_out = time_after(jiffies, timeout); - } while (((radio-registers[STATUSRSSI] STATUSRSSI_STC) == 0) -(!timed_out)); - } + /* wait till tune operation has completed */ + INIT_COMPLETION(radio-completion); + retval = wait_for_completion_timeout(radio-completion, + msecs_to_jiffies(seek_timeout)); + if (!retval) + timed_out = true; if ((radio-registers[STATUSRSSI] STATUSRSSI_STC) == 0) dev_warn(radio-videodev.dev, seek does not complete\n); @@ -356,7 +325,6 @@ static int si470x_set_seek(struct si470x_device *radio, dev_warn(radio-videodev.dev, seek failed / band limit reached\n); -stop:
[PATCHv2 3/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-dev.c|1 + drivers/media/video/v4l2-ioctl.c |6 ++ include/linux/videodev2.h | 26 ++ include/media/v4l2-ioctl.h|2 ++ 5 files changed, 36 insertions(+) diff --git a/drivers/media/video/v4l2-compat-ioctl32.c b/drivers/media/video/v4l2-compat-ioctl32.c index d33ab18..141e745 100644 --- a/drivers/media/video/v4l2-compat-ioctl32.c +++ b/drivers/media/video/v4l2-compat-ioctl32.c @@ -970,6 +970,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-dev.c b/drivers/media/video/v4l2-dev.c index 5ccbd46..6bf6307 100644 --- a/drivers/media/video/v4l2-dev.c +++ b/drivers/media/video/v4l2-dev.c @@ -597,6 +597,7 @@ static void determine_valid_ioctls(struct video_device *vdev) SET_VALID_IOCTL(ops, VIDIOC_REQBUFS, vidioc_reqbufs); SET_VALID_IOCTL(ops, VIDIOC_QUERYBUF, vidioc_querybuf); SET_VALID_IOCTL(ops, VIDIOC_QBUF, vidioc_qbuf); + SET_VALID_IOCTL(ops, VIDIOC_EXPBUF, vidioc_expbuf); SET_VALID_IOCTL(ops, VIDIOC_DQBUF, vidioc_dqbuf); SET_VALID_IOCTL(ops, VIDIOC_OVERLAY, vidioc_overlay); SET_VALID_IOCTL(ops, VIDIOC_G_FBUF, vidioc_g_fbuf); diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c index 31fc2ad..a73b14e 100644 --- a/drivers/media/video/v4l2-ioctl.c +++ b/drivers/media/video/v4l2-ioctl.c @@ -212,6 +212,7 @@ static struct v4l2_ioctl_info v4l2_ioctls[] = { IOCTL_INFO(VIDIOC_S_FBUF, INFO_FL_PRIO), IOCTL_INFO(VIDIOC_OVERLAY, INFO_FL_PRIO), IOCTL_INFO(VIDIOC_QBUF, 0), + IOCTL_INFO(VIDIOC_EXPBUF, 0), IOCTL_INFO(VIDIOC_DQBUF, 0), IOCTL_INFO(VIDIOC_STREAMON, INFO_FL_PRIO), IOCTL_INFO(VIDIOC_STREAMOFF, INFO_FL_PRIO), @@ -957,6 +958,11 @@ static long __video_do_ioctl(struct file *file, dbgbuf(cmd, vfd, p); break; } + case VIDIOC_EXPBUF: + { + ret = ops-vidioc_expbuf(file, fh, arg); + break; + } case VIDIOC_DQBUF: { struct v4l2_buffer *p = arg; diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 51b20f4..e8893a5 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -684,6 +684,31 @@ 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:buffer memory offset as returned by VIDIOC_QUERYBUF in struct + * v4l2_buffer::m.offset (for single-plane formats) or + * v4l2_plane::m.offset (for multi-planar formats) + * @flags: flags for newly created file, currently only O_CLOEXEC is + * supported, refer to manual of open syscall for more details + * + * Contains data used for exporting a video buffer as DMABUF file descriptor. + * The buffer is identified by a 'cookie' returned by VIDIOC_QUERYBUF + * (identical to the cookie used to mmap() the buffer to userspace). All + * reserved fields must be set to zero. The field reserved0 is expected to + * become a structure 'type' allowing an alternative layout of the structure + * content. Therefore this field should not be used for any other extensions. + */ +struct v4l2_exportbuffer { + __u32 fd; + __u32 reserved0; + __u32 mem_offset; + __u32 flags; + __u32 reserved[12]; +}; + /* * O V E R L A Y P R E V I E W */ @@ -2553,6 +2578,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 d8b76f7..ccd1faa 100644 --- a/include/media/v4l2-ioctl.h
[PATCHv2 6/9] v4l: s5p-fimc: support for dmabuf exporting
This patch enhances s5p-fimc with support for DMABUF exporting via VIDIOC_EXPBUF ioctl. Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com --- drivers/media/video/s5p-fimc/fimc-capture.c |9 + 1 file changed, 9 insertions(+) diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c b/drivers/media/video/s5p-fimc/fimc-capture.c index cd27e33..52c9b36 100644 --- a/drivers/media/video/s5p-fimc/fimc-capture.c +++ b/drivers/media/video/s5p-fimc/fimc-capture.c @@ -1101,6 +1101,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) { @@ -1225,6 +1233,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_prepare_buf = fimc_cap_prepare_buf, .vidioc_create_bufs = fimc_cap_create_bufs, -- 1.7.9.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
[PATCHv2 1/9] v4l: vb2-dma-contig: let mmap method to use dma_mmap_coherent call
From: Marek Szyprowski m.szyprow...@samsung.com Let mmap method to use dma_mmap_coherent call. This patch depends on DMA mapping redesign patches because the usage of dma_mmap_coherent breaks dma-contig allocator for architectures other than ARM and AVR. Moreover, this patch removes vb2_mmap_pfn_range from videobuf2 helpers. The function is no longer used in vb2 code. Suggested-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/video/videobuf2-dma-contig.c | 28 +-- drivers/media/video/videobuf2-memops.c | 40 include/media/videobuf2-memops.h |5 3 files changed, 26 insertions(+), 47 deletions(-) diff --git a/drivers/media/video/videobuf2-dma-contig.c b/drivers/media/video/videobuf2-dma-contig.c index 040829b..00b776c 100644 --- a/drivers/media/video/videobuf2-dma-contig.c +++ b/drivers/media/video/videobuf2-dma-contig.c @@ -178,14 +178,38 @@ static void *vb2_dc_alloc(void *alloc_ctx, unsigned long size) static int vb2_dc_mmap(void *buf_priv, struct vm_area_struct *vma) { struct vb2_dc_buf *buf = buf_priv; + int ret; if (!buf) { printk(KERN_ERR No buffer to map\n); return -EINVAL; } - return vb2_mmap_pfn_range(vma, buf-dma_addr, buf-size, - vb2_common_vm_ops, buf-handler); + /* +* dma_mmap_* uses vm_pgoff as in-buffer offset, but we want to +* map whole buffer +*/ + vma-vm_pgoff = 0; + + ret = dma_mmap_coherent(buf-dev, vma, buf-vaddr, + buf-dma_addr, buf-size); + + if (ret) { + printk(KERN_ERR Remapping memory failed, error: %d\n, ret); + return ret; + } + + vma-vm_flags |= VM_DONTEXPAND | VM_RESERVED; + vma-vm_private_data= buf-handler; + vma-vm_ops = vb2_common_vm_ops; + + vma-vm_ops-open(vma); + + printk(KERN_DEBUG %s: mapped dma addr 0x%08lx at 0x%08lx, size %ld\n, + __func__, (unsigned long)buf-dma_addr, vma-vm_start, + buf-size); + + return 0; } /*/ diff --git a/drivers/media/video/videobuf2-memops.c b/drivers/media/video/videobuf2-memops.c index 504cd4c..81c1ad8 100644 --- a/drivers/media/video/videobuf2-memops.c +++ b/drivers/media/video/videobuf2-memops.c @@ -137,46 +137,6 @@ int vb2_get_contig_userptr(unsigned long vaddr, unsigned long size, EXPORT_SYMBOL_GPL(vb2_get_contig_userptr); /** - * vb2_mmap_pfn_range() - map physical pages to userspace - * @vma: virtual memory region for the mapping - * @paddr: starting physical address of the memory to be mapped - * @size: size of the memory to be mapped - * @vm_ops:vm operations to be assigned to the created area - * @priv: private data to be associated with the area - * - * Returns 0 on success. - */ -int vb2_mmap_pfn_range(struct vm_area_struct *vma, unsigned long paddr, - unsigned long size, - const struct vm_operations_struct *vm_ops, - void *priv) -{ - int ret; - - size = min_t(unsigned long, vma-vm_end - vma-vm_start, size); - - vma-vm_page_prot = pgprot_noncached(vma-vm_page_prot); - ret = remap_pfn_range(vma, vma-vm_start, paddr PAGE_SHIFT, - size, vma-vm_page_prot); - if (ret) { - printk(KERN_ERR Remapping memory failed, error: %d\n, ret); - return ret; - } - - vma-vm_flags |= VM_DONTEXPAND | VM_RESERVED; - vma-vm_private_data= priv; - vma-vm_ops = vm_ops; - - vma-vm_ops-open(vma); - - pr_debug(%s: mapped paddr 0x%08lx at 0x%08lx, size %ld\n, - __func__, paddr, vma-vm_start, size); - - return 0; -} -EXPORT_SYMBOL_GPL(vb2_mmap_pfn_range); - -/** * vb2_common_vm_open() - increase refcount of the vma * @vma: virtual memory region for the mapping * diff --git a/include/media/videobuf2-memops.h b/include/media/videobuf2-memops.h index 84e1f6c..f05444c 100644 --- a/include/media/videobuf2-memops.h +++ b/include/media/videobuf2-memops.h @@ -33,11 +33,6 @@ extern const struct vm_operations_struct vb2_common_vm_ops; int vb2_get_contig_userptr(unsigned long vaddr, unsigned long size, struct vm_area_struct **res_vma, dma_addr_t *res_pa); -int vb2_mmap_pfn_range(struct vm_area_struct *vma, unsigned long paddr, - unsigned long size, - const struct vm_operations_struct *vm_ops, - void *priv); - struct vm_area_struct
[PATCHv2 0/9] Support for dmabuf exporting for videobuf2
Hello everyone, The patches adds support for DMABUF exporting to V4L2 stack. The latest support for DMABUF importing was posted in [1]. The exporter part is dependant on DMA mapping redesign [2] which is expected to be merged into the mainline. Therefore it is posted as a separate patchset. Moreover some patches depends on vmap extension for DMABUF by Dave Airlie [3] and sg_alloc_table_from_pages function [4]. The last patch 'v4l: vb2-dma-contig: use dma_get_sgtable' depends on dma_get_sgtable extension to DMA api [5]. The tree with all the patches and extensions is available at: repo: git://git.infradead.org/users/kmpark/linux-2.6-samsung branch: media-for3.5-vb2-dmabuf-v7 Changelog: v2: - add documentation for DMABUF exporting - squashed 'let mmap method to use dma_mmap_coherent call' with 'remove vb2_mmap_pfn_range function' - move setup of scatterlist for MMAP buffers from alloc to DMABUF export code - use locking to serialize map/unmap of DMABUF attachments - squash vmap/kmap, setup of sg lists, allocation in attachments into dma-contig exporter patch - fix occasional failure of follow_pfn trick by using init_mm in artificial VMA - add support for exporting in s5p-mfc driver - drop all code that duplicates sg_alloc_table_from_pages - introduce usage of dma_get_sgtable as generic solution to follow_pfn trick v1: - updated setup of VIDIOC_EXPBUF ioctl - doc updates - introduced workaround to avoid using dma_get_pages, - removed caching of exported dmabuf to avoid existence of circular reference between dmabuf and vb2_dc_buf or resource leakage - removed all 'change behaviour' patches - inital support for exporting in s5p-mfs driver - removal of vb2_mmap_pfn_range that is no longer used - use sg_alloc_table_from_pages instead of creating sglist in vb2_dc code - move attachment allocation to exporter's attach callback v0: RFC - initial version [1] http://thread.gmane.org/gmane.linux.drivers.video-input-infrastructure/49438 [2] http://thread.gmane.org/gmane.linux.kernel.cross-arch/14098 [3] http://permalink.gmane.org/gmane.comp.video.dri.devel/69302 [4] This patchset is rebased on 3.4-rc1 plus the following patchsets: [5] http://www.spinics.net/lists/linux-arch/msg18282.html Marek Szyprowski (1): v4l: vb2-dma-contig: let mmap method to use dma_mmap_coherent call Tomasz Stanislawski (8): Documentation: media: description of DMABUF exporting in V4L2 v4l: add buffer exporting via dmabuf v4l: vb2: add buffer exporting via dmabuf v4l: vb2-dma-contig: add support for DMABUF exporting v4l: s5p-fimc: support for dmabuf exporting v4l: s5p-tv: mixer: support for dmabuf exporting v4l: s5p-mfc: support for dmabuf exporting v4l: vb2-dma-contig: use dma_get_sgtable Documentation/DocBook/media/v4l/compat.xml|3 + Documentation/DocBook/media/v4l/io.xml|3 + Documentation/DocBook/media/v4l/v4l2.xml |1 + Documentation/DocBook/media/v4l/vidioc-expbuf.xml | 223 drivers/media/video/s5p-fimc/fimc-capture.c |9 + drivers/media/video/s5p-mfc/s5p_mfc_dec.c | 18 ++ drivers/media/video/s5p-mfc/s5p_mfc_enc.c | 18 ++ drivers/media/video/s5p-tv/mixer_video.c | 10 + drivers/media/video/v4l2-compat-ioctl32.c |1 + drivers/media/video/v4l2-dev.c|1 + drivers/media/video/v4l2-ioctl.c |6 + drivers/media/video/videobuf2-core.c | 67 ++ drivers/media/video/videobuf2-dma-contig.c| 224 - drivers/media/video/videobuf2-memops.c| 40 include/linux/videodev2.h | 26 +++ include/media/v4l2-ioctl.h|2 + include/media/videobuf2-core.h|2 + include/media/videobuf2-memops.h |5 - 18 files changed, 612 insertions(+), 47 deletions(-) create mode 100644 Documentation/DocBook/media/v4l/vidioc-expbuf.xml -- 1.7.9.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
[PATCHv2 9/9] v4l: vb2-dma-contig: use dma_get_sgtable
This patch removes a workaround for extraction of struct pages from DMA buffer. The method of using follow_pfn for artificial VMA is dropped in favour of dma_get_sgtable function. 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 | 60 ++-- 1 file changed, 4 insertions(+), 56 deletions(-) diff --git a/drivers/media/video/videobuf2-dma-contig.c b/drivers/media/video/videobuf2-dma-contig.c index a845ff7..73297b7 100644 --- a/drivers/media/video/videobuf2-dma-contig.c +++ b/drivers/media/video/videobuf2-dma-contig.c @@ -361,73 +361,21 @@ static struct dma_buf_ops vb2_dc_dmabuf_ops = { .release = vb2_dc_dmabuf_ops_release, }; -/** - * vb2_dc_kaddr_to_pages() - extract list of struct pages from a kernel - * pointer. This function is a workaround to extract pages from a pointer - * returned by dma_alloc_coherent. The pages are obtained by creating an - * artificial vma and using follow_pfn to do a page walk to find a PFN - */ -static int vb2_dc_kaddr_to_pages(unsigned long kaddr, - struct page **pages, unsigned int n_pages) -{ - unsigned int i; - unsigned long pfn; - /* create an artificial VMA */ - struct vm_area_struct vma = { - .vm_flags = VM_IO | VM_PFNMAP, - .vm_mm = init_mm, - }; - - for (i = 0; i n_pages; ++i, kaddr += PAGE_SIZE) { - if (follow_pfn(vma, kaddr, pfn)) - break; - pages[i] = pfn_to_page(pfn); - } - - return i; -} - static struct sg_table *vb2_dc_get_base_sgt(struct vb2_dc_buf *buf) { - int n_pages; - struct page **pages = NULL; int ret; struct sg_table *sgt; - n_pages = PAGE_ALIGN(buf-size) PAGE_SHIFT; - - pages = kmalloc(n_pages * sizeof pages[0], GFP_KERNEL); - if (!pages) { - dev_err(buf-dev, failed to alloc page table\n); - return ERR_PTR(-ENOMEM); - } - - ret = vb2_dc_kaddr_to_pages((unsigned long)buf-vaddr, pages, n_pages); - if (ret 0) { - dev_err(buf-dev, failed to get buffer pages from DMA API\n); - kfree(pages); - return ERR_PTR(ret); - } - if (ret != n_pages) { - dev_err(buf-dev, got only %d of %d pages from DMA API\n, - ret, n_pages); - kfree(pages); - return ERR_PTR(-EFAULT); - } - sgt = kmalloc(sizeof *sgt, GFP_KERNEL); if (!sgt) { dev_err(buf-dev, failed to alloc sg table\n); - kfree(pages); return ERR_PTR(-ENOMEM); } - ret = sg_alloc_table_from_pages(sgt, pages, n_pages, 0, - buf-size, GFP_KERNEL); - /* failure or not, pages are no longer needed */ - kfree(pages); - if (ret) { - dev_err(buf-dev, failed to covert pages to sg table\n); + ret = dma_get_sgtable(buf-dev, sgt, buf-vaddr, buf-dma_addr, + buf-size, NULL); + if (ret 0) { + dev_err(buf-dev, failed to get scatterlist from DMA API\n); kfree(sgt); return ERR_PTR(ret); } -- 1.7.9.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
[PATCHv2 4/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 Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/video/videobuf2-core.c | 67 ++ include/media/videobuf2-core.h |2 + 2 files changed, 69 insertions(+) diff --git a/drivers/media/video/videobuf2-core.c b/drivers/media/video/videobuf2-core.c index d60ed25..923165a 100644 --- a/drivers/media/video/videobuf2-core.c +++ b/drivers/media/video/videobuf2-core.c @@ -1730,6 +1730,73 @@ static int __find_plane_by_offset(struct vb2_queue *q, unsigned long off, } /** + * vb2_expbuf() - Export a buffer as a file descriptor + * @q: videobuf2 queue + * @eb: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; + } + + if (eb-flags ~O_CLOEXEC) { + dprintk(1, Queue does support only O_CLOEXEC flag\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, eb-flags); + if (ret 0) { + dprintk(3, buffer %d, plane %d failed to export (%d)\n, + buffer, plane, ret); + dma_buf_put(dbuf); + 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_mmap() - map video buffers into application address space * @q: videobuf2 queue * @vma: vma passed to the mmap file operation handler in the driver diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h index d079f92..fe01f95 100644 --- a/include/media/videobuf2-core.h +++ b/include/media/videobuf2-core.h @@ -81,6 +81,7 @@ struct vb2_fileio_data; struct vb2_mem_ops { void*(*alloc)(void *alloc_ctx, unsigned long size); 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); @@ -350,6 +351,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.9.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
[PATCHv2 8/9] v4l: s5p-mfc: support for dmabuf exporting
This patch enhances s5p-mfc with support for DMABUF exporting via VIDIOC_EXPBUF ioctl. Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com CC: Kamil Debski k.deb...@samsung.com --- drivers/media/video/s5p-mfc/s5p_mfc_dec.c | 18 ++ drivers/media/video/s5p-mfc/s5p_mfc_enc.c | 18 ++ 2 files changed, 36 insertions(+) diff --git a/drivers/media/video/s5p-mfc/s5p_mfc_dec.c b/drivers/media/video/s5p-mfc/s5p_mfc_dec.c index c25ec02..8344ce5 100644 --- a/drivers/media/video/s5p-mfc/s5p_mfc_dec.c +++ b/drivers/media/video/s5p-mfc/s5p_mfc_dec.c @@ -564,6 +564,23 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *buf) return -EINVAL; } +/* Export DMA buffer */ +static int vidioc_expbuf(struct file *file, void *priv, + struct v4l2_exportbuffer *eb) +{ + struct s5p_mfc_ctx *ctx = fh_to_ctx(priv); + int ret; + + if (eb-mem_offset DST_QUEUE_OFF_BASE) + return vb2_expbuf(ctx-vq_src, eb); + + eb-mem_offset -= DST_QUEUE_OFF_BASE; + ret = vb2_expbuf(ctx-vq_dst, eb); + eb-mem_offset += DST_QUEUE_OFF_BASE; + + return ret; +} + /* Stream on */ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type type) @@ -739,6 +756,7 @@ static const struct v4l2_ioctl_ops s5p_mfc_dec_ioctl_ops = { .vidioc_querybuf = vidioc_querybuf, .vidioc_qbuf = vidioc_qbuf, .vidioc_dqbuf = vidioc_dqbuf, + .vidioc_expbuf = vidioc_expbuf, .vidioc_streamon = vidioc_streamon, .vidioc_streamoff = vidioc_streamoff, .vidioc_g_crop = vidioc_g_crop, diff --git a/drivers/media/video/s5p-mfc/s5p_mfc_enc.c b/drivers/media/video/s5p-mfc/s5p_mfc_enc.c index acedb20..db110c5 100644 --- a/drivers/media/video/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/video/s5p-mfc/s5p_mfc_enc.c @@ -1141,6 +1141,23 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *buf) return -EINVAL; } +/* Export DMA buffer */ +static int vidioc_expbuf(struct file *file, void *priv, + struct v4l2_exportbuffer *eb) +{ + struct s5p_mfc_ctx *ctx = fh_to_ctx(priv); + int ret; + + if (eb-mem_offset DST_QUEUE_OFF_BASE) + return vb2_expbuf(ctx-vq_src, eb); + + eb-mem_offset -= DST_QUEUE_OFF_BASE; + ret = vb2_expbuf(ctx-vq_dst, eb); + eb-mem_offset += DST_QUEUE_OFF_BASE; + + return ret; +} + /* Stream on */ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type type) @@ -1486,6 +1503,7 @@ static const struct v4l2_ioctl_ops s5p_mfc_enc_ioctl_ops = { .vidioc_querybuf = vidioc_querybuf, .vidioc_qbuf = vidioc_qbuf, .vidioc_dqbuf = vidioc_dqbuf, + .vidioc_expbuf = vidioc_expbuf, .vidioc_streamon = vidioc_streamon, .vidioc_streamoff = vidioc_streamoff, .vidioc_s_parm = vidioc_s_parm, -- 1.7.9.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
[PATCHv2 2/9] Documentation: media: description of DMABUF exporting in V4L2
This patch adds description and usage examples for exporting DMABUF file descriptor in V4L2. Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com CC: linux-...@vger.kernel.org --- Documentation/DocBook/media/v4l/compat.xml|3 + Documentation/DocBook/media/v4l/io.xml|3 + Documentation/DocBook/media/v4l/v4l2.xml |1 + Documentation/DocBook/media/v4l/vidioc-expbuf.xml | 223 + 4 files changed, 230 insertions(+) create mode 100644 Documentation/DocBook/media/v4l/vidioc-expbuf.xml diff --git a/Documentation/DocBook/media/v4l/compat.xml b/Documentation/DocBook/media/v4l/compat.xml index 07a311f..7773450 100644 --- a/Documentation/DocBook/media/v4l/compat.xml +++ b/Documentation/DocBook/media/v4l/compat.xml @@ -2591,6 +2591,9 @@ ioctls./para paraImporting DMABUF file descriptors as a new IO method described in xref linkend=dmabuf /./para /listitem +listitem + paraExporting DMABUF files using VIDIOC-EXPBUF; ioctl./para +/listitem /itemizedlist /section diff --git a/Documentation/DocBook/media/v4l/io.xml b/Documentation/DocBook/media/v4l/io.xml index f55b0ab..7a0dfc9 100644 --- a/Documentation/DocBook/media/v4l/io.xml +++ b/Documentation/DocBook/media/v4l/io.xml @@ -488,6 +488,9 @@ buffer from userspace using a file descriptor previously exported for a different or the same device (known as the importer role), or both. This section describes the DMABUF importer role API in V4L2./para +paraRefer to link linked=vidioc-expbuf DMABUF exporting /link for +details about exporting a V4L2 buffers as DMABUF file descriptors./para + paraInput and output devices support the streaming I/O method when the constantV4L2_CAP_STREAMING/constant flag in the structfieldcapabilities/structfield field of v4l2-capability; returned by diff --git a/Documentation/DocBook/media/v4l/v4l2.xml b/Documentation/DocBook/media/v4l/v4l2.xml index 015c561..8f650d2 100644 --- a/Documentation/DocBook/media/v4l/v4l2.xml +++ b/Documentation/DocBook/media/v4l/v4l2.xml @@ -561,6 +561,7 @@ and discussions on the V4L mailing list./revremark sub-log-status; sub-overlay; sub-qbuf; +sub-expbuf; sub-querybuf; sub-querycap; sub-queryctrl; diff --git a/Documentation/DocBook/media/v4l/vidioc-expbuf.xml b/Documentation/DocBook/media/v4l/vidioc-expbuf.xml new file mode 100644 index 000..30ebf67 --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-expbuf.xml @@ -0,0 +1,223 @@ +refentry id=vidioc-expbuf + + refmeta +refentrytitleioctl VIDIOC_EXPBUF/refentrytitle +manvol; + /refmeta + + refnamediv +refnameVIDIOC_EXPBUF/refname +refpurposeExport a buffer as a DMABUF file descriptor./refpurpose + /refnamediv + + refsynopsisdiv +funcsynopsis + funcprototype + funcdefint functionioctl/function/funcdef + paramdefint parameterfd/parameter/paramdef + paramdefint parameterrequest/parameter/paramdef + paramdefstruct v4l2_exportbuffer *parameterargp/parameter/paramdef + /funcprototype +/funcsynopsis + /refsynopsisdiv + + refsect1 +titleArguments/title + +variablelist + varlistentry + termparameterfd/parameter/term + listitem + parafd;/para + /listitem + /varlistentry + varlistentry + termparameterrequest/parameter/term + listitem + paraVIDIOC_EXPBUF/para + /listitem + /varlistentry + varlistentry + termparameterargp/parameter/term + listitem + para/para + /listitem + /varlistentry +/variablelist + /refsect1 + + refsect1 +titleDescription/title + +note + titleExperimental/title + paraThis is an link linkend=experimental experimental /link + interface and may change in the future./para +/note + +paraThis ioctl is an extension to the link linkend=mmapmemory +mapping/link I/O method therefore it is available only for +constantV4L2_MEMORY_MMAP/constant buffers. It can be used to export a +buffer as DMABUF file at any time after buffers have been allocated with the +VIDIOC-REQBUFS; ioctl./para + +paraPrior to exporting an application calls link +linkend=vidioc-querybufVIDIOC_QUERYBUF/link to obtain memory offsets. When +using the link linkend=planar-apismulti-planar API/link every plane has +own offset./para + +paraTo export a buffer, the application fills v4l2-exportbuffer;. The +structfield mem_offset /structfield field is set to the offset obtained +from constant VIDIOC_QUERYBUF /constant. Additional flags may be posted in +the structfield flags /structfield field. Refer to manual for open syscall +for details. Currently only O_CLOEXEC is guaranteed to be supported. All other +fields must be set to zero. In a case of multi-planar API, every plane is +exported separately using multiple constant VIDIOC_EXPBUF
[PATCHv2 5/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 | 248 1 file changed, 248 insertions(+) diff --git a/drivers/media/video/videobuf2-dma-contig.c b/drivers/media/video/videobuf2-dma-contig.c index 00b776c..a845ff7 100644 --- a/drivers/media/video/videobuf2-dma-contig.c +++ b/drivers/media/video/videobuf2-dma-contig.c @@ -36,6 +36,7 @@ struct vb2_dc_buf { /* MMAP related */ struct vb2_vmarea_handler handler; atomic_trefcount; + struct sg_table *sgt_base; /* USERPTR related */ struct vm_area_struct *vma; @@ -142,6 +143,10 @@ static void vb2_dc_put(void *buf_priv) if (!atomic_dec_and_test(buf-refcount)) return; + if (buf-sgt_base) { + sg_free_table(buf-sgt_base); + kfree(buf-sgt_base); + } dma_free_coherent(buf-dev, buf-size, buf-vaddr, buf-dma_addr); kfree(buf); } @@ -213,6 +218,248 @@ 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) +{ + struct vb2_dc_attachment *attach; + unsigned int i; + struct scatterlist *rd, *wr; + struct sg_table *sgt; + struct vb2_dc_buf *buf = dbuf-priv; + int ret; + + attach = kzalloc(sizeof *attach, GFP_KERNEL); + if (!attach) + return -ENOMEM; + + sgt = attach-sgt; + /* Copy the buf-base_sgt scatter list to the attachment, as we can't +* map the same scatter list to multiple attachments at the same time. +*/ + ret = sg_alloc_table(sgt, buf-sgt_base-orig_nents, GFP_KERNEL); + if (ret) { + kfree(attach); + return -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); + } + + attach-dir = DMA_NONE; + dbuf_attach-priv = attach; + + 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; + + /* release the scatterlist cache */ + if (attach-dir != DMA_NONE) + dma_unmap_sg(db_attach-dev, sgt-sgl, sgt-orig_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 vb2_dc_attachment *attach = db_attach-priv; + /* stealing dmabuf mutex to serialize map/unmap operations */ + struct mutex *lock = db_attach-dmabuf-lock; + struct sg_table *sgt; + int ret; + + mutex_lock(lock); + + sgt = attach-sgt; + /* return previously mapped sg table */ + if (attach-dir == dir) { + mutex_unlock(lock); + return sgt; + } + + /* release any previous cache */ + if (attach-dir != DMA_NONE) { + dma_unmap_sg(db_attach-dev, sgt-sgl, sgt-orig_nents, + attach-dir); + attach-dir = DMA_NONE; + } + + /* mapping to the client with new direction */ + ret = dma_map_sg(db_attach-dev, sgt-sgl, sgt-orig_nents, dir); + if (ret = 0) { + printk(KERN_ERR failed to map scatterlist\n); + mutex_unlock(lock); + return ERR_PTR(-EIO); + } + + attach-dir = dir; + + mutex_unlock(lock); + + return sgt; +} + +static void vb2_dc_dmabuf_ops_unmap(struct dma_buf_attachment *db_attach, + struct sg_table *sgt, enum dma_data_direction dir) +{ + /* 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 void *vb2_dc_dmabuf_ops_kmap(struct dma_buf *dbuf, unsigned long pgnum) +{ + struct vb2_dc_buf *buf = dbuf-priv; + + return buf-vaddr + pgnum * PAGE_SIZE; +} + +static void *vb2_dc_dmabuf_ops_vmap(struct dma_buf *dbuf) +{ + struct
[PATCH 1/8] [RESEND] cx231xx: Paranoic stack memory save
Saves 255 bytes of stack memory on cx231xx_usb_probe() by removing a char array. Tested by compilation only. Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com --- drivers/media/video/cx231xx/cx231xx-cards.c | 17 +++-- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/drivers/media/video/cx231xx/cx231xx-cards.c b/drivers/media/video/cx231xx/cx231xx-cards.c index 8ed460d..02d4d36 100644 --- a/drivers/media/video/cx231xx/cx231xx-cards.c +++ b/drivers/media/video/cx231xx/cx231xx-cards.c @@ -1023,7 +1023,6 @@ static int cx231xx_usb_probe(struct usb_interface *interface, int nr = 0, ifnum; int i, isoc_pipe = 0; char *speed; - char descr[255] = ; struct usb_interface_assoc_descriptor *assoc_desc; udev = usb_get_dev(interface_to_usbdev(interface)); @@ -1098,20 +1097,10 @@ static int cx231xx_usb_probe(struct usb_interface *interface, speed = unknown; } - if (udev-manufacturer) - strlcpy(descr, udev-manufacturer, sizeof(descr)); - - if (udev-product) { - if (*descr) - strlcat(descr, , sizeof(descr)); - strlcat(descr, udev-product, sizeof(descr)); - } - if (*descr) - strlcat(descr, , sizeof(descr)); - - cx231xx_info(New device %s@ %s Mbps + cx231xx_info(New device %s %s @ %s Mbps (%04x:%04x) with %d interfaces\n, -descr, +udev-manufacturer ? udev-manufacturer : , +udev-product ? udev-product : , speed, le16_to_cpu(udev-descriptor.idVendor), le16_to_cpu(udev-descriptor.idProduct), -- 1.7.10.2 -- 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/8] [RESEND] pvrusb2: Variables set but not used
Tested by compilation only. Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com --- drivers/media/video/pvrusb2/pvrusb2-v4l2.c |8 1 file changed, 8 deletions(-) diff --git a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c index 7bddfae..cbe4080 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c +++ b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c @@ -226,13 +226,11 @@ static int pvr2_enum_input(struct file *file, void *priv, struct v4l2_input *vi) struct v4l2_input tmp; unsigned int cnt; int val; - int ret; cptr = pvr2_hdw_get_ctrl_by_id(hdw, PVR2_CID_INPUT); memset(tmp, 0, sizeof(tmp)); tmp.index = vi-index; - ret = 0; if (vi-index = fh-input_cnt) return -EINVAL; val = fh-input_map[vi-index]; @@ -556,9 +554,7 @@ static int pvr2_queryctrl(struct file *file, void *priv, struct pvr2_hdw *hdw = fh-channel.mc_head-hdw; struct pvr2_ctrl *cptr; int val; - int ret; - ret = 0; if (vc-id V4L2_CTRL_FLAG_NEXT_CTRL) { cptr = pvr2_hdw_get_ctrl_nextv4l( hdw, (vc-id ~V4L2_CTRL_FLAG_NEXT_CTRL)); @@ -705,11 +701,9 @@ static int pvr2_try_ext_ctrls(struct file *file, void *priv, struct v4l2_ext_control *ctrl; struct pvr2_ctrl *pctl; unsigned int idx; - int ret; /* For the moment just validate that the requested control actually exists. */ - ret = 0; for (idx = 0; idx ctls-count; idx++) { ctrl = ctls-controls + idx; pctl = pvr2_hdw_get_ctrl_v4l(hdw, ctrl-id); @@ -770,12 +764,10 @@ static int pvr2_s_crop(struct file *file, void *priv, struct v4l2_crop *crop) { struct pvr2_v4l2_fh *fh = file-private_data; struct pvr2_hdw *hdw = fh-channel.mc_head-hdw; - struct v4l2_cropcap cap; int ret; if (crop-type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; - cap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; ret = pvr2_ctrl_set_value( pvr2_hdw_get_ctrl_by_id(hdw, PVR2_CID_CROPL), crop-c.left); -- 1.7.10.2 -- 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:Thu Jun 14 19:00:17 CEST 2012 git hash:5472d3f17845c4398c6a510b46855820920c2181 gcc version: i686-linux-gcc (GCC) 4.6.3 host hardware:x86_64 host os: 3.3-6.slh.2-amd64 linux-git-arm-eabi-davinci: WARNINGS linux-git-arm-eabi-exynos: WARNINGS linux-git-arm-eabi-omap: 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-i686: WARNINGS linux-3.4-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-x86_64: WARNINGS linux-3.4-x86_64: WARNINGS apps: WARNINGS spec-git: WARNINGS sparse: ERRORS Detailed results are available here: http://www.xs4all.nl/~hverkuil/logs/Thursday.log Full logs are available here: http://www.xs4all.nl/~hverkuil/logs/Thursday.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
[PATCH 3/8] [RESEND] saa7146: Variable set but not used
In function fops_open variable type was set but not used. Tested by compilation only. Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com --- drivers/media/common/saa7146_fops.c |5 - 1 file changed, 5 deletions(-) diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c index 7d42c11..0cdbd74 100644 --- a/drivers/media/common/saa7146_fops.c +++ b/drivers/media/common/saa7146_fops.c @@ -198,7 +198,6 @@ static int fops_open(struct file *file) struct saa7146_dev *dev = video_drvdata(file); struct saa7146_fh *fh = NULL; int result = 0; - enum v4l2_buf_type type; DEB_EE(file:%p, dev:%s\n, file, video_device_node_name(vdev)); @@ -207,10 +206,6 @@ static int fops_open(struct file *file) DEB_D(using: %p\n, dev); - type = vdev-vfl_type == VFL_TYPE_GRABBER -? V4L2_BUF_TYPE_VIDEO_CAPTURE -: V4L2_BUF_TYPE_VBI_CAPTURE; - /* check if an extension is registered */ if( NULL == dev-ext ) { DEB_S(no extension registered for this device\n); -- 1.7.10.2 -- 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/8] [RESEND] saa7164: Variable set but not used
In function saa7164_api_i2c_read variable regval was set but not used. Tested by compilation only. Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com --- drivers/media/video/saa7164/saa7164-api.c | 14 -- 1 file changed, 14 deletions(-) diff --git a/drivers/media/video/saa7164/saa7164-api.c b/drivers/media/video/saa7164/saa7164-api.c index 8a98ab6..c8799fd 100644 --- a/drivers/media/video/saa7164/saa7164-api.c +++ b/drivers/media/video/saa7164/saa7164-api.c @@ -1367,7 +1367,6 @@ int saa7164_api_i2c_read(struct saa7164_i2c *bus, u8 addr, u32 reglen, u8 *reg, struct saa7164_dev *dev = bus-dev; u16 len = 0; int unitid; - u32 regval; u8 buf[256]; int ret; @@ -1376,19 +1375,6 @@ int saa7164_api_i2c_read(struct saa7164_i2c *bus, u8 addr, u32 reglen, u8 *reg, if (reglen 4) return -EIO; - if (reglen == 1) - regval = *(reg); - else - if (reglen == 2) - regval = ((*(reg) 8) || *(reg+1)); - else - if (reglen == 3) - regval = ((*(reg) 16) | (*(reg+1) 8) | *(reg+2)); - else - if (reglen == 4) - regval = ((*(reg) 24) | (*(reg+1) 16) | - (*(reg+2) 8) | *(reg+3)); - /* Prepare the send buffer */ /* Bytes 00-03 source register length * 04-07 source bytes to read -- 1.7.10.2 -- 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/8] nuvoton-cir: Code cleanup: remove unused variable and function
Tested by compilation only. Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com --- drivers/media/rc/nuvoton-cir.c | 37 - 1 file changed, 37 deletions(-) diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c index dc8a7dd..0e8052f 100644 --- a/drivers/media/rc/nuvoton-cir.c +++ b/drivers/media/rc/nuvoton-cir.c @@ -473,39 +473,6 @@ static void nvt_enable_wake(struct nvt_dev *nvt) nvt_cir_wake_reg_write(nvt, 0, CIR_WAKE_IREN); } -/* rx carrier detect only works in learning mode, must be called w/nvt_lock */ -static u32 nvt_rx_carrier_detect(struct nvt_dev *nvt) -{ - u32 count, carrier, duration = 0; - int i; - - count = nvt_cir_reg_read(nvt, CIR_FCCL) | - nvt_cir_reg_read(nvt, CIR_FCCH) 8; - - for (i = 0; i nvt-pkts; i++) { - if (nvt-buf[i] BUF_PULSE_BIT) - duration += nvt-buf[i] BUF_LEN_MASK; - } - - duration *= SAMPLE_PERIOD; - - if (!count || !duration) { - nvt_pr(KERN_NOTICE, Unable to determine carrier! (c:%u, d:%u), - count, duration); - return 0; - } - - carrier = MS_TO_NS(count) / duration; - - if ((carrier MAX_CARRIER) || (carrier MIN_CARRIER)) - nvt_dbg(WTF? Carrier frequency out of range!); - - nvt_dbg(Carrier frequency: %u (count %u, duration %u), - carrier, count, duration); - - return carrier; -} - /* * set carrier frequency * @@ -618,7 +585,6 @@ static void nvt_dump_rx_buf(struct nvt_dev *nvt) static void nvt_process_rx_ir_data(struct nvt_dev *nvt) { DEFINE_IR_RAW_EVENT(rawir); - u32 carrier; u8 sample; int i; @@ -627,9 +593,6 @@ static void nvt_process_rx_ir_data(struct nvt_dev *nvt) if (debug) nvt_dump_rx_buf(nvt); - if (nvt-carrier_detect_enabled) - carrier = nvt_rx_carrier_detect(nvt); - nvt_dbg_verbose(Processing buffer of len %d, nvt-pkts); init_ir_raw_event(rawir); -- 1.7.10.2 -- 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 6/8] stv0367: variable 'tps_rcvd' set but not used
Tested by compilation only. Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com --- drivers/media/dvb/frontends/stv0367.c |5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/media/dvb/frontends/stv0367.c b/drivers/media/dvb/frontends/stv0367.c index fdd20c7..2a8aaeb 100644 --- a/drivers/media/dvb/frontends/stv0367.c +++ b/drivers/media/dvb/frontends/stv0367.c @@ -1584,7 +1584,7 @@ static int stv0367ter_algo(struct dvb_frontend *fe) struct stv0367ter_state *ter_state = state-ter_state; int offset = 0, tempo = 0; u8 u_var; - u8 /*constell,*/ counter, tps_rcvd[2]; + u8 /*constell,*/ counter; s8 step; s32 timing_offset = 0; u32 trl_nomrate = 0, InternalFreq = 0, temp = 0; @@ -1709,9 +1709,6 @@ static int stv0367ter_algo(struct dvb_frontend *fe) return 0; ter_state-state = FE_TER_LOCKOK; - /* update results */ - tps_rcvd[0] = stv0367_readreg(state, R367TER_TPS_RCVD2); - tps_rcvd[1] = stv0367_readreg(state, R367TER_TPS_RCVD3); ter_state-mode = stv0367_readbits(state, F367TER_SYR_MODE); ter_state-guard = stv0367_readbits(state, F367TER_SYR_GUARD); -- 1.7.10.2 -- 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 7/8] stv090x: variable 'no_signal' set but not used
Tested by compilation only. Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com --- drivers/media/dvb/frontends/stv090x.c |7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/media/dvb/frontends/stv090x.c b/drivers/media/dvb/frontends/stv090x.c index d79e69f..d229dba 100644 --- a/drivers/media/dvb/frontends/stv090x.c +++ b/drivers/media/dvb/frontends/stv090x.c @@ -3172,7 +3172,7 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state) enum stv090x_signal_state signal_state = STV090x_NOCARRIER; u32 reg; s32 agc1_power, power_iq = 0, i; - int lock = 0, low_sr = 0, no_signal = 0; + int lock = 0, low_sr = 0; reg = STV090x_READ_DEMOD(state, TSCFGH); STV090x_SETFIELD_Px(reg, RST_HWARE_FIELD, 1); /* Stop path 1 stream merger */ @@ -3411,10 +3411,9 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state) /* Reset the packet Error counter2 */ if (STV090x_WRITE_DEMOD(state, ERRCTRL2, 0xc1) 0) goto err; - } else { + } else signal_state = STV090x_NODATA; - no_signal = stv090x_chk_signal(state); - } + } return signal_state; -- 1.7.10.2 -- 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 8/8] s5h1420: Unused variable clock_setting
The switch/case was setting clock_setting that is not being used. Both switch/case and the variable definition were removed. Currently clock is being calculated by the formula: (state-fclk/100 - 8) Tested by compilation only. Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com --- drivers/media/dvb/frontends/s5h1420.c | 20 1 file changed, 20 deletions(-) diff --git a/drivers/media/dvb/frontends/s5h1420.c b/drivers/media/dvb/frontends/s5h1420.c index 2322257..e2fec9e 100644 --- a/drivers/media/dvb/frontends/s5h1420.c +++ b/drivers/media/dvb/frontends/s5h1420.c @@ -634,7 +634,6 @@ static int s5h1420_set_frontend(struct dvb_frontend *fe) struct s5h1420_state* state = fe-demodulator_priv; int frequency_delta; struct dvb_frontend_tune_settings fesettings; - uint8_t clock_setting; dprintk(enter %s\n, __func__); @@ -679,25 +678,6 @@ static int s5h1420_set_frontend(struct dvb_frontend *fe) else state-fclk = 4400; - /* Clock */ - switch (state-fclk) { - default: - case 8800: - clock_setting = 80; - break; - case 8600: - clock_setting = 78; - break; - case 8000: - clock_setting = 72; - break; - case 5900: - clock_setting = 51; - break; - case 4400: - clock_setting = 36; - break; - } dprintk(pll01: %d, ToneFreq: %d\n, state-fclk/100 - 8, (state-fclk + (TONE_FREQ * 32) - 1) / (TONE_FREQ * 32)); s5h1420_writereg(state, PLL01, state-fclk/100 - 8); s5h1420_writereg(state, PLL02, 0x40); -- 1.7.10.2 -- 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 V7 0/5] [Media] Radio: Fixes and New features for FM
Hi Mauro, Please pull these patches to K3.6, these patches are reviewed and Acked-By Hans. Regards Manju On Mon, May 21, 2012 at 12:12 PM, manjunatha_ha...@ti.com wrote: From: Manjunatha Halli x0130...@ti.com Mauro and the list, This version 7 of patchset resolves the comments received from Han's on patchset v6. Also removed the frequency band handling from this patch set. This patchset creates new control class 'V4L2_CTRL_CLASS_FM_RX' for FM RX, introduces 2 new CID's for FM RX and and 1 new CID for FM TX. Also adds 1 field in struct v4l2_hw_freq_seek. This patch adds few new features to TI's FM driver features are listed below, 1) FM TX RDS Support (RT, PS, AF, PI, PTY) 2) FM RX Russian band support 3) FM RX AF set/get 4) FM RX De-emphasis mode set/get Along with new features this patch also fixes few issues in the driver like default rssi level for seek, unnecessory logs etc. Manjunatha Halli (5): WL128x: Add support for FM TX RDS New control class and features for FM RX Add new CID for FM TX RDS Alternate Frequency Media: Update docs for V4L2 FM new features WL12xx: Add support for FM new features Documentation/DocBook/media/v4l/compat.xml | 3 + Documentation/DocBook/media/v4l/controls.xml | 77 Documentation/DocBook/media/v4l/dev-rds.xml | 5 +- .../DocBook/media/v4l/vidioc-g-ext-ctrls.xml | 7 ++ drivers/media/radio/wl128x/fmdrv.h | 2 +- drivers/media/radio/wl128x/fmdrv_common.c | 30 +--- drivers/media/radio/wl128x/fmdrv_common.h | 25 +-- drivers/media/radio/wl128x/fmdrv_rx.c | 13 +++- drivers/media/radio/wl128x/fmdrv_tx.c | 41 +-- drivers/media/radio/wl128x/fmdrv_tx.h | 3 +- drivers/media/radio/wl128x/fmdrv_v4l2.c | 74 +++ drivers/media/video/v4l2-ctrls.c | 18 - include/linux/videodev2.h | 10 +++ 13 files changed, 255 insertions(+), 53 deletions(-) -- 1.7.4.1 -- 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 -- Regards Halli -- 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/8] nuvoton-cir: Code cleanup: remove unused variable and function
On Thu, Jun 14, 2012 at 02:58:13PM -0300, Peter Senna Tschudin wrote: Tested by compilation only. [...] I can't say whether this is correct since I never used the driver either, but the function you remove is reading registers so it may have important side-effects. Ben. -- Ben Hutchings We get into the habit of living before acquiring the habit of thinking. - Albert Camus -- 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
stv090x: possible bug with 8psk,fec=5/6
I own a Skystar USB HD which I use with vdr. Ever since I bought the card I have been having some strange issues with 11817V on Astra 23.5E. Femon reports that there is a lock and sound comes but the image is completely garbled. The same setup (Kernel: 3.3.8, VDR: 1.7.27) works fine with an HVR-4000. So I started to suspect that there might be something wrong with the driver. Trying to find out some more information I came across this forum: http://rickcaylor.websitetoolbox.com/post/stv0900_core.c-patch-5481028 I tried the patch which is supposed to (among other things) make the tuner lock on high bitrate transponders (60Mbps). But it did not help. So using the stock driver I gave dvbsnoop a whirl to see if there was something amiss. Astra 3B 11817.00 V DVB-S2 8PSK 27500 5/6 66.6 Mbps packets read: 122/(343292) d_time: 0.001 s = 183488.000 kbit/s (Avrg: 66142.860 kbit/s) [bad: 2] packets read: 42/(343334) d_time: 0.001 s = 63168.000 kbit/s (Avrg: 66150.953 kbit/s) [bad: 0] packets read: 38/(343372) d_time: 0.001 s = 57152.000 kbit/s (Avrg: 66158.274 kbit/s) [bad: 2] packets read: 34/(343406) d_time: 0.001 s = 51136.000 kbit/s (Avrg: 66164.825 kbit/s) [bad: 1] packets read: 35/(343441) d_time: 0.001 s = 52640.000 kbit/s (Avrg: 66171.569 kbit/s) [bad: 2] packets read: 31/(343472) d_time: 0.001 s = 46624.000 kbit/s (Avrg: 66177.541 kbit/s) [bad: 4] packets read: 16/(343488) d_time: 0.001 s = 24064.000 kbit/s (Avrg: 66180.624 kbit/s) [bad: 0] packets read: 29/(343517) d_time: 0.008 s = 5452.000 kbit/s (Avrg: 66118.450 kbit/s) [bad: 1] packets read: 116/(343633) d_time: 0.001 s = 174464.000 kbit/s (Avrg: 66140.777 kbit/s) [bad: 1] packets read: 38/(343671) d_time: 0.001 s = 57152.000 kbit/s (Avrg: 66148.091 kbit/s) [bad: 1] packets read: 34/(343705) d_time: 0.001 s = 51136.000 kbit/s (Avrg: 66154.635 kbit/s) [bad: 1] packets read: 30/(343735) d_time: 0.001 s = 45120.000 kbit/s (Avrg: 66160.410 kbit/s) [bad: 0] packets read: 37/(343772) d_time: 0.001 s = 55648.000 kbit/s (Avrg: 66167.531 kbit/s) [bad: 2] packets read: 38/(343810) d_time: 0.001 s = 57152.000 kbit/s (Avrg: 66174.845 kbit/s) [bad: 1] packets read: 30/(343840) d_time: 0.001 s = 45120.000 kbit/s (Avrg: 66180.619 kbit/s) [bad: 0] Then I experimented with a lot of other transponders and found another one with the same behavior. HotBird 13C 11411.00 H DVB-S2 8PSK 27500 5/6 68.2 Mbps packets read: 40/(259860) d_time: 0.001 s = 60160.000 kbit/s (Avrg: 65498.482 kbit/s) [bad: 0] packets read: 39/(259899) d_time: 0.001 s = 58656.000 kbit/s (Avrg: 65508.312 kbit/s) [bad: 0] packets read: 34/(259933) d_time: 0.001 s = 51136.000 kbit/s (Avrg: 65516.882 kbit/s) [bad: 1] packets read: 34/(259967) d_time: 0.001 s = 51136.000 kbit/s (Avrg: 65525.451 kbit/s) [bad: 0] packets read: 36/(260003) d_time: 0.001 s = 54144.000 kbit/s (Avrg: 65534.525 kbit/s) [bad: 2] packets read: 11/(260014) d_time: 0.001 s = 16544.000 kbit/s (Avrg: 65537.298 kbit/s) [bad: 1] packets read: 349/(260363) d_time: 0.008 s = 65612.000 kbit/s (Avrg: 65537.398 kbit/s) [bad: 7] packets read: 25/(260388) d_time: 0.008 s = 4700.000 kbit/s (Avrg: 65456.051 kbit/s) [bad: 0] packets read: 129/(260517) d_time: 0.001 s = 194016.000 kbit/s (Avrg: 65488.479 kbit/s) [bad: 2] packets read: 35/(260552) d_time: 0.001 s = 52640.000 kbit/s (Avrg: 65497.277 kbit/s) [bad: 0] packets read: 37/(260589) d_time: 0.001 s = 55648.000 kbit/s (Avrg: 65506.578 kbit/s) [bad: 2] packets read: 34/(260623) d_time: 0.001 s = 51136.000 kbit/s (Avrg: 65515.125 kbit/s) [bad: 2] packets read: 36/(260659) d_time: 0.001 s = 54144.000 kbit/s (Avrg: 65524.174 kbit/s) [bad: 3] packets read: 34/(260693) d_time: 0.001 s = 51136.000 kbit/s (Avrg: 65532.721 kbit/s) [bad: 0] packets read: 21/(260714) d_time: 0.001 s = 31584.000 kbit/s (Avrg: 65538.000 kbit/s) [bad: 0] Both of these are 8psk 5/6 and have an average bitrate of over 65Mbps. The high bitrate per se could not explain what is wrong because there are a number of ~65Mbps transponders on Hotbird which are OK. For example: HotBird 13B 11785.00 H DVB-S2 8PSK 29900 3/4 65.1 Mbps packets read: 33/(434934) d_time: 0.001 s = 49632.000 kbit/s (Avrg: 65101.586 kbit/s) [bad: 0] packets read: 38/(434972) d_time: 0.001 s = 57152.000 kbit/s (Avrg: 65107.274 kbit/s) [bad: 0] packets read: 34/(435006) d_time: 0.001 s = 51136.000 kbit/s (Avrg: 65112.363 kbit/s) [bad: 0] packets read: 36/(435042) d_time: 0.001 s = 54144.000 kbit/s (Avrg: 65117.752 kbit/s) [bad: 0] packets read: 17/(435059) d_time: 0.001 s = 25568.000 kbit/s (Avrg: 65120.296 kbit/s) [bad: 0] packets read: 32/(435091) d_time: 0.007 s = 6875.429 kbit/s (Avrg: 65079.748 kbit/s) [bad: 0] packets read: 122/(435213) d_time: 0.001 s
Re: [PATCH 1/2] [BUG] dvb_usb_v2: return the download ret in dvb_usb_download_firmware
On 06/14/2012 04:15 AM, Antti Palosaari wrote: On 06/14/2012 03:44 AM, Malcolm Priestley wrote: On Thu, 2012-06-14 at 02:29 +0300, Antti Palosaari wrote: Hi Malcolm, I was really surprised someone has had interest to test that stuff at that phase as I did not even advertised it yet :) It is likely happen next Monday or so as there is some issues I would like to check / solve. On 06/14/2012 01:24 AM, Malcolm Priestley wrote: Hi antti There some issues with dvb_usb_v2 with the lmedm04 driver. The first being this patch, no return value from dvb_usb_download_firmware causes system wide dead lock with COLD disconnect as system attempts to continue to warm state. Hmm, I did not understand what you mean. What I looked lmedm04 driver I think it uses single USB ID (no cold + warm IDs). So it downloads firmware and then reconnects itself from the USB bus? For that scenario you should return RECONNECTS_USB; from the driver .download_firmware(). If the device disconnects from the USB bus after the firmware download. In most cases the device is already gone. There is currently no way to insert RECONNECTS_USB into the return. Argh, I was blind! You are absolutely correct. It never returns value 1 (RECONNECTS_USB) from the .download_firmware(). That patch is fine, I will apply it, thanks! I think that must be also changed to return immediately without releasing the interface. Let the USB core release it when it detects disconnect - otherwise it could crash as it tries to access potentially resources that are already freed. Just for the timing issue if it happens or not. } else if (ret == RECONNECTS_USB) { ret = 0; goto exit_usb_driver_release_interface; add return 0 here without releasing interface and test. I tested it using one non-public Cypress FX2 device - it was changing USB ID after the FX download, but from the driver perspective it does not matter. It is always new device if it reconnects USB. Have double checked that the thread is not continuing to write on the old ID? Nope, but likely delayed probe() is finished until it reconnects so I cannot see problem. You device disconnects faster and thus USB core traps .disconnect() earlier... Could you test returning 0 and if it works sent new patch. The zero condition will lead to dvb_usb_init. PS. as I looked that driver I saw many different firmwares. That is now supported and you should use .get_firmware_name() (maybe you already did it). Yes, I have supported this in the driver. Malcolm, could you just test if returning from the routines after fw download is enough to fix all your problems? I mean those two fixes: dvb_usb_download_firmware() * return RECONNECTS_USB correctly dvb_usbv2_init_work() * return without releasing USB interface if RECONNECTS_USB regardss Antti -- http://palosaari.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
[PATCH RFC 04/10] [media] firewire: move it one level up
Move firewire to one level up, as the dvb subdirectory will be removed. Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com --- drivers/media/Kconfig |6 +- drivers/media/Makefile |1 + drivers/media/dvb/Kconfig |4 drivers/media/dvb/Makefile |2 -- drivers/media/{dvb = }/firewire/Kconfig |0 drivers/media/{dvb = }/firewire/Makefile |0 drivers/media/{dvb = }/firewire/firedtv-avc.c |0 drivers/media/{dvb = }/firewire/firedtv-ci.c |0 drivers/media/{dvb = }/firewire/firedtv-dvb.c |0 drivers/media/{dvb = }/firewire/firedtv-fe.c |0 drivers/media/{dvb = }/firewire/firedtv-fw.c |0 drivers/media/{dvb = }/firewire/firedtv-rc.c |0 drivers/media/{dvb = }/firewire/firedtv.h |0 13 files changed, 6 insertions(+), 7 deletions(-) rename drivers/media/{dvb = }/firewire/Kconfig (100%) rename drivers/media/{dvb = }/firewire/Makefile (100%) rename drivers/media/{dvb = }/firewire/firedtv-avc.c (100%) rename drivers/media/{dvb = }/firewire/firedtv-ci.c (100%) rename drivers/media/{dvb = }/firewire/firedtv-dvb.c (100%) rename drivers/media/{dvb = }/firewire/firedtv-fe.c (100%) rename drivers/media/{dvb = }/firewire/firedtv-fw.c (100%) rename drivers/media/{dvb = }/firewire/firedtv-rc.c (100%) rename drivers/media/{dvb = }/firewire/firedtv.h (100%) diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig index 318c2bf..788be30 100644 --- a/drivers/media/Kconfig +++ b/drivers/media/Kconfig @@ -166,8 +166,12 @@ source drivers/media/radio/Kconfig source drivers/media/dvb-core/Kconfig source drivers/media/dvb/Kconfig +comment Supported FireWire (IEEE 1394) Adapters + depends on DVB_CORE FIREWIRE +source drivers/media/firewire/Kconfig + comment Supported DVB Frontends -depends on DVB_CORE + depends on DVB_CORE source drivers/media/dvb-frontends/Kconfig endif # MEDIA_SUPPORT diff --git a/drivers/media/Makefile b/drivers/media/Makefile index f95b9e3..37e448c 100644 --- a/drivers/media/Makefile +++ b/drivers/media/Makefile @@ -12,3 +12,4 @@ obj-y += v4l2-core/ common/ rc/ video/ obj-$(CONFIG_VIDEO_DEV) += radio/ obj-$(CONFIG_DVB_CORE) += dvb-core/ dvb/ dvb-frontends/ +obj-$(CONFIG_DVB_FIREDTV) += firewire/ diff --git a/drivers/media/dvb/Kconfig b/drivers/media/dvb/Kconfig index 874ff53..71bb941 100644 --- a/drivers/media/dvb/Kconfig +++ b/drivers/media/dvb/Kconfig @@ -38,10 +38,6 @@ comment Supported SDMC DM1105 Adapters depends on DVB_CORE PCI I2C source drivers/media/dvb/dm1105/Kconfig -comment Supported FireWire (IEEE 1394) Adapters - depends on DVB_CORE FIREWIRE -source drivers/media/dvb/firewire/Kconfig - comment Supported Earthsoft PT1 Adapters depends on DVB_CORE PCI I2C source drivers/media/dvb/pt1/Kconfig diff --git a/drivers/media/dvb/Makefile b/drivers/media/dvb/Makefile index 352adaa..dd2864b 100644 --- a/drivers/media/dvb/Makefile +++ b/drivers/media/dvb/Makefile @@ -15,5 +15,3 @@ obj-y:= ttpci/ \ mantis/ \ ngene/ \ ddbridge/ - -obj-$(CONFIG_DVB_FIREDTV) += firewire/ diff --git a/drivers/media/dvb/firewire/Kconfig b/drivers/media/firewire/Kconfig similarity index 100% rename from drivers/media/dvb/firewire/Kconfig rename to drivers/media/firewire/Kconfig diff --git a/drivers/media/dvb/firewire/Makefile b/drivers/media/firewire/Makefile similarity index 100% rename from drivers/media/dvb/firewire/Makefile rename to drivers/media/firewire/Makefile diff --git a/drivers/media/dvb/firewire/firedtv-avc.c b/drivers/media/firewire/firedtv-avc.c similarity index 100% rename from drivers/media/dvb/firewire/firedtv-avc.c rename to drivers/media/firewire/firedtv-avc.c diff --git a/drivers/media/dvb/firewire/firedtv-ci.c b/drivers/media/firewire/firedtv-ci.c similarity index 100% rename from drivers/media/dvb/firewire/firedtv-ci.c rename to drivers/media/firewire/firedtv-ci.c diff --git a/drivers/media/dvb/firewire/firedtv-dvb.c b/drivers/media/firewire/firedtv-dvb.c similarity index 100% rename from drivers/media/dvb/firewire/firedtv-dvb.c rename to drivers/media/firewire/firedtv-dvb.c diff --git a/drivers/media/dvb/firewire/firedtv-fe.c b/drivers/media/firewire/firedtv-fe.c similarity index 100% rename from drivers/media/dvb/firewire/firedtv-fe.c rename to drivers/media/firewire/firedtv-fe.c diff --git a/drivers/media/dvb/firewire/firedtv-fw.c b/drivers/media/firewire/firedtv-fw.c similarity index 100% rename from drivers/media/dvb/firewire/firedtv-fw.c rename to drivers/media/firewire/firedtv-fw.c diff --git a/drivers/media/dvb/firewire/firedtv-rc.c b/drivers/media/firewire/firedtv-rc.c similarity index 100% rename from drivers/media/dvb/firewire/firedtv-rc.c rename to drivers/media/firewire/firedtv-rc.c diff --git a/drivers/media/dvb/firewire/firedtv.h
[PATCH RFC 02/10] [media] dvb: move the dvb core one level up
just like the V4L2 core, move the DVB core to drivers/media, as the intention is to get rid of both video and dvb directories. Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com --- drivers/media/Kconfig |1 + drivers/media/Makefile|2 +- drivers/media/common/tuners/Makefile |2 +- drivers/media/dvb-core/Kconfig| 29 + drivers/media/{dvb = }/dvb-core/Makefile |0 drivers/media/{dvb = }/dvb-core/demux.h |0 drivers/media/{dvb = }/dvb-core/dmxdev.c |0 drivers/media/{dvb = }/dvb-core/dmxdev.h |0 drivers/media/{dvb = }/dvb-core/dvb_ca_en50221.c |0 drivers/media/{dvb = }/dvb-core/dvb_ca_en50221.h |0 drivers/media/{dvb = }/dvb-core/dvb_demux.c |0 drivers/media/{dvb = }/dvb-core/dvb_demux.h |0 drivers/media/{dvb = }/dvb-core/dvb_filter.c |0 drivers/media/{dvb = }/dvb-core/dvb_filter.h |0 drivers/media/{dvb = }/dvb-core/dvb_frontend.c |0 drivers/media/{dvb = }/dvb-core/dvb_frontend.h |0 drivers/media/{dvb = }/dvb-core/dvb_math.c |0 drivers/media/{dvb = }/dvb-core/dvb_math.h |0 drivers/media/{dvb = }/dvb-core/dvb_net.c|0 drivers/media/{dvb = }/dvb-core/dvb_net.h|0 drivers/media/{dvb = }/dvb-core/dvb_ringbuffer.c |0 drivers/media/{dvb = }/dvb-core/dvb_ringbuffer.h |0 drivers/media/{dvb = }/dvb-core/dvbdev.c |0 drivers/media/{dvb = }/dvb-core/dvbdev.h |0 drivers/media/dvb/Kconfig | 26 -- drivers/media/dvb/Makefile|3 +-- drivers/media/dvb/b2c2/Makefile |2 +- drivers/media/dvb/bt8xx/Makefile |2 +- drivers/media/dvb/ddbridge/Makefile |2 +- drivers/media/dvb/dm1105/Makefile |2 +- drivers/media/dvb/dvb-usb/Makefile|2 +- drivers/media/dvb/firewire/Makefile |2 +- drivers/media/dvb/frontends/Makefile |2 +- drivers/media/dvb/mantis/Makefile |2 +- drivers/media/dvb/ngene/Makefile |2 +- drivers/media/dvb/pluto2/Makefile |2 +- drivers/media/dvb/pt1/Makefile|2 +- drivers/media/dvb/siano/Makefile |2 +- drivers/media/dvb/ttpci/Makefile |2 +- drivers/media/dvb/ttusb-budget/Makefile |2 +- drivers/media/dvb/ttusb-dec/Makefile |2 +- drivers/media/v4l2-core/Makefile |2 +- drivers/media/video/Makefile |2 +- drivers/media/video/au0828/Makefile |2 +- drivers/media/video/bt8xx/Makefile|2 +- drivers/media/video/cx18/Makefile |2 +- drivers/media/video/cx231xx/Makefile |2 +- drivers/media/video/cx23885/Makefile |2 +- drivers/media/video/cx25821/Makefile |2 +- drivers/media/video/cx88/Makefile |2 +- drivers/media/video/em28xx/Makefile |2 +- drivers/media/video/ivtv/Makefile |2 +- drivers/media/video/pvrusb2/Makefile |2 +- drivers/media/video/saa7134/Makefile |2 +- drivers/media/video/saa7164/Makefile |2 +- drivers/media/video/tlg2300/Makefile |2 +- drivers/media/video/tm6000/Makefile |2 +- drivers/staging/media/as102/Makefile |2 +- drivers/staging/media/cxd2099/Makefile|2 +- drivers/staging/media/go7007/Makefile |2 +- 60 files changed, 67 insertions(+), 64 deletions(-) create mode 100644 drivers/media/dvb-core/Kconfig rename drivers/media/{dvb = }/dvb-core/Makefile (100%) rename drivers/media/{dvb = }/dvb-core/demux.h (100%) rename drivers/media/{dvb = }/dvb-core/dmxdev.c (100%) rename drivers/media/{dvb = }/dvb-core/dmxdev.h (100%) rename drivers/media/{dvb = }/dvb-core/dvb_ca_en50221.c (100%) rename drivers/media/{dvb = }/dvb-core/dvb_ca_en50221.h (100%) rename drivers/media/{dvb = }/dvb-core/dvb_demux.c (100%) rename drivers/media/{dvb = }/dvb-core/dvb_demux.h (100%) rename drivers/media/{dvb = }/dvb-core/dvb_filter.c (100%) rename drivers/media/{dvb = }/dvb-core/dvb_filter.h (100%) rename drivers/media/{dvb = }/dvb-core/dvb_frontend.c (100%) rename drivers/media/{dvb = }/dvb-core/dvb_frontend.h (100%) rename drivers/media/{dvb = }/dvb-core/dvb_math.c (100%) rename drivers/media/{dvb = }/dvb-core/dvb_math.h (100%) rename drivers/media/{dvb = }/dvb-core/dvb_net.c (100%) rename drivers/media/{dvb = }/dvb-core/dvb_net.h (100%) rename drivers/media/{dvb = }/dvb-core/dvb_ringbuffer.c (100%) rename drivers/media/{dvb = }/dvb-core/dvb_ringbuffer.h (100%) rename
[PATCH RFC 01/10] [media] v4l: move v4l2 core into a separate directory
Currently, the v4l2 core is mixed together with other non-core drivers. Move them into a separate directory. Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com --- drivers/media/Kconfig |1 + drivers/media/Makefile |2 +- drivers/media/v4l2-core/Kconfig| 60 drivers/media/v4l2-core/Makefile | 35 drivers/media/{video = v4l2-core}/tuner-core.c|0 drivers/media/{video = v4l2-core}/v4l2-common.c |0 .../{video = v4l2-core}/v4l2-compat-ioctl32.c |0 drivers/media/{video = v4l2-core}/v4l2-ctrls.c|0 drivers/media/{video = v4l2-core}/v4l2-dev.c |0 drivers/media/{video = v4l2-core}/v4l2-device.c |0 drivers/media/{video = v4l2-core}/v4l2-event.c|0 drivers/media/{video = v4l2-core}/v4l2-fh.c |0 .../media/{video = v4l2-core}/v4l2-int-device.c |0 drivers/media/{video = v4l2-core}/v4l2-ioctl.c|0 drivers/media/{video = v4l2-core}/v4l2-mem2mem.c |0 drivers/media/{video = v4l2-core}/v4l2-subdev.c |0 drivers/media/{video = v4l2-core}/videobuf-core.c |0 .../{video = v4l2-core}/videobuf-dma-contig.c |0 .../media/{video = v4l2-core}/videobuf-dma-sg.c |0 drivers/media/{video = v4l2-core}/videobuf-dvb.c |0 .../media/{video = v4l2-core}/videobuf-vmalloc.c |0 .../media/{video = v4l2-core}/videobuf2-core.c|0 .../{video = v4l2-core}/videobuf2-dma-contig.c|0 .../media/{video = v4l2-core}/videobuf2-dma-sg.c |0 .../media/{video = v4l2-core}/videobuf2-memops.c |0 .../media/{video = v4l2-core}/videobuf2-vmalloc.c |0 drivers/media/video/Kconfig| 56 -- drivers/media/video/Makefile | 27 - 28 files changed, 97 insertions(+), 84 deletions(-) create mode 100644 drivers/media/v4l2-core/Kconfig create mode 100644 drivers/media/v4l2-core/Makefile rename drivers/media/{video = v4l2-core}/tuner-core.c (100%) rename drivers/media/{video = v4l2-core}/v4l2-common.c (100%) rename drivers/media/{video = v4l2-core}/v4l2-compat-ioctl32.c (100%) rename drivers/media/{video = v4l2-core}/v4l2-ctrls.c (100%) rename drivers/media/{video = v4l2-core}/v4l2-dev.c (100%) rename drivers/media/{video = v4l2-core}/v4l2-device.c (100%) rename drivers/media/{video = v4l2-core}/v4l2-event.c (100%) rename drivers/media/{video = v4l2-core}/v4l2-fh.c (100%) rename drivers/media/{video = v4l2-core}/v4l2-int-device.c (100%) rename drivers/media/{video = v4l2-core}/v4l2-ioctl.c (100%) rename drivers/media/{video = v4l2-core}/v4l2-mem2mem.c (100%) rename drivers/media/{video = v4l2-core}/v4l2-subdev.c (100%) rename drivers/media/{video = v4l2-core}/videobuf-core.c (100%) rename drivers/media/{video = v4l2-core}/videobuf-dma-contig.c (100%) rename drivers/media/{video = v4l2-core}/videobuf-dma-sg.c (100%) rename drivers/media/{video = v4l2-core}/videobuf-dvb.c (100%) rename drivers/media/{video = v4l2-core}/videobuf-vmalloc.c (100%) rename drivers/media/{video = v4l2-core}/videobuf2-core.c (100%) rename drivers/media/{video = v4l2-core}/videobuf2-dma-contig.c (100%) rename drivers/media/{video = v4l2-core}/videobuf2-dma-sg.c (100%) rename drivers/media/{video = v4l2-core}/videobuf2-memops.c (100%) rename drivers/media/{video = v4l2-core}/videobuf2-vmalloc.c (100%) diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig index 2f5b395..8bb3b66 100644 --- a/drivers/media/Kconfig +++ b/drivers/media/Kconfig @@ -154,6 +154,7 @@ source drivers/media/common/tuners/Kconfig # Video/Radio/Hybrid adapters # +source drivers/media/v4l2-core/Kconfig source drivers/media/video/Kconfig source drivers/media/radio/Kconfig diff --git a/drivers/media/Makefile b/drivers/media/Makefile index 64755c9..2f9abaa 100644 --- a/drivers/media/Makefile +++ b/drivers/media/Makefile @@ -8,7 +8,7 @@ ifeq ($(CONFIG_MEDIA_CONTROLLER),y) obj-$(CONFIG_MEDIA_SUPPORT) += media.o endif -obj-y += common/ rc/ video/ +obj-y += v4l2-core/ common/ rc/ video/ obj-$(CONFIG_VIDEO_DEV) += radio/ obj-$(CONFIG_DVB_CORE) += dvb/ diff --git a/drivers/media/v4l2-core/Kconfig b/drivers/media/v4l2-core/Kconfig new file mode 100644 index 000..6f53337 --- /dev/null +++ b/drivers/media/v4l2-core/Kconfig @@ -0,0 +1,60 @@ +# +# Generic video config states +# + +config VIDEO_V4L2 + tristate + depends on VIDEO_DEV VIDEO_V4L2_COMMON + default y + +config VIDEOBUF_GEN + tristate + +config VIDEOBUF_DMA_SG + depends on HAS_DMA + select VIDEOBUF_GEN + tristate + +config VIDEOBUF_VMALLOC + select VIDEOBUF_GEN + tristate + +config VIDEOBUF_DMA_CONTIG + depends on HAS_DMA + select VIDEOBUF_GEN + tristate + +config VIDEOBUF_DVB + tristate + select VIDEOBUF_GEN + +config VIDEO_TUNER + tristate + depends on MEDIA_TUNER +
[PATCH RFC 08/10] [media] common: move media/common/tuners to media/tuners
Move the tuners one level up, as the common directory will be used by drivers that are shared between more than one driver. Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com --- MAINTAINERS|4 ++-- drivers/media/Kconfig |2 +- drivers/media/Makefile |2 +- drivers/media/common/Makefile |2 +- drivers/media/common/b2c2/Makefile |2 +- drivers/media/dvb-frontends/Makefile |2 +- drivers/media/pci/bt8xx/Makefile |2 +- drivers/media/pci/ddbridge/Makefile|2 +- drivers/media/pci/ngene/Makefile |2 +- drivers/media/pci/ttpci/Makefile |2 +- drivers/media/{common = }/tuners/Kconfig |0 drivers/media/{common = }/tuners/Makefile |0 drivers/media/{common = }/tuners/fc0011.c |0 drivers/media/{common = }/tuners/fc0011.h |0 drivers/media/{common = }/tuners/fc0012-priv.h|0 drivers/media/{common = }/tuners/fc0012.c |0 drivers/media/{common = }/tuners/fc0012.h |0 drivers/media/{common = }/tuners/fc0013-priv.h|0 drivers/media/{common = }/tuners/fc0013.c |0 drivers/media/{common = }/tuners/fc0013.h |0 drivers/media/{common = }/tuners/fc001x-common.h |0 drivers/media/{common = }/tuners/max2165.c|0 drivers/media/{common = }/tuners/max2165.h|0 drivers/media/{common = }/tuners/max2165_priv.h |0 drivers/media/{common = }/tuners/mc44s803.c |0 drivers/media/{common = }/tuners/mc44s803.h |0 drivers/media/{common = }/tuners/mc44s803_priv.h |0 drivers/media/{common = }/tuners/mt2060.c |0 drivers/media/{common = }/tuners/mt2060.h |0 drivers/media/{common = }/tuners/mt2060_priv.h|0 drivers/media/{common = }/tuners/mt2063.c |0 drivers/media/{common = }/tuners/mt2063.h |0 drivers/media/{common = }/tuners/mt20xx.c |0 drivers/media/{common = }/tuners/mt20xx.h |0 drivers/media/{common = }/tuners/mt2131.c |0 drivers/media/{common = }/tuners/mt2131.h |0 drivers/media/{common = }/tuners/mt2131_priv.h|0 drivers/media/{common = }/tuners/mt2266.c |0 drivers/media/{common = }/tuners/mt2266.h |0 drivers/media/{common = }/tuners/mxl5005s.c |0 drivers/media/{common = }/tuners/mxl5005s.h |0 drivers/media/{common = }/tuners/mxl5007t.c |0 drivers/media/{common = }/tuners/mxl5007t.h |0 drivers/media/{common = }/tuners/qt1010.c |0 drivers/media/{common = }/tuners/qt1010.h |0 drivers/media/{common = }/tuners/qt1010_priv.h|0 drivers/media/{common = }/tuners/tda18212.c |0 drivers/media/{common = }/tuners/tda18212.h |0 drivers/media/{common = }/tuners/tda18218.c |0 drivers/media/{common = }/tuners/tda18218.h |0 drivers/media/{common = }/tuners/tda18218_priv.h |0 drivers/media/{common = }/tuners/tda18271-common.c|0 drivers/media/{common = }/tuners/tda18271-fe.c|0 drivers/media/{common = }/tuners/tda18271-maps.c |0 drivers/media/{common = }/tuners/tda18271-priv.h |0 drivers/media/{common = }/tuners/tda18271.h |0 drivers/media/{common = }/tuners/tda827x.c|0 drivers/media/{common = }/tuners/tda827x.h|0 drivers/media/{common = }/tuners/tda8290.c|0 drivers/media/{common = }/tuners/tda8290.h|0 drivers/media/{common = }/tuners/tda9887.c|0 drivers/media/{common = }/tuners/tda9887.h|0 drivers/media/{common = }/tuners/tea5761.c|0 drivers/media/{common = }/tuners/tea5761.h|0 drivers/media/{common = }/tuners/tea5767.c|0 drivers/media/{common = }/tuners/tea5767.h|0 drivers/media/{common = }/tuners/tua9001.c|0 drivers/media/{common = }/tuners/tua9001.h|0 drivers/media/{common = }/tuners/tua9001_priv.h |0 drivers/media/{common = }/tuners/tuner-i2c.h |0 drivers/media/{common = }/tuners/tuner-simple.c |0 drivers/media/{common = }/tuners/tuner-simple.h |0 drivers/media/{common = }/tuners/tuner-types.c|0 drivers/media/{common = }/tuners/tuner-xc2028-types.h |0 drivers/media/{common = }/tuners/tuner-xc2028.c |0 drivers/media/{common = }/tuners/tuner-xc2028.h |0 drivers/media/{common = }/tuners/xc4000.c |
[PATCH RFC 09/10] [media] saa7146: Move it to its own directory
In order to better organize the directory tree, move the saa7146 common driver to its own directory. Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com --- drivers/media/common/Kconfig | 11 +-- drivers/media/common/Makefile |7 +-- drivers/media/common/saa7146/Kconfig |9 + drivers/media/common/saa7146/Makefile |5 + drivers/media/common/{ = saa7146}/saa7146_core.c |0 drivers/media/common/{ = saa7146}/saa7146_fops.c |0 drivers/media/common/{ = saa7146}/saa7146_hlp.c |0 drivers/media/common/{ = saa7146}/saa7146_i2c.c |0 drivers/media/common/{ = saa7146}/saa7146_vbi.c |0 drivers/media/common/{ = saa7146}/saa7146_video.c |0 10 files changed, 16 insertions(+), 16 deletions(-) create mode 100644 drivers/media/common/saa7146/Kconfig create mode 100644 drivers/media/common/saa7146/Makefile rename drivers/media/common/{ = saa7146}/saa7146_core.c (100%) rename drivers/media/common/{ = saa7146}/saa7146_fops.c (100%) rename drivers/media/common/{ = saa7146}/saa7146_hlp.c (100%) rename drivers/media/common/{ = saa7146}/saa7146_i2c.c (100%) rename drivers/media/common/{ = saa7146}/saa7146_vbi.c (100%) rename drivers/media/common/{ = saa7146}/saa7146_video.c (100%) diff --git a/drivers/media/common/Kconfig b/drivers/media/common/Kconfig index 4672f7d..157f191 100644 --- a/drivers/media/common/Kconfig +++ b/drivers/media/common/Kconfig @@ -1,11 +1,2 @@ -config VIDEO_SAA7146 - tristate - depends on I2C PCI - -config VIDEO_SAA7146_VV - tristate - depends on VIDEO_V4L2 - select VIDEOBUF_DMA_SG - select VIDEO_SAA7146 - source drivers/media/common/b2c2/Kconfig +source drivers/media/common/saa7146/Kconfig diff --git a/drivers/media/common/Makefile b/drivers/media/common/Makefile index a471242..f3afd83 100644 --- a/drivers/media/common/Makefile +++ b/drivers/media/common/Makefile @@ -1,6 +1 @@ -saa7146-objs:= saa7146_i2c.o saa7146_core.o -saa7146_vv-objs := saa7146_fops.o saa7146_video.o saa7146_hlp.o saa7146_vbi.o - -obj-y += b2c2/ -obj-$(CONFIG_VIDEO_SAA7146) += saa7146.o -obj-$(CONFIG_VIDEO_SAA7146_VV) += saa7146_vv.o +obj-y += b2c2/ saa7146/ diff --git a/drivers/media/common/saa7146/Kconfig b/drivers/media/common/saa7146/Kconfig new file mode 100644 index 000..769c6f8 --- /dev/null +++ b/drivers/media/common/saa7146/Kconfig @@ -0,0 +1,9 @@ +config VIDEO_SAA7146 + tristate + depends on I2C PCI + +config VIDEO_SAA7146_VV + tristate + depends on VIDEO_V4L2 + select VIDEOBUF_DMA_SG + select VIDEO_SAA7146 diff --git a/drivers/media/common/saa7146/Makefile b/drivers/media/common/saa7146/Makefile new file mode 100644 index 000..3219b00 --- /dev/null +++ b/drivers/media/common/saa7146/Makefile @@ -0,0 +1,5 @@ +saa7146-objs:= saa7146_i2c.o saa7146_core.o +saa7146_vv-objs := saa7146_fops.o saa7146_video.o saa7146_hlp.o saa7146_vbi.o + +obj-$(CONFIG_VIDEO_SAA7146) += saa7146.o +obj-$(CONFIG_VIDEO_SAA7146_VV) += saa7146_vv.o diff --git a/drivers/media/common/saa7146_core.c b/drivers/media/common/saa7146/saa7146_core.c similarity index 100% rename from drivers/media/common/saa7146_core.c rename to drivers/media/common/saa7146/saa7146_core.c diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146/saa7146_fops.c similarity index 100% rename from drivers/media/common/saa7146_fops.c rename to drivers/media/common/saa7146/saa7146_fops.c diff --git a/drivers/media/common/saa7146_hlp.c b/drivers/media/common/saa7146/saa7146_hlp.c similarity index 100% rename from drivers/media/common/saa7146_hlp.c rename to drivers/media/common/saa7146/saa7146_hlp.c diff --git a/drivers/media/common/saa7146_i2c.c b/drivers/media/common/saa7146/saa7146_i2c.c similarity index 100% rename from drivers/media/common/saa7146_i2c.c rename to drivers/media/common/saa7146/saa7146_i2c.c diff --git a/drivers/media/common/saa7146_vbi.c b/drivers/media/common/saa7146/saa7146_vbi.c similarity index 100% rename from drivers/media/common/saa7146_vbi.c rename to drivers/media/common/saa7146/saa7146_vbi.c diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146/saa7146_video.c similarity index 100% rename from drivers/media/common/saa7146_video.c rename to drivers/media/common/saa7146/saa7146_video.c -- 1.7.10.2 -- 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 RFC 05/10] [media] dvb-usb: move it to drivers/media/usb/dvb-usb
As media/dvb will be removed, move it to a proper place. Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com --- Documentation/dvb/README.dvb-usb |2 +- drivers/media/Kconfig |1 + drivers/media/Makefile|2 +- drivers/media/dvb/Kconfig |7 --- drivers/media/dvb/Makefile|4 drivers/media/usb/Kconfig | 17 + drivers/media/usb/Makefile|6 ++ drivers/media/{dvb = usb}/dvb-usb/Kconfig|0 drivers/media/{dvb = usb}/dvb-usb/Makefile |0 drivers/media/{dvb = usb}/dvb-usb/a800.c |0 drivers/media/{dvb = usb}/dvb-usb/af9005-fe.c|0 drivers/media/{dvb = usb}/dvb-usb/af9005-remote.c|0 drivers/media/{dvb = usb}/dvb-usb/af9005-script.h|0 drivers/media/{dvb = usb}/dvb-usb/af9005.c |0 drivers/media/{dvb = usb}/dvb-usb/af9005.h |0 drivers/media/{dvb = usb}/dvb-usb/af9015.c |0 drivers/media/{dvb = usb}/dvb-usb/af9015.h |0 drivers/media/{dvb = usb}/dvb-usb/af9035.c |0 drivers/media/{dvb = usb}/dvb-usb/af9035.h |0 drivers/media/{dvb = usb}/dvb-usb/anysee.c |0 drivers/media/{dvb = usb}/dvb-usb/anysee.h |0 drivers/media/{dvb = usb}/dvb-usb/au6610.c |0 drivers/media/{dvb = usb}/dvb-usb/au6610.h |0 drivers/media/{dvb = usb}/dvb-usb/az6007.c |0 drivers/media/{dvb = usb}/dvb-usb/az6027.c |0 drivers/media/{dvb = usb}/dvb-usb/az6027.h |0 drivers/media/{dvb = usb}/dvb-usb/ce6230.c |0 drivers/media/{dvb = usb}/dvb-usb/ce6230.h |0 drivers/media/{dvb = usb}/dvb-usb/cinergyT2-core.c |0 drivers/media/{dvb = usb}/dvb-usb/cinergyT2-fe.c |0 drivers/media/{dvb = usb}/dvb-usb/cinergyT2.h|0 drivers/media/{dvb = usb}/dvb-usb/cxusb.c|0 drivers/media/{dvb = usb}/dvb-usb/cxusb.h|0 drivers/media/{dvb = usb}/dvb-usb/dib0700.h |0 drivers/media/{dvb = usb}/dvb-usb/dib0700_core.c |0 drivers/media/{dvb = usb}/dvb-usb/dib0700_devices.c |0 drivers/media/{dvb = usb}/dvb-usb/dib07x0.h |0 drivers/media/{dvb = usb}/dvb-usb/dibusb-common.c|0 drivers/media/{dvb = usb}/dvb-usb/dibusb-mb.c|0 drivers/media/{dvb = usb}/dvb-usb/dibusb-mc.c|0 drivers/media/{dvb = usb}/dvb-usb/dibusb.h |0 drivers/media/{dvb = usb}/dvb-usb/digitv.c |0 drivers/media/{dvb = usb}/dvb-usb/digitv.h |0 drivers/media/{dvb = usb}/dvb-usb/dtt200u-fe.c |0 drivers/media/{dvb = usb}/dvb-usb/dtt200u.c |0 drivers/media/{dvb = usb}/dvb-usb/dtt200u.h |0 drivers/media/{dvb = usb}/dvb-usb/dtv5100.c |0 drivers/media/{dvb = usb}/dvb-usb/dtv5100.h |0 drivers/media/{dvb = usb}/dvb-usb/dvb-usb-common.h |0 drivers/media/{dvb = usb}/dvb-usb/dvb-usb-dvb.c |0 drivers/media/{dvb = usb}/dvb-usb/dvb-usb-firmware.c |0 drivers/media/{dvb = usb}/dvb-usb/dvb-usb-i2c.c |0 drivers/media/{dvb = usb}/dvb-usb/dvb-usb-ids.h |0 drivers/media/{dvb = usb}/dvb-usb/dvb-usb-init.c |0 drivers/media/{dvb = usb}/dvb-usb/dvb-usb-remote.c |0 drivers/media/{dvb = usb}/dvb-usb/dvb-usb-urb.c |0 drivers/media/{dvb = usb}/dvb-usb/dvb-usb.h |0 drivers/media/{dvb = usb}/dvb-usb/dw2102.c |0 drivers/media/{dvb = usb}/dvb-usb/dw2102.h |0 drivers/media/{dvb = usb}/dvb-usb/ec168.c|0 drivers/media/{dvb = usb}/dvb-usb/ec168.h|0 drivers/media/{dvb = usb}/dvb-usb/friio-fe.c |0 drivers/media/{dvb = usb}/dvb-usb/friio.c|0 drivers/media/{dvb = usb}/dvb-usb/friio.h|0 drivers/media/{dvb = usb}/dvb-usb/gl861.c|0 drivers/media/{dvb = usb}/dvb-usb/gl861.h|0 drivers/media/{dvb = usb}/dvb-usb/gp8psk-fe.c|0 drivers/media/{dvb = usb}/dvb-usb/gp8psk.c |0 drivers/media/{dvb = usb}/dvb-usb/gp8psk.h |0 drivers/media/{dvb = usb}/dvb-usb/it913x.c |0 drivers/media/{dvb = usb}/dvb-usb/lmedm04.c |0 drivers/media/{dvb = usb}/dvb-usb/lmedm04.h |0 drivers/media/{dvb = usb}/dvb-usb/m920x.c|0 drivers/media/{dvb = usb}/dvb-usb/m920x.h|0 drivers/media/{dvb = usb}/dvb-usb/mxl111sf-demod.c |0 drivers/media/{dvb = usb}/dvb-usb/mxl111sf-demod.h |0 drivers/media/{dvb = usb}/dvb-usb/mxl111sf-gpio.c|0 drivers/media/{dvb = usb}/dvb-usb/mxl111sf-gpio.h|0 drivers/media/{dvb = usb}/dvb-usb/mxl111sf-i2c.c |0
[PATCH RFC 06/10] [media] Rename media/dvb as media/pci
The remaining dvb drivers are pci, so rename them to match the bus. Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com --- Documentation/DocBook/media/dvb/kdapi.xml|2 +- drivers/media/Kconfig|2 +- drivers/media/Makefile |2 +- drivers/media/{dvb = pci}/Kconfig | 18 +- drivers/media/{dvb = pci}/Makefile |0 drivers/media/{dvb = pci}/b2c2/Kconfig |0 drivers/media/{dvb = pci}/b2c2/Makefile |0 drivers/media/{dvb = pci}/b2c2/flexcop-common.h |0 drivers/media/{dvb = pci}/b2c2/flexcop-dma.c|0 drivers/media/{dvb = pci}/b2c2/flexcop-eeprom.c |0 drivers/media/{dvb = pci}/b2c2/flexcop-fe-tuner.c |0 drivers/media/{dvb = pci}/b2c2/flexcop-hw-filter.c |0 drivers/media/{dvb = pci}/b2c2/flexcop-i2c.c|0 drivers/media/{dvb = pci}/b2c2/flexcop-misc.c |0 drivers/media/{dvb = pci}/b2c2/flexcop-pci.c|0 drivers/media/{dvb = pci}/b2c2/flexcop-reg.h|0 drivers/media/{dvb = pci}/b2c2/flexcop-sram.c |0 drivers/media/{dvb = pci}/b2c2/flexcop-usb.c|0 drivers/media/{dvb = pci}/b2c2/flexcop-usb.h|0 drivers/media/{dvb = pci}/b2c2/flexcop.c|0 drivers/media/{dvb = pci}/b2c2/flexcop.h|0 .../media/{dvb = pci}/b2c2/flexcop_ibi_value_be.h |0 .../media/{dvb = pci}/b2c2/flexcop_ibi_value_le.h |0 drivers/media/{dvb = pci}/bt8xx/Kconfig |0 drivers/media/{dvb = pci}/bt8xx/Makefile|0 drivers/media/{dvb = pci}/bt8xx/bt878.c |0 drivers/media/{dvb = pci}/bt8xx/bt878.h |0 drivers/media/{dvb = pci}/bt8xx/dst.c |0 drivers/media/{dvb = pci}/bt8xx/dst_ca.c|0 drivers/media/{dvb = pci}/bt8xx/dst_ca.h|0 drivers/media/{dvb = pci}/bt8xx/dst_common.h|0 drivers/media/{dvb = pci}/bt8xx/dst_priv.h |0 drivers/media/{dvb = pci}/bt8xx/dvb-bt8xx.c |0 drivers/media/{dvb = pci}/bt8xx/dvb-bt8xx.h |0 drivers/media/{dvb = pci}/ddbridge/Kconfig |0 drivers/media/{dvb = pci}/ddbridge/Makefile |0 drivers/media/{dvb = pci}/ddbridge/ddbridge-core.c |0 drivers/media/{dvb = pci}/ddbridge/ddbridge-regs.h |0 drivers/media/{dvb = pci}/ddbridge/ddbridge.h |0 drivers/media/{dvb = pci}/dm1105/Kconfig|0 drivers/media/{dvb = pci}/dm1105/Makefile |0 drivers/media/{dvb = pci}/dm1105/dm1105.c |0 drivers/media/{dvb = pci}/mantis/Kconfig|0 drivers/media/{dvb = pci}/mantis/Makefile |0 drivers/media/{dvb = pci}/mantis/hopper_cards.c |0 drivers/media/{dvb = pci}/mantis/hopper_vp3028.c|0 drivers/media/{dvb = pci}/mantis/hopper_vp3028.h|0 drivers/media/{dvb = pci}/mantis/mantis_ca.c|0 drivers/media/{dvb = pci}/mantis/mantis_ca.h|0 drivers/media/{dvb = pci}/mantis/mantis_cards.c |0 drivers/media/{dvb = pci}/mantis/mantis_common.h|0 drivers/media/{dvb = pci}/mantis/mantis_core.c |0 drivers/media/{dvb = pci}/mantis/mantis_core.h |0 drivers/media/{dvb = pci}/mantis/mantis_dma.c |0 drivers/media/{dvb = pci}/mantis/mantis_dma.h |0 drivers/media/{dvb = pci}/mantis/mantis_dvb.c |0 drivers/media/{dvb = pci}/mantis/mantis_dvb.h |0 drivers/media/{dvb = pci}/mantis/mantis_evm.c |0 drivers/media/{dvb = pci}/mantis/mantis_hif.c |0 drivers/media/{dvb = pci}/mantis/mantis_hif.h |0 drivers/media/{dvb = pci}/mantis/mantis_i2c.c |0 drivers/media/{dvb = pci}/mantis/mantis_i2c.h |0 drivers/media/{dvb = pci}/mantis/mantis_input.c |0 drivers/media/{dvb = pci}/mantis/mantis_ioc.c |0 drivers/media/{dvb = pci}/mantis/mantis_ioc.h |0 drivers/media/{dvb = pci}/mantis/mantis_link.h |0 drivers/media/{dvb = pci}/mantis/mantis_pci.c |0 drivers/media/{dvb = pci}/mantis/mantis_pci.h |0 drivers/media/{dvb = pci}/mantis/mantis_pcmcia.c|0 drivers/media/{dvb = pci}/mantis/mantis_reg.h |0 drivers/media/{dvb = pci}/mantis/mantis_uart.c |0 drivers/media/{dvb = pci}/mantis/mantis_uart.h |0 drivers/media/{dvb = pci}/mantis/mantis_vp1033.c|0 drivers/media/{dvb = pci}/mantis/mantis_vp1033.h|0 drivers/media/{dvb = pci}/mantis/mantis_vp1034.c|0 drivers/media/{dvb = pci}/mantis/mantis_vp1034.h|0 drivers/media/{dvb = pci}/mantis/mantis_vp1041.c|0 drivers/media/{dvb = pci}/mantis/mantis_vp1041.h|0 drivers/media/{dvb = pci}/mantis/mantis_vp2033.c|0 drivers/media/{dvb = pci}/mantis/mantis_vp2033.h|0 drivers/media/{dvb =
[PATCH RFC 10/10] [media] break siano into mmc and usb directories
siano is, in fact, 2 drivers: one for MMC and one for USB, plus a common bus-independent code. Break it accordingly. Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com --- drivers/media/Kconfig|1 + drivers/media/Makefile |2 +- drivers/media/common/Kconfig |1 + drivers/media/common/Makefile|2 +- drivers/media/common/siano/Kconfig | 17 ++ drivers/media/common/siano/Makefile |7 ++ drivers/media/{usb = common}/siano/sms-cards.c |0 drivers/media/{usb = common}/siano/sms-cards.h |0 drivers/media/{usb = common}/siano/smscoreapi.c |0 drivers/media/{usb = common}/siano/smscoreapi.h |0 drivers/media/{usb = common}/siano/smsdvb.c |0 drivers/media/{usb = common}/siano/smsendian.c |0 drivers/media/{usb = common}/siano/smsendian.h |0 drivers/media/{usb = common}/siano/smsir.c |0 drivers/media/{usb = common}/siano/smsir.h |0 drivers/media/mmc/Kconfig|1 + drivers/media/mmc/Makefile |1 + drivers/media/mmc/siano/Kconfig | 10 + drivers/media/mmc/siano/Makefile |6 + drivers/media/{usb = mmc}/siano/smssdio.c |0 drivers/media/usb/siano/Kconfig | 26 +- drivers/media/usb/siano/Makefile |7 +- 22 files changed, 48 insertions(+), 33 deletions(-) create mode 100644 drivers/media/common/siano/Kconfig create mode 100644 drivers/media/common/siano/Makefile rename drivers/media/{usb = common}/siano/sms-cards.c (100%) rename drivers/media/{usb = common}/siano/sms-cards.h (100%) rename drivers/media/{usb = common}/siano/smscoreapi.c (100%) rename drivers/media/{usb = common}/siano/smscoreapi.h (100%) rename drivers/media/{usb = common}/siano/smsdvb.c (100%) rename drivers/media/{usb = common}/siano/smsendian.c (100%) rename drivers/media/{usb = common}/siano/smsendian.h (100%) rename drivers/media/{usb = common}/siano/smsir.c (100%) rename drivers/media/{usb = common}/siano/smsir.h (100%) create mode 100644 drivers/media/mmc/Kconfig create mode 100644 drivers/media/mmc/Makefile create mode 100644 drivers/media/mmc/siano/Kconfig create mode 100644 drivers/media/mmc/siano/Makefile rename drivers/media/{usb = mmc}/siano/smssdio.c (100%) diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig index 7b079a4..d892d48 100644 --- a/drivers/media/Kconfig +++ b/drivers/media/Kconfig @@ -165,6 +165,7 @@ source drivers/media/radio/Kconfig source drivers/media/dvb-core/Kconfig source drivers/media/pci/Kconfig source drivers/media/usb/Kconfig +source drivers/media/mmc/Kconfig comment Supported FireWire (IEEE 1394) Adapters depends on DVB_CORE FIREWIRE diff --git a/drivers/media/Makefile b/drivers/media/Makefile index f89ccac..3265a9a 100644 --- a/drivers/media/Makefile +++ b/drivers/media/Makefile @@ -11,5 +11,5 @@ endif obj-y += v4l2-core/ tuners/ common/ rc/ video/ obj-$(CONFIG_VIDEO_DEV) += radio/ -obj-$(CONFIG_DVB_CORE) += dvb-core/ pci/ dvb-frontends/ usb/ +obj-$(CONFIG_DVB_CORE) += dvb-core/ pci/ dvb-frontends/ usb/ mmc/ obj-$(CONFIG_DVB_FIREDTV) += firewire/ diff --git a/drivers/media/common/Kconfig b/drivers/media/common/Kconfig index 157f191..121b011 100644 --- a/drivers/media/common/Kconfig +++ b/drivers/media/common/Kconfig @@ -1,2 +1,3 @@ source drivers/media/common/b2c2/Kconfig source drivers/media/common/saa7146/Kconfig +source drivers/media/common/siano/Kconfig diff --git a/drivers/media/common/Makefile b/drivers/media/common/Makefile index f3afd83..b8e2e3a 100644 --- a/drivers/media/common/Makefile +++ b/drivers/media/common/Makefile @@ -1 +1 @@ -obj-y += b2c2/ saa7146/ +obj-y += b2c2/ saa7146/ siano/ diff --git a/drivers/media/common/siano/Kconfig b/drivers/media/common/siano/Kconfig new file mode 100644 index 000..425aead --- /dev/null +++ b/drivers/media/common/siano/Kconfig @@ -0,0 +1,17 @@ +# +# Siano Mobile Silicon Digital TV device configuration +# + +config SMS_SIANO_MDTV + tristate + depends on DVB_CORE RC_CORE HAS_DMA + depends on SMS_USB_DRV || SMS_SDIO_DRV + default y + ---help--- + Choose Y or M here if you have MDTV receiver with a Siano chipset. + + To compile this driver as a module, choose M here + (The module will be called smsmdtv). + + Further documentation on this driver can be found on the WWW + at http://www.siano-ms.com/ diff --git a/drivers/media/common/siano/Makefile b/drivers/media/common/siano/Makefile new file mode 100644 index 000..2a09279 --- /dev/null +++ b/drivers/media/common/siano/Makefile @@ -0,0 +1,7 @@ +smsmdtv-objs := smscoreapi.o sms-cards.o smsendian.o smsir.o + +obj-$(CONFIG_SMS_SIANO_MDTV) += smsmdtv.o smsdvb.o + +ccflags-y += -Idrivers/media/dvb-core
[PATCH RFC 07/10] [media] b2c2: break it into common/pci/usb directories
b2c2 is, in fact, 2 drivers: one for PCI and one for USB, plus a common bus-independent code. Break it accordingly. Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com --- drivers/media/Kconfig |4 +- drivers/media/common/Kconfig |2 + drivers/media/common/Makefile |2 +- drivers/media/common/b2c2/Kconfig | 31 drivers/media/common/b2c2/Makefile |7 .../media/{pci = common}/b2c2/flexcop-common.h|0 .../media/{pci = common}/b2c2/flexcop-eeprom.c|0 .../media/{pci = common}/b2c2/flexcop-fe-tuner.c |0 .../media/{pci = common}/b2c2/flexcop-hw-filter.c |0 drivers/media/{pci = common}/b2c2/flexcop-i2c.c |0 drivers/media/{pci = common}/b2c2/flexcop-misc.c |0 drivers/media/{pci = common}/b2c2/flexcop-reg.h |0 drivers/media/{pci = common}/b2c2/flexcop-sram.c |0 drivers/media/{pci = common}/b2c2/flexcop.c |0 drivers/media/{pci = common}/b2c2/flexcop.h |0 .../{pci = common}/b2c2/flexcop_ibi_value_be.h|0 .../{pci = common}/b2c2/flexcop_ibi_value_le.h|0 drivers/media/pci/Kconfig | 21 +++ drivers/media/pci/Makefile |3 +- drivers/media/pci/b2c2/Kconfig | 39 drivers/media/pci/b2c2/Makefile| 13 ++- drivers/media/usb/Kconfig |1 + drivers/media/usb/Makefile |2 +- drivers/media/usb/b2c2/Kconfig |6 +++ drivers/media/usb/b2c2/Makefile|7 drivers/media/{pci = usb}/b2c2/flexcop-usb.c |0 drivers/media/{pci = usb}/b2c2/flexcop-usb.h |0 27 files changed, 71 insertions(+), 67 deletions(-) create mode 100644 drivers/media/common/b2c2/Kconfig create mode 100644 drivers/media/common/b2c2/Makefile rename drivers/media/{pci = common}/b2c2/flexcop-common.h (100%) rename drivers/media/{pci = common}/b2c2/flexcop-eeprom.c (100%) rename drivers/media/{pci = common}/b2c2/flexcop-fe-tuner.c (100%) rename drivers/media/{pci = common}/b2c2/flexcop-hw-filter.c (100%) rename drivers/media/{pci = common}/b2c2/flexcop-i2c.c (100%) rename drivers/media/{pci = common}/b2c2/flexcop-misc.c (100%) rename drivers/media/{pci = common}/b2c2/flexcop-reg.h (100%) rename drivers/media/{pci = common}/b2c2/flexcop-sram.c (100%) rename drivers/media/{pci = common}/b2c2/flexcop.c (100%) rename drivers/media/{pci = common}/b2c2/flexcop.h (100%) rename drivers/media/{pci = common}/b2c2/flexcop_ibi_value_be.h (100%) rename drivers/media/{pci = common}/b2c2/flexcop_ibi_value_le.h (100%) create mode 100644 drivers/media/usb/b2c2/Kconfig create mode 100644 drivers/media/usb/b2c2/Makefile rename drivers/media/{pci = usb}/b2c2/flexcop-usb.c (100%) rename drivers/media/{pci = usb}/b2c2/flexcop-usb.h (100%) diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig index bd415c4..efc3055 100644 --- a/drivers/media/Kconfig +++ b/drivers/media/Kconfig @@ -141,7 +141,6 @@ config DVB_NET You may want to disable the network support on embedded devices. If unsure say Y. -source drivers/media/common/Kconfig source drivers/media/rc/Kconfig # @@ -175,4 +174,7 @@ comment Supported DVB Frontends depends on DVB_CORE source drivers/media/dvb-frontends/Kconfig +# Common drivers +source drivers/media/common/Kconfig + endif # MEDIA_SUPPORT diff --git a/drivers/media/common/Kconfig b/drivers/media/common/Kconfig index 769c6f8..4672f7d 100644 --- a/drivers/media/common/Kconfig +++ b/drivers/media/common/Kconfig @@ -7,3 +7,5 @@ config VIDEO_SAA7146_VV depends on VIDEO_V4L2 select VIDEOBUF_DMA_SG select VIDEO_SAA7146 + +source drivers/media/common/b2c2/Kconfig diff --git a/drivers/media/common/Makefile b/drivers/media/common/Makefile index e3ec963..d0512d7 100644 --- a/drivers/media/common/Makefile +++ b/drivers/media/common/Makefile @@ -1,6 +1,6 @@ saa7146-objs:= saa7146_i2c.o saa7146_core.o saa7146_vv-objs := saa7146_fops.o saa7146_video.o saa7146_hlp.o saa7146_vbi.o -obj-y += tuners/ +obj-y += tuners/ b2c2/ obj-$(CONFIG_VIDEO_SAA7146) += saa7146.o obj-$(CONFIG_VIDEO_SAA7146_VV) += saa7146_vv.o diff --git a/drivers/media/common/b2c2/Kconfig b/drivers/media/common/b2c2/Kconfig new file mode 100644 index 000..e270dd8 --- /dev/null +++ b/drivers/media/common/b2c2/Kconfig @@ -0,0 +1,31 @@ +config DVB_B2C2_FLEXCOP + tristate + depends on DVB_CORE I2C + depends on DVB_B2C2_FLEXCOP_PCI || DVB_B2C2_FLEXCOP_USB + default y + select DVB_PLL if !DVB_FE_CUSTOMISE + select DVB_STV0299 if !DVB_FE_CUSTOMISE + select DVB_MT352 if !DVB_FE_CUSTOMISE + select DVB_MT312 if !DVB_FE_CUSTOMISE + select DVB_NXT200X if !DVB_FE_CUSTOMISE + select DVB_STV0297
Re: [PATCH 1/2] [BUG] dvb_usb_v2: return the download ret in dvb_usb_download_firmware
On Thu, 2012-06-14 at 23:31 +0300, Antti Palosaari wrote: On 06/14/2012 04:15 AM, Antti Palosaari wrote: On 06/14/2012 03:44 AM, Malcolm Priestley wrote: On Thu, 2012-06-14 at 02:29 +0300, Antti Palosaari wrote: Hi Malcolm, I was really surprised someone has had interest to test that stuff at that phase as I did not even advertised it yet :) It is likely happen next Monday or so as there is some issues I would like to check / solve. On 06/14/2012 01:24 AM, Malcolm Priestley wrote: Hi antti There some issues with dvb_usb_v2 with the lmedm04 driver. The first being this patch, no return value from dvb_usb_download_firmware causes system wide dead lock with COLD disconnect as system attempts to continue to warm state. Hmm, I did not understand what you mean. What I looked lmedm04 driver I think it uses single USB ID (no cold + warm IDs). So it downloads firmware and then reconnects itself from the USB bus? For that scenario you should return RECONNECTS_USB; from the driver .download_firmware(). If the device disconnects from the USB bus after the firmware download. In most cases the device is already gone. There is currently no way to insert RECONNECTS_USB into the return. Argh, I was blind! You are absolutely correct. It never returns value 1 (RECONNECTS_USB) from the .download_firmware(). That patch is fine, I will apply it, thanks! I think that must be also changed to return immediately without releasing the interface. Let the USB core release it when it detects disconnect - otherwise it could crash as it tries to access potentially resources that are already freed. Just for the timing issue if it happens or not. } else if (ret == RECONNECTS_USB) { ret = 0; goto exit_usb_driver_release_interface; add return 0 here without releasing interface and test. I tested it using one non-public Cypress FX2 device - it was changing USB ID after the FX download, but from the driver perspective it does not matter. It is always new device if it reconnects USB. Have double checked that the thread is not continuing to write on the old ID? Nope, but likely delayed probe() is finished until it reconnects so I cannot see problem. You device disconnects faster and thus USB core traps .disconnect() earlier... Could you test returning 0 and if it works sent new patch. The zero condition will lead to dvb_usb_init. PS. as I looked that driver I saw many different firmwares. That is now supported and you should use .get_firmware_name() (maybe you already did it). Yes, I have supported this in the driver. Malcolm, could you just test if returning from the routines after fw download is enough to fix all your problems? I mean those two fixes: dvb_usb_download_firmware() * return RECONNECTS_USB correctly dvb_usbv2_init_work() * return without releasing USB interface if RECONNECTS_USB Hi Antti, Yes, I have tested it and there is no difference. My understanding is, if the interface is no longer bound it returns anyway. It is best not to use it, other drivers in the dvb-usb tree may not like to be forcibly unbound prior to their reset. Regards Malcolm -- 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: Patches
On 06/14/2012 11:12 AM, Peter Senna Tschudin wrote: Dear Mauro, I've just send some patches. Some are being sent again just to group my patches. The cx231xx patch was resent because I forgot to CC the maintainers of the patch. For the pvrusb2, I've grouped four commits into one. get_maintainers.pl has reported that one of the maintainers of cx231xx is Greg Kroah-Hartman gre...@suse.de, but this E-mail do not exist any more. Should I report this somewhere? ./scripts/get_maintainer.pl -f drivers/media/video/cx231xx/ Mauro Carvalho Chehab mche...@infradead.org (maintainer:MEDIA INPUT INFRA...,commit_signer:23/24=96%) Devin Heitmueller dheitmuel...@kernellabs.com (commit_signer:4/24=17%) Hans Verkuil hans.verk...@cisco.com (commit_signer:4/24=17%) Thomas Petazzoni thomas.petazz...@free-electrons.com (commit_signer:4/24=17%) linux-media@vger.kernel.org (open list:MEDIA INPUT INFRA...) linux-ker...@vger.kernel.org (open list) That (above) should be enough. If you feel that you need to copy GregKH on the patches, his current email address is in the MAINTAINERS file. thanks, -- ~Randy -- 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 1/2] [BUG] dvb_usb_v2: return the download ret in dvb_usb_download_firmware
On 06/15/2012 12:33 AM, Malcolm Priestley wrote: On Thu, 2012-06-14 at 23:31 +0300, Antti Palosaari wrote: On 06/14/2012 04:15 AM, Antti Palosaari wrote: On 06/14/2012 03:44 AM, Malcolm Priestley wrote: On Thu, 2012-06-14 at 02:29 +0300, Antti Palosaari wrote: Hi Malcolm, I was really surprised someone has had interest to test that stuff at that phase as I did not even advertised it yet :) It is likely happen next Monday or so as there is some issues I would like to check / solve. On 06/14/2012 01:24 AM, Malcolm Priestley wrote: Hi antti There some issues with dvb_usb_v2 with the lmedm04 driver. The first being this patch, no return value from dvb_usb_download_firmware causes system wide dead lock with COLD disconnect as system attempts to continue to warm state. Hmm, I did not understand what you mean. What I looked lmedm04 driver I think it uses single USB ID (no cold + warm IDs). So it downloads firmware and then reconnects itself from the USB bus? For that scenario you should return RECONNECTS_USB; from the driver .download_firmware(). If the device disconnects from the USB bus after the firmware download. In most cases the device is already gone. There is currently no way to insert RECONNECTS_USB into the return. Argh, I was blind! You are absolutely correct. It never returns value 1 (RECONNECTS_USB) from the .download_firmware(). That patch is fine, I will apply it, thanks! I think that must be also changed to return immediately without releasing the interface. Let the USB core release it when it detects disconnect - otherwise it could crash as it tries to access potentially resources that are already freed. Just for the timing issue if it happens or not. } else if (ret == RECONNECTS_USB) { ret = 0; goto exit_usb_driver_release_interface; add return 0 here without releasing interface and test. I tested it using one non-public Cypress FX2 device - it was changing USB ID after the FX download, but from the driver perspective it does not matter. It is always new device if it reconnects USB. Have double checked that the thread is not continuing to write on the old ID? Nope, but likely delayed probe() is finished until it reconnects so I cannot see problem. You device disconnects faster and thus USB core traps .disconnect() earlier... Could you test returning 0 and if it works sent new patch. The zero condition will lead to dvb_usb_init. PS. as I looked that driver I saw many different firmwares. That is now supported and you should use .get_firmware_name() (maybe you already did it). Yes, I have supported this in the driver. Malcolm, could you just test if returning from the routines after fw download is enough to fix all your problems? I mean those two fixes: dvb_usb_download_firmware() * return RECONNECTS_USB correctly dvb_usbv2_init_work() * return without releasing USB interface if RECONNECTS_USB Hi Antti, Yes, I have tested it and there is no difference. My understanding is, if the interface is no longer bound it returns anyway. It is best not to use it, other drivers in the dvb-usb tree may not like to be forcibly unbound prior to their reset. I don't understand why this logic cannot work. Do you have some crash dump I can see likely functions in path? I draw it here as a skeleton code. dvb_usbv2_init_work() ret = download_firmware() if (ret == DEVICE_IS_WARM) init_device() return else if (ret == DEVICE_RECONECTS_USB) return else (ret == some error code) usb_driver_release_interface() return dvb_usbv2_probe() state = alloc() usb_set_intfdata(state) schedule_work(dvb_usbv2_init_work) return 0 dvb_usbv2_disconnect() state = usb_get_intfdata() cancel_work_sync(dvb_usbv2_init_work) free(state) Anyhow, I have devices I know how to force reconnect USB (AF9015, EC168) when needed. So I will make some tests here. regards Antti -- http://palosaari.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 1/2] [BUG] dvb_usb_v2: return the download ret in dvb_usb_download_firmware
On Fri, 2012-06-15 at 01:12 +0300, Antti Palosaari wrote: On 06/15/2012 12:33 AM, Malcolm Priestley wrote: On Thu, 2012-06-14 at 23:31 +0300, Antti Palosaari wrote: On 06/14/2012 04:15 AM, Antti Palosaari wrote: On 06/14/2012 03:44 AM, Malcolm Priestley wrote: On Thu, 2012-06-14 at 02:29 +0300, Antti Palosaari wrote: Hi Malcolm, I was really surprised someone has had interest to test that stuff at that phase as I did not even advertised it yet :) It is likely happen next Monday or so as there is some issues I would like to check / solve. On 06/14/2012 01:24 AM, Malcolm Priestley wrote: Hi antti There some issues with dvb_usb_v2 with the lmedm04 driver. The first being this patch, no return value from dvb_usb_download_firmware causes system wide dead lock with COLD disconnect as system attempts to continue to warm state. Hmm, I did not understand what you mean. What I looked lmedm04 driver I think it uses single USB ID (no cold + warm IDs). So it downloads firmware and then reconnects itself from the USB bus? For that scenario you should return RECONNECTS_USB; from the driver .download_firmware(). If the device disconnects from the USB bus after the firmware download. In most cases the device is already gone. There is currently no way to insert RECONNECTS_USB into the return. Argh, I was blind! You are absolutely correct. It never returns value 1 (RECONNECTS_USB) from the .download_firmware(). That patch is fine, I will apply it, thanks! I think that must be also changed to return immediately without releasing the interface. Let the USB core release it when it detects disconnect - otherwise it could crash as it tries to access potentially resources that are already freed. Just for the timing issue if it happens or not. } else if (ret == RECONNECTS_USB) { ret = 0; goto exit_usb_driver_release_interface; add return 0 here without releasing interface and test. I tested it using one non-public Cypress FX2 device - it was changing USB ID after the FX download, but from the driver perspective it does not matter. It is always new device if it reconnects USB. Have double checked that the thread is not continuing to write on the old ID? Nope, but likely delayed probe() is finished until it reconnects so I cannot see problem. You device disconnects faster and thus USB core traps .disconnect() earlier... Could you test returning 0 and if it works sent new patch. The zero condition will lead to dvb_usb_init. PS. as I looked that driver I saw many different firmwares. That is now supported and you should use .get_firmware_name() (maybe you already did it). Yes, I have supported this in the driver. Malcolm, could you just test if returning from the routines after fw download is enough to fix all your problems? I mean those two fixes: dvb_usb_download_firmware() * return RECONNECTS_USB correctly dvb_usbv2_init_work() * return without releasing USB interface if RECONNECTS_USB Hi Antti, Yes, I have tested it and there is no difference. My understanding is, if the interface is no longer bound it returns anyway. It is best not to use it, other drivers in the dvb-usb tree may not like to be forcibly unbound prior to their reset. I don't understand why this logic cannot work. Do you have some crash dump I can see likely functions in path? Sorry, you misunderstood me, there is no crash. I was only talking using usb_driver_release_interface() or not. The skeleton code below would work fine :-) Regards Malcolm I draw it here as a skeleton code. dvb_usbv2_init_work() ret = download_firmware() if (ret == DEVICE_IS_WARM) init_device() return else if (ret == DEVICE_RECONECTS_USB) return else (ret == some error code) usb_driver_release_interface() return dvb_usbv2_probe() state = alloc() usb_set_intfdata(state) schedule_work(dvb_usbv2_init_work) return 0 dvb_usbv2_disconnect() state = usb_get_intfdata() cancel_work_sync(dvb_usbv2_init_work) free(state) Anyhow, I have devices I know how to force reconnect USB (AF9015, EC168) when needed. So I will make some tests here. regards Antti -- 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 1/2] [BUG] dvb_usb_v2: return the download ret in dvb_usb_download_firmware
On 06/15/2012 01:32 AM, Malcolm Priestley wrote: On Fri, 2012-06-15 at 01:12 +0300, Antti Palosaari wrote: On 06/15/2012 12:33 AM, Malcolm Priestley wrote: On Thu, 2012-06-14 at 23:31 +0300, Antti Palosaari wrote: On 06/14/2012 04:15 AM, Antti Palosaari wrote: On 06/14/2012 03:44 AM, Malcolm Priestley wrote: On Thu, 2012-06-14 at 02:29 +0300, Antti Palosaari wrote: Hi Malcolm, I was really surprised someone has had interest to test that stuff at that phase as I did not even advertised it yet :) It is likely happen next Monday or so as there is some issues I would like to check / solve. On 06/14/2012 01:24 AM, Malcolm Priestley wrote: Hi antti There some issues with dvb_usb_v2 with the lmedm04 driver. The first being this patch, no return value from dvb_usb_download_firmware causes system wide dead lock with COLD disconnect as system attempts to continue to warm state. Hmm, I did not understand what you mean. What I looked lmedm04 driver I think it uses single USB ID (no cold + warm IDs). So it downloads firmware and then reconnects itself from the USB bus? For that scenario you should return RECONNECTS_USB; from the driver .download_firmware(). If the device disconnects from the USB bus after the firmware download. In most cases the device is already gone. There is currently no way to insert RECONNECTS_USB into the return. Argh, I was blind! You are absolutely correct. It never returns value 1 (RECONNECTS_USB) from the .download_firmware(). That patch is fine, I will apply it, thanks! I think that must be also changed to return immediately without releasing the interface. Let the USB core release it when it detects disconnect - otherwise it could crash as it tries to access potentially resources that are already freed. Just for the timing issue if it happens or not. } else if (ret == RECONNECTS_USB) { ret = 0; goto exit_usb_driver_release_interface; add return 0 here without releasing interface and test. I tested it using one non-public Cypress FX2 device - it was changing USB ID after the FX download, but from the driver perspective it does not matter. It is always new device if it reconnects USB. Have double checked that the thread is not continuing to write on the old ID? Nope, but likely delayed probe() is finished until it reconnects so I cannot see problem. You device disconnects faster and thus USB core traps .disconnect() earlier... Could you test returning 0 and if it works sent new patch. The zero condition will lead to dvb_usb_init. PS. as I looked that driver I saw many different firmwares. That is now supported and you should use .get_firmware_name() (maybe you already did it). Yes, I have supported this in the driver. Malcolm, could you just test if returning from the routines after fw download is enough to fix all your problems? I mean those two fixes: dvb_usb_download_firmware() * return RECONNECTS_USB correctly dvb_usbv2_init_work() * return without releasing USB interface if RECONNECTS_USB Hi Antti, Yes, I have tested it and there is no difference. My understanding is, if the interface is no longer bound it returns anyway. It is best not to use it, other drivers in the dvb-usb tree may not like to be forcibly unbound prior to their reset. I don't understand why this logic cannot work. Do you have some crash dump I can see likely functions in path? Sorry, you misunderstood me, there is no crash. I was only talking using usb_driver_release_interface() or not. The skeleton code below would work fine :-) Hi Malcolm, Are you fine now with these two patches and no further changes are needed? http://git.linuxtv.org/anttip/media_tree.git/commit/2ced3f3b5763b4817c5a884b0980a9a7c87e4d96 http://git.linuxtv.org/anttip/media_tree.git/commit/ddd75d554b2b08cb112c756983301cb9418ccd42 regards Antti -- http://palosaari.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 1/2] [BUG] dvb_usb_v2: return the download ret in dvb_usb_download_firmware
On Fri, 2012-06-15 at 02:14 +0300, Antti Palosaari wrote: Hi Malcolm, Are you fine now with these two patches and no further changes are needed? http://git.linuxtv.org/anttip/media_tree.git/commit/2ced3f3b5763b4817c5a884b0980a9a7c87e4d96 http://git.linuxtv.org/anttip/media_tree.git/commit/ddd75d554b2b08cb112c756983301cb9418ccd42 Yes, these are okay. Regards Malcolm -- 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
Webcam Genius 1300[AF] V2 not working since kernel 2.6.39
The webcams Genius 1300 V2 and Genius 1300AF V2 (and probably some built-in MacBook iSight webcams) face an issue since v2.6.39. For versions before that, they work fine. Every application displays a black screen for the devices except for mplayer which displays a green screen. Output of lsusb -vvv -d 0458:7067 http://pastebin.com/9R9atS9L Output of mplayer tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0 -fps 30 http://pastebin.com/pHuaKDv8 On doing git bisect, I was able to find the commit which brings the regression. It's commit e1620d591a75a10b15cf61dbf8243a0b7e6731a2 titled USB: Move runtime PM callbacks to usb_device_pm_ops. A bug was reported with UVC on sourceforge by another user http://sourceforge.net/mailarchive/message.php?msg_id=29030464 Please fix this. Would hate to see this remain unfixed especially since I gave quite an amount of time to find the commit. -- 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: Patches
Hello Randy, ./scripts/get_maintainer.pl -f drivers/media/video/cx231xx/ Mauro Carvalho Chehab mche...@infradead.org (maintainer:MEDIA INPUT INFRA...,commit_signer:23/24=96%) Devin Heitmueller dheitmuel...@kernellabs.com (commit_signer:4/24=17%) Hans Verkuil hans.verk...@cisco.com (commit_signer:4/24=17%) Thomas Petazzoni thomas.petazz...@free-electrons.com (commit_signer:4/24=17%) linux-media@vger.kernel.org (open list:MEDIA INPUT INFRA...) linux-ker...@vger.kernel.org (open list) When I run it pointing to the patch, it also includes Julia Lawall and Greg Kroah-Hartman. See: $ scripts/get_maintainer.pl outgoing/0001-RESEND-cx231xx-Paranoic-stack-memory-save.patch Mauro Carvalho Chehab mche...@infradead.org (maintainer:MEDIA INPUT INFRA...,commit_signer:11/12=92%) Thomas Petazzoni thomas.petazz...@free-electrons.com (commit_signer:3/12=25%) Devin Heitmueller dheitmuel...@kernellabs.com (commit_signer:2/12=17%) Julia Lawall ju...@diku.dk (commit_signer:1/12=8%) Greg Kroah-Hartman gre...@suse.de (commit_signer:1/12=8%) linux-media@vger.kernel.org (open list:MEDIA INPUT INFRA...) linux-ker...@vger.kernel.org (open list) The patch was sent to all people above but Greg did not get it due invalid E-mail. I've removed linux-ker...@vger.kernel.org list. That (above) should be enough. If you feel that you need to copy GregKH on the patches, his current email address is in the MAINTAINERS file. I feel there is no need of sending the patch to him, but I'm not sure about the need of reporting the broken E-mail. thanks, -- ~Randy Thanks, Peter -- Peter Senna Tschudin peter.se...@gmail.com gpg id: 48274C36 -- 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: DVB streaming failed after running tzap
To avoid misunderstanding, I'd like to rephrase the passage below: SVN-r35003-4.5.2); however, if I ran tzap before launching mplayer, then I would get a series of dvb_streaming_read, attempt N. 6 failed with errno 0 when reading 2048 bytes failure messages. Then I must unplug the DiBcom USB tuner and plug it in again so that I could relaunch mplayer to tune to a DVB-T channel. If I launched mplayer after running tzap, I would get a series of dvb_streaming_read, attempt N. n failed with errno 0 when reading 2048 bytes failure messages. I must unplug the DiBcom USB tuner and plug it in again so that I could relaunch mplayer to tune to a DVB-T channel. Looks like tzap messed up something with the DiBcom kernel modules? -- 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: Patches
On Fri, 15 Jun 2012 03:42:14 Peter Senna Tschudin wrote: Dear Mauro, I've just send some patches. Some are being sent again just to group my patches. The cx231xx patch was resent because I forgot to CC the maintainers of the patch. For the pvrusb2, I've grouped four commits into one. get_maintainers.pl has reported that one of the maintainers of cx231xx is Greg Kroah-Hartman gre...@suse.de, but this E-mail do not exist any more. Should I report this somewhere? []'s Peter Try gre...@linux.com (that is the address he uses on the opensuse mailing list)... -- == Rodney Baker rod...@jeremiah31-10.net web: www.jeremiah31-10.net == -- 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
pctv hd pci 800i card problem: cx88-dvb does not insert
Dear v4l-dvb experts, I'm stuck trying to get a hybrid tv card that seems to be well supported working. The box is labeled simply pctv hd card 800i; Newegg sells it as Hauppauge pctv pci 800i; Linuxtv has a setup page for it as a Pinnacle card (http://www.linuxtv.org/wiki/index.php/Pinnacle_PCTV_HD_Card_%28800i%29). Grepping dmesg for the firmware and drivers (cx88\|xc5000) shows where I'm stuck---the last few lines: [ 15.667814] cx88/0: cx2388x v4l2 driver version 0.0.9 loaded [ 15.671012] cx88[0]: subsystem: 11bd:0051, board: Pinnacle PCTV HD 800i [card=58,autodetected], frontend(s): 1 [ 15.671016] cx88[0]: TV tuner type 76, Radio tuner type -1 [ 15.673125] cx88/2: cx2388x MPEG-TS Driver Manager version 0.0.9 loaded [ 16.040393] xc5000 1-0064: creating new instance [ 16.042076] xc5000: Successfully identified at address 0x64 [ 16.042078] xc5000: Firmware has not been loaded previously [ 16.042083] cx88[0]: Calling XC5000 callback [ 16.144338] input: cx88 IR (Pinnacle PCTV HD 800i) as /devices/pci:00/:00:1c.2/:04:00.0/:05:00.0/rc/rc0/input11 [ 16.144439] rc0: cx88 IR (Pinnacle PCTV HD 800i) as /devices/pci:00/:00:1c.2/:04:00.0/:05:00.0/rc/rc0 [ 16.144490] cx88[0]/0: found at :05:00.0, rev: 5, irq: 18, latency: 32, mmio: 0xf800 [ 16.148463] xc5000: waiting for firmware upload (dvb-fe-xc5000-1.6.114.fw)... [ 16.198497] xc5000: firmware read 12401 bytes. [ 16.198500] xc5000: firmware uploading... [ 16.198504] cx88[0]: Calling XC5000 callback [ 16.320681] input: MCE IR Keyboard/Mouse (cx88xx) as /devices/virtual/input/input12 [ 16.342673] rc rc0: lirc_dev: driver ir-lirc-codec (cx88xx) registered at minor = 0 [ 19.559428] xc5000: firmware upload complete... [ 20.155953] cx88[0]/0: registered device video0 [v4l2] [ 20.156084] cx88[0]/0: registered device vbi0 [ 20.156278] cx88[0]/2: cx2388x 8802 Driver Manager [ 20.156316] cx88[0]/2: found at :05:00.2, rev: 5, irq: 18, latency: 32, mmio: 0xf600 [ 20.156443] cx88[0]/1: CX88x/0: ALSA support for cx2388x boards [ 20.188403] cx88/2: cx2388x dvb driver version 0.0.9 loaded [ 20.188405] cx88/2: registering cx8802 driver, type: dvb access: shared [ 20.188408] cx88[0]/2: subsystem: 11bd:0051, board: Pinnacle PCTV HD 800i [card=58] [ 20.188410] cx88[0]/2: cx2388x based DVB/ATSC card [ 20.188411] cx8802_alloc_frontends() allocating 1 frontend(s) [ 20.224518] cx88[0]/2: frontend initialization failed [ 20.224521] cx88[0]/2: dvb_register failed (err = -22) [ 20.224523] cx88[0]/2: cx8802 probe failed, err = -22 [ 20.224563] cx88[0]: Calling XC5000 callback [ 20.224602] cx88[0]: Calling XC5000 callback [ 20.232631] modprobe[819]: FATAL: Error inserting cx88_dvb (/lib/modules/3.3.7-1.fc16.x86_64/kernel/drivers/media/video/cx88/cx88-dvb.ko): No such device No /dev/dvb nodes are created; the analog /dev/v4l nodes are created (and analog video seems to work). NOTES: (1) Trying to insert cx88-dvb by hand yields the same error. (2) I am using Fedora 16 (kernel 3.3.7-1.fc16.x86_64). The drivers are in the kernel. I've built the drivers from source against the 3.3.7-1.fc16.x86_64 headers, but the results are the same. (3) I tried a workaround in a similar-sounding redhat bug report at http://linuxtv.org/wiki/index.php/KWorld_ATSC_120: Boot with cx8800, cx8802, cx88-alsa, and cx88-dvb blacklisted, remove the blacklist, then modprobe cx88-dvb. cx88-dvb still fails to insert. Thanks very much for any help! Mack For the record, here is the card's lspci -vvnn: 05:00.0 Multimedia video controller [0400]: Conexant Systems, Inc. CX23880/1/2/3 PCI Video and Audio Decoder [14f1:8800] (rev 05) Subsystem: Pinnacle Systems Inc. Device [11bd:0051] Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx- Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium TAbort- TAbort- MAbort- SERR- PERR- INTx- Latency: 32 (5000ns min, 13750ns max), Cache Line Size: 64 bytes Interrupt: pin A routed to IRQ 18 Region 0: Memory at f800 (32-bit, non-prefetchable) [size=16M] Capabilities: [44] Vital Product Data No end tag found Capabilities: [4c] Power Management version 2 Flags: PMEClk- DSI+ D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-) Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME- Kernel driver in use: cx8800 Kernel modules: cx8800 05:00.1 Multimedia controller [0480]: Conexant Systems, Inc. CX23880/1/2/3 PCI Video and Audio Decoder [Audio Port] [14f1:8801] (rev 05) Subsystem: Pinnacle Systems Inc. Device [11bd:0051] Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx- Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium TAbort- TAbort- MAbort- SERR- PERR- INTx- Latency: 32 (1000ns min, 63750ns max), Cache Line Size: 64 bytes Interrupt: pin A routed to IRQ 18 Region 0: Memory at