Re: [GIT PULL for v3.5] Control events support for uvcvideo
Hi Laurent, I know I am very late with this, but I looked through the event/control core changes and I found a locking bug there. I didn't have a chance to review the patch series when HdG posted it earlier this month, so my apologies for coming up with this only now. The problem is in v4l2-ctrls.c: diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c index 7023e6d..2a44355 100644 --- a/drivers/media/video/v4l2-ctrls.c +++ b/drivers/media/video/v4l2-ctrls.c @@ -2381,10 +2381,22 @@ int v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val) } EXPORT_SYMBOL(v4l2_ctrl_s_ctrl); -void v4l2_ctrl_add_event(struct v4l2_ctrl *ctrl, - struct v4l2_subscribed_event *sev) +static int v4l2_ctrl_add_event(struct v4l2_subscribed_event *sev) { - v4l2_ctrl_lock(ctrl); This lock... + struct v4l2_ctrl_handler *hdl = sev-fh-ctrl_handler; + struct v4l2_ctrl_ref *ref; + struct v4l2_ctrl *ctrl; + int ret = 0; + + mutex_lock(hdl-lock); ...and this lock are not necessarily the same. If the control was from a subdevice then they will be different. This doesn't happen in uvc, but it will in other drivers. + + ref = find_ref(hdl, sev-id); The right approach is to use v4l2_ctrl_find here and then call v4l2_ctrl_lock(ctrl), just as was done in the original code. + if (!ref) { + ret = -EINVAL; + goto leave; + } + ctrl = ref-ctrl; + list_add_tail(sev-node, ctrl-ev_subs); if (ctrl-type != V4L2_CTRL_TYPE_CTRL_CLASS (sev-flags V4L2_EVENT_SUB_FL_SEND_INITIAL)) { @@ -2396,18 +2408,42 @@ void v4l2_ctrl_add_event(struct v4l2_ctrl *ctrl, fill_event(ev, ctrl, changes); v4l2_event_queue_fh(sev-fh, ev); } - v4l2_ctrl_unlock(ctrl); +leave: + mutex_unlock(hdl-lock); + return ret; } -EXPORT_SYMBOL(v4l2_ctrl_add_event); -void v4l2_ctrl_del_event(struct v4l2_ctrl *ctrl, - struct v4l2_subscribed_event *sev) +static void v4l2_ctrl_del_event(struct v4l2_subscribed_event *sev) { - v4l2_ctrl_lock(ctrl); + struct v4l2_ctrl_handler *hdl = sev-fh-ctrl_handler; + + mutex_lock(hdl-lock); Same problem here. list_del(sev-node); - v4l2_ctrl_unlock(ctrl); + mutex_unlock(hdl-lock); } -EXPORT_SYMBOL(v4l2_ctrl_del_event); So the code should be: static int v4l2_ctrl_add_event(struct v4l2_subscribed_event *sev) { struct v4l2_ctrl *ctrl = v4l2_ctrl_find(sev-fh-ctrl_handler, sev-id); if (ctrl == NULL) return -EINVAL; v4l2_ctrl_lock(ctrl); list_add_tail(sev-node, ctrl-ev_subs); if (ctrl-type != V4L2_CTRL_TYPE_CTRL_CLASS (sev-flags V4L2_EVENT_SUB_FL_SEND_INITIAL)) { struct v4l2_event ev; u32 changes = V4L2_EVENT_CTRL_CH_FLAGS; if (!(ctrl-flags V4L2_CTRL_FLAG_WRITE_ONLY)) changes |= V4L2_EVENT_CTRL_CH_VALUE; fill_event(ev, ctrl, changes); v4l2_event_queue_fh(sev-fh, ev); } v4l2_ctrl_unlock(ctrl); return 0; } and: static void v4l2_ctrl_del_event(struct v4l2_subscribed_event *sev) { struct v4l2_ctrl *ctrl = v4l2_ctrl_find(sev-fh-ctrl_handler, sev-id); v4l2_ctrl_lock(ctrl); list_del(sev-node); v4l2_ctrl_unlock(ctrl); } Regards, Hans On Sunday, April 29, 2012 19:59:01 Laurent Pinchart wrote: Hi Mauro, The following changes since commit bcb2cf6e0bf033d79821c89e5ccb328bfbd44907: [media] ngene: remove an unneeded condition (2012-04-26 15:29:23 -0300) are available in the git repository at: git://linuxtv.org/pinchartl/uvcvideo.git uvcvideo-events Hans de Goede (10): media/radio: use v4l2_ctrl_subscribe_event where possible v4l2-event: Add v4l2_subscribed_event_ops v4l2-ctrls: Use v4l2_subscribed_event_ops uvcvideo: Fix a ignoring return value of ‘__clear_user’ warning uvcvideo: Refactor uvc_ctrl_get and query uvcvideo: Move __uvc_ctrl_get() up uvcvideo: Add support for control events uvcvideo: Properly report the inactive flag for inactive controls uvcvideo: Send control change events for slave ctrls when the master changes uvcvideo: Drop unused ctrl member from struct uvc_control_mapping Documentation/video4linux/v4l2-framework.txt | 28 ++- drivers/media/radio/radio-isa.c | 10 +- drivers/media/radio/radio-keene.c| 14 +- drivers/media/video/ivtv/ivtv-ioctl.c|3 +- drivers/media/video/omap3isp/ispccdc.c |2 +- drivers/media/video/omap3isp/ispstat.c |2 +- drivers/media/video/uvc/uvc_ctrl.c | 320 + drivers/media/video/uvc/uvc_v4l2.c | 46 +++-
Pinnacle PCTV IR trouble
Hi, I have a Pinnacle PCTV 310i PCI DVB-T card and I have some problems with getting the IR remote working. The card identifies itself as: saa7130/34: v4l2 driver version 0, 2, 17 loaded saa7133[0]: found at :02:00.0, rev: 209, irq: 16, latency: 32, mmio: 0xfe60 saa7133[0]: subsystem: 11bd:002f, board: Pinnacle PCTV 310i [card=101,autodetected] saa7133[0]: board init: gpio is 600e000 saa7133[0]: i2c eeprom 00: bd 11 2f 00 54 20 1c 00 43 43 a9 1c 55 d2 b2 92 saa7133[0]: i2c eeprom 10: ff e0 60 06 ff 20 ff ff 00 30 8d 36 74 54 ff ff saa7133[0]: i2c eeprom 20: 01 2c 01 23 23 01 04 30 98 ff 00 e7 ff 21 00 c2 saa7133[0]: i2c eeprom 30: 96 10 03 32 15 20 ff 15 0e 6c a3 eb 04 e6 48 c6 saa7133[0]: i2c eeprom 40: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7133[0]: i2c eeprom 50: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7133[0]: i2c eeprom 60: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7133[0]: i2c eeprom 70: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7133[0]: i2c eeprom 80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7133[0]: i2c eeprom 90: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7133[0]: i2c eeprom a0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7133[0]: i2c eeprom b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7133[0]: i2c eeprom c0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7133[0]: i2c eeprom d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7133[0]: i2c eeprom e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7133[0]: i2c eeprom f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff i2c-core: driver [tuner] using legacy suspend method i2c-core: driver [tuner] using legacy resume method tuner 12-004b: Tuner -1 found with type(s) Radio TV. tda829x 12-004b: setting tuner address to 61 tda829x 12-004b: type set to tda8290+75a saa7133[0]: registered device video0 [v4l2] saa7133[0]: registered device vbi0 saa7133[0]: registered device radio0 dvb_init() allocating 1 frontend DVB: registering new adapter (saa7133[0]) DVB: registering adapter 0 frontend 0 (Philips TDA10046H DVB-T)... tda1004x: setting up plls for 48MHz sampling clock tda1004x: found firmware revision 20 -- ok saa7134 ALSA driver for DMA sound loaded saa7133[0]/alsa: saa7133[0] at 0xfe60 irq 16 registered as card -1 The first problem is that with current 3.4.0-rc4 kernel the IR input device is not recognized with ir-kbd-i2c: : Unsupported device at address 0x47 I've found a Debian bug [1], which describes a similar problem. It has a patch attached which fixes this. I have no idea if it's correct, but it'd be nice to get it upstream if it is. With the patch applied, the IR device is detected as Registered IR keymap rc-pinnacle-color input: i2c IR (Pinnacle PCTV) as /devices/virtual/rc/rc1/input17 rc1: i2c IR (Pinnacle PCTV) as /devices/virtual/rc/rc1 ir-kbd-i2c: i2c IR (Pinnacle PCTV) detected at i2c-12/12-0047/ir0 [saa7133[0]] However, pressing a button on a remote results (with i2c_debug=1) in the following messages saa7133[0]: i2c xfer: 8f ERROR: NO_DEVICE i2c IR (Pinnacle PCTV)/ir: read error saa7133[0]: i2c xfer: 8f ERROR: NO_DEVICE i2c IR (Pinnacle PCTV)/ir: read error saa7133[0]: i2c xfer: 8f ERROR: NO_DEVICE i2c IR (Pinnacle PCTV)/ir: read error and LIRC doesn't read anything. catting the event device spits out some data after a few minutes, but i don't know if it's garbage or what. It's not usable in any case I'd much appreciate any help with this. [1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=617488 -- Anton Khirnov -- 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
subdev_pad_ops vs video_ops
subdev_pad_ops and video_ops both contains operation related to format, crop and bus format. When should one or the other be used ? For example mt9p031 implement everything using pad_ops, but other drivers use video_ops functions. -- 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.5] (v2) Control events support for uvcvideo
Hi Mauro, A locking bug was present in the previous pull request. Please ignore it and pull this one instead. The following changes since commit bcb2cf6e0bf033d79821c89e5ccb328bfbd44907: [media] ngene: remove an unneeded condition (2012-04-26 15:29:23 -0300) are available in the git repository at: git://linuxtv.org/pinchartl/uvcvideo.git uvcvideo-events Hans de Goede (10): media/radio: use v4l2_ctrl_subscribe_event where possible v4l2-event: Add v4l2_subscribed_event_ops v4l2-ctrls: Use v4l2_subscribed_event_ops uvcvideo: Fix a ignoring return value of ‘__clear_user’ warning uvcvideo: Refactor uvc_ctrl_get and query uvcvideo: Move __uvc_ctrl_get() up uvcvideo: Add support for control events uvcvideo: Properly report the inactive flag for inactive controls uvcvideo: Send control change events for slave ctrls when the master changes uvcvideo: Drop unused ctrl member from struct uvc_control_mapping Documentation/video4linux/v4l2-framework.txt | 28 ++- drivers/media/radio/radio-isa.c | 10 +- drivers/media/radio/radio-keene.c| 14 +- drivers/media/video/ivtv/ivtv-ioctl.c|3 +- drivers/media/video/omap3isp/ispccdc.c |2 +- drivers/media/video/omap3isp/ispstat.c |2 +- drivers/media/video/uvc/uvc_ctrl.c | 320 ++ drivers/media/video/uvc/uvc_v4l2.c | 46 +++- drivers/media/video/uvc/uvcvideo.h | 26 ++- drivers/media/video/v4l2-ctrls.c | 47 +++- drivers/media/video/v4l2-event.c | 71 +++--- drivers/usb/gadget/uvc_v4l2.c|2 +- include/media/v4l2-ctrls.h |7 +- include/media/v4l2-event.h | 24 ++- 14 files changed, 447 insertions(+), 155 deletions(-) -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: subdev_pad_ops vs video_ops
Hi Jean-Philippe, On Monday 30 April 2012 10:34:54 jean-philippe francois wrote: subdev_pad_ops and video_ops both contains operation related to format, crop and bus format. When should one or the other be used ? For example mt9p031 implement everything using pad_ops, but other drivers use video_ops functions. The pad ops are required by the media controller framework. New drivers should use pad ops for format and selection handling. We need wrappers to translate video ops to pad ops to be used by bridge drivers that don't support pad ops yet. -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [GIT PULL for v3.5] (v2) Control events support for uvcvideo
Hi Laurent! On Monday 30 April 2012 11:43:10 Laurent Pinchart wrote: Hi Mauro, A locking bug was present in the previous pull request. Please ignore it and pull this one instead. I hate to say it, but while you did update v4l2_ctrl_add_event, you forgot to update v4l2_ctrl_del_event as well. That one still has the same locking issue... Time for a v3 :-) Regards, Hans The following changes since commit bcb2cf6e0bf033d79821c89e5ccb328bfbd44907: [media] ngene: remove an unneeded condition (2012-04-26 15:29:23 -0300) are available in the git repository at: git://linuxtv.org/pinchartl/uvcvideo.git uvcvideo-events Hans de Goede (10): media/radio: use v4l2_ctrl_subscribe_event where possible v4l2-event: Add v4l2_subscribed_event_ops v4l2-ctrls: Use v4l2_subscribed_event_ops uvcvideo: Fix a ignoring return value of ‘__clear_user’ warning uvcvideo: Refactor uvc_ctrl_get and query uvcvideo: Move __uvc_ctrl_get() up uvcvideo: Add support for control events uvcvideo: Properly report the inactive flag for inactive controls uvcvideo: Send control change events for slave ctrls when the master changes uvcvideo: Drop unused ctrl member from struct uvc_control_mapping Documentation/video4linux/v4l2-framework.txt | 28 ++- drivers/media/radio/radio-isa.c | 10 +- drivers/media/radio/radio-keene.c| 14 +- drivers/media/video/ivtv/ivtv-ioctl.c|3 +- drivers/media/video/omap3isp/ispccdc.c |2 +- drivers/media/video/omap3isp/ispstat.c |2 +- drivers/media/video/uvc/uvc_ctrl.c | 320 ++ drivers/media/video/uvc/uvc_v4l2.c | 46 +++- drivers/media/video/uvc/uvcvideo.h | 26 ++- drivers/media/video/v4l2-ctrls.c | 47 +++- drivers/media/video/v4l2-event.c | 71 +++--- drivers/usb/gadget/uvc_v4l2.c|2 +- include/media/v4l2-ctrls.h |7 +- include/media/v4l2-event.h | 24 ++- 14 files changed, 447 insertions(+), 155 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
[GIT PULL for v3.5] (v3) Control events support for uvcvideo
Hi Hans, On Monday 30 April 2012 11:49:54 Hans Verkuil wrote: On Monday 30 April 2012 11:43:10 Laurent Pinchart wrote: Hi Mauro, A locking bug was present in the previous pull request. Please ignore it and pull this one instead. I hate to say it, but while you did update v4l2_ctrl_add_event, you forgot to update v4l2_ctrl_del_event as well. That one still has the same locking issue... If it wasn't noon already I'd blame it on not having woken up completely :-) Time for a v3 :-) Here it is. Mauro, could you please pull the following ? Sorry for the noise. The following changes since commit bcb2cf6e0bf033d79821c89e5ccb328bfbd44907: [media] ngene: remove an unneeded condition (2012-04-26 15:29:23 -0300) are available in the git repository at: git://linuxtv.org/pinchartl/uvcvideo.git uvcvideo-events Hans de Goede (10): media/radio: use v4l2_ctrl_subscribe_event where possible v4l2-event: Add v4l2_subscribed_event_ops v4l2-ctrls: Use v4l2_subscribed_event_ops uvcvideo: Fix a ignoring return value of ‘__clear_user’ warning uvcvideo: Refactor uvc_ctrl_get and query uvcvideo: Move __uvc_ctrl_get() up uvcvideo: Add support for control events uvcvideo: Properly report the inactive flag for inactive controls uvcvideo: Send control change events for slave ctrls when the master changes uvcvideo: Drop unused ctrl member from struct uvc_control_mapping Documentation/video4linux/v4l2-framework.txt | 28 ++- drivers/media/radio/radio-isa.c | 10 +- drivers/media/radio/radio-keene.c| 14 +- drivers/media/video/ivtv/ivtv-ioctl.c|3 +- drivers/media/video/omap3isp/ispccdc.c |2 +- drivers/media/video/omap3isp/ispstat.c |2 +- drivers/media/video/uvc/uvc_ctrl.c | 320 ++ drivers/media/video/uvc/uvc_v4l2.c | 46 +++- drivers/media/video/uvc/uvcvideo.h | 26 ++- drivers/media/video/v4l2-ctrls.c | 41 +++- drivers/media/video/v4l2-event.c | 71 +++--- drivers/usb/gadget/uvc_v4l2.c|2 +- include/media/v4l2-ctrls.h |7 +- include/media/v4l2-event.h | 24 ++- 14 files changed, 443 insertions(+), 153 deletions(-) -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Using UVC webcam gadget with a real v4l2 device
Hi Bhupesh, On Thursday 26 April 2012 13:23:59 Bhupesh SHARMA wrote: Hi Laurent, Sorry to jump-in before your reply on my previous mail, but as I was studying the USERPTR stuff in more detail, I have a few more queries which I believe you can include in your reply as well.. [snip] I am now a bit confused on how the entire system will work now: - Does USERPTR method needs to be supported both in UVC gadget and soc-camera side, or one can still support the MMAP method and the other can now be changed to support USERPTR method and we can achieve a ZERO buffer copy operation using this method? You need USERPTR support on one side only. In practice many (all?) soc-camera drivers require physically contiguous memory, so you will need to use MMAP on the soc-camera side and USERPTR on the UVC gadget side. DMABUF, when merged in the kernel, will be a better solution (but will require all drivers to use vb2). - More specifically, I would like to keep the soc-camera still using MMAP (and hence still using video-buf) and make changes at the UVC gadget side to support USERPTR and videobuf2. Will this work? Please see above :-) - At the application side how should we design the flow in case both support USERPTR, i.e. the buffer needs to be protected from simultaneous access from the UVC gadget driver and soc-camera driver (to ensure that a single buffer can be shared across them). Also in case we keep soc-camera still using MMAP and UVC gadget side supporting USERPTR, how can we share a common buffer across the UVC gadget and soc-camera driver. That's easy. Request the same number of buffers on both sides with REQBUFS, mmap() them to userspace on the soc-camera side, and then use the user pointer to queue them with QBUF on the UVC side. You just need to ensure that a buffer is never enqueued to two drivers at the same time. Wait for buffers to be ready on both sides with select(), and when a buffer is ready dequeue it and requeue it on the other side. - In case of USERPTR method the camera capture hardware should be able to DMA the received data to the user space buffers. Are there any specific requirements on the DMA capability of these use-space buffers (scatter-gather or contiguous?). DMA to userspace is quite hackish. You should use the MMAP method on the soc- camera side. -- 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
OMAP3 previewer bayer pattern selection
Hi, I am trying to get a working preview from a CMOS sensor with a CFA bayer pattern. Does the CCDC_COLPTN register have any effect on previewer CFA interpolation ? From my experience it does not. I can set BGGR or GRBG, but the output is always the same. When doing raw capture, I get nice image if I use a BGGR pattern for my software bayer to rgb interpolation. When using previewer, the output looks like BGGR interpreted as GRBG, ie blue and red are green, and green turns into purple. Looking at the driver code (mainline), there is nothing about bayer order in the previewer code. Looking at the TRM, theres is also nothing in the previewer part about bayer order. How are we supposed to debayer something different from GRBG ? By modifying the cfa_coef_table table ? Cropping at the previewer output to start on an odd line ? Thank you for any pointer on this issue. Jean-Philippe François -- 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: Using UVC webcam gadget with a real v4l2 device
Hi Laurent, -Original Message- From: Laurent Pinchart [mailto:laurent.pinch...@ideasonboard.com] Sent: Monday, April 30, 2012 3:51 PM To: Bhupesh SHARMA Cc: linux-...@vger.kernel.org; linux-media@vger.kernel.org; ba...@ti.com; g.liakhovet...@gmx.de Subject: Re: Using UVC webcam gadget with a real v4l2 device Hi Bhupesh, On Thursday 26 April 2012 13:23:59 Bhupesh SHARMA wrote: Hi Laurent, Sorry to jump-in before your reply on my previous mail, but as I was studying the USERPTR stuff in more detail, I have a few more queries which I believe you can include in your reply as well.. [snip] I am now a bit confused on how the entire system will work now: - Does USERPTR method needs to be supported both in UVC gadget and soc-camera side, or one can still support the MMAP method and the other can now be changed to support USERPTR method and we can achieve a ZERO buffer copy operation using this method? You need USERPTR support on one side only. In practice many (all?) soc- camera drivers require physically contiguous memory, so you will need to use MMAP on the soc-camera side and USERPTR on the UVC gadget side. DMABUF, when merged in the kernel, will be a better solution (but will require all drivers to use vb2). Perfect. So, I plan now to add vb2 support for uvc-gadget and leave soc-camera side to use the mmap stuff. Now, waiting for your pointers for managing the race-conditions in the UVC gadget and also avoiding the memcpy that is happening in the QBUF call on the UVC gadget, before I start the actual work. Thanks for your help. Regards, Bhupesh - More specifically, I would like to keep the soc-camera still using MMAP (and hence still using video-buf) and make changes at the UVC gadget side to support USERPTR and videobuf2. Will this work? Please see above :-) - At the application side how should we design the flow in case both support USERPTR, i.e. the buffer needs to be protected from simultaneous access from the UVC gadget driver and soc-camera driver (to ensure that a single buffer can be shared across them). Also in case we keep soc- camera still using MMAP and UVC gadget side supporting USERPTR, how can we share a common buffer across the UVC gadget and soc-camera driver. That's easy. Request the same number of buffers on both sides with REQBUFS, mmap() them to userspace on the soc-camera side, and then use the user pointer to queue them with QBUF on the UVC side. You just need to ensure that a buffer is never enqueued to two drivers at the same time. Wait for buffers to be ready on both sides with select(), and when a buffer is ready dequeue it and requeue it on the other side. - In case of USERPTR method the camera capture hardware should be able to DMA the received data to the user space buffers. Are there any specific requirements on the DMA capability of these use-space buffers (scatter-gather or contiguous?). DMA to userspace is quite hackish. You should use the MMAP method on the soc- camera side. -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFCv1 PATCH 0/7] gspca: allow use of control framework and other fixes
Hi, On 04/28/2012 05:09 PM, Hans Verkuil wrote: Hi all, Here is a patch series that makes it possible to use the control framework in gspca. The gspca core changes are very minor but as a bonus give you priority support as well. The hard work is in updating the subdrivers. I've done two, and I intend to do the stv06xx driver as well, but that's the last of my gspca webcams that I can test. Looking through the subdrivers I think that 50-70% are in the category 'easy to convert', the others will take a bit more time (autogain/gain type of constructs are always more complex than just a simple brightness control). After applying this patch series the two converted drivers pass the v4l2-compliance test as it stands today. I haven't looked at any details yet, but from the description I love the changes :) I was actually planning on doing something very similar myself soon-ish, so you've saved me a bunch of work :) I'll review this and add these to my tree. Jean-Francois, is it ok for these changes to go upstream through my tree? The reason I'm asking is that I plan to convert more subdrivers to the control framework for 3.5 and its easiest to have this all in one tree then. If you've remarks to the core changes I will make sure these get addressed in my tree of course. Regards, Hans (the other 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: [GIT PULL for 3.3-rc1] media updates
Hi Geert, On Wednesday 25 April 2012 17:12:49 Geert Uytterhoeven wrote: On Sun, Jan 15, 2012 at 14:41, Mauro Carvalho Chehab wrote: Laurent Pinchart (18): [media] uvcvideo: Move fields from uvc_buffer::buf to uvc_buffer [media] uvcvideo: Use videobuf2-vmalloc It seems these change (3d95e932573c316ad56b8e2f283e26de0b9c891c resp. 6998b6fb4b1c8f320adeee938d399c4d8dcc90e2) broke the build for nommu a while ago, as uvc_queue_get_unmapped_area() was not or was incorrectly updated: drivers/media/video/uvc/uvc_queue.c:254:23: error: 'struct uvc_video_queue' has no member named 'count' drivers/media/video/uvc/uvc_queue.c:255:18: error: 'struct uvc_video_queue' has no member named 'buffer' drivers/media/video/uvc/uvc_queue.c:256:19: error: 'struct vb2_buffer' has no member named 'm' drivers/media/video/uvc/uvc_queue.c:259:16: error: 'struct uvc_video_queue' has no member named 'count' drivers/media/video/uvc/uvc_queue.c:263:23: error: 'buf' undeclared (first use in this function) Cfr. http://kisskb.ellerman.id.au/kisskb/buildresult/6171077/ My bad, and thanks for the report. The following patch should fix this. Do you have a NOMMU system to test it on ? From bbd5c24f340abeeecddd3e84c0da76408fc3f964 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart laurent.pinch...@ideasonboard.com Date: Mon, 30 Apr 2012 13:19:10 +0200 Subject: [PATCH] uvcvideo: Use videobuf2 .get_unmapped_area() implementation The get_unmapped_area() operation was forgotten during conversion to videobuf2. Fix it. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/video/uvc/uvc_queue.c | 43 ++ 1 files changed, 13 insertions(+), 30 deletions(-) diff --git a/drivers/media/video/uvc/uvc_queue.c b/drivers/media/video/uvc/uvc_queue.c index 8f54e24..9288fbd 100644 --- a/drivers/media/video/uvc/uvc_queue.c +++ b/drivers/media/video/uvc/uvc_queue.c @@ -207,6 +207,19 @@ int uvc_queue_mmap(struct uvc_video_queue *queue, struct vm_area_struct *vma) return ret; } +#ifndef CONFIG_MMU +unsigned long uvc_queue_get_unmapped_area(struct uvc_video_queue *queue, + unsigned long pgoff) +{ + unsigned long ret; + + mutex_lock(queue-mutex); + ret = vb2_get_unmapped_area(queue-queue, 0, 0, pgoff, 0); + mutex_unlock(queue-mutex); + return ret; +} +#endif + unsigned int uvc_queue_poll(struct uvc_video_queue *queue, struct file *file, poll_table *wait) { @@ -237,36 +250,6 @@ int uvc_queue_allocated(struct uvc_video_queue *queue) return allocated; } -#ifndef CONFIG_MMU -/* - * Get unmapped area. - * - * NO-MMU arch need this function to make mmap() work correctly. - */ -unsigned long uvc_queue_get_unmapped_area(struct uvc_video_queue *queue, - unsigned long pgoff) -{ - struct uvc_buffer *buffer; - unsigned int i; - unsigned long ret; - - mutex_lock(queue-mutex); - for (i = 0; i queue-count; ++i) { - buffer = queue-buffer[i]; - if ((buffer-buf.m.offset PAGE_SHIFT) == pgoff) - break; - } - if (i == queue-count) { - ret = -EINVAL; - goto done; - } - ret = (unsigned long)buf-mem; -done: - mutex_unlock(queue-mutex); - return ret; -} -#endif - /* * Enable or disable the video buffers queue. * -- 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
Ambiguous specification regarding valid audmode value for radio tuners
Hi all, While working on the v4l2-compliance tool I came across an ambiguous specification. The question is whether VIDIOC_S_TUNER should accept audmode values other then MONO and STEREO for FM radio devices. On the one hand the description of VIDIOC_S_TUNER says: Drivers may choose a different audio mode if the requested mode is invalid or unsupported. On the other hand the clearly mention that the non-MONO and -STEREO modes are for analog TV only. The return code description says that -EINVAL is only returned in case of an invalid index value. I'm inclined to say that for radio devices any audmodes other than MONO and STEREO should cause a -EINVAL error. Alternatively we could define that any other audmodes are accepted but map to STEREO instead. Comments? 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
[PATCH 1/1] v4l: drop v4l2_buffer.input and V4L2_BUF_FLAG_INPUT
Remove input field in struct v4l2_buffer and flag V4L2_BUF_FLAG_INPUT which tells the former is valid. The flag is used by no driver currently. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi --- Hi all, I thought this would be a good time to get rid of the input field in v4l2_buffer to avoid writing more useless compat code for it --- the enum compat code. Comments are welcome. This patch is compile tested on videobuf and videobuf2. drivers/media/video/v4l2-compat-ioctl32.c |8 +++- drivers/media/video/videobuf-core.c | 16 drivers/media/video/videobuf2-core.c |4 +--- include/linux/videodev2.h |4 +--- include/media/videobuf-core.h |2 -- 5 files changed, 5 insertions(+), 29 deletions(-) diff --git a/drivers/media/video/v4l2-compat-ioctl32.c b/drivers/media/video/v4l2-compat-ioctl32.c index 2829d25..a2ddc37 100644 --- a/drivers/media/video/v4l2-compat-ioctl32.c +++ b/drivers/media/video/v4l2-compat-ioctl32.c @@ -387,8 +387,7 @@ static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user get_user(kp-index, up-index) || get_user(kp-type, up-type) || get_user(kp-flags, up-flags) || - get_user(kp-memory, up-memory) || - get_user(kp-input, up-input)) + get_user(kp-memory, up-memory) return -EFAULT; if (V4L2_TYPE_IS_OUTPUT(kp-type)) @@ -472,8 +471,7 @@ static int put_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user put_user(kp-index, up-index) || put_user(kp-type, up-type) || put_user(kp-flags, up-flags) || - put_user(kp-memory, up-memory) || - put_user(kp-input, up-input)) + put_user(kp-memory, up-memory) return -EFAULT; if (put_user(kp-bytesused, up-bytesused) || @@ -482,7 +480,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-reserved, up-reserved)) + copy_to_user(kp-reserved, up-reserved, sizeof(kp-reserved)) return -EFAULT; if (V4L2_TYPE_IS_MULTIPLANAR(kp-type)) { diff --git a/drivers/media/video/videobuf-core.c b/drivers/media/video/videobuf-core.c index ffdf59c..bf7a326 100644 --- a/drivers/media/video/videobuf-core.c +++ b/drivers/media/video/videobuf-core.c @@ -359,11 +359,6 @@ static void videobuf_status(struct videobuf_queue *q, struct v4l2_buffer *b, break; } - if (vb-input != UNSET) { - b-flags |= V4L2_BUF_FLAG_INPUT; - b-input = vb-input; - } - b-field = vb-field; b-timestamp = vb-ts; b-bytesused = vb-size; @@ -402,7 +397,6 @@ int __videobuf_mmap_setup(struct videobuf_queue *q, break; q-bufs[i]-i = i; - q-bufs[i]-input = UNSET; q-bufs[i]-memory = memory; q-bufs[i]-bsize = bsize; switch (memory) { @@ -566,16 +560,6 @@ int videobuf_qbuf(struct videobuf_queue *q, struct v4l2_buffer *b) goto done; } - if (b-flags V4L2_BUF_FLAG_INPUT) { - if (b-input = q-inputs) { - dprintk(1, qbuf: wrong input.\n); - goto done; - } - buf-input = b-input; - } else { - buf-input = UNSET; - } - switch (b-memory) { case V4L2_MEMORY_MMAP: if (0 == buf-baddr) { diff --git a/drivers/media/video/videobuf2-core.c b/drivers/media/video/videobuf2-core.c index 3786d88..0daaec7 100644 --- a/drivers/media/video/videobuf2-core.c +++ b/drivers/media/video/videobuf2-core.c @@ -338,8 +338,7 @@ static int __fill_v4l2_buffer(struct vb2_buffer *vb, struct v4l2_buffer *b) /* Copy back data such as timestamp, flags, input, etc. */ memcpy(b, vb-v4l2_buf, offsetof(struct v4l2_buffer, m)); - b-input = vb-v4l2_buf.input; - b-reserved = vb-v4l2_buf.reserved; + memcpy(b-reserved, vb-v4l2_buf.reserved, sizeof(b-reserved)); if (V4L2_TYPE_IS_MULTIPLANAR(q-type)) { ret = __verify_planes_array(vb, b); @@ -860,7 +859,6 @@ static int __fill_vb2_buffer(struct vb2_buffer *vb, const struct v4l2_buffer *b, vb-v4l2_buf.field = b-field; vb-v4l2_buf.timestamp = b-timestamp; - vb-v4l2_buf.input = b-input; vb-v4l2_buf.flags = b-flags ~V4L2_BUFFER_STATE_FLAGS; return 0; diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 5a09ac3..ae3062d 100644 ---
Re: [PATCH 1/1] v4l: drop v4l2_buffer.input and V4L2_BUF_FLAG_INPUT
Hi Sakari, On Monday 30 April 2012 15:40:24 Sakari Ailus wrote: Remove input field in struct v4l2_buffer and flag V4L2_BUF_FLAG_INPUT which tells the former is valid. The flag is used by no driver currently. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi --- Hi all, I thought this would be a good time to get rid of the input field in v4l2_buffer to avoid writing more useless compat code for it --- the enum compat code. Comments are welcome. This patch is compile tested on videobuf and videobuf2. I'm all for this. As far as I know, the field was only useful for a single out-of-tree driver which is long dead now. drivers/media/video/v4l2-compat-ioctl32.c |8 +++- drivers/media/video/videobuf-core.c | 16 drivers/media/video/videobuf2-core.c |4 +--- include/linux/videodev2.h |4 +--- include/media/videobuf-core.h |2 -- A quick grep through the code shows that you've missed the cpia2 driver which sets the input field to 0 in cpia2_dqbuf(). Please try to compile as many drivers as possible with this patch. Using coccinelle (http://coccinelle.lip6.fr/) could help finding other accesses to the input field. 5 files changed, 5 insertions(+), 29 deletions(-) diff --git a/drivers/media/video/v4l2-compat-ioctl32.c b/drivers/media/video/v4l2-compat-ioctl32.c index 2829d25..a2ddc37 100644 --- a/drivers/media/video/v4l2-compat-ioctl32.c +++ b/drivers/media/video/v4l2-compat-ioctl32.c @@ -387,8 +387,7 @@ static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user get_user(kp-index, up-index) || get_user(kp-type, up-type) || get_user(kp-flags, up-flags) || - get_user(kp-memory, up-memory) || - get_user(kp-input, up-input)) + get_user(kp-memory, up-memory) return -EFAULT; if (V4L2_TYPE_IS_OUTPUT(kp-type)) @@ -472,8 +471,7 @@ static int put_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user put_user(kp-index, up-index) || put_user(kp-type, up-type) || put_user(kp-flags, up-flags) || - put_user(kp-memory, up-memory) || - put_user(kp-input, up-input)) + put_user(kp-memory, up-memory) return -EFAULT; if (put_user(kp-bytesused, up-bytesused) || @@ -482,7 +480,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-reserved, up-reserved)) + copy_to_user(kp-reserved, up-reserved, sizeof(kp-reserved)) return -EFAULT; if (V4L2_TYPE_IS_MULTIPLANAR(kp-type)) { diff --git a/drivers/media/video/videobuf-core.c b/drivers/media/video/videobuf-core.c index ffdf59c..bf7a326 100644 --- a/drivers/media/video/videobuf-core.c +++ b/drivers/media/video/videobuf-core.c @@ -359,11 +359,6 @@ static void videobuf_status(struct videobuf_queue *q, struct v4l2_buffer *b, break; } - if (vb-input != UNSET) { - b-flags |= V4L2_BUF_FLAG_INPUT; - b-input = vb-input; - } - b-field = vb-field; b-timestamp = vb-ts; b-bytesused = vb-size; @@ -402,7 +397,6 @@ int __videobuf_mmap_setup(struct videobuf_queue *q, break; q-bufs[i]-i = i; - q-bufs[i]-input = UNSET; q-bufs[i]-memory = memory; q-bufs[i]-bsize = bsize; switch (memory) { @@ -566,16 +560,6 @@ int videobuf_qbuf(struct videobuf_queue *q, struct v4l2_buffer *b) goto done; } - if (b-flags V4L2_BUF_FLAG_INPUT) { - if (b-input = q-inputs) { - dprintk(1, qbuf: wrong input.\n); - goto done; - } - buf-input = b-input; - } else { - buf-input = UNSET; - } - switch (b-memory) { case V4L2_MEMORY_MMAP: if (0 == buf-baddr) { diff --git a/drivers/media/video/videobuf2-core.c b/drivers/media/video/videobuf2-core.c index 3786d88..0daaec7 100644 --- a/drivers/media/video/videobuf2-core.c +++ b/drivers/media/video/videobuf2-core.c @@ -338,8 +338,7 @@ static int __fill_v4l2_buffer(struct vb2_buffer *vb, struct v4l2_buffer *b) /* Copy back data such as timestamp, flags, input, etc. */ memcpy(b, vb-v4l2_buf, offsetof(struct v4l2_buffer, m)); - b-input = vb-v4l2_buf.input; - b-reserved = vb-v4l2_buf.reserved; + memcpy(b-reserved, vb-v4l2_buf.reserved, sizeof(b-reserved)); if (V4L2_TYPE_IS_MULTIPLANAR(q-type)) { ret = __verify_planes_array(vb, b); @@ -860,7 +859,6 @@ static int __fill_vb2_buffer(struct
Re: [PATCH 1/1] v4l: drop v4l2_buffer.input and V4L2_BUF_FLAG_INPUT
Hi Laurent, On Mon, Apr 30, 2012 at 02:48:23PM +0200, Laurent Pinchart wrote: On Monday 30 April 2012 15:40:24 Sakari Ailus wrote: Remove input field in struct v4l2_buffer and flag V4L2_BUF_FLAG_INPUT which tells the former is valid. The flag is used by no driver currently. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi --- Hi all, I thought this would be a good time to get rid of the input field in v4l2_buffer to avoid writing more useless compat code for it --- the enum compat code. Comments are welcome. This patch is compile tested on videobuf and videobuf2. I'm all for this. As far as I know, the field was only useful for a single out-of-tree driver which is long dead now. drivers/media/video/v4l2-compat-ioctl32.c |8 +++- drivers/media/video/videobuf-core.c | 16 drivers/media/video/videobuf2-core.c |4 +--- include/linux/videodev2.h |4 +--- include/media/videobuf-core.h |2 -- A quick grep through the code shows that you've missed the cpia2 driver which sets the input field to 0 in cpia2_dqbuf(). Please try to compile as many drivers as possible with this patch. Using coccinelle (http://coccinelle.lip6.fr/) could help finding other accesses to the input field. I grepped them but forgot to give -r option to grep... I found no further uses of the input field by quick looking. I'll compile what I can and resend the patch. -- Sakari Ailus e-mail: sakari.ai...@iki.fi jabber/XMPP/Gmail: sai...@retiisi.org.uk -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/1] v4l: drop v4l2_buffer.input and V4L2_BUF_FLAG_INPUT
Remove input field in struct v4l2_buffer and flag V4L2_BUF_FLAG_INPUT which tells the former is valid. The flag is used by no driver currently. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi --- Hi all, I thought this would be a good time to get rid of the input field in v4l2_buffer to avoid writing more useless compat code for it --- the enum compat code. Comments are welcome. This patch is compile tested on videobuf and videobuf2. Update: Fixes according to Laurent's comments. All drivers available on x86 and arm (N9) have been compile tested. Changes to the previous patch: - videobuf2 comment fix (the input field is no longer there). - cpia driver still contained a reference to input field and also needed changes to handling of the reserved field. - Bring back UNSET. While this is no longer used in videobuf as the result of the removal of the input field, it is quite widely misused outside videobuf, and removing it should be a separate patch. drivers/media/video/cpia2/cpia2_v4l.c |3 +-- drivers/media/video/v4l2-compat-ioctl32.c |8 +++- drivers/media/video/videobuf-core.c | 16 drivers/media/video/videobuf2-core.c |6 ++ include/linux/videodev2.h |4 +--- 5 files changed, 7 insertions(+), 30 deletions(-) diff --git a/drivers/media/video/cpia2/cpia2_v4l.c b/drivers/media/video/cpia2/cpia2_v4l.c index 077eb1d..1ed633f 100644 --- a/drivers/media/video/cpia2/cpia2_v4l.c +++ b/drivers/media/video/cpia2/cpia2_v4l.c @@ -1289,8 +1289,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-input = 0; - buf-reserved = 0; + memset(buf-reserved, 0, sizeof(buf-reserved)); memset(buf-timecode, 0, sizeof(buf-timecode)); DBG(DQBUF #%d status:%d seq:%d length:%d\n, buf-index, diff --git a/drivers/media/video/v4l2-compat-ioctl32.c b/drivers/media/video/v4l2-compat-ioctl32.c index 2829d25..a2ddc37 100644 --- a/drivers/media/video/v4l2-compat-ioctl32.c +++ b/drivers/media/video/v4l2-compat-ioctl32.c @@ -387,8 +387,7 @@ static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user get_user(kp-index, up-index) || get_user(kp-type, up-type) || get_user(kp-flags, up-flags) || - get_user(kp-memory, up-memory) || - get_user(kp-input, up-input)) + get_user(kp-memory, up-memory) return -EFAULT; if (V4L2_TYPE_IS_OUTPUT(kp-type)) @@ -472,8 +471,7 @@ static int put_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user put_user(kp-index, up-index) || put_user(kp-type, up-type) || put_user(kp-flags, up-flags) || - put_user(kp-memory, up-memory) || - put_user(kp-input, up-input)) + put_user(kp-memory, up-memory) return -EFAULT; if (put_user(kp-bytesused, up-bytesused) || @@ -482,7 +480,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-reserved, up-reserved)) + copy_to_user(kp-reserved, up-reserved, sizeof(kp-reserved)) return -EFAULT; if (V4L2_TYPE_IS_MULTIPLANAR(kp-type)) { diff --git a/drivers/media/video/videobuf-core.c b/drivers/media/video/videobuf-core.c index ffdf59c..bf7a326 100644 --- a/drivers/media/video/videobuf-core.c +++ b/drivers/media/video/videobuf-core.c @@ -359,11 +359,6 @@ static void videobuf_status(struct videobuf_queue *q, struct v4l2_buffer *b, break; } - if (vb-input != UNSET) { - b-flags |= V4L2_BUF_FLAG_INPUT; - b-input = vb-input; - } - b-field = vb-field; b-timestamp = vb-ts; b-bytesused = vb-size; @@ -402,7 +397,6 @@ int __videobuf_mmap_setup(struct videobuf_queue *q, break; q-bufs[i]-i = i; - q-bufs[i]-input = UNSET; q-bufs[i]-memory = memory; q-bufs[i]-bsize = bsize; switch (memory) { @@ -566,16 +560,6 @@ int videobuf_qbuf(struct videobuf_queue *q, struct v4l2_buffer *b) goto done; } - if (b-flags V4L2_BUF_FLAG_INPUT) { - if (b-input = q-inputs) { - dprintk(1, qbuf: wrong input.\n); - goto done; - } - buf-input = b-input; - } else { - buf-input =
Re: [PATCH 1/1] v4l: drop v4l2_buffer.input and V4L2_BUF_FLAG_INPUT
On Monday 30 April 2012 15:34:58 Sakari Ailus wrote: Remove input field in struct v4l2_buffer and flag V4L2_BUF_FLAG_INPUT which tells the former is valid. The flag is used by no driver currently. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi --- Hi all, I thought this would be a good time to get rid of the input field in v4l2_buffer to avoid writing more useless compat code for it --- the enum compat code. Comments are welcome. This patch is compile tested on videobuf and videobuf2. I'm all in favor of this. Don't forget to update the documentation as well, though! What would the impact be on applications, though? Any app that currently does 'reserved = 0' would fail to compile after this change. Perhaps rather than removing 'input' and changing 'reserved' to 'reserved[2]' we should do something like this: union { u32 input; u32 reserved2; }; u32 reserved; Or perhaps leave out the union and just replace 'input' by 'reserved2'. Regards, Hans Update: Fixes according to Laurent's comments. All drivers available on x86 and arm (N9) have been compile tested. Changes to the previous patch: - videobuf2 comment fix (the input field is no longer there). - cpia driver still contained a reference to input field and also needed changes to handling of the reserved field. - Bring back UNSET. While this is no longer used in videobuf as the result of the removal of the input field, it is quite widely misused outside videobuf, and removing it should be a separate patch. drivers/media/video/cpia2/cpia2_v4l.c |3 +-- drivers/media/video/v4l2-compat-ioctl32.c |8 +++- drivers/media/video/videobuf-core.c | 16 drivers/media/video/videobuf2-core.c |6 ++ include/linux/videodev2.h |4 +--- 5 files changed, 7 insertions(+), 30 deletions(-) diff --git a/drivers/media/video/cpia2/cpia2_v4l.c b/drivers/media/video/cpia2/cpia2_v4l.c index 077eb1d..1ed633f 100644 --- a/drivers/media/video/cpia2/cpia2_v4l.c +++ b/drivers/media/video/cpia2/cpia2_v4l.c @@ -1289,8 +1289,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-input = 0; - buf-reserved = 0; + memset(buf-reserved, 0, sizeof(buf-reserved)); memset(buf-timecode, 0, sizeof(buf-timecode)); DBG(DQBUF #%d status:%d seq:%d length:%d\n, buf-index, diff --git a/drivers/media/video/v4l2-compat-ioctl32.c b/drivers/media/video/v4l2-compat-ioctl32.c index 2829d25..a2ddc37 100644 --- a/drivers/media/video/v4l2-compat-ioctl32.c +++ b/drivers/media/video/v4l2-compat-ioctl32.c @@ -387,8 +387,7 @@ static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user get_user(kp-index, up-index) || get_user(kp-type, up-type) || get_user(kp-flags, up-flags) || - get_user(kp-memory, up-memory) || - get_user(kp-input, up-input)) + get_user(kp-memory, up-memory) return -EFAULT; if (V4L2_TYPE_IS_OUTPUT(kp-type)) @@ -472,8 +471,7 @@ static int put_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user put_user(kp-index, up-index) || put_user(kp-type, up-type) || put_user(kp-flags, up-flags) || - put_user(kp-memory, up-memory) || - put_user(kp-input, up-input)) + put_user(kp-memory, up-memory) return -EFAULT; if (put_user(kp-bytesused, up-bytesused) || @@ -482,7 +480,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-reserved, up-reserved)) + copy_to_user(kp-reserved, up-reserved, sizeof(kp- reserved)) return -EFAULT; if (V4L2_TYPE_IS_MULTIPLANAR(kp-type)) { diff --git a/drivers/media/video/videobuf-core.c b/drivers/media/video/videobuf-core.c index ffdf59c..bf7a326 100644 --- a/drivers/media/video/videobuf-core.c +++ b/drivers/media/video/videobuf-core.c @@ -359,11 +359,6 @@ static void videobuf_status(struct videobuf_queue *q, struct v4l2_buffer *b, break; } - if (vb-input != UNSET) { - b-flags |= V4L2_BUF_FLAG_INPUT; - b-input = vb-input; - } - b-field = vb-field; b-timestamp = vb-ts; b-bytesused = vb-size; @@ -402,7 +397,6 @@ int __videobuf_mmap_setup(struct videobuf_queue *q, break; q-bufs[i]-i = i; - q-bufs[i]-input = UNSET; q-bufs[i]-memory = memory;
Re: [PATCH 0/3] gspca - ov534: saturation and hue (using fixp-arith.h)
On Mon, 23 Apr 2012 14:16:25 -0600 Jonathan Corbet cor...@lwn.net wrote: On Mon, 23 Apr 2012 15:21:04 +0200 Antonio Ospite osp...@studenti.unina.it wrote: Jonathan, maybe fixp_sin() and fixp_cos() can be used in drivers/media/video/ov7670.c too where currently ov7670_sine() and ov7670_cosine() are defined, but I didn't want to send a patch I could not test. Seems like a good idea. No reason to have multiple such hacks in the kernel; I'll look at dumping the ov7670 version when I get a chance. That may not be all that soon, though; life is a bit challenging at the moment. One concern is that if we're going to add users to fixp-arith.h, some of it should maybe go to a C file. Otherwise we'll create duplicated copies of the cos_table array for each user. I'm not sure the functions need to be inline either; nobody expects cos() to be blindingly fast. Jonathan, does lib/fixp-arith.c sound OK to you? I'll put that on my TODO, unless Johann wans to do some more rework; in any case I think we can still merge this patchset like it is right now. Jean-Francois will you take care of that? Thanks, Antonio -- Antonio Ospite http://ao2.it A: Because it messes up the order in which people normally read text. See http://en.wikipedia.org/wiki/Posting_style Q: Why is top-posting such a bad thing? pgpsTmBTy6qfs.pgp Description: PGP signature
Re: [PATCH 1/1] v4l: drop v4l2_buffer.input and V4L2_BUF_FLAG_INPUT
Hi Hans, Thanks for your comments. On Mon, Apr 30, 2012 at 03:48:14PM +0200, Hans Verkuil wrote: On Monday 30 April 2012 15:34:58 Sakari Ailus wrote: Remove input field in struct v4l2_buffer and flag V4L2_BUF_FLAG_INPUT which tells the former is valid. The flag is used by no driver currently. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi --- Hi all, I thought this would be a good time to get rid of the input field in v4l2_buffer to avoid writing more useless compat code for it --- the enum compat code. Comments are welcome. This patch is compile tested on videobuf and videobuf2. I'm all in favor of this. Don't forget to update the documentation as well, though! Good point. I'll go through that next. What would the impact be on applications, though? Any app that currently does 'reserved = 0' would fail to compile after this change. I had a bit of that in drivers and videobuf(2), too. Is there a known good practice of dealing with this? The reserved fields are supposed to be set to zero by applications but the reserved fields may even vanish over time from some structs. One option is to keep the reserved fields as array even there was just one of them or if it no longer was there. If so, reserved should have been reserved[1] in the first place. This would make it easier to deal with the changing size of the reserved field. Perhaps rather than removing 'input' and changing 'reserved' to 'reserved[2]' we should do something like this: union { u32 input; u32 reserved2; }; u32 reserved; Or perhaps leave out the union and just replace 'input' by 'reserved2'. That sounds like a good option to me, too. Kind regards, -- Sakari Ailus e-mail: sakari.ai...@iki.fi jabber/XMPP/Gmail: sai...@retiisi.org.uk -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/1] v4l: drop v4l2_buffer.input and V4L2_BUF_FLAG_INPUT
On Monday 30 April 2012 16:06:16 Sakari Ailus wrote: Hi Hans, Thanks for your comments. On Mon, Apr 30, 2012 at 03:48:14PM +0200, Hans Verkuil wrote: On Monday 30 April 2012 15:34:58 Sakari Ailus wrote: Remove input field in struct v4l2_buffer and flag V4L2_BUF_FLAG_INPUT which tells the former is valid. The flag is used by no driver currently. Signed-off-by: Sakari Ailus sakari.ai...@iki.fi --- Hi all, I thought this would be a good time to get rid of the input field in v4l2_buffer to avoid writing more useless compat code for it --- the enum compat code. Comments are welcome. This patch is compile tested on videobuf and videobuf2. I'm all in favor of this. Don't forget to update the documentation as well, though! Good point. I'll go through that next. What would the impact be on applications, though? Any app that currently does 'reserved = 0' would fail to compile after this change. I had a bit of that in drivers and videobuf(2), too. Is there a known good practice of dealing with this? The reserved fields are supposed to be set to zero by applications but the reserved fields may even vanish over time from some structs. We never ran out of reserved fields before (at least to my knowledge), so there is no known good practice. One option is to keep the reserved fields as array even there was just one of them or if it no longer was there. If so, reserved should have been reserved[1] in the first place. This would make it easier to deal with the changing size of the reserved field. Definitely. But I think struct v4l2_buffer has been like this for a long time (Laurent would know when the input field was added). Regards, Hans Perhaps rather than removing 'input' and changing 'reserved' to 'reserved[2]' we should do something like this: union { u32 input; u32 reserved2; }; u32 reserved; Or perhaps leave out the union and just replace 'input' by 'reserved2'. That sounds like a good option to me, too. Kind regards, -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/1] v4l: drop v4l2_buffer.input and V4L2_BUF_FLAG_INPUT
On Monday 30 April 2012 16:15:30 Hans Verkuil wrote: On Monday 30 April 2012 16:06:16 Sakari Ailus wrote: [snip] One option is to keep the reserved fields as array even there was just one of them or if it no longer was there. If so, reserved should have been reserved[1] in the first place. This would make it easier to deal with the changing size of the reserved field. Definitely. But I think struct v4l2_buffer has been like this for a long time (Laurent would know when the input field was added). That was 8 to 9 years ago. I'm responsible for that terrible idea, so I'd be happy to see the input field removed ;-) -- 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] s5p-fimc: Use selection API in place of crop operations
Replace deprecated crop operations with the selection API. Original crop ioctls are supported through a compatibility layer at the v4l2 core. Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com Signed-off-by: Kuyngmin Park kyungmin.p...@samsung.com --- drivers/media/video/s5p-fimc/fimc-capture.c | 176 --- drivers/media/video/s5p-fimc/fimc-core.h|2 +- 2 files changed, 109 insertions(+), 69 deletions(-) diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c b/drivers/media/video/s5p-fimc/fimc-capture.c index e7d9833..4550713 100644 --- a/drivers/media/video/s5p-fimc/fimc-capture.c +++ b/drivers/media/video/s5p-fimc/fimc-capture.c @@ -615,8 +615,13 @@ static struct fimc_fmt *fimc_capture_try_format(struct fimc_ctx *ctx, } /* Apply the scaler and the output DMA constraints */ max_w = rotation ? pl-out_rot_en_w : pl-out_rot_dis_w; - min_w = ctx-state FIMC_DST_CROP ? dst-width : var-min_out_pixsize; - min_h = ctx-state FIMC_DST_CROP ? dst-height : var-min_out_pixsize; + if (ctx-state FIMC_COMPOSE) { + min_w = dst-offs_h + dst-width; + min_h = dst-offs_v + dst-height; + } else { + min_w = var-min_out_pixsize; + min_h = var-min_out_pixsize; + } if (var-min_vsize_align == 1 !rotation) align_h = fimc_fmt_is_rgb(ffmt-color) ? 0 : 1; @@ -634,8 +639,9 @@ static struct fimc_fmt *fimc_capture_try_format(struct fimc_ctx *ctx, return ffmt; } -static void fimc_capture_try_crop(struct fimc_ctx *ctx, struct v4l2_rect *r, - int pad) +static void fimc_capture_try_selection(struct fimc_ctx *ctx, + struct v4l2_rect *r, + int target) { bool rotate = ctx-rotation == 90 || ctx-rotation == 270; struct fimc_dev *fimc = ctx-fimc_dev; @@ -653,7 +659,7 @@ static void fimc_capture_try_crop(struct fimc_ctx *ctx, struct v4l2_rect *r, r-left = r-top = 0; return; } - if (pad == FIMC_SD_PAD_SOURCE) { + if (target == V4L2_SEL_TGT_COMPOSE_ACTIVE) { if (ctx-rotation != 90 ctx-rotation != 270) align_h = 1; max_sc_h = min(SCALER_MAX_HRATIO, 1 (ffs(sink-width) - 3)); @@ -667,8 +673,7 @@ static void fimc_capture_try_crop(struct fimc_ctx *ctx, struct v4l2_rect *r, max_sc_h = max_sc_v = 1; } /* -* For the crop rectangle at source pad the following constraints -* must be met: +* For the compose rectangle the following constraints must be met: * - it must fit in the sink pad format rectangle (f_width/f_height); * - maximum downscaling ratio is 64; * - maximum crop size depends if the rotator is used or not; @@ -680,7 +685,8 @@ static void fimc_capture_try_crop(struct fimc_ctx *ctx, struct v4l2_rect *r, rotate ? pl-out_rot_en_w : pl-out_rot_dis_w, rotate ? sink-f_height : sink-f_width); max_h = min_t(u32, FIMC_CAMIF_MAX_HEIGHT, sink-f_height); - if (pad == FIMC_SD_PAD_SOURCE) { + + if (target == V4L2_SEL_TGT_COMPOSE_ACTIVE) { min_w = min_t(u32, max_w, sink-f_width / max_sc_h); min_h = min_t(u32, max_h, sink-f_height / max_sc_v); if (rotate) { @@ -691,13 +697,13 @@ static void fimc_capture_try_crop(struct fimc_ctx *ctx, struct v4l2_rect *r, v4l_bound_align_image(r-width, min_w, max_w, ffs(min_sz) - 1, r-height, min_h, max_h, align_h, align_sz); - /* Adjust left/top if cropping rectangle is out of bounds */ + /* Adjust left/top if crop/compose rectangle is out of bounds */ r-left = clamp_t(u32, r-left, 0, sink-f_width - r-width); r-top = clamp_t(u32, r-top, 0, sink-f_height - r-height); r-left = round_down(r-left, var-hor_offs_align); - dbg(pad%d: (%d,%d)/%dx%d, sink fmt: %dx%d, - pad, r-left, r-top, r-width, r-height, + dbg(target %#x: (%d,%d)/%dx%d, sink fmt: %dx%d, + target, r-left, r-top, r-width, r-height, sink-f_width, sink-f_height); } @@ -929,7 +935,7 @@ static int fimc_capture_set_format(struct fimc_dev *fimc, struct v4l2_format *f) set_frame_bounds(ff, pix-width, pix-height); /* Reset the composition rectangle if not yet configured */ - if (!(ctx-state FIMC_DST_CROP)) + if (!(ctx-state FIMC_COMPOSE)) set_frame_crop(ff, 0, 0, pix-width, pix-height); fimc_capture_mark_jpeg_xfer(ctx, fimc_fmt_is_jpeg(ff-fmt-color)); @@ -1187,29 +1193,18 @@ static int fimc_cap_s_selection(struct file *file, void *fh, struct v4l2_rect rect = s-r; struct fimc_frame *f; unsigned long flags; - unsigned int pad;
[PATCH] s5p-fimc: Avoid crash with null platform_data
In commit s5p-fimc: Handle sub-device interdependencies using deferred.. there was a check added for pdata-num_clients without first checking pdata against NULL. This causes a crash when platform_data is not set, which is a valid use case. Fix this regression by skipping the MIPI-CSIS subdev registration also when pdata is null. Reported-by: HeungJun Kim riverful@samsung.com Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com --- drivers/media/video/s5p-fimc/fimc-mdevice.c |2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/video/s5p-fimc/fimc-mdevice.c b/drivers/media/video/s5p-fimc/fimc-mdevice.c index 1587498..f653259 100644 --- a/drivers/media/video/s5p-fimc/fimc-mdevice.c +++ b/drivers/media/video/s5p-fimc/fimc-mdevice.c @@ -448,6 +448,8 @@ static int fimc_md_register_platform_entities(struct fimc_md *fmd) * Check if there is any sensor on the MIPI-CSI2 bus and * if not skip the s5p-csis module loading. */ + if (pdata == NULL) + return 0; for (i = 0; i pdata-num_clients; i++) { if (pdata-isp_info[i].bus_type == FIMC_MIPI_CSI2) { ret = 1; -- 1.7.10 -- 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/RFC v3 00/14] V4L camera control enhancements
Hi, On 04/27/2012 04:23 PM, Sylwester Nawrocki wrote: Here is one more update of the camera class controls change set. The changes since v2 are: - V4L2_CID_WHITE_BALANCE_PRESET replaced with V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE according to suggestions from Hans de Goede; - added Flurescent H white balance preset; - V4L2_CID_IMAGE_STABILIZATION and V4L2_CID_WIDE_DYNAMIC_RANGE controls type changed from boolean to menu, to make any further extensions of these controls easier; I'm just not 100% sure if V4L2_WIDE_DYNAMIC_RANGE_ENABLED and V4L2_IMAGE_STABILIZATION_ENABLED are good names for cases where the camera doesn't support wide dynamic range or image stabilization technique selection and only allows to enable or disable those algorithms; - V4L2_CID_ISO_SENSITIVITY_AUTO control type changed from boolean to menu in order to support ISO presets; currently enum v4l2_iso_sensitivity_auto_type does not contain any presets though; - V4L2_CID_COLORFX patch removed from this series; - updated vivi and s5c73m3 driver patches. Changes since v1 (implicit): - the V4L2_CID_AUTO_FOCUS_FACE_PRIORITY control merged with V4L2_CID_AUTO_FOCUS_FACE_AREA, - many minor documentation corrections, - removed 08/23 V4L: camera control class... patch, which got accidentally added at v1, - added V4L2_CID_SCENE_MODE and V4L2_CID_3A_LOCK controls, - added vivi patch for testing. The patches are also available in a git repository at: http://git.infradead.org/users/kmpark/linux-samsung/shortlog/refs/heads/v4l-controls-s5c73m3 I've done following changes: - V4L2_CID_AUTO_FOCUS_DISTANCE renamed to V4L2_CID_AUTO_FOCUS_RANGE, added new item V4L2_AUTO_FOCUS_RANGE_AUTO, - V4L2_AUTO_FOCUS_STATUS_SUCCESS renamed to V4L2_AUTO_FOCUS_STATUS_REACHED, added V4L2_AUTO_FOCUS_STATUS_LOST, - edited V4L2_CID_3A_LOCK description, renamed V4L2_3A_LOCK_* to V4L2_LOCK_*, - added a _type sufffix to enum v4l2_wide_dynamic_range, v4l2_auto_focus_distance and v4l2_auto_focus_area, and pushed it to git repository (gitweb link as above): git://git.infradead.org/users/kmpark/linux-samsung v4l-controls-s5c73m3 These are a bunch of minor changes, I didn't want to spam the mailing list by resending whole change set again. I plan to do it at the end of week if there are more comments and corrections needed. -- Regards, Sylwester Sylwester Nawrocki (14): V4L: Add helper function for standard integer menu controls V4L: Add camera exposure bias control V4L: Add an extended camera white balance control V4L: Add camera wide dynamic range control V4L: Add camera image stabilization control V4L: Add camera ISO sensitivity controls V4L: Add camera exposure metering control V4L: Add camera scene mode control V4L: Add camera 3A lock control V4L: Add auto focus targets to the selections API V4L: Add auto focus targets to the subdev selections API V4L: Add camera auto focus controls V4L: Add S5C73M3 sensor sub-device driver vivi: Add controls Documentation/DocBook/media/v4l/biblio.xml | 11 + Documentation/DocBook/media/v4l/controls.xml | 501 +++- Documentation/DocBook/media/v4l/dev-subdev.xml | 27 +- Documentation/DocBook/media/v4l/selection-api.xml | 33 +- .../DocBook/media/v4l/vidioc-g-selection.xml | 11 + .../media/v4l/vidioc-subdev-g-selection.xml| 14 +- drivers/media/video/Kconfig|8 + drivers/media/video/Makefile |1 + drivers/media/video/s5c73m3/Makefile |3 + drivers/media/video/s5c73m3/s5c73m3-ctrls.c| 705 +++ drivers/media/video/s5c73m3/s5c73m3-spi.c | 126 ++ drivers/media/video/s5c73m3/s5c73m3.c | 1243 drivers/media/video/s5c73m3/s5c73m3.h | 442 +++ drivers/media/video/v4l2-ctrls.c | 133 ++- drivers/media/video/vivi.c | 111 +- include/linux/v4l2-subdev.h|4 + include/linux/videodev2.h | 92 ++ include/media/s5c73m3.h| 62 + include/media/v4l2-ctrls.h | 17 + 19 files changed, 3536 insertions(+), 8 deletions(-) create mode 100644 drivers/media/video/s5c73m3/Makefile create mode 100644 drivers/media/video/s5c73m3/s5c73m3-ctrls.c create mode 100644 drivers/media/video/s5c73m3/s5c73m3-spi.c create mode 100644 drivers/media/video/s5c73m3/s5c73m3.c create mode 100644 drivers/media/video/s5c73m3/s5c73m3.h create mode 100644 include/media/s5c73m3.h -- 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/RFC v3 01/14] V4L: Add helper function for standard integer menu controls
Hi Sylwester! Can you also update Documentation/video4linux/v4l2-controls.txt? Thanks, Hans On Friday 27 April 2012 16:23:18 Sylwester Nawrocki wrote: This patch adds v4l2_ctrl_new_std_int_menu() helper function which can be used in drivers for creating standard integer menu control. It is similar to v4l2_ctrl_new_std_menu(), except it doesn't have a mask parameter and an additional qmenu parameter allows passing an array of signed 64-bit integers constituting the menu items. Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com --- drivers/media/video/v4l2-ctrls.c | 21 + include/media/v4l2-ctrls.h | 17 + 2 files changed, 38 insertions(+) diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c index c93a979..e0725b5 100644 --- a/drivers/media/video/v4l2-ctrls.c +++ b/drivers/media/video/v4l2-ctrls.c @@ -1517,6 +1517,27 @@ struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl, } EXPORT_SYMBOL(v4l2_ctrl_new_std_menu); +/* Helper function for standard integer menu controls */ +struct v4l2_ctrl *v4l2_ctrl_new_std_int_menu(struct v4l2_ctrl_handler *hdl, + const struct v4l2_ctrl_ops *ops, + u32 id, s32 max, s32 def, const s64 *qmenu_int) +{ + const char *name; + enum v4l2_ctrl_type type; + s32 min; + s32 step; + u32 flags; + + v4l2_ctrl_fill(id, name, type, min, max, step, def, flags); + if (type != V4L2_CTRL_TYPE_INTEGER_MENU) { + handler_set_err(hdl, -EINVAL); + return NULL; + } + return v4l2_ctrl_new(hdl, ops, id, name, type, + 0, max, 0, def, flags, NULL, qmenu_int, NULL); +} +EXPORT_SYMBOL(v4l2_ctrl_new_std_int_menu); + /* Add a control from another handler to this handler */ struct v4l2_ctrl *v4l2_ctrl_add_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_ctrl *ctrl) diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index 8920f82..15116d2 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h @@ -347,6 +347,23 @@ struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl, const struct v4l2_ctrl_ops *ops, u32 id, s32 max, s32 mask, s32 def); +/** v4l2_ctrl_new_std_int_menu() - Create a new standard V4L2 integer menu control. + * @hdl:The control handler. + * @ops:The control ops. + * @id: The control ID. + * @max:The control's maximum value. + * @def:The control's default value. + * @qmenu_int: The control's menu entries. + * + * Same as v4l2_ctrl_new_std_menu(), but @mask is set to 0 and it additionaly + * needs an array of integers determining the menu entries. + * + * If @id refers to a non-integer-menu control, then this function will return NULL. + */ +struct v4l2_ctrl *v4l2_ctrl_new_std_int_menu(struct v4l2_ctrl_handler *hdl, + const struct v4l2_ctrl_ops *ops, + u32 id, s32 max, s32 def, const s64 *qmenu_int); + /** v4l2_ctrl_add_ctrl() - Add a control from another handler to this handler. * @hdl:The control handler. * @ctrl: The control to add. -- 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/RFC v3 01/14] V4L: Add helper function for standard integer menu controls
Hi! On 04/30/2012 05:20 PM, Hans Verkuil wrote: Hi Sylwester! Can you also update Documentation/video4linux/v4l2-controls.txt? I think I have to :-) I'll do, sorry for forgetting about it. -- Regards, Sylwester -- 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/RFC v3 04/14] V4L: Add camera wide dynamic range control
On Monday 30 April 2012 17:50:57 Hans Verkuil wrote: On Friday 27 April 2012 16:23:21 Sylwester Nawrocki wrote: Add V4L2_CID_WIDE_DYNAMIC_RANGE camera class control for camera wide dynamic range (WDR, HDR) feature. This control has now only menu entries for enabling and disabling WDR. It can be extended when the wide dynamic range technique selection is needed. Never mind, I get it. It's for future expansion. That said, I find it dubious to make this an enum. I would go with a boolean control and perhaps make a remark that it might become an enum in the future if more options are needed. Regards, Hans Signed-off-by: HeungJun Kim riverful@samsung.com Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com --- Documentation/DocBook/media/v4l/controls.xml | 28 ++ drivers/media/video/v4l2-ctrls.c |9 + include/linux/videodev2.h|6 ++ 3 files changed, 43 insertions(+) diff --git a/Documentation/DocBook/media/v4l/controls.xml b/Documentation/DocBook/media/v4l/controls.xml index b671a70..487b7b5 100644 --- a/Documentation/DocBook/media/v4l/controls.xml +++ b/Documentation/DocBook/media/v4l/controls.xml @@ -3018,6 +3018,34 @@ sky. It corresponds approximately to 9000...1 K color temperature. /row rowentry/entry/row + row id=v4l2-wide-dynamic-range-type + entry spanname=idconstantV4L2_CID_WIDE_DYNAMIC_RANGE/constant/entry + entryenumnbsp;v4l2_wide_dynamic_range_type/entry + /row + row + entry spanname=descrEnables or disables the camera's wide dynamic +range feature. This feature allows to obtain clear images in situations where +intensity of the illumination varies significantly throughout the scene, i.e. +there are simultaneously very dark and very bright areas. It is most commonly +realized in cameras by combining two subsequent frames with different exposure +times./entry + /row + row + entrytbl spanname=descr cols=2 + tbody valign=top + row + entryconstantV4L2_WIDE_DYNAMIC_RANGE_DISABLED/constant/entry + entryWide dynamic range is disabled./entry + /row + row + entryconstantV4L2_WIDE_DYNAMIC_RANGE_ENABLED/constant/entry + entryWide dynamic range is enabled./entry + /row + /tbody + /entrytbl + /row + rowentry/entry/row + /tbody /tgroup /table diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c index 02fa9b0..ad2f035 100644 --- a/drivers/media/video/v4l2-ctrls.c +++ b/drivers/media/video/v4l2-ctrls.c @@ -256,6 +256,11 @@ const char * const *v4l2_ctrl_get_menu(u32 id) Shade, NULL, }; + static const char * const camera_wide_dynamic_range[] = { + Disabled, + Enabled, + NULL + }; Huh? Why isn't this a boolean control? This looks very weird. Regards, Hans static const char * const tune_preemphasis[] = { No Preemphasis, 50 Microseconds, @@ -427,6 +432,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id) return colorfx; case V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE: return auto_n_preset_white_balance; + case V4L2_CID_WIDE_DYNAMIC_RANGE: + return camera_wide_dynamic_range; case V4L2_CID_TUNE_PREEMPHASIS: return tune_preemphasis; case V4L2_CID_FLASH_LED_MODE: @@ -614,6 +621,7 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_IRIS_RELATIVE:return Iris, Relative; case V4L2_CID_AUTO_EXPOSURE_BIAS: return Auto Exposure, Bias; case V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE: return White Balance, Auto Preset; + case V4L2_CID_WIDE_DYNAMIC_RANGE: return Wide Dynamic Range; /* FM Radio Modulator control */ /* Keep the order of the 'case's the same as in videodev2.h! */ @@ -751,6 +759,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL: case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE: case V4L2_CID_JPEG_CHROMA_SUBSAMPLING: + case V4L2_CID_WIDE_DYNAMIC_RANGE: *type = V4L2_CTRL_TYPE_MENU; break; case V4L2_CID_RDS_TX_PS_NAME: diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 08891e6..3ca9b10 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -1709,6 +1709,12 @@ enum v4l2_auto_n_preset_white_balance_type { V4L2_WHITE_BALANCE_SHADE= 9, }; +#define V4L2_CID_WIDE_DYNAMIC_RANGE (V4L2_CID_CAMERA_CLASS_BASE+21) +enum
Re: [PATCH/RFC v3 09/14] V4L: Add camera 3A lock control
On Friday 27 April 2012 16:23:26 Sylwester Nawrocki wrote: The V4L2_CID_3A_LOCK bitmask control allows applications to pause or resume the automatic exposure, focus and wite balance adjustments. It can be used, for example, to lock the 3A adjustments right before a still image is captured, for pre-focus, etc. The applications can control each of the algorithms independently, through a corresponding control bit, if driver allows that. Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com --- Documentation/DocBook/media/v4l/controls.xml | 40 ++ drivers/media/video/v4l2-ctrls.c |2 ++ include/linux/videodev2.h|5 3 files changed, 47 insertions(+) diff --git a/Documentation/DocBook/media/v4l/controls.xml b/Documentation/DocBook/media/v4l/controls.xml index bf481d4..51509f4 100644 --- a/Documentation/DocBook/media/v4l/controls.xml +++ b/Documentation/DocBook/media/v4l/controls.xml @@ -3253,6 +3253,46 @@ lens-distortion correction./entry /row rowentry/entry/row + row + entry spanname=idconstantV4L2_CID_3A_LOCK/constant/entry + entrybitmask/entry + /row + row + entry spanname=descrThis control locks or unlocks the automatic +exposure, white balance and focus. The automatic adjustments can be paused +independently by setting the coresponding lock bit to 1. The camera then retains Small typo: coresponding - corresponding +the corresponding 3A settings, until the lock bit is cleared. The value of this +control may be changed by other, exposure, white balance or focus controls. The The sentence 'The value ... focus controls' doesn't parse. I think 'other, ' needs to be removed. Regards, Hans +following control bits are defined : +/entry + /row + row + entrytbl spanname=descr cols=2 + tbody valign=top + row + entryconstantV4L2_3A_LOCK_EXPOSURE/constant/entry + entryAutomatic exposure adjustments lock./entry + /row + row + entryconstantV4L2_3A_LOCK_WHITE_BALANCE/constant/entry + entryAutomatic white balance adjustments lock./entry + /row + row + entryconstantV4L2_3A_LOCK_FOCUS/constant/entry + entryAutomatic focus adjustments lock./entry + /row + /tbody + /entrytbl + /row + rowentry spanname=descr +When a particular algorithm is not enabled, drivers should ignore requests +to lock it and should return no error. An example might be an application +setting bit constantV4L2_3A_LOCK_WHITE_BALANCE/constant when the +constantV4L2_CID_AUTO_WHITE_BALANCE/constant control is set to +constantFALSE/constant./entry + /row + rowentry/entry/row + /tbody /tgroup /table diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c index 8b48893..d45f00c 100644 --- a/drivers/media/video/v4l2-ctrls.c +++ b/drivers/media/video/v4l2-ctrls.c @@ -671,6 +671,7 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_ISO_SENSITIVITY_AUTO: return ISO Sensitivity, Auto; case V4L2_CID_EXPOSURE_METERING:return Exposure, Metering Mode; case V4L2_CID_SCENE_MODE: return Scene Mode; + case V4L2_CID_3A_LOCK: return 3A Lock; /* FM Radio Modulator control */ /* Keep the order of the 'case's the same as in videodev2.h! */ @@ -843,6 +844,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, break; case V4L2_CID_FLASH_FAULT: case V4L2_CID_JPEG_ACTIVE_MARKER: + case V4L2_CID_3A_LOCK: *type = V4L2_CTRL_TYPE_BITMASK; break; case V4L2_CID_MIN_BUFFERS_FOR_CAPTURE: diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 2c82fd9..7c30d54 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -1752,6 +1752,11 @@ enum v4l2_scene_mode { V4L2_SCENE_MODE_TEXT= 13, }; +#define V4L2_CID_3A_LOCK (V4L2_CID_CAMERA_CLASS_BASE+27) +#define V4L2_3A_LOCK_EXPOSURE(1 0) +#define V4L2_3A_LOCK_WHITE_BALANCE (1 1) +#define V4L2_3A_LOCK_FOCUS (1 2) + /* FM Modulator class control IDs */ #define V4L2_CID_FM_TX_CLASS_BASE(V4L2_CTRL_CLASS_FM_TX | 0x900) #define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 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
Re: [PATCH/RFC v3 04/14] V4L: Add camera wide dynamic range control
On Friday 27 April 2012 16:23:21 Sylwester Nawrocki wrote: Add V4L2_CID_WIDE_DYNAMIC_RANGE camera class control for camera wide dynamic range (WDR, HDR) feature. This control has now only menu entries for enabling and disabling WDR. It can be extended when the wide dynamic range technique selection is needed. Signed-off-by: HeungJun Kim riverful@samsung.com Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com --- Documentation/DocBook/media/v4l/controls.xml | 28 ++ drivers/media/video/v4l2-ctrls.c |9 + include/linux/videodev2.h|6 ++ 3 files changed, 43 insertions(+) diff --git a/Documentation/DocBook/media/v4l/controls.xml b/Documentation/DocBook/media/v4l/controls.xml index b671a70..487b7b5 100644 --- a/Documentation/DocBook/media/v4l/controls.xml +++ b/Documentation/DocBook/media/v4l/controls.xml @@ -3018,6 +3018,34 @@ sky. It corresponds approximately to 9000...1 K color temperature. /row rowentry/entry/row + row id=v4l2-wide-dynamic-range-type + entry spanname=idconstantV4L2_CID_WIDE_DYNAMIC_RANGE/constant/entry + entryenumnbsp;v4l2_wide_dynamic_range_type/entry + /row + row + entry spanname=descrEnables or disables the camera's wide dynamic +range feature. This feature allows to obtain clear images in situations where +intensity of the illumination varies significantly throughout the scene, i.e. +there are simultaneously very dark and very bright areas. It is most commonly +realized in cameras by combining two subsequent frames with different exposure +times./entry + /row + row + entrytbl spanname=descr cols=2 + tbody valign=top + row + entryconstantV4L2_WIDE_DYNAMIC_RANGE_DISABLED/constant/entry + entryWide dynamic range is disabled./entry + /row + row + entryconstantV4L2_WIDE_DYNAMIC_RANGE_ENABLED/constant/entry + entryWide dynamic range is enabled./entry + /row + /tbody + /entrytbl + /row + rowentry/entry/row + /tbody /tgroup /table diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c index 02fa9b0..ad2f035 100644 --- a/drivers/media/video/v4l2-ctrls.c +++ b/drivers/media/video/v4l2-ctrls.c @@ -256,6 +256,11 @@ const char * const *v4l2_ctrl_get_menu(u32 id) Shade, NULL, }; + static const char * const camera_wide_dynamic_range[] = { + Disabled, + Enabled, + NULL + }; Huh? Why isn't this a boolean control? This looks very weird. Regards, Hans static const char * const tune_preemphasis[] = { No Preemphasis, 50 Microseconds, @@ -427,6 +432,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id) return colorfx; case V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE: return auto_n_preset_white_balance; + case V4L2_CID_WIDE_DYNAMIC_RANGE: + return camera_wide_dynamic_range; case V4L2_CID_TUNE_PREEMPHASIS: return tune_preemphasis; case V4L2_CID_FLASH_LED_MODE: @@ -614,6 +621,7 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_IRIS_RELATIVE:return Iris, Relative; case V4L2_CID_AUTO_EXPOSURE_BIAS: return Auto Exposure, Bias; case V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE: return White Balance, Auto Preset; + case V4L2_CID_WIDE_DYNAMIC_RANGE: return Wide Dynamic Range; /* FM Radio Modulator control */ /* Keep the order of the 'case's the same as in videodev2.h! */ @@ -751,6 +759,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL: case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE: case V4L2_CID_JPEG_CHROMA_SUBSAMPLING: + case V4L2_CID_WIDE_DYNAMIC_RANGE: *type = V4L2_CTRL_TYPE_MENU; break; case V4L2_CID_RDS_TX_PS_NAME: diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 08891e6..3ca9b10 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -1709,6 +1709,12 @@ enum v4l2_auto_n_preset_white_balance_type { V4L2_WHITE_BALANCE_SHADE= 9, }; +#define V4L2_CID_WIDE_DYNAMIC_RANGE (V4L2_CID_CAMERA_CLASS_BASE+21) +enum v4l2_wide_dynamic_range_type { + V4L2_WIDE_DYNAMIC_RANGE_DISABLED= 0, + V4L2_WIDE_DYNAMIC_RANGE_ENABLED = 1, +}; + /* FM Modulator class control IDs */ #define V4L2_CID_FM_TX_CLASS_BASE(V4L2_CTRL_CLASS_FM_TX | 0x900) #define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1) -- To
Re: [PATCH/RFC v3 14/14] vivi: Add controls
On Friday 27 April 2012 16:23:31 Sylwester Nawrocki wrote: This patch is just for testing the new controls, it is NOT intended for merging upstream. Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com --- drivers/media/video/vivi.c | 111 +++- 1 file changed, 110 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c index d64d482..cbe103e 100644 --- a/drivers/media/video/vivi.c +++ b/drivers/media/video/vivi.c @@ -179,6 +179,29 @@ struct vivi_dev { struct v4l2_ctrl *bitmask; struct v4l2_ctrl *int_menu; + struct v4l2_ctrl *exposure_bias; + struct v4l2_ctrl *metering; + struct v4l2_ctrl *wb_preset; + struct { + /* iso/auto iso cluster */ + struct v4l2_ctrl *auto_iso; + struct v4l2_ctrl *iso; + }; + struct { + /* continuous auto focus/auto focus cluster */ + struct v4l2_ctrl *focus_auto; + struct v4l2_ctrl *af_start; + struct v4l2_ctrl *af_stop; + struct v4l2_ctrl *af_status; + struct v4l2_ctrl *af_distance; + struct v4l2_ctrl *af_area; + }; + struct v4l2_ctrl *scene_mode; + struct v4l2_ctrl *lock_3a; + struct v4l2_ctrl *colorfx; + struct v4l2_ctrl *wdr; + struct v4l2_ctrl *stabilization; + Why add these controls to vivi? It doesn't belong here. Regards, Hans spinlock_t slock; struct mutex mutex; @@ -208,6 +231,14 @@ struct vivi_dev { u8 line[MAX_WIDTH * 4]; }; +static const s64 vivi_iso_qmenu[] = { + 50, 100, 200, 400, 800, 1600 +}; + +static const s64 vivi_ev_bias_qmenu[] = { + -1500, -1000, -500, 0, 500, 1000, 1500 +}; + /* -- DMA and thread functions --*/ @@ -516,6 +547,10 @@ static void vivi_fillbuff(struct vivi_dev *dev, struct vivi_buffer *buf) gen_text(dev, vbuf, line++ * 16, 16, str); } + snprintf(str, sizeof(str), auto iso: %s, iso: %lld , + dev-auto_iso-cur.val ? on : off, + vivi_iso_qmenu[dev-iso-cur.val]); + dev-mv_count += 2; buf-vb.v4l2_buf.field = dev-field; @@ -1023,6 +1058,13 @@ static int vivi_s_ctrl(struct v4l2_ctrl *ctrl) if (ctrl == dev-button) dev-button_pressed = 30; + + if (ctrl-type == V4L2_CTRL_TYPE_STRING) + return 0; + + dprintk(dev, 1, %s: control: %s, val: %d, val64: %lld, + __func__, ctrl-name, ctrl-val, ctrl-val64); + return 0; } @@ -1267,7 +1309,8 @@ static int __init vivi_create_instance(int inst) dev-width = 640; dev-height = 480; hdl = dev-ctrl_handler; - v4l2_ctrl_handler_init(hdl, 11); + v4l2_ctrl_handler_init(hdl, 26); + dev-volume = v4l2_ctrl_new_std(hdl, vivi_ctrl_ops, V4L2_CID_AUDIO_VOLUME, 0, 255, 1, 200); dev-brightness = v4l2_ctrl_new_std(hdl, vivi_ctrl_ops, @@ -1290,11 +1333,77 @@ static int __init vivi_create_instance(int inst) dev-string = v4l2_ctrl_new_custom(hdl, vivi_ctrl_string, NULL); dev-bitmask = v4l2_ctrl_new_custom(hdl, vivi_ctrl_bitmask, NULL); dev-int_menu = v4l2_ctrl_new_custom(hdl, vivi_ctrl_int_menu, NULL); + + dev-wb_preset = v4l2_ctrl_new_std_menu(hdl, + vivi_ctrl_ops, V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE, + 9, ~0x3ff, V4L2_WHITE_BALANCE_AUTO); + + dev-exposure_bias = v4l2_ctrl_new_std_int_menu(hdl, + vivi_ctrl_ops, V4L2_CID_AUTO_EXPOSURE_BIAS, + ARRAY_SIZE(vivi_ev_bias_qmenu) - 1, + ARRAY_SIZE(vivi_ev_bias_qmenu)/2 - 1, + vivi_ev_bias_qmenu); + + dev-metering = v4l2_ctrl_new_std_menu(hdl, + vivi_ctrl_ops, V4L2_CID_EXPOSURE_METERING, + 2, ~0x7, V4L2_EXPOSURE_METERING_AVERAGE); + + /* ISO cluster */ + dev-auto_iso = v4l2_ctrl_new_std(hdl, vivi_ctrl_ops, + V4L2_CID_ISO_SENSITIVITY_AUTO, 0, 1, 1, 1); + + dev-iso = v4l2_ctrl_new_std_int_menu(hdl, vivi_ctrl_ops, + V4L2_CID_ISO_SENSITIVITY, ARRAY_SIZE(vivi_iso_qmenu) - 1, + ARRAY_SIZE(vivi_iso_qmenu)/2 - 1, vivi_iso_qmenu); + + /* Auto focus cluster */ + dev-focus_auto = v4l2_ctrl_new_std(hdl, vivi_ctrl_ops, + V4L2_CID_FOCUS_AUTO, 0, 1, 1, 0); + + dev-af_start = v4l2_ctrl_new_std(hdl, vivi_ctrl_ops, +
Re: [PATCH/RFC v3 00/14] V4L camera control enhancements
Hi Sylwester! I've finished my review. You made excellent documentation for the new controls! Other than some small stuff the only thing I am unhappy about is the use of menu controls for what are currently just boolean controls. I am inclined to make them boolean controls and add a comment that they may be changed to menu controls in the future. That shouldn't be a problem as long as the control values 0 and 1 retain their meaning. Regards, Hans On Friday 27 April 2012 16:23:17 Sylwester Nawrocki wrote: Here is one more update of the camera class controls change set. The changes since v2 are: - V4L2_CID_WHITE_BALANCE_PRESET replaced with V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE according to suggestions from Hans de Goede; - added Flurescent H white balance preset; - V4L2_CID_IMAGE_STABILIZATION and V4L2_CID_WIDE_DYNAMIC_RANGE controls type changed from boolean to menu, to make any further extensions of these controls easier; I'm just not 100% sure if V4L2_WIDE_DYNAMIC_RANGE_ENABLED and V4L2_IMAGE_STABILIZATION_ENABLED are good names for cases where the camera doesn't support wide dynamic range or image stabilization technique selection and only allows to enable or disable those algorithms; - V4L2_CID_ISO_SENSITIVITY_AUTO control type changed from boolean to menu in order to support ISO presets; currently enum v4l2_iso_sensitivity_auto_type does not contain any presets though; - V4L2_CID_COLORFX patch removed from this series; - updated vivi and s5c73m3 driver patches. Changes since v1 (implicit): - the V4L2_CID_AUTO_FOCUS_FACE_PRIORITY control merged with V4L2_CID_AUTO_FOCUS_FACE_AREA, - many minor documentation corrections, - removed 08/23 V4L: camera control class... patch, which got accidentally added at v1, - added V4L2_CID_SCENE_MODE and V4L2_CID_3A_LOCK controls, - added vivi patch for testing. The patches are also available in a git repository at: http://git.infradead.org/users/kmpark/linux-samsung/shortlog/refs/heads/v4l-controls-s5c73m3 Thanks, Sylwester Sylwester Nawrocki (14): V4L: Add helper function for standard integer menu controls V4L: Add camera exposure bias control V4L: Add an extended camera white balance control V4L: Add camera wide dynamic range control V4L: Add camera image stabilization control V4L: Add camera ISO sensitivity controls V4L: Add camera exposure metering control V4L: Add camera scene mode control V4L: Add camera 3A lock control V4L: Add auto focus targets to the selections API V4L: Add auto focus targets to the subdev selections API V4L: Add camera auto focus controls V4L: Add S5C73M3 sensor sub-device driver vivi: Add controls Documentation/DocBook/media/v4l/biblio.xml | 11 + Documentation/DocBook/media/v4l/controls.xml | 501 +++- Documentation/DocBook/media/v4l/dev-subdev.xml | 27 +- Documentation/DocBook/media/v4l/selection-api.xml | 33 +- .../DocBook/media/v4l/vidioc-g-selection.xml | 11 + .../media/v4l/vidioc-subdev-g-selection.xml| 14 +- drivers/media/video/Kconfig|8 + drivers/media/video/Makefile |1 + drivers/media/video/s5c73m3/Makefile |3 + drivers/media/video/s5c73m3/s5c73m3-ctrls.c| 705 +++ drivers/media/video/s5c73m3/s5c73m3-spi.c | 126 ++ drivers/media/video/s5c73m3/s5c73m3.c | 1243 drivers/media/video/s5c73m3/s5c73m3.h | 442 +++ drivers/media/video/v4l2-ctrls.c | 133 ++- drivers/media/video/vivi.c | 111 +- include/linux/v4l2-subdev.h|4 + include/linux/videodev2.h | 92 ++ include/media/s5c73m3.h| 62 + include/media/v4l2-ctrls.h | 17 + 19 files changed, 3536 insertions(+), 8 deletions(-) create mode 100644 drivers/media/video/s5c73m3/Makefile create mode 100644 drivers/media/video/s5c73m3/s5c73m3-ctrls.c create mode 100644 drivers/media/video/s5c73m3/s5c73m3-spi.c create mode 100644 drivers/media/video/s5c73m3/s5c73m3.c create mode 100644 drivers/media/video/s5c73m3/s5c73m3.h create mode 100644 include/media/s5c73m3.h -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 00/12] V4L: Exynos 4x12 camera host interface (FIMC-LITE) driver
This change set adds support for FIMC-LITE devices, available in Exynos4x12 (and Exynos5) SoCs, to the existing s5p-fimc driver. The FIMC-LITE differs from regular FIMC in that it doesn't have a scaler, rotator, color converter and the DMA input. So it's just a basic camera host interface, with additional internal FIFO data output to other SoC sub-modules. Cropping at the host interface input is exposed on a subdev sink pad through the selection API, and composition performed by the output DMA engine can be controlled through selection compose targets on the video node. I tried to make the exynos-fimc-lite module as much independent as possible, to allow its reuse on any other SoCs that have same IP block. This change set also includes small enhancement of V4L2_CID_COLORFX and a patch adding support for this control at the s5p-fimc driver. Changes since first version: - modified V4L2_CID_COLORFX control patches, added V4L2_CID_COLORFX_CBCR control according to suggestions from Hans Verkuil; - fixed VIDIOC_S_FMT ioctl handler so it is now possible to configure random output memory buffer for composition, not only with same resolution as at the subdev's source pad; - corrected completely broken cropping handling at the subdev (looks like someone has forgotten to test it...); - dropped patch 03/13 s5p-fimc: Simplify... which was wrong. TODOs: - power management testing (when proper platform support for exynos4x12 is available in the mainline kernel), - complete internal FIFO output support to the internal ISP (should just require filling in the subdev ops stubs); - improve the interrupt handler. Regards, -- Sylwester Nawrocki Samsung Poland RD Center Sylwester Nawrocki (12): V4L: Extend V4L2_CID_COLORFX with more image effects s5p-fimc: Move m2m node driver into separate file s5p-fimc: Use v4l2_subdev internal ops to register video nodes s5p-fimc: Refactor the register interface functions s5p-fimc: Add FIMC-LITE register definitions s5p-fimc: Rework the video pipeline control functions s5p-fimc: Prefix format enumerations with FIMC_FMT_ s5p-fimc: Minor cleanups s5p-fimc: Make sure an interrupt is properly requested s5p-fimc: Add support for Exynos4x12 FIMC-LITE s5p-fimc: Update copyright notices s5p-fimc: Add color effect control Documentation/DocBook/media/v4l/compat.xml | 13 + Documentation/DocBook/media/v4l/controls.xml | 100 +- Documentation/DocBook/media/v4l/v4l2.xml |5 +- drivers/media/video/Kconfig | 24 +- drivers/media/video/s5p-fimc/Kconfig | 48 + drivers/media/video/s5p-fimc/Makefile|6 +- drivers/media/video/s5p-fimc/fimc-capture.c | 297 +++-- drivers/media/video/s5p-fimc/fimc-core.c | 1091 +++--- drivers/media/video/s5p-fimc/fimc-core.h | 252 ++--- drivers/media/video/s5p-fimc/fimc-lite-reg.c | 301 + drivers/media/video/s5p-fimc/fimc-lite-reg.h | 153 +++ drivers/media/video/s5p-fimc/fimc-lite.c | 1547 ++ drivers/media/video/s5p-fimc/fimc-lite.h | 209 drivers/media/video/s5p-fimc/fimc-m2m.c | 820 ++ drivers/media/video/s5p-fimc/fimc-mdevice.c | 405 --- drivers/media/video/s5p-fimc/fimc-mdevice.h | 18 +- drivers/media/video/s5p-fimc/fimc-reg.c | 613 +- drivers/media/video/s5p-fimc/fimc-reg.h | 326 ++ drivers/media/video/s5p-fimc/regs-fimc.h | 301 - drivers/media/video/v4l2-ctrls.c |7 + include/linux/videodev2.h| 29 +- include/media/s5p_fimc.h | 16 + 22 files changed, 4593 insertions(+), 1988 deletions(-) create mode 100644 drivers/media/video/s5p-fimc/Kconfig create mode 100644 drivers/media/video/s5p-fimc/fimc-lite-reg.c create mode 100644 drivers/media/video/s5p-fimc/fimc-lite-reg.h create mode 100644 drivers/media/video/s5p-fimc/fimc-lite.c create mode 100644 drivers/media/video/s5p-fimc/fimc-lite.h create mode 100644 drivers/media/video/s5p-fimc/fimc-m2m.c create mode 100644 drivers/media/video/s5p-fimc/fimc-reg.h delete mode 100644 drivers/media/video/s5p-fimc/regs-fimc.h -- 1.7.10 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 11/12] s5p-fimc: Update copyright notices
Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com --- drivers/media/video/s5p-fimc/fimc-capture.c |4 ++-- drivers/media/video/s5p-fimc/fimc-core.c|4 ++-- drivers/media/video/s5p-fimc/fimc-core.h|2 +- drivers/media/video/s5p-fimc/fimc-mdevice.h |2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c b/drivers/media/video/s5p-fimc/fimc-capture.c index 3e3ab85..bcf9c1e 100644 --- a/drivers/media/video/s5p-fimc/fimc-capture.c +++ b/drivers/media/video/s5p-fimc/fimc-capture.c @@ -1,8 +1,8 @@ /* * Samsung S5P/EXYNOS4 SoC series camera interface (camera capture) driver * - * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. - * Author: Sylwester Nawrocki, s.nawro...@samsung.com + * Copyright (C) 2010 - 2012 Samsung Electronics Co., Ltd. + * Sylwester Nawrocki s.nawro...@samsung.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/drivers/media/video/s5p-fimc/fimc-core.c b/drivers/media/video/s5p-fimc/fimc-core.c index d59d8c1..8d066c5 100644 --- a/drivers/media/video/s5p-fimc/fimc-core.c +++ b/drivers/media/video/s5p-fimc/fimc-core.c @@ -1,8 +1,8 @@ /* * Samsung S5P/EXYNOS4 SoC series FIMC (CAMIF) driver * - * Copyright (C) 2010-2011 Samsung Electronics Co., Ltd. - * Contact: Sylwester Nawrocki, s.nawro...@samsung.com + * Copyright (C) 2010-2012 Samsung Electronics Co., Ltd. + * Sylwester Nawrocki s.nawro...@samsung.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 diff --git a/drivers/media/video/s5p-fimc/fimc-core.h b/drivers/media/video/s5p-fimc/fimc-core.h index 600cf52..8b7e122 100644 --- a/drivers/media/video/s5p-fimc/fimc-core.h +++ b/drivers/media/video/s5p-fimc/fimc-core.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. + * Copyright (C) 2010 - 2012 Samsung Electronics Co., Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/drivers/media/video/s5p-fimc/fimc-mdevice.h b/drivers/media/video/s5p-fimc/fimc-mdevice.h index 3524c19..3b8a349 100644 --- a/drivers/media/video/s5p-fimc/fimc-mdevice.h +++ b/drivers/media/video/s5p-fimc/fimc-mdevice.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Samsung Electronics Co., Ltd. + * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as -- 1.7.10 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 09/12] s5p-fimc: Make sure an interrupt is properly requested
Use dev_name() for requesting an interrupt so we don't get an interrupt requested with same name for multiple device instances. Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com --- drivers/media/video/s5p-fimc/fimc-core.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/video/s5p-fimc/fimc-core.c b/drivers/media/video/s5p-fimc/fimc-core.c index 6573029..d59d8c1 100644 --- a/drivers/media/video/s5p-fimc/fimc-core.c +++ b/drivers/media/video/s5p-fimc/fimc-core.c @@ -841,7 +841,7 @@ static int fimc_probe(struct platform_device *pdev) platform_set_drvdata(pdev, fimc); ret = devm_request_irq(pdev-dev, res-start, fimc_irq_handler, - 0, pdev-name, fimc); + 0, dev_name(pdev-dev), fimc); if (ret) { dev_err(pdev-dev, failed to install irq (%d)\n, ret); goto err_clk; -- 1.7.10 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 12/12] s5p-fimc: Add color effect control
Add support for V4L2_CID_COLORFX control at the mem-to-mem and capture video nodes. Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com --- drivers/media/video/s5p-fimc/fimc-capture.c | 11 +-- drivers/media/video/s5p-fimc/fimc-core.c| 124 +-- drivers/media/video/s5p-fimc/fimc-core.h| 38 +--- drivers/media/video/s5p-fimc/fimc-m2m.c |4 +- drivers/media/video/s5p-fimc/fimc-reg.c |4 +- drivers/media/video/s5p-fimc/fimc-reg.h |2 +- 6 files changed, 133 insertions(+), 50 deletions(-) diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c b/drivers/media/video/s5p-fimc/fimc-capture.c index bcf9c1e..88903e5 100644 --- a/drivers/media/video/s5p-fimc/fimc-capture.c +++ b/drivers/media/video/s5p-fimc/fimc-capture.c @@ -62,7 +62,7 @@ static int fimc_capture_hw_init(struct fimc_dev *fimc) fimc_hw_set_mainscaler(ctx); fimc_hw_set_target_format(ctx); fimc_hw_set_rotation(ctx); - fimc_hw_set_effect(ctx, false); + fimc_hw_set_effect(ctx); fimc_hw_set_output_path(ctx); fimc_hw_set_out_dma(ctx); if (fimc-variant-has_alpha) @@ -164,6 +164,7 @@ static int fimc_capture_config_update(struct fimc_ctx *ctx) fimc_hw_set_mainscaler(ctx); fimc_hw_set_target_format(ctx); fimc_hw_set_rotation(ctx); + fimc_hw_set_effect(ctx); fimc_prepare_dma_offset(ctx, ctx-d_frame); fimc_hw_set_out_dma(ctx); if (fimc-variant-has_alpha) @@ -457,14 +458,14 @@ int fimc_capture_ctrls_create(struct fimc_dev *fimc) if (WARN_ON(vid_cap-ctx == NULL)) return -ENXIO; - if (vid_cap-ctx-ctrls_rdy) + if (vid_cap-ctx-ctrls.ready) return 0; ret = fimc_ctrls_create(vid_cap-ctx); - if (ret || vid_cap-user_subdev_api) + if (ret || vid_cap-user_subdev_api || !vid_cap-ctx-ctrls.ready) return ret; - return v4l2_ctrl_add_handler(vid_cap-ctx-ctrl_handler, + return v4l2_ctrl_add_handler(vid_cap-ctx-ctrls.handler, fimc-pipeline.subdevs[IDX_SENSOR]-ctrl_handler); } @@ -1579,7 +1580,7 @@ static int fimc_register_capture_device(struct fimc_dev *fimc, v4l2_info(v4l2_dev, Registered %s as /dev/%s\n, vfd-name, video_device_node_name(vfd)); - vfd-ctrl_handler = ctx-ctrl_handler; + vfd-ctrl_handler = ctx-ctrls.handler; return 0; err_vd: diff --git a/drivers/media/video/s5p-fimc/fimc-core.c b/drivers/media/video/s5p-fimc/fimc-core.c index 8d066c5..0d7ef6d 100644 --- a/drivers/media/video/s5p-fimc/fimc-core.c +++ b/drivers/media/video/s5p-fimc/fimc-core.c @@ -461,11 +461,53 @@ void fimc_prepare_dma_offset(struct fimc_ctx *ctx, struct fimc_frame *f) f-fmt-color, f-dma_offset.y_h, f-dma_offset.y_v); } +int fimc_set_color_effect(struct fimc_ctx *ctx, enum v4l2_colorfx colorfx) +{ + struct fimc_effect *effect = ctx-effect; + + switch (colorfx) { + case V4L2_COLORFX_NONE: + effect-type = FIMC_REG_CIIMGEFF_FIN_BYPASS; + break; + case V4L2_COLORFX_BW: + effect-type = FIMC_REG_CIIMGEFF_FIN_ARBITRARY; + effect-pat_cb = 128; + effect-pat_cr = 128; + break; + case V4L2_COLORFX_SEPIA: + effect-type = FIMC_REG_CIIMGEFF_FIN_ARBITRARY; + effect-pat_cb = 115; + effect-pat_cr = 145; + break; + case V4L2_COLORFX_NEGATIVE: + effect-type = FIMC_REG_CIIMGEFF_FIN_NEGATIVE; + break; + case V4L2_COLORFX_EMBOSS: + effect-type = FIMC_REG_CIIMGEFF_FIN_EMBOSSING; + break; + case V4L2_COLORFX_ART_FREEZE: + effect-type = FIMC_REG_CIIMGEFF_FIN_ARTFREEZE; + break; + case V4L2_COLORFX_SILHOUETTE: + effect-type = FIMC_REG_CIIMGEFF_FIN_SILHOUETTE; + break; + case V4L2_COLORFX_SET_CBCR: + effect-type = FIMC_REG_CIIMGEFF_FIN_ARBITRARY; + effect-pat_cb = ctx-ctrls.colorfx_cbcr-val 8; + effect-pat_cr = ctx-ctrls.colorfx_cbcr-val 0xff; + break; + default: + return -EINVAL; + } + + return 0; +} + /* * V4L2 controls handling */ #define ctrl_to_ctx(__ctrl) \ - container_of((__ctrl)-handler, struct fimc_ctx, ctrl_handler) + container_of((__ctrl)-handler, struct fimc_ctx, ctrls.handler) static int __fimc_s_ctrl(struct fimc_ctx *ctx, struct v4l2_ctrl *ctrl) { @@ -505,7 +547,14 @@ static int __fimc_s_ctrl(struct fimc_ctx *ctx, struct v4l2_ctrl *ctrl) case V4L2_CID_ALPHA_COMPONENT: ctx-d_frame.alpha = ctrl-val; break; + + case V4L2_CID_COLORFX: + ret =
[PATCH v2 03/12] s5p-fimc: Use v4l2_subdev internal ops to register video nodes
In order to be able to select only FIMC-LITE support, which is added with subsequent patches, the regular FIMC support is now contained only in fimc-core.c, fimc-m2m.c and fimc-capture.c files. The graph and pipeline management is now solely handled in fimc-mdevice.[ch]. This means the FIMC driver can now be excluded with Kconfig option, leaving only FIMC-LITE and allowing this driver to be reused in SoCs that have only FIMC-LITE and no regular FIMC IP. Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com --- drivers/media/video/s5p-fimc/fimc-capture.c | 142 +++ drivers/media/video/s5p-fimc/fimc-core.c|8 +- drivers/media/video/s5p-fimc/fimc-core.h|7 +- drivers/media/video/s5p-fimc/fimc-m2m.c | 17 +++- drivers/media/video/s5p-fimc/fimc-mdevice.c | 89 +++-- drivers/media/video/s5p-fimc/fimc-mdevice.h |1 + 6 files changed, 136 insertions(+), 128 deletions(-) diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c b/drivers/media/video/s5p-fimc/fimc-capture.c index 513ffbc..b9ef1be 100644 --- a/drivers/media/video/s5p-fimc/fimc-capture.c +++ b/drivers/media/video/s5p-fimc/fimc-capture.c @@ -988,7 +988,7 @@ static int fimc_pipeline_validate(struct fimc_dev *fimc) if (!(pad-flags MEDIA_PAD_FL_SINK)) break; /* Don't call FIMC subdev operation to avoid nested locking */ - if (sd == fimc-vid_cap.subdev) { + if (sd == fimc-vid_cap.subdev) { struct fimc_frame *ff = vid_cap-ctx-s_frame; sink_fmt.format.width = ff-f_width; sink_fmt.format.height = ff-f_height; @@ -1484,53 +1484,6 @@ static struct v4l2_subdev_ops fimc_subdev_ops = { .pad = fimc_subdev_pad_ops, }; -static int fimc_create_capture_subdev(struct fimc_dev *fimc, - struct v4l2_device *v4l2_dev) -{ - struct v4l2_subdev *sd; - int ret; - - sd = kzalloc(sizeof(*sd), GFP_KERNEL); - if (!sd) - return -ENOMEM; - - v4l2_subdev_init(sd, fimc_subdev_ops); - sd-flags = V4L2_SUBDEV_FL_HAS_DEVNODE; - snprintf(sd-name, sizeof(sd-name), FIMC.%d, fimc-pdev-id); - - fimc-vid_cap.sd_pads[FIMC_SD_PAD_SINK].flags = MEDIA_PAD_FL_SINK; - fimc-vid_cap.sd_pads[FIMC_SD_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE; - ret = media_entity_init(sd-entity, FIMC_SD_PADS_NUM, - fimc-vid_cap.sd_pads, 0); - if (ret) - goto me_err; - ret = v4l2_device_register_subdev(v4l2_dev, sd); - if (ret) - goto sd_err; - - fimc-vid_cap.subdev = sd; - v4l2_set_subdevdata(sd, fimc); - sd-entity.ops = fimc_sd_media_ops; - return 0; -sd_err: - media_entity_cleanup(sd-entity); -me_err: - kfree(sd); - return ret; -} - -static void fimc_destroy_capture_subdev(struct fimc_dev *fimc) -{ - struct v4l2_subdev *sd = fimc-vid_cap.subdev; - - if (!sd) - return; - media_entity_cleanup(sd-entity); - v4l2_device_unregister_subdev(sd); - kfree(sd); - fimc-vid_cap.subdev = NULL; -} - /* Set default format at the sensor and host interface */ static int fimc_capture_set_default_format(struct fimc_dev *fimc) { @@ -1549,7 +1502,7 @@ static int fimc_capture_set_default_format(struct fimc_dev *fimc) } /* fimc-lock must be already initialized */ -int fimc_register_capture_device(struct fimc_dev *fimc, +static int fimc_register_capture_device(struct fimc_dev *fimc, struct v4l2_device *v4l2_dev) { struct video_device *vfd; @@ -1567,7 +1520,7 @@ int fimc_register_capture_device(struct fimc_dev *fimc, ctx-out_path= FIMC_DMA; ctx-state = FIMC_CTX_CAP; ctx-s_frame.fmt = fimc_find_format(NULL, NULL, FMT_FLAGS_CAM, 0); - ctx-d_frame.fmt = fimc_find_format(NULL, NULL, FMT_FLAGS_CAM, 0); + ctx-d_frame.fmt = ctx-s_frame.fmt; vfd = video_device_alloc(); if (!vfd) { @@ -1575,8 +1528,7 @@ int fimc_register_capture_device(struct fimc_dev *fimc, goto err_vd_alloc; } - snprintf(vfd-name, sizeof(vfd-name), %s.capture, -dev_name(fimc-pdev-dev)); + snprintf(vfd-name, sizeof(vfd-name), fimc.%d.capture, fimc-id); vfd-fops = fimc_capture_fops; vfd-ioctl_ops = fimc_capture_ioctl_ops; @@ -1607,18 +1559,22 @@ int fimc_register_capture_device(struct fimc_dev *fimc, vb2_queue_init(q); - fimc-vid_cap.vd_pad.flags = MEDIA_PAD_FL_SINK; - ret = media_entity_init(vfd-entity, 1, fimc-vid_cap.vd_pad, 0); + vid_cap-vd_pad.flags = MEDIA_PAD_FL_SINK; + ret = media_entity_init(vfd-entity, 1, vid_cap-vd_pad, 0); if (ret) goto err_ent; - ret =
[PATCH v2 06/12] s5p-fimc: Rework the video pipeline control functions
There is getting more entities to manage within single video pipeline in newer SoCs. To simplify code put subdevs' pointer into an array rather than adding new member in struct fimc_pipeline for each subdev. This allows to easier handle subdev operations in proper order. Additionally walk graph in one direction only in fimc_pipeline_prepare() function to make sure we properly gather only media entities that below to single data pipeline. This avoids wrong initialization in case where, for example there are multiple active links from s5p-mipi-csis subdev output pad. struct fimc_pipeline declaration is moved to the driver's public header to allow other drivers to reuse the fimc-lite driver added in subsequent patches. Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com --- drivers/media/video/s5p-fimc/fimc-capture.c | 32 +++--- drivers/media/video/s5p-fimc/fimc-core.h|5 - drivers/media/video/s5p-fimc/fimc-mdevice.c | 164 +-- drivers/media/video/s5p-fimc/fimc-mdevice.h | 10 +- include/media/s5p_fimc.h| 16 +++ 5 files changed, 139 insertions(+), 88 deletions(-) diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c b/drivers/media/video/s5p-fimc/fimc-capture.c index 31392c8..8d33445 100644 --- a/drivers/media/video/s5p-fimc/fimc-capture.c +++ b/drivers/media/video/s5p-fimc/fimc-capture.c @@ -34,16 +34,17 @@ static int fimc_init_capture(struct fimc_dev *fimc) { struct fimc_ctx *ctx = fimc-vid_cap.ctx; + struct fimc_pipeline *p = fimc-pipeline; struct fimc_sensor_info *sensor; unsigned long flags; int ret = 0; - if (fimc-pipeline.sensor == NULL || ctx == NULL) + if (p-subdevs[IDX_SENSOR] == NULL || ctx == NULL) return -ENXIO; if (ctx-s_frame.fmt == NULL) return -EINVAL; - sensor = v4l2_get_subdev_hostdata(fimc-pipeline.sensor); + sensor = v4l2_get_subdev_hostdata(p-subdevs[IDX_SENSOR]); spin_lock_irqsave(fimc-slock, flags); fimc_prepare_dma_offset(ctx, ctx-d_frame); @@ -109,7 +110,7 @@ static int fimc_capture_state_cleanup(struct fimc_dev *fimc, bool suspend) spin_unlock_irqrestore(fimc-slock, flags); if (streaming) - return fimc_pipeline_s_stream(fimc, 0); + return fimc_pipeline_s_stream(fimc-pipeline, 0); else return 0; } @@ -258,7 +259,7 @@ static int start_streaming(struct vb2_queue *q, unsigned int count) fimc_activate_capture(ctx); if (!test_and_set_bit(ST_CAPT_ISP_STREAM, fimc-state)) - fimc_pipeline_s_stream(fimc, 1); + fimc_pipeline_s_stream(fimc-pipeline, 1); } return 0; @@ -285,7 +286,7 @@ int fimc_capture_suspend(struct fimc_dev *fimc) int ret = fimc_stop_capture(fimc, suspend); if (ret) return ret; - return fimc_pipeline_shutdown(fimc); + return fimc_pipeline_shutdown(fimc-pipeline); } static void buffer_queue(struct vb2_buffer *vb); @@ -301,7 +302,7 @@ int fimc_capture_resume(struct fimc_dev *fimc) INIT_LIST_HEAD(fimc-vid_cap.active_buf_q); vid_cap-buf_index = 0; - fimc_pipeline_initialize(fimc, fimc-vid_cap.vfd-entity, + fimc_pipeline_initialize(fimc-pipeline, vid_cap-vfd-entity, false); fimc_init_capture(fimc); @@ -409,7 +410,7 @@ static void buffer_queue(struct vb2_buffer *vb) spin_unlock_irqrestore(fimc-slock, flags); if (!test_and_set_bit(ST_CAPT_ISP_STREAM, fimc-state)) - fimc_pipeline_s_stream(fimc, 1); + fimc_pipeline_s_stream(fimc-pipeline, 1); return; } spin_unlock_irqrestore(fimc-slock, flags); @@ -459,7 +460,7 @@ int fimc_capture_ctrls_create(struct fimc_dev *fimc) return ret; return v4l2_ctrl_add_handler(vid_cap-ctx-ctrl_handler, - fimc-pipeline.sensor-ctrl_handler); + fimc-pipeline.subdevs[IDX_SENSOR]-ctrl_handler); } static int fimc_capture_set_default_format(struct fimc_dev *fimc); @@ -482,7 +483,7 @@ static int fimc_capture_open(struct file *file) pm_runtime_get_sync(fimc-pdev-dev); if (++fimc-vid_cap.refcnt == 1) { - ret = fimc_pipeline_initialize(fimc, + ret = fimc_pipeline_initialize(fimc-pipeline, fimc-vid_cap.vfd-entity, true); if (ret 0) { dev_err(fimc-pdev-dev, @@ -510,7 +511,7 @@ static int fimc_capture_close(struct file *file) if (--fimc-vid_cap.refcnt == 0) { clear_bit(ST_CAPT_BUSY, fimc-state); fimc_stop_capture(fimc, false); - fimc_pipeline_shutdown(fimc); +
[PATCH v2 05/12] s5p-fimc: Add FIMC-LITE register definitions
Add register definitions and register API for FIMC-LITE devices. Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com --- drivers/media/video/s5p-fimc/fimc-lite-reg.c | 301 ++ drivers/media/video/s5p-fimc/fimc-lite-reg.h | 153 + drivers/media/video/s5p-fimc/fimc-lite.h | 209 ++ 3 files changed, 663 insertions(+) create mode 100644 drivers/media/video/s5p-fimc/fimc-lite-reg.c create mode 100644 drivers/media/video/s5p-fimc/fimc-lite-reg.h create mode 100644 drivers/media/video/s5p-fimc/fimc-lite.h diff --git a/drivers/media/video/s5p-fimc/fimc-lite-reg.c b/drivers/media/video/s5p-fimc/fimc-lite-reg.c new file mode 100644 index 000..7a20c45 --- /dev/null +++ b/drivers/media/video/s5p-fimc/fimc-lite-reg.c @@ -0,0 +1,301 @@ +/* + * Register interface file for EXYNOS FIMC-LITE (camera interface) driver + * + * Copyright (C) 2012 Samsung Electronics Co., Ltd. + * Sylwester Nawrocki s.nawro...@samsung.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. +*/ + +#include linux/io.h +#include linux/delay.h +#include media/s5p_fimc.h + +#include fimc-lite-reg.h +#include fimc-lite.h +#include fimc-core.h + +#define FLITE_RESET_TIMEOUT 50 /* in ms FIXME: */ + +void flite_hw_reset(struct fimc_lite *dev) +{ + unsigned long end = jiffies + msecs_to_jiffies(FLITE_RESET_TIMEOUT); + u32 cfg; + + cfg = readl(dev-regs + FLITE_REG_CIGCTRL); + cfg |= FLITE_REG_CIGCTRL_SWRST_REQ; + writel(cfg, dev-regs + FLITE_REG_CIGCTRL); + + while (time_is_after_jiffies(end)) { + cfg = readl(dev-regs + FLITE_REG_CIGCTRL); + if (cfg FLITE_REG_CIGCTRL_SWRST_RDY) + break; + usleep_range(1000, 5000); + } + + cfg |= FLITE_REG_CIGCTRL_SWRST; + writel(cfg, dev-regs + FLITE_REG_CIGCTRL); +} + +void flite_hw_clear_pending_irq(struct fimc_lite *dev) +{ + u32 cfg = readl(dev-regs + FLITE_REG_CISTATUS); + cfg = ~FLITE_REG_CISTATUS_IRQ_CAM; + writel(cfg, dev-regs + FLITE_REG_CISTATUS); +} + +u32 flite_hw_get_interrupt_source(struct fimc_lite *dev) +{ + u32 intsrc = readl(dev-regs + FLITE_REG_CISTATUS); + return intsrc FLITE_REG_CISTATUS_IRQ_MASK; +} + +void flite_hw_clear_last_capture_end(struct fimc_lite *dev) +{ + + u32 cfg = readl(dev-regs + FLITE_REG_CISTATUS2); + cfg = ~FLITE_REG_CISTATUS2_LASTCAPEND; + writel(cfg, dev-regs + FLITE_REG_CISTATUS2); +} + +void flite_hw_set_interrupt_mask(struct fimc_lite *dev) +{ + u32 cfg, intsrc; + + /* Select interrupts to be enabled for each output mode */ + if (dev-out_path == FIMC_IO_DMA) { + intsrc = FLITE_REG_CIGCTRL_IRQ_OVFEN | +FLITE_REG_CIGCTRL_IRQ_LASTEN | +/* FLITE_REG_CIGCTRL_IRQ_ENDEN0 | */ + FLITE_REG_CIGCTRL_IRQ_STARTEN; + } else { + /* An output to the FIMC-IS */ + intsrc = FLITE_REG_CIGCTRL_IRQ_OVFEN | +FLITE_REG_CIGCTRL_IRQ_LASTEN; + } + + cfg = readl(dev-regs + FLITE_REG_CIGCTRL); + cfg |= FLITE_REG_CIGCTRL_IRQ_DISABLE_MASK; + cfg = ~intsrc; + writel(cfg, dev-regs + FLITE_REG_CIGCTRL); +} + +void flite_hw_capture_start(struct fimc_lite *dev) +{ + u32 cfg = readl(dev-regs + FLITE_REG_CIIMGCPT); + cfg |= FLITE_REG_CIIMGCPT_IMGCPTEN; + writel(cfg, dev-regs + FLITE_REG_CIIMGCPT); +} + +void flite_hw_capture_stop(struct fimc_lite *dev) +{ + u32 cfg = readl(dev-regs + FLITE_REG_CIIMGCPT); + cfg = ~FLITE_REG_CIIMGCPT_IMGCPTEN; + writel(cfg, dev-regs + FLITE_REG_CIIMGCPT); +} + +/* + * Test pattern (color bars) enable/disable. External sensor + * pixel clock must be active for the test pattern to work. + */ +void flite_hw_set_test_pattern(struct fimc_lite *dev, bool on) +{ + u32 cfg = readl(dev-regs + FLITE_REG_CIGCTRL); + if (on) + cfg |= FLITE_REG_CIGCTRL_TEST_PATTERN_COLORBAR; + else + cfg = ~FLITE_REG_CIGCTRL_TEST_PATTERN_COLORBAR; + writel(cfg, dev-regs + FLITE_REG_CIGCTRL); +} + +static const u32 src_pixfmt_map[8][3] = { + { V4L2_MBUS_FMT_YUYV8_2X8, FLITE_REG_CISRCSIZE_ORDER422_IN_YCBYCR, + FLITE_REG_CIGCTRL_YUV422_1P }, + { V4L2_MBUS_FMT_YVYU8_2X8, FLITE_REG_CISRCSIZE_ORDER422_IN_YCRYCB, + FLITE_REG_CIGCTRL_YUV422_1P }, + { V4L2_MBUS_FMT_UYVY8_2X8, FLITE_REG_CISRCSIZE_ORDER422_IN_CBYCRY, + FLITE_REG_CIGCTRL_YUV422_1P }, + { V4L2_MBUS_FMT_VYUY8_2X8, FLITE_REG_CISRCSIZE_ORDER422_IN_CRYCBY, + FLITE_REG_CIGCTRL_YUV422_1P }, + { V4L2_PIX_FMT_SGRBG8, 0, FLITE_REG_CIGCTRL_RAW8 }, + { V4L2_PIX_FMT_SGRBG10, 0,
[PATCH v2 02/12] s5p-fimc: Move m2m node driver into separate file
Virtually no functional changes, just code reordering. This let us to clearly separate all logical functions available in the driver: fimc capture, mem-to-mem, and later fimc-lite capture, ISP features, etc. Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com --- drivers/media/video/s5p-fimc/Makefile |2 +- drivers/media/video/s5p-fimc/fimc-capture.c | 72 ++- drivers/media/video/s5p-fimc/fimc-core.c| 853 +-- drivers/media/video/s5p-fimc/fimc-core.h| 10 +- drivers/media/video/s5p-fimc/fimc-m2m.c | 808 + 5 files changed, 892 insertions(+), 853 deletions(-) create mode 100644 drivers/media/video/s5p-fimc/fimc-m2m.c diff --git a/drivers/media/video/s5p-fimc/Makefile b/drivers/media/video/s5p-fimc/Makefile index 33dec7f..1da3c6a 100644 --- a/drivers/media/video/s5p-fimc/Makefile +++ b/drivers/media/video/s5p-fimc/Makefile @@ -1,4 +1,4 @@ -s5p-fimc-objs := fimc-core.o fimc-reg.o fimc-capture.o fimc-mdevice.o +s5p-fimc-objs := fimc-core.o fimc-reg.o fimc-m2m.o fimc-capture.o fimc-mdevice.o s5p-csis-objs := mipi-csis.o obj-$(CONFIG_VIDEO_S5P_MIPI_CSIS) += s5p-csis.o diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c b/drivers/media/video/s5p-fimc/fimc-capture.c index dc18ba5..513ffbc 100644 --- a/drivers/media/video/s5p-fimc/fimc-capture.c +++ b/drivers/media/video/s5p-fimc/fimc-capture.c @@ -139,7 +139,7 @@ static int fimc_stop_capture(struct fimc_dev *fimc, bool suspend) * spinlock held. It updates the camera pixel crop, rotation and * image flip in H/W. */ -int fimc_capture_config_update(struct fimc_ctx *ctx) +static int fimc_capture_config_update(struct fimc_ctx *ctx) { struct fimc_dev *fimc = ctx-fimc_dev; int ret; @@ -166,6 +166,74 @@ int fimc_capture_config_update(struct fimc_ctx *ctx) return ret; } +void fimc_capture_irq_handler(struct fimc_dev *fimc) +{ + struct fimc_vid_cap *cap = fimc-vid_cap; + struct fimc_vid_buffer *v_buf; + bool capture_stop; + struct timeval *tv; + struct timespec ts; + + if (test_and_clear_bit(ST_CAPT_SHUT, fimc-state)) { + wake_up(fimc-irq_queue); + goto done; + } + + capture_stop = !test_bit(ST_CAPT_JPEG, fimc-state) || + (cap-reqbufs_count == 1); + + if (!list_empty(cap-active_buf_q) + test_bit(ST_CAPT_RUN, fimc-state) capture_stop) { + ktime_get_real_ts(ts); + + v_buf = fimc_active_queue_pop(cap); + + tv = v_buf-vb.v4l2_buf.timestamp; + tv-tv_sec = ts.tv_sec; + tv-tv_usec = ts.tv_nsec / NSEC_PER_USEC; + v_buf-vb.v4l2_buf.sequence = cap-frame_count++; + + vb2_buffer_done(v_buf-vb, VB2_BUF_STATE_DONE); + } + + if (!list_empty(cap-pending_buf_q)) { + + v_buf = fimc_pending_queue_pop(cap); + fimc_hw_set_output_addr(fimc, v_buf-paddr, cap-buf_index); + v_buf-index = cap-buf_index; + + /* Move the buffer to the capture active queue */ + fimc_active_queue_add(cap, v_buf); + + dbg(next frame: %d, done frame: %d, + fimc_hw_get_frame_index(fimc), v_buf-index); + + if (++cap-buf_index = FIMC_MAX_OUT_BUFS) + cap-buf_index = 0; + } + + if (cap-active_buf_cnt == 0) { + if (capture_stop) + clear_bit(ST_CAPT_RUN, fimc-state); + + if (++cap-buf_index = FIMC_MAX_OUT_BUFS) + cap-buf_index = 0; + } else { + set_bit(ST_CAPT_RUN, fimc-state); + } + + fimc_capture_config_update(cap-ctx); +done: + if (cap-active_buf_cnt == 1) { + fimc_deactivate_capture(fimc); + clear_bit(ST_CAPT_STREAM, fimc-state); + } + + dbg(frame: %d, active_buf_cnt: %d, + fimc_hw_get_frame_index(fimc), cap-active_buf_cnt); +} + + static int start_streaming(struct vb2_queue *q, unsigned int count) { struct fimc_ctx *ctx = q-drv_priv; @@ -1236,7 +1304,7 @@ void fimc_sensor_notify(struct v4l2_subdev *sd, unsigned int notification, struct fimc_vid_buffer, list); vb2_set_plane_payload(buf-vb, 0, *((u32 *)arg)); } - fimc_capture_irq_handler(fimc, true); + fimc_capture_irq_handler(fimc); fimc_deactivate_capture(fimc); spin_unlock_irqrestore(fimc-slock, irq_flags); } diff --git a/drivers/media/video/s5p-fimc/fimc-core.c b/drivers/media/video/s5p-fimc/fimc-core.c index 7b90a89..55858c5 100644 --- a/drivers/media/video/s5p-fimc/fimc-core.c +++ b/drivers/media/video/s5p-fimc/fimc-core.c @@ -1,5 +1,5 @@ /* - * Samsung S5P/EXYNOS4 SoC series camera interface
[PATCH v2 10/12] s5p-fimc: Add support for Exynos4x12 FIMC-LITE
This patch adds driver for FIMC-LITE camera host interface. This new IP differs from the regular FIMC IP in that it doesn't have input DMA, scaler and color space conversion support. So it just plain camera host interface for MIPI-CSI2 and ITU-R interfaces. For the serial bus support it interworks with MIPI-CSIS and the exisiting s5p-csis driver. The FIMC-LITE and MIPI-CSIS drivers can also be reused in the Exynos5 SoC series. Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com --- drivers/media/video/Kconfig | 24 +- drivers/media/video/s5p-fimc/Kconfig| 48 + drivers/media/video/s5p-fimc/Makefile |4 +- drivers/media/video/s5p-fimc/fimc-core.h|1 + drivers/media/video/s5p-fimc/fimc-lite.c| 1547 +++ drivers/media/video/s5p-fimc/fimc-mdevice.c | 152 ++- drivers/media/video/s5p-fimc/fimc-mdevice.h |5 +- 7 files changed, 1737 insertions(+), 44 deletions(-) create mode 100644 drivers/media/video/s5p-fimc/Kconfig create mode 100644 drivers/media/video/s5p-fimc/fimc-lite.c diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index f2479c5..2885516 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig @@ -1127,19 +1127,6 @@ config VIDEO_MX2 This is a v4l2 driver for the i.MX27 and the i.MX25 Camera Sensor Interface -config VIDEO_SAMSUNG_S5P_FIMC - tristate Samsung S5P and EXYNOS4 camera interface driver (EXPERIMENTAL) - depends on VIDEO_V4L2 I2C PLAT_S5P PM_RUNTIME \ - VIDEO_V4L2_SUBDEV_API EXPERIMENTAL - select VIDEOBUF2_DMA_CONTIG - select V4L2_MEM2MEM_DEV - ---help--- - This is a v4l2 driver for Samsung S5P and EXYNOS4 camera - host interface and video postprocessor. - - To compile this driver as a module, choose M here: the - module will be called s5p-fimc. - config VIDEO_ATMEL_ISI tristate ATMEL Image Sensor Interface (ISI) support depends on VIDEO_DEV SOC_CAMERA ARCH_AT91 @@ -1148,16 +1135,7 @@ config VIDEO_ATMEL_ISI This module makes the ATMEL Image Sensor Interface available as a v4l2 device. -config VIDEO_S5P_MIPI_CSIS - tristate Samsung S5P and EXYNOS4 MIPI CSI receiver driver - depends on VIDEO_V4L2 PM_RUNTIME PLAT_S5P - depends on VIDEO_V4L2_SUBDEV_API REGULATOR - ---help--- - This is a v4l2 driver for Samsung S5P/EXYNOS4 MIPI-CSI receiver. - - To compile this driver as a module, choose M here: the - module will be called s5p-csis. - +source drivers/media/video/s5p-fimc/Kconfig source drivers/media/video/s5p-tv/Kconfig endif # V4L_PLATFORM_DRIVERS diff --git a/drivers/media/video/s5p-fimc/Kconfig b/drivers/media/video/s5p-fimc/Kconfig new file mode 100644 index 000..a564f7e --- /dev/null +++ b/drivers/media/video/s5p-fimc/Kconfig @@ -0,0 +1,48 @@ + +config VIDEO_SAMSUNG_S5P_FIMC + bool Samsung S5P/EXYNOS SoC camera interface driver (experimental) + depends on VIDEO_V4L2 VIDEO_V4L2_SUBDEV_API PLAT_S5P PM_RUNTIME + depends on EXPERIMENTAL + help + Say Y here to enable camera host interface devices for + Samsung S5P and EXYNOS SoC series. + +if VIDEO_SAMSUNG_S5P_FIMC + +config VIDEO_S5P_FIMC + tristate S5P/EXYNOS4 FIMC/CAMIF camera interface driver + depends on I2C + select VIDEOBUF2_DMA_CONTIG + select V4L2_MEM2MEM_DEV + help + This is a V4L2 driver for Samsung S5P and EXYNOS4 SoC camera host + interface and video postprocessor (FIMC and FIMC-LITE) devices. + + To compile this driver as a module, choose M here: the + module will be called s5p-fimc. + +config VIDEO_S5P_MIPI_CSIS + tristate S5P/EXYNOS MIPI-CSI2 receiver (MIPI-CSIS) driver + depends on REGULATOR + help + This is a V4L2 driver for Samsung S5P and EXYNOS4 SoC MIPI-CSI2 + receiver (MIPI-CSIS) devices. + + To compile this driver as a module, choose M here: the + module will be called s5p-csis. + +if ARCH_EXYNOS + +config VIDEO_EXYNOS_FIMC_LITE + tristate EXYNOS FIMC-LITE camera interface driver + depends on I2C + select VIDEOBUF2_DMA_CONTIG + help + This is a V4L2 driver for Samsung EXYNOS4/5 SoC FIMC-LITE camera + host interface. + + To compile this driver as a module, choose M here: the + module will be called exynos-fimc-lite. +endif + +endif # VIDEO_SAMSUNG_S5P_FIMC diff --git a/drivers/media/video/s5p-fimc/Makefile b/drivers/media/video/s5p-fimc/Makefile index 1da3c6a..4648514 100644 --- a/drivers/media/video/s5p-fimc/Makefile +++ b/drivers/media/video/s5p-fimc/Makefile @@ -1,5 +1,7 @@ s5p-fimc-objs := fimc-core.o fimc-reg.o fimc-m2m.o fimc-capture.o fimc-mdevice.o +exynos-fimc-lite-objs += fimc-lite-reg.o fimc-lite.o s5p-csis-objs :=
[PATCH v2 08/12] s5p-fimc: Minor cleanups
Tidy up the variant and driver data handling. Remove the 'samsung_' prefix from some data structures since it doesn't really carry any useful information and makes the names unnecessarily long. Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com --- drivers/media/video/s5p-fimc/fimc-capture.c | 33 +-- drivers/media/video/s5p-fimc/fimc-core.c| 39 +-- drivers/media/video/s5p-fimc/fimc-core.h| 26 +- drivers/media/video/s5p-fimc/fimc-reg.c |2 +- 4 files changed, 51 insertions(+), 49 deletions(-) diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c b/drivers/media/video/s5p-fimc/fimc-capture.c index 4855af1..3e3ab85 100644 --- a/drivers/media/video/s5p-fimc/fimc-capture.c +++ b/drivers/media/video/s5p-fimc/fimc-capture.c @@ -31,7 +31,7 @@ #include fimc-core.h #include fimc-reg.h -static int fimc_init_capture(struct fimc_dev *fimc) +static int fimc_capture_hw_init(struct fimc_dev *fimc) { struct fimc_ctx *ctx = fimc-vid_cap.ctx; struct fimc_pipeline *p = fimc-pipeline; @@ -73,6 +73,14 @@ static int fimc_init_capture(struct fimc_dev *fimc) return ret; } +/* + * Reinitialize the driver so it is ready to start the streaming again. + * Set fimc-state to indicate stream off and the hardware shut down state. + * If not suspending (@suspend is false), return any buffers to videobuf2. + * Otherwise put any owned buffers onto the pending buffers queue, so they + * can be re-spun when the device is being resumed. Also perform FIMC + * software reset and disable streaming on the whole pipeline if required. + */ static int fimc_capture_state_cleanup(struct fimc_dev *fimc, bool suspend) { struct fimc_vid_cap *cap = fimc-vid_cap; @@ -146,9 +154,6 @@ static int fimc_capture_config_update(struct fimc_ctx *ctx) struct fimc_dev *fimc = ctx-fimc_dev; int ret; - if (!test_bit(ST_CAPT_APPLY_CFG, fimc-state)) - return 0; - fimc_hw_set_camera_offset(fimc, ctx-s_frame); ret = fimc_set_scaler_info(ctx); @@ -224,7 +229,8 @@ void fimc_capture_irq_handler(struct fimc_dev *fimc) set_bit(ST_CAPT_RUN, fimc-state); } - fimc_capture_config_update(cap-ctx); + if (test_bit(ST_CAPT_APPLY_CFG, fimc-state)) + fimc_capture_config_update(cap-ctx); done: if (cap-active_buf_cnt == 1) { fimc_deactivate_capture(fimc); @@ -246,9 +252,11 @@ static int start_streaming(struct vb2_queue *q, unsigned int count) vid_cap-frame_count = 0; - ret = fimc_init_capture(fimc); - if (ret) - goto error; + ret = fimc_capture_hw_init(fimc); + if (ret) { + fimc_capture_state_cleanup(fimc, false); + return ret; + } set_bit(ST_CAPT_PEND, fimc-state); @@ -263,9 +271,6 @@ static int start_streaming(struct vb2_queue *q, unsigned int count) } return 0; -error: - fimc_capture_state_cleanup(fimc, false); - return ret; } static int stop_streaming(struct vb2_queue *q) @@ -304,7 +309,7 @@ int fimc_capture_resume(struct fimc_dev *fimc) vid_cap-buf_index = 0; fimc_pipeline_initialize(fimc-pipeline, vid_cap-vfd-entity, false); - fimc_init_capture(fimc); + fimc_capture_hw_init(fimc); clear_bit(ST_CAPT_SUSPENDED, fimc-state); @@ -558,7 +563,7 @@ static struct fimc_fmt *fimc_capture_try_format(struct fimc_ctx *ctx, { bool rotation = ctx-rotation == 90 || ctx-rotation == 270; struct fimc_dev *fimc = ctx-fimc_dev; - struct samsung_fimc_variant *var = fimc-variant; + struct fimc_variant *var = fimc-variant; struct fimc_pix_limit *pl = var-pix_limit; struct fimc_frame *dst = ctx-d_frame; u32 depth, min_w, max_w, min_h, align_h = 3; @@ -624,7 +629,7 @@ static void fimc_capture_try_crop(struct fimc_ctx *ctx, struct v4l2_rect *r, { bool rotate = ctx-rotation == 90 || ctx-rotation == 270; struct fimc_dev *fimc = ctx-fimc_dev; - struct samsung_fimc_variant *var = fimc-variant; + struct fimc_variant *var = fimc-variant; struct fimc_pix_limit *pl = var-pix_limit; struct fimc_frame *sink = ctx-s_frame; u32 max_w, max_h, min_w = 0, min_h = 0, min_sz; diff --git a/drivers/media/video/s5p-fimc/fimc-core.c b/drivers/media/video/s5p-fimc/fimc-core.c index 8be7f05..6573029 100644 --- a/drivers/media/video/s5p-fimc/fimc-core.c +++ b/drivers/media/video/s5p-fimc/fimc-core.c @@ -231,7 +231,7 @@ static int fimc_get_scaler_factor(u32 src, u32 tar, u32 *ratio, u32 *shift) int fimc_set_scaler_info(struct fimc_ctx *ctx) { - struct samsung_fimc_variant *variant = ctx-fimc_dev-variant; + struct fimc_variant *variant = ctx-fimc_dev-variant; struct device *dev =
[PATCH v2 01/12] V4L: Extend V4L2_CID_COLORFX with more image effects
This patch adds definition of additional color effects: - V4L2_COLORFX_AQUA, - V4L2_COLORFX_ART_FREEZE, - V4L2_COLORFX_SILHOUETTE, - V4L2_COLORFX_SOLARIZATION, - V4L2_COLORFX_ANTIQUE, - V4L2_COLORFX_SET_CBCR. The control's type in the documentation is changed from 'enum' to 'menu' - V4L2_CID_COLORFX has always been a menu, not an integer type control. The new V4L2_COLORFX_CBCR is added to allow for setting the fixed Cb, Cr values which are replacing chroma Cb/Cr coefficients in case of V4L2_COLORFX_SET_CBCR effect. Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com --- Documentation/DocBook/media/v4l/compat.xml | 13 Documentation/DocBook/media/v4l/controls.xml | 100 ++ Documentation/DocBook/media/v4l/v4l2.xml |5 +- drivers/media/video/v4l2-ctrls.c |7 ++ include/linux/videodev2.h| 29 +--- 5 files changed, 128 insertions(+), 26 deletions(-) diff --git a/Documentation/DocBook/media/v4l/compat.xml b/Documentation/DocBook/media/v4l/compat.xml index 87339b2..149f65d 100644 --- a/Documentation/DocBook/media/v4l/compat.xml +++ b/Documentation/DocBook/media/v4l/compat.xml @@ -2422,6 +2422,19 @@ details./para VIDIOC-SUBDEV-G-SELECTION; and VIDIOC-SUBDEV-S-SELECTION;./para /listitem +listitem + para Added constantV4L2_COLORFX_ANTIQUE/constant, + constantV4L2_COLORFX_ART_FREEZE/constant, + constantV4L2_COLORFX_AQUA/constant, + constantV4L2_COLORFX_SILHOUETTE/constant, + constantV4L2_COLORFX_SOLARIZATION/constant, + constantV4L2_COLORFX_VIVID/constant and + constantV4L2_COLORFX_ARBITRARY_CBCR/constant menu items + to the constantV4L2_CID_COLORFX/constant control./para +/listitem +listitem + para Added constantV4L2_CID_COLORFX_CBCR/constant control./para +/listitem /orderedlist /section diff --git a/Documentation/DocBook/media/v4l/controls.xml b/Documentation/DocBook/media/v4l/controls.xml index 5038a3a..b63e444 100644 --- a/Documentation/DocBook/media/v4l/controls.xml +++ b/Documentation/DocBook/media/v4l/controls.xml @@ -284,19 +284,93 @@ minimum value disables backlight compensation./entry /row row id=v4l2-colorfx entryconstantV4L2_CID_COLORFX/constant/entry - entryenum/entry - entrySelects a color effect. Possible values for -constantenum v4l2_colorfx/constant are: -constantV4L2_COLORFX_NONE/constant (0), -constantV4L2_COLORFX_BW/constant (1), -constantV4L2_COLORFX_SEPIA/constant (2), -constantV4L2_COLORFX_NEGATIVE/constant (3), -constantV4L2_COLORFX_EMBOSS/constant (4), -constantV4L2_COLORFX_SKETCH/constant (5), -constantV4L2_COLORFX_SKY_BLUE/constant (6), -constantV4L2_COLORFX_GRASS_GREEN/constant (7), -constantV4L2_COLORFX_SKIN_WHITEN/constant (8) and -constantV4L2_COLORFX_VIVID/constant (9)./entry + entrymenu/entry + entrySelects a color effect. The following values are defined: + /entry + /rowrow + entry/entry + entry/entry + entrytbl spanname=descr cols=2 + tbody valign=top + row + entryconstantV4L2_COLORFX_NONE/constantnbsp;/entry + entryColor effect is disabled./entry + /row + row + entryconstantV4L2_COLORFX_ANTIQUE/constantnbsp;/entry + entryAn aging (old photo) effect./entry + /row + row + entryconstantV4L2_COLORFX_ART_FREEZE/constantnbsp;/entry + entryFrost color effect./entry + /row + row + entryconstantV4L2_COLORFX_AQUA/constantnbsp;/entry + entryWater color, cool tone./entry + /row + row + entryconstantV4L2_COLORFX_BW/constantnbsp;/entry + entryBlack and white./entry + /row + row + entryconstantV4L2_COLORFX_EMBOSS/constantnbsp;/entry + entryEmboss, the highlights and shadows replace light/dark boundaries + and low contrast areas are set to a gray background./entry + /row + row + entryconstantV4L2_COLORFX_GRASS_GREEN/constantnbsp;/entry + entryGrass green./entry + /row + row + entryconstantV4L2_COLORFX_NEGATIVE/constantnbsp;/entry + entryNegative./entry + /row + row + entryconstantV4L2_COLORFX_SEPIA/constantnbsp;/entry + entrySepia tone./entry + /row + row + entryconstantV4L2_COLORFX_SKETCH/constantnbsp;/entry + entrySketch./entry + /row + row +
[PATCH v2 07/12] s5p-fimc: Prefix format enumerations with FIMC_FMT_
Prefix the pixel format enumerations with FIMC_FMT_ to make it more clear, especially when used in new IP drivers, like fimc-lite, etc. Also add IO_ prefix in the input/output enumeration. Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com --- drivers/media/video/s5p-fimc/fimc-capture.c |4 +- drivers/media/video/s5p-fimc/fimc-core.c| 56 +-- drivers/media/video/s5p-fimc/fimc-core.h| 45 +++-- drivers/media/video/s5p-fimc/fimc-m2m.c |4 +- drivers/media/video/s5p-fimc/fimc-reg.c | 48 +++ 5 files changed, 81 insertions(+), 76 deletions(-) diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c b/drivers/media/video/s5p-fimc/fimc-capture.c index 8d33445..4855af1 100644 --- a/drivers/media/video/s5p-fimc/fimc-capture.c +++ b/drivers/media/video/s5p-fimc/fimc-capture.c @@ -1519,8 +1519,8 @@ static int fimc_register_capture_device(struct fimc_dev *fimc, return -ENOMEM; ctx-fimc_dev= fimc; - ctx-in_path = FIMC_CAMERA; - ctx-out_path= FIMC_DMA; + ctx-in_path = FIMC_IO_CAMERA; + ctx-out_path= FIMC_IO_DMA; ctx-state = FIMC_CTX_CAP; ctx-s_frame.fmt = fimc_find_format(NULL, NULL, FMT_FLAGS_CAM, 0); ctx-d_frame.fmt = ctx-s_frame.fmt; diff --git a/drivers/media/video/s5p-fimc/fimc-core.c b/drivers/media/video/s5p-fimc/fimc-core.c index c80c57d..8be7f05 100644 --- a/drivers/media/video/s5p-fimc/fimc-core.c +++ b/drivers/media/video/s5p-fimc/fimc-core.c @@ -40,7 +40,7 @@ static struct fimc_fmt fimc_formats[] = { .name = RGB565, .fourcc = V4L2_PIX_FMT_RGB565, .depth = { 16 }, - .color = S5P_FIMC_RGB565, + .color = FIMC_FMT_RGB565, .memplanes = 1, .colplanes = 1, .flags = FMT_FLAGS_M2M, @@ -48,7 +48,7 @@ static struct fimc_fmt fimc_formats[] = { .name = BGR666, .fourcc = V4L2_PIX_FMT_BGR666, .depth = { 32 }, - .color = S5P_FIMC_RGB666, + .color = FIMC_FMT_RGB666, .memplanes = 1, .colplanes = 1, .flags = FMT_FLAGS_M2M, @@ -56,7 +56,7 @@ static struct fimc_fmt fimc_formats[] = { .name = ARGB, 32 bpp, .fourcc = V4L2_PIX_FMT_RGB32, .depth = { 32 }, - .color = S5P_FIMC_RGB888, + .color = FIMC_FMT_RGB888, .memplanes = 1, .colplanes = 1, .flags = FMT_FLAGS_M2M | FMT_HAS_ALPHA, @@ -64,7 +64,7 @@ static struct fimc_fmt fimc_formats[] = { .name = ARGB1555, .fourcc = V4L2_PIX_FMT_RGB555, .depth = { 16 }, - .color = S5P_FIMC_RGB555, + .color = FIMC_FMT_RGB555, .memplanes = 1, .colplanes = 1, .flags = FMT_FLAGS_M2M_OUT | FMT_HAS_ALPHA, @@ -72,7 +72,7 @@ static struct fimc_fmt fimc_formats[] = { .name = ARGB, .fourcc = V4L2_PIX_FMT_RGB444, .depth = { 16 }, - .color = S5P_FIMC_RGB444, + .color = FIMC_FMT_RGB444, .memplanes = 1, .colplanes = 1, .flags = FMT_FLAGS_M2M_OUT | FMT_HAS_ALPHA, @@ -80,7 +80,7 @@ static struct fimc_fmt fimc_formats[] = { .name = YUV 4:2:2 packed, YCbYCr, .fourcc = V4L2_PIX_FMT_YUYV, .depth = { 16 }, - .color = S5P_FIMC_YCBYCR422, + .color = FIMC_FMT_YCBYCR422, .memplanes = 1, .colplanes = 1, .mbus_code = V4L2_MBUS_FMT_YUYV8_2X8, @@ -89,7 +89,7 @@ static struct fimc_fmt fimc_formats[] = { .name = YUV 4:2:2 packed, CbYCrY, .fourcc = V4L2_PIX_FMT_UYVY, .depth = { 16 }, - .color = S5P_FIMC_CBYCRY422, + .color = FIMC_FMT_CBYCRY422, .memplanes = 1, .colplanes = 1, .mbus_code = V4L2_MBUS_FMT_UYVY8_2X8, @@ -98,7 +98,7 @@ static struct fimc_fmt fimc_formats[] = { .name = YUV 4:2:2 packed, CrYCbY, .fourcc = V4L2_PIX_FMT_VYUY, .depth = { 16 }, - .color = S5P_FIMC_CRYCBY422, +
cron job: media_tree daily build: WARNINGS
This message is generated daily by a cron job that builds media_tree for the kernels and architectures in the list below. Results of the daily build of media_tree: date:Mon Apr 30 19:00:16 CEST 2012 git hash:bcb2cf6e0bf033d79821c89e5ccb328bfbd44907 gcc version: i686-linux-gcc (GCC) 4.6.3 host hardware:x86_64 host os: 3.1-2.slh.1-amd64 linux-git-arm-eabi-exynos: WARNINGS linux-git-arm-eabi-omap: WARNINGS linux-git-armv5-ixp: WARNINGS linux-git-i686: OK linux-git-m32r: OK linux-git-mips: WARNINGS linux-git-powerpc64: OK linux-git-x86_64: WARNINGS linux-2.6.31.12-i686: WARNINGS linux-2.6.32.6-i686: WARNINGS linux-2.6.33-i686: WARNINGS linux-2.6.34-i686: WARNINGS linux-2.6.35.3-i686: WARNINGS linux-2.6.36-i686: WARNINGS linux-2.6.37-i686: WARNINGS linux-2.6.38.2-i686: WARNINGS linux-2.6.39.1-i686: WARNINGS linux-3.0-i686: OK linux-3.1-i686: OK linux-3.2.1-i686: OK linux-3.3-i686: WARNINGS linux-2.6.31.12-x86_64: WARNINGS linux-2.6.32.6-x86_64: WARNINGS linux-2.6.33-x86_64: WARNINGS linux-2.6.34-x86_64: WARNINGS linux-2.6.35.3-x86_64: WARNINGS linux-2.6.36-x86_64: WARNINGS linux-2.6.37-x86_64: WARNINGS linux-2.6.38.2-x86_64: WARNINGS linux-2.6.39.1-x86_64: WARNINGS linux-3.0-x86_64: WARNINGS linux-3.1-x86_64: WARNINGS linux-3.2.1-x86_64: WARNINGS linux-3.3-x86_64: WARNINGS apps: WARNINGS spec-git: WARNINGS 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 V4L-DVB specification from this daily build is here: http://www.xs4all.nl/~hverkuil/spec/media.html -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3] [media] rc: Postpone ISR registration
On Mon, Apr 23, 2012 at 02:38:11PM -0400, Jarod Wilson wrote: On Sat, Apr 21, 2012 at 05:25:21PM +0100, Luis Henriques wrote: An early registration of an ISR was causing a crash to several users (for example, with the ite-cir driver: http://bugs.launchpad.net/bugs/972723). The reason was that IRQs were being triggered before a driver initialisation was completed. This patch fixes this by moving the invocation to request_irq() and to request_region() to a later stage on the driver probe function. From what I can tell, it looks like v3 should do the job for all affected drivers. Acked-by: Jarod Wilson ja...@redhat.com Hi Jarod, I was wondering whether there are any news about this patch. I've checked linux-media tree, and it looks like it hasn't been applied. Cheers, -- Luis -- 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: ATSC-MH driver support for the Hauppauge WinTV Aero-m
0001-linux-dvb-v5-API-support-for-ATSC-MH.patch Description: Binary data
Re: ATSC-MH driver support for the Hauppauge WinTV Aero-m
0002-DocBook-document-new-DTV-Properties-for-ATSC-MH-deli.patch Description: Binary data
Re: ATSC-MH driver support for the Hauppauge WinTV Aero-m
0003-increment-DVB-API-to-version-5.6-for-ATSC-MH-fronten.patch Description: Binary data
Re: ATSC-MH driver support for the Hauppauge WinTV Aero-m
0004-mxl111sf-tuner-tune-SYS_ATSCMH-just-like-SYS_ATSC.patch Description: Binary data
Re: ATSC-MH driver support for the Hauppauge WinTV Aero-m
0005-DVB-add-support-for-the-LG2160-ATSC-MH-demodulator.patch Description: Binary data
Re: ATSC-MH driver support for the Hauppauge WinTV Aero-m
0006-lg2160-update-internal-api-interfaces-and-enable-bui.patch Description: Binary data
Re: ATSC-MH driver support for the Hauppauge WinTV Aero-m
0007-dvb-demux-add-functionality-to-send-raw-payload-to-t.patch Description: Binary data
Re: ATSC-MH driver support for the Hauppauge WinTV Aero-m
0008-dvb-usb-add-support-for-dvb-usb-adapters-that-delive.patch Description: Binary data
Re: ATSC-MH driver support for the Hauppauge WinTV Aero-m
0009-dvb-usb-increase-MAX_NO_OF_FE_PER_ADAP-from-2-to-3.patch Description: Binary data
Re: ATSC-MH driver support for the Hauppauge WinTV Aero-m
0010-mxl111sf-add-ATSC-MH-support.patch Description: Binary data
[PATCH] via-camera: specify XO-1.5 camera clock speed
For the ov7670 camera to return images at the requested frame rate, it needs to make calculations based on the clock speed, which is a completely external factor (depends on the wiring of the system). On the XO-1.5, which is the only known via-camera user, the camera is clocked at 90MHz. Pass this information to the ov7670 driver, to fix an issue where a framerate of 3x the requested amount was being provided. Signed-off-by: Daniel Drake d...@laptop.org --- drivers/media/video/via-camera.c | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/via-camera.c b/drivers/media/video/via-camera.c index 20f7237..308e150 100644 --- a/drivers/media/video/via-camera.c +++ b/drivers/media/video/via-camera.c @@ -18,6 +18,7 @@ #include media/v4l2-device.h #include media/v4l2-ioctl.h #include media/v4l2-chip-ident.h +#include media/ov7670.h #include media/videobuf-dma-sg.h #include linux/delay.h #include linux/dma-mapping.h @@ -1347,11 +1348,21 @@ static __devinit bool viacam_serial_is_enabled(void) return false; } +static struct ov7670_config sensor_cfg = { + /* The XO-1.5 (only known user) clocks the camera at 90MHz. */ + .clock_speed = 90, +}; + static __devinit int viacam_probe(struct platform_device *pdev) { int ret; struct i2c_adapter *sensor_adapter; struct viafb_dev *viadev = pdev-dev.platform_data; + struct i2c_board_info ov7670_info = { + .type = ov7670, + .addr = 0x42 1, + .platform_data = sensor_cfg, + }; /* * Note that there are actually two capture channels on @@ -1433,8 +1444,8 @@ static __devinit int viacam_probe(struct platform_device *pdev) * is OLPC-specific. 0x42 assumption is ov7670-specific. */ sensor_adapter = viafb_find_i2c_adapter(VIA_PORT_31); - cam-sensor = v4l2_i2c_new_subdev(cam-v4l2_dev, sensor_adapter, - ov7670, 0x42 1, NULL); + cam-sensor = v4l2_i2c_new_subdev_board(cam-v4l2_dev, sensor_adapter, + ov7670_info, NULL); if (cam-sensor == NULL) { dev_err(pdev-dev, Unable to find the sensor!\n); ret = -ENODEV; -- 1.7.10 -- 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: ATSC-MH driver support for the Hauppauge WinTV Aero-m
On Thu, Apr 19, 2012 at 9:36 AM, Mauro Carvalho Chehab mche...@redhat.com wrote: This patch is incomplete: - It doesn't increment the version number; - Docbook is untouched. Also, I didn't see any post of those patches at the ML. Please post the patches at the ML for review before sending a pull request, especially when API changes are there. New pull request and patchbomb follows: The following changes since commit 296da3cd14db9eb5606924962b2956c9c656dbb0: [media] pwc: poll(): Check that the device has not beem claimed for streaming already (2012-03-27 11:42:04 -0300) are available in the git repository at: git://git.linuxtv.org/mkrufky/mxl111sf aero-m Michael Krufky (10): linux-dvb v5 API support for ATSC-MH DocBook: document new DTV Properties for ATSC-MH delivery system increment DVB API to version 5.6 for ATSC-MH frontend control mxl111sf-tuner: tune SYS_ATSCMH just like SYS_ATSC DVB: add support for the LG2160 ATSC-MH demodulator lg2160: update internal api interfaces and enable build dvb-demux: add functionality to send raw payload to the dvr device dvb-usb: add support for dvb-usb-adapters that deliver raw payload dvb-usb: increase MAX_NO_OF_FE_PER_ADAP from 2 to 3 mxl111sf: add ATSC-MH support Documentation/DocBook/media/dvb/dvbproperty.xml | 178 +++ drivers/media/dvb/dvb-core/dvb_demux.c | 10 + drivers/media/dvb/dvb-core/dvb_demux.h |2 + drivers/media/dvb/dvb-core/dvb_frontend.c | 92 ++- drivers/media/dvb/dvb-core/dvb_frontend.h | 22 + drivers/media/dvb/dvb-usb/Kconfig |1 + drivers/media/dvb/dvb-usb/dvb-usb-urb.c | 12 + drivers/media/dvb/dvb-usb/dvb-usb.h |3 +- drivers/media/dvb/dvb-usb/mxl111sf-tuner.c |1 + drivers/media/dvb/dvb-usb/mxl111sf.c| 871 +- drivers/media/dvb/frontends/Kconfig |8 + drivers/media/dvb/frontends/Makefile|1 + drivers/media/dvb/frontends/lg2160.c| 1461 +++ drivers/media/dvb/frontends/lg2160.h| 84 ++ include/linux/dvb/frontend.h| 54 +- include/linux/dvb/version.h |2 +- 16 files changed, 2751 insertions(+), 51 deletions(-) create mode 100644 drivers/media/dvb/frontends/lg2160.c create mode 100644 drivers/media/dvb/frontends/lg2160.h -- 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] via-camera: specify XO-1.5 camera clock speed
On Mon, 30 Apr 2012 23:06:27 +0100 (BST) Daniel Drake d...@laptop.org wrote: For the ov7670 camera to return images at the requested frame rate, it needs to make calculations based on the clock speed, which is a completely external factor (depends on the wiring of the system). On the XO-1.5, which is the only known via-camera user, the camera is clocked at 90MHz. Pass this information to the ov7670 driver, to fix an issue where a framerate of 3x the requested amount was being provided. This is big-time weird...this problem has been solved before. The reason ov7670 *has* a clock speed parameter is because the XO 1.5 - the second user - clocked it so fast. I'm going to have to go digging through some history to try to figure out where this fix went... Meanwhile, this looks fine. Acked-by: Jonathan Corbet cor...@lwn.net jon -- 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] via-camera: specify XO-1.5 camera clock speed
On Mon, Apr 30, 2012 at 5:27 PM, Jonathan Corbet cor...@lwn.net wrote: On Mon, 30 Apr 2012 23:06:27 +0100 (BST) Daniel Drake d...@laptop.org wrote: For the ov7670 camera to return images at the requested frame rate, it needs to make calculations based on the clock speed, which is a completely external factor (depends on the wiring of the system). On the XO-1.5, which is the only known via-camera user, the camera is clocked at 90MHz. Pass this information to the ov7670 driver, to fix an issue where a framerate of 3x the requested amount was being provided. This is big-time weird...this problem has been solved before. The reason ov7670 *has* a clock speed parameter is because the XO 1.5 - the second user - clocked it so fast. I'm going to have to go digging through some history to try to figure out where this fix went... Meanwhile, this looks fine. We solved it with ugly #ifdef things in the OLPC kernel. http://dev.laptop.org/ticket/10137 Then we found and discussed the upstreamable solution, put the ov7670_config thing in place, and solved it for XO-1 (cafe). But for whatever reason it looks like I forgot to fix via-camera -- maybe via-camera was still in flux and non-upstream at that time. Daniel -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 01/10] linux-dvb v5 API support for ATSC-MH
Signed-off-by: Michael Krufky mkru...@linuxtv.org --- drivers/media/dvb/dvb-core/dvb_frontend.c | 92 - drivers/media/dvb/dvb-core/dvb_frontend.h | 22 +++ include/linux/dvb/frontend.h | 54 +- 3 files changed, 166 insertions(+), 2 deletions(-) diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index 4555baa..067f10a 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c @@ -180,13 +180,13 @@ static enum dvbv3_emulation_type dvbv3_type(u32 delivery_system) case SYS_DMBTH: return DVBV3_OFDM; case SYS_ATSC: + case SYS_ATSCMH: case SYS_DVBC_ANNEX_B: return DVBV3_ATSC; case SYS_UNDEFINED: case SYS_ISDBC: case SYS_DVBH: case SYS_DAB: - case SYS_ATSCMH: default: /* * Doesn't know how to emulate those types and/or @@ -1027,6 +1027,28 @@ static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = { _DTV_CMD(DTV_HIERARCHY, 0, 0), _DTV_CMD(DTV_ENUM_DELSYS, 0, 0), + + _DTV_CMD(DTV_ATSCMH_PARADE_ID, 1, 0), + _DTV_CMD(DTV_ATSCMH_RS_FRAME_ENSEMBLE, 1, 0), + + _DTV_CMD(DTV_ATSCMH_FIC_VER, 0, 0), + _DTV_CMD(DTV_ATSCMH_PARADE_ID, 0, 0), + _DTV_CMD(DTV_ATSCMH_NOG, 0, 0), + _DTV_CMD(DTV_ATSCMH_TNOG, 0, 0), + _DTV_CMD(DTV_ATSCMH_SGN, 0, 0), + _DTV_CMD(DTV_ATSCMH_PRC, 0, 0), + _DTV_CMD(DTV_ATSCMH_RS_FRAME_MODE, 0, 0), + _DTV_CMD(DTV_ATSCMH_RS_FRAME_ENSEMBLE, 0, 0), + _DTV_CMD(DTV_ATSCMH_RS_CODE_MODE_PRI, 0, 0), + _DTV_CMD(DTV_ATSCMH_RS_CODE_MODE_SEC, 0, 0), + _DTV_CMD(DTV_ATSCMH_SCCC_BLOCK_MODE, 0, 0), + _DTV_CMD(DTV_ATSCMH_SCCC_CODE_MODE_A, 0, 0), + _DTV_CMD(DTV_ATSCMH_SCCC_CODE_MODE_B, 0, 0), + _DTV_CMD(DTV_ATSCMH_SCCC_CODE_MODE_C, 0, 0), + _DTV_CMD(DTV_ATSCMH_SCCC_CODE_MODE_D, 0, 0), + _DTV_CMD(DTV_ATSCMH_FIC_ERR, 0, 0), + _DTV_CMD(DTV_ATSCMH_CRC_ERR, 0, 0), + _DTV_CMD(DTV_ATSCMH_RS_ERR, 0, 0), }; static void dtv_property_dump(struct dtv_property *tvp) @@ -1118,6 +1140,8 @@ static int dtv_property_cache_sync(struct dvb_frontend *fe, case DVBV3_ATSC: dprintk(%s() Preparing ATSC req\n, __func__); c-modulation = p-u.vsb.modulation; + if (c-delivery_system == SYS_ATSCMH) + break; if ((c-modulation == VSB_8) || (c-modulation == VSB_16)) c-delivery_system = SYS_ATSC; else @@ -1364,6 +1388,63 @@ static int dtv_property_process_get(struct dvb_frontend *fe, case DTV_DVBT2_PLP_ID: tvp-u.data = c-dvbt2_plp_id; break; + + /* ATSC-MH */ + case DTV_ATSCMH_FIC_VER: + tvp-u.data = fe-dtv_property_cache.atscmh_fic_ver; + break; + case DTV_ATSCMH_PARADE_ID: + tvp-u.data = fe-dtv_property_cache.atscmh_parade_id; + break; + case DTV_ATSCMH_NOG: + tvp-u.data = fe-dtv_property_cache.atscmh_nog; + break; + case DTV_ATSCMH_TNOG: + tvp-u.data = fe-dtv_property_cache.atscmh_tnog; + break; + case DTV_ATSCMH_SGN: + tvp-u.data = fe-dtv_property_cache.atscmh_sgn; + break; + case DTV_ATSCMH_PRC: + tvp-u.data = fe-dtv_property_cache.atscmh_prc; + break; + case DTV_ATSCMH_RS_FRAME_MODE: + tvp-u.data = fe-dtv_property_cache.atscmh_rs_frame_mode; + break; + case DTV_ATSCMH_RS_FRAME_ENSEMBLE: + tvp-u.data = fe-dtv_property_cache.atscmh_rs_frame_ensemble; + break; + case DTV_ATSCMH_RS_CODE_MODE_PRI: + tvp-u.data = fe-dtv_property_cache.atscmh_rs_code_mode_pri; + break; + case DTV_ATSCMH_RS_CODE_MODE_SEC: + tvp-u.data = fe-dtv_property_cache.atscmh_rs_code_mode_sec; + break; + case DTV_ATSCMH_SCCC_BLOCK_MODE: + tvp-u.data = fe-dtv_property_cache.atscmh_sccc_block_mode; + break; + case DTV_ATSCMH_SCCC_CODE_MODE_A: + tvp-u.data = fe-dtv_property_cache.atscmh_sccc_code_mode_a; + break; + case DTV_ATSCMH_SCCC_CODE_MODE_B: + tvp-u.data = fe-dtv_property_cache.atscmh_sccc_code_mode_b; + break; + case DTV_ATSCMH_SCCC_CODE_MODE_C: + tvp-u.data = fe-dtv_property_cache.atscmh_sccc_code_mode_c; + break; + case DTV_ATSCMH_SCCC_CODE_MODE_D: + tvp-u.data = fe-dtv_property_cache.atscmh_sccc_code_mode_d; + break; + case DTV_ATSCMH_FIC_ERR: + tvp-u.data = fe-dtv_property_cache.atscmh_fic_err; + break; + case
[PATCH 03/10] increment DVB API to version 5.6 for ATSC-MH frontend control
Signed-off-by: Michael Krufky mkru...@linuxtv.org --- include/linux/dvb/version.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/include/linux/dvb/version.h b/include/linux/dvb/version.h index 0559e2b..43d9e8d 100644 --- a/include/linux/dvb/version.h +++ b/include/linux/dvb/version.h @@ -24,6 +24,6 @@ #define _DVBVERSION_H_ #define DVB_API_VERSION 5 -#define DVB_API_VERSION_MINOR 5 +#define DVB_API_VERSION_MINOR 6 #endif /*_DVBVERSION_H_*/ -- 1.7.5.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 02/10] DocBook: document new DTV Properties for ATSC-MH delivery system
Signed-off-by: Michael Krufky mkru...@linuxtv.org --- Documentation/DocBook/media/dvb/dvbproperty.xml | 178 +++ 1 files changed, 178 insertions(+), 0 deletions(-) diff --git a/Documentation/DocBook/media/dvb/dvbproperty.xml b/Documentation/DocBook/media/dvb/dvbproperty.xml index c7a4ca5..d631535 100644 --- a/Documentation/DocBook/media/dvb/dvbproperty.xml +++ b/Documentation/DocBook/media/dvb/dvbproperty.xml @@ -531,6 +531,154 @@ typedef enum fe_delivery_system { here are referring to what can be found in the TMCC-structure - independent of the mode./para /section + section id=DTV-ATSCMH-FIC-VER + titleconstantDTV_ATSCMH_FIC_VER/constant/title + paraVersion number of the FIC (Fast Information Channel) signaling data./para + paraFIC is used for relaying information to allow rapid service acquisition by the receiver./para + paraPossible values: 0, 1, 2, 3, ..., 30, 31/para + /section + section id=DTV-ATSCMH-PARADE-ID + titleconstantDTV_ATSCMH_PARADE_ID/constant/title + paraParade identification number/para + paraA parade is a collection of up to eight MH groups, conveying one or two ensembles./para + paraPossible values: 0, 1, 2, 3, ..., 126, 127/para + /section + section id=DTV-ATSCMH-NOG + titleconstantDTV_ATSCMH_NOG/constant/title + paraNumber of MH groups per MH subframe for a designated parade./para + paraPossible values: 1, 2, 3, 4, 5, 6, 7, 8/para + /section + section id=DTV-ATSCMH-TNOG + titleconstantDTV_ATSCMH_TNOG/constant/title + paraTotal number of MH groups including all MH groups belonging to all MH parades in one MH subframe./para + paraPossible values: 0, 1, 2, 3, ..., 30, 31/para + /section + section id=DTV-ATSCMH-SGN + titleconstantDTV_ATSCMH_SGN/constant/title + paraStart group number./para + paraPossible values: 0, 1, 2, 3, ..., 14, 15/para + /section + section id=DTV-ATSCMH-PRC + titleconstantDTV_ATSCMH_PRC/constant/title + paraParade repetition cycle./para + paraPossible values: 1, 2, 3, 4, 5, 6, 7, 8/para + /section + section id=DTV-ATSCMH-RS-FRAME-MODE + titleconstantDTV_ATSCMH_RS_FRAME_MODE/constant/title + paraRS frame mode./para + paraPossible values are:/para +programlisting +typedef enum atscmh_rs_frame_mode { + ATSCMH_RSFRAME_PRI_ONLY = 0, + ATSCMH_RSFRAME_PRI_SEC = 1, +} atscmh_rs_frame_mode_t; +/programlisting + /section + section id=DTV-ATSCMH-RS-FRAME-ENSEMBLE + titleconstantDTV_ATSCMH_RS_FRAME_ENSEMBLE/constant/title + paraRS frame ensemble./para + paraPossible values are:/para +programlisting +typedef enum atscmh_rs_frame_ensemble { + ATSCMH_RSFRAME_ENS_PRI = 0, + ATSCMH_RSFRAME_ENS_SEC = 1, +} atscmh_rs_frame_ensemble_t; +/programlisting + /section + section id=DTV-ATSCMH-RS-CODE-MODE-PRI + titleconstantDTV_ATSCMH_RS_CODE_MODE_PRI/constant/title + paraRS code mode (primary)./para + paraPossible values are:/para +programlisting +typedef enum atscmh_rs_code_mode { + ATSCMH_RSCODE_211_187= 0, + ATSCMH_RSCODE_223_187= 1, + ATSCMH_RSCODE_235_187= 2, +} atscmh_rs_code_mode_t; +/programlisting + /section + section id=DTV-ATSCMH-RS-CODE-MODE-SEC + titleconstantDTV_ATSCMH_RS_CODE_MODE_SEC/constant/title + paraRS code mode (secondary)./para + paraPossible values are:/para +programlisting +typedef enum atscmh_rs_code_mode { + ATSCMH_RSCODE_211_187= 0, + ATSCMH_RSCODE_223_187= 1, + ATSCMH_RSCODE_235_187= 2, +} atscmh_rs_code_mode_t; +/programlisting + /section + section id=DTV-ATSCMH-SCCC-BLOCK-MODE + titleconstantDTV_ATSCMH_SCCC_BLOCK_MODE/constant/title + paraSeries Concatenated Convolutional Code Block Mode./para + paraPossible values are:/para +programlisting +typedef enum atscmh_sccc_block_mode { + ATSCMH_SCCC_BLK_SEP = 0, + ATSCMH_SCCC_BLK_COMB = 1, +} atscmh_sccc_block_mode_t; +/programlisting +
[PATCH 06/10] lg2160: update internal api interfaces and enable build
Signed-off-by: Michael Krufky mkru...@linuxtv.org --- drivers/media/dvb/frontends/Kconfig |8 drivers/media/dvb/frontends/lg2160.c | 25 + 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/drivers/media/dvb/frontends/Kconfig b/drivers/media/dvb/frontends/Kconfig index 2124670..09e21c9 100644 --- a/drivers/media/dvb/frontends/Kconfig +++ b/drivers/media/dvb/frontends/Kconfig @@ -531,6 +531,14 @@ config DVB_LGDT3305 An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want to support this frontend. +config DVB_LG2160 + tristate LG Electronics LG216x based + depends on DVB_CORE I2C + default m if DVB_FE_CUSTOMISE + help + An ATSC/MH demodulator module. Say Y when you want + to support this frontend. + config DVB_S5H1409 tristate Samsung S5H1409 based depends on DVB_CORE I2C diff --git a/drivers/media/dvb/frontends/lg2160.c b/drivers/media/dvb/frontends/lg2160.c index 269ab7b..daa8596 100644 --- a/drivers/media/dvb/frontends/lg2160.c +++ b/drivers/media/dvb/frontends/lg2160.c @@ -939,17 +939,15 @@ static int lg216x_read_rs_err_count(struct lg216x_state *state, u16 *err) /* */ -static int lg216x_get_frontend(struct dvb_frontend *fe, - struct dvb_frontend_parameters *param) +static int lg216x_get_frontend(struct dvb_frontend *fe) { struct lg216x_state *state = fe-demodulator_priv; int ret; lg_dbg(\n); - param-u.vsb.modulation = VSB_8; /* FIXME (MH) */ - param-frequency = state-current_frequency; - + fe-dtv_property_cache.modulation = VSB_8; + fe-dtv_property_cache.frequency = state-current_frequency; fe-dtv_property_cache.delivery_system = SYS_ATSCMH; ret = lg216x_get_fic_version(state, @@ -1051,28 +1049,25 @@ fail: static int lg216x_get_property(struct dvb_frontend *fe, struct dtv_property *tvp) { - struct dvb_frontend_parameters param; - return (DTV_ATSCMH_FIC_VER == tvp-cmd) ? - lg216x_get_frontend(fe, param) : 0; + lg216x_get_frontend(fe) : 0; } -static int lg2160_set_frontend(struct dvb_frontend *fe, - struct dvb_frontend_parameters *param) +static int lg2160_set_frontend(struct dvb_frontend *fe) { struct lg216x_state *state = fe-demodulator_priv; int ret; - lg_dbg((%d, %d)\n, param-frequency, param-u.vsb.modulation); + lg_dbg((%d)\n, fe-dtv_property_cache.frequency); if (fe-ops.tuner_ops.set_params) { - ret = fe-ops.tuner_ops.set_params(fe, param); + ret = fe-ops.tuner_ops.set_params(fe); if (fe-ops.i2c_gate_ctrl) fe-ops.i2c_gate_ctrl(fe, 0); if (lg_fail(ret)) goto fail; - state-current_frequency = param-frequency; + state-current_frequency = fe-dtv_property_cache.frequency; } ret = lg2160_agc_fix(state, 0, 0); @@ -1129,7 +1124,7 @@ static int lg2160_set_frontend(struct dvb_frontend *fe, ret = lg216x_enable_fic(state, 1); lg_fail(ret); - lg216x_get_frontend(fe, param); + lg216x_get_frontend(fe); fail: return ret; } @@ -1359,7 +1354,6 @@ static struct dvb_frontend_ops lg2160_ops = { .frequency_min = 5400, .frequency_max = 85800, .frequency_stepsize = 62500, - .caps = FE_CAN_8VSB | FE_HAS_EXTENDED_CAPS /* FIXME (MH) */ }, .i2c_gate_ctrl= lg216x_i2c_gate_ctrl, #if 0 @@ -1389,7 +1383,6 @@ static struct dvb_frontend_ops lg2161_ops = { .frequency_min = 5400, .frequency_max = 85800, .frequency_stepsize = 62500, - .caps = FE_CAN_8VSB | FE_HAS_EXTENDED_CAPS /* FIXME (MH) */ }, .i2c_gate_ctrl= lg216x_i2c_gate_ctrl, #if 0 -- 1.7.5.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 05/10] DVB: add support for the LG2160 ATSC-MH demodulator
Signed-off-by: Michael Krufky mkru...@linuxtv.org --- drivers/media/dvb/frontends/Makefile |1 + drivers/media/dvb/frontends/lg2160.c | 1468 ++ drivers/media/dvb/frontends/lg2160.h | 84 ++ 3 files changed, 1553 insertions(+), 0 deletions(-) create mode 100644 drivers/media/dvb/frontends/lg2160.c create mode 100644 drivers/media/dvb/frontends/lg2160.h diff --git a/drivers/media/dvb/frontends/Makefile b/drivers/media/dvb/frontends/Makefile index 86fa808..f19775d 100644 --- a/drivers/media/dvb/frontends/Makefile +++ b/drivers/media/dvb/frontends/Makefile @@ -50,6 +50,7 @@ obj-$(CONFIG_DVB_BCM3510) += bcm3510.o obj-$(CONFIG_DVB_S5H1420) += s5h1420.o obj-$(CONFIG_DVB_LGDT330X) += lgdt330x.o obj-$(CONFIG_DVB_LGDT3305) += lgdt3305.o +obj-$(CONFIG_DVB_LG2160) += lg2160.o obj-$(CONFIG_DVB_CX24123) += cx24123.o obj-$(CONFIG_DVB_LNBP21) += lnbp21.o obj-$(CONFIG_DVB_LNBP22) += lnbp22.o diff --git a/drivers/media/dvb/frontends/lg2160.c b/drivers/media/dvb/frontends/lg2160.c new file mode 100644 index 000..269ab7b --- /dev/null +++ b/drivers/media/dvb/frontends/lg2160.c @@ -0,0 +1,1468 @@ +/* + *Support for LG2160 - ATSC/MH + * + *Copyright (C) 2010 Michael Krufky mkru...@linuxtv.org + * + *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 linux/jiffies.h +#include linux/dvb/frontend.h +#include lg2160.h + +static int debug; +module_param(debug, int, 0644); +MODULE_PARM_DESC(debug, set debug level (info=1, reg=2 (or-able))); + +#define DBG_INFO 1 +#define DBG_REG 2 + +#define lg_printk(kern, fmt, arg...) \ + printk(kern %s: fmt, __func__, ##arg) + +#define lg_info(fmt, arg...) printk(KERN_INFO lg2160: fmt, ##arg) +#define lg_warn(fmt, arg...) lg_printk(KERN_WARNING, fmt, ##arg) +#define lg_err(fmt, arg...)lg_printk(KERN_ERR, fmt, ##arg) +#define lg_dbg(fmt, arg...) if (debug DBG_INFO) \ + lg_printk(KERN_DEBUG, fmt, ##arg) +#define lg_reg(fmt, arg...) if (debug DBG_REG) \ + lg_printk(KERN_DEBUG, fmt, ##arg) + +#define lg_fail(ret) \ +({ \ + int __ret; \ + __ret = (ret 0); \ + if (__ret) \ + lg_err(error %d on line %d\n, ret, __LINE__); \ + __ret; \ +}) + +struct lg216x_state { + struct i2c_adapter *i2c_adap; + const struct lg2160_config *cfg; + + struct dvb_frontend frontend; + + u32 current_frequency; + u8 parade_id; + u8 fic_ver; + unsigned int last_reset; +}; + +/* */ + +static int lg216x_write_reg(struct lg216x_state *state, u16 reg, u8 val) +{ + int ret; + u8 buf[] = { reg 8, reg 0xff, val }; + struct i2c_msg msg = { + .addr = state-cfg-i2c_addr, .flags = 0, + .buf = buf, .len = 3, + }; + + lg_reg(reg: 0x%04x, val: 0x%02x\n, reg, val); + + ret = i2c_transfer(state-i2c_adap, msg, 1); + + if (ret != 1) { + lg_err(error (addr %02x %02x - %02x, err = %i)\n, + msg.buf[0], msg.buf[1], msg.buf[2], ret); + if (ret 0) + return ret; + else + return -EREMOTEIO; + } + return 0; +} + +static int lg216x_read_reg(struct lg216x_state *state, u16 reg, u8 *val) +{ + int ret; + u8 reg_buf[] = { reg 8, reg 0xff }; + struct i2c_msg msg[] = { + { .addr = state-cfg-i2c_addr, + .flags = 0, .buf = reg_buf, .len = 2 }, + { .addr = state-cfg-i2c_addr, + .flags = I2C_M_RD, .buf = val, .len = 1 }, + }; + + lg_reg(reg: 0x%04x\n, reg); + + ret = i2c_transfer(state-i2c_adap, msg, 2); + + if (ret != 2) { + lg_err(error
[PATCH 08/10] dvb-usb: add support for dvb-usb-adapters that deliver raw payload
From: Michael Krufky mkru...@kernellabs.com Select this feature setting the dvb-usb-adapter caps field with DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD Signed-off-by: Michael Krufky mkru...@linuxtv.org --- drivers/media/dvb/dvb-usb/dvb-usb-urb.c | 12 drivers/media/dvb/dvb-usb/dvb-usb.h |1 + 2 files changed, 13 insertions(+), 0 deletions(-) diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-urb.c b/drivers/media/dvb/dvb-usb/dvb-usb-urb.c index 53a5c30..5c8f651 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-urb.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-urb.c @@ -80,6 +80,14 @@ static void dvb_usb_data_complete_204(struct usb_data_stream *stream, u8 *buffer dvb_dmx_swfilter_204(adap-demux, buffer, length); } +static void dvb_usb_data_complete_raw(struct usb_data_stream *stream, + u8 *buffer, size_t length) +{ + struct dvb_usb_adapter *adap = stream-user_priv; + if (adap-feedcount 0 adap-state DVB_USB_ADAP_STATE_DVB) + dvb_dmx_swfilter_raw(adap-demux, buffer, length); +} + int dvb_usb_adapter_stream_init(struct dvb_usb_adapter *adap) { int i, ret = 0; @@ -90,6 +98,10 @@ int dvb_usb_adapter_stream_init(struct dvb_usb_adapter *adap) adap-fe_adap[i].stream.complete = dvb_usb_data_complete_204; else + if (adap-props.fe[i].caps DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD) + adap-fe_adap[i].stream.complete = + dvb_usb_data_complete_raw; + else adap-fe_adap[i].stream.complete = dvb_usb_data_complete; adap-fe_adap[i].stream.user_priv = adap; ret = usb_urb_init(adap-fe_adap[i].stream, diff --git a/drivers/media/dvb/dvb-usb/dvb-usb.h b/drivers/media/dvb/dvb-usb/dvb-usb.h index 6d7d13f..86cfa86 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb.h @@ -141,6 +141,7 @@ struct dvb_usb_adapter_fe_properties { #define DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF 0x02 #define DVB_USB_ADAP_NEED_PID_FILTERING 0x04 #define DVB_USB_ADAP_RECEIVES_204_BYTE_TS 0x08 +#define DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD 0x10 int caps; int pid_filter_count; -- 1.7.5.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 09/10] dvb-usb: increase MAX_NO_OF_FE_PER_ADAP from 2 to 3
Signed-off-by: Michael Krufky mkru...@linuxtv.org --- drivers/media/dvb/dvb-usb/dvb-usb.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/media/dvb/dvb-usb/dvb-usb.h b/drivers/media/dvb/dvb-usb/dvb-usb.h index 86cfa86..99f9440 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb.h @@ -157,7 +157,7 @@ struct dvb_usb_adapter_fe_properties { int size_of_priv; }; -#define MAX_NO_OF_FE_PER_ADAP 2 +#define MAX_NO_OF_FE_PER_ADAP 3 struct dvb_usb_adapter_properties { int size_of_priv; -- 1.7.5.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 10/10] mxl111sf: add ATSC-MH support
Signed-off-by: Michael Krufky mkru...@linuxtv.org --- drivers/media/dvb/dvb-usb/Kconfig|1 + drivers/media/dvb/dvb-usb/mxl111sf.c | 871 -- 2 files changed, 825 insertions(+), 47 deletions(-) diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig index 63bf456..3164273 100644 --- a/drivers/media/dvb/dvb-usb/Kconfig +++ b/drivers/media/dvb/dvb-usb/Kconfig @@ -409,6 +409,7 @@ config DVB_USB_MXL111SF tristate MxL111SF DTV USB2.0 support depends on DVB_USB select DVB_LGDT3305 if !DVB_FE_CUSTOMISE + select DVB_LG2160 if !DVB_FE_CUSTOMISE select VIDEO_TVEEPROM help Say Y here to support the MxL111SF USB2.0 DTV receiver. diff --git a/drivers/media/dvb/dvb-usb/mxl111sf.c b/drivers/media/dvb/dvb-usb/mxl111sf.c index 81305de..c518e86 100644 --- a/drivers/media/dvb/dvb-usb/mxl111sf.c +++ b/drivers/media/dvb/dvb-usb/mxl111sf.c @@ -21,6 +21,7 @@ #include mxl111sf-tuner.h #include lgdt3305.h +#include lg2160.h int dvb_usb_mxl111sf_debug; module_param_named(debug, dvb_usb_mxl111sf_debug, int, 0644); @@ -31,6 +32,10 @@ int dvb_usb_mxl111sf_isoc; module_param_named(isoc, dvb_usb_mxl111sf_isoc, int, 0644); MODULE_PARM_DESC(isoc, enable usb isoc xfer (0=bulk, 1=isoc).); +int dvb_usb_mxl111sf_spi; +module_param_named(spi, dvb_usb_mxl111sf_spi, int, 0644); +MODULE_PARM_DESC(spi, use spi rather than tp for data xfer (0=tp, 1=spi).); + #define ANT_PATH_AUTO 0 #define ANT_PATH_EXTERNAL 1 #define ANT_PATH_INTERNAL 2 @@ -361,6 +366,33 @@ static int mxl111sf_ep6_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) return ret; } +static int mxl111sf_ep5_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) +{ + struct dvb_usb_device *d = adap-dev; + struct mxl111sf_state *state = d-priv; + int ret = 0; + + deb_info(%s(%d)\n, __func__, onoff); + + if (onoff) { + ret = mxl111sf_enable_usb_output(state); + mxl_fail(ret); + + ret = mxl111sf_init_i2s_port(state, 200); + mxl_fail(ret); + ret = mxl111sf_config_i2s(state, 0, 15); + mxl_fail(ret); + } else { + ret = mxl111sf_disable_i2s_port(state); + mxl_fail(ret); + } + if (state-chip_rev MXL111SF_V6) + ret = mxl111sf_config_spi(state, onoff); + mxl_fail(ret); + + return ret; +} + static int mxl111sf_ep4_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) { struct dvb_usb_device *d = adap-dev; @@ -453,6 +485,255 @@ fail: return ret; } +static struct lg2160_config hauppauge_lg2160_config = { + .lg_chip= LG2160, + .i2c_addr = 0x1c 1, + .deny_i2c_rptr = 1, + .spectral_inversion = 0, + .if_khz = 6000, +}; + +static int mxl111sf_lg2160_frontend_attach(struct dvb_usb_adapter *adap) +{ + struct dvb_usb_device *d = adap-dev; + struct mxl111sf_state *state = d-priv; + int fe_id = adap-num_frontends_initialized; + struct mxl111sf_adap_state *adap_state = adap-fe_adap[fe_id].priv; + int ret; + + deb_adv(%s()\n, __func__); + + /* save a pointer to the dvb_usb_device in device state */ + state-d = d; + adap_state-alt_mode = (dvb_usb_mxl111sf_isoc) ? 2 : 1; + state-alt_mode = adap_state-alt_mode; + + if (usb_set_interface(adap-dev-udev, 0, state-alt_mode) 0) + err(set interface failed); + + state-gpio_mode = MXL111SF_GPIO_MOD_MH; + adap_state-gpio_mode = state-gpio_mode; + adap_state-device_mode = MXL_TUNER_MODE; + adap_state-ep6_clockphase = 1; + + ret = mxl1x1sf_soft_reset(state); + if (mxl_fail(ret)) + goto fail; + ret = mxl111sf_init_tuner_demod(state); + if (mxl_fail(ret)) + goto fail; + + ret = mxl1x1sf_set_device_mode(state, adap_state-device_mode); + if (mxl_fail(ret)) + goto fail; + + ret = mxl111sf_enable_usb_output(state); + if (mxl_fail(ret)) + goto fail; + ret = mxl1x1sf_top_master_ctrl(state, 1); + if (mxl_fail(ret)) + goto fail; + + ret = mxl111sf_init_port_expander(state); + if (mxl_fail(ret)) + goto fail; + ret = mxl111sf_gpio_mode_switch(state, state-gpio_mode); + if (mxl_fail(ret)) + goto fail; + + ret = get_chip_info(state); + if (mxl_fail(ret)) + goto fail; + + adap-fe_adap[fe_id].fe = dvb_attach(lg2160_attach, + hauppauge_lg2160_config, + adap-dev-i2c_adap); + if (adap-fe_adap[fe_id].fe) { + adap_state-fe_init = adap-fe_adap[fe_id].fe-ops.init; + adap-fe_adap[fe_id].fe-ops.init = mxl111sf_adap_fe_init; + adap_state-fe_sleep =
[PATCH 07/10] dvb-demux: add functionality to send raw payload to the dvr device
From: Michael Krufky mkru...@kernellabs.com If your driver needs to deliver the raw payload to userspace without passing through the kernel demux, use function: dvb_dmx_swfilter_raw Signed-off-by: Michael Krufky mkru...@linuxtv.org --- drivers/media/dvb/dvb-core/dvb_demux.c | 10 ++ drivers/media/dvb/dvb-core/dvb_demux.h |2 ++ 2 files changed, 12 insertions(+), 0 deletions(-) diff --git a/drivers/media/dvb/dvb-core/dvb_demux.c b/drivers/media/dvb/dvb-core/dvb_demux.c index faa3671..d82469f 100644 --- a/drivers/media/dvb/dvb-core/dvb_demux.c +++ b/drivers/media/dvb/dvb-core/dvb_demux.c @@ -568,6 +568,16 @@ void dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf, size_t count) } EXPORT_SYMBOL(dvb_dmx_swfilter_204); +void dvb_dmx_swfilter_raw(struct dvb_demux *demux, const u8 *buf, size_t count) +{ + spin_lock(demux-lock); + + demux-feed-cb.ts(buf, count, NULL, 0, demux-feed-feed.ts, DMX_OK); + + spin_unlock(demux-lock); +} +EXPORT_SYMBOL(dvb_dmx_swfilter_raw); + static struct dvb_demux_filter *dvb_dmx_filter_alloc(struct dvb_demux *demux) { int i; diff --git a/drivers/media/dvb/dvb-core/dvb_demux.h b/drivers/media/dvb/dvb-core/dvb_demux.h index a7d876f..fa7188a 100644 --- a/drivers/media/dvb/dvb-core/dvb_demux.h +++ b/drivers/media/dvb/dvb-core/dvb_demux.h @@ -145,5 +145,7 @@ void dvb_dmx_swfilter_packets(struct dvb_demux *dvbdmx, const u8 *buf, void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count); void dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf, size_t count); +void dvb_dmx_swfilter_raw(struct dvb_demux *demux, const u8 *buf, + size_t count); #endif /* _DVB_DEMUX_H_ */ -- 1.7.5.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 04/10] mxl111sf-tuner: tune SYS_ATSCMH just like SYS_ATSC
Signed-off-by: Michael Krufky mkru...@linuxtv.org --- drivers/media/dvb/dvb-usb/mxl111sf-tuner.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/drivers/media/dvb/dvb-usb/mxl111sf-tuner.c b/drivers/media/dvb/dvb-usb/mxl111sf-tuner.c index 72db6ee..74da5bb1 100644 --- a/drivers/media/dvb/dvb-usb/mxl111sf-tuner.c +++ b/drivers/media/dvb/dvb-usb/mxl111sf-tuner.c @@ -284,6 +284,7 @@ static int mxl111sf_tuner_set_params(struct dvb_frontend *fe) switch (delsys) { case SYS_ATSC: + case SYS_ATSCMH: bw = 0; /* ATSC */ break; case SYS_DVBC_ANNEX_B: -- 1.7.5.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html