Re: [REVIEW PATCH v3 1/2] media: Change media device link_notify behaviour
Hi Sylwester, Should I take the series in my tree, or would you like to push it yourself to avoid conflicts with other Exynos patches ? On Monday 10 June 2013 01:10:30 Sakari Ailus wrote: Hi Sylwester, Thanks for the update. Sylwester Nawrocki wrote: ... diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c index 1d7dbd5..1a2d25c 100644 --- a/drivers/media/platform/omap3isp/isp.c +++ b/drivers/media/platform/omap3isp/isp.c @@ -792,9 +792,9 @@ int omap3isp_pipeline_pm_use(struct media_entity *entity, int use) /* * isp_pipeline_link_notify - Link management notification callback - * @source: Pad at the start of the link - * @sink: Pad at the end of the link + * @link: The link * @flags: New link flags that will be applied + * @notification: The link's state change notification type (MEDIA_DEV_NOTIFY_*) * * React to link management on powered pipelines by updating the use count of * all entities in the source and sink sides of the link. Entities are powered @@ -804,29 +804,38 @@ int omap3isp_pipeline_pm_use(struct media_entity *entity, int use) * off is assumed to never fail. This function will not fail for disconnection * events. */ -static int isp_pipeline_link_notify(struct media_pad *source, - struct media_pad *sink, u32 flags) +static int isp_pipeline_link_notify(struct media_link *link, u32 flags, + unsigned int notification) { - int source_use = isp_pipeline_pm_use_count(source-entity); - int sink_use = isp_pipeline_pm_use_count(sink-entity); + struct media_entity *source = link-source-entity; + struct media_entity *sink = link-sink-entity; + int source_use = isp_pipeline_pm_use_count(source); + int sink_use = isp_pipeline_pm_use_count(sink); int ret; - if (!(flags MEDIA_LNK_FL_ENABLED)) { + if (notification == MEDIA_DEV_NOTIFY_POST_LINK_CH + !(link-flags MEDIA_LNK_FL_ENABLED)) { /* Powering off entities is assumed to never fail. */ - isp_pipeline_pm_power(source-entity, -sink_use); - isp_pipeline_pm_power(sink-entity, -source_use); + isp_pipeline_pm_power(source, -sink_use); + isp_pipeline_pm_power(sink, -source_use); return 0; } - ret = isp_pipeline_pm_power(source-entity, sink_use); - if (ret 0) - return ret; + if (notification == MEDIA_DEV_NOTIFY_PRE_LINK_CH + (flags MEDIA_LNK_FL_ENABLED)) { You could return zero here if the opposite was true, and unindent the rest. Up to you --- the patch is fine. Acked-by: Sakari Ailus sakari.ai...@iki.fi - ret = isp_pipeline_pm_power(sink-entity, source_use); - if (ret 0) - isp_pipeline_pm_power(source-entity, -sink_use); + ret = isp_pipeline_pm_power(source, sink_use); + if (ret 0) + return ret; - return ret; + ret = isp_pipeline_pm_power(sink, source_use); + if (ret 0) + isp_pipeline_pm_power(source, -sink_use); + + return ret; + } + + return 0; } /* --- -- -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] mt9p031: Use bulk regulator API
Hi Fabio, On Saturday 08 June 2013 10:20:42 Fabio Estevam wrote: On Sat, Jun 8, 2013 at 4:55 AM, Laurent Pinchart wrote: - if (IS_ERR(mt9p031-vaa) || IS_ERR(mt9p031-vdd) || - IS_ERR(mt9p031-vdd_io)) { + ret = devm_regulator_bulk_get(client-dev, 3, mt9p031-regulators); + if (ret 0) { dev_err(client-dev, Unable to get regulators\n); return -ENODEV; You should do a 'return ret' here instead. Good point, I'll fix that. -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] mt9p031: Use bulk regulator API
Hi Fabio, On Saturday 08 June 2013 10:24:58 Fabio Estevam wrote: On Sat, Jun 8, 2013 at 10:20 AM, Fabio Estevam wrote: On Sat, Jun 8, 2013 at 4:55 AM, Laurent Pinchart wrote: - if (IS_ERR(mt9p031-vaa) || IS_ERR(mt9p031-vdd) || - IS_ERR(mt9p031-vdd_io)) { + ret = devm_regulator_bulk_get(client-dev, 3, mt9p031-regulators); and you could use ARRAY_SIZE(mt9p031-regulators) instead of the hardcoded '3'. Right, but on the other hand I initialize the regulators array right before using hard-coded indices, so it doesn't matter much in this case. -- 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] mt9p031: Use bulk regulator API
The sensor is powered by three supplies. Use the bulk regulator API to enable and disable them instead of performing the operations manually. This fixes a warning caused by ignoring the return value of regulator_enable(). Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/i2c/mt9p031.c | 30 +++--- 1 file changed, 15 insertions(+), 15 deletions(-) Changes since v1: - Return the devm_regulator_bulk_get() return code instead of -ENODEV diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c index 6187416..c93640b 100644 --- a/drivers/media/i2c/mt9p031.c +++ b/drivers/media/i2c/mt9p031.c @@ -126,9 +126,7 @@ struct mt9p031 { int power_count; struct clk *clk; - struct regulator *vaa; - struct regulator *vdd; - struct regulator *vdd_io; + struct regulator_bulk_data regulators[3]; enum mt9p031_model model; struct aptina_pll pll; @@ -273,6 +271,8 @@ static inline int mt9p031_pll_disable(struct mt9p031 *mt9p031) static int mt9p031_power_on(struct mt9p031 *mt9p031) { + int ret; + /* Ensure RESET_BAR is low */ if (gpio_is_valid(mt9p031-reset)) { gpio_set_value(mt9p031-reset, 0); @@ -280,9 +280,10 @@ static int mt9p031_power_on(struct mt9p031 *mt9p031) } /* Bring up the supplies */ - regulator_enable(mt9p031-vdd); - regulator_enable(mt9p031-vdd_io); - regulator_enable(mt9p031-vaa); + ret = regulator_bulk_enable(ARRAY_SIZE(mt9p031-regulators), + mt9p031-regulators); + if (ret 0) + return ret; /* Emable clock */ if (mt9p031-clk) @@ -304,9 +305,8 @@ static void mt9p031_power_off(struct mt9p031 *mt9p031) usleep_range(1000, 2000); } - regulator_disable(mt9p031-vaa); - regulator_disable(mt9p031-vdd_io); - regulator_disable(mt9p031-vdd); + regulator_bulk_disable(ARRAY_SIZE(mt9p031-regulators), + mt9p031-regulators); if (mt9p031-clk) clk_disable_unprepare(mt9p031-clk); @@ -986,14 +986,14 @@ static int mt9p031_probe(struct i2c_client *client, mt9p031-model = did-driver_data; mt9p031-reset = -1; - mt9p031-vaa = devm_regulator_get(client-dev, vaa); - mt9p031-vdd = devm_regulator_get(client-dev, vdd); - mt9p031-vdd_io = devm_regulator_get(client-dev, vdd_io); + mt9p031-regulators[0].supply = vdd; + mt9p031-regulators[1].supply = vdd_io; + mt9p031-regulators[2].supply = vaa; - if (IS_ERR(mt9p031-vaa) || IS_ERR(mt9p031-vdd) || - IS_ERR(mt9p031-vdd_io)) { + ret = devm_regulator_bulk_get(client-dev, 3, mt9p031-regulators); + if (ret 0) { dev_err(client-dev, Unable to get regulators\n); - return -ENODEV; + return ret; } v4l2_ctrl_handler_init(mt9p031-ctrls, ARRAY_SIZE(mt9p031_ctrls) + 6); -- 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
[GIT PULL FOR v3.11] Updates for 3.11
Besides various fixes and two new drivers (ths8200, ML86V7667) this merges also some long patch series of mine: Control framework conversions: http://www.mail-archive.com/linux-media@vger.kernel.org/msg62772.html QUERYSTD fixes (particularly in the case of 'no signal'): http://www.spinics.net/lists/linux-media/msg64131.html DBG_G_CHIP_IDENT removal: http://www.spinics.net/lists/linux-media/msg64081.html Note: patches 7, 13, 20-23, 25 and 36 are kept back. There is a pending cx88 fix for 3.10 (http://git.linuxtv.org/media_tree.git/commit/609c4c12af79b1ba5fd2d31727a95dd3a319c0ae) that conflicts with this patch series, so once that fix is merged back from 3.10 I can finalize this patch series. Removal of current_norm: http://www.mail-archive.com/linux-media@vger.kernel.org/msg62914.html Note: patch 5 was dropped. It was 1) broken, and 2) not related to current_norm anyway. A fixed version will be posted separately. saa7134 cleanup: http://www.mail-archive.com/linux-media@vger.kernel.org/msg62863.html Regards, Hans The following changes since commit ab5060cdb8829c0503b7be2b239b52e9a25063b4: [media] drxk_hard: Remove most 80-cols checkpatch warnings (2013-06-08 22:11:39 -0300) are available in the git repository at: git://linuxtv.org/hverkuil/media_tree.git for-v3.11 for you to fetch changes up to 569160288c5ec9c1a615325ecb5bac265705: ths8200: fix two compiler warnings (2013-06-10 11:57:19 +0200) Antti Palosaari (1): radio-keene: add delay in order to settle hardware Hans Verkuil (101): mxl111sf: don't redefine pr_err/info/debug hdpvr: fix querystd 'unknown format' return. hdpvr: code cleanup hdpvr: improve error handling ml86v7667: fix the querystd implementation radio-keene: set initial frequency. v4l2-ioctl: dbg_g/s_register: only match BRIDGE and SUBDEV types. v4l2: remove g_chip_ident from bridge drivers where it is easy to do so. cx18: remove g_chip_ident support. saa7115: add back the dropped 'found' message. ivtv: remove g_chip_ident cx23885: remove g_chip_ident. saa6752hs: drop obsolete g_chip_ident. gspca: remove g_chip_ident cx231xx: remove g_chip_ident. marvell-ccic: remove g_chip_ident. tveeprom: remove v4l2-chip-ident.h include. au8522_decoder: remove g_chip_ident op. radio: remove g_chip_ident op. indycam: remove g_chip_ident op. soc_camera sensors: remove g_chip_ident op. media/i2c: remove g_chip_ident op. cx25840: remove the v4l2-chip-ident.h include saa7134: check register address in g_register. mxb: check register address when reading/writing a register. vpbe_display: drop g/s_register ioctls. marvell-ccic: check register address. au0828: set reg-size. cx231xx: the reg-size field wasn't filled in. sn9c20x: the reg-size field wasn't filled in. pvrusb2: drop g/s_register ioctls. media/i2c: fill in missing reg-size fields. cx18: fix register range check ivtv: fix register range check DocBook/media/v4l: update VIDIOC_DBG_ documentation v4l2-framework: replace g_chip_ident by g_std in the examples. saa7706h: convert to the control framework. sr030pc30: convert to the control framework. saa6752hs: convert to the control framework. radio-tea5764: add support for struct v4l2_device. radio-tea5764: embed struct video_device. radio-tea5764: convert to the control framework. radio-tea5764: audio and input ioctls do not apply to radio devices. radio-tea5764: add device_caps support. radio-tea5764: add prio and control event support. radio-tea5764: some cleanups and clamp frequency when out-of-range radio-timb: add device_caps support, remove input/audio ioctls. radio-timb: convert to the control framework. radio-timb: actually load the requested subdevs radio-timb: add control events and prio support. tef6862: clamp frequency. timblogiw: fix querycap. radio-sf16fmi: remove audio/input ioctls. radio-sf16fmi: add device_caps support to querycap. radio-sf16fmi: clamp frequency. radio-sf16fmi: convert to the control framework. radio-sf16fmi: add control event and prio support. mcam-core: replace current_norm by g_std. via-camera: replace current_norm by g_std. sh_vou: remove current_norm soc_camera: remove use of current_norm. fsl-viu: remove current_norm. tm6000: remove deprecated current_norm saa7164: replace current_norm by g_std cx23885: remove use of deprecated current_norm usbvision: replace current_norm by g_std. saa7134: drop deprecated current_norm. dt3155v4l: remove deprecated current_norm v4l2: remove deprecated current_norm support completely. adv7183: fix querystd bt819:
[GIT PULL FOR v3.11] OMAP3 ISP patches
Hi Mauro, This should be the last set of OMAP3 ISP patches for v3.11. The following changes since commit ab5060cdb8829c0503b7be2b239b52e9a25063b4: [media] drxk_hard: Remove most 80-cols checkpatch warnings (2013-06-08 22:11:39 -0300) are available in the git repository at: git://linuxtv.org/pinchartl/media.git omap3isp/next for you to fetch changes up to f25d34ca08fa4401f228d9b70e751fcadec5c577: omap3isp: ccp2: Don't ignore the regulator_enable() return value (2013-06-10 11:53:49 +0200) Arnd Bergmann (1): omap3isp: include linux/mm_types.h Laurent Pinchart (2): omap3isp: Defer probe when the IOMMU is not available omap3isp: ccp2: Don't ignore the regulator_enable() return value Sachin Kamat (1): omap3isp: Remove redundant platform_set_drvdata() drivers/media/platform/omap3isp/isp.c | 4 ++-- drivers/media/platform/omap3isp/ispccp2.c | 19 +++ drivers/media/platform/omap3isp/ispqueue.h | 1 + 3 files changed, 18 insertions(+), 6 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
[GIT PULL FOR v3.11] media core fix
Hi Mauro, Here's a small fix for the media controller core, targetted at v3.11. The following changes since commit ab5060cdb8829c0503b7be2b239b52e9a25063b4: [media] drxk_hard: Remove most 80-cols checkpatch warnings (2013-06-08 22:11:39 -0300) are available in the git repository at: git://linuxtv.org/pinchartl/media.git v4l2/media for you to fetch changes up to 64efe52d0a6df07867109c868dc51ba081ab5fed: media: info leak in __media_device_enum_links() (2013-06-10 12:05:07 +0200) Dan Carpenter (1): media: info leak in __media_device_enum_links() drivers/media/media-device.c | 3 +++ 1 file changed, 3 insertions(+) -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch] [media] media: info leak in __media_device_enum_links()
Hi Dan, On Friday 31 May 2013 15:24:45 Dan Carpenter wrote: Ping? Oops, sorry for having missed the patch. On Sat, Apr 13, 2013 at 12:32:15PM +0300, Dan Carpenter wrote: These structs have holes and reserved struct members which aren't cleared. I've added a memset() so we don't leak stack information. Signed-off-by: Dan Carpenter dan.carpen...@oracle.com Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com I've taken the patch in my tree, Added a CC: sta...@vger.kernel.org and issued a pull request. diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c index 99b80b6..450c0d1 100644 --- a/drivers/media/media-device.c +++ b/drivers/media/media-device.c @@ -139,6 +139,8 @@ static long __media_device_enum_links(struct media_device *mdev, for (p = 0; p entity-num_pads; p++) { struct media_pad_desc pad; + + memset(pad, 0, sizeof(pad)); media_device_kpad_to_upad(entity-pads[p], pad); if (copy_to_user(links-pads[p], pad, sizeof(pad))) return -EFAULT; @@ -156,6 +158,7 @@ static long __media_device_enum_links(struct media_device *mdev, if (entity-links[l].source-entity != entity) continue; + memset(link, 0, sizeof(link)); media_device_kpad_to_upad(entity-links[l].source, link.source); media_device_kpad_to_upad(entity-links[l].sink, -- 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] [media] usbtv: Add driver for Fushicai USBTV007 video frame grabber
Reverse-engineered driver for cheapo video digitizer, made from observations of Windows XP driver. The protocol is not yet completely understood, so far we don't provide any controls, only support a single format out of three and don't support the audio device. Signed-off-by: Lubomir Rintel lkund...@v3.sk Cc: Mauro Carvalho Chehab mche...@redhat.com Cc: linux-ker...@vger.kernel.org Cc: linux-media@vger.kernel.org --- Hi everyone, this is my first experience with v4l2, videobuf2, usb and a video video hardware. Therefore, please be careful reviewing this as I could have made mistakes that are not likely to happen for more experienced people. I've not figured out the controls for the hardware yet, thus the huge set of unidentified register settings. I've been very unsuccessfully struggling with my Windows installation (the Windows driver for hardware was not usable enough with any other player than the cranky one shipped with it, crashing and deadlocking quite often). It seems quite possible to create a simpler directshow app that would just set the controls; and I plan to do that as time permits. Also, I the hardware uses V4L2_FIELD_ALTERNATE interlacing, but I couldn't make it work, so I'm doing deinterlacing in the driver, which is obviously not the right thing to do. Could anyone educate me on proper way of dealing with data interlaced this way? I could not find a decent example, and I'm not even sure what the sizes in format specification are (like, is the height after or before deinterlacing?). Thanks a lot! Lubo drivers/media/usb/Kconfig|1 + drivers/media/usb/Makefile |1 + drivers/media/usb/usbtv/Kconfig | 10 + drivers/media/usb/usbtv/Makefile |1 + drivers/media/usb/usbtv/usbtv.c | 723 ++ 5 files changed, 736 insertions(+), 0 deletions(-) create mode 100644 drivers/media/usb/usbtv/Kconfig create mode 100644 drivers/media/usb/usbtv/Makefile create mode 100644 drivers/media/usb/usbtv/usbtv.c diff --git a/drivers/media/usb/Kconfig b/drivers/media/usb/Kconfig index 0a7d520..8e10267 100644 --- a/drivers/media/usb/Kconfig +++ b/drivers/media/usb/Kconfig @@ -17,6 +17,7 @@ source drivers/media/usb/zr364xx/Kconfig source drivers/media/usb/stkwebcam/Kconfig source drivers/media/usb/s2255/Kconfig source drivers/media/usb/sn9c102/Kconfig +source drivers/media/usb/usbtv/Kconfig endif if MEDIA_ANALOG_TV_SUPPORT diff --git a/drivers/media/usb/Makefile b/drivers/media/usb/Makefile index 7f51d7e..0935f47 100644 --- a/drivers/media/usb/Makefile +++ b/drivers/media/usb/Makefile @@ -20,3 +20,4 @@ obj-$(CONFIG_VIDEO_STK1160) += stk1160/ obj-$(CONFIG_VIDEO_CX231XX) += cx231xx/ obj-$(CONFIG_VIDEO_TM6000) += tm6000/ obj-$(CONFIG_VIDEO_EM28XX) += em28xx/ +obj-$(CONFIG_VIDEO_USBTV) += usbtv/ diff --git a/drivers/media/usb/usbtv/Kconfig b/drivers/media/usb/usbtv/Kconfig new file mode 100644 index 000..8864436 --- /dev/null +++ b/drivers/media/usb/usbtv/Kconfig @@ -0,0 +1,10 @@ +config VIDEO_USBTV +tristate USBTV007 video capture support +depends on VIDEO_DEV +select VIDEOBUF2_VMALLOC + +---help--- + This is a video4linux2 driver for USBTV007 based video capture devices. + + To compile this driver as a module, choose M here: the + module will be called usbtv diff --git a/drivers/media/usb/usbtv/Makefile b/drivers/media/usb/usbtv/Makefile new file mode 100644 index 000..28b872f --- /dev/null +++ b/drivers/media/usb/usbtv/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_VIDEO_USBTV) += usbtv.o diff --git a/drivers/media/usb/usbtv/usbtv.c b/drivers/media/usb/usbtv/usbtv.c new file mode 100644 index 000..d165cb1 --- /dev/null +++ b/drivers/media/usb/usbtv/usbtv.c @@ -0,0 +1,723 @@ +/* + * Fushicai USBTV007 Video Grabber Driver + * + * Product web site: + * http://www.fushicai.com/products_detail/productId=d05449ee-b690-42f9-a661-aa7353894bed.html + * + * Following LWN articles were very useful in construction of this driver: + * Video4Linux2 API series: http://lwn.net/Articles/203924/ + * videobuf2 API explanation: http://lwn.net/Articles/447435/ + * Thanks go to Jonathan Corbet for providing this quality documentation. + * He is awesome. + * + * Copyright (c) 2013 Lubomir Rintel + * All rights reserved. + * No physical hadrware was harmed running Windows during the + * reverse-engineering activity + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions, and the following disclaimer, + *without modification. + * 2. The name of the author may not be used to endorse or promote products + *derived from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License
Re: [REVIEW PATCH v3 1/2] media: Change media device link_notify behaviour
Hi Laurent, On 06/10/2013 11:46 AM, Laurent Pinchart wrote: Hi Sylwester, Should I take the series in my tree, or would you like to push it yourself to avoid conflicts with other Exynos patches ? My plan was to handle this series together with the other Exynos patches it depends on. I would send a pull request today. I guess there would be the least conflicts this way. Sorry about embedding this core patch in my series. 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: [REVIEW PATCH v3 1/2] media: Change media device link_notify behaviour
On Monday 10 June 2013 12:20:15 Sylwester Nawrocki wrote: On 06/10/2013 11:46 AM, Laurent Pinchart wrote: Hi Sylwester, Should I take the series in my tree, or would you like to push it yourself to avoid conflicts with other Exynos patches ? My plan was to handle this series together with the other Exynos patches it depends on. I would send a pull request today. I guess there would be the least conflicts this way. Sorry about embedding this core patch in my series. No worries, I'm fine with that. That's one less pull request for me to handle :-) -- 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: stv0297 signal issues on QAM256
Hi, sorry for resurrecting this thread after a year and for my lengthy mail. On Sun, Jun 10, 2012 at 02:25:09PM +0200, Fredrik wrote: Unfortunatly my cable provider Comhem moved almost all channels to QAM256. The results are terrible on my two cards. Blocky picture and skipping audio. On Wed, Jun 13, 2012 at 10:46:00AM +0200, Fontana wrote: After some further digging i found a post with attached patch. http://www.linuxtv.org/pipermail/linux-dvb/attachments/20080731/de8768ed/att achment.diff Dunno why there were no followup on this one? http://linuxtv.org/pipermail/linux-dvb/2008-July/027517.html Applied cleanly to kernel 3.4.0 with the following change. - (p-u.qam.modulation == QAM_256) ? 6718 : 7250); + (p-modulation == QAM_256) ? 6718 : 7250); As I recently bought a TT premium C2300 suffering from the same problem, I spent Saturday night analyzing in detail what causes it. To make sure there are no offsets introduces by my cable provider, I mapped the complete spectrum with cxadc (and XC3028 switched to DVB-T). Both QAM64 and QAM256 channels are centered exactly at the frequencies mentioned in the NIT. I then tried to measure the output of the tuner with my cheap oscilloscope but failed, probably due to the low signal level. I did succeed however at the output of the TDA9819 (pin 18). There I could see that the center frequency is about 6.6MHz, in contrast to the 7.25MHz configured in the STV0297. From both adjacent channels there are remnants visible, attenuated to about the same level, so the 36.15MHz IF is correct. But why is it not centered around 7.25MHz? That second IF is generated by a VCO that is controlled by pin 16 of the TDA9819. If you look closely, you can see that pin 16 is directly connected to pin 15, which controlls the DVB AGC. This only makes sense if these pins are tied to a fixed voltage. My multimeter says 2.47V, which is close to the typical input voltage mentioned in the data sheet for pin 15. The diagram for the VCO frequency tells us this should make the VCO run at about 86.3MHz, which is halved before it is multiplied with the signal from the tuner. If we lived in a perfect world, we would get a 2nd IF of 86.3/2-36.15=7MHz. If the VCO is off by 1%, we arrive at 6.6MHz. What counts is that there is no calibrated quartz controlling the frequency of the 2nd IF, so it may vary with each device (and probably temperature, supply voltage, etc.). But why does QAM64 work? The STV0297 contains two stages that can compensate for IF offsets. The first one is controlled by stv0297_set_initialdemodfreq the second one by stv0297_set_carrieroffset. Both stages can automatically try different frequencies during locking, but we only allow this for the second stage. The first one we fix at 7.25MHz or rather 7.266MHz due to rounding while calculating the register value. On a tuned QAM64 channel stv0297_get_carrieroffset reports an offset of about 680kHz. By why does QAM256 not work? I also get a lock on QAM256 channels and there stv0297_get_carrieroffset also reports the same offset give or take 5 kHz. The STV0297 data sheet says: It is possible to optimize chip performance by optimizing the respective uses of CRL and initial derotator (for example if the CRL locks for a given offset value, it is possible to transfer this offset cancellation from CRL to initial derotator before Nyquist filtering, the latter being then better matched to the signal actually received). So while at QAM64 we get away with doing the correction in the CRL (second stage), QAM256 requires this to be done in the first stage. We once had code in the driver trying to move the offset from the second stage to the first stage, but it didn't work correctly and was removed in 2005 without trying to fix it: http://linuxtv.org/mailinglists/linux-dvb/2005/01-2005/msg00165.html I found an error in stv0297_get_carrieroffset for negative offsets. Maybe that was the cause back then. Maybe we should not reuse the offset for different channels. A module parameter for the IF probably does not work for people wanting to use more than one card. I am not sure what is the best way to solve the problem but I do know that the 7.25MHz don't work for everyone and it does not depend on the modulation as suggested by the patch above. 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
Re: [RFC PATCH v2 1/2] media: Add function removing all media entity links
Hi Sakari, On 06/10/2013 12:15 AM, Sakari Ailus wrote: Sylwester Nawrocki wrote: ... diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c index e1cd132..bd85dc3 100644 --- a/drivers/media/media-entity.c +++ b/drivers/media/media-entity.c @@ -429,6 +429,57 @@ media_entity_create_link(struct media_entity *source, u16 source_pad, } EXPORT_SYMBOL_GPL(media_entity_create_link); +void __media_entity_remove_links(struct media_entity *entity) +{ +int i, r; u16? r can be defined inside the loop. I would argue 'unsigned int' would be more optimal type for i in most cases. Will move r inside the loop. +for (i = 0; i entity-num_links; i++) { +struct media_link *link =entity-links[i]; +struct media_entity *remote; +int num_links; num_links is u16 in struct media_entity. I'd use the same type. I would go with 'unsigned int', as a more natural type for the CPU in most cases. It's a minor issue, but I can't see how u16 would have been more optimal than unsigned int for a local variable like this, while this code is mostly used on 32-bit systems at least. +if (link-source-entity == entity) +remote = link-sink-entity; +else +remote = link-source-entity; + +num_links = remote-num_links; + +for (r = 0; r num_links; r++) { Is caching remote-num_links needed, or do I miss something? Yes, it is needed, remote-num_links is decremented inside the loop. Oh, forgot this one... yes, remote-num_links is decremented, but so is r it's compared to. So I don't think it's necessary to cache it, but it's neither an error to do so. Indeed, it seems more correct to not cache it, thanks. +struct media_link *rlink =remote-links[r]; + +if (rlink != link-reverse) +continue; + +if (link-source-entity == entity) +remote-num_backlinks--; + +remote-num_links--; + +if (remote-num_links 1) How about: if (!remote-num_links) ? Hmm, perhaps squashing the above two lines to: if (--remote-num_links == 0) ? I'm not too fond of --/++ operators as part of more complex structures so I'd keep it separate. Fewer lines doesn't always equate to more readable code. :-) In general I agree, however it's quite simple statement in this case - only decrement and test, it's often only one instruction even in the assembly language... I'm going to squash following to this patch: diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c index f5ea82e..1fb619d 100644 --- a/drivers/media/media-entity.c +++ b/drivers/media/media-entity.c @@ -436,18 +436,18 @@ void __media_entity_remove_links(struct media_entity *entity) for (i = 0; i entity-num_links; i++) { struct media_link *link = entity-links[i]; struct media_entity *remote; - unsigned int r, num_links; + unsigned int r; if (link-source-entity == entity) remote = link-sink-entity; else remote = link-source-entity; - num_links = remote-num_links; - - for (r = 0; r num_links; r++) { - if (remote-links[r] != link-reverse) + while (r remote-num_links; r++) { + if (remote-links[r] != link-reverse) { + r++; continue; + } if (link-source-entity == entity) remote-num_backlinks--; @@ -456,7 +456,7 @@ void __media_entity_remove_links(struct media_entity *entity) break; /* Insert last entry in place of the dropped link. */ - remote-links[r--] = remote-links[remote-num_links]; + remote-links[r] = remote-links[remote-num_links]; } } So the loop looks something like: while (r remote-num_links) { if (remote-links[r] != link-reverse) { r++; continue; } if (link-source-entity == entity) remote-num_backlinks--; if (--remote-num_links == 0) break; /* Insert last entry in place of the dropped link. */ remote-links[r] = remote-links[remote-num_links]; } Does it sound OK ? 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: [RFC PATCH v2 1/2] media: Add function removing all media entity links
On 06/10/2013 12:26 PM, Sylwester Nawrocki wrote: Hi Sakari, On 06/10/2013 12:15 AM, Sakari Ailus wrote: Sylwester Nawrocki wrote: ... diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c index e1cd132..bd85dc3 100644 --- a/drivers/media/media-entity.c +++ b/drivers/media/media-entity.c @@ -429,6 +429,57 @@ media_entity_create_link(struct media_entity *source, u16 source_pad, } EXPORT_SYMBOL_GPL(media_entity_create_link); +void __media_entity_remove_links(struct media_entity *entity) +{ +int i, r; u16? r can be defined inside the loop. I would argue 'unsigned int' would be more optimal type for i in most cases. Will move r inside the loop. +for (i = 0; i entity-num_links; i++) { +struct media_link *link =entity-links[i]; +struct media_entity *remote; +int num_links; num_links is u16 in struct media_entity. I'd use the same type. I would go with 'unsigned int', as a more natural type for the CPU in most cases. It's a minor issue, but I can't see how u16 would have been more optimal than unsigned int for a local variable like this, while this code is mostly used on 32-bit systems at least. +if (link-source-entity == entity) +remote = link-sink-entity; +else +remote = link-source-entity; + +num_links = remote-num_links; + +for (r = 0; r num_links; r++) { Is caching remote-num_links needed, or do I miss something? Yes, it is needed, remote-num_links is decremented inside the loop. Oh, forgot this one... yes, remote-num_links is decremented, but so is r it's compared to. So I don't think it's necessary to cache it, but it's neither an error to do so. Indeed, it seems more correct to not cache it, thanks. +struct media_link *rlink =remote-links[r]; + +if (rlink != link-reverse) +continue; + +if (link-source-entity == entity) +remote-num_backlinks--; + +remote-num_links--; + +if (remote-num_links 1) How about: if (!remote-num_links) ? Hmm, perhaps squashing the above two lines to: if (--remote-num_links == 0) ? I'm not too fond of --/++ operators as part of more complex structures so I'd keep it separate. Fewer lines doesn't always equate to more readable code. :-) In general I agree, however it's quite simple statement in this case - only decrement and test, it's often only one instruction even in the assembly language... I'm going to squash following to this patch: diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c index f5ea82e..1fb619d 100644 --- a/drivers/media/media-entity.c +++ b/drivers/media/media-entity.c @@ -436,18 +436,18 @@ void __media_entity_remove_links(struct media_entity *entity) for (i = 0; i entity-num_links; i++) { struct media_link *link = entity-links[i]; struct media_entity *remote; - unsigned int r, num_links; + unsigned int r; Should have been: unsigned int r = 0; Thanks, 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: [REVIEW PATCH v3 1/2] media: Change media device link_notify behaviour
Hi Sakari, On 06/10/2013 12:10 AM, Sakari Ailus wrote: Sylwester Nawrocki wrote: ... diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c index 1d7dbd5..1a2d25c 100644 --- a/drivers/media/platform/omap3isp/isp.c +++ b/drivers/media/platform/omap3isp/isp.c @@ -792,9 +792,9 @@ int omap3isp_pipeline_pm_use(struct media_entity *entity, int use) /* * isp_pipeline_link_notify - Link management notification callback - * @source: Pad at the start of the link - * @sink: Pad at the end of the link + * @link: The link * @flags: New link flags that will be applied + * @notification: The link's state change notification type (MEDIA_DEV_NOTIFY_*) * * React to link management on powered pipelines by updating the use count of * all entities in the source and sink sides of the link. Entities are powered @@ -804,29 +804,38 @@ int omap3isp_pipeline_pm_use(struct media_entity *entity, int use) * off is assumed to never fail. This function will not fail for disconnection * events. */ -static int isp_pipeline_link_notify(struct media_pad *source, -struct media_pad *sink, u32 flags) +static int isp_pipeline_link_notify(struct media_link *link, u32 flags, +unsigned int notification) { -int source_use = isp_pipeline_pm_use_count(source-entity); -int sink_use = isp_pipeline_pm_use_count(sink-entity); +struct media_entity *source = link-source-entity; +struct media_entity *sink = link-sink-entity; +int source_use = isp_pipeline_pm_use_count(source); +int sink_use = isp_pipeline_pm_use_count(sink); int ret; -if (!(flags MEDIA_LNK_FL_ENABLED)) { +if (notification == MEDIA_DEV_NOTIFY_POST_LINK_CH +!(link-flags MEDIA_LNK_FL_ENABLED)) { /* Powering off entities is assumed to never fail. */ -isp_pipeline_pm_power(source-entity, -sink_use); -isp_pipeline_pm_power(sink-entity, -source_use); +isp_pipeline_pm_power(source, -sink_use); +isp_pipeline_pm_power(sink, -source_use); return 0; } -ret = isp_pipeline_pm_power(source-entity, sink_use); -if (ret 0) -return ret; +if (notification == MEDIA_DEV_NOTIFY_PRE_LINK_CH +(flags MEDIA_LNK_FL_ENABLED)) { You could return zero here if the opposite was true, and unindent the rest. Up to you --- the patch is fine. All right, thanks for the Ack. An updated patch to follow. Acked-by: Sakari Ailus sakari.ai...@iki.fi -ret = isp_pipeline_pm_power(sink-entity, source_use); -if (ret 0) -isp_pipeline_pm_power(source-entity, -sink_use); +ret = isp_pipeline_pm_power(source, sink_use); +if (ret 0) +return ret; -return ret; +ret = isp_pipeline_pm_power(sink, source_use); +if (ret 0) +isp_pipeline_pm_power(source, -sink_use); + +return ret; +} + +return 0; } 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: [REVIEW PATCH v3 1/2] media: Change media device link_notify behaviour
On Monday 10 June 2013 12:47:02 Sylwester Nawrocki wrote: On 06/10/2013 12:10 AM, Sakari Ailus wrote: Sylwester Nawrocki wrote: ... diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c index 1d7dbd5..1a2d25c 100644 --- a/drivers/media/platform/omap3isp/isp.c +++ b/drivers/media/platform/omap3isp/isp.c @@ -792,9 +792,9 @@ int omap3isp_pipeline_pm_use(struct media_entity *entity, int use) /* * isp_pipeline_link_notify - Link management notification callback - * @source: Pad at the start of the link - * @sink: Pad at the end of the link + * @link: The link * @flags: New link flags that will be applied + * @notification: The link's state change notification type (MEDIA_DEV_NOTIFY_*) * * React to link management on powered pipelines by updating the use count of * all entities in the source and sink sides of the link. Entities are powered @@ -804,29 +804,38 @@ int omap3isp_pipeline_pm_use(struct media_entity *entity, int use) * off is assumed to never fail. This function will not fail for disconnection * events. */ -static int isp_pipeline_link_notify(struct media_pad *source, - struct media_pad *sink, u32 flags) +static int isp_pipeline_link_notify(struct media_link *link, u32 flags, + unsigned int notification) { - int source_use = isp_pipeline_pm_use_count(source-entity); - int sink_use = isp_pipeline_pm_use_count(sink-entity); + struct media_entity *source = link-source-entity; + struct media_entity *sink = link-sink-entity; + int source_use = isp_pipeline_pm_use_count(source); + int sink_use = isp_pipeline_pm_use_count(sink); int ret; - if (!(flags MEDIA_LNK_FL_ENABLED)) { + if (notification == MEDIA_DEV_NOTIFY_POST_LINK_CH + !(link-flags MEDIA_LNK_FL_ENABLED)) { /* Powering off entities is assumed to never fail. */ - isp_pipeline_pm_power(source-entity, -sink_use); - isp_pipeline_pm_power(sink-entity, -source_use); + isp_pipeline_pm_power(source, -sink_use); + isp_pipeline_pm_power(sink, -source_use); return 0; } - ret = isp_pipeline_pm_power(source-entity, sink_use); - if (ret 0) - return ret; + if (notification == MEDIA_DEV_NOTIFY_PRE_LINK_CH + (flags MEDIA_LNK_FL_ENABLED)) { You could return zero here if the opposite was true, and unindent the rest. Up to you --- the patch is fine. I would personally keep the code as-is, to keep the symmetry, but I'm fine with both :-) All right, thanks for the Ack. An updated patch to follow. Acked-by: Sakari Ailus sakari.ai...@iki.fi - ret = isp_pipeline_pm_power(sink-entity, source_use); - if (ret 0) - isp_pipeline_pm_power(source-entity, -sink_use); + ret = isp_pipeline_pm_power(source, sink_use); + if (ret 0) + return ret; - return ret; + ret = isp_pipeline_pm_power(sink, source_use); + if (ret 0) + isp_pipeline_pm_power(source, -sink_use); + + return ret; + } + + return 0; } -- 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: [REVIEW PATCH v3 1/2] media: Change media device link_notify behaviour
On 06/10/2013 12:49 PM, Laurent Pinchart wrote: -static int isp_pipeline_link_notify(struct media_pad *source, - struct media_pad *sink, u32 flags) +static int isp_pipeline_link_notify(struct media_link *link, u32 flags, + unsigned int notification) { - int source_use = isp_pipeline_pm_use_count(source-entity); - int sink_use = isp_pipeline_pm_use_count(sink-entity); + struct media_entity *source = link-source-entity; + struct media_entity *sink = link-sink-entity; + int source_use = isp_pipeline_pm_use_count(source); + int sink_use = isp_pipeline_pm_use_count(sink); int ret; - if (!(flags MEDIA_LNK_FL_ENABLED)) { + if (notification == MEDIA_DEV_NOTIFY_POST_LINK_CH + !(link-flags MEDIA_LNK_FL_ENABLED)) { /* Powering off entities is assumed to never fail. */ - isp_pipeline_pm_power(source-entity, -sink_use); - isp_pipeline_pm_power(sink-entity, -source_use); + isp_pipeline_pm_power(source, -sink_use); + isp_pipeline_pm_power(sink, -source_use); return 0; } - ret = isp_pipeline_pm_power(source-entity, sink_use); - if (ret 0) - return ret; + if (notification == MEDIA_DEV_NOTIFY_PRE_LINK_CH + (flags MEDIA_LNK_FL_ENABLED)) { You could return zero here if the opposite was true, and unindent the rest. Up to you --- the patch is fine. I would personally keep the code as-is, to keep the symmetry, but I'm fine with both :-) I had also an impression that it looks more symmetric as-is. I would leave it unchanged then. ;) 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] [media] usbtv: Add driver for Fushicai USBTV007 video frame grabber
Hi Lubomir! Thanks for working on this. I've got some review comments below... On Mon June 10 2013 11:52:11 Lubomir Rintel wrote: Reverse-engineered driver for cheapo video digitizer, made from observations of Windows XP driver. The protocol is not yet completely understood, so far we don't provide any controls, only support a single format out of three and don't support the audio device. Signed-off-by: Lubomir Rintel lkund...@v3.sk Cc: Mauro Carvalho Chehab mche...@redhat.com Cc: linux-ker...@vger.kernel.org Cc: linux-media@vger.kernel.org --- Hi everyone, this is my first experience with v4l2, videobuf2, usb and a video video hardware. Therefore, please be careful reviewing this as I could have made mistakes that are not likely to happen for more experienced people. I've not figured out the controls for the hardware yet, thus the huge set of unidentified register settings. I've been very unsuccessfully struggling with my Windows installation (the Windows driver for hardware was not usable enough with any other player than the cranky one shipped with it, crashing and deadlocking quite often). It seems quite possible to create a simpler directshow app that would just set the controls; and I plan to do that as time permits. Also, I the hardware uses V4L2_FIELD_ALTERNATE interlacing, but I couldn't make it work, What didn't work exactly? so I'm doing deinterlacing in the driver, which is obviously not the right thing to do. Could anyone educate me on proper way of dealing with data interlaced this way? I could not find a decent example, and I'm not even sure what the sizes in format specification are (like, is the height after or before deinterlacing?). FIELD_ALTERNATE means that each buffer contains one field, so the format height should be 240/288 (NTSC/PAL). Drivers using FIELD_ALTERNATE are very rare. Thanks a lot! Lubo drivers/media/usb/Kconfig|1 + drivers/media/usb/Makefile |1 + drivers/media/usb/usbtv/Kconfig | 10 + drivers/media/usb/usbtv/Makefile |1 + drivers/media/usb/usbtv/usbtv.c | 723 ++ 5 files changed, 736 insertions(+), 0 deletions(-) create mode 100644 drivers/media/usb/usbtv/Kconfig create mode 100644 drivers/media/usb/usbtv/Makefile create mode 100644 drivers/media/usb/usbtv/usbtv.c diff --git a/drivers/media/usb/Kconfig b/drivers/media/usb/Kconfig index 0a7d520..8e10267 100644 --- a/drivers/media/usb/Kconfig +++ b/drivers/media/usb/Kconfig @@ -17,6 +17,7 @@ source drivers/media/usb/zr364xx/Kconfig source drivers/media/usb/stkwebcam/Kconfig source drivers/media/usb/s2255/Kconfig source drivers/media/usb/sn9c102/Kconfig +source drivers/media/usb/usbtv/Kconfig endif if MEDIA_ANALOG_TV_SUPPORT diff --git a/drivers/media/usb/Makefile b/drivers/media/usb/Makefile index 7f51d7e..0935f47 100644 --- a/drivers/media/usb/Makefile +++ b/drivers/media/usb/Makefile @@ -20,3 +20,4 @@ obj-$(CONFIG_VIDEO_STK1160) += stk1160/ obj-$(CONFIG_VIDEO_CX231XX) += cx231xx/ obj-$(CONFIG_VIDEO_TM6000) += tm6000/ obj-$(CONFIG_VIDEO_EM28XX) += em28xx/ +obj-$(CONFIG_VIDEO_USBTV) += usbtv/ diff --git a/drivers/media/usb/usbtv/Kconfig b/drivers/media/usb/usbtv/Kconfig new file mode 100644 index 000..8864436 --- /dev/null +++ b/drivers/media/usb/usbtv/Kconfig @@ -0,0 +1,10 @@ +config VIDEO_USBTV +tristate USBTV007 video capture support +depends on VIDEO_DEV +select VIDEOBUF2_VMALLOC + +---help--- + This is a video4linux2 driver for USBTV007 based video capture devices. + + To compile this driver as a module, choose M here: the + module will be called usbtv diff --git a/drivers/media/usb/usbtv/Makefile b/drivers/media/usb/usbtv/Makefile new file mode 100644 index 000..28b872f --- /dev/null +++ b/drivers/media/usb/usbtv/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_VIDEO_USBTV) += usbtv.o diff --git a/drivers/media/usb/usbtv/usbtv.c b/drivers/media/usb/usbtv/usbtv.c new file mode 100644 index 000..d165cb1 --- /dev/null +++ b/drivers/media/usb/usbtv/usbtv.c @@ -0,0 +1,723 @@ +/* + * Fushicai USBTV007 Video Grabber Driver + * + * Product web site: + * http://www.fushicai.com/products_detail/productId=d05449ee-b690-42f9-a661-aa7353894bed.html + * + * Following LWN articles were very useful in construction of this driver: + * Video4Linux2 API series: http://lwn.net/Articles/203924/ + * videobuf2 API explanation: http://lwn.net/Articles/447435/ + * Thanks go to Jonathan Corbet for providing this quality documentation. + * He is awesome. + * + * Copyright (c) 2013 Lubomir Rintel + * All rights reserved. + * No physical hadrware was harmed running Windows during the typo: hardware + * reverse-engineering activity + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the
Re: [PATCH] [media] usbtv: Add driver for Fushicai USBTV007 video frame grabber
Just as I sent my reply I realized that my notes w.r.t. field handling were incomplete. So I'll try to clarify it below. On Mon June 10 2013 13:05:04 Hans Verkuil wrote: Hi Lubomir! Thanks for working on this. I've got some review comments below... On Mon June 10 2013 11:52:11 Lubomir Rintel wrote: Reverse-engineered driver for cheapo video digitizer, made from observations of Windows XP driver. The protocol is not yet completely understood, so far we don't provide any controls, only support a single format out of three and don't support the audio device. Signed-off-by: Lubomir Rintel lkund...@v3.sk Cc: Mauro Carvalho Chehab mche...@redhat.com Cc: linux-ker...@vger.kernel.org Cc: linux-media@vger.kernel.org --- Hi everyone, this is my first experience with v4l2, videobuf2, usb and a video video hardware. Therefore, please be careful reviewing this as I could have made mistakes that are not likely to happen for more experienced people. I've not figured out the controls for the hardware yet, thus the huge set of unidentified register settings. I've been very unsuccessfully struggling with my Windows installation (the Windows driver for hardware was not usable enough with any other player than the cranky one shipped with it, crashing and deadlocking quite often). It seems quite possible to create a simpler directshow app that would just set the controls; and I plan to do that as time permits. Also, I the hardware uses V4L2_FIELD_ALTERNATE interlacing, but I couldn't make it work, What didn't work exactly? so I'm doing deinterlacing in the driver, which is obviously not the right thing to do. Could anyone educate me on proper way of dealing with data interlaced this way? I could not find a decent example, and I'm not even sure what the sizes in format specification are (like, is the height after or before deinterlacing?). FIELD_ALTERNATE means that each buffer contains one field, so the format height should be 240/288 (NTSC/PAL). Drivers using FIELD_ALTERNATE are very rare. Given the fact that very few drivers do FIELD_ALTERNATE it makes sense to convert it in the driver to FIELD_INTERLACED format, which is much more common. While normally format conversions in the kernel are discouraged I think it is not an issue here: the data has to be copied into the buffer anyway, so why not copy it in a way that makes more sense. Doing this will give buffers that use FIELD_INTERLACED and have as height the full frame size (480 or 576, depending on the standard). snip +static int usbtv_g_fmt_vid_cap(struct file *file, void *priv, + struct v4l2_format *f) Rename to usbtv_fmt_vid_cap and use this for all g/try/s ops. +{ + f-fmt.pix.width = USBTV_WIDTH; + f-fmt.pix.height = USBTV_HEIGHT; + f-fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV; + f-fmt.pix.field = V4L2_FIELD_NONE; This should be V4L2_FIELD_ALTERNATE I guess. Correction: this should be FIELD_INTERLACED. + f-fmt.pix.bytesperline = USBTV_WIDTH * 2; + f-fmt.pix.sizeimage = (f-fmt.pix.bytesperline * f-fmt.pix.height); + f-fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; + return 0; +} BTW, one thing that is missing in this driver is that the timestamp isn't set in the buffer. The correct sequence in usbtv_image_chunk() is: buf-vb.v4l2_buf.field = V4L2_FIELD_INTERLACED; buf-vb.v4l2_buf.sequence = usbtv-sequence++; v4l2_get_timestamp(buf-vb.v4l2_buf.timestamp); vb2_set_plane_payload(buf-vb, 0, size); vb2_buffer_done(buf-vb, VB2_BUF_STATE_DONE); Regards, Hans -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 1/1] v4l: Document timestamp behaviour to correspond to reality
On Mon June 10 2013 00:35:44 Sakari Ailus wrote: Hi Laurent, Laurent Pinchart wrote: ... @@ -745,13 +718,9 @@ applications when an output stream./entry byte was captured, as returned by the functionclock_gettime()/function function for the relevant clock id; see constantV4L2_BUF_FLAG_TIMESTAMP_*/constant in - xref linkend=buffer-flags /. For output streams the data - will not be displayed before this time, secondary to the nominal - frame rate determined by the current video standard in enqueued - order. Applications can for example zero this field to display - frames as soon as possible. The driver stores the time at which - the first data byte was actually sent out in the - structfieldtimestamp/structfield field. This permits + xref linkend=buffer-flags /. For output streams he driver 'he' - 'the' + stores the time at which the first data byte was actually sent out + in the structfieldtimestamp/structfield field. This permits Not true: the timestamp is taken after the whole frame was transmitted. Note that the 'timestamp' field documentation still says that it is the timestamp of the first data byte for capture as well, that's also wrong. I know we've already discussed this, but what about devices, such as uvcvideo, that can provide the time stamp at which the image has been captured ? I don't think it would be worth it making this configurable, or even reporting the information to userspace, but shouldn't we give some degree of freedom to drivers here ? Hmm. That's a good question --- if we allow variation then we preferrably should also provide a way for applications to know which case is which. Could the uvcvideo timestamps be meaningfully converted to the frame end time instead? I'd suppose that a frame rate dependent constant would suffice. However, how to calculate this I don't know. I don't think that's a good idea. The time at which the last byte of the image is received is meaningless to applications. What they care about, for synchronization purpose, is the time at which the image has been captured. I'm wondering if we really need to care for now. I would be enclined to leave it as-is until an application runs into a real issue related to timestamps. What do you mean by image has been captured? Which part of it? What I was thinking was the possibility that we could change the definition so that it'd be applicable to both cases: the time the whole image is fully in the system memory is of secondary importance in both cases anyway. As on embedded systems the time between the last pixel of the image is fully captured to it being in the host system memory is very, very short the two can be considered the same in most situations. I wonder if this change would have any undesirable consequences. I really think we need to add a buffer flag that states whether the timestamp is taken at the start or at the end of the frame. For video receivers the timestamp at the end of the frame is the logical choice and this is what almost all drivers do. Only for sensors can the start of the frame be more suitable since the framerate can be variable. /* Timestamp is taken at the start-of-frame, not the end-of-frame */ #define V4L2_BUF_FLAG_TIMESTAMP_SOF 0x0200 I think it is a safe bet that we won't see 'middle of frame' timestamps, so let's just add this flag. Regards, Hans -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[REVIEW PATCH 1/9] soc_camera: replace vdev-parent by vdev-v4l2_dev.
From: Hans Verkuil hans.verk...@cisco.com The parent field will eventually disappear to be replaced by v4l2_dev. soc_camera does provide a v4l2_device struct but did not point to it in struct video_device. This is now fixed. Now the video nodes can be found under the correct platform bus, and the advanced debug ioctls work correctly as well (the core implementation of those ioctls requires that v4l2_dev is set correctly). Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/platform/soc_camera/soc_camera.c |5 +++-- include/media/soc_camera.h |4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c index 0252fbb..9a43560 100644 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c @@ -524,7 +524,7 @@ static int soc_camera_open(struct file *file) return -ENODEV; } - icd = dev_get_drvdata(vdev-parent); + icd = video_get_drvdata(vdev); ici = to_soc_camera_host(icd-parent); ret = try_module_get(ici-ops-owner) ? 0 : -ENODEV; @@ -1477,7 +1477,7 @@ static int video_dev_create(struct soc_camera_device *icd) strlcpy(vdev-name, ici-drv_name, sizeof(vdev-name)); - vdev-parent= icd-pdev; + vdev-v4l2_dev = ici-v4l2_dev; vdev-fops = soc_camera_fops; vdev-ioctl_ops = soc_camera_ioctl_ops; vdev-release = video_device_release; @@ -1500,6 +1500,7 @@ static int soc_camera_video_start(struct soc_camera_device *icd) if (!icd-parent) return -ENODEV; + video_set_drvdata(icd-vdev, icd); ret = video_register_device(icd-vdev, VFL_TYPE_GRABBER, -1); if (ret 0) { dev_err(icd-pdev, video_register_device failed: %d\n, ret); diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h index ff77d08..31a4bfe 100644 --- a/include/media/soc_camera.h +++ b/include/media/soc_camera.h @@ -346,9 +346,9 @@ static inline struct soc_camera_subdev_desc *soc_camera_i2c_to_desc(const struct return client-dev.platform_data; } -static inline struct v4l2_subdev *soc_camera_vdev_to_subdev(const struct video_device *vdev) +static inline struct v4l2_subdev *soc_camera_vdev_to_subdev(struct video_device *vdev) { - struct soc_camera_device *icd = dev_get_drvdata(vdev-parent); + struct soc_camera_device *icd = video_get_drvdata(vdev); return soc_camera_to_subdev(icd); } -- 1.7.10.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
[REVIEW PATCH 2/9] cx23885-417: use v4l2_dev instead of the deprecated parent field.
From: Hans Verkuil hans.verk...@cisco.com Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/pci/cx23885/cx23885-417.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/pci/cx23885/cx23885-417.c b/drivers/media/pci/cx23885/cx23885-417.c index f4f9ef0..e3fc2c7 100644 --- a/drivers/media/pci/cx23885/cx23885-417.c +++ b/drivers/media/pci/cx23885/cx23885-417.c @@ -1732,7 +1732,7 @@ static struct video_device *cx23885_video_dev_alloc( *vfd = *template; snprintf(vfd-name, sizeof(vfd-name), %s (%s), cx23885_boards[tsport-dev-board].name, type); - vfd-parent = pci-dev; + vfd-v4l2_dev = dev-v4l2_dev; vfd-release = video_device_release; return vfd; } -- 1.7.10.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
[REVIEW PATCH 7/9] pvrusb2: use v4l2_dev instead of the deprecated parent field.
From: Hans Verkuil hans.verk...@cisco.com Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/usb/pvrusb2/pvrusb2-hdw.c |4 drivers/media/usb/pvrusb2/pvrusb2-hdw.h |4 drivers/media/usb/pvrusb2/pvrusb2-v4l2.c |7 --- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c index d329209..c4d51d7 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c @@ -2704,6 +2704,10 @@ static void pvr2_hdw_remove_usb_stuff(struct pvr2_hdw *hdw) pvr2_hdw_render_useless(hdw); } +void pvr2_hdw_set_v4l2_dev(struct pvr2_hdw *hdw, struct video_device *vdev) +{ + vdev-v4l2_dev = hdw-v4l2_dev; +} /* Destroy hardware interaction structure */ void pvr2_hdw_destroy(struct pvr2_hdw *hdw) diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.h b/drivers/media/usb/pvrusb2/pvrusb2-hdw.h index 1a135cf..4184707 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.h +++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.h @@ -22,6 +22,7 @@ #include linux/usb.h #include linux/videodev2.h +#include media/v4l2-dev.h #include pvrusb2-io.h #include pvrusb2-ctrl.h @@ -138,6 +139,9 @@ const char *pvr2_hdw_get_device_identifier(struct pvr2_hdw *); /* Called when hardware has been unplugged */ void pvr2_hdw_disconnect(struct pvr2_hdw *); +/* Sets v4l2_dev of a video_device struct */ +void pvr2_hdw_set_v4l2_dev(struct pvr2_hdw *, struct video_device *); + /* Get the number of defined controls */ unsigned int pvr2_hdw_get_ctrl_count(struct pvr2_hdw *); diff --git a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c index 82f619b..d77069e 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c @@ -31,6 +31,7 @@ #include linux/videodev2.h #include linux/module.h #include media/v4l2-dev.h +#include media/v4l2-device.h #include media/v4l2-common.h #include media/v4l2-ioctl.h @@ -870,8 +871,8 @@ static void pvr2_v4l2_dev_destroy(struct pvr2_v4l2_dev *dip) static void pvr2_v4l2_dev_disassociate_parent(struct pvr2_v4l2_dev *dip) { if (!dip) return; - if (!dip-devbase.parent) return; - dip-devbase.parent = NULL; + if (!dip-devbase.v4l2_dev-dev) return; + dip-devbase.v4l2_dev-dev = NULL; device_move(dip-devbase.dev, NULL, DPM_ORDER_NONE); } @@ -1321,7 +1322,7 @@ static void pvr2_v4l2_dev_init(struct pvr2_v4l2_dev *dip, if (nr_ptr (unit_number = 0) (unit_number PVR_NUM)) { mindevnum = nr_ptr[unit_number]; } - dip-devbase.parent = usbdev-dev; + pvr2_hdw_set_v4l2_dev(hdw, dip-devbase); if ((video_register_device(dip-devbase, dip-v4l_type, mindevnum) 0) (video_register_device(dip-devbase, -- 1.7.10.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
[REVIEW PATCH 9/9] v4l2: remove parent from v4l2 core.
From: Hans Verkuil hans.verk...@cisco.com Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/v4l2-core/v4l2-dev.c | 34 +++--- drivers/media/v4l2-core/v4l2-ioctl.c |7 +-- include/media/v4l2-dev.h |2 -- 3 files changed, 16 insertions(+), 27 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c index 2f3fac5..61e82f8 100644 --- a/drivers/media/v4l2-core/v4l2-dev.c +++ b/drivers/media/v4l2-core/v4l2-dev.c @@ -495,8 +495,8 @@ static const struct file_operations v4l2_fops = { }; /** - * get_index - assign stream index number based on parent device - * @vdev: video_device to assign index number to, vdev-parent should be assigned + * get_index - assign stream index number based on v4l2_dev + * @vdev: video_device to assign index number to, vdev-v4l2_dev should be assigned * * Note that when this is called the new device has not yet been registered * in the video_device array, but it was able to obtain a minor number. @@ -514,15 +514,11 @@ static int get_index(struct video_device *vdev) static DECLARE_BITMAP(used, VIDEO_NUM_DEVICES); int i; - /* Some drivers do not set the parent. In that case always return 0. */ - if (vdev-parent == NULL) - return 0; - bitmap_zero(used, VIDEO_NUM_DEVICES); for (i = 0; i VIDEO_NUM_DEVICES; i++) { if (video_device[i] != NULL - video_device[i]-parent == vdev-parent) { + video_device[i]-v4l2_dev == vdev-v4l2_dev) { set_bit(video_device[i]-index, used); } } @@ -776,6 +772,9 @@ int __video_register_device(struct video_device *vdev, int type, int nr, /* the release callback MUST be present */ if (WARN_ON(!vdev-release)) return -EINVAL; + /* the v4l2_dev pointer MUST be present */ + if (WARN_ON(!vdev-v4l2_dev)) + return -EINVAL; /* v4l2_fh support */ spin_lock_init(vdev-fh_lock); @@ -803,16 +802,13 @@ int __video_register_device(struct video_device *vdev, int type, int nr, vdev-vfl_type = type; vdev-cdev = NULL; - if (vdev-v4l2_dev) { - if (vdev-v4l2_dev-dev) - vdev-parent = vdev-v4l2_dev-dev; - if (vdev-ctrl_handler == NULL) - vdev-ctrl_handler = vdev-v4l2_dev-ctrl_handler; - /* If the prio state pointer is NULL, then use the v4l2_device - prio state. */ - if (vdev-prio == NULL) - vdev-prio = vdev-v4l2_dev-prio; - } + + if (vdev-ctrl_handler == NULL) + vdev-ctrl_handler = vdev-v4l2_dev-ctrl_handler; + /* If the prio state pointer is NULL, then use the v4l2_device + prio state. */ + if (vdev-prio == NULL) + vdev-prio = vdev-v4l2_dev-prio; /* Part 2: find a free minor, device node number and device index. */ #ifdef CONFIG_VIDEO_FIXED_MINOR_RANGES @@ -897,8 +893,8 @@ int __video_register_device(struct video_device *vdev, int type, int nr, /* Part 4: register the device with sysfs */ vdev-dev.class = video_class; vdev-dev.devt = MKDEV(VIDEO_MAJOR, vdev-minor); - if (vdev-parent) - vdev-dev.parent = vdev-parent; + if (vdev-v4l2_dev-dev) + vdev-dev.parent = vdev-v4l2_dev-dev; dev_set_name(vdev-dev, %s%d, name_base, vdev-num); ret = device_register(vdev-dev); if (ret 0) { diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 19e2988..3dcdaa3 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1845,12 +1845,7 @@ static int v4l_dbg_g_chip_info(const struct v4l2_ioctl_ops *ops, p-flags |= V4L2_CHIP_FL_WRITABLE; if (ops-vidioc_g_register) p-flags |= V4L2_CHIP_FL_READABLE; - if (vfd-v4l2_dev) - strlcpy(p-name, vfd-v4l2_dev-name, sizeof(p-name)); - else if (vfd-parent) - strlcpy(p-name, vfd-parent-driver-name, sizeof(p-name)); - else - strlcpy(p-name, bridge, sizeof(p-name)); + strlcpy(p-name, vfd-v4l2_dev-name, sizeof(p-name)); if (ops-vidioc_g_chip_info) return ops-vidioc_g_chip_info(file, fh, arg); if (p-match.addr) diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h index b2c3776..4d10e66 100644 --- a/include/media/v4l2-dev.h +++ b/include/media/v4l2-dev.h @@ -96,8 +96,6 @@ struct video_device struct device dev; /* v4l device */ struct cdev *cdev; /* character device */ - /* Set either parent or v4l2_dev if your driver
[REVIEW PATCH 0/9] Use v4l2_dev instead of parent.
This patch series converts the last set of drivers still using the parent field of video_device to using v4l2_dev instead and at the end the parent field is removed altogether. A proper pointer to v4l2_dev is necessary otherwise the advanced debugging ioctls will not work when addressing sub-devices. I have been steadily converting drivers to set the v4l2_dev pointer correctly, and this patch series finishes that work. Guennadi, the first patch replaces the broken version I posted earlier as part of the 'current_norm' removal patch series. I've tested it with my renesas board. Note that this patch series sits on top of my for_v3.11 branch. Regards, Hans -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[REVIEW PATCH 5/9] saa7164: use v4l2_dev instead of the deprecated parent field.
From: Hans Verkuil hans.verk...@cisco.com Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/pci/saa7164/saa7164-core.c|6 ++ drivers/media/pci/saa7164/saa7164-encoder.c |2 +- drivers/media/pci/saa7164/saa7164-vbi.c |2 +- drivers/media/pci/saa7164/saa7164.h |3 +++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/media/pci/saa7164/saa7164-core.c b/drivers/media/pci/saa7164/saa7164-core.c index 7618fda..8fa5ba7 100644 --- a/drivers/media/pci/saa7164/saa7164-core.c +++ b/drivers/media/pci/saa7164/saa7164-core.c @@ -1196,6 +1196,11 @@ static int saa7164_initdev(struct pci_dev *pci_dev, if (NULL == dev) return -ENOMEM; + if (v4l2_device_register(pci_dev-dev, dev-v4l2_dev)) { + dev_err(pci_dev-dev, v4l2_device_register failed\n); + goto fail_free; + } + /* pci init */ dev-pci = pci_dev; if (pci_enable_device(pci_dev)) { @@ -1439,6 +1444,7 @@ static void saa7164_finidev(struct pci_dev *pci_dev) mutex_unlock(devlist); saa7164_dev_unregister(dev); + v4l2_device_unregister(dev-v4l2_dev); kfree(dev); } diff --git a/drivers/media/pci/saa7164/saa7164-encoder.c b/drivers/media/pci/saa7164/saa7164-encoder.c index 7b7ed97..9266965 100644 --- a/drivers/media/pci/saa7164/saa7164-encoder.c +++ b/drivers/media/pci/saa7164/saa7164-encoder.c @@ -1348,7 +1348,7 @@ static struct video_device *saa7164_encoder_alloc( snprintf(vfd-name, sizeof(vfd-name), %s %s (%s), dev-name, type, saa7164_boards[dev-board].name); - vfd-parent = pci-dev; + vfd-v4l2_dev = dev-v4l2_dev; vfd-release = video_device_release; return vfd; } diff --git a/drivers/media/pci/saa7164/saa7164-vbi.c b/drivers/media/pci/saa7164/saa7164-vbi.c index 552c01a..6e025fe 100644 --- a/drivers/media/pci/saa7164/saa7164-vbi.c +++ b/drivers/media/pci/saa7164/saa7164-vbi.c @@ -1297,7 +1297,7 @@ static struct video_device *saa7164_vbi_alloc( snprintf(vfd-name, sizeof(vfd-name), %s %s (%s), dev-name, type, saa7164_boards[dev-board].name); - vfd-parent = pci-dev; + vfd-v4l2_dev = dev-v4l2_dev; vfd-release = video_device_release; return vfd; } diff --git a/drivers/media/pci/saa7164/saa7164.h b/drivers/media/pci/saa7164/saa7164.h index 2df47ea..8b29e89 100644 --- a/drivers/media/pci/saa7164/saa7164.h +++ b/drivers/media/pci/saa7164/saa7164.h @@ -63,6 +63,7 @@ #include dmxdev.h #include media/v4l2-common.h #include media/v4l2-ioctl.h +#include media/v4l2-device.h #include saa7164-reg.h #include saa7164-types.h @@ -427,6 +428,8 @@ struct saa7164_dev { struct list_headdevlist; atomic_trefcount; + struct v4l2_device v4l2_dev; + /* pci stuff */ struct pci_dev *pci; unsigned char pci_rev, pci_lat; -- 1.7.10.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
[REVIEW PATCH 3/9] zoran: use v4l2_dev instead of the deprecated parent field.
From: Hans Verkuil hans.verk...@cisco.com Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/pci/zoran/zoran_card.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/pci/zoran/zoran_card.c b/drivers/media/pci/zoran/zoran_card.c index bb53d24..923d59a 100644 --- a/drivers/media/pci/zoran/zoran_card.c +++ b/drivers/media/pci/zoran/zoran_card.c @@ -1050,7 +1050,7 @@ static int zr36057_init (struct zoran *zr) * Now add the template and register the device unit. */ memcpy(zr-video_dev, zoran_template, sizeof(zoran_template)); - zr-video_dev-parent = zr-pci_dev-dev; + zr-video_dev-v4l2_dev = zr-v4l2_dev; strcpy(zr-video_dev-name, ZR_DEVNAME(zr)); /* It's not a mem2mem device, but you can both capture and output from one and the same device. This should really be split up into two -- 1.7.10.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
[REVIEW PATCH 6/9] omap24xxcam: use v4l2_dev instead of the deprecated parent field.
From: Hans Verkuil hans.verk...@cisco.com Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/platform/omap24xxcam.c |9 - drivers/media/platform/omap24xxcam.h |3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/omap24xxcam.c b/drivers/media/platform/omap24xxcam.c index debb44c..d2b440c 100644 --- a/drivers/media/platform/omap24xxcam.c +++ b/drivers/media/platform/omap24xxcam.c @@ -1656,7 +1656,7 @@ static int omap24xxcam_device_register(struct v4l2_int_device *s) } vfd-release = video_device_release; - vfd-parent = cam-dev; + vfd-v4l2_dev = cam-v4l2_dev; strlcpy(vfd-name, CAM_NAME, sizeof(vfd-name)); vfd-fops= omap24xxcam_fops; @@ -1752,6 +1752,11 @@ static int omap24xxcam_probe(struct platform_device *pdev) cam-dev = pdev-dev; + if (v4l2_device_register(pdev-dev, cam-v4l2_dev)) { + dev_err(pdev-dev, v4l2_device_register failed\n); + goto err; + } + /* * Impose a lower limit on the amount of memory allocated for * capture. We require at least enough memory to double-buffer @@ -1849,6 +1854,8 @@ static int omap24xxcam_remove(struct platform_device *pdev) cam-mmio_base_phys = 0; } + v4l2_device_unregister(cam-v4l2_dev); + kfree(cam); return 0; diff --git a/drivers/media/platform/omap24xxcam.h b/drivers/media/platform/omap24xxcam.h index c439595..7f6f791 100644 --- a/drivers/media/platform/omap24xxcam.h +++ b/drivers/media/platform/omap24xxcam.h @@ -29,6 +29,7 @@ #include media/videobuf-dma-sg.h #include media/v4l2-int-device.h +#include media/v4l2-device.h /* * @@ -462,6 +463,8 @@ struct omap24xxcam_device { */ struct mutex mutex; + struct v4l2_device v4l2_dev; + /*** general driver state information ***/ atomic_t users; /* -- 1.7.10.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
[REVIEW PATCH 4/9] sn9c102: use v4l2_dev instead of the deprecated parent field.
From: Hans Verkuil hans.verk...@cisco.com Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/usb/sn9c102/sn9c102.h |3 +++ drivers/media/usb/sn9c102/sn9c102_core.c | 12 +++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/sn9c102/sn9c102.h b/drivers/media/usb/sn9c102/sn9c102.h index 2bc153e..8a917f06 100644 --- a/drivers/media/usb/sn9c102/sn9c102.h +++ b/drivers/media/usb/sn9c102/sn9c102.h @@ -25,6 +25,7 @@ #include linux/videodev2.h #include media/v4l2-common.h #include media/v4l2-ioctl.h +#include media/v4l2-device.h #include linux/device.h #include linux/list.h #include linux/spinlock.h @@ -100,6 +101,8 @@ static DECLARE_RWSEM(sn9c102_dev_lock); struct sn9c102_device { struct video_device* v4ldev; + struct v4l2_device v4l2_dev; + enum sn9c102_bridge bridge; struct sn9c102_sensor sensor; diff --git a/drivers/media/usb/sn9c102/sn9c102_core.c b/drivers/media/usb/sn9c102/sn9c102_core.c index c957e9a..b1f8082 100644 --- a/drivers/media/usb/sn9c102/sn9c102_core.c +++ b/drivers/media/usb/sn9c102/sn9c102_core.c @@ -1737,6 +1737,7 @@ static void sn9c102_release_resources(struct kref *kref) video_device_node_name(cam-v4ldev)); video_set_drvdata(cam-v4ldev, NULL); video_unregister_device(cam-v4ldev); + v4l2_device_unregister(cam-v4l2_dev); usb_put_dev(cam-usbdev); kfree(cam-control_buffer); kfree(cam); @@ -3254,6 +3255,13 @@ sn9c102_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) cam-usbdev = udev; + /* register v4l2_device early so it can be used for printks */ + if (v4l2_device_register(intf-dev, cam-v4l2_dev)) { + dev_err(intf-dev, v4l2_device_register failed\n); + err = -ENOMEM; + goto fail; + } + if (!(cam-control_buffer = kzalloc(8, GFP_KERNEL))) { DBG(1, kzalloc() failed); err = -ENOMEM; @@ -3325,7 +,7 @@ sn9c102_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) strcpy(cam-v4ldev-name, SN9C1xx PC Camera); cam-v4ldev-fops = sn9c102_fops; cam-v4ldev-release = video_device_release; - cam-v4ldev-parent = udev-dev; + cam-v4ldev-v4l2_dev = cam-v4l2_dev; init_completion(cam-probe); @@ -3407,6 +3415,8 @@ static void sn9c102_usb_disconnect(struct usb_interface* intf) wake_up_interruptible_all(cam-wait_open); + v4l2_device_disconnect(cam-v4l2_dev); + kref_put(cam-kref, sn9c102_release_resources); up_write(sn9c102_dev_lock); -- 1.7.10.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
[REVIEW PATCH 8/9] f_uvc: use v4l2_dev instead of the deprecated parent field.
From: Hans Verkuil hans.verk...@cisco.com Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/usb/gadget/f_uvc.c |8 +++- drivers/usb/gadget/uvc.h |2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/f_uvc.c b/drivers/usb/gadget/f_uvc.c index 38dcedd..762e82f 100644 --- a/drivers/usb/gadget/f_uvc.c +++ b/drivers/usb/gadget/f_uvc.c @@ -413,7 +413,7 @@ uvc_register_video(struct uvc_device *uvc) if (video == NULL) return -ENOMEM; - video-parent = cdev-gadget-dev; + video-v4l2_dev = uvc-v4l2_dev; video-fops = uvc_v4l2_fops; video-release = video_device_release; strlcpy(video-name, cdev-gadget-name, sizeof(video-name)); @@ -570,6 +570,7 @@ uvc_function_unbind(struct usb_configuration *c, struct usb_function *f) INFO(cdev, uvc_function_unbind\n); video_unregister_device(uvc-vdev); + v4l2_device_unregister(uvc-v4l2_dev); uvc-control_ep-driver_data = NULL; uvc-video.ep-driver_data = NULL; @@ -697,6 +698,11 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f) if ((ret = usb_function_deactivate(f)) 0) goto error; + if (v4l2_device_register(cdev-gadget-dev, uvc-v4l2_dev)) { + printk(KERN_INFO v4l2_device_register failed\n); + goto error; + } + /* Initialise video. */ ret = uvc_video_init(uvc-video); if (ret 0) diff --git a/drivers/usb/gadget/uvc.h b/drivers/usb/gadget/uvc.h index 817e9e1..7a9111d 100644 --- a/drivers/usb/gadget/uvc.h +++ b/drivers/usb/gadget/uvc.h @@ -57,6 +57,7 @@ struct uvc_event #include linux/videodev2.h #include linux/version.h #include media/v4l2-fh.h +#include media/v4l2-device.h #include uvc_queue.h @@ -145,6 +146,7 @@ enum uvc_state struct uvc_device { struct video_device *vdev; + struct v4l2_device v4l2_dev; enum uvc_state state; struct usb_function func; struct uvc_video video; -- 1.7.10.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 0/6] s5p-mfc: Add support for MFC v7 firmware
This patch series adds MFC v7 firmware support to the Exynos MFC driver. MFC v7 is present in 5420 SoC which has support for VP8 encoding and many other features. Arun Kumar K (6): [media] s5p-mfc: Update v6 encoder buffer sizes [media] s5p-mfc: Add register definition file for MFC v7 [media] s5p-mfc: Core support for MFC v7 [media] s5p-mfc: Update driver for v7 firmware [media] V4L: Add VP8 encoder controls [media] s5p-mfc: Add support for VP8 encoder Documentation/DocBook/media/v4l/controls.xml| 145 +++ drivers/media/platform/s5p-mfc/regs-mfc-v6.h|4 +- drivers/media/platform/s5p-mfc/regs-mfc-v7.h| 58 + drivers/media/platform/s5p-mfc/s5p_mfc.c| 32 + drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c |3 + drivers/media/platform/s5p-mfc/s5p_mfc_common.h | 21 +++- drivers/media/platform/s5p-mfc/s5p_mfc_enc.c| 100 +++- drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c | 129 ++-- drivers/media/v4l2-core/v4l2-ctrls.c| 38 ++ include/uapi/linux/v4l2-controls.h | 30 - 10 files changed, 545 insertions(+), 15 deletions(-) create mode 100644 drivers/media/platform/s5p-mfc/regs-mfc-v7.h -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/6] [media] s5p-mfc: Update v6 encoder buffer sizes
The patch updates few encoder buffer sizes for MFC v6.5 as per the udpdated user manual. The same buffer sizes holds good for v7 firmware also. Signed-off-by: Arun Kumar K arun...@samsung.com --- drivers/media/platform/s5p-mfc/regs-mfc-v6.h |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/s5p-mfc/regs-mfc-v6.h b/drivers/media/platform/s5p-mfc/regs-mfc-v6.h index 363a97c..2398cdf 100644 --- a/drivers/media/platform/s5p-mfc/regs-mfc-v6.h +++ b/drivers/media/platform/s5p-mfc/regs-mfc-v6.h @@ -374,9 +374,9 @@ #define S5P_FIMV_NUM_PIXELS_IN_MB_COL_V6 16 /* Buffer size requirements defined by hardware */ -#define S5P_FIMV_TMV_BUFFER_SIZE_V6(w, h) (((w) + 1) * ((h) + 1) * 8) +#define S5P_FIMV_TMV_BUFFER_SIZE_V6(w, h) (((w) + 1) * ((h) + 3) * 8) #define S5P_FIMV_ME_BUFFER_SIZE_V6(imw, imh, mbw, mbh) \ - ((DIV_ROUND_UP(imw, 64) * DIV_ROUND_UP(imh, 64) * 256) + \ + (imw + 127) / 64) * 16) * DIV_ROUND_UP(imh, 64) * 256) + \ (DIV_ROUND_UP((mbw) * (mbh), 32) * 16)) #define S5P_FIMV_SCRATCH_BUF_SIZE_H264_DEC_V6(w, h)(((w) * 192) + 64) #define S5P_FIMV_SCRATCH_BUF_SIZE_MPEG4_DEC_V6(w, h) \ -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/6] [media] s5p-mfc: Add register definition file for MFC v7
The patch adds the register definition file for new firmware version v7 for MFC. New firmware supports VP8 encoding along with many other features. Signed-off-by: Arun Kumar K arun...@samsung.com --- drivers/media/platform/s5p-mfc/regs-mfc-v7.h | 58 ++ 1 file changed, 58 insertions(+) create mode 100644 drivers/media/platform/s5p-mfc/regs-mfc-v7.h diff --git a/drivers/media/platform/s5p-mfc/regs-mfc-v7.h b/drivers/media/platform/s5p-mfc/regs-mfc-v7.h new file mode 100644 index 000..24dba69 --- /dev/null +++ b/drivers/media/platform/s5p-mfc/regs-mfc-v7.h @@ -0,0 +1,58 @@ +/* + * Register definition file for Samsung MFC V7.x Interface (FIMV) driver + * + * Copyright (c) 2013 Samsung Electronics Co., Ltd. + * http://www.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. + */ + +#ifndef _REGS_MFC_V7_H +#define _REGS_MFC_V7_H + +#include regs-mfc-v6.h + +/* Additional features of v7 */ +#define S5P_FIMV_CODEC_VP8_ENC_V7 25 + +/* Additional registers for v7 */ +#define S5P_FIMV_D_INIT_BUFFER_OPTIONS_V7 0xf47c + +#define S5P_FIMV_E_SOURCE_FIRST_ADDR_V70xf9e0 +#define S5P_FIMV_E_SOURCE_SECOND_ADDR_V7 0xf9e4 +#define S5P_FIMV_E_SOURCE_THIRD_ADDR_V70xf9e8 +#define S5P_FIMV_E_SOURCE_FIRST_STRIDE_V7 0xf9ec +#define S5P_FIMV_E_SOURCE_SECOND_STRIDE_V7 0xf9f0 +#define S5P_FIMV_E_SOURCE_THIRD_STRIDE_V7 0xf9f4 + +#define S5P_FIMV_E_ENCODED_SOURCE_FIRST_ADDR_V70xfa70 +#define S5P_FIMV_E_ENCODED_SOURCE_SECOND_ADDR_V7 0xfa74 + +#define S5P_FIMV_E_VP8_OPTIONS_V7 0xfdb0 +#define S5P_FIMV_E_VP8_FILTER_OPTIONS_V7 0xfdb4 +#define S5P_FIMV_E_VP8_GOLDEN_FRAME_OPTION_V7 0xfdb8 +#define S5P_FIMV_E_VP8_NUM_T_LAYER_V7 0xfdc4 + +/* MFCv7 variant defines */ +#define MAX_FW_SIZE_V7 (SZ_1M) /* 1MB */ +#define MAX_CPB_SIZE_V7(3 * SZ_1M) /* 3MB */ +#define MFC_VERSION_V7 0x72 +#define MFC_NUM_PORTS_V7 1 + +/* MFCv7 Context buffer sizes */ +#define MFC_CTX_BUF_SIZE_V7(30 * SZ_1K)/* 30KB */ +#define MFC_H264_DEC_CTX_BUF_SIZE_V7 (2 * SZ_1M) /* 2MB */ +#define MFC_OTHER_DEC_CTX_BUF_SIZE_V7 (20 * SZ_1K)/* 20KB */ +#define MFC_H264_ENC_CTX_BUF_SIZE_V7 (100 * SZ_1K) /* 100KB */ +#define MFC_OTHER_ENC_CTX_BUF_SIZE_V7 (10 * SZ_1K)/* 10KB */ + +/* Buffer size defines */ +#define S5P_FIMV_SCRATCH_BUF_SIZE_MPEG4_DEC_V7(w, h) \ + (SZ_1M + ((w) * 144) + (8192 * (h)) + 49216) + +#define S5P_FIMV_SCRATCH_BUF_SIZE_VP8_ENC_V7(w, h) \ + (((w) * 48) + (((w) + 1) / 2 * 128) + 144 + 8192) + +#endif /*_REGS_MFC_V7_H*/ -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/6] [media] s5p-mfc: Core support for MFC v7
Adds variant data and core support for the MFC v7 firmware Signed-off-by: Arun Kumar K arun...@samsung.com --- drivers/media/platform/s5p-mfc/s5p_mfc.c| 32 +++ drivers/media/platform/s5p-mfc/s5p_mfc_common.h |2 ++ 2 files changed, 34 insertions(+) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index d12faa6..d6be52f 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c @@ -1391,6 +1391,32 @@ static struct s5p_mfc_variant mfc_drvdata_v6 = { .fw_name= s5p-mfc-v6.fw, }; +struct s5p_mfc_buf_size_v6 mfc_buf_size_v7 = { + .dev_ctx= MFC_CTX_BUF_SIZE_V7, + .h264_dec_ctx = MFC_H264_DEC_CTX_BUF_SIZE_V7, + .other_dec_ctx = MFC_OTHER_DEC_CTX_BUF_SIZE_V7, + .h264_enc_ctx = MFC_H264_ENC_CTX_BUF_SIZE_V7, + .other_enc_ctx = MFC_OTHER_ENC_CTX_BUF_SIZE_V7, +}; + +struct s5p_mfc_buf_size buf_size_v7 = { + .fw = MAX_FW_SIZE_V7, + .cpb= MAX_CPB_SIZE_V7, + .priv = mfc_buf_size_v7, +}; + +struct s5p_mfc_buf_align mfc_buf_align_v7 = { + .base = 0, +}; + +static struct s5p_mfc_variant mfc_drvdata_v7 = { + .version= MFC_VERSION_V7, + .port_num = MFC_NUM_PORTS_V7, + .buf_size = buf_size_v7, + .buf_align = mfc_buf_align_v7, + .fw_name= s5p-mfc-v7.fw, +}; + static struct platform_device_id mfc_driver_ids[] = { { .name = s5p-mfc, @@ -1401,6 +1427,9 @@ static struct platform_device_id mfc_driver_ids[] = { }, { .name = s5p-mfc-v6, .driver_data = (unsigned long)mfc_drvdata_v6, + }, { + .name = s5p-mfc-v7, + .driver_data = (unsigned long)mfc_drvdata_v7, }, {}, }; @@ -1413,6 +1442,9 @@ static const struct of_device_id exynos_mfc_match[] = { }, { .compatible = samsung,mfc-v6, .data = mfc_drvdata_v6, + }, { + .compatible = samsung,mfc-v7, + .data = mfc_drvdata_v7, }, {}, }; diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h index ef4074c..7281de2 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h @@ -24,6 +24,7 @@ #include media/videobuf2-core.h #include regs-mfc.h #include regs-mfc-v6.h +#include regs-mfc-v7.h /* Definitions related to MFC memory */ @@ -684,5 +685,6 @@ void set_work_bit_irqsave(struct s5p_mfc_ctx *ctx); (dev-variant-port_num ? 1 : 0) : 0) : 0) #define IS_TWOPORT(dev)(dev-variant-port_num == 2 ? 1 : 0) #define IS_MFCV6(dev) (dev-variant-version = 0x60 ? 1 : 0) +#define IS_MFCV7(dev) (dev-variant-version = 0x70 ? 1 : 0) #endif /* S5P_MFC_COMMON_H_ */ -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/6] [media] s5p-mfc: Update driver for v7 firmware
Firmware version v7 is mostly similar to v6 in terms of hardware specific controls and commands. So the hardware specific opr_v6 and cmd_v6 are re-used for v7 also. This patch updates the v6 files to handle v7 version also. Signed-off-by: Arun Kumar K arun...@samsung.com --- drivers/media/platform/s5p-mfc/s5p_mfc_enc.c| 12 - drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c | 53 +++ 2 files changed, 54 insertions(+), 11 deletions(-) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c index 2549967..13799a8 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c @@ -1662,8 +1662,16 @@ static int s5p_mfc_queue_setup(struct vb2_queue *vq, *buf_count = 1; if (*buf_count MFC_MAX_BUFFERS) *buf_count = MFC_MAX_BUFFERS; - psize[0] = ctx-luma_size; - psize[1] = ctx-chroma_size; + + if (IS_MFCV7(dev)) { + /* MFCv7 needs pad bytes for input YUV */ + psize[0] = ctx-luma_size + 256; + psize[1] = ctx-chroma_size + 128; + } else { + psize[0] = ctx-luma_size; + psize[1] = ctx-chroma_size; + } + if (IS_MFCV6(dev)) { allocators[0] = ctx-dev-alloc_ctx[MFC_BANK1_ALLOC_CTX]; diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c index 7d4c5e1..7145ae5 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c @@ -80,6 +80,7 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx) ctx-tmv_buffer_size = S5P_FIMV_NUM_TMV_BUFFERS_V6 * ALIGN(S5P_FIMV_TMV_BUFFER_SIZE_V6(mb_width, mb_height), S5P_FIMV_TMV_BUFFER_ALIGN_V6); + ctx-luma_dpb_size = ALIGN((mb_width * mb_height) * S5P_FIMV_LUMA_MB_TO_PIXEL_V6, S5P_FIMV_LUMA_DPB_BUFFER_ALIGN_V6); @@ -112,10 +113,18 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx) (ctx-mv_count * ctx-mv_size); break; case S5P_MFC_CODEC_MPEG4_DEC: - ctx-scratch_buf_size = - S5P_FIMV_SCRATCH_BUF_SIZE_MPEG4_DEC_V6( - mb_width, - mb_height); + if (IS_MFCV7(dev)) { + ctx-scratch_buf_size = + S5P_FIMV_SCRATCH_BUF_SIZE_MPEG4_DEC_V7( + mb_width, + mb_height); + } else { + ctx-scratch_buf_size = + S5P_FIMV_SCRATCH_BUF_SIZE_MPEG4_DEC_V6( + mb_width, + mb_height); + } + ctx-scratch_buf_size = ALIGN(ctx-scratch_buf_size, S5P_FIMV_SCRATCH_BUFFER_ALIGN_V6); ctx-bank1.size = ctx-scratch_buf_size; @@ -453,8 +462,13 @@ static void s5p_mfc_set_enc_frame_buffer_v6(struct s5p_mfc_ctx *ctx, { struct s5p_mfc_dev *dev = ctx-dev; - WRITEL(y_addr, S5P_FIMV_E_SOURCE_LUMA_ADDR_V6); /* 256B align */ - WRITEL(c_addr, S5P_FIMV_E_SOURCE_CHROMA_ADDR_V6); + if (IS_MFCV7(dev)) { + WRITEL(y_addr, S5P_FIMV_E_SOURCE_FIRST_ADDR_V7); + WRITEL(c_addr, S5P_FIMV_E_SOURCE_SECOND_ADDR_V7); + } else { + WRITEL(y_addr, S5P_FIMV_E_SOURCE_LUMA_ADDR_V6); + WRITEL(c_addr, S5P_FIMV_E_SOURCE_CHROMA_ADDR_V6); + } mfc_debug(2, enc src y buf addr: 0x%08lx\n, y_addr); mfc_debug(2, enc src c buf addr: 0x%08lx\n, c_addr); @@ -466,8 +480,13 @@ static void s5p_mfc_get_enc_frame_buffer_v6(struct s5p_mfc_ctx *ctx, struct s5p_mfc_dev *dev = ctx-dev; unsigned long enc_recon_y_addr, enc_recon_c_addr; - *y_addr = READL(S5P_FIMV_E_ENCODED_SOURCE_LUMA_ADDR_V6); - *c_addr = READL(S5P_FIMV_E_ENCODED_SOURCE_CHROMA_ADDR_V6); + if (IS_MFCV7(dev)) { + *y_addr = READL(S5P_FIMV_E_ENCODED_SOURCE_FIRST_ADDR_V7); + *c_addr = READL(S5P_FIMV_E_ENCODED_SOURCE_SECOND_ADDR_V7); + } else { + *y_addr = READL(S5P_FIMV_E_ENCODED_SOURCE_LUMA_ADDR_V6); + *c_addr = READL(S5P_FIMV_E_ENCODED_SOURCE_CHROMA_ADDR_V6); + } enc_recon_y_addr = READL(S5P_FIMV_E_RECON_LUMA_DPB_ADDR_V6); enc_recon_c_addr = READL(S5P_FIMV_E_RECON_CHROMA_DPB_ADDR_V6); @@ -1166,6 +1185,12 @@ static int
[PATCH 5/6] [media] V4L: Add VP8 encoder controls
This patch adds new V4L controls for VP8 encoding. Signed-off-by: Arun Kumar K arun...@samsung.com Signed-off-by: Kiran AVND avnd.ki...@samsung.com --- Documentation/DocBook/media/v4l/controls.xml | 145 ++ drivers/media/v4l2-core/v4l2-ctrls.c | 38 +++ include/uapi/linux/v4l2-controls.h | 30 +- 3 files changed, 212 insertions(+), 1 deletion(-) diff --git a/Documentation/DocBook/media/v4l/controls.xml b/Documentation/DocBook/media/v4l/controls.xml index 8d7a779..db614c7 100644 --- a/Documentation/DocBook/media/v4l/controls.xml +++ b/Documentation/DocBook/media/v4l/controls.xml @@ -4772,4 +4772,149 @@ defines possible values for de-emphasis. Here they are:/entry /table /section + +section id=vpx-controls + titleVPX Control Reference/title + + paraThe VPX control class includes controls for encoding parameters + of VPx video codec./para + + table pgwide=1 frame=none id=fm-rx-control-id + titleVPX Control IDs/title + + tgroup cols=4 +colspec colname=c1 colwidth=1* / +colspec colname=c2 colwidth=6* / +colspec colname=c3 colwidth=2* / +colspec colname=c4 colwidth=6* / +spanspec namest=c1 nameend=c2 spanname=id / +spanspec namest=c2 nameend=c4 spanname=descr / +thead + row +entry spanname=id align=leftID/entry +entry align=leftType/entry + /rowrow rowsep=1entry spanname=descr align=leftDescription/entry + /row +/thead +tbody valign=top + rowentry/entry/row + + rowentry/entry/row + row id=v4l2-vpx-num-partitions + entry spanname=idconstantV4L2_CID_VPX_NUM_PARTITIONS/constantnbsp;/entry + entryenumnbsp;v4l2_vp8_num_partitions/entry + /row + rowentry spanname=descrThe number of token partitions to use in VP8 encoder. +Possible values are:/entry + /row + row + entrytbl spanname=descr cols=2 + tbody valign=top + row + entryconstantV4L2_VPX_1_PARTITION/constantnbsp;/entry + entry1 coefficient partition/entry + /row + row + entryconstantV4L2_VPX_2_PARTITIONS/constantnbsp;/entry + entry2 partitions/entry + /row + row + entryconstantV4L2_VPX_4_PARTITIONS/constantnbsp;/entry + entry4 partitions/entry + /row + row + entryconstantV4L2_VPX_8_PARTITIONS/constantnbsp;/entry + entry8 partitions/entry + /row + /tbody + /entrytbl + /row + + rowentry/entry/row + row + entry spanname=idconstantV4L2_CID_VPX_IMD_DISABLE_4X4/constantnbsp;/entry + entryboolean/entry + /row + rowentry spanname=descrSetting this prevents intra 4x4 mode in the intra mode decision./entry + /row + + rowentry/entry/row + row id=v4l2-vpx-num-ref-frames + entry spanname=idconstantV4L2_CID_VPX_NUM_REF_FRAMES/constantnbsp;/entry + entryenumnbsp;v4l2_vp8_num_ref_frames/entry + /row + rowentry spanname=descrThe number of reference pictures for encoding P frames. +Possible values are:/entry + /row + row + entrytbl spanname=descr cols=2 + tbody valign=top + row + entryconstantV4L2_VPX_1_REF_FRAME/constantnbsp;/entry + entryLast encoded frame will be searched/entry + /row + row + entryconstantV4L2_VPX_2_REF_FRAME/constantnbsp;/entry + entryLast encoded frame and the Golden frame will be searched/entry + /row + /tbody + /entrytbl + /row + + rowentry/entry/row + row + entry spanname=idconstantV4L2_CID_VPX_FILTER_LEVEL/constantnbsp;/entry + entryinteger/entry + /row + rowentry spanname=descrIndicates the loop filter level. The adjustment of loop +filter level is done via a delta value against a baseline loop filter value./entry + /row + + rowentry/entry/row + row + entry spanname=idconstantV4L2_CID_VPX_FILTER_SHARPNESS/constantnbsp;/entry + entryinteger/entry + /row + rowentry spanname=descrThis parameter affects the loop filter. Anything above +zero weakens the deblocking effect on loop filter./entry + /row + + rowentry/entry/row + row +
[PATCH 6/6] [media] s5p-mfc: Add support for VP8 encoder
MFC v7 supports VP8 encoding and this patch adds support for it in the driver. Signed-off-by: Arun Kumar K arun...@samsung.com --- drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c |3 + drivers/media/platform/s5p-mfc/s5p_mfc_common.h | 19 - drivers/media/platform/s5p-mfc/s5p_mfc_enc.c| 88 +++ drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c | 76 4 files changed, 185 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c b/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c index 5708fc3..db796c8 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c @@ -108,6 +108,9 @@ static int s5p_mfc_open_inst_cmd_v6(struct s5p_mfc_ctx *ctx) case S5P_MFC_CODEC_H263_ENC: codec_type = S5P_FIMV_CODEC_H263_ENC_V6; break; + case S5P_MFC_CODEC_VP8_ENC: + codec_type = S5P_FIMV_CODEC_VP8_ENC_V7; + break; default: codec_type = S5P_FIMV_CODEC_NONE_V6; }; diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h index 7281de2..a9d4593 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h @@ -65,7 +65,7 @@ static inline dma_addr_t s5p_mfc_mem_cookie(void *a, void *b) #define MFC_ENC_CAP_PLANE_COUNT1 #define MFC_ENC_OUT_PLANE_COUNT2 #define STUFF_BYTE 4 -#define MFC_MAX_CTRLS 70 +#define MFC_MAX_CTRLS 77 #define S5P_MFC_CODEC_NONE -1 #define S5P_MFC_CODEC_H264_DEC 0 @@ -81,6 +81,7 @@ static inline dma_addr_t s5p_mfc_mem_cookie(void *a, void *b) #define S5P_MFC_CODEC_H264_MVC_ENC 21 #define S5P_MFC_CODEC_MPEG4_ENC22 #define S5P_MFC_CODEC_H263_ENC 23 +#define S5P_MFC_CODEC_VP8_ENC 24 #define S5P_MFC_R2H_CMD_EMPTY 0 #define S5P_MFC_R2H_CMD_SYS_INIT_RET 1 @@ -409,6 +410,21 @@ struct s5p_mfc_mpeg4_enc_params { }; /** + * struct s5p_mfc_vp8_enc_params - encoding parameters for vp8 + */ +struct s5p_mfc_vp8_enc_params { + u8 imd_4x4; + enum v4l2_vp8_num_partitions num_partitions; + enum v4l2_vp8_num_ref_frames num_ref; + u8 filter_level; + u8 filter_sharpness; + u32 golden_frame_ref_period; + enum v4l2_vp8_golden_frame_sel golden_frame_sel; + u8 hier_layer; + u8 hier_layer_qp[3]; +}; + +/** * struct s5p_mfc_enc_params - general encoding parameters */ struct s5p_mfc_enc_params { @@ -442,6 +458,7 @@ struct s5p_mfc_enc_params { struct { struct s5p_mfc_h264_enc_params h264; struct s5p_mfc_mpeg4_enc_params mpeg4; + struct s5p_mfc_vp8_enc_params vp8; } codec; }; diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c index 13799a8..146462d 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c @@ -84,6 +84,13 @@ static struct s5p_mfc_fmt formats[] = { .type = MFC_FMT_ENC, .num_planes = 1, }, + { + .name = VP8 Encoded Stream, + .fourcc = V4L2_PIX_FMT_VP8, + .codec_mode = S5P_MFC_CODEC_VP8_ENC, + .type = MFC_FMT_ENC, + .num_planes = 1, + }, }; #define NUM_FORMATS ARRAY_SIZE(formats) @@ -557,6 +564,62 @@ static struct mfc_control controls[] = { .step = 1, .default_value = 0, }, + { + .id = V4L2_CID_VPX_NUM_PARTITIONS, + .type = V4L2_CTRL_TYPE_MENU, + .minimum = V4L2_VPX_1_PARTITION, + .maximum = V4L2_VPX_8_PARTITIONS, + .default_value = V4L2_VPX_1_PARTITION, + .menu_skip_mask = 0, + }, + { + .id = V4L2_CID_VPX_IMD_DISABLE_4X4, + .type = V4L2_CTRL_TYPE_BOOLEAN, + .minimum = 0, + .maximum = 1, + .step = 1, + .default_value = 0, + }, + { + .id = V4L2_CID_VPX_NUM_REF_FRAMES, + .type = V4L2_CTRL_TYPE_MENU, + .minimum = V4L2_VPX_1_REF_FRAME, + .maximum = V4L2_VPX_2_REF_FRAME, + .default_value = V4L2_VPX_1_REF_FRAME, + .menu_skip_mask = 0, + }, + { + .id = V4L2_CID_VPX_FILTER_LEVEL, + .type = V4L2_CTRL_TYPE_INTEGER, + .minimum = 0, + .maximum = 63, + .step = 1, + .default_value = 0, + }, + { + .id = V4L2_CID_VPX_FILTER_SHARPNESS, + .type = V4L2_CTRL_TYPE_INTEGER, + .minimum = 0, +
[GIT PULL FOR 3.11] Samsung SoC media driver updates
Hi Mauro, This includes mostly cleanups and non-critical bug fixes for The Samsung S3C/S5P/Exynos SoC media drivers, and some prerequisite patches to add support for more DMA interfaces of the Exynos4x12 Imaging Subsystem. There is also included a patch modifying the media link setup notifier, which was needed to handle properly video pipeline reconfiguration at the exynos4-is driver. The following changes since commit ab5060cdb8829c0503b7be2b239b52e9a25063b4: [media] drxk_hard: Remove most 80-cols checkpatch warnings (2013-06-08 22:11:39 -0300) are available in the git repository at: git://linuxtv.org/snawrocki/samsung.git for-v3.11 for you to fetch changes up to e14d355f12f2b6f8466be083d9640cc8483900ba: s5p-tv: Don't ignore return value of regulator_bulk_enable() in hdmi_drv.c (2013-06-10 15:18:24 +0200) Phil Carmody (1): exynos4-is: Simplify bitmask usage Sachin Kamat (10): s3c-camif: Staticize local symbols s3c-camif: Use dev_info instead of printk s5c73m3: Fix whitespace related warnings exynos4-is: Remove redundant NULL check in fimc-lite.c s3c-camif: Remove redundant NULL check s5p-tv: Fix incorrect usage of IS_ERR_OR_NULL in hdmi_drv.c s5p-tv: Fix incorrect usage of IS_ERR_OR_NULL in mixer_drv.c exynos-gsc: Remove redundant use of of_match_ptr macro s5p-mfc: Remove redundant use of of_match_ptr macro exynos4-is: Staticize local symbols Sylwester Nawrocki (23): exynos4-is: Fix example dts in .../bindings/samsung-fimc.txt exynos4-is: Remove platform_device_id table at fimc-lite driver exynos4-is: Correct querycap ioctl handling at fimc-lite driver s5c73m3: Do not ignore errors from regulator_enable() exynos4-is: Move common functions to a separate module exynos4-is: Add struct exynos_video_entity exynos4-is: Preserve state of controls between /dev/video open/close exynos4-is: Media graph/video device locking rework exynos4-is: Do not use asynchronous runtime PM in release fop exynos4-is: Use common exynos_media_pipeline data structure exynos4-is: Remove WARN_ON() from __fimc_pipeline_close() exynos4-is: Fix sensor subdev - FIMC notification setup exynos4-is: Add locking at fimc(-lite) subdev unregistered handler exynos4-is: Remove leftovers of non-dt FIMC-LITE support exynos4-is: Remove unused code exynos4-is: Refactor vidioc_s_fmt, vidioc_try_fmt handlers exynos4-is: Move __fimc_videoc_querycap() function to the common module exynos4-is: Add isp_dbg() macro media: Change media device link_notify behaviour exynos4-is: Extend link_notify handler to support fimc-is/lite pipelines s5p-tv: Don't ignore return value of regulator_enable() in sii9234_drv.c s5p-tv: Do not ignore regulator/clk API return values in sdo_drv.c s5p-tv: Don't ignore return value of regulator_bulk_enable() in hdmi_drv.c Wei Yongjun (1): s5p-tv: fix error return code in mxr_acquire_video() .../devicetree/bindings/media/samsung-fimc.txt | 26 +- drivers/media/i2c/s5c73m3/s5c73m3-core.c |9 +- drivers/media/i2c/s5c73m3/s5c73m3-spi.c|4 +- drivers/media/media-entity.c | 18 +- drivers/media/platform/exynos-gsc/gsc-core.c |2 +- drivers/media/platform/exynos4-is/Kconfig |7 +- drivers/media/platform/exynos4-is/Makefile |5 +- drivers/media/platform/exynos4-is/common.c | 53 +++ drivers/media/platform/exynos4-is/common.h | 16 + drivers/media/platform/exynos4-is/fimc-capture.c | 387 ++-- drivers/media/platform/exynos4-is/fimc-core.c | 11 - drivers/media/platform/exynos4-is/fimc-core.h | 13 +- drivers/media/platform/exynos4-is/fimc-is-i2c.c|2 +- drivers/media/platform/exynos4-is/fimc-is-param.c | 84 +++-- drivers/media/platform/exynos4-is/fimc-is-regs.c |4 +- drivers/media/platform/exynos4-is/fimc-is.c| 12 +- drivers/media/platform/exynos4-is/fimc-is.h|8 +- drivers/media/platform/exynos4-is/fimc-isp.c | 20 +- drivers/media/platform/exynos4-is/fimc-isp.h | 18 +- drivers/media/platform/exynos4-is/fimc-lite-reg.c |2 +- drivers/media/platform/exynos4-is/fimc-lite.c | 138 +++ drivers/media/platform/exynos4-is/fimc-lite.h |8 +- drivers/media/platform/exynos4-is/fimc-m2m.c |1 + drivers/media/platform/exynos4-is/fimc-reg.c |7 +- drivers/media/platform/exynos4-is/media-dev.c | 270 +- drivers/media/platform/exynos4-is/media-dev.h | 54 ++- drivers/media/platform/omap3isp/isp.c | 41 ++- drivers/media/platform/s3c-camif/camif-core.c |6 +- drivers/media/platform/s3c-camif/camif-regs.c |6 +- drivers/media/platform/s5p-mfc/s5p_mfc.c
Re: [PATCH 5/6] [media] V4L: Add VP8 encoder controls
Hi Arun, Some review comments below... On Mon June 10 2013 15:23:05 Arun Kumar K wrote: This patch adds new V4L controls for VP8 encoding. Signed-off-by: Arun Kumar K arun...@samsung.com Signed-off-by: Kiran AVND avnd.ki...@samsung.com --- Documentation/DocBook/media/v4l/controls.xml | 145 ++ drivers/media/v4l2-core/v4l2-ctrls.c | 38 +++ include/uapi/linux/v4l2-controls.h | 30 +- 3 files changed, 212 insertions(+), 1 deletion(-) diff --git a/Documentation/DocBook/media/v4l/controls.xml b/Documentation/DocBook/media/v4l/controls.xml index 8d7a779..db614c7 100644 --- a/Documentation/DocBook/media/v4l/controls.xml +++ b/Documentation/DocBook/media/v4l/controls.xml @@ -4772,4 +4772,149 @@ defines possible values for de-emphasis. Here they are:/entry /table /section + +section id=vpx-controls + titleVPX Control Reference/title + + paraThe VPX control class includes controls for encoding parameters + of VPx video codec./para Are these controls defined by the VPx standard, or are they specific to the Samsung hardware? I am not certain whether a separate class should be created for these. Adding it to the MPEG control class might be a better approach (yes, I know MPEG is a bit of a misnomer, but it already handles other compressions standards as well). + + table pgwide=1 frame=none id=fm-rx-control-id + titleVPX Control IDs/title + + tgroup cols=4 +colspec colname=c1 colwidth=1* / +colspec colname=c2 colwidth=6* / +colspec colname=c3 colwidth=2* / +colspec colname=c4 colwidth=6* / +spanspec namest=c1 nameend=c2 spanname=id / +spanspec namest=c2 nameend=c4 spanname=descr / +thead + row +entry spanname=id align=leftID/entry +entry align=leftType/entry + /rowrow rowsep=1entry spanname=descr align=leftDescription/entry + /row +/thead +tbody valign=top + rowentry/entry/row + + rowentry/entry/row + row id=v4l2-vpx-num-partitions + entry spanname=idconstantV4L2_CID_VPX_NUM_PARTITIONS/constantnbsp;/entry + entryenumnbsp;v4l2_vp8_num_partitions/entry + /row + rowentry spanname=descrThe number of token partitions to use in VP8 encoder. +Possible values are:/entry + /row + row + entrytbl spanname=descr cols=2 + tbody valign=top + row + entryconstantV4L2_VPX_1_PARTITION/constantnbsp;/entry + entry1 coefficient partition/entry + /row + row + entryconstantV4L2_VPX_2_PARTITIONS/constantnbsp;/entry + entry2 partitions/entry + /row + row + entryconstantV4L2_VPX_4_PARTITIONS/constantnbsp;/entry + entry4 partitions/entry + /row + row + entryconstantV4L2_VPX_8_PARTITIONS/constantnbsp;/entry + entry8 partitions/entry + /row + /tbody + /entrytbl + /row + + rowentry/entry/row + row + entry spanname=idconstantV4L2_CID_VPX_IMD_DISABLE_4X4/constantnbsp;/entry + entryboolean/entry + /row + rowentry spanname=descrSetting this prevents intra 4x4 mode in the intra mode decision./entry + /row + + rowentry/entry/row + row id=v4l2-vpx-num-ref-frames + entry spanname=idconstantV4L2_CID_VPX_NUM_REF_FRAMES/constantnbsp;/entry + entryenumnbsp;v4l2_vp8_num_ref_frames/entry + /row + rowentry spanname=descrThe number of reference pictures for encoding P frames. +Possible values are:/entry + /row + row + entrytbl spanname=descr cols=2 + tbody valign=top + row + entryconstantV4L2_VPX_1_REF_FRAME/constantnbsp;/entry + entryLast encoded frame will be searched/entry + /row + row + entryconstantV4L2_VPX_2_REF_FRAME/constantnbsp;/entry + entryLast encoded frame and the Golden frame will be searched/entry + /row + /tbody + /entrytbl + /row + + rowentry/entry/row + row + entry spanname=idconstantV4L2_CID_VPX_FILTER_LEVEL/constantnbsp;/entry + entryinteger/entry + /row + rowentry spanname=descrIndicates the loop filter level. The adjustment of loop +filter level is done via a delta value against a baseline loop filter value./entry +
Re: [PATCH RFC v3 2/3] media: added managed v4l2 control initialization
On Sun June 9 2013 20:05:33 Sylwester Nawrocki wrote: Hi Sakari, On 06/06/2013 11:41 PM, Sakari Ailus wrote: ... diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index ebb8e48..f47ccfa 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -1421,6 +1421,38 @@ void v4l2_ctrl_handler_free(struct v4l2_ctrl_handler *hdl) } EXPORT_SYMBOL(v4l2_ctrl_handler_free); +static void devm_v4l2_ctrl_handler_release(struct device *dev, void *res) +{ + struct v4l2_ctrl_handler **hdl = res; + + v4l2_ctrl_handler_free(*hdl); v4l2_ctrl_handler_free() acquires hdl-mutex which is independent of the existence of hdl. By default hdl-lock is in the handler, but it may also be elsewhere, e.g. in a driver-specific device struct such as struct smiapp_sensor defined in drivers/media/i2c/smiapp/smiapp.h. I wonder if anything guarantees that hdl-mutex still exists at the time the device is removed. If it is a driver-managed lock, then the driver should also be responsible for that lock during the life-time of the control handler. I think that is a fair assumption. Agreed. I have to say I don't think it's neither meaningful to acquire that mutex in v4l2_ctrl_handler_free(), though, since the whole going to be freed next anyway: reference counting would be needed to prevent bad things from happening, in case the drivers wouldn't take care of that. It's probably not meaningful today, but it might become meaningful in the future. And in any case, not taking the lock when manipulating internal lists is very unexpected even though it might work with today's use cases. I simply don't think it's meaningful to acquire a lock related to an object when that object is being destroyed. If something else was holding that lock, you should not have begun destroying that object in the first place. This could be solved by reference counting the handler which I don't think is needed. Right now the way controls are set up is very static, but in the future I expect to see more dynamical behavior (I'm thinking of FPGAs supporting partial reconfiguration). In cases like that it you do want to take the lock preventing others from making modifications while the handler is freed. I am well aware that much more work will have to be done if we want to support such scenarios, but it is one reason why I would like to keep the lock there. I'm ok with that. How about adding a note to the comment above devm_v4l2_ctrl_handler_init() that the function cannot be used with drivers that wish to use their own lock? But wouldn't it be a false statement ? The driver can still control the cleanup sequence by properly ordering the initialization sequence. So as long as it is ensured the mutex is destroyed after the controls handler (IOW, the mutex is created before the controls handler using the devm_* API) everything should be fine, shouldn't it ? It should indeed. I really don't see the problem here. Regards, Hans -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Are there any high fps camera available?
On Fri June 7 2013 16:51:23 Peter Senna Tschudin wrote: Any one know any linux-media compatible camera capable of recording at 480 fps or more? Not to my knowledge. Note that there is no technical reason why such cameras couldn't be supported by linux. Regards, Hans -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 5/6] [media] V4L: Add VP8 encoder controls
Hi Arun, On 06/10/2013 03:23 PM, Arun Kumar K wrote: diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index fccd08b..2cf17d4 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -456,6 +456,23 @@ const char * const *v4l2_ctrl_get_menu(u32 id) RGB full range (0-255), NULL, }; + static const char * const vpx_num_partitions[] = { + 1 partition, + 2 partitions, + 4 partitions, + 8 partitions, + NULL, + }; + static const char * const vpx_num_ref_frames[] = { + 1 reference frame, + 2 reference frame, + NULL, + }; Have you considered using V4L2_CTRL_TYPE_INTEGER_MENU control type for this ? One example is V4L2_CID_ISO_SENSITIVITY control. +/* VPX streams, specific to multiplexed streams */ +#define V4L2_CID_VPX_NUM_PARTITIONS (V4L2_CID_VPX_BASE+0) +enum v4l2_vp8_num_partitions { + V4L2_VPX_1_PARTITION= 0, + V4L2_VPX_2_PARTITIONS = (1 1), + V4L2_VPX_4_PARTITIONS = (1 2), + V4L2_VPX_8_PARTITIONS = (1 3), +}; I think we could still have such standard value definitions if needed, but rather in form of: #define V4L2_VPX_1_PARTITION1 #define V4L2_VPX_2_PARTITIONS 2 #define V4L2_VPX_4_PARTITIONS 4 #define V4L2_VPX_8_PARTITIONS 8 +#define V4L2_CID_VPX_IMD_DISABLE_4X4 (V4L2_CID_VPX_BASE+1) +#define V4L2_CID_VPX_NUM_REF_FRAMES (V4L2_CID_VPX_BASE+2) +enum v4l2_vp8_num_ref_frames { + V4L2_VPX_1_REF_FRAME= 0, + V4L2_VPX_2_REF_FRAME= 1, +}; 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 2/2] Print parser position on error
Hi Sascha, I'm sorry for the late reply. Great patch set, thank you. It's very helpful. On Wednesday 08 May 2013 15:27:54 Sascha Hauer wrote: Most parser functions take a **endp argument to indicate the caller where parsing has stopped. This is currently only used after parsing something successfully. This patch sets **endp to the erroneous position in the error case and prints its position after an error has occured. Signed-off-by: Sascha Hauer s.ha...@pengutronix.de --- src/mediactl.c | 48 +--- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/src/mediactl.c b/src/mediactl.c index c65de50..04ade15 100644 --- a/src/mediactl.c +++ b/src/mediactl.c @@ -40,6 +40,22 @@ #include mediactl.h #include tools.h +void media_print_streampos(struct media_device *media, const char *p, const char *end) The function can be static. +{ + int pos; + + pos = end - p + 1; + + if (pos 0) + pos = 0; + if (pos strlen(p)) + pos = strlen(p); + + media_dbg(media, \n); + media_dbg(media, %s\n, p); + media_dbg(media, %*s\n, pos, ^); +} + struct media_pad *media_entity_remote_source(struct media_pad *pad) { unsigned int i; @@ -538,12 +554,16 @@ struct media_pad *media_parse_pad(struct media_device *media, if (*p == '') { for (end = (char *)p + 1; *end *end != ''; ++end); if (*end != '') { + if (endp) + *endp = (char *)end; No need to cast to a char * here, end is already a char *. What would you think about adding + /* endp can be NULL. To avoid spreading NULL checks across the +* function, set endp to end in that case. +*/ + if (endp == NULL) + endp = end; at the beginning of the function and removing the endp NULL checks that are spread across the code below ? media_dbg(media, missing matching '\'\n); return NULL; } entity = media_get_entity_by_name(media, p + 1, end - p - 1); if (entity == NULL) { + if (endp) + *endp = (char *)p + 1; media_dbg(media, no such entity \%.*s\\n, end - p - 1, p + 1); return NULL; } @@ -553,6 +573,8 @@ struct media_pad *media_parse_pad(struct media_device *media, entity_id = strtoul(p, end, 10); entity = media_get_entity_by_id(media, entity_id); if (entity == NULL) { + if (endp) + *endp = (char *)p; media_dbg(media, no such entity %d\n, entity_id); return NULL; } @@ -560,6 +582,8 @@ struct media_pad *media_parse_pad(struct media_device *media, for (; isspace(*end); ++end); if (*end != ':') { + if (endp) + *endp = end; media_dbg(media, Expected ':'\n, *end); return NULL; } @@ -569,6 +593,8 @@ struct media_pad *media_parse_pad(struct media_device *media, pad = strtoul(p, end, 10); if (pad = entity-info.pads) { + if (endp) + *endp = (char *)p; media_dbg(media, No pad '%d' on entity \%s\. Maximum pad number is %d\n, pad, entity-info.name, entity-info.pads - 1); return NULL; @@ -591,10 +617,15 @@ struct media_link *media_parse_link(struct media_device *media, char *end; source = media_parse_pad(media, p, end); - if (source == NULL) + if (source == NULL) { + if (endp) + *endp = end; The endp argument to media_parse_link() and media_parse_setup_link() is mandatory, there's no need to test it. If you're fine with those modifications there's no need to resubmit the code, I'll fix it while applying. return NULL; + } if (end[0] != '-' || end[1] != '') { + if (endp) + *endp = end; media_dbg(media, Expected '-'\n); return NULL; } @@ -602,8 +633,11 @@ struct media_link *media_parse_link(struct media_device *media, p = end + 2; sink = media_parse_pad(media, p, end); - if (sink == NULL) + if (sink == NULL) { + if (endp) + *endp = end; return NULL; + } *endp = end; @@ -629,6 +663,8 @@ int media_parse_setup_link(struct media_device *media, link = media_parse_link(media, p, end); if (link == NULL) { + if (endp) + *endp = end; media_dbg(media, %s: Unable to parse link\n, __func__); return -EINVAL; @@ -636,6 +672,8 @@ int media_parse_setup_link(struct media_device *media,
Re: [RFC PATCH v2 0/2] Media entity links handling
Hi Laurent, On 06/09/2013 10:23 PM, Laurent Pinchart wrote: Hi Sylwester, On Sunday 09 June 2013 21:41:37 Sylwester Nawrocki wrote: Hi All, This small patch set adds a function for removing all links at a media entity. I found out such a function is needed when media entites that belong to a single media device have drivers in different kernel modules. This means virtually all camera drivers, since sensors are separate modules from the host interface drivers. More details can be found at each patch's description. The patches look good to me. Thanks, I would push v3 upstream if everyone agrees. I think there is further work to be done, to allow the media entities race-free access to their parent media device and the graph mutex. For example, entity-parent-graph_mutex is needed to access entity-stream_count in a subdev driver, but for that it needs to be ensured that entity-parent doesn't change unexpectedly. The links removal from a media entity is rather strightforward, but when and where links should be created/removed is not immediately clear to me. I assumed that links should normally be created/removed when an entity is registered to its media device, with the graph mutex held. I'm open to opinions whether it's good or not and possibly suggestions on how those issues could be handled differently. It's a very good question. So far links were created at initialization time and assumed to stay until the device gets torn down. Existing drivers thus access the links without holding the graph mutex. An easy solution to fix race conditions at link creation time would be to take the graph mutex in media_entity_create_link(). We will still have to fix drivers to take the mutex when accessing links, I don't think there's a way around that. We also need to precisely define what the graph mutex protects and how drivers can access links and entities. This will become especially important when the media controller framework will be used in DRM/KMS. I agree with that. Clear and documented semantics of the graph mutex is essential. And it all really seems required for proper subdevs hotplugging, deferred probing support etc. 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
[RFC PATCH v3 0/2] Media entity links handling
Hi, This is an updated version of the patch set http://www.spinics.net/lists/linux-media/msg64536.html Comparing to v2 it includes improvements of the __media_entity_remove_links() function, thanks to Sakari. The cover letter of v2 is included below. This small patch set adds a function for removing all links at a media entity. I found out such a function is needed when media entites that belong to a single media device have drivers in different kernel modules. This means virtually all camera drivers, since sensors are separate modules from the host interface drivers. More details can be found at each patch's description. The links removal from a media entity is rather strightforward, but when and where links should be created/removed is not immediately clear to me. I assumed that links should normally be created/removed when an entity is registered to its media device, with the graph mutex held. I'm open to opinions whether it's good or not and possibly suggestions on how those issues could be handled differently. The changes since original version are listed in patch 1/2, in patch 2/2 only the commit description has changed slightly. Thanks, Sylwester Sylwester Nawrocki (2): media: Add a function removing all links of a media entity V4L: Remove all links of a media entity when unregistering subdev drivers/media/media-entity.c | 50 + drivers/media/v4l2-core/v4l2-device.c |4 ++- include/media/media-entity.h |3 ++ 3 files changed, 56 insertions(+), 1 deletion(-) -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC PATCH v3 1/2] media: Add a function removing all links of a media entity
This function allows to remove all media entity's links to other entities, leaving no references to a media entity's links array at its remote entities. Currently, when a driver of some entity is removed it will free its media entities links[] array, leaving dangling pointers at other entities that are part of same media graph. This is troublesome when drivers of a media device entities are in separate kernel modules, removing only some modules will leave others in an incorrect state. This function is intended to be used when an entity is being unregistered from a media device. With an assumption that normally the media links should be created between media entities registered to a media device, with the graph mutex held. Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com Reviewed-by: Andrzej Hajda a.ha...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com --- Changes since v2: - removed caching of remote-num_links, re-added rlink local variable, - refactored the loop iterating the remote entity links array. Changes since v1: - couple code improvements like variable localization, type change, etc. - removed WARN_ON_ONCE() to avoid warnings when the media_entity_remove_links() function is called from within remove() callback of a driver of subdev which has not yet been registered to the media device, e.g. due to deferred probing, with a call stack like - remove() - v4l2_device_unregister_subdev() - media_entity_remove_links() --- drivers/media/media-entity.c | 50 ++ include/media/media-entity.h |3 +++ 2 files changed, 53 insertions(+) diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c index 0438209..4f436f1 100644 --- a/drivers/media/media-entity.c +++ b/drivers/media/media-entity.c @@ -429,6 +429,56 @@ media_entity_create_link(struct media_entity *source, u16 source_pad, } EXPORT_SYMBOL_GPL(media_entity_create_link); +void __media_entity_remove_links(struct media_entity *entity) +{ + unsigned int i; + + for (i = 0; i entity-num_links; i++) { + struct media_link *link = entity-links[i]; + struct media_entity *remote; + unsigned int r = 0; + + if (link-source-entity == entity) + remote = link-sink-entity; + else + remote = link-source-entity; + + while (r remote-num_links) { + struct media_link *rlink = remote-links[r]; + + if (rlink != link-reverse) { + r++; + continue; + } + + if (link-source-entity == entity) + remote-num_backlinks--; + + if (--remote-num_links == 0) + break; + + /* Insert last entry in place of the dropped link. */ + *rlink = remote-links[remote-num_links]; + } + } + + entity-num_links = 0; + entity-num_backlinks = 0; +} +EXPORT_SYMBOL_GPL(__media_entity_remove_links); + +void media_entity_remove_links(struct media_entity *entity) +{ + /* Do nothing if the entity is not registered. */ + if (entity-parent == NULL) + return; + + mutex_lock(entity-parent-graph_mutex); + __media_entity_remove_links(entity); + mutex_lock(entity-parent-graph_mutex); +} +EXPORT_SYMBOL_GPL(media_entity_remove_links); + static int __media_entity_setup_link_notify(struct media_link *link, u32 flags) { int ret; diff --git a/include/media/media-entity.h b/include/media/media-entity.h index 4eefedc..06bacf9 100644 --- a/include/media/media-entity.h +++ b/include/media/media-entity.h @@ -128,6 +128,9 @@ void media_entity_cleanup(struct media_entity *entity); int media_entity_create_link(struct media_entity *source, u16 source_pad, struct media_entity *sink, u16 sink_pad, u32 flags); +void __media_entity_remove_links(struct media_entity *entity); +void media_entity_remove_links(struct media_entity *entity); + int __media_entity_setup_link(struct media_link *link, u32 flags); int media_entity_setup_link(struct media_link *link, u32 flags); struct media_link *media_entity_find_link(struct media_pad *source, -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC PATCH v3 2/2] V4L: Remove all links of a media entity when unregistering subdev
Remove all links of the subdev's media entity after internal_ops 'unregistered' call and right before unregistering the entity from a media device. It is assumed here that an unregistered (orphan) media entity cannot have links to other entities registered to a media device. It is also assumed the media links should be created/removed with the media graph's mutex held. The above implies that the caller of v4l2_device_unregister_subdev() must not hold the graph's mutex. Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com Reviewed-by: Andrzej Hajda a.ha...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com --- drivers/media/v4l2-core/v4l2-device.c |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/v4l2-device.c b/drivers/media/v4l2-core/v4l2-device.c index 8ed5da2..2dbfebc 100644 --- a/drivers/media/v4l2-core/v4l2-device.c +++ b/drivers/media/v4l2-core/v4l2-device.c @@ -269,8 +269,10 @@ void v4l2_device_unregister_subdev(struct v4l2_subdev *sd) sd-v4l2_dev = NULL; #if defined(CONFIG_MEDIA_CONTROLLER) - if (v4l2_dev-mdev) + if (v4l2_dev-mdev) { + media_entity_remove_links(sd-entity); media_device_unregister_entity(sd-entity); + } #endif video_unregister_device(sd-devnode); module_put(sd-owner); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC PATCH v3 0/2] Media entity links handling
This is an updated version of the patch set http://www.spinics.net/lists/linux-media/msg64536.html Comparing to v2 it includes improvements of the __media_entity_remove_links() function, thanks to Sakari. The cover letter of v2 is included below. This small patch set adds a function for removing all links at a media entity. I found out such a function is needed when media entites that belong to a single media device have drivers in different kernel modules. This means virtually all camera drivers, since sensors are separate modules from the host interface drivers. More details can be found at each patch's description. The links removal from a media entity is rather strightforward, but when and where links should be created/removed is not immediately clear to me. I assumed that links should normally be created/removed when an entity is registered to its media device, with the graph mutex held. I'm open to opinions whether it's good or not and possibly suggestions on how those issues could be handled differently. The changes since original version are listed in patch 1/2, in patch 2/2 only the commit description has changed slightly. Thanks, Sylwester Sylwester Nawrocki (2): media: Add a function removing all links of a media entity V4L: Remove all links of a media entity when unregistering subdev drivers/media/media-entity.c | 50 + drivers/media/v4l2-core/v4l2-device.c |4 ++- include/media/media-entity.h |3 ++ 3 files changed, 56 insertions(+), 1 deletion(-) -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: rtl28xxu IR remote
Hi, I just compiled and tested Antti Palosaari branch and can confirm the remote works for my RTL2832U. I have updated the wiki[1] entry with the steps necessary to configure the remote control. Please confirm if these fixes your problem. Thanks, but I can't confirm if this fixes my problem, because the modules I obtain building Antti's branch are not compatible with my existing kernel, so I can't test them (modprobe --force fails, and using a brand new kernel would be too much work on Tinycore at the moment). On the other hand, I tried the sources fromgit://linuxtv.org/media_build.git, first with manual patches and then (when the latter got accepted) without them. But the ir remote does not work. I think Antti's repo and patching linuxtv repo should lead to the same results, right? -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] [media] usbtv: Add driver for Fushicai USBTV007 video frame grabber
On Mon, 2013-06-10 at 13:05 +0200, Hans Verkuil wrote: Also, I the hardware uses V4L2_FIELD_ALTERNATE interlacing, but I couldn't make it work, What didn't work exactly? Both mplayer and gstream v4l2src displayed only half of an image. Not sure which combinations of flags did I use anymore. +static int usbtv_queryctrl(struct file *file, void *priv, + struct v4l2_queryctrl *ctrl) +{ + return -EINVAL; +} Drop this ioctl. If it doesn't do anything, then don't specify it. It actually does something; EINVAL here for any ctrl signals there's zero controls. When undefined, ENOTTY that is returned is considered invalid by gstreamer source. It doesn't look too bad :-) You're using all the latest frameworks which is excellent. Thanks for your time. I'll follow up with a new version that aims to address all the concerns above (apart for the queryctl change, which would break with gstreamer). Can you run the v4l2-compliance tool and post the output of that tool? Driver Info: Driver name : usbtv Card type : usbtv Bus info : usb-:00:1d.7-5 Driver version: 3.10.0 Capabilities : 0x8501 Video Capture Read/Write Streaming Device Capabilities Device Caps : 0x0501 Video Capture Read/Write Streaming Compliance test for device /dev/video1 (not using libv4l2): Required ioctls: test VIDIOC_QUERYCAP: OK Allow for multiple opens: test second video open: OK test VIDIOC_QUERYCAP: OK test VIDIOC_G/S_PRIORITY: OK Debug ioctls: test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) test VIDIOC_LOG_STATUS: OK (Not Supported) Input ioctls: test VIDIOC_G/S_TUNER: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported) test VIDIOC_G/S/ENUMINPUT: OK test VIDIOC_G/S_AUDIO: OK (Not Supported) Inputs: 1 Audio Inputs: 0 Tuners: 0 Output ioctls: test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported) Outputs: 0 Audio Outputs: 0 Modulators: 0 Control ioctls: test VIDIOC_QUERYCTRL/MENU: OK test VIDIOC_G/S_CTRL: OK (Not Supported) test VIDIOC_G/S/TRY_EXT_CTRLS: OK (Not Supported) test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK (Not Supported) test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 0 Private Controls: 0 Input/Output configuration ioctls: test VIDIOC_ENUM/G/S/QUERY_STD: OK test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported) Format ioctls: test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK test VIDIOC_G/S_PARM: OK test VIDIOC_G_FBUF: OK (Not Supported) test VIDIOC_G_FMT: OK test VIDIOC_TRY_FMT: OK test VIDIOC_S_FMT: OK test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) Codec ioctls: test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported) Buffer ioctls: test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK Total: 36, Succeeded: 36, Failed: 0, Warnings: 0 -- Lubomir Rintel lkund...@v3.sk -- 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] [media] usbtv: Add driver for Fushicai USBTV007 video frame grabber
Reverse-engineered driver for cheapo video digitizer, made from observations of Windows XP driver. The protocol is not yet completely understood, so far we don't provide any controls, only support a single format out of three and don't support the audio device. Signed-off-by: Lubomir Rintel lkund...@v3.sk Cc: Mauro Carvalho Chehab mche...@redhat.com Cc: linux-ker...@vger.kernel.org Cc: linux-media@vger.kernel.org --- Changes for v2: - Fix a typo in comment - Make prototype register settings static const - Solve parity calculation weirdness - Attempt to fix interlacing - Add timestamp to frames - [v4l2-compliance] Set pix format priv to 0 - Drop usbtv_*_fmt_vid_cap code duplication - [v4l2-compliance] Add vidioc_create_bufs - [v4l2-compliance] Use file handle priorities - Drop Driver from initial dev_info drivers/media/usb/Kconfig|1 + drivers/media/usb/Makefile |1 + drivers/media/usb/usbtv/Kconfig | 10 + drivers/media/usb/usbtv/Makefile |1 + drivers/media/usb/usbtv/usbtv.c | 715 ++ 5 files changed, 728 insertions(+), 0 deletions(-) create mode 100644 drivers/media/usb/usbtv/Kconfig create mode 100644 drivers/media/usb/usbtv/Makefile create mode 100644 drivers/media/usb/usbtv/usbtv.c diff --git a/drivers/media/usb/Kconfig b/drivers/media/usb/Kconfig index 0a7d520..8e10267 100644 --- a/drivers/media/usb/Kconfig +++ b/drivers/media/usb/Kconfig @@ -17,6 +17,7 @@ source drivers/media/usb/zr364xx/Kconfig source drivers/media/usb/stkwebcam/Kconfig source drivers/media/usb/s2255/Kconfig source drivers/media/usb/sn9c102/Kconfig +source drivers/media/usb/usbtv/Kconfig endif if MEDIA_ANALOG_TV_SUPPORT diff --git a/drivers/media/usb/Makefile b/drivers/media/usb/Makefile index 7f51d7e..0935f47 100644 --- a/drivers/media/usb/Makefile +++ b/drivers/media/usb/Makefile @@ -20,3 +20,4 @@ obj-$(CONFIG_VIDEO_STK1160) += stk1160/ obj-$(CONFIG_VIDEO_CX231XX) += cx231xx/ obj-$(CONFIG_VIDEO_TM6000) += tm6000/ obj-$(CONFIG_VIDEO_EM28XX) += em28xx/ +obj-$(CONFIG_VIDEO_USBTV) += usbtv/ diff --git a/drivers/media/usb/usbtv/Kconfig b/drivers/media/usb/usbtv/Kconfig new file mode 100644 index 000..8864436 --- /dev/null +++ b/drivers/media/usb/usbtv/Kconfig @@ -0,0 +1,10 @@ +config VIDEO_USBTV +tristate USBTV007 video capture support +depends on VIDEO_DEV +select VIDEOBUF2_VMALLOC + +---help--- + This is a video4linux2 driver for USBTV007 based video capture devices. + + To compile this driver as a module, choose M here: the + module will be called usbtv diff --git a/drivers/media/usb/usbtv/Makefile b/drivers/media/usb/usbtv/Makefile new file mode 100644 index 000..28b872f --- /dev/null +++ b/drivers/media/usb/usbtv/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_VIDEO_USBTV) += usbtv.o diff --git a/drivers/media/usb/usbtv/usbtv.c b/drivers/media/usb/usbtv/usbtv.c new file mode 100644 index 000..c2a02c2 --- /dev/null +++ b/drivers/media/usb/usbtv/usbtv.c @@ -0,0 +1,715 @@ +/* + * Fushicai USBTV007 Video Grabber Driver + * + * Product web site: + * http://www.fushicai.com/products_detail/productId=d05449ee-b690-42f9-a661-aa7353894bed.html + * + * Following LWN articles were very useful in construction of this driver: + * Video4Linux2 API series: http://lwn.net/Articles/203924/ + * videobuf2 API explanation: http://lwn.net/Articles/447435/ + * Thanks go to Jonathan Corbet for providing this quality documentation. + * He is awesome. + * + * Copyright (c) 2013 Lubomir Rintel + * All rights reserved. + * No physical hardware was harmed running Windows during the + * reverse-engineering activity + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions, and the following disclaimer, + *without modification. + * 2. The name of the author may not be used to endorse or promote products + *derived from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License (GPL). + */ + +#include linux/init.h +#include linux/list.h +#include linux/module.h +#include linux/slab.h +#include linux/usb.h +#include linux/version.h +#include linux/videodev2.h + +#include media/v4l2-device.h +#include media/v4l2-ioctl.h +#include media/videobuf2-core.h +#include media/videobuf2-vmalloc.h + +/* Hardware. */ +#define USBTV_VIDEO_ENDP 0x81 +#define USBTV_BASE 0xc000 +#define USBTV_REQUEST_REG 12 + +/* Number of concurrent isochronous urbs submitted. + * Higher numbers was seen to overly saturate the USB bus. */ +#define USBTV_ISOC_TRANSFERS 16 +#define USBTV_ISOC_PACKETS 8 + +#define USBTV_WIDTH720 +#define USBTV_HEIGHT
Re: rtl28xxu IR remote
On 06/10/2013 06:09 PM, marco caminati wrote: Hi, I just compiled and tested Antti Palosaari branch and can confirm the remote works for my RTL2832U. I have updated the wiki[1] entry with the steps necessary to configure the remote control. Please confirm if these fixes your problem. Thanks, but I can't confirm if this fixes my problem, because the modules I obtain building Antti's branch are not compatible with my existing kernel, so I can't test them (modprobe --force fails, and using a brand new kernel would be too much work on Tinycore at the moment). On the other hand, I tried the sources fromgit://linuxtv.org/media_build.git, first with manual patches and then (when the latter got accepted) without them. But the ir remote does not work. I think Antti's repo and patching linuxtv repo should lead to the same results, right? I think the most easiest way could be compile install whole Kernel from my tree. It is 3.10-rc4 + some fixes. media_build.git has also option to fetch developer git tree from linuxtv.org. Something like ./build --git git://linuxtv.org/anttip/media_tree.git rtl28xxu . That approach seem to be not documented on wiki: http://linuxtv.org/wiki/index.php/How_to_Obtain,_Build_and_Install_V4L-DVB_Device_Drivers regards Antti -- http://palosaari.fi/ -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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 Jun 10 19:00:18 CEST 2013 git branch: test git hash: ab5060cdb8829c0503b7be2b239b52e9a25063b4 gcc version:i686-linux-gcc (GCC) 4.8.0 host hardware: x86_64 host os:3.8-3.slh.2-amd64 linux-git-arm-davinci: OK linux-git-arm-exynos: WARNINGS linux-git-arm-omap: WARNINGS linux-git-blackfin: WARNINGS linux-git-i686: OK linux-git-m32r: OK linux-git-mips: OK linux-git-powerpc64: OK linux-git-sh: OK linux-git-x86_64: OK linux-2.6.31.14-i686: WARNINGS linux-2.6.32.27-i686: WARNINGS linux-2.6.33.7-i686: WARNINGS linux-2.6.34.7-i686: WARNINGS linux-2.6.35.9-i686: WARNINGS linux-2.6.36.4-i686: WARNINGS linux-2.6.37.6-i686: WARNINGS linux-2.6.38.8-i686: WARNINGS linux-2.6.39.4-i686: WARNINGS linux-3.0.60-i686: WARNINGS linux-3.10-rc1-i686: WARNINGS linux-3.1.10-i686: WARNINGS linux-3.2.37-i686: WARNINGS linux-3.3.8-i686: WARNINGS linux-3.4.27-i686: WARNINGS linux-3.5.7-i686: WARNINGS linux-3.6.11-i686: WARNINGS linux-3.7.4-i686: WARNINGS linux-3.8-i686: WARNINGS linux-3.9.2-i686: WARNINGS linux-2.6.31.14-x86_64: WARNINGS linux-2.6.32.27-x86_64: WARNINGS linux-2.6.33.7-x86_64: WARNINGS linux-2.6.34.7-x86_64: WARNINGS linux-2.6.35.9-x86_64: WARNINGS linux-2.6.36.4-x86_64: WARNINGS linux-2.6.37.6-x86_64: WARNINGS linux-2.6.38.8-x86_64: WARNINGS linux-2.6.39.4-x86_64: WARNINGS linux-3.0.60-x86_64: WARNINGS linux-3.10-rc1-x86_64: WARNINGS linux-3.1.10-x86_64: WARNINGS linux-3.2.37-x86_64: WARNINGS linux-3.3.8-x86_64: WARNINGS linux-3.4.27-x86_64: WARNINGS linux-3.5.7-x86_64: WARNINGS linux-3.6.11-x86_64: WARNINGS linux-3.7.4-x86_64: WARNINGS linux-3.8-x86_64: WARNINGS linux-3.9.2-x86_64: WARNINGS apps: WARNINGS spec-git: OK sparse: ERRORS Detailed results are available here: http://www.xs4all.nl/~hverkuil/logs/Monday.log Full logs are available here: http://www.xs4all.nl/~hverkuil/logs/Monday.tar.bz2 The Media Infrastructure API from this daily build is here: http://www.xs4all.nl/~hverkuil/spec/media.html -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [REVIEW PATCH 8/9] f_uvc: use v4l2_dev instead of the deprecated parent field.
Hi Hans, Thanks for the patch. On Monday 10 June 2013 14:48:37 Hans Verkuil wrote: From: Hans Verkuil hans.verk...@cisco.com Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/usb/gadget/f_uvc.c |8 +++- drivers/usb/gadget/uvc.h |2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/f_uvc.c b/drivers/usb/gadget/f_uvc.c index 38dcedd..762e82f 100644 --- a/drivers/usb/gadget/f_uvc.c +++ b/drivers/usb/gadget/f_uvc.c @@ -413,7 +413,7 @@ uvc_register_video(struct uvc_device *uvc) if (video == NULL) return -ENOMEM; - video-parent = cdev-gadget-dev; + video-v4l2_dev = uvc-v4l2_dev; video-fops = uvc_v4l2_fops; video-release = video_device_release; strlcpy(video-name, cdev-gadget-name, sizeof(video-name)); @@ -570,6 +570,7 @@ uvc_function_unbind(struct usb_configuration *c, struct usb_function *f) INFO(cdev, uvc_function_unbind\n); video_unregister_device(uvc-vdev); + v4l2_device_unregister(uvc-v4l2_dev); uvc-control_ep-driver_data = NULL; uvc-video.ep-driver_data = NULL; @@ -697,6 +698,11 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f) if ((ret = usb_function_deactivate(f)) 0) goto error; + if (v4l2_device_register(cdev-gadget-dev, uvc-v4l2_dev)) { + printk(KERN_INFO v4l2_device_register failed\n); + goto error; + } + /* Initialise video. */ ret = uvc_video_init(uvc-video); if (ret 0) Shouldn't you add the corresponding cleanup code in the error path at the end of the function ? diff --git a/drivers/usb/gadget/uvc.h b/drivers/usb/gadget/uvc.h index 817e9e1..7a9111d 100644 --- a/drivers/usb/gadget/uvc.h +++ b/drivers/usb/gadget/uvc.h @@ -57,6 +57,7 @@ struct uvc_event #include linux/videodev2.h #include linux/version.h #include media/v4l2-fh.h +#include media/v4l2-device.h #include uvc_queue.h @@ -145,6 +146,7 @@ enum uvc_state struct uvc_device { struct video_device *vdev; + struct v4l2_device v4l2_dev; enum uvc_state state; struct usb_function func; struct uvc_video video; -- 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: [REVIEW PATCH 9/9] v4l2: remove parent from v4l2 core.
Hi Hans, Thanks for the patch. On Monday 10 June 2013 14:48:38 Hans Verkuil wrote: From: Hans Verkuil hans.verk...@cisco.com Signed-off-by: Hans Verkuil hans.verk...@cisco.com Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/v4l2-core/v4l2-dev.c | 34 ++ drivers/media/v4l2-core/v4l2-ioctl.c |7 +-- include/media/v4l2-dev.h |2 -- 3 files changed, 16 insertions(+), 27 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c index 2f3fac5..61e82f8 100644 --- a/drivers/media/v4l2-core/v4l2-dev.c +++ b/drivers/media/v4l2-core/v4l2-dev.c @@ -495,8 +495,8 @@ static const struct file_operations v4l2_fops = { }; /** - * get_index - assign stream index number based on parent device - * @vdev: video_device to assign index number to, vdev-parent should be assigned + * get_index - assign stream index number based on v4l2_dev + * @vdev: video_device to assign index number to, vdev-v4l2_dev should be assigned * * Note that when this is called the new device has not yet been registered * in the video_device array, but it was able to obtain a minor number. @@ -514,15 +514,11 @@ static int get_index(struct video_device *vdev) static DECLARE_BITMAP(used, VIDEO_NUM_DEVICES); int i; - /* Some drivers do not set the parent. In that case always return 0. */ - if (vdev-parent == NULL) - return 0; - bitmap_zero(used, VIDEO_NUM_DEVICES); for (i = 0; i VIDEO_NUM_DEVICES; i++) { if (video_device[i] != NULL - video_device[i]-parent == vdev-parent) { + video_device[i]-v4l2_dev == vdev-v4l2_dev) { set_bit(video_device[i]-index, used); } } @@ -776,6 +772,9 @@ int __video_register_device(struct video_device *vdev, int type, int nr, /* the release callback MUST be present */ if (WARN_ON(!vdev-release)) return -EINVAL; + /* the v4l2_dev pointer MUST be present */ + if (WARN_ON(!vdev-v4l2_dev)) + return -EINVAL; /* v4l2_fh support */ spin_lock_init(vdev-fh_lock); @@ -803,16 +802,13 @@ int __video_register_device(struct video_device *vdev, int type, int nr, vdev-vfl_type = type; vdev-cdev = NULL; - if (vdev-v4l2_dev) { - if (vdev-v4l2_dev-dev) - vdev-parent = vdev-v4l2_dev-dev; - if (vdev-ctrl_handler == NULL) - vdev-ctrl_handler = vdev-v4l2_dev-ctrl_handler; - /* If the prio state pointer is NULL, then use the v4l2_device -prio state. */ - if (vdev-prio == NULL) - vdev-prio = vdev-v4l2_dev-prio; - } + + if (vdev-ctrl_handler == NULL) + vdev-ctrl_handler = vdev-v4l2_dev-ctrl_handler; + /* If the prio state pointer is NULL, then use the v4l2_device +prio state. */ + if (vdev-prio == NULL) + vdev-prio = vdev-v4l2_dev-prio; /* Part 2: find a free minor, device node number and device index. */ #ifdef CONFIG_VIDEO_FIXED_MINOR_RANGES @@ -897,8 +893,8 @@ int __video_register_device(struct video_device *vdev, int type, int nr, /* Part 4: register the device with sysfs */ vdev-dev.class = video_class; vdev-dev.devt = MKDEV(VIDEO_MAJOR, vdev-minor); - if (vdev-parent) - vdev-dev.parent = vdev-parent; + if (vdev-v4l2_dev-dev) + vdev-dev.parent = vdev-v4l2_dev-dev; dev_set_name(vdev-dev, %s%d, name_base, vdev-num); ret = device_register(vdev-dev); if (ret 0) { diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 19e2988..3dcdaa3 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1845,12 +1845,7 @@ static int v4l_dbg_g_chip_info(const struct v4l2_ioctl_ops *ops, p-flags |= V4L2_CHIP_FL_WRITABLE; if (ops-vidioc_g_register) p-flags |= V4L2_CHIP_FL_READABLE; - if (vfd-v4l2_dev) - strlcpy(p-name, vfd-v4l2_dev-name, sizeof(p-name)); - else if (vfd-parent) - strlcpy(p-name, vfd-parent-driver-name, sizeof(p-name)); - else - strlcpy(p-name, bridge, sizeof(p-name)); + strlcpy(p-name, vfd-v4l2_dev-name, sizeof(p-name)); if (ops-vidioc_g_chip_info) return ops-vidioc_g_chip_info(file, fh, arg); if (p-match.addr) diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h index b2c3776..4d10e66 100644 --- a/include/media/v4l2-dev.h +++ b/include/media/v4l2-dev.h @@ -96,8 +96,6 @@ struct video_device struct device dev; /* v4l device */ struct cdev *cdev; /*
[PATCH] [media] ttusb-budget: fix memory leak in ttusb_probe()
If something goes wrong starting from i2c_add_adapter(), ttusb-iso_urb[] and ttusb itself are not deallocated. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov khoroshi...@ispras.ru --- drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c index 21b9049..f8a60c1 100644 --- a/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c +++ b/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c @@ -1768,6 +1768,8 @@ err_i2c_del_adapter: i2c_del_adapter(ttusb-i2c_adap); err_unregister_adapter: dvb_unregister_adapter (ttusb-adapter); + ttusb_free_iso_urbs(ttusb); + kfree(ttusb); return result; } -- 1.8.1.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] [media] usbvision-video: fix memory leak of alt_max_pkt_size
1. usbvision-alt_max_pkt_size is not deallocated anywhere. 2. if allocation of usbvision-alt_max_pkt_size fails, there is no proper deallocation of already acquired resources. The patch adds kfree(usbvision-alt_max_pkt_size) to usbvision_release() as soon as other deallocations happen there. It calls usbvision_release() if allocation of usbvision-alt_max_pkt_size fails as soon as usbvision_release() is safe to work with incompletely initialized usbvision structure. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov khoroshi...@ispras.ru --- drivers/media/usb/usbvision/usbvision-video.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/usb/usbvision/usbvision-video.c b/drivers/media/usb/usbvision/usbvision-video.c index d34c2af..443e783 100644 --- a/drivers/media/usb/usbvision/usbvision-video.c +++ b/drivers/media/usb/usbvision/usbvision-video.c @@ -1459,6 +1459,7 @@ static void usbvision_release(struct usb_usbvision *usbvision) usbvision_remove_sysfs(usbvision-vdev); usbvision_unregister_video(usbvision); + kfree(usbvision-alt_max_pkt_size); usb_free_urb(usbvision-ctrl_urb); @@ -1574,6 +1575,7 @@ static int usbvision_probe(struct usb_interface *intf, usbvision-alt_max_pkt_size = kmalloc(32 * usbvision-num_alt, GFP_KERNEL); if (usbvision-alt_max_pkt_size == NULL) { dev_err(intf-dev, usbvision: out of memory!\n); + usbvision_release(usbvision); return -ENOMEM; } -- 1.8.1.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html