RE: buffer delivery stops with cx23885
And important for me, because if it IS related to the vb2 conversion then I need to know asap. Might take a few days to be completely sure. I've wondered if it's something to do with the signal too (maybe some bug when signal error occurs?). So many variables :( I can reasonably reliably reproduce the problem using dvbstream. strace output below. It looks pretty much as you'd expect - poll returning normally up until it doesn't anymore. I'll test out the downgrade to 73d8102298719863d54264f62521362487f84256 just to be sure, then see if I can take it further back. James poll([{fd=7, events=POLLIN|POLLPRI}], 1, 500) = 1 ([{fd=7, revents=POLLIN|POLLPRI}]) accept(0, 0x712e20, [0])= -1 ENOTSOCK (Socket operation on non-socket) read(7, G\v\30\37\252V\317\373\21\377\35\265\6\200Z\200\34\24\342\337bw\237\265\314,:!`\n\370\4..., 188) = 188 write(3, G\v\30\37\252V\317\373\21\377\35\265\6\200Z\200\34\24\342\337bw\237\265\314,:!`\n\370\4..., 188) = 188 poll([{fd=7, events=POLLIN|POLLPRI}], 1, 500) = 1 ([{fd=7, revents=POLLIN|POLLPRI}]) accept(0, 0x712e20, [0])= -1 ENOTSOCK (Socket operation on non-socket) read(7, G\v\30\20\f0n!\200\301\10)@),\261\241\330\242\213\376\f\345\223\21\202@N\2b\224i..., 188) = 188 write(3, G\v\30\20\f0n!\200\301\10)@),\261\241\330\242\213\376\f\345\223\21\202@N\2b\224i..., 188) = 188 poll([{fd=7, events=POLLIN|POLLPRI}], 1, 500) = 1 ([{fd=7, revents=POLLIN|POLLPRI}]) accept(0, 0x712e20, [0])= -1 ENOTSOCK (Socket operation on non-socket) read(7, G\v\30\21%\35]\356\rv\372+\0222\34\233\312v,\230\371\363\204s\205RQ\334\243\21\337\223..., 188) = 188 write(3, G\v\30\21%\35]\356\rv\372+\0222\34\233\312v,\230\371\363\204s\205RQ\334\243\21\337\223..., 188) = 188 poll([{fd=7, events=POLLIN|POLLPRI}], 1, 500) = 0 (Timeout) accept(0, 0x712e20, [0])= -1 ENOTSOCK (Socket operation on non-socket) read(7, 0x77145120, 188)= -1 EAGAIN (Resource temporarily unavailable) poll([{fd=7, events=POLLIN|POLLPRI}], 1, 500) = 0 (Timeout) accept(0, 0x712e20, [0])= -1 ENOTSOCK (Socket operation on non-socket) read(7, 0x77145120, 188)= -1 EAGAIN (Resource temporarily unavailable) poll([{fd=7, events=POLLIN|POLLPRI}], 1, 500) = 0 (Timeout) accept(0, 0x712e20, [0])= -1 ENOTSOCK (Socket operation on non-socket)
Re: [PATCHv2 1/3] vb2: fix VBI/poll regression
On 09/20/2014 09:26 PM, Laurent Pinchart wrote: Hi Hans, Thank you for the patch. On Saturday 20 September 2014 21:16:35 Hans Verkuil wrote: From: Hans Verkuil hans.verk...@cisco.com The recent conversion of saa7134 to vb2 unconvered a poll() bug that broke the teletext applications alevt and mtt. These applications expect that calling poll() without having called VIDIOC_STREAMON will cause poll() to return POLLERR. That did not happen in vb2. This patch fixes that behavior. It also fixes what should happen when poll() is called when STREAMON is called but no buffers have been queued. In that case poll() will also return POLLERR, but only for capture queues since output queues will always return POLLOUT anyway in that situation. This brings the vb2 behavior in line with the old videobuf behavior. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/v4l2-core/videobuf2-core.c | 17 ++--- include/media/videobuf2-core.h | 4 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index 7e6aff6..a0aa694 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -977,6 +977,7 @@ static int __reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req) * to the userspace. */ req-count = allocated_buffers; +q-waiting_for_buffers = !V4L2_TYPE_IS_OUTPUT(q-type); return 0; } @@ -1024,6 +1025,7 @@ static int __create_bufs(struct vb2_queue *q, struct v4l2_create_buffers *create memset(q-plane_sizes, 0, sizeof(q-plane_sizes)); memset(q-alloc_ctx, 0, sizeof(q-alloc_ctx)); q-memory = create-memory; +q-waiting_for_buffers = !V4L2_TYPE_IS_OUTPUT(q-type); Wouldn't it be easier to set the flag when creating the queue and in vb2_internal_streamoff() instead of in __create_bufs and __reqbufs ? I'll let you decide. Sorry, I don't follow. 'When creating the queue'? __create_bufs and __reqbufs are the functions that create the queue (i.e. allocate the buffers). Regards, Hans } num_buffers = min(create-count, VIDEO_MAX_FRAME - q-num_buffers); @@ -1801,6 +1803,7 @@ static int vb2_internal_qbuf(struct vb2_queue *q, struct v4l2_buffer *b) */ list_add_tail(vb-queued_entry, q-queued_list); q-queued_count++; +q-waiting_for_buffers = false; vb-state = VB2_BUF_STATE_QUEUED; if (V4L2_TYPE_IS_OUTPUT(q-type)) { /* @@ -2261,6 +2264,7 @@ static int vb2_internal_streamoff(struct vb2_queue *q, enum v4l2_buf_type type) * their normal dequeued state. */ __vb2_queue_cancel(q); +q-waiting_for_buffers = !V4L2_TYPE_IS_OUTPUT(q-type); dprintk(3, successful\n); return 0; @@ -2583,10 +2587,17 @@ unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait) } /* - * There is nothing to wait for if no buffer has been queued and the - * queue isn't streaming, or if the error flag is set. + * There is nothing to wait for if the queue isn't streaming, or if the + * error flag is set. */ -if ((list_empty(q-queued_list) !vb2_is_streaming(q)) || q-error) +if (!vb2_is_streaming(q) || q-error) +return res | POLLERR; +/* + * For compatibility with vb1: if QBUF hasn't been called yet, then + * return POLLERR as well. This only affects capture queues, output + * queues will always initialize waiting_for_buffers to false. + */ +if (q-waiting_for_buffers) return res | POLLERR; /* diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h index 5a10d8d..84f790c 100644 --- a/include/media/videobuf2-core.h +++ b/include/media/videobuf2-core.h @@ -381,6 +381,9 @@ struct v4l2_fh; * @start_streaming_called: start_streaming() was called successfully and we * started streaming. * @error: a fatal error occurred on the queue + * @waiting_for_buffers: used in poll() to check if vb2 is still waiting for + * buffers. Only set for capture queues if qbuf has not yet been + *called since poll() needs to return POLLERR in that situation. * @fileio: file io emulator internal data, used only if emulator is active * @threadio: thread io internal data, used only if thread is active */ @@ -419,6 +422,7 @@ struct vb2_queue { unsigned intstreaming:1; unsigned intstart_streaming_called:1; unsigned interror:1; +unsigned intwaiting_for_buffers:1; struct vb2_fileio_data *fileio; struct vb2_threadio_data*threadio; -- 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
[GIT PULL FOR v3.17] Various bug/regression fixes for 3.17
Hi Mauro, This collects my set of 3.17 patches, including the vb2 poll regression fix. I have also included the poll documentation fixes here, but if you prefer to add those to 3.18 instead, then that's fine by me. Besides this pull request for 3.17 I have two other pull requests for 3.17 as well that have not yet been merged: https://patchwork.linuxtv.org/patch/25162/ https://patchwork.linuxtv.org/patch/25824/ And this cx18 fix for 3.17 is currently in your fixes branch, but not yet upstream: https://patchwork.linuxtv.org/patch/25572/ Regards, Hans The following changes since commit f5281fc81e9a0a3e80b78720c5ae2ed06da3bfae: [media] vpif: Fix compilation with allmodconfig (2014-09-09 18:08:08 -0300) are available in the git repository at: git://linuxtv.org/hverkuil/media_tree.git for-v3.17k for you to fetch changes up to cd36be2ddfd6ff0ff823546caa03fb9a05dae54a: DocBook media: improve the poll() documentation (2014-09-21 11:00:12 +0200) Hans Verkuil (6): adv7604: fix inverted condition cx24123: fix kernel oops due to missing parent pointer cx2341x: fix kernel oops vb2: fix VBI/poll regression DocBook media: fix the poll() 'no QBUF' documentation DocBook media: improve the poll() documentation Documentation/DocBook/media/v4l/func-poll.xml | 35 +-- drivers/media/common/cx2341x.c| 1 + drivers/media/dvb-frontends/cx24123.c | 1 + drivers/media/i2c/adv7604.c | 2 +- drivers/media/v4l2-core/videobuf2-core.c | 17 ++--- include/media/videobuf2-core.h| 4 6 files changed, 50 insertions(+), 10 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCHv2 1/3] vb2: fix VBI/poll regression
Hi Hans, On Sunday 21 September 2014 11:00:02 Hans Verkuil wrote: On 09/20/2014 09:26 PM, Laurent Pinchart wrote: On Saturday 20 September 2014 21:16:35 Hans Verkuil wrote: From: Hans Verkuil hans.verk...@cisco.com The recent conversion of saa7134 to vb2 unconvered a poll() bug that broke the teletext applications alevt and mtt. These applications expect that calling poll() without having called VIDIOC_STREAMON will cause poll() to return POLLERR. That did not happen in vb2. This patch fixes that behavior. It also fixes what should happen when poll() is called when STREAMON is called but no buffers have been queued. In that case poll() will also return POLLERR, but only for capture queues since output queues will always return POLLOUT anyway in that situation. This brings the vb2 behavior in line with the old videobuf behavior. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/v4l2-core/videobuf2-core.c | 17 ++--- include/media/videobuf2-core.h | 4 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index 7e6aff6..a0aa694 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -977,6 +977,7 @@ static int __reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req) * to the userspace. */ req-count = allocated_buffers; + q-waiting_for_buffers = !V4L2_TYPE_IS_OUTPUT(q-type); return 0; } @@ -1024,6 +1025,7 @@ static int __create_bufs(struct vb2_queue *q, struct v4l2_create_buffers *create memset(q-plane_sizes, 0, sizeof(q-plane_sizes)); memset(q-alloc_ctx, 0, sizeof(q-alloc_ctx)); q-memory = create-memory; + q-waiting_for_buffers = !V4L2_TYPE_IS_OUTPUT(q-type); Wouldn't it be easier to set the flag when creating the queue and in vb2_internal_streamoff() instead of in __create_bufs and __reqbufs ? I'll let you decide. Sorry, I don't follow. 'When creating the queue'? __create_bufs and __reqbufs are the functions that create the queue (i.e. allocate the buffers). I meant vb2_queue_init. } num_buffers = min(create-count, VIDEO_MAX_FRAME - q-num_buffers); @@ -1801,6 +1803,7 @@ static int vb2_internal_qbuf(struct vb2_queue *q, struct v4l2_buffer *b) */ list_add_tail(vb-queued_entry, q-queued_list); q-queued_count++; + q-waiting_for_buffers = false; vb-state = VB2_BUF_STATE_QUEUED; if (V4L2_TYPE_IS_OUTPUT(q-type)) { /* @@ -2261,6 +2264,7 @@ static int vb2_internal_streamoff(struct vb2_queue *q, enum v4l2_buf_type type) * their normal dequeued state. */ __vb2_queue_cancel(q); + q-waiting_for_buffers = !V4L2_TYPE_IS_OUTPUT(q-type); dprintk(3, successful\n); return 0; @@ -2583,10 +2587,17 @@ unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait) } /* - * There is nothing to wait for if no buffer has been queued and the - * queue isn't streaming, or if the error flag is set. + * There is nothing to wait for if the queue isn't streaming, or if the + * error flag is set. */ - if ((list_empty(q-queued_list) !vb2_is_streaming(q)) || q- error) + if (!vb2_is_streaming(q) || q-error) + return res | POLLERR; + /* + * For compatibility with vb1: if QBUF hasn't been called yet, then + * return POLLERR as well. This only affects capture queues, output + * queues will always initialize waiting_for_buffers to false. + */ + if (q-waiting_for_buffers) return res | POLLERR; /* diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h index 5a10d8d..84f790c 100644 --- a/include/media/videobuf2-core.h +++ b/include/media/videobuf2-core.h @@ -381,6 +381,9 @@ struct v4l2_fh; * @start_streaming_called: start_streaming() was called successfully and we *started streaming. * @error:a fatal error occurred on the queue + * @waiting_for_buffers: used in poll() to check if vb2 is still waiting for + *buffers. Only set for capture queues if qbuf has not yet been + *called since poll() needs to return POLLERR in that situation. * @fileio: file io emulator internal data, used only if emulator is active * @threadio: thread io internal data, used only if thread is active */ @@ -419,6 +422,7 @@ struct vb2_queue { unsigned intstreaming:1; unsigned intstart_streaming_called:1; unsigned interror:1; + unsigned intwaiting_for_buffers:1; struct vb2_fileio_data *fileio; struct vb2_threadio_data
Re: [PATCHv2 1/3] vb2: fix VBI/poll regression
On 09/21/2014 11:30 AM, Laurent Pinchart wrote: Hi Hans, On Sunday 21 September 2014 11:00:02 Hans Verkuil wrote: On 09/20/2014 09:26 PM, Laurent Pinchart wrote: On Saturday 20 September 2014 21:16:35 Hans Verkuil wrote: From: Hans Verkuil hans.verk...@cisco.com The recent conversion of saa7134 to vb2 unconvered a poll() bug that broke the teletext applications alevt and mtt. These applications expect that calling poll() without having called VIDIOC_STREAMON will cause poll() to return POLLERR. That did not happen in vb2. This patch fixes that behavior. It also fixes what should happen when poll() is called when STREAMON is called but no buffers have been queued. In that case poll() will also return POLLERR, but only for capture queues since output queues will always return POLLOUT anyway in that situation. This brings the vb2 behavior in line with the old videobuf behavior. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/v4l2-core/videobuf2-core.c | 17 ++--- include/media/videobuf2-core.h | 4 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index 7e6aff6..a0aa694 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -977,6 +977,7 @@ static int __reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req) * to the userspace. */ req-count = allocated_buffers; + q-waiting_for_buffers = !V4L2_TYPE_IS_OUTPUT(q-type); return 0; } @@ -1024,6 +1025,7 @@ static int __create_bufs(struct vb2_queue *q, struct v4l2_create_buffers *create memset(q-plane_sizes, 0, sizeof(q-plane_sizes)); memset(q-alloc_ctx, 0, sizeof(q-alloc_ctx)); q-memory = create-memory; + q-waiting_for_buffers = !V4L2_TYPE_IS_OUTPUT(q-type); Wouldn't it be easier to set the flag when creating the queue and in vb2_internal_streamoff() instead of in __create_bufs and __reqbufs ? I'll let you decide. Sorry, I don't follow. 'When creating the queue'? __create_bufs and __reqbufs are the functions that create the queue (i.e. allocate the buffers). I meant vb2_queue_init. That's not an option as it is called only once at probe time. And this flag needs to be set every time you setup the queue for streaming, when you stop streaming and when you queue a buffer. Regards, Hans -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[GIT PULL FOR v3.18] Fixes, add teletext to vivid
Various 3.18 fixes and the teletext support for vivid. Regards, Hans The following changes since commit f5281fc81e9a0a3e80b78720c5ae2ed06da3bfae: [media] vpif: Fix compilation with allmodconfig (2014-09-09 18:08:08 -0300) are available in the git repository at: git://linuxtv.org/hverkuil/media_tree.git for-v3.18c for you to fetch changes up to bff227b31543edd2d52d27ac5ff51da53032b3b4: cx23885: fix size helper functions (2014-09-21 11:24:28 +0200) Hans Verkuil (6): DocBook media: fix wrong prototype vivid: add teletext support to VBI capture v4l2-dv-timings: only check standards if non-zero adv7604/adv7842: fix il_vbackporch typo and zero the struct cx23885: fix VBI support. cx23885: fix size helper functions Documentation/DocBook/media/v4l/vidioc-g-edid.xml | 2 +- Documentation/video4linux/vivid.txt | 10 ++ drivers/media/i2c/adv7604.c | 2 +- drivers/media/i2c/adv7842.c | 4 +++- drivers/media/pci/cx23885/cx23885-core.c | 4 ++-- drivers/media/pci/cx23885/cx23885-vbi.c | 8 drivers/media/pci/cx23885/cx23885-video.c | 2 +- drivers/media/pci/cx23885/cx23885.h | 9 ++--- drivers/media/platform/vivid/vivid-vbi-cap.c | 43 -- drivers/media/platform/vivid/vivid-vbi-gen.c | 76 ++- drivers/media/platform/vivid/vivid-vbi-gen.h | 2 +- drivers/media/platform/vivid/vivid-vbi-out.c | 7 --- drivers/media/platform/vivid/vivid-vid-cap.c | 2 +- drivers/media/platform/vivid/vivid-vid-out.c | 2 +- drivers/media/v4l2-core/v4l2-dv-timings.c | 3 ++- 15 files changed, 133 insertions(+), 43 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] saa7134: also capture the WSS signal for 50 Hz VBI capture
The saa7134 driver missed capturing line 23 of the VBI area for the 50 Hz formats. Include that line in the VBI capture. Signed-off-by: Hans Verkuil hans.verk...@cisco.com Tested-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/pci/saa7134/saa7134-vbi.c | 2 +- drivers/media/pci/saa7134/saa7134-video.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/pci/saa7134/saa7134-vbi.c b/drivers/media/pci/saa7134/saa7134-vbi.c index c06dbe1..4f0b101 100644 --- a/drivers/media/pci/saa7134/saa7134-vbi.c +++ b/drivers/media/pci/saa7134/saa7134-vbi.c @@ -43,7 +43,7 @@ MODULE_PARM_DESC(vbibufs,number of vbi buffers, range 2-32); /* -- */ -#define VBI_LINE_COUNT 16 +#define VBI_LINE_COUNT 17 #define VBI_LINE_LENGTH 2048 #define VBI_SCALE 0x200 diff --git a/drivers/media/pci/saa7134/saa7134-video.c b/drivers/media/pci/saa7134/saa7134-video.c index 0cfa2ca..fc4a427 100644 --- a/drivers/media/pci/saa7134/saa7134-video.c +++ b/drivers/media/pci/saa7134/saa7134-video.c @@ -201,7 +201,7 @@ static struct saa7134_format formats[] = { .video_v_start = 24,\ .video_v_stop = 311, \ .vbi_v_start_0 = 7, \ - .vbi_v_stop_0 = 22,\ + .vbi_v_stop_0 = 23,\ .vbi_v_start_1 = 319, \ .src_timing= 4 -- 2.1.0 -- 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: [PATCHv2 1/3] vb2: fix VBI/poll regression
Hi Hans, On Sunday 21 September 2014 11:34:26 Hans Verkuil wrote: On 09/21/2014 11:30 AM, Laurent Pinchart wrote: On Sunday 21 September 2014 11:00:02 Hans Verkuil wrote: On 09/20/2014 09:26 PM, Laurent Pinchart wrote: On Saturday 20 September 2014 21:16:35 Hans Verkuil wrote: From: Hans Verkuil hans.verk...@cisco.com The recent conversion of saa7134 to vb2 unconvered a poll() bug that broke the teletext applications alevt and mtt. These applications expect that calling poll() without having called VIDIOC_STREAMON will cause poll() to return POLLERR. That did not happen in vb2. This patch fixes that behavior. It also fixes what should happen when poll() is called when STREAMON is called but no buffers have been queued. In that case poll() will also return POLLERR, but only for capture queues since output queues will always return POLLOUT anyway in that situation. This brings the vb2 behavior in line with the old videobuf behavior. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/v4l2-core/videobuf2-core.c | 17 ++--- include/media/videobuf2-core.h | 4 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index 7e6aff6..a0aa694 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -977,6 +977,7 @@ static int __reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req) * to the userspace. */ req-count = allocated_buffers; +q-waiting_for_buffers = !V4L2_TYPE_IS_OUTPUT(q-type); return 0; } @@ -1024,6 +1025,7 @@ static int __create_bufs(struct vb2_queue *q, struct v4l2_create_buffers *create memset(q-plane_sizes, 0, sizeof(q-plane_sizes)); memset(q-alloc_ctx, 0, sizeof(q-alloc_ctx)); q-memory = create-memory; +q-waiting_for_buffers = !V4L2_TYPE_IS_OUTPUT(q-type); Wouldn't it be easier to set the flag when creating the queue and in vb2_internal_streamoff() instead of in __create_bufs and __reqbufs ? I'll let you decide. Sorry, I don't follow. 'When creating the queue'? __create_bufs and __reqbufs are the functions that create the queue (i.e. allocate the buffers). I meant vb2_queue_init. That's not an option as it is called only once at probe time. I know :-) And this flag needs to be set every time you setup the queue for streaming, when you stop streaming and when you queue a buffer. I was thinking it would be enough to set the flag when stopping the stream, as it would then be set for the next REQBUFS or CREATE_BUFS operation, but that would break if an application calls QBUF - close() - open() - ... Let's proceed with your patch. -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] saa7134: add saa7134-go7007
This patch adds support to saa7134 for 'WIS Voyager or compatible' PCI boards such as the Sensoray model 614 with which this patch was tested. It is a saa7134-based PCI board with a go7007 MPEG encoder. This was a patch when the go7007 was still in staging and was not applied when go7007 was moved to drivers/media since it needed more work. That work is now done and this last piece of go7007 support can now go in. Signed-off-by: Hans Verkuil hans.verk...@cisco.com Tested-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/pci/saa7134/Makefile | 3 +- drivers/media/pci/saa7134/saa7134-cards.c | 29 ++ drivers/media/pci/saa7134/saa7134-core.c | 10 +- drivers/media/pci/saa7134/saa7134-go7007.c | 532 + drivers/media/pci/saa7134/saa7134.h| 5 + 5 files changed, 576 insertions(+), 3 deletions(-) create mode 100644 drivers/media/pci/saa7134/saa7134-go7007.c diff --git a/drivers/media/pci/saa7134/Makefile b/drivers/media/pci/saa7134/Makefile index 58de9b0..b55bd9a 100644 --- a/drivers/media/pci/saa7134/Makefile +++ b/drivers/media/pci/saa7134/Makefile @@ -4,7 +4,7 @@ saa7134-y +=saa7134-ts.o saa7134-tvaudio.o saa7134-vbi.o saa7134-y += saa7134-video.o saa7134-$(CONFIG_VIDEO_SAA7134_RC) += saa7134-input.o -obj-$(CONFIG_VIDEO_SAA7134) += saa7134.o saa7134-empress.o +obj-$(CONFIG_VIDEO_SAA7134) += saa7134.o saa7134-empress.o saa7134-go7007.o obj-$(CONFIG_VIDEO_SAA7134_ALSA) += saa7134-alsa.o @@ -14,3 +14,4 @@ ccflags-y += -I$(srctree)/drivers/media/i2c ccflags-y += -I$(srctree)/drivers/media/tuners ccflags-y += -I$(srctree)/drivers/media/dvb-core ccflags-y += -I$(srctree)/drivers/media/dvb-frontends +ccflags-y += -I$(srctree)/drivers/media/usb/go7007 diff --git a/drivers/media/pci/saa7134/saa7134-cards.c b/drivers/media/pci/saa7134/saa7134-cards.c index 6e4bdb9..3ca0780 100644 --- a/drivers/media/pci/saa7134/saa7134-cards.c +++ b/drivers/media/pci/saa7134/saa7134-cards.c @@ -5827,6 +5827,29 @@ struct saa7134_board saa7134_boards[] = { .gpio = 0x800, }, }, + [SAA7134_BOARD_WIS_VOYAGER] = { + .name = WIS Voyager or compatible, + .audio_clock= 0x0020, + .tuner_type = TUNER_PHILIPS_TDA8290, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .mpeg = SAA7134_MPEG_GO7007, + .inputs = { { + .name = name_comp1, + .vmux = 0, + .amux = LINE2, + }, { + .name = name_tv, + .vmux = 3, + .amux = TV, + .tv = 1, + }, { + .name = name_svideo, + .vmux = 6, + .amux = LINE1, + } }, + }, }; @@ -7080,6 +7103,12 @@ struct pci_device_id saa7134_pci_tbl[] = { .subdevice= 0x2055, /* AverTV Satellite Hybrid+FM A706 */ .driver_data = SAA7134_BOARD_AVERMEDIA_A706, }, { + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7133, + .subvendor= 0x1905, /* WIS */ + .subdevice= 0x7007, + .driver_data = SAA7134_BOARD_WIS_VOYAGER, + }, { /* --- boards without eeprom + subsystem ID --- */ .vendor = PCI_VENDOR_ID_PHILIPS, .device = PCI_DEVICE_ID_PHILIPS_SAA7134, diff --git a/drivers/media/pci/saa7134/saa7134-core.c b/drivers/media/pci/saa7134/saa7134-core.c index 9ff03a6..236ed72 100644 --- a/drivers/media/pci/saa7134/saa7134-core.c +++ b/drivers/media/pci/saa7134/saa7134-core.c @@ -160,6 +160,8 @@ static void request_module_async(struct work_struct *work){ request_module(saa7134-empress); if (card_is_dvb(dev)) request_module(saa7134-dvb); + if (card_is_go7007(dev)) + request_module(saa7134-go7007); if (alsa) { if (dev-pci-device != PCI_DEVICE_ID_PHILIPS_SAA7130) request_module(saa7134-alsa); @@ -563,8 +565,12 @@ static irqreturn_t saa7134_irq(int irq, void *dev_id) saa7134_irq_vbi_done(dev,status); if ((report SAA7134_IRQ_REPORT_DONE_RA2) - card_has_mpeg(dev)) - saa7134_irq_ts_done(dev,status); + card_has_mpeg(dev)) { + if (dev-mops-irq_ts_done != NULL) + dev-mops-irq_ts_done(dev, status); + else + saa7134_irq_ts_done(dev, status); + } if (report SAA7134_IRQ_REPORT_GPIO16) {
Re: vb2_reqbufs() is not allowing more than VIDEO_MAX_FRAME
On 07/21/2014 08:03 AM, Divneil Wadhawan wrote: Hi Hans, This patch is all messed up and doesn't apply. Check your mailer settings: it clearly replaced hard tabs by a space. Can you repost? I tried to find out if I can change the mailer settings. Seems, that is the problem. I tried using mutt, but, seems the configuration is missing. If you have a simple method, on using mutt, I will send it from there, as, mutt is respecting the TAB spaces. I didn't spend much time with it for time being. Ping? If you really can't get your mailer to behave, then mail it as an attachment. Regards, Hans Regards, Divneil -- 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 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/3] IT930x USB DVB-T2/C tuner
This patch set adds support for IT930x reference design. It contains IT9303 USB bridge, Si2168-B40 demodulator and Si2147-A30 tuner. The patches should be applied on top of Antti's af9035 branch. http://git.linuxtv.org/cgit.cgi/anttip/media_tree.git/log/?h=af9035 Cc: cr...@iki.fi Olli Salonen (3): si2157: Add support for Si2147-A30 af9035: Add possibility to define which I2C adapter to use af9035: Add support for IT930x USB bridge drivers/media/dvb-core/dvb-usb-ids.h | 1 + drivers/media/tuners/si2157.c | 13 +- drivers/media/tuners/si2157.h | 2 +- drivers/media/tuners/si2157_priv.h| 2 +- drivers/media/usb/dvb-usb-v2/af9035.c | 333 +++--- drivers/media/usb/dvb-usb-v2/af9035.h | 6 + 6 files changed, 331 insertions(+), 26 deletions(-) -- 1.9.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
[PATCH 1/3] si2157: Add support for Si2147-A30
This patch adds support for Si2147-A30 tuner. Fairly trivial, no firmware needed for this tuner. However, command 14 00 02 07 01 00 seems to be mandatory. On Si2157 and Si2158 the value 0x0100 is the default value, so this patch does not impact the existing tuners/devices. On Si2147 the default is 0x and I can't get a lock with that value. Signed-off-by: Olli Salonen olli.salo...@iki.fi Cc: cr...@iki.fi --- drivers/media/tuners/si2157.c | 13 +++-- drivers/media/tuners/si2157.h | 2 +- drivers/media/tuners/si2157_priv.h | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c index efb5cce..41965c7 100644 --- a/drivers/media/tuners/si2157.c +++ b/drivers/media/tuners/si2157.c @@ -1,5 +1,5 @@ /* - * Silicon Labs Si2157/2158 silicon tuner driver + * Silicon Labs Si2147/2157/2158 silicon tuner driver * * Copyright (C) 2014 Antti Palosaari cr...@iki.fi * @@ -110,12 +110,14 @@ static int si2157_init(struct dvb_frontend *fe) #define SI2158_A20 ('A' 24 | 58 16 | '2' 8 | '0' 0) #define SI2157_A30 ('A' 24 | 57 16 | '3' 8 | '0' 0) + #define SI2147_A30 ('A' 24 | 47 16 | '3' 8 | '0' 0) switch (chip_id) { case SI2158_A20: fw_file = SI2158_A20_FIRMWARE; break; case SI2157_A30: + case SI2147_A30: goto skip_fw_download; break; default: @@ -258,7 +260,14 @@ static int si2157_set_params(struct dvb_frontend *fe) if (s-inversion) cmd.args[5] = 0x01; cmd.wlen = 6; - cmd.rlen = 1; + cmd.rlen = 4; + ret = si2157_cmd_execute(s, cmd); + if (ret) + goto err; + + memcpy(cmd.args, \x14\x00\x02\x07\x01\x00, 6); + cmd.wlen = 6; + cmd.rlen = 4; ret = si2157_cmd_execute(s, cmd); if (ret) goto err; diff --git a/drivers/media/tuners/si2157.h b/drivers/media/tuners/si2157.h index 6da4d5d..d3b19ca 100644 --- a/drivers/media/tuners/si2157.h +++ b/drivers/media/tuners/si2157.h @@ -1,5 +1,5 @@ /* - * Silicon Labs Si2157/2158 silicon tuner driver + * Silicon Labs Si2147/2157/2158 silicon tuner driver * * Copyright (C) 2014 Antti Palosaari cr...@iki.fi * diff --git a/drivers/media/tuners/si2157_priv.h b/drivers/media/tuners/si2157_priv.h index 3ddab5e..02350f8 100644 --- a/drivers/media/tuners/si2157_priv.h +++ b/drivers/media/tuners/si2157_priv.h @@ -1,5 +1,5 @@ /* - * Silicon Labs Si2157/2158 silicon tuner driver + * Silicon Labs Si2147/2157/2158 silicon tuner driver * * Copyright (C) 2014 Antti Palosaari cr...@iki.fi * -- 1.9.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
[PATCH 2/3] af9035: Add possibility to define which I2C adapter to use
Some I2C tuner drivers require that the I2C device of the tuner is added to the I2C adapter of the demodulator (Si2168+Si2157 for example). Add possibility to tell af9035_add_i2c_dev which I2C adapter should be used. Cc: cr...@iki.fi Signed-off-by: Olli Salonen olli.salo...@iki.fi --- drivers/media/usb/dvb-usb-v2/af9035.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c index 440ecb4..c50d27d 100644 --- a/drivers/media/usb/dvb-usb-v2/af9035.c +++ b/drivers/media/usb/dvb-usb-v2/af9035.c @@ -194,12 +194,11 @@ static int af9035_wr_reg_mask(struct dvb_usb_device *d, u32 reg, u8 val, } static int af9035_add_i2c_dev(struct dvb_usb_device *d, char *type, u8 addr, - void *platform_data) + void *platform_data, struct i2c_adapter *adapter) { int ret, num; struct state *state = d_to_priv(d); struct i2c_client *client; - struct i2c_adapter *adapter = d-i2c_adap; struct i2c_board_info board_info = { .addr = addr, .platform_data = platform_data, @@ -1091,7 +1090,7 @@ static int af9035_frontend_attach(struct dvb_usb_adapter *adap) state-af9033_config[adap-id].fe = adap-fe[0]; state-af9033_config[adap-id].ops = state-ops; ret = af9035_add_i2c_dev(d, af9033, state-af9033_i2c_addr[adap-id], - state-af9033_config[adap-id]); + state-af9033_config[adap-id], d-i2c_adap); if (ret) goto err; @@ -1382,7 +1381,7 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap) ret = af9035_add_i2c_dev(d, it913x, state-af9033_i2c_addr[adap-id] 1, - it913x_config); + it913x_config, d-i2c_adap); if (ret) goto err; @@ -1407,7 +1406,7 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap) ret = af9035_add_i2c_dev(d, it913x, state-af9033_i2c_addr[adap-id] 1, - it913x_config); + it913x_config, d-i2c_adap); if (ret) goto err; -- 1.9.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
[PATCH 3/3] af9035: Add support for IT930x USB bridge
Add support for IT930x USB bridge and IT9303 reference design. It is a DVB-T/T2/C tuner with the following components: - IT9303 USB bridge - Si2168-B40 demodulator - Si2147-A30 tuner The IT9303 requires firmware that can be downloaded here: http://trsqr.net/olli/linux/firmwares/it930x/ The Si2168-B40 requires firmware, but the one that is used by PCTV 292e can be used. http://palosaari.fi/linux/v4l-dvb/firmware/Si2168/Si2168-B40/ The Si2147-A30 tuner does not require firmware loading. Cc: cr...@iki.fi Signed-off-by: Olli Salonen olli.salo...@iki.fi --- drivers/media/dvb-core/dvb-usb-ids.h | 1 + drivers/media/usb/dvb-usb-v2/af9035.c | 324 -- drivers/media/usb/dvb-usb-v2/af9035.h | 6 + 3 files changed, 314 insertions(+), 17 deletions(-) diff --git a/drivers/media/dvb-core/dvb-usb-ids.h b/drivers/media/dvb-core/dvb-usb-ids.h index d484a51..e07a84e 100644 --- a/drivers/media/dvb-core/dvb-usb-ids.h +++ b/drivers/media/dvb-core/dvb-usb-ids.h @@ -144,6 +144,7 @@ #define USB_PID_ITETECH_IT9135 0x9135 #define USB_PID_ITETECH_IT9135_90050x9005 #define USB_PID_ITETECH_IT9135_90060x9006 +#define USB_PID_ITETECH_IT9303 0x9306 #define USB_PID_KWORLD_399U0xe399 #define USB_PID_KWORLD_399U_2 0xe400 #define USB_PID_KWORLD_395U0xe396 diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c index c50d27d..00758c8 100644 --- a/drivers/media/usb/dvb-usb-v2/af9035.c +++ b/drivers/media/usb/dvb-usb-v2/af9035.c @@ -290,7 +290,7 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap, return -EAGAIN; /* -* I2C sub header is 5 bytes long. Meaning of those bytes are: +* AF9035 I2C sub header is 5 bytes long. Meaning of those bytes are: * 0: data len * 1: I2C addr 1 * 2: reg addr len @@ -317,6 +317,12 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap, * bus. I2C subsystem does not allow register multiple devices to same * bus, having same slave address. Due to that we reuse demod address, * shifted by one bit, on that case. +* +* For IT930x we use a different command and the sub header is +* different as well: +* 0: data len +* 1: I2C bus (0x03 seems to be only value used) +* 2: I2C addr 1 */ #define AF9035_IS_I2C_XFER_WRITE_READ(_msg, _num) \ (_num == 2 !(_msg[0].flags I2C_M_RD) (_msg[1].flags I2C_M_RD)) @@ -348,13 +354,24 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap, struct usb_req req = { CMD_I2C_RD, 0, 5 + msg[0].len, buf, msg[1].len, msg[1].buf }; + if (state-chip_type == 0x9306) { + req.cmd = CMD_GENERIC_I2C_RD; + req.wlen = 3 + msg[0].len; + } req.mbox |= ((msg[0].addr 0x80)3); + buf[0] = msg[1].len; - buf[1] = msg[0].addr 1; - buf[2] = 0x00; /* reg addr len */ - buf[3] = 0x00; /* reg addr MSB */ - buf[4] = 0x00; /* reg addr LSB */ - memcpy(buf[5], msg[0].buf, msg[0].len); + if (state-chip_type == 0x9306) { + buf[1] = 0x03; /* I2C bus */ + buf[2] = msg[0].addr 1; + memcpy(buf[3], msg[0].buf, msg[0].len); + } else { + buf[1] = msg[0].addr 1; + buf[2] = 0x00; /* reg addr len */ + buf[3] = 0x00; /* reg addr MSB */ + buf[4] = 0x00; /* reg addr LSB */ + memcpy(buf[5], msg[0].buf, msg[0].len); + } ret = af9035_ctrl_msg(d, req); } } else if (AF9035_IS_I2C_XFER_WRITE(msg, num)) { @@ -380,13 +397,24 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap, struct usb_req req = { CMD_I2C_WR, 0, 5 + msg[0].len, buf, 0, NULL }; + if (state-chip_type == 0x9306) { + req.cmd = CMD_GENERIC_I2C_WR; + req.wlen = 3 + msg[0].len; + } + req.mbox |= ((msg[0].addr 0x80)3); buf[0] = msg[0].len; - buf[1] = msg[0].addr 1; - buf[2] = 0x00; /* reg addr len */ - buf[3] = 0x00; /* reg addr MSB */ - buf[4] = 0x00;
[PATCH] v4l2-ioctl.c: fix inverted condition
v4l_print_ext_controls() would print the 'size' if it was 0 and 'value' if size was non-zero, but it should have been the other way around. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/v4l2-core/v4l2-ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 46f4c04..9ccb19a 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -562,7 +562,7 @@ static void v4l_print_ext_controls(const void *arg, bool write_only) pr_cont(class=0x%x, count=%d, error_idx=%d, p-ctrl_class, p-count, p-error_idx); for (i = 0; i p-count; i++) { - if (p-controls[i].size) + if (!p-controls[i].size) pr_cont(, id/val=0x%x/0x%x, p-controls[i].id, p-controls[i].value); else -- 2.1.0 -- 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
RFC: vb2: replace alloc_ctx by struct device * in vb2_queue
Hi Marek, Pawel, Currently for dma_config (and the dma_sg code that I posted before) drivers have to allocate a alloc_ctx context, but in practice that just contains a device pointer. Is there any reason why we can't just change in struct vb2_queue: void*alloc_ctx[VIDEO_MAX_PLANES]; to: struct device *alloc_ctx[VIDEO_MAX_PLANES]; or possibly even just: struct device *alloc_ctx; That simplifies the code quite a bit and I don't see and need for anything else. The last option would make it impossible to have different allocation contexts for different planes, but that might be something that Samsumg needs. Regards, Hans -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Re: [PATCH 3/4 v4] support for DVBSky dvb-s2 usb: add dvb-usb-v2driver for DVBSky dvb-s2 box, no ci support.
Hello Antti, Could you collect the following patches? It will make to support DVBSky DVB-S2 usb device. https://patchwork.linuxtv.org/patch/25313/ https://patchwork.linuxtv.org/patch/25202/ https://patchwork.linuxtv.org/patch/25201/ BR, Max Looks OK Reviewed-by: Antti Palosaari cr...@iki.fi regards Antti On 08/11/2014 07:45 AM, nibble.max wrote: remove ci support part in v1 patch. hook demod read status and set voltage operations. add m88ts2022 select in Kconfig. move usb buffer into state for usb ctrl. make checkpatch.pl happy. Signed-off-by: Nibble Max nibble@gmail.com --- drivers/media/usb/dvb-usb-v2/Kconfig | 7 + drivers/media/usb/dvb-usb-v2/Makefile | 3 + drivers/media/usb/dvb-usb-v2/dvbsky.c | 460 ++ 3 files changed, 470 insertions(+) diff --git a/drivers/media/usb/dvb-usb-v2/Kconfig b/drivers/media/usb/dvb-usb-v2/Kconfig index 66645b0..5b34323 100644 --- a/drivers/media/usb/dvb-usb-v2/Kconfig +++ b/drivers/media/usb/dvb-usb-v2/Kconfig @@ -141,3 +141,10 @@ config DVB_USB_RTL28XXU help Say Y here to support the Realtek RTL28xxU DVB USB receiver. +config DVB_USB_DVBSKY +tristate DVBSky USB support +depends on DVB_USB_V2 +select DVB_M88DS3103 if MEDIA_SUBDRV_AUTOSELECT +select MEDIA_TUNER_M88TS2022 if MEDIA_SUBDRV_AUTOSELECT +help + Say Y here to support the USB receivers from DVBSky. diff --git a/drivers/media/usb/dvb-usb-v2/Makefile b/drivers/media/usb/dvb-usb-v2/Makefile index bc38f03..f10d4df 100644 --- a/drivers/media/usb/dvb-usb-v2/Makefile +++ b/drivers/media/usb/dvb-usb-v2/Makefile @@ -37,6 +37,9 @@ obj-$(CONFIG_DVB_USB_MXL111SF) += mxl111sf-tuner.o dvb-usb-rtl28xxu-objs := rtl28xxu.o obj-$(CONFIG_DVB_USB_RTL28XXU) += dvb-usb-rtl28xxu.o +dvb-usb-dvbsky-objs := dvbsky.o +obj-$(CONFIG_DVB_USB_DVBSKY) += dvb-usb-dvbsky.o + ccflags-y += -I$(srctree)/drivers/media/dvb-core ccflags-y += -I$(srctree)/drivers/media/dvb-frontends ccflags-y += -I$(srctree)/drivers/media/tuners diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c b/drivers/media/usb/dvb-usb-v2/dvbsky.c new file mode 100644 index 000..34688c8 --- /dev/null +++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c @@ -0,0 +1,460 @@ +/* + * Driver for DVBSky USB2.0 receiver + * + * Copyright (C) 2013 Max nibble nibble@gmail.com + * + *This program is free software; you can redistribute it and/or modify + *it under the terms of the GNU General Public License as published by + *the Free Software Foundation; either version 2 of the License, or + *(at your option) any later version. + * + *This program is distributed in the hope that it will be useful, + *but WITHOUT ANY WARRANTY; without even the implied warranty of + *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + *GNU General Public License for more details. + * + *You should have received a copy of the GNU General Public License + *along with this program; if not, write to the Free Software + *Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include dvb_usb.h +#include m88ds3103.h +#include m88ts2022.h + +#define DVBSKY_MSG_DELAY0/*2000*/ +#define DVBSKY_BUF_LEN 64 + +DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); + +struct dvbsky_state { +struct mutex stream_mutex; +u8 ibuf[DVBSKY_BUF_LEN]; +u8 obuf[DVBSKY_BUF_LEN]; +u8 last_lock; +struct i2c_client *i2c_client_tuner; + +/* fe hook functions*/ +int (*fe_set_voltage)(struct dvb_frontend *fe, +fe_sec_voltage_t voltage); +int (*fe_read_status)(struct dvb_frontend *fe, +fe_status_t *status); +}; + +static int dvbsky_usb_generic_rw(struct dvb_usb_device *d, +u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen) +{ +int ret; +struct dvbsky_state *state = d_to_priv(d); + +mutex_lock(d-usb_mutex); +if (wlen != 0) +memcpy(state-obuf, wbuf, wlen); + +ret = dvb_usbv2_generic_rw_locked(d, state-obuf, wlen, +state-ibuf, rlen); + +if (!ret (rlen != 0)) +memcpy(rbuf, state-ibuf, rlen); + +mutex_unlock(d-usb_mutex); +return ret; +} + +static int dvbsky_stream_ctrl(struct dvb_usb_device *d, u8 onoff) +{ +struct dvbsky_state *state = d_to_priv(d); +int ret; +u8 obuf_pre[3] = { 0x37, 0, 0 }; +u8 obuf_post[3] = { 0x36, 3, 0 }; + +mutex_lock(state-stream_mutex); +ret = dvbsky_usb_generic_rw(d, obuf_pre, 3, NULL, 0); +if (!ret onoff) { +msleep(20); +ret = dvbsky_usb_generic_rw(d, obuf_post, 3, NULL, 0); +} +mutex_unlock(state-stream_mutex); +return ret; +} + +static int dvbsky_streaming_ctrl(struct dvb_frontend *fe, int onoff) +{ +struct dvb_usb_device *d = fe_to_d(fe); + +return dvbsky_stream_ctrl(d, (onoff == 0) ? 0 : 1); +} + +/* GPIO */
Re: [PATCH 3/4 v4] support for DVBSky dvb-s2 usb: add dvb-usb-v2driver for DVBSky dvb-s2 box, no ci support.
Moikka Max, I have asked Mauro many times to handle these waiting patches, lastly yesterday. Mauro's ETA is tomorrow, Monday. If it does not happen tomorrow, I will pick those and send PULL request as those PULL request generally go higher priority than patches in patchwork :) There is also some other patches, mainly from Olli, which I am not going to pull my tree before Mauro commits my pending PULL requests. regards Antti On 09/21/2014 04:51 PM, Nibble Max wrote: Hello Antti, Could you collect the following patches? It will make to support DVBSky DVB-S2 usb device. https://patchwork.linuxtv.org/patch/25313/ https://patchwork.linuxtv.org/patch/25202/ https://patchwork.linuxtv.org/patch/25201/ BR, Max Looks OK Reviewed-by: Antti Palosaari cr...@iki.fi regards Antti On 08/11/2014 07:45 AM, nibble.max wrote: remove ci support part in v1 patch. hook demod read status and set voltage operations. add m88ts2022 select in Kconfig. move usb buffer into state for usb ctrl. make checkpatch.pl happy. Signed-off-by: Nibble Max nibble@gmail.com --- drivers/media/usb/dvb-usb-v2/Kconfig | 7 + drivers/media/usb/dvb-usb-v2/Makefile | 3 + drivers/media/usb/dvb-usb-v2/dvbsky.c | 460 ++ 3 files changed, 470 insertions(+) diff --git a/drivers/media/usb/dvb-usb-v2/Kconfig b/drivers/media/usb/dvb-usb-v2/Kconfig index 66645b0..5b34323 100644 --- a/drivers/media/usb/dvb-usb-v2/Kconfig +++ b/drivers/media/usb/dvb-usb-v2/Kconfig @@ -141,3 +141,10 @@ config DVB_USB_RTL28XXU help Say Y here to support the Realtek RTL28xxU DVB USB receiver. +config DVB_USB_DVBSKY + tristate DVBSky USB support + depends on DVB_USB_V2 + select DVB_M88DS3103 if MEDIA_SUBDRV_AUTOSELECT + select MEDIA_TUNER_M88TS2022 if MEDIA_SUBDRV_AUTOSELECT + help + Say Y here to support the USB receivers from DVBSky. diff --git a/drivers/media/usb/dvb-usb-v2/Makefile b/drivers/media/usb/dvb-usb-v2/Makefile index bc38f03..f10d4df 100644 --- a/drivers/media/usb/dvb-usb-v2/Makefile +++ b/drivers/media/usb/dvb-usb-v2/Makefile @@ -37,6 +37,9 @@ obj-$(CONFIG_DVB_USB_MXL111SF) += mxl111sf-tuner.o dvb-usb-rtl28xxu-objs := rtl28xxu.o obj-$(CONFIG_DVB_USB_RTL28XXU) += dvb-usb-rtl28xxu.o +dvb-usb-dvbsky-objs := dvbsky.o +obj-$(CONFIG_DVB_USB_DVBSKY) += dvb-usb-dvbsky.o + ccflags-y += -I$(srctree)/drivers/media/dvb-core ccflags-y += -I$(srctree)/drivers/media/dvb-frontends ccflags-y += -I$(srctree)/drivers/media/tuners diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c b/drivers/media/usb/dvb-usb-v2/dvbsky.c new file mode 100644 index 000..34688c8 --- /dev/null +++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c @@ -0,0 +1,460 @@ +/* + * Driver for DVBSky USB2.0 receiver + * + * Copyright (C) 2013 Max nibble nibble@gmail.com + * + *This program is free software; you can redistribute it and/or modify + *it under the terms of the GNU General Public License as published by + *the Free Software Foundation; either version 2 of the License, or + *(at your option) any later version. + * + *This program is distributed in the hope that it will be useful, + *but WITHOUT ANY WARRANTY; without even the implied warranty of + *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + *GNU General Public License for more details. + * + *You should have received a copy of the GNU General Public License + *along with this program; if not, write to the Free Software + *Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include dvb_usb.h +#include m88ds3103.h +#include m88ts2022.h + +#define DVBSKY_MSG_DELAY 0/*2000*/ +#define DVBSKY_BUF_LEN 64 + +DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); + +struct dvbsky_state { + struct mutex stream_mutex; + u8 ibuf[DVBSKY_BUF_LEN]; + u8 obuf[DVBSKY_BUF_LEN]; + u8 last_lock; + struct i2c_client *i2c_client_tuner; + + /* fe hook functions*/ + int (*fe_set_voltage)(struct dvb_frontend *fe, + fe_sec_voltage_t voltage); + int (*fe_read_status)(struct dvb_frontend *fe, + fe_status_t *status); +}; + +static int dvbsky_usb_generic_rw(struct dvb_usb_device *d, + u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen) +{ + int ret; + struct dvbsky_state *state = d_to_priv(d); + + mutex_lock(d-usb_mutex); + if (wlen != 0) + memcpy(state-obuf, wbuf, wlen); + + ret = dvb_usbv2_generic_rw_locked(d, state-obuf, wlen, + state-ibuf, rlen); + + if (!ret (rlen != 0)) + memcpy(rbuf, state-ibuf, rlen); + + mutex_unlock(d-usb_mutex); + return ret; +} + +static int dvbsky_stream_ctrl(struct dvb_usb_device *d, u8 onoff) +{ + struct dvbsky_state *state = d_to_priv(d); + int ret; + u8 obuf_pre[3] = { 0x37, 0, 0 }; + u8 obuf_post[3] = { 0x36, 3, 0 }; + +
Running Technisat DVB-S2 on ARM-NAS
Hi, I want to turn my Netgear ReadyNAS RN104 into a VDR. I already run a self made kernel 3.16.3) and plain debian on it. For hardware and software details see http://natisbad.org/NAS3/ I recently compiled those DVB modules into the kernel. And after a lot of struggle to get a clean build, I succeeded in loading the modules: dvb_usb_technisat_usb2, dvb_usb, dvb_core, stv090x, rc_core but device recognition somehow does not fully work. usb 2-1: new high-speed USB device number 3 using xhci_hcd usb 2-1: New USB device found, idVendor=14f7, idProduct=0500 usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 usb 2-1: Product: TechniSat USB device usb 2-1: Manufacturer: TechniSat Digital usb 2-1: SerialNumber: technisat-usb2: set alternate setting technisat-usb2: firmware version: 17.63 dvb-usb: found a 'Technisat SkyStar USB HD (DVB-S/S2)' in warm state. dvb-usb: will pass the complete MPEG2 transport stream to the software demuxer. dvb-usb: Technisat SkyStar USB HD (DVB-S/S2) error while loading driver (-12) usbcore: registered new interface driver dvb_usb_technisat_usb2 How my I find out more about the error -12? It's a lot of wrapped return ret in the code... Is there any way of enabling more logging? I believe it comes from the dvb-usb-technisat-usb2 module, but there is no c file? thanks. Jan -- 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: Running Technisat DVB-S2 on ARM-NAS
On 09/21/2014 05:26 PM, JPT wrote: Hi, I want to turn my Netgear ReadyNAS RN104 into a VDR. I already run a self made kernel 3.16.3) and plain debian on it. For hardware and software details see http://natisbad.org/NAS3/ I recently compiled those DVB modules into the kernel. And after a lot of struggle to get a clean build, I succeeded in loading the modules: dvb_usb_technisat_usb2, dvb_usb, dvb_core, stv090x, rc_core but device recognition somehow does not fully work. usb 2-1: new high-speed USB device number 3 using xhci_hcd usb 2-1: New USB device found, idVendor=14f7, idProduct=0500 usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 usb 2-1: Product: TechniSat USB device usb 2-1: Manufacturer: TechniSat Digital usb 2-1: SerialNumber: technisat-usb2: set alternate setting technisat-usb2: firmware version: 17.63 dvb-usb: found a 'Technisat SkyStar USB HD (DVB-S/S2)' in warm state. dvb-usb: will pass the complete MPEG2 transport stream to the software demuxer. dvb-usb: Technisat SkyStar USB HD (DVB-S/S2) error while loading driver (-12) usbcore: registered new interface driver dvb_usb_technisat_usb2 How my I find out more about the error -12? It's a lot of wrapped return ret in the code... Is there any way of enabling more logging? I believe it comes from the dvb-usb-technisat-usb2 module, but there is no c file? http://www.virtsync.com/c-error-codes-include-errno #define ENOMEM 12 /* Out of memory */ Likely allocating USB stream buffers fails. You could try request smaller buffers. Drop count to 1 and test. Drop framesperurb to 1 and test. Drop framesize to 1 and test. Surely streaming will not work if all buffers are totally wrong and too small, but you will see if it is due to big usb buffers. Then you could try optimize buffers smaller. .stream = { .type = USB_ISOC, .count = 8, .endpoint = 0x2, .u = { .isoc = { .framesperurb = 32, .framesize = 2048, .interval = 1, } } }, 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
[RFC PATCH 07/11] v4l2-ctrls: implement 'ignore after use' support.
From: Hans Verkuil hans.verk...@cisco.com Sometimes you want to apply a value every time v4l2_ctrl_apply_store is called, and sometimes you want to apply that value only once. This adds support for that feature. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/v4l2-core/v4l2-ctrls.c | 75 drivers/media/v4l2-core/v4l2-ioctl.c | 14 +++ include/media/v4l2-ctrls.h | 12 ++ 3 files changed, 79 insertions(+), 22 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index e5dccf2..21560b0 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -1475,6 +1475,7 @@ static int ptr_to_user(struct v4l2_ext_control *c, static int cur_to_user(struct v4l2_ext_control *c, struct v4l2_ctrl *ctrl) { + c-flags = 0; return ptr_to_user(c, ctrl, ctrl-p_cur); } @@ -1482,8 +1483,13 @@ static int cur_to_user(struct v4l2_ext_control *c, static int store_to_user(struct v4l2_ext_control *c, struct v4l2_ctrl *ctrl, unsigned store) { + c-flags = 0; if (store == 0) return ptr_to_user(c, ctrl, ctrl-p_new); + if (test_bit(store - 1, ctrl-cluster[0]-ignore_store_after_use)) + c-flags |= V4L2_EXT_CTRL_FL_IGN_STORE_AFTER_USE; + if (test_bit(store - 1, ctrl-cluster[0]-ignore_store)) + c-flags |= V4L2_EXT_CTRL_FL_IGN_STORE; return ptr_to_user(c, ctrl, ctrl-p_stores[store - 1]); } @@ -1491,6 +1497,7 @@ static int store_to_user(struct v4l2_ext_control *c, static int new_to_user(struct v4l2_ext_control *c, struct v4l2_ctrl *ctrl) { + c-flags = 0; return ptr_to_user(c, ctrl, ctrl-p_new); } @@ -1546,6 +1553,8 @@ static int user_to_ptr(struct v4l2_ext_control *c, static int user_to_new(struct v4l2_ext_control *c, struct v4l2_ctrl *ctrl) { + ctrl-cluster[0]-new_ignore_store_after_use = + c-flags V4L2_EXT_CTRL_FL_IGN_STORE_AFTER_USE; return user_to_ptr(c, ctrl, ctrl-p_new); } @@ -1597,8 +1606,11 @@ static void new_to_cur(struct v4l2_fh *fh, struct v4l2_ctrl *ctrl, u32 ch_flags) /* Helper function: copy the new control value to the store */ static void new_to_store(struct v4l2_ctrl *ctrl) { + if (ctrl == NULL) + return; + /* has_changed is set by cluster_changed */ - if (ctrl ctrl-has_changed) + if (ctrl-has_changed) ptr_to_ptr(ctrl, ctrl-p_new, ctrl-p_stores[ctrl-store - 1]); } @@ -2328,6 +2340,12 @@ void v4l2_ctrl_cluster(unsigned ncontrols, struct v4l2_ctrl **controls) for (i = 0; i ncontrols; i++) { if (controls[i]) { + /* +* All controls in a cluster must have the same +* V4L2_CTRL_FLAG_CAN_STORE flag value. +*/ + WARN_ON((controls[0]-flags controls[i]-flags) + V4L2_CTRL_FLAG_CAN_STORE); controls[i]-cluster = controls; controls[i]-ncontrols = ncontrols; if (controls[i]-flags V4L2_CTRL_FLAG_VOLATILE) @@ -2850,6 +2868,10 @@ static int extend_store(struct v4l2_ctrl *ctrl, unsigned stores) unsigned s, idx; union v4l2_ctrl_ptr *p; + /* round up to the next multiple of 4 */ + stores = (stores + 3) ~3; + if (stores V4L2_CTRLS_MAX_STORES) + return -EINVAL; p = kcalloc(stores, sizeof(union v4l2_ctrl_ptr), GFP_KERNEL); if (p == NULL) return -ENOMEM; @@ -2868,6 +2890,7 @@ static int extend_store(struct v4l2_ctrl *ctrl, unsigned stores) memcpy(p, ctrl-p_stores, ctrl-nr_of_stores * sizeof(union v4l2_ctrl_ptr)); kfree(ctrl-p_stores); ctrl-p_stores = p; + bitmap_set(ctrl-ignore_store, ctrl-nr_of_stores, stores - ctrl-nr_of_stores); ctrl-nr_of_stores = stores; return 0; } @@ -3081,21 +3104,33 @@ static int try_or_set_cluster(struct v4l2_fh *fh, struct v4l2_ctrl *master, ret = call_op(master, try_ctrl); - /* Don't set if there is no change */ - if (ret || !set || !cluster_changed(master)) - return ret; - ret = call_op(master, s_ctrl); - if (ret) + if (ret || !set) return ret; - /* If OK, then make the new values permanent. */ - update_flag = is_cur_manual(master) != is_new_manual(master); - for (i = 0; i master-ncontrols; i++) { - if (store) - new_to_store(master-cluster[i]); + /* Don't set if there is no change */ + if (cluster_changed(master)) { + ret = call_op(master, s_ctrl); + if (ret) + return ret; + +
[RFC PATCH 08/11] vivid: add test config store for the contrast control
From: Hans Verkuil hans.verk...@cisco.com Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/platform/vivid/vivid-ctrls.c | 4 drivers/media/platform/vivid/vivid-vid-cap.c | 1 + 2 files changed, 5 insertions(+) diff --git a/drivers/media/platform/vivid/vivid-ctrls.c b/drivers/media/platform/vivid/vivid-ctrls.c index d5cbf00..42376a1 100644 --- a/drivers/media/platform/vivid/vivid-ctrls.c +++ b/drivers/media/platform/vivid/vivid-ctrls.c @@ -255,6 +255,9 @@ static int vivid_user_vid_s_ctrl(struct v4l2_ctrl *ctrl) { struct vivid_dev *dev = container_of(ctrl-handler, struct vivid_dev, ctrl_hdl_user_vid); + if (ctrl-store) + return 0; + switch (ctrl-id) { case V4L2_CID_BRIGHTNESS: dev-input_brightness[dev-input] = ctrl-val - dev-input * 128; @@ -1199,6 +1202,7 @@ int vivid_create_controls(struct vivid_dev *dev, bool show_ccs_cap, dev-input_brightness[i] = 128; dev-contrast = v4l2_ctrl_new_std(hdl_user_vid, vivid_user_vid_ctrl_ops, V4L2_CID_CONTRAST, 0, 255, 1, 128); + v4l2_ctrl_can_store(dev-contrast); dev-saturation = v4l2_ctrl_new_std(hdl_user_vid, vivid_user_vid_ctrl_ops, V4L2_CID_SATURATION, 0, 255, 1, 128); dev-hue = v4l2_ctrl_new_std(hdl_user_vid, vivid_user_vid_ctrl_ops, diff --git a/drivers/media/platform/vivid/vivid-vid-cap.c b/drivers/media/platform/vivid/vivid-vid-cap.c index b016aed..95eda68 100644 --- a/drivers/media/platform/vivid/vivid-vid-cap.c +++ b/drivers/media/platform/vivid/vivid-vid-cap.c @@ -197,6 +197,7 @@ static int vid_cap_buf_prepare(struct vb2_buffer *vb) vb2_set_plane_payload(vb, p, size); vb-v4l2_planes[p].data_offset = dev-fmt_cap-data_offset[p]; } + v4l2_ctrl_apply_store(dev-vid_cap_dev.ctrl_handler, vb-v4l2_buf.config_store); return 0; } -- 2.1.0 -- 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
[RFC PATCH 00/11] Add configuration store support
This patch series adds support for configuration stores to the control framework. This allows you to store control values for a particular configuration (up to VIDEO_MAX_FRAME configuration stores are currently supported). When you queue a new buffer you can supply the store ID and the driver will apply all controls for that configuration store. When you set a new value for a configuration store then you can choose whether this is 'fire and forget', i.e. after the driver applies the control value for that store it won't be applied again until a new value is set. Or you can set the value every time that configuration store is applied. The first 7 patches add support for this in the API and in v4l2-ctrls.c. Patch 8 adds configure store support for the contrast control in the vivid driver. Patches 9-11 add support for crop/compose controls to v4l2-ctrls and vivid as a proof-of-concept. This allows you to play around with things like digital zoom by manipulating crop and compose rectangles for specific buffers. It's basically a hack just to allow me to test this so don't bother reviewing these last three patches. This patch series is available here: http://git.linuxtv.org/cgit.cgi/hverkuil/media_tree.git/log/?h=confstore A patched version of qv4l2 and v4l2-ctl that add config store support is available here: http://git.linuxtv.org/cgit.cgi/hverkuil/v4l-utils.git/log/?h=confstore The easiest way to test this is with vivid. Load vivid, then run the patched qv4l2. This will associate every queued buffer with a corresponding config store. There are 4 buffers, so stores 1-4 are available for use. You can change the contrast value for a buffer as follows: v4l2-ctl --store=1 -c contrast=90 For a fire-and-forget you add the --ignore-after-use option: v4l2-ctl --store=1 -c contrast=90 --ignore-after-use So you can cycle between different contrast values as follows: v4l2-ctl --store=1 -c contrast=90 v4l2-ctl --store=2 -c contrast=100 v4l2-ctl --store=3 -c contrast=110 v4l2-ctl --store=4 -c contrast=120 This patch series and the API enhancements will be discussed during the upcoming media workshop. Regards, Hans -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC PATCH 04/11] v4l2-ctrls: add config store support
From: Hans Verkuil hans.verk...@cisco.com Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/v4l2-core/v4l2-ctrls.c | 150 +-- drivers/media/v4l2-core/v4l2-ioctl.c | 4 +- include/media/v4l2-ctrls.h | 14 3 files changed, 141 insertions(+), 27 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index 35d1f3d..df0f3ee 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -1478,6 +1478,15 @@ static int cur_to_user(struct v4l2_ext_control *c, return ptr_to_user(c, ctrl, ctrl-p_cur); } +/* Helper function: copy the store's control value back to the caller */ +static int store_to_user(struct v4l2_ext_control *c, + struct v4l2_ctrl *ctrl, unsigned store) +{ + if (store == 0) + return ptr_to_user(c, ctrl, ctrl-p_new); + return ptr_to_user(c, ctrl, ctrl-p_stores[store - 1]); +} + /* Helper function: copy the new control value back to the caller */ static int new_to_user(struct v4l2_ext_control *c, struct v4l2_ctrl *ctrl) @@ -1585,6 +1594,14 @@ static void new_to_cur(struct v4l2_fh *fh, struct v4l2_ctrl *ctrl, u32 ch_flags) } } +/* Helper function: copy the new control value to the store */ +static void new_to_store(struct v4l2_ctrl *ctrl) +{ + /* has_changed is set by cluster_changed */ + if (ctrl ctrl-has_changed) + ptr_to_ptr(ctrl, ctrl-p_new, ctrl-p_stores[ctrl-store - 1]); +} + /* Copy the current value to the new value */ static void cur_to_new(struct v4l2_ctrl *ctrl) { @@ -1603,13 +1620,18 @@ static int cluster_changed(struct v4l2_ctrl *master) for (i = 0; i master-ncontrols; i++) { struct v4l2_ctrl *ctrl = master-cluster[i]; + union v4l2_ctrl_ptr ptr; bool ctrl_changed = false; if (ctrl == NULL) continue; + if (ctrl-store) + ptr = ctrl-p_stores[ctrl-store - 1]; + else + ptr = ctrl-p_cur; for (idx = 0; !ctrl_changed idx ctrl-elems; idx++) ctrl_changed = !ctrl-type_ops-equal(ctrl, idx, - ctrl-p_cur, ctrl-p_new); + ptr, ctrl-p_new); ctrl-has_changed = ctrl_changed; changed |= ctrl-has_changed; } @@ -1740,6 +1762,13 @@ void v4l2_ctrl_handler_free(struct v4l2_ctrl_handler *hdl) list_del(ctrl-node); list_for_each_entry_safe(sev, next_sev, ctrl-ev_subs, node) list_del(sev-node); + if (ctrl-p_stores) { + unsigned s; + + for (s = 0; s ctrl-nr_of_stores; s++) + kfree(ctrl-p_stores[s].p); + } + kfree(ctrl-p_stores); kfree(ctrl); } kfree(hdl-buckets); @@ -1970,7 +1999,7 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl, handler_set_err(hdl, -ERANGE); return NULL; } - if (is_array + if ((is_array || (flags V4L2_CTRL_FLAG_CAN_STORE)) (type == V4L2_CTRL_TYPE_BUTTON || type == V4L2_CTRL_TYPE_CTRL_CLASS)) { handler_set_err(hdl, -EINVAL); @@ -2084,8 +2113,10 @@ struct v4l2_ctrl *v4l2_ctrl_new_custom(struct v4l2_ctrl_handler *hdl, is_menu ? cfg-menu_skip_mask : step, def, cfg-dims, cfg-elem_size, flags, qmenu, qmenu_int, priv); - if (ctrl) + if (ctrl) { ctrl-is_private = cfg-is_private; + ctrl-can_store = cfg-can_store; + } return ctrl; } EXPORT_SYMBOL(v4l2_ctrl_new_custom); @@ -2452,6 +2483,7 @@ int v4l2_ctrl_handler_setup(struct v4l2_ctrl_handler *hdl) cur_to_new(master-cluster[i]); master-cluster[i]-is_new = 1; master-cluster[i]-done = true; + master-cluster[i]-store = 0; } } ret = call_op(master, s_ctrl); @@ -2539,6 +2571,8 @@ int v4l2_query_ext_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_query_ext_ctr qc-id = ctrl-id; strlcpy(qc-name, ctrl-name, sizeof(qc-name)); qc-flags = ctrl-flags; + if (ctrl-can_store) + qc-flags |= V4L2_CTRL_FLAG_CAN_STORE; qc-type = ctrl-type; if (ctrl-is_ptr) qc-flags |= V4L2_CTRL_FLAG_HAS_PAYLOAD; @@ -2700,6 +2734,8 @@ static int prepare_ext_ctrls(struct v4l2_ctrl_handler *hdl, struct v4l2_ctrl_helper *helpers, bool get) { +
[RFC PATCH 03/11] videodev2.h: rename reserved2 to config_store in v4l2_buffer.
From: Hans Verkuil hans.verk...@cisco.com When queuing buffers allow for passing the configuration store ID that should be associated with this buffer. Use the 'reserved2' field for this. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/usb/cpia2/cpia2_v4l.c | 2 +- drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 4 ++-- drivers/media/v4l2-core/videobuf2-core.c | 4 +++- include/uapi/linux/videodev2.h| 3 ++- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/media/usb/cpia2/cpia2_v4l.c b/drivers/media/usb/cpia2/cpia2_v4l.c index 9caea83..0f28d2b 100644 --- a/drivers/media/usb/cpia2/cpia2_v4l.c +++ b/drivers/media/usb/cpia2/cpia2_v4l.c @@ -952,7 +952,7 @@ static int cpia2_dqbuf(struct file *file, void *fh, struct v4l2_buffer *buf) buf-sequence = cam-buffers[buf-index].seq; buf-m.offset = cam-buffers[buf-index].data - cam-frame_buffer; buf-length = cam-frame_size; - buf-reserved2 = 0; + buf-config_store = 0; buf-reserved = 0; memset(buf-timecode, 0, sizeof(buf-timecode)); diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c index e502a5f..5afef3a 100644 --- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c +++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c @@ -324,7 +324,7 @@ struct v4l2_buffer32 { __s32 fd; } m; __u32 length; - __u32 reserved2; + __u32 config_store; __u32 reserved; }; @@ -489,7 +489,7 @@ static int put_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user put_user(kp-timestamp.tv_usec, up-timestamp.tv_usec) || copy_to_user(up-timecode, kp-timecode, sizeof(struct v4l2_timecode)) || put_user(kp-sequence, up-sequence) || - put_user(kp-reserved2, up-reserved2) || + put_user(kp-config_store, up-config_store) || put_user(kp-reserved, up-reserved)) return -EFAULT; diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index 7e6aff6..e3b6c50 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -655,7 +655,7 @@ static void __fill_v4l2_buffer(struct vb2_buffer *vb, struct v4l2_buffer *b) /* Copy back data such as timestamp, flags, etc. */ memcpy(b, vb-v4l2_buf, offsetof(struct v4l2_buffer, m)); - b-reserved2 = vb-v4l2_buf.reserved2; + b-config_store = vb-v4l2_buf.config_store; b-reserved = vb-v4l2_buf.reserved; if (V4L2_TYPE_IS_MULTIPLANAR(q-type)) { @@ -680,6 +680,7 @@ static void __fill_v4l2_buffer(struct vb2_buffer *vb, struct v4l2_buffer *b) else if (q-memory == V4L2_MEMORY_DMABUF) b-m.fd = vb-v4l2_planes[0].m.fd; } + b-config_store = vb-v4l2_buf.config_store; /* * Clear any buffer state related flags. @@ -1324,6 +1325,7 @@ static void __fill_vb2_buffer(struct vb2_buffer *vb, const struct v4l2_buffer *b */ vb-v4l2_buf.flags = ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK; } + vb-v4l2_buf.config_store = b-config_store; if (V4L2_TYPE_IS_OUTPUT(b-type)) { /* diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 83ef28a..2ca44ed 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -672,6 +672,7 @@ struct v4l2_plane { * @length:size in bytes of the buffer (NOT its payload) for single-plane * buffers (when type != *_MPLANE); number of elements in the * planes array for multi-plane buffers + * @config_store: this buffer should use this configuration store * * Contains data exchanged by application and driver using one of the Streaming * I/O methods. @@ -695,7 +696,7 @@ struct v4l2_buffer { __s32 fd; } m; __u32 length; - __u32 reserved2; + __u32 config_store; __u32 reserved; }; -- 2.1.0 -- 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
[RFC PATCH 06/11] videodev2.h: add new v4l2_ext_control flags field
From: Hans Verkuil hans.verk...@cisco.com Replace reserved2 by a flags field. This is used to tell whether setting a new store value is applied only once or every time that v4l2_ctrl_apply_store() is called for that store. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- include/uapi/linux/videodev2.h | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 2ca44ed..fa84070 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -1282,7 +1282,7 @@ struct v4l2_control { struct v4l2_ext_control { __u32 id; __u32 size; - __u32 reserved2[1]; + __u32 flags; union { __s32 value; __s64 value64; @@ -1294,6 +1294,10 @@ struct v4l2_ext_control { }; } __attribute__ ((packed)); +/* v4l2_ext_control flags */ +#define V4L2_EXT_CTRL_FL_IGN_STORE_AFTER_USE 0x0001 +#define V4L2_EXT_CTRL_FL_IGN_STORE 0x0002 + struct v4l2_ext_controls { union { __u32 ctrl_class; -- 2.1.0 -- 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
[RFC PATCH 11/11] vivid: add crop/compose selection control support
From: Hans Verkuil hans.verk...@cisco.com Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/platform/vivid/vivid-core.h| 5 drivers/media/platform/vivid/vivid-ctrls.c | 37 drivers/media/platform/vivid/vivid-vid-cap.c | 10 ++-- drivers/media/platform/vivid/vivid-vid-cap.h | 1 + 4 files changed, 51 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/vivid/vivid-core.h b/drivers/media/platform/vivid/vivid-core.h index 811c286..f9d6c45 100644 --- a/drivers/media/platform/vivid/vivid-core.h +++ b/drivers/media/platform/vivid/vivid-core.h @@ -214,6 +214,11 @@ struct vivid_dev { struct v4l2_ctrl*ctrl_dv_timings_signal_mode; struct v4l2_ctrl*ctrl_dv_timings; }; + struct { + /* capture selection crop/compose cluster */ + struct v4l2_ctrl*ctrl_cap_crop; + struct v4l2_ctrl*ctrl_cap_compose; + }; struct v4l2_ctrl*ctrl_has_crop_cap; struct v4l2_ctrl*ctrl_has_compose_cap; struct v4l2_ctrl*ctrl_has_scaler_cap; diff --git a/drivers/media/platform/vivid/vivid-ctrls.c b/drivers/media/platform/vivid/vivid-ctrls.c index 42376a1..04d18be 100644 --- a/drivers/media/platform/vivid/vivid-ctrls.c +++ b/drivers/media/platform/vivid/vivid-ctrls.c @@ -398,6 +398,25 @@ static int vivid_vid_cap_s_ctrl(struct v4l2_ctrl *ctrl) if (dev-edid_blocks dev-edid_max_blocks) dev-edid_blocks = dev-edid_max_blocks; break; + case V4L2_CID_CAPTURE_CROP: { + struct v4l2_selection s = { V4L2_BUF_TYPE_VIDEO_CAPTURE }; + struct v4l2_ctrl_selection *crop = dev-ctrl_cap_crop-p_new.p_sel; + struct v4l2_ctrl_selection *compose = dev-ctrl_cap_compose-p_new.p_sel; + int ret; + + if (ctrl-store) + break; + s.target = V4L2_SEL_TGT_CROP; + s.r = crop-r; + s.flags = crop-flags; + ret = vivid_vid_cap_s_selection_int(dev, s); + if (ret) + return ret; + s.target = V4L2_SEL_TGT_COMPOSE; + s.r = compose-r; + s.flags = compose-flags; + return vivid_vid_cap_s_selection_int(dev, s); + } } return 0; } @@ -668,6 +687,19 @@ static const struct v4l2_ctrl_config vivid_ctrl_limited_rgb_range = { .step = 1, }; +static const struct v4l2_ctrl_config vivid_ctrl_capture_crop = { + .ops = vivid_vid_cap_ctrl_ops, + .id = V4L2_CID_CAPTURE_CROP, + .dims = { 1 }, + .can_store = true, +}; + +static const struct v4l2_ctrl_config vivid_ctrl_capture_compose = { + .ops = vivid_vid_cap_ctrl_ops, + .id = V4L2_CID_CAPTURE_COMPOSE, + .dims = { 1 }, + .can_store = true, +}; /* VBI Capture Control */ @@ -1263,6 +1295,10 @@ int vivid_create_controls(struct vivid_dev *dev, bool show_ccs_cap, dev-colorspace = v4l2_ctrl_new_custom(hdl_vid_cap, vivid_ctrl_colorspace, NULL); v4l2_ctrl_new_custom(hdl_vid_cap, vivid_ctrl_alpha_mode, NULL); + dev-ctrl_cap_crop = v4l2_ctrl_new_custom(hdl_vid_cap, + vivid_ctrl_capture_crop, NULL); + dev-ctrl_cap_compose = v4l2_ctrl_new_custom(hdl_vid_cap, + vivid_ctrl_capture_compose, NULL); } if (dev-has_vid_out show_ccs_out) { @@ -1435,6 +1471,7 @@ int vivid_create_controls(struct vivid_dev *dev, bool show_ccs_cap, v4l2_ctrl_add_handler(hdl_vid_cap, hdl_user_aud, NULL); v4l2_ctrl_add_handler(hdl_vid_cap, hdl_streaming, NULL); v4l2_ctrl_add_handler(hdl_vid_cap, hdl_sdtv_cap, NULL); + v4l2_ctrl_cluster(2, dev-ctrl_cap_crop); if (hdl_vid_cap-error) return hdl_vid_cap-error; dev-vid_cap_dev.ctrl_handler = hdl_vid_cap; diff --git a/drivers/media/platform/vivid/vivid-vid-cap.c b/drivers/media/platform/vivid/vivid-vid-cap.c index 95eda68..934ea3d 100644 --- a/drivers/media/platform/vivid/vivid-vid-cap.c +++ b/drivers/media/platform/vivid/vivid-vid-cap.c @@ -831,9 +831,8 @@ int vivid_vid_cap_g_selection(struct file *file, void *priv, return 0; } -int vivid_vid_cap_s_selection(struct file *file, void *fh, struct v4l2_selection *s) +int vivid_vid_cap_s_selection_int(struct vivid_dev *dev, struct v4l2_selection *s) { - struct vivid_dev *dev = video_drvdata(file); struct v4l2_rect *crop = dev-crop_cap; struct v4l2_rect *compose = dev-compose_cap; unsigned factor = V4L2_FIELD_HAS_T_OR_B(dev-field_cap) ? 2 : 1; @@ -967,6 +966,13 @@ int vivid_vid_cap_s_selection(struct file *file, void *fh, struct
[RFC PATCH 10/11] v4l2-ctrls: add multi-selection controls
From: Hans Verkuil hans.verk...@cisco.com Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/v4l2-core/v4l2-ctrls.c | 24 include/uapi/linux/v4l2-controls.h | 7 ++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index 21560b0..af76bda 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -643,6 +643,10 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_MIN_BUFFERS_FOR_OUTPUT: return Min Number of Output Buffers; case V4L2_CID_ALPHA_COMPONENT: return Alpha Component; case V4L2_CID_COLORFX_CBCR: return Color Effects, CbCr; + case V4L2_CID_CAPTURE_CROP: return Capture Crop Selections; + case V4L2_CID_CAPTURE_COMPOSE: return Capture Compose Selections; + case V4L2_CID_OUTPUT_CROP: return Output Crop Selections; + case V4L2_CID_OUTPUT_COMPOSE: return Output Compose Selections; /* Codec controls */ /* The MPEG controls are applicable to all codec controls @@ -1122,6 +1126,13 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_RDS_TX_ALT_FREQS: *type = V4L2_CTRL_TYPE_U32; break; + case V4L2_CID_CAPTURE_CROP: + case V4L2_CID_CAPTURE_COMPOSE: + case V4L2_CID_OUTPUT_CROP: + case V4L2_CID_OUTPUT_COMPOSE: + *type = V4L2_CTRL_TYPE_SELECTION; + *min = *max = *step = *def = 0; + break; default: *type = V4L2_CTRL_TYPE_INTEGER; break; @@ -1336,6 +1347,12 @@ static void std_log(const struct v4l2_ctrl *ctrl) case V4L2_CTRL_TYPE_U32: pr_cont(%u, (unsigned)*ptr.p_u32); break; + case V4L2_CTRL_TYPE_SELECTION: + pr_cont(%ux%u@%dx%d (0x%x), + ptr.p_sel-r.width, ptr.p_sel-r.height, + ptr.p_sel-r.left, ptr.p_sel-r.top, + ptr.p_sel-flags); + break; default: pr_cont(unknown type %d, ctrl-type); break; @@ -1429,6 +1446,10 @@ static int std_validate(const struct v4l2_ctrl *ctrl, u32 idx, return -ERANGE; return 0; + case V4L2_CTRL_TYPE_SELECTION: + /* TODO: check for valid rectangle */ + return 0; + default: return -EINVAL; } @@ -1998,6 +2019,9 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl, case V4L2_CTRL_TYPE_U32: elem_size = sizeof(u32); break; + case V4L2_CTRL_TYPE_SELECTION: + elem_size = sizeof(struct v4l2_ctrl_selection); + break; default: if (type V4L2_CTRL_COMPOUND_TYPES) elem_size = sizeof(s32); diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 8b93021..1c2fbf3 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -140,8 +140,13 @@ enum v4l2_colorfx { #define V4L2_CID_ALPHA_COMPONENT (V4L2_CID_BASE+41) #define V4L2_CID_COLORFX_CBCR (V4L2_CID_BASE+42) +#define V4L2_CID_CAPTURE_CROP (V4L2_CID_BASE+43) +#define V4L2_CID_CAPTURE_COMPOSE (V4L2_CID_BASE+44) +#define V4L2_CID_OUTPUT_CROP (V4L2_CID_BASE+45) +#define V4L2_CID_OUTPUT_COMPOSE(V4L2_CID_BASE+46) + /* last CID + 1 */ -#define V4L2_CID_LASTP1 (V4L2_CID_BASE+43) +#define V4L2_CID_LASTP1 (V4L2_CID_BASE+47) /* USER-class private control IDs */ -- 2.1.0 -- 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
[RFC PATCH 05/11] v4l2-ctrls: add function to apply a configuration store.
From: Hans Verkuil hans.verk...@cisco.com Drivers need to be able to select a specific store. Add a new function that can be used to apply a given store. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/v4l2-core/v4l2-ctrls.c | 61 include/media/v4l2-ctrls.h | 2 ++ 2 files changed, 63 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index df0f3ee..e5dccf2 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -1610,6 +1610,17 @@ static void cur_to_new(struct v4l2_ctrl *ctrl) ptr_to_ptr(ctrl, ctrl-p_cur, ctrl-p_new); } +static void store_to_new(struct v4l2_ctrl *ctrl, unsigned store) +{ + if (ctrl == NULL) + return; + if (store) + ptr_to_ptr(ctrl, ctrl-p_stores[store - 1], ctrl-p_new); + else + ptr_to_ptr(ctrl, ctrl-p_cur, ctrl-p_new); + ctrl-is_new = true; +} + /* Return non-zero if one or more of the controls in the cluster has a new value that differs from the current value. */ static int cluster_changed(struct v4l2_ctrl *master) @@ -3368,6 +3379,56 @@ int __v4l2_ctrl_s_ctrl_string(struct v4l2_ctrl *ctrl, const char *s) } EXPORT_SYMBOL(__v4l2_ctrl_s_ctrl_string); +int v4l2_ctrl_apply_store(struct v4l2_ctrl_handler *hdl, unsigned store) +{ + struct v4l2_ctrl_ref *ref; + bool found_store = false; + unsigned i; + + if (hdl == NULL || store == 0) + return -EINVAL; + + mutex_lock(hdl-lock); + + list_for_each_entry(ref, hdl-ctrl_refs, node) { + struct v4l2_ctrl *master; + + if (store ref-ctrl-nr_of_stores) + continue; + found_store = true; + master = ref-ctrl-cluster[0]; + if (ref-ctrl != master) + continue; + if (master-handler != hdl) + v4l2_ctrl_lock(master); + for (i = 0; i master-ncontrols; i++) + store_to_new(master-cluster[i], store); + + /* For volatile autoclusters that are currently in auto mode + we need to discover if it will be set to manual mode. + If so, then we have to copy the current volatile values + first since those will become the new manual values (which + may be overwritten by explicit new values from this set + of controls). */ + if (master-is_auto master-has_volatiles + !is_cur_manual(master)) { + s32 new_auto_val = *master-p_stores[store - 1].p_s32; + + /* If the new value == the manual value, then copy + the current volatile values. */ + if (new_auto_val == master-manual_mode_value) + update_from_auto_cluster(master); + } + + try_or_set_cluster(NULL, master, 0, true, 0); + if (master-handler != hdl) + v4l2_ctrl_unlock(master); + } + mutex_unlock(hdl-lock); + return found_store ? 0 : -EINVAL; +} +EXPORT_SYMBOL(v4l2_ctrl_apply_store); + void v4l2_ctrl_notify(struct v4l2_ctrl *ctrl, v4l2_ctrl_notify_fnc notify, void *priv) { if (ctrl == NULL) diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index 4c31688..713980a 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h @@ -777,6 +777,8 @@ static inline void v4l2_ctrl_can_store(struct v4l2_ctrl *ctrl) ctrl-can_store = true; } +int v4l2_ctrl_apply_store(struct v4l2_ctrl_handler *hdl, unsigned store); + /* Internal helper functions that deal with control events. */ extern const struct v4l2_subscribed_event_ops v4l2_ctrl_sub_ev_ops; void v4l2_ctrl_replace(struct v4l2_event *old, const struct v4l2_event *new); -- 2.1.0 -- 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
[RFC PATCH 09/11] videodev2.h: add v4l2_ctrl_selection compound control type.
From: Hans Verkuil hans.verk...@cisco.com This will be used by a new selection control. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- include/media/v4l2-ctrls.h | 2 ++ include/uapi/linux/videodev2.h | 8 2 files changed, 10 insertions(+) diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index 3005d88..c2fd050 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h @@ -46,6 +46,7 @@ struct poll_table_struct; * @p_u16: Pointer to a 16-bit unsigned value. * @p_u32: Pointer to a 32-bit unsigned value. * @p_char:Pointer to a string. + * @p_sel: Pointer to a struct v4l2_ctrl_selection. * @p: Pointer to a compound value. */ union v4l2_ctrl_ptr { @@ -55,6 +56,7 @@ union v4l2_ctrl_ptr { u16 *p_u16; u32 *p_u32; char *p_char; + struct v4l2_ctrl_selection *p_sel; void *p; }; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index fa84070..e956472 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -1271,6 +1271,12 @@ struct v4l2_output { #define V4L2_OUT_CAP_CUSTOM_TIMINGSV4L2_OUT_CAP_DV_TIMINGS /* For compatibility */ #define V4L2_OUT_CAP_STD 0x0004 /* Supports S_STD */ +struct v4l2_ctrl_selection { + __u32 flags; + struct v4l2_rect r; + __u32 reserved[9]; +}; + /* * C O N T R O L S */ @@ -1290,6 +1296,7 @@ struct v4l2_ext_control { __u8 __user *p_u8; __u16 __user *p_u16; __u32 __user *p_u32; + struct v4l2_ctrl_selection __user *p_sel; void __user *ptr; }; } __attribute__ ((packed)); @@ -1330,6 +1337,7 @@ enum v4l2_ctrl_type { V4L2_CTRL_TYPE_U8= 0x0100, V4L2_CTRL_TYPE_U16 = 0x0101, V4L2_CTRL_TYPE_U32 = 0x0102, + V4L2_CTRL_TYPE_SELECTION = 0x0103, }; /* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ -- 2.1.0 -- 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
[RFC PATCH 02/11] videodev2.h: add config_store to v4l2_ext_controls
From: Hans Verkuil hans.verk...@cisco.com The ctrl_class is fairly pointless when used with drivers that use the control framework: you can just fill in 0 and it will just work fine. There are still some old unconverted drivers that do not support 0 and instead want the control class there. The idea being that all controls in the list all belong to that class. This was done to simplify drivers in the absence of the control framework. When using the control framework the framework itself is smart enough to allow controls of any class to be included in the control list. Since configuration store IDs are in the range 1..255 (or so, in any case a relatively small non-zero positive integer) it makes sense to effectively rename ctrl_class to config_store. Set it to 0 and you get the normal behavior (you change the current control value), set it to a configuration store ID and you get/set the control for that store. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- include/uapi/linux/videodev2.h | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 199834b..83ef28a 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -1294,7 +1294,10 @@ struct v4l2_ext_control { } __attribute__ ((packed)); struct v4l2_ext_controls { - __u32 ctrl_class; + union { + __u32 ctrl_class; + __u32 config_store; + }; __u32 count; __u32 error_idx; __u32 reserved[2]; -- 2.1.0 -- 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
[RFC PATCH 01/11] videodev2.h: add V4L2_CTRL_FLAG_CAN_STORE
From: Hans Verkuil hans.verk...@cisco.com Controls that have a configuration store will set this flag. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- include/uapi/linux/videodev2.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 0b1ba5c..199834b 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -1375,6 +1375,7 @@ struct v4l2_querymenu { #define V4L2_CTRL_FLAG_WRITE_ONLY 0x0040 #define V4L2_CTRL_FLAG_VOLATILE0x0080 #define V4L2_CTRL_FLAG_HAS_PAYLOAD 0x0100 +#define V4L2_CTRL_FLAG_CAN_STORE 0x0200 /* Query flags, to be ORed with the control ID */ #define V4L2_CTRL_FLAG_NEXT_CTRL 0x8000 -- 2.1.0 -- 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
[GIT PULL for v3.17-rc6] media fixes
Hi Linus, Please pull from: git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media tags/media-v3.17-rc6 For some media bug fixes: - a Kconfig dependency issue; - Some fixes for af9033/it913x demod to be more reliable and address a performance regression; - cx18: fix an oops on devices with tda8290 tuner; - two new USB IDs for af9035; - a couple fixes on smapp driver. Regards, Mauro PS.: FYI, I'm now starting to use mche...@osg.samsung.com e-mail address. The old one (m.che...@samsung.com) is still valid, but we're using the OSG subdomain for the Samsung's Open Source Group. The following changes since commit 7d1311b93e58ed55f3a31cc8f94c4b8fe988a2b9: Linux 3.17-rc1 (2014-08-16 10:40:26 -0600) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media tags/media-v3.17-rc6 for you to fetch changes up to a04646c045cab08a9e62b9be8f01ecbb0632d24e: [media] af9035: new IDs: add support for PCTV 78e and PCTV 79e (2014-09-04 12:24:19 -0300) media fixes for v3.17-rc6 Antti Palosaari (2): [media] Kconfig: do not select SPI bus on sub-driver auto-select [media] af9033: feed clock to RF tuner Bimow Chen (2): [media] af9033: update IT9135 tuner inittabs [media] it913x: init tuner on attach Hans Verkuil (1): [media] cx18: fix kernel oops with tda8290 tuner Malcolm Priestley (1): [media] af9035: new IDs: add support for PCTV 78e and PCTV 79e Sakari Ailus (2): [media] smiapp: Fix power count handling [media] smiapp: Set sub-device owner drivers/media/Kconfig | 1 - drivers/media/dvb-core/dvb-usb-ids.h | 2 ++ drivers/media/dvb-frontends/af9033.c | 13 + drivers/media/dvb-frontends/af9033_priv.h | 20 +--- drivers/media/i2c/smiapp/smiapp-core.c| 13 +++-- drivers/media/pci/cx18/cx18-driver.c | 1 + drivers/media/tuners/tuner_it913x.c | 6 ++ drivers/media/usb/dvb-usb-v2/af9035.c | 4 8 files changed, 38 insertions(+), 22 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Running Technisat DVB-S2 on ARM-NAS
How my I find out more about the error -12? http://www.virtsync.com/c-error-codes-include-errno #define ENOMEM 12 /* Out of memory */ Likely allocating USB stream buffers fails. You could try request smaller buffers. Drop count to 1 and test. Drop framesperurb to 1 and test. Drop framesize to 1 and test. Surely streaming will not work if all buffers are totally wrong and too small, but you will see if it is due to big usb buffers. Then you could try optimize buffers smaller. Wow, that did it. Thanks Antti! Works with count = 2, but not with count = 4. What exactly do I learn from this? Where are those buffers? In the RAM? or somewhere in onboard USB hardware? VDR is now able to connect to the device, but I am not sure if it receives anything yet. Jan -- 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: Running Technisat DVB-S2 on ARM-NAS
On 09/21/2014 06:10 PM, JPT wrote: How my I find out more about the error -12? http://www.virtsync.com/c-error-codes-include-errno #define ENOMEM 12 /* Out of memory */ Likely allocating USB stream buffers fails. You could try request smaller buffers. Drop count to 1 and test. Drop framesperurb to 1 and test. Drop framesize to 1 and test. Surely streaming will not work if all buffers are totally wrong and too small, but you will see if it is due to big usb buffers. Then you could try optimize buffers smaller. Wow, that did it. Thanks Antti! Works with count = 2, but not with count = 4. What exactly do I learn from this? Where are those buffers? In the RAM? or somewhere in onboard USB hardware? VDR is now able to connect to the device, but I am not sure if it receives anything yet. .count = 8, .framesperurb = 32, .framesize = 2048, If I didn't remember wrong, that means allocated buffers are 8 * 32 * 2048 = 524288 bytes. It sounds rather big for my taste. Probably even wrong. IIRC USB2.0 frames are 1024 and there could be 1-3 frames. You could use lsusb with all verbosity levels to see if it is 1024/2048/3072. And set value according to that info. 32 framesperurb sounds absolute too much. You could decrease it a lot, under 10 should be OK. Maybe 8 is good guess. 8 is number of URBs you use for streaming. 8 does not sound bad, but maybe 6 is OK if it works. Smallest value depends largely device USB FIFO size vs. stream size. Bigger the FIFO less the buffers needed. Smaller the stream, less the buffers needed. So I would recommend .count = 6, .framesperurb = 8, .framesize = 1024, Use some testing with error and trial to find out smallest working buffers, then add some 20% extra for that. 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: Running Technisat DVB-S2 on ARM-NAS
If I didn't remember wrong, that means allocated buffers are 8 * 32 * 2048 = 524288 bytes. It sounds rather big for my taste. Probably even wrong. IIRC USB2.0 frames are 1024 and there could be 1-3 frames. You could use lsusb with all verbosity levels to see if it is 1024/2048/3072. And set value according to that info. lsusb tells: Interface Descriptor: Endpoint Descriptor: wMaxPacketSize 0x0200 1x 512 bytes Endpoint Descriptor: wMaxPacketSize 0x0200 1x 512 bytes Endpoint Descriptor: wMaxPacketSize 0x0200 1x 512 bytes Interface Descriptor: Endpoint Descriptor: wMaxPacketSize 0x0c00 2x 1024 bytes Endpoint Descriptor: wMaxPacketSize 0x0200 1x 512 bytes Endpoint Descriptor: wMaxPacketSize 0x0200 1x 512 bytes But I haven't got any clue about the meaning. Ask me a question about any bit in the tcp/ip packages, but don't ask me about USB ;) Where can I get technical details that are, well... readable without studing for weeks? btw, it's attached to a FT1009 USB3.0 SuperSpeed chip. So I would recommend .count = 6, .framesperurb = 8, .framesize = 1024, Use some testing with error and trial to find out smallest working buffers, then add some 20% extra for that. I set to 8x8x2048 (because max package size is 2x1024) but w_scan doesn't find any transponder. What should happen if buffers are too small? Tommorrow I'll swap the sat cable just to make sure this isn't the cause. thanks, Jan -- 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: [GIT PULL for v3.17-rc6] media fixes
On Sun, Sep 21, 2014 at 7:50 AM, Mauro Carvalho Chehab mche...@osg.samsung.com wrote: PS.: FYI, I'm now starting to use mche...@osg.samsung.com e-mail address. The old one (m.che...@samsung.com) is still valid, but we're using the OSG subdomain for the Samsung's Open Source Group. Thanks for signing this. When I get things from new email addresses, a signed tag is appreciated (even if it's then kernel.org). In fact, a signed tag is always appreciated, so I'm hoping this is going to be your new workflow.. Linus -- 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 v2 1/6] V4L2: Add Renesas R-Car JPEG codec driver.
Hello. On 08/25/2014 04:49 PM, Hans Verkuil wrote: This patch contains driver for Renesas R-Car JPEG codec. Cnanges since v1: - s/g_fmt function simplified - default format for queues added - dumb vidioc functions added to be in compliance with standard api: jpu_s_priority, jpu_g_priority Oops, that's a bug elsewhere. Don't add these empty prio ops, this needs to be solved in the v4l2 core. I'll post a patch for this. After some thought I've decided to allow prio handling for m2m devices. It is actually useful if some application wants exclusive access to the m2m hardware. So I will change v4l2-compliance instead. I take it we don't need to change the driver? Asking because the driver seems stuck for nearly a month now. I'm myself still seeing a place for improvement (register macro naming of the top of my head). Perhaps it's time to take this driver into my own hands... Regards, Hans WBR, Sergei -- 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 v2 1/6] V4L2: Add Renesas R-Car JPEG codec driver.
Hello. On 08/25/2014 04:49 PM, Hans Verkuil wrote: This patch contains driver for Renesas R-Car JPEG codec. Cnanges since v1: - s/g_fmt function simplified - default format for queues added - dumb vidioc functions added to be in compliance with standard api: jpu_s_priority, jpu_g_priority Oops, that's a bug elsewhere. Don't add these empty prio ops, this needs to be solved in the v4l2 core. I'll post a patch for this. After some thought I've decided to allow prio handling for m2m devices. It is actually useful if some application wants exclusive access to the m2m hardware. So I will change v4l2-compliance instead. I take it we don't need to change the driver? Asking because the driver seems stuck for nearly a months now. I'm myself still seeing a place for improvement (register macro naming of the top of my head). Perhaps it's time to take this driver into my own hands... Regards, Hans WBR, Sergei -- 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: [GIT PULL for v3.17-rc6] media fixes
Em Sun, 21 Sep 2014 11:05:06 -0700 Linus Torvalds torva...@linux-foundation.org escreveu: On Sun, Sep 21, 2014 at 7:50 AM, Mauro Carvalho Chehab mche...@osg.samsung.com wrote: PS.: FYI, I'm now starting to use mche...@osg.samsung.com e-mail address. The old one (m.che...@samsung.com) is still valid, but we're using the OSG subdomain for the Samsung's Open Source Group. Thanks for signing this. When I get things from new email addresses, a signed tag is appreciated (even if it's then kernel.org). In fact, a signed tag is always appreciated, so I'm hoping this is going to be your new workflow.. Yes, my new workflow is to generate a signed tag for every pull request I'll send you. I updated the scripts for that and tested them today. So, you should expect signed tags on my next pull requests. Regards, Mauro -- 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: Running Technisat DVB-S2 on ARM-NAS
Am 21.09.2014 um 19:28 schrieb JPT: Tommorrow I'll swap the sat cable just to make sure this isn't the cause. Hi Jan, Are we talking about this device: http://www.linuxtv.org/wiki/index.php/Technisat_SkyStar_USB_HD (You never mentioned the actual model AFAIK)? If so, it has two LEDs. A red one for power and a green one for tuned/locked. So if the green one lights up, the sat cable should be okay. I remember having tested my one with the RaspberryPi and it worked. So it is not a general problem of the DVB-S2 device and ARM but rather the specific board you are working with. Just found the link where I reported success: https://github.com/raspberrypi/linux/issues/82#issuecomment-27253775 Best regards, Jannis -- 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 v2 3/8] anysee: convert tda18212 tuner to I2C client
Em Thu, 18 Sep 2014 16:01:59 +0300 Antti Palosaari cr...@iki.fi escreveu: On 09/18/2014 03:31 PM, Mauro Carvalho Chehab wrote: Em Sun, 7 Sep 2014 04:59:55 +0300 Antti Palosaari cr...@iki.fi escreveu: Used tda18212 tuner is implemented as I2C driver. Implement I2C client to anysee and use it for tda18212. +static int anysee_add_i2c_dev(struct dvb_usb_device *d, char *type, u8 addr, + void *platform_data) + +static void anysee_del_i2c_dev(struct dvb_usb_device *d) Please, instead of adding a function to insert/remove an I2C driver on every place, put them into a common place. I would actually very much prefer if you could reuse the same code that are already at the media subsystem (see v4l2_i2c_new_subdev_board friends at drivers/media/v4l2-core/v4l2-common.c), eventually making it more generic. Btw, as we want to use the media controller also for DVB, we'll end by needing to use a call similar to v4l2_device_register_subdev(). So, having this code all on just one place will make easier for us to go to this next step. I am just learning and finding out best practices to use I2C drivers. That was one implementation solution and IMHO not so bad even. Sure those 2 functions could be replaced some more common at some phase, but currently, when there is only few drivers, I don't see need for common implementation. Let it happen when best practices are clear. And I really wonder why there is no such general implementation provided by I2C framework? It used to have on Kernel 2.4 and 2.6 (up to 2.6.1x or 2.6.2x - don't remember the exact Kernel where this changed). The previous binding model got deprecated and removed, as different subsystems might need to do different things. So, it was opted to have one solution per subsystem. If you look how I have improved that in a long ran; 1st implementation is in em28xx driver, 2nd test was dd-bridge driver, then this anysee and eventually there is af9035 (which is almost same than this anysee). So, now we have 3 different implementations (4, if we count the generic one at v4l-core). That's bad. We should really stick with the original idea of having just one per subsystem. So, please write a patch unifying them into just one. For now, I'll be merging it, but please let's avoid all those code duplication, as this makes harder to maintain. @@ -939,46 +1025,63 @@ static int anysee_tuner_attach(struct dvb_usb_adapter *adap) * fails attach old simple PLL. */ /* attach tuner */ - fe = dvb_attach(tda18212_attach, adap-fe[0], d-i2c_adap, - anysee_tda18212_config); + if (state-has_tda18212) { + struct tda18212_config tda18212_config = + anysee_tda18212_config; - if (fe adap-fe[1]) { - /* attach tuner for 2nd FE */ - fe = dvb_attach(tda18212_attach, adap-fe[1], - d-i2c_adap, anysee_tda18212_config); - break; - } else if (fe) { - break; - } - - /* attach tuner */ - fe = dvb_attach(dvb_pll_attach, adap-fe[0], (0xc0 1), - d-i2c_adap, DVB_PLL_SAMSUNG_DTOS403IH102A); + tda18212_config.fe = adap-fe[0]; + ret = anysee_add_i2c_dev(d, tda18212, 0x60, + tda18212_config); + if (ret) + goto err; + + /* copy tuner ops for 2nd FE as tuner is shared */ + if (adap-fe[1]) { + adap-fe[1]-tuner_priv = + adap-fe[0]-tuner_priv; + memcpy(adap-fe[1]-ops.tuner_ops, + adap-fe[0]-ops.tuner_ops, + sizeof(struct dvb_tuner_ops)); + } - if (fe adap-fe[1]) { - /* attach tuner for 2nd FE */ - fe = dvb_attach(dvb_pll_attach, adap-fe[1], + return 0; + } else { + /* attach tuner */ + fe = dvb_attach(dvb_pll_attach, adap-fe[0], (0xc0 1), d-i2c_adap, DVB_PLL_SAMSUNG_DTOS403IH102A); Please don't use dvb_attach() for those converted modules. The dvb_attach() is a very dirty hack that was created as an alternative to provide an abstraction similar to the one that the I2C core already provides. See how V4L calls the subdev callbacks at include/media/v4l2-subdev.h. You looked it wrong, it is dvb_pll_attach. tda18212 attach is replaced here with I2C driver. It is tda18212 which is converted here to I2C driver, whilst dvb-pll
HOW ARE YOU?
Hello my Dear, I will greatly appreciate my correspondence meets you in good health condition. My name is Mr. Benjamin Siaka. I am seeking for your co-operation for investment partnership in your Country. I shall provide the FUND for the investment. When you acknowledged the receipt of this correspondence, thereafter I will give you the Full Details of my investment proposal. I await your response in earliest. My regards, Mr. Benjamin Siaka. -- 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: ERRORS
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: Mon Sep 22 04:00:28 CEST 2014 git branch: test git hash: c0aaf696d45e2a72048a56441e81dad78659c698 gcc version:i686-linux-gcc (GCC) 4.9.1 sparse version: v0.5.0-20-g7abd8a7 host hardware: x86_64 host os:3.16-2.slh.3-amd64 linux-git-arm-at91: ERRORS linux-git-arm-davinci: ERRORS linux-git-arm-exynos: ERRORS linux-git-arm-mx: ERRORS linux-git-arm-omap: OK linux-git-arm-omap1: ERRORS linux-git-arm-pxa: ERRORS linux-git-blackfin: ERRORS linux-git-i686: OK linux-git-m32r: OK linux-git-mips: ERRORS linux-git-powerpc64: OK linux-git-sh: ERRORS linux-git-x86_64: WARNINGS linux-2.6.32.27-i686: OK linux-2.6.33.7-i686: OK linux-2.6.34.7-i686: OK linux-2.6.35.9-i686: OK linux-2.6.36.4-i686: OK linux-2.6.37.6-i686: OK linux-2.6.38.8-i686: OK linux-2.6.39.4-i686: OK linux-3.0.60-i686: OK linux-3.1.10-i686: OK linux-3.2.37-i686: OK linux-3.3.8-i686: OK linux-3.4.27-i686: OK linux-3.5.7-i686: OK linux-3.6.11-i686: OK linux-3.7.4-i686: OK linux-3.8-i686: OK linux-3.9.2-i686: OK linux-3.10.1-i686: OK linux-3.11.1-i686: WARNINGS linux-3.12.23-i686: WARNINGS linux-3.13.11-i686: WARNINGS linux-3.14.9-i686: WARNINGS linux-3.15.2-i686: WARNINGS linux-3.16-i686: WARNINGS linux-3.17-rc1-i686: WARNINGS linux-2.6.32.27-x86_64: OK linux-2.6.33.7-x86_64: OK linux-2.6.34.7-x86_64: OK linux-2.6.35.9-x86_64: OK linux-2.6.36.4-x86_64: OK linux-2.6.37.6-x86_64: OK linux-2.6.38.8-x86_64: OK linux-2.6.39.4-x86_64: OK linux-3.0.60-x86_64: OK linux-3.1.10-x86_64: OK linux-3.2.37-x86_64: OK linux-3.3.8-x86_64: OK linux-3.4.27-x86_64: OK linux-3.5.7-x86_64: OK linux-3.6.11-x86_64: OK linux-3.7.4-x86_64: OK linux-3.8-x86_64: OK linux-3.9.2-x86_64: OK linux-3.10.1-x86_64: OK linux-3.11.1-x86_64: WARNINGS linux-3.12.23-x86_64: WARNINGS linux-3.13.11-x86_64: WARNINGS linux-3.14.9-x86_64: WARNINGS linux-3.15.2-x86_64: WARNINGS linux-3.16-x86_64: WARNINGS linux-3.17-rc1-x86_64: WARNINGS apps: OK spec-git: OK sparse: ERRORS sparse: ERRORS Detailed results are available here: http://www.xs4all.nl/~hverkuil/logs/Monday.log Full logs are available here: http://www.xs4all.nl/~hverkuil/logs/Monday.tar.bz2 The Media Infrastructure API from this daily build is here: http://www.xs4all.nl/~hverkuil/spec/media.html -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] [media] soc_camera: Support VIDIOC_EXPBUF ioctl
Hi Guennadi, Thank you for your review. (2014/09/20 16:50), Guennadi Liakhovetski wrote: Hi Kobayashi-san, Thanks for the patch. In principle it looks good, just one question below: On Thu, 11 Sep 2014, Kazunori Kobayashi wrote: This patch allows for exporting a dmabuf descriptor from soc_camera drivers. Signed-off-by: Kazunori Kobayashi kkoba...@igel.co.jp --- drivers/media/platform/soc_camera/soc_camera.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c index f4308fe..9d7b8ea 100644 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c @@ -437,6 +437,19 @@ static int soc_camera_prepare_buf(struct file *file, void *priv, return vb2_prepare_buf(icd-vb2_vidq, b); } +static int soc_camera_expbuf(struct file *file, void *priv, + struct v4l2_exportbuffer *p) +{ +struct soc_camera_device *icd = file-private_data; +struct soc_camera_host *ici = to_soc_camera_host(icd-parent); + +/* videobuf2 only */ +if (ici-ops-init_videobuf) +return -EINVAL; +else +return vb2_expbuf(icd-vb2_vidq, p); Many soc-camera queue management functions, like queuing, dequeuing a buffer check, that the caller is indeed the process, that is controlling the device. This is done for the case, when two (or more) processes open a video device node, some of them only want to monitor it, or control parameters like exposure etc. Whereas only one process is allowed to perform critical operations, like setting a video format, starting and stopping streaming, queuing and dequeuing buffers. Should this function too use such a check if (icd-streamer != file) return -EBUSY; If you agree, I can just add it myself, no need to resubmit. I think that's appropriate suggestion. The dmabuf exporting should be restricted to the process that operates the video streaming. Please add the check. Thanks Guennadi +} + /* Always entered with .host_lock held */ static int soc_camera_init_user_formats(struct soc_camera_device *icd) { @@ -2085,6 +2098,7 @@ static const struct v4l2_ioctl_ops soc_camera_ioctl_ops = { .vidioc_dqbuf= soc_camera_dqbuf, .vidioc_create_bufs = soc_camera_create_bufs, .vidioc_prepare_buf = soc_camera_prepare_buf, +.vidioc_expbuf = soc_camera_expbuf, .vidioc_streamon = soc_camera_streamon, .vidioc_streamoff= soc_camera_streamoff, .vidioc_cropcap = soc_camera_cropcap, -- 1.8.1.2 -- - IGEL Co.,Ltd. Kazunori Kobayashi kkoba...@igel.co.jp http://www.igel.co.jp/ -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/1] driver/drx39xyj: fix some compiling warnings
When compiling kernel, in module drx39xyj, there are some warnings showing some variables may be used uninitialized, though they have been initialized in fact. drivers/media/dvb-frontends/drx39xyj/drxj.c: In function ‘drxj_dap_atomic_read_reg32.isra.17’: drivers/media/dvb-frontends/drx39xyj/drxj.c:2190:7: warning: ‘*((void *)buf+3)’ may be used uninitialized in this function [-Wmaybe-uninitialized] word = (u32) buf[3]; ^ drivers/media/dvb-frontends/drx39xyj/drxj.c:2192:10: warning: ‘*((void *)buf+2)’ may be used uninitialized in this function [-Wmaybe-uninitialized] word |= (u32) buf[2]; ^ drivers/media/dvb-frontends/drx39xyj/drxj.c:2194:10: warning: ‘*((void *)buf+1)’ may be used uninitialized in this function [-Wmaybe-uninitialized] word |= (u32) buf[1]; ^ drivers/media/dvb-frontends/drx39xyj/drxj.c:2196:10: warning: ‘buf’ may be used uninitialized in this function [-Wmaybe-uninitialized] word |= (u32) buf[0]; ^ drivers/media/dvb-frontends/drx39xyj/drxj.c: In function ‘drx39xxj_read_status’: drivers/media/dvb-frontends/drx39xyj/drxj.c:10671:11: warning: ‘strength’ may be used uninitialized in this function [-Wmaybe-uninitialized] u16 mer, strength; ^ drivers/media/dvb-frontends/drx39xyj/drxj.c: In function ‘drxj_dap_scu_atomic_read_reg16’: drivers/media/dvb-frontends/drx39xyj/drxj.c:4208:9: warning: ‘*((void *)buf+1)’ may be used uninitialized in this function [-Wmaybe-uninitialized] word = (u16) (buf[0] + (buf[1] 8)); ^ drivers/media/dvb-frontends/drx39xyj/drxj.c:4208:9: warning: ‘buf’ may be used uninitialized in this function [-Wmaybe-uninitialized] Signed-off-by: Li, Zhen-Hua zhen-h...@hp.com --- drivers/media/dvb-frontends/drx39xyj/drxj.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/dvb-frontends/drx39xyj/drxj.c b/drivers/media/dvb-frontends/drx39xyj/drxj.c index 7ca7a21..afb14c70 100644 --- a/drivers/media/dvb-frontends/drx39xyj/drxj.c +++ b/drivers/media/dvb-frontends/drx39xyj/drxj.c @@ -2181,6 +2181,7 @@ int drxj_dap_atomic_read_reg32(struct i2c_device_addr *dev_addr, if (!data) return -EINVAL; + memset(buf, 0, sizeof(*data)); rc = drxj_dap_atomic_read_write_block(dev_addr, addr, sizeof(*data), buf, true); @@ -4200,6 +4201,7 @@ int drxj_dap_scu_atomic_read_reg16(struct i2c_device_addr *dev_addr, if (!data) return -EINVAL; + memset(buf, 0, 2); rc = drxj_dap_scu_atomic_read_write_block(dev_addr, addr, 2, buf, true); if (rc 0) return rc; @@ -10667,7 +10669,7 @@ ctrl_sig_quality(struct drx_demod_instance *demod, enum drx_standard standard = ext_attr-standard; int rc; u32 ber, cnt, err, pkt; - u16 mer, strength; + u16 mer, strength = 0; rc = get_sig_strength(demod, strength); if (rc 0) { -- 2.0.0-rc0 -- 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: RFC: vb2: replace alloc_ctx by struct device * in vb2_queue
Hi Hans, I'm not very much against it, but I'm not sure how option 2 is significantly simpler than option 1. It's just one cast away from being the same, unless you have some more rework in mind, e.g. making vb2 aware of devices somehow and skip driver's involvement for example? Thanks, Pawel On Sun, Sep 21, 2014 at 10:05 PM, Hans Verkuil hverk...@xs4all.nl wrote: Hi Marek, Pawel, Currently for dma_config (and the dma_sg code that I posted before) drivers have to allocate a alloc_ctx context, but in practice that just contains a device pointer. Is there any reason why we can't just change in struct vb2_queue: void*alloc_ctx[VIDEO_MAX_PLANES]; to: struct device *alloc_ctx[VIDEO_MAX_PLANES]; or possibly even just: struct device *alloc_ctx; That simplifies the code quite a bit and I don't see and need for anything else. The last option would make it impossible to have different allocation contexts for different planes, but that might be something that Samsumg needs. Regards, Hans -- Best regards, Pawel Osciak -- 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] cx231xx: use i2c mux instead of own switching
There no longer is port switching unrelated to any access. The 4 (3 external and 1 internal) i2c busses can now be specified directly via symbolic constants. The handling of the i2c_clients and the bus scanning could be improved, so that the new muxed busses also have i2c_clients for direct usage and are automatically scanned. This patch should be tested for more of the affected devices to make sure it is correct. To get rid of lines greater 80 columns one could save the tuner and demod i2c_adap in local variables. Signed-off-by: Matthias Schwarzott z...@gentoo.org --- drivers/media/usb/cx231xx/Kconfig | 1 + drivers/media/usb/cx231xx/cx231xx-avcore.c | 17 -- drivers/media/usb/cx231xx/cx231xx-cards.c | 85 ++ drivers/media/usb/cx231xx/cx231xx-core.c | 34 ++-- drivers/media/usb/cx231xx/cx231xx-dvb.c| 42 +++ drivers/media/usb/cx231xx/cx231xx-i2c.c| 17 ++ drivers/media/usb/cx231xx/cx231xx-input.c | 2 +- drivers/media/usb/cx231xx/cx231xx.h| 5 +- 8 files changed, 113 insertions(+), 90 deletions(-) diff --git a/drivers/media/usb/cx231xx/Kconfig b/drivers/media/usb/cx231xx/Kconfig index 569aa29..173c0e2 100644 --- a/drivers/media/usb/cx231xx/Kconfig +++ b/drivers/media/usb/cx231xx/Kconfig @@ -7,6 +7,7 @@ config VIDEO_CX231XX select VIDEOBUF_VMALLOC select VIDEO_CX25840 select VIDEO_CX2341X + select I2C_MUX ---help--- This is a video4linux driver for Conexant 231xx USB based TV cards. diff --git a/drivers/media/usb/cx231xx/cx231xx-avcore.c b/drivers/media/usb/cx231xx/cx231xx-avcore.c index 51872b9..fcdbb4b 100644 --- a/drivers/media/usb/cx231xx/cx231xx-avcore.c +++ b/drivers/media/usb/cx231xx/cx231xx-avcore.c @@ -1270,8 +1270,6 @@ int cx231xx_enable_i2c_port_3(struct cx231xx *dev, bool is_port_3) int status = 0; bool current_is_port_3; - if (dev-board.dont_use_port_3) - is_port_3 = false; status = cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, PWR_CTL_EN, value, 4); if (status 0) @@ -1288,9 +1286,6 @@ int cx231xx_enable_i2c_port_3(struct cx231xx *dev, bool is_port_3) else value[0] = ~I2C_DEMOD_EN; - cx231xx_info(Changing the i2c master port to %d\n, -is_port_3 ? 3 : 1); - status = cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, PWR_CTL_EN, value, 4); @@ -2317,9 +2312,6 @@ int cx231xx_set_power_mode(struct cx231xx *dev, enum AV_MODE mode) } if (dev-board.tuner_type != TUNER_ABSENT) { - /* Enable tuner */ - cx231xx_enable_i2c_port_3(dev, true); - /* reset the Tuner */ if (dev-board.tuner_gpio) cx231xx_gpio_set(dev, dev-board.tuner_gpio); @@ -2384,15 +2376,6 @@ int cx231xx_set_power_mode(struct cx231xx *dev, enum AV_MODE mode) } if (dev-board.tuner_type != TUNER_ABSENT) { - /* -* Enable tuner -* Hauppauge Exeter seems to need to do something different! -*/ - if (dev-model == CX231XX_BOARD_HAUPPAUGE_EXETER) - cx231xx_enable_i2c_port_3(dev, false); - else - cx231xx_enable_i2c_port_3(dev, true); - /* reset the Tuner */ if (dev-board.tuner_gpio) cx231xx_gpio_set(dev, dev-board.tuner_gpio); diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c b/drivers/media/usb/cx231xx/cx231xx-cards.c index 791f00c..2f71f08 100644 --- a/drivers/media/usb/cx231xx/cx231xx-cards.c +++ b/drivers/media/usb/cx231xx/cx231xx-cards.c @@ -104,8 +104,8 @@ struct cx231xx_board cx231xx_boards[] = { .ctl_pin_status_mask = 0xFFC4, .agc_analog_digital_select_gpio = 0x0c, .gpio_pin_status_mask = 0x4001000, - .tuner_i2c_master = 1, - .demod_i2c_master = 2, + .tuner_i2c_master = I2C_3, + .demod_i2c_master = I2C_2, .has_dvb = 1, .demod_addr = 0x02, .norm = V4L2_STD_PAL, @@ -144,8 +144,8 @@ struct cx231xx_board cx231xx_boards[] = { .ctl_pin_status_mask = 0xFFC4, .agc_analog_digital_select_gpio = 0x0c, .gpio_pin_status_mask = 0x4001000, - .tuner_i2c_master = 1, - .demod_i2c_master = 2, + .tuner_i2c_master = I2C_3, + .demod_i2c_master = I2C_2, .has_dvb = 1, .demod_addr = 0x32, .norm = V4L2_STD_NTSC, @@ -184,8 +184,8 @@ struct cx231xx_board