Re: [RFC] [Patch] implement video driver for sur40
On Fri, 19 Dec 2014, Hans Verkuil wrote: drivers/media remains under heavy development, so for video capture drivers like yours you should always patch against either the mainline linux tree or (preferred) the media_tree.git repo (git://linuxtv.org/media_tree.git, master branch). As per your suggestion, I've switched development to 3.18, and now I'm nearly there in terms of v4l2-compliance (also see attachment). There's only one failing test left, which is this one: Streaming ioctls: test read/write: OK fail: v4l2-test-buffers.cpp(284): g_field() == V4L2_FIELD_ANY fail: v4l2-test-buffers.cpp(611): buf.check(q, last_seq) fail: v4l2-test-buffers.cpp(884): captureBufs(node, q, m2m_q, frame_count, false) test MMAP: FAIL test USERPTR: OK (Not Supported) test DMABUF: Cannot test, specify --expbuf-device Total: 45, Succeeded: 44, Failed: 1, Warnings: 0 Could you give some hints on what this means? On a different note, I'm getting occasional warnings in syslog when I run a regular video streaming application (e.g. cheese): [ cut here ] WARNING: CPU: 1 PID: 4995 at /home/apw/COD/linux/drivers/media/v4l2-core/videobuf2-core.c:2144 __vb2_queue_cancel+0x1d0/0x240 [videobuf2_core]() Modules linked in: sur40(OE) videobuf2_dma_contig videobuf2_memops videobuf2_core v4l2_common videodev media dm_crypt wl(POE) snd_hda_codec_realtek snd_hda_codec_generic snd_hda_codec_hdmi snd_hda_intel rfcomm bnep joydev input_polldev snd_hda_controller snd_hda_codec snd_hwdep kvm_amd kvm snd_pcm snd_seq_midi snd_seq_midi_event snd_rawmidi edac_core snd_seq snd_seq_device serio_raw snd_timer sp5100_tco k10temp edac_mce_amd i2c_piix4 snd btusb soundcore bluetooth cfg80211 ipmi_si ppdev lp parport_pc ipmi_msghandler parport tpm_infineon mac_hid shpchp hid_apple usbhid hid uas usb_storage pata_acpi radeon i2c_algo_bit ttm psmouse drm_kms_helper pata_atiixp drm r8169 ahci mii libahci [last unloaded: sur40] CPU: 1 PID: 4995 Comm: cheese Tainted: P OE 3.17.1-031701-generic #201410150735 Hardware name: Samsung SUR40/SDNE-R78BA2-20, BIOS SDNE-R78BA2-2000 11/04/2011 0860 8800c2c1bd28 81796c37 0007 8800c2c1bd68 81074a3c 8800c2c1bd58 fff8800c05904f8 8800c05904d0 8800abd65d38 8800abd65d38 Call Trace: [81796c37] dump_stack+0x46/0x58 [81074a3c] warn_slowpath_common+0x8c/0xc0 [81074a8a] warn_slowpath_null+0x1a/0x20 [c05b7a10] __vb2_queue_cancel+0x1d0/0x240 [videobuf2_core] [c05bb3ee] vb2_queue_release+0x1e/0x40 [videobuf2_core] [c05bb481] _vb2_fop_release+0x71/0xb0 [videobuf2_core] [c05bb4ee] vb2_fop_release+0x2e/0x50 [videobuf2_core] [c0c1f491] v4l2_release+0x41/0x90 [videodev] [811eb34d] __fput+0xbd/0x250 [811eb52e] fput+0xe/0x10 [81091504] task_work_run+0xc4/0xe0 [810776a6] do_exit+0x196/0x470 [81082822] ? zap_other_threads+0x82/0xa0 [81077a14] do_group_exit+0x44/0xa0 [81077a87] SyS_exit_group+0x17/0x20 [817a47ad] system_call_fastpath+0x1a/0x1f ---[ end trace 451ed974170f6e44 ]--- Does this mean the driver consumes too much CPU resources? Thanks for your help best regards, Florian -- _Nothing_ brightens up my morning. Coffee simply provides a shade of grey just above the pitch-black of the infinite depths of the _abyss_.Driver Info: Driver name : sur40 Card type : Samsung SUR40 Bus info : usb-:00:13.2-1 Driver version: 3.17.1 Capabilities : 0x8521 Video Capture Read/Write Streaming Extended Pix Format Device Capabilities Device Caps : 0x0521 Video Capture Read/Write Streaming Extended Pix Format Compliance test for device /dev/video0 (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/ENUM_FREQ_BANDS: 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
Re: [RFC] [Patch] implement video driver for sur40
On 01/06/2015 10:29 AM, Florian Echtler wrote: On Fri, 19 Dec 2014, Hans Verkuil wrote: drivers/media remains under heavy development, so for video capture drivers like yours you should always patch against either the mainline linux tree or (preferred) the media_tree.git repo (git://linuxtv.org/media_tree.git, master branch). As per your suggestion, I've switched development to 3.18, and now I'm nearly there in terms of v4l2-compliance (also see attachment). There's only one failing test left, which is this one: Streaming ioctls: test read/write: OK fail: v4l2-test-buffers.cpp(284): g_field() == V4L2_FIELD_ANY You're not filling in the 'field' field of struct v4l2_buffer when returning a frame. It should most likely be FIELD_NONE in your case. fail: v4l2-test-buffers.cpp(611): buf.check(q, last_seq) fail: v4l2-test-buffers.cpp(884): captureBufs(node, q, m2m_q, frame_count, false) test MMAP: FAIL test USERPTR: OK (Not Supported) test DMABUF: Cannot test, specify --expbuf-device Total: 45, Succeeded: 44, Failed: 1, Warnings: 0 Could you give some hints on what this means? On a different note, I'm getting occasional warnings in syslog when I run a regular video streaming application (e.g. cheese): [ cut here ] WARNING: CPU: 1 PID: 4995 at /home/apw/COD/linux/drivers/media/v4l2-core/videobuf2-core.c:2144 __vb2_queue_cancel+0x1d0/0x240 [videobuf2_core]() Modules linked in: sur40(OE) videobuf2_dma_contig videobuf2_memops videobuf2_core v4l2_common videodev media dm_crypt wl(POE) snd_hda_codec_realtek snd_hda_codec_generic snd_hda_codec_hdmi snd_hda_intel rfcomm bnep joydev input_polldev snd_hda_controller snd_hda_codec snd_hwdep kvm_amd kvm snd_pcm snd_seq_midi snd_seq_midi_event snd_rawmidi edac_core snd_seq snd_seq_device serio_raw snd_timer sp5100_tco k10temp edac_mce_amd i2c_piix4 snd btusb soundcore bluetooth cfg80211 ipmi_si ppdev lp parport_pc ipmi_msghandler parport tpm_infineon mac_hid shpchp hid_apple usbhid hid uas usb_storage pata_acpi radeon i2c_algo_bit ttm psmouse drm_kms_helper pata_atiixp drm r8169 ahci mii libahci [last unloaded: sur40] CPU: 1 PID: 4995 Comm: cheese Tainted: P OE 3.17.1-031701-generic #201410150735 Hardware name: Samsung SUR40/SDNE-R78BA2-20, BIOS SDNE-R78BA2-2000 11/04/2011 0860 8800c2c1bd28 81796c37 0007 8800c2c1bd68 81074a3c 8800c2c1bd58 fff8800c05904f8 8800c05904d0 8800abd65d38 8800abd65d38 Call Trace: [81796c37] dump_stack+0x46/0x58 [81074a3c] warn_slowpath_common+0x8c/0xc0 [81074a8a] warn_slowpath_null+0x1a/0x20 [c05b7a10] __vb2_queue_cancel+0x1d0/0x240 [videobuf2_core] [c05bb3ee] vb2_queue_release+0x1e/0x40 [videobuf2_core] [c05bb481] _vb2_fop_release+0x71/0xb0 [videobuf2_core] [c05bb4ee] vb2_fop_release+0x2e/0x50 [videobuf2_core] [c0c1f491] v4l2_release+0x41/0x90 [videodev] [811eb34d] __fput+0xbd/0x250 [811eb52e] fput+0xe/0x10 [81091504] task_work_run+0xc4/0xe0 [810776a6] do_exit+0x196/0x470 [81082822] ? zap_other_threads+0x82/0xa0 [81077a14] do_group_exit+0x44/0xa0 [81077a87] SyS_exit_group+0x17/0x20 [817a47ad] system_call_fastpath+0x1a/0x1f ---[ end trace 451ed974170f6e44 ]--- Does this mean the driver consumes too much CPU resources? No, it means that your driver is not returning all buffers to vb2. Most likely this is missing in the vb2 stop_streaming op. When that is called your driver must return all buffers it has back to vb2 by calling vb2_buffer_done with state ERROR. The same can happen in the start_streaming op if that returns an error for some reason. In that case all buffers owned by the driver should be returned to vb2 with state QUEUED. See also Documentation/video4linux/v4l2-pci-skeleton.c as reference code. Regards, Hans Thanks for your help best regards, Florian -- 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
Payment
Dear Recipient, You have been awarded the sum of 8,000,000.00 (Eight Million Pounds sterling) with reference number 77100146 by office of the ministry of finance UK.Send us your personal details to deliver your funds. Gloria Peter -- 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 12/13] ARM: dts: sun6i: Add sun6i-a31s.dtsi
Hi, On Mon, Jan 05, 2015 at 10:31:05AM +0100, Hans de Goede wrote: Thanks, while looking at your dt-for-3.20 branch I noticed that you've merged v2 of ARM: dts: sun6i: Add ir node, I did a v3 adding an ir: label to the node, which I noticed was missing because you asked me to move the a31s dt stuff to moving label references, can you fix this up, or do you want me to do a follow up patch ? Note that having this fixed is a pre-req for the csq-cs908 dts patch. Ah, right. I edited your previous patch to add the label. Thanks! Maxime -- Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com signature.asc Description: Digital signature
Re: [RFC] [Patch] implement video driver for sur40
On 06.01.2015 10:36, Hans Verkuil wrote: On 01/06/2015 10:29 AM, Florian Echtler wrote: There's only one failing test left, which is this one: Streaming ioctls: test read/write: OK fail: v4l2-test-buffers.cpp(284): g_field() == V4L2_FIELD_ANY You're not filling in the 'field' field of struct v4l2_buffer when returning a frame. It should most likely be FIELD_NONE in your case. fail: v4l2-test-buffers.cpp(611): buf.check(q, last_seq) fail: v4l2-test-buffers.cpp(884): captureBufs(node, q, m2m_q, frame_count, false) OK, easy to fix. This will also influence the other two warnings, I assume? On a different note, I'm getting occasional warnings in syslog when I run a regular video streaming application (e.g. cheese): [ cut here ] ... ---[ end trace 451ed974170f6e44 ]--- Does this mean the driver consumes too much CPU resources? No, it means that your driver is not returning all buffers to vb2. Most likely this is missing in the vb2 stop_streaming op. When that is called your driver must return all buffers it has back to vb2 by calling vb2_buffer_done with state ERROR. The same can happen in the start_streaming op if that returns an error for some reason. In that case all buffers owned by the driver should be returned to vb2 with state QUEUED. See also Documentation/video4linux/v4l2-pci-skeleton.c as reference code. I did actually build my driver code based on v4l2-pci-skeleton.c, and I'm calling the exact same return_all_buffers function (see below) with VB2_BUF_STATE_ERROR from my stop_streaming ioctl. static void return_all_buffers(struct sur40_state *sur40, enum vb2_buffer_state state) { struct sur40_buffer *buf, *node; spin_lock(sur40-qlock); list_for_each_entry_safe(buf, node, sur40-buf_list, list) { vb2_buffer_done(buf-vb, state); list_del(buf-list); } spin_unlock(sur40-qlock); } Is there another possible explanation? Thanks best regards, Florian -- SENT FROM MY DEC VT50 TERMINAL signature.asc Description: OpenPGP digital signature
Re: [RFC] [Patch] implement video driver for sur40
On 01/06/2015 11:17 AM, Florian Echtler wrote: On 06.01.2015 10:36, Hans Verkuil wrote: On 01/06/2015 10:29 AM, Florian Echtler wrote: There's only one failing test left, which is this one: Streaming ioctls: test read/write: OK fail: v4l2-test-buffers.cpp(284): g_field() == V4L2_FIELD_ANY You're not filling in the 'field' field of struct v4l2_buffer when returning a frame. It should most likely be FIELD_NONE in your case. fail: v4l2-test-buffers.cpp(611): buf.check(q, last_seq) fail: v4l2-test-buffers.cpp(884): captureBufs(node, q, m2m_q, frame_count, false) OK, easy to fix. This will also influence the other two warnings, I assume? Most likely, yes. On a different note, I'm getting occasional warnings in syslog when I run a regular video streaming application (e.g. cheese): [ cut here ] ... ---[ end trace 451ed974170f6e44 ]--- Does this mean the driver consumes too much CPU resources? No, it means that your driver is not returning all buffers to vb2. Most likely this is missing in the vb2 stop_streaming op. When that is called your driver must return all buffers it has back to vb2 by calling vb2_buffer_done with state ERROR. The same can happen in the start_streaming op if that returns an error for some reason. In that case all buffers owned by the driver should be returned to vb2 with state QUEUED. See also Documentation/video4linux/v4l2-pci-skeleton.c as reference code. I did actually build my driver code based on v4l2-pci-skeleton.c, and I'm calling the exact same return_all_buffers function (see below) with VB2_BUF_STATE_ERROR from my stop_streaming ioctl. static void return_all_buffers(struct sur40_state *sur40, enum vb2_buffer_state state) { struct sur40_buffer *buf, *node; spin_lock(sur40-qlock); list_for_each_entry_safe(buf, node, sur40-buf_list, list) { vb2_buffer_done(buf-vb, state); list_del(buf-list); } spin_unlock(sur40-qlock); } Is there another possible explanation? No :-) You are still missing a buffer somewhere. I'd have to see your latest source code to see what's wrong. Some drivers (esp. USB drivers) use a separate pointer to the active buffer, so that buffer is no longer part of the buf_list, but still needs to be returned in stop_streaming. Could that be the cause perhaps? 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: omap3isp Device Tree support status
Hi Sakari, Laurent, Wish You A Happy New Year!!! On Friday 10 October 2014 12:51 AM, Sakari Ailus wrote: Hi Alaganjar, On Fri, Oct 10, 2014 at 02:08:43AM +0530, Alaganraj Sandhanam wrote: Hi Sakari, On Wednesday 08 October 2014 05:03 PM, Sakari Ailus wrote: Hi Alaganjar, On Tue, Oct 07, 2014 at 02:37:37AM +0530, Alaganraj Sandhanam wrote: Hi Sakari, Thanks for the patches. On Monday 29 September 2014 03:43 AM, Sakari Ailus wrote: Hi, I managed to find some time for debugging my original omap3isp DT support patchset (which includes smiapp DT support as well), and found a few small but important bugs. The status is now that images can be captured using the Nokia N9 camera, in which the sensor is connected to the CSI-2 interface. Laurent confirmed that the parallel interface worked for him (Beagleboard, mt9p031 sensor on Leopard imaging's li-5m03 board). Good news! These patches (on top of the smiapp patches I recently sent for review which are in much better shape) are still experimental and not ready for review. I continue to clean them up and post them to the list when that is done. For now they can be found here: URL:http://git.linuxtv.org/cgit.cgi/sailus/media_tree.git/log/?h=rm696-043-dt I couldn't clone the repo, getting remote corrupt error. $ git remote -v media-sakari git://linuxtv.org/sailus/media_tree.git (fetch) media-sakari git://linuxtv.org/sailus/media_tree.git (push) origin git://linuxtv.org/media_tree.git (fetch) origin git://linuxtv.org/media_tree.git (push) sakari git://vihersipuli.retiisi.org.uk/~sailus/linux.git (fetch) sakari git://vihersipuli.retiisi.org.uk/~sailus/linux.git (push) $ git fetch media-sakari warning: cannot parse SRV response: Message too long remote: error: Could not read 5ea878796f0a1d9649fe43a6a09df53d3915c0ef remote: fatal: revision walk setup failed remote: aborting due to possible repository corruption on the remote side. fatal: protocol error: bad pack header I'm not sure what this could be related. Can you fetch from other trees, e.g. your origin remote? Do you get the same error from the remote on vihersipuli, and by using http instead? I'm able to fetch from origin and vihersipuli remotes. problem with only git://linuxtv.org/sailus/media_tree.git remote. Then you can get the same branch (or later) from vihersipuli. It's available there as well. Sorry for late response, because of some personal work I couldn't get time to test rm696-043-dt branch. I've beagleboard xM and MT9P031 Leopard imaging's LI-5M03 board. Compilation step: $ git checkout -b rm696-043-dt remotes/sakari/rm696-043-dt $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- omap2plus_defconfig $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig Enabled OMAP3ISP, MT9P031, Media controller support $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j4 Copy images to SD card $ sudo cp -f arch/arm/boot/zImage /media/alagan/BOOT/ $ sudo cp -f arch/arm/boot/dts/omap3-beagle-xm.dtb /media/alagan/BOOT/dtbs/ Kernel is booting but getting below error of_graph_get_next_endpoint(): no port node found in /ocp/omap3_isp@480bc000/ports Also device node /dev/media0 is missing and sensor not detected. Please find log below: U-Boot SPL 2014.07-rc3-dirty (Jun 16 2014 - 02:11:57) SPL: Please implement spl_start_uboot() for your board SPL: Direct Linux boot not active! reading u-boot.img reading u-boot.img U-Boot 2014.07-rc3-dirty (Jun 16 2014 - 02:11:57) OMAP36XX/37XX-GP ES1.2, CPU-OPP2, L3-200MHz, Max CPU Clock 1 Ghz OMAP3 Beagle board + LPDDR/NAND I2C: ready DRAM: 512 MiB NAND: 0 MiB MMC: OMAP SD/MMC: 0 *** Warning - readenv() failed, using default environment Beagle xM Rev C No EEPROM on expansion board No EEPROM on expansion board Die ID #327c00029ff8016849a904021023 Net: usb_ether Hit any key to stop autoboot: 0 mmc0 is current device gpio: pin 173 (gpio 173) value is 0 gpio: pin 4 (gpio 4) value is 0 SD/MMC found on device 0 reading uEnv.txt 153 bytes read in 3 ms (49.8 KiB/s) Loaded environment from uEnv.txt Importing environment from mmc ... Checking if lcdcmd is set ... Checking if uenvcmd is set ... Running default loadimage ... reading /zImage 4583568 bytes read in 293 ms (14.9 MiB/s) reading /dtbs/omap3-beagle-xm.dtb 62434 bytes read in 24 ms (2.5 MiB/s) Booting from mmc ... Kernel image @ 0x8030 [ 0x00 - 0x45f090 ] ## Flattened Device Tree blob at 815f Booting using the fdt blob at 0x815f Using Device Tree in place at 815f, end 816023e1 Starting kernel ... [0.498565] platform 48058000.ssi-controller: Cannot lookup hwmod 'ssi' [0.553863] edma-dma-engine edma-dma-engine.0: Can't allocate PaRAM dummy slot [1.358947] mtdoops: mtd device (mtddev=name/number) must be supplied [1.386444] twl4030_keypad 4807.i2c:twl@48:keypad: OF: linux,keymap property not defined in /ocp/i2c@4807/twl@48/keypad [1.398681] twl4030_keypad
Re: [PATCH 1/2] V4L: remove clock name from v4l2_clk API
Hi, Guennadi After look deep into this patch, I found you miss one line that should be changed as well. It's In function v4l2_clk_get(), there still has one line code called v4l2_clk_find(dev_id, id). You need to change it to v4l2_clk_find(dev_id, NULL) as well. Otherwise the code that many sensor used: v4l2_clk_get(client-dev, mclk) cannot acquired the mclk clock. After above changes, this patch works for me. On 1/2/2015 7:48 PM, Guennadi Liakhovetski wrote: All uses of the v4l2_clk API so far only register one clock with a fixed name. This allows us to get rid of it, which also will make CCF and DT integration easier. Signed-off-by: Guennadi Liakhovetski g.liakhovet...@gmx.de --- drivers/media/platform/soc_camera/soc_camera.c | 6 +++--- drivers/media/usb/em28xx/em28xx-camera.c | 2 +- drivers/media/v4l2-core/v4l2-clk.c | 24 +++- include/media/v4l2-clk.h | 7 +++ 4 files changed, 18 insertions(+), 21 deletions(-) diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c index f4be2a1..ce192b6 100644 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c @@ -1380,7 +1380,7 @@ static int soc_camera_i2c_init(struct soc_camera_device *icd, snprintf(clk_name, sizeof(clk_name), %d-%04x, shd-i2c_adapter_id, shd-board_info-addr); - icd-clk = v4l2_clk_register(soc_camera_clk_ops, clk_name, mclk, icd); + icd-clk = v4l2_clk_register(soc_camera_clk_ops, clk_name, icd); if (IS_ERR(icd-clk)) { ret = PTR_ERR(icd-clk); goto eclkreg; @@ -1561,7 +1561,7 @@ static int scan_async_group(struct soc_camera_host *ici, snprintf(clk_name, sizeof(clk_name), %d-%04x, sasd-asd.match.i2c.adapter_id, sasd-asd.match.i2c.address); - icd-clk = v4l2_clk_register(soc_camera_clk_ops, clk_name, mclk, icd); + icd-clk = v4l2_clk_register(soc_camera_clk_ops, clk_name, icd); if (IS_ERR(icd-clk)) { ret = PTR_ERR(icd-clk); goto eclkreg; @@ -1666,7 +1666,7 @@ static int soc_of_bind(struct soc_camera_host *ici, snprintf(clk_name, sizeof(clk_name), of-%s, of_node_full_name(remote)); - icd-clk = v4l2_clk_register(soc_camera_clk_ops, clk_name, mclk, icd); + icd-clk = v4l2_clk_register(soc_camera_clk_ops, clk_name, icd); if (IS_ERR(icd-clk)) { ret = PTR_ERR(icd-clk); goto eclkreg; diff --git a/drivers/media/usb/em28xx/em28xx-camera.c b/drivers/media/usb/em28xx/em28xx-camera.c index 7be661f..a4b22c2 100644 --- a/drivers/media/usb/em28xx/em28xx-camera.c +++ b/drivers/media/usb/em28xx/em28xx-camera.c @@ -330,7 +330,7 @@ int em28xx_init_camera(struct em28xx *dev) v4l2_clk_name_i2c(clk_name, sizeof(clk_name), i2c_adapter_id(adap), client-addr); - v4l2-clk = v4l2_clk_register_fixed(clk_name, mclk, -EINVAL); + v4l2-clk = v4l2_clk_register_fixed(clk_name, -EINVAL); if (IS_ERR(v4l2-clk)) return PTR_ERR(v4l2-clk); diff --git a/drivers/media/v4l2-core/v4l2-clk.c b/drivers/media/v4l2-core/v4l2-clk.c index e18cc04..c210906 100644 --- a/drivers/media/v4l2-core/v4l2-clk.c +++ b/drivers/media/v4l2-core/v4l2-clk.c @@ -31,7 +31,8 @@ static struct v4l2_clk *v4l2_clk_find(const char *dev_id, const char *id) if (strcmp(dev_id, clk-dev_id)) continue; - if (!id || !clk-id || !strcmp(clk-id, id)) + if ((!id !clk-id) || + (id clk-id !strcmp(clk-id, id))) return clk; } @@ -127,8 +128,8 @@ void v4l2_clk_disable(struct v4l2_clk *clk) mutex_lock(clk-lock); enable = --clk-enable; - if (WARN(enable 0, Unbalanced %s() on %s:%s!\n, __func__, -clk-dev_id, clk-id)) + if (WARN(enable 0, Unbalanced %s() on %s!\n, __func__, +clk-dev_id)) clk-enable++; else if (!enable clk-ops-disable) clk-ops-disable(clk); @@ -181,7 +182,7 @@ EXPORT_SYMBOL(v4l2_clk_set_rate); struct v4l2_clk *v4l2_clk_register(const struct v4l2_clk_ops *ops, const char *dev_id, - const char *id, void *priv) + void *priv) { struct v4l2_clk *clk; int ret; @@ -193,9 +194,8 @@ struct v4l2_clk *v4l2_clk_register(const struct v4l2_clk_ops *ops, if (!clk) return ERR_PTR(-ENOMEM); - clk-id = kstrdup(id, GFP_KERNEL); clk-dev_id = kstrdup(dev_id, GFP_KERNEL); - if ((id !clk-id) || !clk-dev_id) { + if (!clk-dev_id) { ret = -ENOMEM; goto ealloc; } @@ -205,7 +205,7 @@ struct v4l2_clk *v4l2_clk_register(const struct
Re: Baytrail camera csi / isp support status ?
On Tue, 2015-01-06 at 09:55 +0200, Laurent Pinchart wrote: Hi Bastien, On Tuesday 06 January 2015 01:06:54 Bastien Nocera wrote: On Fri, 2014-12-12 at 12:07 +0100, Hans de Goede wrote: Hi All, A college of mine has a baytrail bases tablet: http://www.onda-tablet.com/onda-v975w-quad-core-win-8-tablet-9-7-inch-reti na-screen-ram-2gb-wifi-32gb.html And he is trying to get Linux to run on it, he has things mostly working, but he would also like to get the cameras to work. I've found this: http://sourceforge.net/projects/e3845mipi/files/ Which is some not so pretty code, with the usual problems of using custom ioctls to pass info from the statistics block of the isp to userspace and then let some userspace thingie (blob?) handle it. So I was wondering if anyone is working on proper support (targeting upstream) for this ? It would be nice if we could at least get the csi bits going, using the sensors or software auto-whitebal, etc. for now. As I mentioned to Hans in private, I would be ready to provide the hardware for somebody with a track record to keep, to allow testing and hopefully maintaining that code longer term. I would expect that this sort of hardware is already quite common amongst Windows 8 tablets so it would be very helpful to have working out-of-the-box on a stock Linux. $ cat BYT_LSP_3.11_ISP_2013-12-26.patch | diffstat -s 302 files changed, 91662 insertions(+), 2 deletions(-) That's smaller than the Wi-Fi driver I'm cleaning up ;) There's no interest in upstreaming the code on Intel's side. As far as I understand their ISP is more like a programmable DSP than a fixed pipeline ISP. I expect the driver they have published to hardcode the pipeline programmed in a particular firmware and thus be specific to a limited number of devices. Given the amount of work required to get the code in shape, and given that reusability would be very limited if my assumptions are correct, I don't really see this happening unless you can find a motivated developer with way too much free time. Can somebody explain the different parts of this puzzle, or point me to a document that would? I understand that there's a piece of silicon on the SoC that would filter the data from the camera sensor, but I would expect that to be (somewhat) optional to at least get something going. Is that not the case? -- 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
[RESEND PATCH v2] [media] Add RGB444_1X12 and RGB565_1X16 media bus formats
Add RGB444_1X12 and RGB565_1X16 format definitions and update the documentation. Signed-off-by: Boris Brezillon boris.brezil...@free-electrons.com Acked-by: Mauro Carvalho Chehab mche...@osg.samsung.com Acked-by: Sakari Ailus sakari.ai...@linux.intel.com --- Hi Mauro, Sakari, This patch has been rejected as 'Not Applicable'. Is there anyting wrong in it ? Best Regards, Boris Documentation/DocBook/media/v4l/subdev-formats.xml | 40 ++ include/uapi/linux/media-bus-format.h | 4 ++- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/Documentation/DocBook/media/v4l/subdev-formats.xml b/Documentation/DocBook/media/v4l/subdev-formats.xml index c5ea868..be57efa 100644 --- a/Documentation/DocBook/media/v4l/subdev-formats.xml +++ b/Documentation/DocBook/media/v4l/subdev-formats.xml @@ -192,6 +192,24 @@ see xref linkend=colorspaces /./entry /row /thead tbody valign=top + row id=MEDIA-BUS-FMT-RGB444-1X12 + entryMEDIA_BUS_FMT_RGB444_1X12/entry + entry0x100d/entry + entry/entry + dash-ent-20; + entryrsubscript3/subscript/entry + entryrsubscript2/subscript/entry + entryrsubscript1/subscript/entry + entryrsubscript0/subscript/entry + entrygsubscript3/subscript/entry + entrygsubscript2/subscript/entry + entrygsubscript1/subscript/entry + entrygsubscript0/subscript/entry + entrybsubscript3/subscript/entry + entrybsubscript2/subscript/entry + entrybsubscript1/subscript/entry + entrybsubscript0/subscript/entry + /row row id=MEDIA-BUS-FMT-RGB444-2X8-PADHI-BE entryMEDIA_BUS_FMT_RGB444_2X8_PADHI_BE/entry entry0x1001/entry @@ -304,6 +322,28 @@ see xref linkend=colorspaces /./entry entrygsubscript4/subscript/entry entrygsubscript3/subscript/entry /row + row id=MEDIA-BUS-FMT-RGB565-1X16 + entryMEDIA_BUS_FMT_RGB565_1X16/entry + entry0x100d/entry + entry/entry + dash-ent-16; + entryrsubscript4/subscript/entry + entryrsubscript3/subscript/entry + entryrsubscript2/subscript/entry + entryrsubscript1/subscript/entry + entryrsubscript0/subscript/entry + entrygsubscript5/subscript/entry + entrygsubscript4/subscript/entry + entrygsubscript3/subscript/entry + entrygsubscript2/subscript/entry + entrygsubscript1/subscript/entry + entrygsubscript0/subscript/entry + entrybsubscript4/subscript/entry + entrybsubscript3/subscript/entry + entrybsubscript2/subscript/entry + entrybsubscript1/subscript/entry + entrybsubscript0/subscript/entry + /row row id=MEDIA-BUS-FMT-BGR565-2X8-BE entryMEDIA_BUS_FMT_BGR565_2X8_BE/entry entry0x1005/entry diff --git a/include/uapi/linux/media-bus-format.h b/include/uapi/linux/media-bus-format.h index 23b4090..37091c6 100644 --- a/include/uapi/linux/media-bus-format.h +++ b/include/uapi/linux/media-bus-format.h @@ -33,11 +33,13 @@ #define MEDIA_BUS_FMT_FIXED0x0001 -/* RGB - next is 0x100e */ +/* RGB - next is 0x1010 */ +#define MEDIA_BUS_FMT_RGB444_1X12 0x100e #define MEDIA_BUS_FMT_RGB444_2X8_PADHI_BE 0x1001 #define MEDIA_BUS_FMT_RGB444_2X8_PADHI_LE 0x1002 #define MEDIA_BUS_FMT_RGB555_2X8_PADHI_BE 0x1003 #define MEDIA_BUS_FMT_RGB555_2X8_PADHI_LE 0x1004 +#define MEDIA_BUS_FMT_RGB565_1X16 0x100f #define MEDIA_BUS_FMT_BGR565_2X8_BE0x1005 #define MEDIA_BUS_FMT_BGR565_2X8_LE0x1006 #define MEDIA_BUS_FMT_RGB565_2X8_BE0x1007 -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC] [Patch] implement video driver for sur40
On 06.01.2015 11:23, Hans Verkuil wrote: On 01/06/2015 11:17 AM, Florian Echtler wrote: You're not filling in the 'field' field of struct v4l2_buffer when returning a frame. It should most likely be FIELD_NONE in your case. fail: v4l2-test-buffers.cpp(611): buf.check(q, last_seq) fail: v4l2-test-buffers.cpp(884): captureBufs(node, q, m2m_q, frame_count, false) OK, easy to fix. This will also influence the other two warnings, I assume? Most likely, yes. Done. I would say that it's nearly ready for submission now (all tests from v4l2-compliance -s pass), I still have to sort out all the warnings from scripts/checkpatch.pl. On a different note, I'm getting occasional warnings in syslog when I run a regular video streaming application (e.g. cheese): Is there another possible explanation? No :-) You are still missing a buffer somewhere. I'd have to see your latest source code to see what's wrong. Weirdly enough, the syslog warning/error doesn't seem to occur anymore since I've fixed the v4l2_buffer field. Perhaps some oddity within cheese? I'm attaching the current source again for you to maybe have another look; I will submit a proper patch in the next days. Thanks again for your help! Best, Florian -- SENT FROM MY DEC VT50 TERMINAL /* * Surface2.0/SUR40/PixelSense input driver * * Copyright (c) 2013 by Florian 'floe' Echtler f...@butterbrot.org * * Derived from the USB Skeleton driver 1.1, * Copyright (c) 2003 Greg Kroah-Hartman (g...@kroah.com) * * and from the Apple USB BCM5974 multitouch driver, * Copyright (c) 2008 Henrik Rydberg (rydb...@euromail.se) * * and from the generic hid-multitouch driver, * Copyright (c) 2010-2012 Stephane Chatty cha...@enac.fr * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. */ #include linux/kernel.h #include linux/errno.h #include linux/delay.h #include linux/init.h #include linux/slab.h #include linux/module.h #include linux/completion.h #include linux/uaccess.h #include linux/usb.h #include linux/printk.h #include linux/input-polldev.h #include linux/input/mt.h #include linux/usb/input.h #include linux/videodev2.h #include media/v4l2-device.h #include media/v4l2-dev.h #include media/v4l2-ioctl.h #include media/videobuf2-dma-contig.h /* read 512 bytes from endpoint 0x86 - get header + blobs */ struct sur40_header { __le16 type; /* always 0x0001 */ __le16 count; /* count of blobs (if 0: continue prev. packet) */ __le32 packet_id; /* unique ID for all packets in one frame */ __le32 timestamp; /* milliseconds (inc. by 16 or 17 each frame) */ __le32 unknown;/* epoch? always 02/03 00 00 00 */ } __packed; struct sur40_blob { __le16 blob_id; u8 action; /* 0x02 = enter/exit, 0x03 = update (?) */ u8 unknown;/* always 0x01 or 0x02 (no idea what this is?) */ __le16 bb_pos_x; /* upper left corner of bounding box */ __le16 bb_pos_y; __le16 bb_size_x; /* size of bounding box */ __le16 bb_size_y; __le16 pos_x; /* finger tip position */ __le16 pos_y; __le16 ctr_x; /* centroid position */ __le16 ctr_y; __le16 axis_x; /* somehow related to major/minor axis, mostly: */ __le16 axis_y; /* axis_x == bb_size_y axis_y == bb_size_x */ __le32 angle; /* orientation in radians relative to x axis - actually an IEEE754 float, don't use in kernel */ __le32 area; /* size in pixels/pressure (?) */ u8 padding[32]; } __packed; /* combined header/blob data */ struct sur40_data { struct sur40_header header; struct sur40_blob blobs[]; } __packed; /* read 512 bytes from endpoint 0x82 - get header below * continue reading 16k blocks until header.size bytes read */ struct sur40_image_header { __le32 magic; /* SUBF */ __le32 packet_id; __le32 size; /* always 0x0007e900 = 960x540 */ __le32 timestamp; /* milliseconds (increases by 16 or 17 each frame) */ __le32 unknown; /* epoch? always 02/03 00 00 00 */ } __packed; /* version information */ #define DRIVER_SHORT sur40 #define DRIVER_LONGSamsung SUR40 #define DRIVER_AUTHOR Florian 'floe' Echtler f...@butterbrot.org #define DRIVER_DESCSurface2.0/SUR40/PixelSense input driver /* vendor and device IDs */ #define ID_MICROSOFT 0x045e #define ID_SUR40 0x0775 /* sensor resolution */ #define SENSOR_RES_X 1920 #define SENSOR_RES_Y 1080 /* touch data endpoint */ #define TOUCH_ENDPOINT 0x86 /* video data endpoint */ #define VIDEO_ENDPOINT 0x82 /* video header fields */ #define VIDEO_HEADER_MAGIC 0x46425553 #define VIDEO_PACKET_SIZE 16384 /* polling interval (ms) */ #define POLL_INTERVAL 10 /* maximum number of contacts FIXME: this is a guess? */ #define MAX_CONTACTS 64 /* control commands */ #define SUR40_GET_VERSION 0xb0 /* 12 bytes string*/
Re: [PATCH 4/5] dvb core: add media controller support for the demod
On 2015年01月06日 03:29, Mauro Carvalho Chehab wrote: Em Mon, 05 Jan 2015 23:36:00 +0900 And if so, Shouldn't only the (tuner) subdevices be registered separately in dvb_i2c_attach_tuner(), instead of dvb_i2c_attach_fe()? No, it seems better to let dmxdev to register. That means that even the non-converted I2C drivers, plus the non-I2C drivers may benefit from the Media controller as well. I guess you meant dvbdev instead of dmxdev, but still I'm afraid that media_entity for a tuner module is not registered like FE(demod),dmxdev,net,ca, because dvb_frontend_register() registers just a demod (or a whole FE module) for now. Tuner subdevices don't have their own device nodes to be passed to dvb_register_media_device() in the first place, So I think we need to define MEDIA_ENT_T_DVB_SUBDEV{,_TUNER} and register a media_entity of type:MEDIA_ENT_T_DVB_SUBDEV_TUNER, if a separate tuner chip is used. (with {major,minor} of the parent FE dev?) If we can distinguish if a separate tuner subdev is used or not by looking into fe, then we might be able to register the subdev from within dvb_register_[media_]device(). But if we cannot know from fe, dvb_i2c_attach_tuner() looks to be a good place. Further, when a DTV board has multiple tuners and/or multiple demods and the link between them can be dynamically configurable, (via media controller API or a new DVB ioctl?), then a tuner subdev can be unused and connected to no demod, so we cannot identify all tuner subdevs from the demod (fe) anyway. Yeah, we could map this way, but that would require to add an extra parameter to the fe register function, with has already too much parameters. So, as it already uses an struct to pass parameters into it, I decided to just re-use it. if we add dvb_adapter.mdev and a user sets the pointer, then we can retrieve mdev in all the registering functions (dvb_register_frontend, dvb_{dmxdev,net,ca_en50221}_init), as all of them take a dvb_adapter parameter. or is it possible that the FE,demux,net,ca under one DVB adapter belong to different mdev's and each of them must keep its parent mdev separately? regards, akihiro -- 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] implement video driver for sur40
On 01/06/2015 01:09 PM, Florian Echtler wrote: On 06.01.2015 11:23, Hans Verkuil wrote: On 01/06/2015 11:17 AM, Florian Echtler wrote: You're not filling in the 'field' field of struct v4l2_buffer when returning a frame. It should most likely be FIELD_NONE in your case. fail: v4l2-test-buffers.cpp(611): buf.check(q, last_seq) fail: v4l2-test-buffers.cpp(884): captureBufs(node, q, m2m_q, frame_count, false) OK, easy to fix. This will also influence the other two warnings, I assume? Most likely, yes. Done. I would say that it's nearly ready for submission now (all tests from v4l2-compliance -s pass), I still have to sort out all the warnings from scripts/checkpatch.pl. On a different note, I'm getting occasional warnings in syslog when I run a regular video streaming application (e.g. cheese): Is there another possible explanation? No :-) You are still missing a buffer somewhere. I'd have to see your latest source code to see what's wrong. Weirdly enough, the syslog warning/error doesn't seem to occur anymore since I've fixed the v4l2_buffer field. Perhaps some oddity within cheese? I'm attaching the current source again for you to maybe have another look; I will submit a proper patch in the next days. Just a few quick remarks: - run scripts/checkpatch.pl over your source, I'm fairly certain it will complain about several constructs. - use videobuf2-vmalloc instead of dma-contig. There is no DMA involved, so there is no reason to use dma-contig. - Don't set V4L2_CAP_EXT_PIX_FORMAT in querycap: it will be set automatically by the v4l2 core. 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
Some issues with Media controller on DVB
Hi Laurent, Now that we have a patchset enabling the media controller for DVB, I'm facing with some issues related to media streaming that are different than what happens at the V4L side. I took some time to write a small text that describes the DVB from the PoV of the media controller, and showing some issues I'm currently facing. Please take a look. Perhaps we could discuss it on a next Media Summit, as some of the issues there seem to require some changes at the media controller side. What do you think? PS.: the described scenario on this document is far from being complete. This is just a starting point for discussions. Regards, Mauro --- DRAFT: DVB and the Media Controller DVB DEVNODES At the DVB API, there are multiple DVB devices that are used for different purposes. A typical device with just one adapter and just one frontend would be mapped as: /dev/dvb/adapter0/frontend0 - frontend devnode /dev/dvb/adapter0/demux0- demux devnode /dev/dvb/adapter0/dvr0 - DVR devnode If such device has a CA module (responsible to decrypt streams), an extra devnode appears: /dev/dvb/adapter0/ca0 - CA devnode If the device is hybrid, it will also have a V4L2 device, like: /dev/video0 TUNER SUB-DEVICE Just like analog TV devices, DVB devices have a component that tuners into a channel. On DVB, the component responsible to tune into a channel and decode the physical layer is called frontend. However, several non-hybrid DVB devices don't have a tuner subdev, due to two reasons: - Sometimes (like Satellite systems), the tuner is integrated with the frontend device; - Several devices use a micro controller to setup both tuner and frontend at the same time. So, the tuner is invisible to the Kernel. Hybrid Analog/Digital devices always have a tuner, as the same tuner is used for both analog TV and as part of the digital TV frontend. In this case, the tuner subdev may feed either the DVB frontend or the analog demod subdev, but never to both at the same time. MEDIA STREAMING === As the DVB devnodes are independent, the concept of media streaming is actually split into each specific devnode. a) frontend streaming When the frontend devnode is opened and a FE_SET_PROPERTY ioctl (or the legacy DVBv3 ioctl) is called, a thread is started inside the DVB core. Both tuner and frontend start streaming at this time. However, the MPEG TS is not delivered yet. What happens here is that it tries to lock at the TV physical channel. Via the frontend interface, it is possible to check the status and the QoS parameters related to the tuning and to the DVB error measurements. b) MPEG-TS streaming The MPEG-TS streaming is commanded via the demod devnode. It happens by setting a filter that will be applied to the MPEG-TS. There are two types of filters: one for MPEG tables, and another one for MPEG programs. When a filter is created, a dynamic stream is created, and will contain all the packet IDs (or tables) that match the filter. Both the input and the output can be directed to different devnodes, depending on the parameters that are given to the ioctl. Typically, it uses the frontend devnode as stream input[1], and the dvr devnode as output, although it is possible to get the output also at the demod devnode[2]. [1] http://linuxtv.org/downloads/v4l-dvb-apis/dvb_demux.html#dmx-input-t [2] http://linuxtv.org/downloads/v4l-dvb-apis/dvb_demux.html#dmx-output-t While in general just a few filters are set, the drivers generally allow a big number of filters, like 256. Some hardware even allow to dynamically allocate and change the max number of filters at runtime, reallocating filters from one adapter to another one. The CA interface is something that requires change. Originally, it was just a control interface to handle CA, but some devices implement it as a completely separated independent module that can even decrypt a TS that was, for example, stored in the disk. So, from the media pipeline PoV, this can be dynamically added in the middle of an streaming pipeline. TYPICAL USECASE === As can be seen from the above, the are multiple streams happening at the DVB API: 1) the frontend streaming; 2) the per-filter streaming. And they're started/stopped at different times. A typical DVB application will initially create one pipeline: tuner -- fe Once the FE locks and has an stable connection, the DVB application will create other pipelines. For example: pipeline 1: Track the MPEG-TS control tables (PAT, PMT, ...) pipeline 2: Audio Program Elementary Stream pipeline 3: Video Program Elementary Stream So, it will have: tuner -- fe -- demux -- dvr filter 0 tuner -- fe -- demux -- dvr filter 1 tuner -- fe -- demux -- dvr filter 2 If the user wants, for example to see the closed captions, an extra pipeline will be created: tuner -- fe -- demux -- dvr filter 3 (for CC) Let's now
Re: TeVii S482 dual DVB-S2
2014-10-13 8:33 GMT+02:00 Josu Lazkano josu.lazk...@gmail.com: Hello, I have TeVii S482 dual DVB-S2 device, is similar to the S480, but it doesn't work with same driver. The problem is that my device is not ported to the Linux kernel, there is a source code in tevii website and liplianin tree: http://www.tevii.com/Tevii_Product_20140428_media_build_b6.tar.bz2.rar https://bitbucket.org/liplianin/s2-liplianin-v39 Is it possible to add this code to the linux-media tree? And to the Linux kernel? Any developer with this device? I am not developer, but I could make some test. Thanks and best regards. Hello again, I create wiki page in the linuxtv web: http://www.linuxtv.org/wiki/index.php/TeVii_S482 I try to add all the information I have about the device. I can compile Liplianin driver in Debian Wheezy (not in Jessie) but the image and audio is bad in some channels, I get this output when it occurs: # dmesg ... [ 373.556033] ts2022_set_params: offset -500khz [ 373.556038] ts2022_set_params: 1256000khz 1255500khz [ 1670.824033] ts2022_set_params: offset 571khz [ 1670.824038] ts2022_set_params: 1847000khz 1847571khz [ 2176.212034] ts2022_set_params: offset -500khz [ 2176.212039] ts2022_set_params: 1256000khz 1255500khz [ 2256.228031] ts2022_set_params: offset 571khz [ 2256.228036] ts2022_set_params: 1847000khz 1847571khz [ 2321.128038] ts2022_set_params: offset -500khz [ 2321.128043] ts2022_set_params: 1256000khz 1255500khz [ 2342.896034] ts2022_set_params: offset 571khz [ 2342.896039] ts2022_set_params: 1847000khz 1847571khz [ 2455.744057] ts2022_set_params: offset 357khz [ 2455.744062] ts2022_set_params: 1178000khz 1178357khz Anyone with this device? Thanks and best regards. -- Josu Lazkano -- 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: Some issues with Media controller on DVB
Em Tue, 6 Jan 2015 12:09:30 -0200 Mauro Carvalho Chehab mche...@osg.samsung.com escreveu: Hi Laurent, Now that we have a patchset enabling the media controller for DVB, I'm facing with some issues related to media streaming that are different than what happens at the V4L side. I took some time to write a small text that describes the DVB from the PoV of the media controller, and showing some issues I'm currently facing. Please take a look. Perhaps we could discuss it on a next Media Summit, as some of the issues there seem to require some changes at the media controller side. What do you think? PS.: the described scenario on this document is far from being complete. This is just a starting point for discussions. Regards, Mauro --- DRAFT: DVB and the Media Controller DVB DEVNODES At the DVB API, there are multiple DVB devices that are used for different purposes. A typical device with just one adapter and just one frontend would be mapped as: /dev/dvb/adapter0/frontend0 - frontend devnode /dev/dvb/adapter0/demux0- demux devnode /dev/dvb/adapter0/dvr0 - DVR devnode If such device has a CA module (responsible to decrypt streams), an extra devnode appears: /dev/dvb/adapter0/ca0 - CA devnode If the device is hybrid, it will also have a V4L2 device, like: /dev/video0 TUNER SUB-DEVICE Just like analog TV devices, DVB devices have a component that tuners into a channel. On DVB, the component responsible to tune into a channel and decode the physical layer is called frontend. However, several non-hybrid DVB devices don't have a tuner subdev, due to two reasons: - Sometimes (like Satellite systems), the tuner is integrated with the frontend device; - Several devices use a micro controller to setup both tuner and frontend at the same time. So, the tuner is invisible to the Kernel. Hybrid Analog/Digital devices always have a tuner, as the same tuner is used for both analog TV and as part of the digital TV frontend. In this case, the tuner subdev may feed either the DVB frontend or the analog demod subdev, but never to both at the same time. MEDIA STREAMING === As the DVB devnodes are independent, the concept of media streaming is actually split into each specific devnode. a) frontend streaming When the frontend devnode is opened and a FE_SET_PROPERTY ioctl (or the legacy DVBv3 ioctl) is called, a thread is started inside the DVB core. Both tuner and frontend start streaming at this time. However, the MPEG TS is not delivered yet. What happens here is that it tries to lock at the TV physical channel. Via the frontend interface, it is possible to check the status and the QoS parameters related to the tuning and to the DVB error measurements. b) MPEG-TS streaming The MPEG-TS streaming is commanded via the demod devnode. It happens by setting a filter that will be applied to the MPEG-TS. There are two types of filters: one for MPEG tables, and another one for MPEG programs. When a filter is created, a dynamic stream is created, and will contain all the packet IDs (or tables) that match the filter. Both the input and the output can be directed to different devnodes, depending on the parameters that are given to the ioctl. Typically, it uses the frontend devnode as stream input[1], and the dvr devnode as output, although it is possible to get the output also at the demod devnode[2]. [1] http://linuxtv.org/downloads/v4l-dvb-apis/dvb_demux.html#dmx-input-t [2] http://linuxtv.org/downloads/v4l-dvb-apis/dvb_demux.html#dmx-output-t While in general just a few filters are set, the drivers generally allow a big number of filters, like 256. Some hardware even allow to dynamically allocate and change the max number of filters at runtime, reallocating filters from one adapter to another one. The CA interface is something that requires change. Originally, it was just a control interface to handle CA, but some devices implement it as a completely separated independent module that can even decrypt a TS that was, for example, stored in the disk. So, from the media pipeline PoV, this can be dynamically added in the middle of an streaming pipeline. TYPICAL USECASE === As can be seen from the above, the are multiple streams happening at the DVB API: 1) the frontend streaming; 2) the per-filter streaming. And they're started/stopped at different times. A typical DVB application will initially create one pipeline: tuner -- fe Once the FE locks and has an stable connection, the DVB application will create other pipelines. For example: pipeline 1: Track the MPEG-TS control tables (PAT, PMT, ...) pipeline 2: Audio Program Elementary Stream pipeline 3: Video Program Elementary Stream So, it will have: tuner -- fe -- demux -- dvr filter 0 tuner -- fe --
Re: [PATCH] gspca_stv06xx: enable button found on some Quickcam Express variant
On Tue, 28 Oct 2014 15:39:41 +0100 Antonio Ospite a...@ao2.it wrote: On Mon, 14 Jul 2014 12:27:57 +0200 Hans de Goede hdego...@redhat.com wrote: Hi, On 07/11/2014 02:56 PM, Antonio Ospite wrote: Signed-off-by: Antonio Ospite a...@ao2.it Thanks, I've added this to my tree and send a pull-req for it to Mauro. Hi Hans, I still don't see the change in 3.18-rc2, maybe it got lost. Here is the patchwork link in case you want to pick the change for 3.19: https://patchwork.linuxtv.org/patch/24732/ Ping. Still missing in 3.19-rc3. Can we have it for 3.20? Thanks, Antonio Regards, Hans --- drivers/media/usb/gspca/stv06xx/stv06xx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/gspca/stv06xx/stv06xx.c b/drivers/media/usb/gspca/stv06xx/stv06xx.c index 49d209b..6ac93d8 100644 --- a/drivers/media/usb/gspca/stv06xx/stv06xx.c +++ b/drivers/media/usb/gspca/stv06xx/stv06xx.c @@ -505,13 +505,13 @@ static int sd_int_pkt_scan(struct gspca_dev *gspca_dev, { int ret = -EINVAL; - if (len == 1 data[0] == 0x80) { + if (len == 1 (data[0] == 0x80 || data[0] == 0x10)) { input_report_key(gspca_dev-input_dev, KEY_CAMERA, 1); input_sync(gspca_dev-input_dev); ret = 0; } - if (len == 1 data[0] == 0x88) { + if (len == 1 (data[0] == 0x88 || data[0] == 0x11)) { input_report_key(gspca_dev-input_dev, KEY_CAMERA, 0); input_sync(gspca_dev-input_dev); ret = 0; -- Antonio Ospite http://ao2.it A: Because it messes up the order in which people normally read text. See http://en.wikipedia.org/wiki/Posting_style Q: Why is top-posting such a bad thing? -- 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 -- Antonio Ospite http://ao2.it A: Because it messes up the order in which people normally read text. See http://en.wikipedia.org/wiki/Posting_style Q: Why is top-posting such a bad thing? -- 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: [BUG] Dual tuner TV card, works using one tuner only, doesn't work if both tuners are used
Hi again, I'm sorry if I sound quite rude, but I'm not sure if I am doing it right or not. I subscribed to this mailing list in order to ask for help, or to help with a bug that I've found (as instructed in the wiki http://linuxtv.org/wiki/index.php/Bug_Report), but it seems to me that the mailing list is filled up with developing messages. I don't want to participate in the development, I am a developer but I don't have the skills nor the knowledge. If this is not the right place to direct my questions, I would appreciate some advice. Thank you very much, and best regards. -Mensaje original- De: linux-media-ow...@vger.kernel.org [mailto:linux-media-ow...@vger.kernel.org] En nombre de dCrypt Enviado el: jueves, 01 de enero de 2015 22:04 Para: linux-media@vger.kernel.org Asunto: [BUG] Dual tuner TV card, works using one tuner only, doesn't work if both tuners are used Hi, I just subscribed to the mailing list to submit information on the bug which is driving me crazy since one month ago. I have a VDR based PVR at home, installed over an Ubuntu 14.04 LTS. Everything was working perfectly, until beginning of December. It seems to me that something changed that broke my PVR pretty bad. The problem is the following: tuning (zap) both tuners (it's not needed that both are tuned simultaneously, only one after the other, in no particular order) makes the tuners to enter an state where they can't lock the signal anymore. Facts: - My TV card is a Cinergy T PCIe Dual from Terratec (http://www.linuxtv.org/wiki/index.php/TerraTec_Cinergy_T_PCIe_dual). - The problem arose in the form of frontend x/0 timed out while tuning to channel ... in /var/log/syslog. It happened when both tuners are active, during EPG scan. The problem does not happen if VDR is run with -D parameter to limit the number of frontends enabled. Disabling the EPG scan with both frontends enabled minimizes the problem, but doesn't solve it because tuning both frontends without any EPG scan makes the error happen again. - I initially thought about a problem in the DVB-T signal, because it all started the 1st of December, during the transition to a new set of frequencies in Spain. - Everything was working perfectly before the 1st, and the problems started suddenly. - I setup testing board for debugging, different board and processor, less memory, lots of Linux distros tested, Windows tested as well. - Both tuners works in windows without problems. Confirmed. - I have completely discarded problems/errors in hardware (because in Windows I can enable both tuners without problems) and VDR (because I can reproduce the problems at OS level, without even having VDR installed). - I have almost narrowed the problem at the cx23885 driver, because when it happens, I can restart the TV card to working conditions by executing rmmod cx23885 and modprobe cx23885; however, as with rmmod several dependencies are unloaded as well, I am stuck and I am unable to go on with debugging to find out where the problem really is. - Tools used to test and confirm the problem are: VDR, MythTV, TVHeadend, dvbscan, dvbv5-scan, dvbv5-zap and others - Linux distros tested: Ubuntu, Fedora, Suse, yaVDR (not sure if the card worked at all), MythBuntu (dvb-fe-tool -a 1 -c DVBT was required to force DVB-T mode for the second tuner), and probably others - I have a Sony PlayTV also with dual tuners, which works without any problem. http://www.linuxtv.org/wiki/index.php/Sony_PlayTV_dual_tuner_DVB-T So, that's why I ask for your help. How can I further debug the problem? Is there something I can do? BR, and happy new year! INFO TEST: pvr@prueba:~$ sudo lspci -vvv -s 03:00.0 03:00.0 Multimedia video controller: Conexant Systems, Inc. CX23885 PCI Video and Audio Decoder (rev 04) Subsystem: TERRATEC Electronic GmbH Cinergy T PCIe Dual Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx- Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast TAbort- TAbort- MAbort- SERR- PERR- INTx- Latency: 0, Cache Line Size: 4 bytes Interrupt: pin A routed to IRQ 16 Region 0: Memory at fba0 (64-bit, non-prefetchable) [size=2M] Capabilities: [40] Express (v1) Endpoint, MSI 00 DevCap: MaxPayload 128 bytes, PhantFunc 0, Latency L0s 64ns, L1 1us ExtTag- AttnBtn- AttnInd- PwrInd- RBE- FLReset- DevCtl: Report errors: Correctable- Non-Fatal- Fatal- Unsupported- RlxdOrd+ ExtTag- PhantFunc- AuxPwr- NoSnoop+ MaxPayload 128 bytes, MaxReadReq 512 bytes DevSta: CorrErr- UncorrErr+ FatalErr- UnsuppReq+ AuxPwr- TransPend- LnkCap: Port #0, Speed 2.5GT/s, Width x1, ASPM L0s L1, Exit Latency L0s 2us, L1 4us ClockPM- Surprise- LLActRep- BwNot- LnkCtl: ASPM
Re: [PATCH 1/2] V4L: remove clock name from v4l2_clk API
Hi Josh, On Tue, 6 Jan 2015, Josh Wu wrote: Hi, Guennadi After look deep into this patch, I found you miss one line that should be changed as well. It's In function v4l2_clk_get(), there still has one line code called v4l2_clk_find(dev_id, id). You need to change it to v4l2_clk_find(dev_id, NULL) as well. Otherwise the code that many sensor used: v4l2_clk_get(client-dev, mclk) cannot acquired the mclk clock. After above changes, this patch works for me. I think you're right, in fact, since we now don't store CCF-based v4l2_clk wrappers on the list, this can be simplified even further, I'll update the patch. Did you only test this patch or both? Thanks Guennadi On 1/2/2015 7:48 PM, Guennadi Liakhovetski wrote: All uses of the v4l2_clk API so far only register one clock with a fixed name. This allows us to get rid of it, which also will make CCF and DT integration easier. Signed-off-by: Guennadi Liakhovetski g.liakhovet...@gmx.de --- drivers/media/platform/soc_camera/soc_camera.c | 6 +++--- drivers/media/usb/em28xx/em28xx-camera.c | 2 +- drivers/media/v4l2-core/v4l2-clk.c | 24 +++- include/media/v4l2-clk.h | 7 +++ 4 files changed, 18 insertions(+), 21 deletions(-) diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c index f4be2a1..ce192b6 100644 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c @@ -1380,7 +1380,7 @@ static int soc_camera_i2c_init(struct soc_camera_device *icd, snprintf(clk_name, sizeof(clk_name), %d-%04x, shd-i2c_adapter_id, shd-board_info-addr); - icd-clk = v4l2_clk_register(soc_camera_clk_ops, clk_name, mclk, icd); + icd-clk = v4l2_clk_register(soc_camera_clk_ops, clk_name, icd); if (IS_ERR(icd-clk)) { ret = PTR_ERR(icd-clk); goto eclkreg; @@ -1561,7 +1561,7 @@ static int scan_async_group(struct soc_camera_host *ici, snprintf(clk_name, sizeof(clk_name), %d-%04x, sasd-asd.match.i2c.adapter_id, sasd-asd.match.i2c.address); - icd-clk = v4l2_clk_register(soc_camera_clk_ops, clk_name, mclk, icd); + icd-clk = v4l2_clk_register(soc_camera_clk_ops, clk_name, icd); if (IS_ERR(icd-clk)) { ret = PTR_ERR(icd-clk); goto eclkreg; @@ -1666,7 +1666,7 @@ static int soc_of_bind(struct soc_camera_host *ici, snprintf(clk_name, sizeof(clk_name), of-%s, of_node_full_name(remote)); - icd-clk = v4l2_clk_register(soc_camera_clk_ops, clk_name, mclk, icd); + icd-clk = v4l2_clk_register(soc_camera_clk_ops, clk_name, icd); if (IS_ERR(icd-clk)) { ret = PTR_ERR(icd-clk); goto eclkreg; diff --git a/drivers/media/usb/em28xx/em28xx-camera.c b/drivers/media/usb/em28xx/em28xx-camera.c index 7be661f..a4b22c2 100644 --- a/drivers/media/usb/em28xx/em28xx-camera.c +++ b/drivers/media/usb/em28xx/em28xx-camera.c @@ -330,7 +330,7 @@ int em28xx_init_camera(struct em28xx *dev) v4l2_clk_name_i2c(clk_name, sizeof(clk_name), i2c_adapter_id(adap), client-addr); - v4l2-clk = v4l2_clk_register_fixed(clk_name, mclk, -EINVAL); + v4l2-clk = v4l2_clk_register_fixed(clk_name, -EINVAL); if (IS_ERR(v4l2-clk)) return PTR_ERR(v4l2-clk); diff --git a/drivers/media/v4l2-core/v4l2-clk.c b/drivers/media/v4l2-core/v4l2-clk.c index e18cc04..c210906 100644 --- a/drivers/media/v4l2-core/v4l2-clk.c +++ b/drivers/media/v4l2-core/v4l2-clk.c @@ -31,7 +31,8 @@ static struct v4l2_clk *v4l2_clk_find(const char *dev_id, const char *id) if (strcmp(dev_id, clk-dev_id)) continue; - if (!id || !clk-id || !strcmp(clk-id, id)) + if ((!id !clk-id) || + (id clk-id !strcmp(clk-id, id))) return clk; } @@ -127,8 +128,8 @@ void v4l2_clk_disable(struct v4l2_clk *clk) mutex_lock(clk-lock); enable = --clk-enable; - if (WARN(enable 0, Unbalanced %s() on %s:%s!\n, __func__, -clk-dev_id, clk-id)) + if (WARN(enable 0, Unbalanced %s() on %s!\n, __func__, +clk-dev_id)) clk-enable++; else if (!enable clk-ops-disable) clk-ops-disable(clk); @@ -181,7 +182,7 @@ EXPORT_SYMBOL(v4l2_clk_set_rate); struct v4l2_clk *v4l2_clk_register(const struct v4l2_clk_ops *ops, const char *dev_id, - const char *id, void *priv) + void *priv) { struct v4l2_clk *clk; int ret; @@ -193,9 +194,8 @@ struct v4l2_clk *v4l2_clk_register(const struct v4l2_clk_ops *ops, if (!clk) return ERR_PTR(-ENOMEM); - clk-id =
[PATCHv3 08/20] dvbdev: add pad for the DVB devnodes
We want to represent the links between the several DVB devnodes, so let's create PADs for them. The DVB net devnode is a different matter, as it is not related to the media stream, but with network. So, at least for now, let's not add any pad for it. Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c index d975cbb29705..1071d31b7f1d 100644 --- a/drivers/media/dvb-core/dvbdev.c +++ b/drivers/media/dvb-core/dvbdev.c @@ -184,7 +184,7 @@ static void dvb_register_media_device(struct dvb_device *dvbdev, int type, int minor) { #if defined(CONFIG_MEDIA_CONTROLLER) - int ret; + int ret = 0, npads; if (!dvbdev-adapter-mdev) return; @@ -196,18 +196,46 @@ static void dvb_register_media_device(struct dvb_device *dvbdev, dvbdev-entity-info.dvb.major = DVB_MAJOR; dvbdev-entity-info.dvb.minor = minor; dvbdev-entity-name = dvbdev-name; + + switch(type) { + case DVB_DEVICE_CA: + case DVB_DEVICE_DEMUX: + npads = 2; + break; + case DVB_DEVICE_NET: + npads = 0; + break; + default: + npads = 1; + } + + if (npads) { + dvbdev-pads = kcalloc(npads, sizeof(*dvbdev-pads), + GFP_KERNEL); + if (!dvbdev-pads) { + kfree(dvbdev-entity); + return; + } + } + switch(type) { case DVB_DEVICE_FRONTEND: dvbdev-entity-type = MEDIA_ENT_T_DEVNODE_DVB_FE; + dvbdev-pads[0].flags = MEDIA_PAD_FL_SOURCE; break; case DVB_DEVICE_DEMUX: dvbdev-entity-type = MEDIA_ENT_T_DEVNODE_DVB_DEMUX; + dvbdev-pads[0].flags = MEDIA_PAD_FL_SOURCE; + dvbdev-pads[1].flags = MEDIA_PAD_FL_SINK; break; case DVB_DEVICE_DVR: dvbdev-entity-type = MEDIA_ENT_T_DEVNODE_DVB_DVR; + dvbdev-pads[0].flags = MEDIA_PAD_FL_SINK; break; case DVB_DEVICE_CA: dvbdev-entity-type = MEDIA_ENT_T_DEVNODE_DVB_CA; + dvbdev-pads[0].flags = MEDIA_PAD_FL_SOURCE; + dvbdev-pads[1].flags = MEDIA_PAD_FL_SINK; break; case DVB_DEVICE_NET: dvbdev-entity-type = MEDIA_ENT_T_DEVNODE_DVB_NET; @@ -218,11 +246,16 @@ static void dvb_register_media_device(struct dvb_device *dvbdev, return; } - ret = media_device_register_entity(dvbdev-adapter-mdev, dvbdev-entity); + if (npads) + ret = media_entity_init(dvbdev-entity, npads, dvbdev-pads, 0); + if (!ret) + ret = media_device_register_entity(dvbdev-adapter-mdev, + dvbdev-entity); if (ret 0) { printk(KERN_ERR %s: media_device_register_entity failed for %s\n, __func__, dvbdev-entity-name); + kfree(dvbdev-pads); kfree(dvbdev-entity); dvbdev-entity = NULL; return; @@ -335,6 +368,7 @@ void dvb_unregister_device(struct dvb_device *dvbdev) if (dvbdev-entity) { media_device_unregister_entity(dvbdev-entity); kfree(dvbdev-entity); + kfree(dvbdev-pads); } #endif diff --git a/drivers/media/dvb-core/dvbdev.h b/drivers/media/dvb-core/dvbdev.h index ace8575975d8..c037c2ff9f5a 100644 --- a/drivers/media/dvb-core/dvbdev.h +++ b/drivers/media/dvb-core/dvbdev.h @@ -101,8 +101,9 @@ struct dvb_device { #if defined(CONFIG_MEDIA_CONTROLLER) const char *name; - /* Filled inside dvbdev.c */ + /* Allocated and filled inside dvbdev.c */ struct media_entity *entity; + struct media_pad *pads; #endif void *priv; -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCHv3 17/20] dvb-frontend: enable tuner link when the FE thread starts
If the dvb frontend thread starts, the tuner should be switched to the frontend. Add a code that ensures that this will happen, using the media controller. Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index c2c559105f64..04e949ad9722 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -590,12 +590,99 @@ static void dvb_frontend_wakeup(struct dvb_frontend *fe) wake_up_interruptible(fepriv-wait_queue); } +/** + * dvb_enable_media_tuner() - tries to enable the DVB tuner + * + * @fe:struct dvb_frontend pointer + * + * This function ensures that just one media tuner is enabled for a given + * frontend. It has two different behaviors: + * - For trivial devices with just one tuner: + * it just enables the existing tuner-fe link + * - For devices with more than one tuner: + * It is up to the driver to implement the logic that will enable one tuner + * and disable the other ones. However, if more than one tuner is enabled for + * the same frontend, it will print an error message and return -EINVAL. + * + * At return, it will return the error code returned by media_entity_setup_link, + * or 0 if everything is OK, if no tuner is linked to the frontend or if the + * mdev is NULL. + */ +static int dvb_enable_media_tuner(struct dvb_frontend *fe) +{ +#ifdef CONFIG_MEDIA_CONTROLLER + struct dvb_frontend_private *fepriv = fe-frontend_priv; + struct dvb_adapter *adapter = fe-dvb; + struct media_device *mdev = adapter-mdev; + struct media_entity *entity, *source; + struct media_link *link, *found_link = NULL; + int i, ret, n_links = 0, active_links = 0; + + if (!mdev) + return 0; + + entity = fepriv-dvbdev-entity; + for (i = 0; i entity-num_links; i++) { + link = entity-links[i]; + if (link-sink-entity == entity) { + found_link = link; + n_links++; + if (link-flags MEDIA_LNK_FL_ENABLED) + active_links++; + } + } + + if (!n_links || active_links == 1 || !found_link) + return 0; + + /* +* If a frontend has more than one tuner linked, it is up to the driver +* to select with one will be the active one, as the frontend core can't +* guess. If the driver doesn't do that, it is a bug. +*/ + if (n_links 1 active_links != 1) { + dev_err(fe-dvb-device, + WARNING: there are %d active links among %d tuners. This is a driver's bug!\n, + active_links, n_links); + return -EINVAL; + } + + source = found_link-source-entity; + for (i = 0; i source-num_links; i++) { + struct media_entity *sink; + int flags = 0; + + link = source-links[i]; + sink = link-sink-entity; + + if (sink == entity) + flags = MEDIA_LNK_FL_ENABLED; + + ret = media_entity_setup_link(link, flags); + if (ret) { + dev_err(fe-dvb-device, + Couldn't change link %s-%s to %s. Error %d\n, + source-name, sink-name, + flags ? enabled : disabled, + ret); + return ret; + } else + dev_dbg(fe-dvb-device, + link %s-%s was %s\n, + source-name, sink-name, + flags ? ENABLED : disabled); + } +#endif + return 0; +} + static int dvb_frontend_thread(void *data) { struct dvb_frontend *fe = data; struct dvb_frontend_private *fepriv = fe-frontend_priv; fe_status_t s; enum dvbfe_algo algo; + int ret; bool re_tune = false; bool semheld = false; @@ -609,6 +696,13 @@ static int dvb_frontend_thread(void *data) fepriv-wakeup = 0; fepriv-reinitialise = 0; + ret = dvb_enable_media_tuner(fe); + if (ret) { + /* FIXME: return an error if it fails */ + dev_info(fe-dvb-device, + proceeding with FE task\n); + } + dvb_frontend_init(fe); set_freezable(); -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCHv3 20/20] dvb_frontend: start media pipeline while thread is running
While the DVB thread is running, the media pipeline should be streaming. This should prevent any attempt of using the analog TV while digital TV is working, and vice-versa. Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index 04e949ad9722..1bee3834e2e1 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -131,6 +131,11 @@ struct dvb_frontend_private { int quality; unsigned int check_wrapped; enum dvbfe_search algo_status; + +#if defined(CONFIG_MEDIA_CONTROLLER) + struct media_pipeline pipe; + struct media_entity *pipe_start_entity; +#endif }; static void dvb_frontend_wakeup(struct dvb_frontend *fe); @@ -608,9 +613,9 @@ static void dvb_frontend_wakeup(struct dvb_frontend *fe) * or 0 if everything is OK, if no tuner is linked to the frontend or if the * mdev is NULL. */ +#ifdef CONFIG_MEDIA_CONTROLLER static int dvb_enable_media_tuner(struct dvb_frontend *fe) { -#ifdef CONFIG_MEDIA_CONTROLLER struct dvb_frontend_private *fepriv = fe-frontend_priv; struct dvb_adapter *adapter = fe-dvb; struct media_device *mdev = adapter-mdev; @@ -618,10 +623,14 @@ static int dvb_enable_media_tuner(struct dvb_frontend *fe) struct media_link *link, *found_link = NULL; int i, ret, n_links = 0, active_links = 0; + fepriv-pipe_start_entity = NULL; + if (!mdev) return 0; entity = fepriv-dvbdev-entity; + fepriv-pipe_start_entity = entity; + for (i = 0; i entity-num_links; i++) { link = entity-links[i]; if (link-sink-entity == entity) { @@ -648,6 +657,7 @@ static int dvb_enable_media_tuner(struct dvb_frontend *fe) } source = found_link-source-entity; + fepriv-pipe_start_entity = source; for (i = 0; i source-num_links; i++) { struct media_entity *sink; int flags = 0; @@ -672,9 +682,9 @@ static int dvb_enable_media_tuner(struct dvb_frontend *fe) source-name, sink-name, flags ? ENABLED : disabled); } -#endif return 0; } +#endif static int dvb_frontend_thread(void *data) { @@ -696,12 +706,19 @@ static int dvb_frontend_thread(void *data) fepriv-wakeup = 0; fepriv-reinitialise = 0; +#ifdef CONFIG_MEDIA_CONTROLLER ret = dvb_enable_media_tuner(fe); if (ret) { /* FIXME: return an error if it fails */ dev_info(fe-dvb-device, proceeding with FE task\n); + } else { + ret = media_entity_pipeline_start(fepriv-pipe_start_entity, + fepriv-pipe); + if (ret) + return ret; } +#endif dvb_frontend_init(fe); @@ -812,6 +829,11 @@ restart: } } +#ifdef CONFIG_MEDIA_CONTROLLER + media_entity_pipeline_stop(fepriv-pipe_start_entity); + fepriv-pipe_start_entity = NULL; +#endif + if (dvb_powerdown_on_sleep) { if (fe-ops.set_voltage) fe-ops.set_voltage(fe, SEC_VOLTAGE_OFF); -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCHv3 16/20] dvbdev: enable DVB-specific links
For now, let's keep the DVB-specific media controller links enabled by default. On most devices, this is fixed anyway, so no big issue. Ok, the demux actually have dynamic links based on the filters, but we don't represent them yet, as the media controller currently lacks the capability of dynamically create/delete entities. Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c index 30acf97f4e4b..1b99cc17836c 100644 --- a/drivers/media/dvb-core/dvbdev.c +++ b/drivers/media/dvb-core/dvbdev.c @@ -414,13 +414,13 @@ void dvb_create_media_graph(struct media_device *mdev) media_entity_create_link(tuner, 0, fe, 0, 0); if (fe demux) - media_entity_create_link(fe, 1, demux, 0, 0); + media_entity_create_link(fe, 1, demux, 0, MEDIA_LNK_FL_ENABLED); if (demux dvr) - media_entity_create_link(demux, 1, dvr, 0, 0); + media_entity_create_link(demux, 1, dvr, 0, MEDIA_LNK_FL_ENABLED); if (demux ca) - media_entity_create_link(demux, 1, ca, 0, 0); + media_entity_create_link(demux, 1, ca, 0, MEDIA_LNK_FL_ENABLED); #endif } EXPORT_SYMBOL_GPL(dvb_create_media_graph); -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCHv3 14/20] dvbdev: add a function to create DVB media graph
We need to create a DVB graph, linking the several DVB devnodes. Add such function. Please notice that this helper function doesn't take into account devices with multiple DVB adapters and frontends. Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c index 3aaffb319688..30acf97f4e4b 100644 --- a/drivers/media/dvb-core/dvbdev.c +++ b/drivers/media/dvb-core/dvbdev.c @@ -380,6 +380,51 @@ void dvb_unregister_device(struct dvb_device *dvbdev) } EXPORT_SYMBOL(dvb_unregister_device); + +void dvb_create_media_graph(struct media_device *mdev) +{ +#ifdef CONFIG_MEDIA_CONTROLLER + struct media_entity *entity, *tuner = NULL, *fe = NULL; + struct media_entity *demux = NULL, *dvr = NULL, *ca = NULL; + + if (!mdev) + return; + + media_device_for_each_entity(entity, mdev) { + switch (entity-type) { + case MEDIA_ENT_T_V4L2_SUBDEV_TUNER: + tuner = entity; + break; + case MEDIA_ENT_T_DEVNODE_DVB_FE: + fe = entity; + break; + case MEDIA_ENT_T_DEVNODE_DVB_DEMUX: + demux = entity; + break; + case MEDIA_ENT_T_DEVNODE_DVB_DVR: + dvr = entity; + break; + case MEDIA_ENT_T_DEVNODE_DVB_CA: + ca = entity; + break; + } + } + + if (tuner fe) + media_entity_create_link(tuner, 0, fe, 0, 0); + + if (fe demux) + media_entity_create_link(fe, 1, demux, 0, 0); + + if (demux dvr) + media_entity_create_link(demux, 1, dvr, 0, 0); + + if (demux ca) + media_entity_create_link(demux, 1, ca, 0, 0); +#endif +} +EXPORT_SYMBOL_GPL(dvb_create_media_graph); + static int dvbdev_check_free_adapter_num(int num) { struct list_head *entry; diff --git a/drivers/media/dvb-core/dvbdev.h b/drivers/media/dvb-core/dvbdev.h index c037c2ff9f5a..3ee767449fff 100644 --- a/drivers/media/dvb-core/dvbdev.h +++ b/drivers/media/dvb-core/dvbdev.h @@ -122,6 +122,7 @@ extern int dvb_register_device (struct dvb_adapter *adap, int type); extern void dvb_unregister_device (struct dvb_device *dvbdev); +void dvb_create_media_graph(struct media_device *mdev); extern int dvb_generic_open (struct inode *inode, struct file *file); extern int dvb_generic_release (struct inode *inode, struct file *file); -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCHv3 18/20] cx231xx: enable tuner-decoder link at videobuf start
The tuner-decoder needs to be enabled when we're about to start streaming. Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c b/drivers/media/usb/cx231xx/cx231xx-video.c index f3d1a488dfa7..634763535d60 100644 --- a/drivers/media/usb/cx231xx/cx231xx-video.c +++ b/drivers/media/usb/cx231xx/cx231xx-video.c @@ -703,6 +703,74 @@ static void free_buffer(struct videobuf_queue *vq, struct cx231xx_buffer *buf) buf-vb.state = VIDEOBUF_NEEDS_INIT; } +static int cx231xx_enable_analog_tuner(struct cx231xx *dev) +{ +#ifdef CONFIG_MEDIA_CONTROLLER + struct media_device *mdev = dev-media_dev; + struct media_entity *entity, *decoder = NULL, *source; + struct media_link *link, *found_link = NULL; + int i, ret, active_links = 0; + + if (!mdev) + return 0; + +/* + * This will find the tuner that it is connected into the decoder. + * Technically, this is not 100% correct, as the device may be using an + * analog input instead of the tuner. However, we can't use the DVB for dvb + * while the DMA engine is being used for V4L2. + */ + media_device_for_each_entity(entity, mdev) { + if (entity-type == MEDIA_ENT_T_V4L2_SUBDEV_DECODER) { + decoder = entity; + break; + } + } + if (!decoder) + return 0; + + for (i = 0; i decoder-num_links; i++) { + link = decoder-links[i]; + if (link-sink-entity == decoder) { + found_link = link; + if (link-flags MEDIA_LNK_FL_ENABLED) + active_links++; + break; + } + } + + if (active_links == 1 || !found_link) + return 0; + + source = found_link-source-entity; + for (i = 0; i source-num_links; i++) { + struct media_entity *sink; + int flags = 0; + + link = source-links[i]; + sink = link-sink-entity; + + if (sink == entity) + flags = MEDIA_LNK_FL_ENABLED; + + ret = media_entity_setup_link(link, flags); + if (ret) { + dev_err(dev-dev, + Couldn't change link %s-%s to %s. Error %d\n, + source-name, sink-name, + flags ? enabled : disabled, + ret); + return ret; + } else + dev_dbg(dev-dev, + link %s-%s was %s\n, + source-name, sink-name, + flags ? ENABLED : disabled); + } +#endif + return 0; +} + static int buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, enum v4l2_field field) @@ -756,6 +824,9 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, } buf-vb.state = VIDEOBUF_PREPARED; + + cx231xx_enable_analog_tuner(dev); + return 0; fail: -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCHv3 02/20] dvbdev: add support for media controller
Provide a way to register media controller device nodes at the DVB core. Please notice that the dvbdev callers also require changes for the devices to be registered via the media controller. Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c index 983db75de350..d975cbb29705 100644 --- a/drivers/media/dvb-core/dvbdev.c +++ b/drivers/media/dvb-core/dvbdev.c @@ -180,6 +180,58 @@ skip: return -ENFILE; } +static void dvb_register_media_device(struct dvb_device *dvbdev, + int type, int minor) +{ +#if defined(CONFIG_MEDIA_CONTROLLER) + int ret; + + if (!dvbdev-adapter-mdev) + return; + + dvbdev-entity = kzalloc(sizeof(*dvbdev-entity), GFP_KERNEL); + if (!dvbdev-entity) + return; + + dvbdev-entity-info.dvb.major = DVB_MAJOR; + dvbdev-entity-info.dvb.minor = minor; + dvbdev-entity-name = dvbdev-name; + switch(type) { + case DVB_DEVICE_FRONTEND: + dvbdev-entity-type = MEDIA_ENT_T_DEVNODE_DVB_FE; + break; + case DVB_DEVICE_DEMUX: + dvbdev-entity-type = MEDIA_ENT_T_DEVNODE_DVB_DEMUX; + break; + case DVB_DEVICE_DVR: + dvbdev-entity-type = MEDIA_ENT_T_DEVNODE_DVB_DVR; + break; + case DVB_DEVICE_CA: + dvbdev-entity-type = MEDIA_ENT_T_DEVNODE_DVB_CA; + break; + case DVB_DEVICE_NET: + dvbdev-entity-type = MEDIA_ENT_T_DEVNODE_DVB_NET; + break; + default: + kfree(dvbdev-entity); + dvbdev-entity = NULL; + return; + } + + ret = media_device_register_entity(dvbdev-adapter-mdev, dvbdev-entity); + if (ret 0) { + printk(KERN_ERR + %s: media_device_register_entity failed for %s\n, + __func__, dvbdev-entity-name); + kfree(dvbdev-entity); + dvbdev-entity = NULL; + return; + } + + printk(KERN_DEBUG %s: media device '%s' registered.\n, + __func__, dvbdev-entity-name); +#endif +} int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, const struct dvb_device *template, void *priv, int type) @@ -258,10 +310,11 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, __func__, adap-num, dnames[type], id, PTR_ERR(clsdev)); return PTR_ERR(clsdev); } - dprintk(KERN_DEBUG DVB: register adapter%d/%s%d @ minor: %i (0x%02x)\n, adap-num, dnames[type], id, minor, minor); + dvb_register_media_device(dvbdev, type, minor); + return 0; } EXPORT_SYMBOL(dvb_register_device); @@ -278,6 +331,13 @@ void dvb_unregister_device(struct dvb_device *dvbdev) device_destroy(dvb_class, MKDEV(DVB_MAJOR, dvbdev-minor)); +#if defined(CONFIG_MEDIA_CONTROLLER) + if (dvbdev-entity) { + media_device_unregister_entity(dvbdev-entity); + kfree(dvbdev-entity); + } +#endif + list_del (dvbdev-list_head); kfree (dvbdev-fops); kfree (dvbdev); diff --git a/drivers/media/dvb-core/dvbdev.h b/drivers/media/dvb-core/dvbdev.h index f96b28e7fc95..ace8575975d8 100644 --- a/drivers/media/dvb-core/dvbdev.h +++ b/drivers/media/dvb-core/dvbdev.h @@ -27,6 +27,7 @@ #include linux/poll.h #include linux/fs.h #include linux/list.h +#include media/media-device.h #define DVB_MAJOR 212 @@ -71,6 +72,10 @@ struct dvb_adapter { int mfe_shared; /* indicates mutually exclusive frontends */ struct dvb_device *mfe_dvbdev; /* frontend device in use */ struct mutex mfe_lock; /* access lock for thread creation */ + +#if defined(CONFIG_MEDIA_CONTROLLER) + struct media_device *mdev; +#endif }; @@ -92,6 +97,14 @@ struct dvb_device { /* don't really need those !? -- FIXME: use video_usercopy */ int (*kernel_ioctl)(struct file *file, unsigned int cmd, void *arg); + /* Needed for media controller register/unregister */ +#if defined(CONFIG_MEDIA_CONTROLLER) + const char *name; + + /* Filled inside dvbdev.c */ + struct media_entity *entity; +#endif + void *priv; }; -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCHv3 06/20] dvb_ca_en50221: add support for CA node at the media controller
Make the dvb core CA support aware of the media controller and register the corresponding devices. Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com diff --git a/drivers/media/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb-core/dvb_ca_en50221.c index 0aac3096728e..22258e15baa9 100644 --- a/drivers/media/dvb-core/dvb_ca_en50221.c +++ b/drivers/media/dvb-core/dvb_ca_en50221.c @@ -1638,15 +1638,17 @@ static const struct file_operations dvb_ca_fops = { .llseek = noop_llseek, }; -static struct dvb_device dvbdev_ca = { +static const struct dvb_device dvbdev_ca = { .priv = NULL, .users = 1, .readers = 1, .writers = 1, +#if defined(CONFIG_MEDIA_CONTROLLER) + .name = ca_en50221, +#endif .fops = dvb_ca_fops, }; - /* */ /* Initialisation/shutdown functions */ -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCHv3 09/20] tuner-core: properly initialize media controller subdev
Properly initialize tuner core subdev at the media controller. That requires a new subtype at the media controller API. Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com diff --git a/drivers/media/v4l2-core/tuner-core.c b/drivers/media/v4l2-core/tuner-core.c index 559f8372e2eb..9a83b27a7e8f 100644 --- a/drivers/media/v4l2-core/tuner-core.c +++ b/drivers/media/v4l2-core/tuner-core.c @@ -134,6 +134,9 @@ struct tuner { unsigned inttype; /* chip type id */ void*config; const char *name; +#if defined(CONFIG_MEDIA_CONTROLLER) + struct media_padpad; +#endif }; /* @@ -434,6 +437,8 @@ static void set_type(struct i2c_client *c, unsigned int type, t-name = analog_ops-info.name; } + t-sd.entity.name = t-name; + tuner_dbg(type set to %s\n, t-name); t-mode_mask = new_mode_mask; @@ -592,6 +597,9 @@ static int tuner_probe(struct i2c_client *client, struct tuner *t; struct tuner *radio; struct tuner *tv; +#ifdef CONFIG_MEDIA_CONTROLLER + int ret; +#endif t = kzalloc(sizeof(struct tuner), GFP_KERNEL); if (NULL == t) @@ -684,6 +692,18 @@ static int tuner_probe(struct i2c_client *client, /* Should be just before return */ register_client: +#if defined(CONFIG_MEDIA_CONTROLLER) + t-pad.flags = MEDIA_PAD_FL_SOURCE; + t-sd.entity.type = MEDIA_ENT_T_V4L2_SUBDEV_TUNER; + t-sd.entity.name = t-name; + + ret = media_entity_init(t-sd.entity, 1, t-pad, 0); + if (ret 0) { + tuner_err(failed to initialize media entity!\n); + kfree(t); + return -ENODEV; + } +#endif /* Sets a default mode */ if (t-mode_mask T_ANALOG_TV) t-mode = V4L2_TUNER_ANALOG_TV; diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h index 707db275f92b..5ffde035789b 100644 --- a/include/uapi/linux/media.h +++ b/include/uapi/linux/media.h @@ -66,6 +66,8 @@ struct media_device_info { /* A converter of analogue video to its digital representation. */ #define MEDIA_ENT_T_V4L2_SUBDEV_DECODER(MEDIA_ENT_T_V4L2_SUBDEV + 4) +#define MEDIA_ENT_T_V4L2_SUBDEV_TUNER (MEDIA_ENT_T_V4L2_SUBDEV + 5) + #define MEDIA_ENT_FL_DEFAULT (1 0) struct media_entity_desc { -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCHv3 19/20] cx231xx: create a streaming pipeline at VB start
When videobuf starts, create a streaming pipeline, destroying it when the stream stops. Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c b/drivers/media/usb/cx231xx/cx231xx-video.c index 634763535d60..c5ded52ba7ed 100644 --- a/drivers/media/usb/cx231xx/cx231xx-video.c +++ b/drivers/media/usb/cx231xx/cx231xx-video.c @@ -705,11 +705,12 @@ static void free_buffer(struct videobuf_queue *vq, struct cx231xx_buffer *buf) static int cx231xx_enable_analog_tuner(struct cx231xx *dev) { + int ret = 0; #ifdef CONFIG_MEDIA_CONTROLLER struct media_device *mdev = dev-media_dev; struct media_entity *entity, *decoder = NULL, *source; struct media_link *link, *found_link = NULL; - int i, ret, active_links = 0; + int i; if (!mdev) return 0; @@ -733,13 +734,11 @@ static int cx231xx_enable_analog_tuner(struct cx231xx *dev) link = decoder-links[i]; if (link-sink-entity == decoder) { found_link = link; - if (link-flags MEDIA_LNK_FL_ENABLED) - active_links++; break; } } - if (active_links == 1 || !found_link) + if (!found_link) return 0; source = found_link-source-entity; @@ -767,8 +766,12 @@ static int cx231xx_enable_analog_tuner(struct cx231xx *dev) source-name, sink-name, flags ? ENABLED : disabled); } + + dev-pipe_start_entity = source; + ret = media_entity_pipeline_start(dev-pipe_start_entity, dev-pipe); + #endif - return 0; + return ret; } static int @@ -804,6 +807,10 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, if (!dev-video_mode.bulk_ctl.num_bufs) urb_init = 1; } + rc = cx231xx_enable_analog_tuner(dev); + if (rc 0) + goto fail; + dev_dbg(dev-dev, urb_init=%d dev-video_mode.max_pkt_size=%d\n, urb_init, dev-video_mode.max_pkt_size); @@ -825,11 +832,15 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, buf-vb.state = VIDEOBUF_PREPARED; - cx231xx_enable_analog_tuner(dev); - return 0; fail: +#ifdef CONFIG_MEDIA_CONTROLLER + if (dev-pipe_start_entity) { + media_entity_pipeline_stop(dev-pipe_start_entity); + dev-pipe_start_entity = NULL; + } +#endif free_buffer(vq, buf); return rc; } @@ -857,6 +868,12 @@ static void buffer_release(struct videobuf_queue *vq, cx231xx_isocdbg(cx231xx: called buffer_release\n); +#ifdef CONFIG_MEDIA_CONTROLLER + if (dev-pipe_start_entity) { + media_entity_pipeline_stop(dev-pipe_start_entity); + dev-pipe_start_entity = NULL; + } +#endif free_buffer(vq, buf); } diff --git a/drivers/media/usb/cx231xx/cx231xx.h b/drivers/media/usb/cx231xx/cx231xx.h index e0d3106f6b44..fa5742801169 100644 --- a/drivers/media/usb/cx231xx/cx231xx.h +++ b/drivers/media/usb/cx231xx/cx231xx.h @@ -661,6 +661,8 @@ struct cx231xx { #if defined(CONFIG_MEDIA_CONTROLLER) struct media_device *media_dev; struct media_pad video_pad, vbi_pad; + struct media_pipeline pipe; + struct media_entity *pipe_start_entity; #endif unsigned char eedata[256]; -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCHv3 00/20] dvb core: add basic support for the media controller
This patch series adds basic support for the media controller at the DVB core: it creates one media entity per DVB devnode, if the media device is passed as an argument to the DVB structures. The cx231xx driver was modified to pass such argument for DVB NET, DVB frontend and DVB demux. - version 3: - Added the second series of patches (add link graph to cx231xx using the media controller) - tuner-core and cx25840: add proper error handling as suggested by Sakari Ailus and pointed by Joe Perches; - dvb core: move the media_dev struct to be inside the DVB adapter. That allowed to simplify the changes for the dvbdev clients; - Add logic to setup the pipelines when analog or digital TV stream starts. - Renamed some patches to better describe its contents. version 2: - Now the PADs are created for all nodes - Instead of using entity-flags for subtypes, create separate MEDIA_ENT_T_DEVNODE_DVB_foo for each DVB devtype - The API change patch was split from the DVB core changes TODO: - Update media API docbook for the DVB media controller changes - Solve the issues pointed by a separate e-mail Those patches are also available at my experimental tree: http://git.linuxtv.org/cgit.cgi/mchehab/experimental-v4l-utils.git/log/?h=dvb-media-ctl Mauro Carvalho Chehab (20): media: add new types for DVB devnodes dvbdev: add support for media controller cx231xx: add media controller support dvb_frontend: add media controller support for DVB frontend dmxdev: add support for demux/dvr nodes at media controller dvb_ca_en50221: add support for CA node at the media controller dvb_net: add support for DVB net node at the media controller dvbdev: add pad for the DVB devnodes tuner-core: properly initialize media controller subdev cx25840: fill the media controller entity cx231xx: initialize video/vbi pads cx231xx: create media links for analog mode dvbdev: represent frontend with two pads dvbdev: add a function to create DVB media graph cx231xx: create DVB graph dvbdev: enable DVB-specific links dvb-frontend: enable tuner link when the FE thread starts cx231xx: enable tuner-decoder link at videobuf start cx231xx: create a streaming pipeline at VB start dvb_frontend: start media pipeline while thread is running drivers/media/dvb-core/dmxdev.c | 11 ++- drivers/media/dvb-core/dvb_ca_en50221.c | 6 +- drivers/media/dvb-core/dvb_frontend.c | 121 - drivers/media/dvb-core/dvb_net.c | 6 +- drivers/media/dvb-core/dvbdev.c | 143 +- drivers/media/dvb-core/dvbdev.h | 15 drivers/media/i2c/cx25840/cx25840-core.c | 18 drivers/media/i2c/cx25840/cx25840-core.h | 3 + drivers/media/usb/cx231xx/cx231xx-cards.c | 98 ++-- drivers/media/usb/cx231xx/cx231xx-dvb.c | 4 + drivers/media/usb/cx231xx/cx231xx-video.c | 101 - drivers/media/usb/cx231xx/cx231xx.h | 7 ++ drivers/media/v4l2-core/tuner-core.c | 20 + include/uapi/linux/media.h| 11 ++- 14 files changed, 547 insertions(+), 17 deletions(-) -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCHv3 04/20] dvb_frontend: add media controller support for DVB frontend
Now that the dvb core is capable of registering devices via the media controller, add support for the DVB frontend devices. Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index 2cf30576bf39..c2c559105f64 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -2612,11 +2612,14 @@ int dvb_register_frontend(struct dvb_adapter* dvb, struct dvb_frontend* fe) { struct dvb_frontend_private *fepriv; - static const struct dvb_device dvbdev_template = { + const struct dvb_device dvbdev_template = { .users = ~0, .writers = 1, .readers = (~0)-1, .fops = dvb_frontend_fops, +#if defined(CONFIG_MEDIA_CONTROLLER) + .name = fe-ops.info.name, +#endif .kernel_ioctl = dvb_frontend_ioctl }; -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCHv3 10/20] cx25840: fill the media controller entity
Instead of keeping the media controller entity not initialized, fill it and create the pads for cx25840. Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com diff --git a/drivers/media/i2c/cx25840/cx25840-core.c b/drivers/media/i2c/cx25840/cx25840-core.c index 573e08826b9b..bdb5bb6b58da 100644 --- a/drivers/media/i2c/cx25840/cx25840-core.c +++ b/drivers/media/i2c/cx25840/cx25840-core.c @@ -5137,6 +5137,9 @@ static int cx25840_probe(struct i2c_client *client, int default_volume; u32 id; u16 device_id; +#if defined(CONFIG_MEDIA_CONTROLLER) + int ret; +#endif /* Check if the adapter supports the needed features */ if (!i2c_check_functionality(client-adapter, I2C_FUNC_SMBUS_BYTE_DATA)) @@ -5178,6 +5181,21 @@ static int cx25840_probe(struct i2c_client *client, sd = state-sd; v4l2_i2c_subdev_init(sd, client, cx25840_ops); +#if defined(CONFIG_MEDIA_CONTROLLER) + /* TODO: need to represent analog inputs too */ + state-pads[0].flags = MEDIA_PAD_FL_SINK; /* Tuner or input */ + state-pads[1].flags = MEDIA_PAD_FL_SOURCE; /* Video */ + state-pads[2].flags = MEDIA_PAD_FL_SOURCE; /* VBI */ + sd-entity.type = MEDIA_ENT_T_V4L2_SUBDEV_DECODER; + + ret = media_entity_init(sd-entity, ARRAY_SIZE(state-pads), + state-pads, 0); + if (ret 0) { + v4l_info(client, failed to initialize media entity!\n); + kfree(state); + return -ENODEV; + } +#endif switch (id) { case CX23885_AV: diff --git a/drivers/media/i2c/cx25840/cx25840-core.h b/drivers/media/i2c/cx25840/cx25840-core.h index 37bc04217c44..17b409f55445 100644 --- a/drivers/media/i2c/cx25840/cx25840-core.h +++ b/drivers/media/i2c/cx25840/cx25840-core.h @@ -64,6 +64,9 @@ struct cx25840_state { wait_queue_head_t fw_wait;/* wake up when the fw load is finished */ struct work_struct fw_work; /* work entry for fw load */ struct cx25840_ir_state *ir_state; +#if defined(CONFIG_MEDIA_CONTROLLER) + struct media_padpads[3]; +#endif }; static inline struct cx25840_state *to_state(struct v4l2_subdev *sd) -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCHv3 07/20] dvb_net: add support for DVB net node at the media controller
Make the dvb core network support aware of the media controller and register the corresponding devices. Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com diff --git a/drivers/media/dvb-core/dvb_net.c b/drivers/media/dvb-core/dvb_net.c index e4041f074909..bd3c2be80216 100644 --- a/drivers/media/dvb-core/dvb_net.c +++ b/drivers/media/dvb-core/dvb_net.c @@ -1498,14 +1498,16 @@ static const struct file_operations dvb_net_fops = { .llseek = noop_llseek, }; -static struct dvb_device dvbdev_net = { +static const struct dvb_device dvbdev_net = { .priv = NULL, .users = 1, .writers = 1, +#if defined(CONFIG_MEDIA_CONTROLLER) + .name = dvb net, +#endif .fops = dvb_net_fops, }; - void dvb_net_release (struct dvb_net *dvbnet) { int i; -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCHv3 01/20] media: add new types for DVB devnodes
Most of the DVB subdevs have already their own devnode. Add support for them at the media controller API. Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h index 7902e800f019..707db275f92b 100644 --- a/include/uapi/linux/media.h +++ b/include/uapi/linux/media.h @@ -50,7 +50,14 @@ struct media_device_info { #define MEDIA_ENT_T_DEVNODE_V4L(MEDIA_ENT_T_DEVNODE + 1) #define MEDIA_ENT_T_DEVNODE_FB (MEDIA_ENT_T_DEVNODE + 2) #define MEDIA_ENT_T_DEVNODE_ALSA (MEDIA_ENT_T_DEVNODE + 3) -#define MEDIA_ENT_T_DEVNODE_DVB(MEDIA_ENT_T_DEVNODE + 4) +#define MEDIA_ENT_T_DEVNODE_DVB_FE (MEDIA_ENT_T_DEVNODE + 4) +#define MEDIA_ENT_T_DEVNODE_DVB_DEMUX (MEDIA_ENT_T_DEVNODE + 5) +#define MEDIA_ENT_T_DEVNODE_DVB_DVR(MEDIA_ENT_T_DEVNODE + 6) +#define MEDIA_ENT_T_DEVNODE_DVB_CA (MEDIA_ENT_T_DEVNODE + 7) +#define MEDIA_ENT_T_DEVNODE_DVB_NET(MEDIA_ENT_T_DEVNODE + 8) + +/* Legacy symbol. Use it to avoid userspace compilation breakages */ +#define MEDIA_ENT_T_DEVNODE_DVBMEDIA_ENT_T_DEVNODE_DVB_FE #define MEDIA_ENT_T_V4L2_SUBDEV(2 MEDIA_ENT_TYPE_SHIFT) #define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR (MEDIA_ENT_T_V4L2_SUBDEV + 1) -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCHv3 13/20] dvbdev: represent frontend with two pads
While on some devices the tuner is bound inside the frontend, other devices use a separate subdevice for it. So, in order to be more generic, better to map it with two pads. That will allows to use the media controller to lock the tuner between the DVB and the V4L2 sub-drivers, on hybrid devices. While here, change the logic to use pad 0 as sink for devices with both sink and source pads. Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c index 1071d31b7f1d..3aaffb319688 100644 --- a/drivers/media/dvb-core/dvbdev.c +++ b/drivers/media/dvb-core/dvbdev.c @@ -200,6 +200,7 @@ static void dvb_register_media_device(struct dvb_device *dvbdev, switch(type) { case DVB_DEVICE_CA: case DVB_DEVICE_DEMUX: + case DVB_DEVICE_FRONTEND: npads = 2; break; case DVB_DEVICE_NET: @@ -221,12 +222,13 @@ static void dvb_register_media_device(struct dvb_device *dvbdev, switch(type) { case DVB_DEVICE_FRONTEND: dvbdev-entity-type = MEDIA_ENT_T_DEVNODE_DVB_FE; - dvbdev-pads[0].flags = MEDIA_PAD_FL_SOURCE; + dvbdev-pads[0].flags = MEDIA_PAD_FL_SINK; + dvbdev-pads[1].flags = MEDIA_PAD_FL_SOURCE; break; case DVB_DEVICE_DEMUX: dvbdev-entity-type = MEDIA_ENT_T_DEVNODE_DVB_DEMUX; - dvbdev-pads[0].flags = MEDIA_PAD_FL_SOURCE; - dvbdev-pads[1].flags = MEDIA_PAD_FL_SINK; + dvbdev-pads[0].flags = MEDIA_PAD_FL_SINK; + dvbdev-pads[1].flags = MEDIA_PAD_FL_SOURCE; break; case DVB_DEVICE_DVR: dvbdev-entity-type = MEDIA_ENT_T_DEVNODE_DVB_DVR; @@ -234,8 +236,8 @@ static void dvb_register_media_device(struct dvb_device *dvbdev, break; case DVB_DEVICE_CA: dvbdev-entity-type = MEDIA_ENT_T_DEVNODE_DVB_CA; - dvbdev-pads[0].flags = MEDIA_PAD_FL_SOURCE; - dvbdev-pads[1].flags = MEDIA_PAD_FL_SINK; + dvbdev-pads[0].flags = MEDIA_PAD_FL_SINK; + dvbdev-pads[1].flags = MEDIA_PAD_FL_SOURCE; break; case DVB_DEVICE_NET: dvbdev-entity-type = MEDIA_ENT_T_DEVNODE_DVB_NET; -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCHv3 11/20] cx231xx: initialize video/vbi pads
Both video and vbi are sink pads. Initialize them as such. Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c b/drivers/media/usb/cx231xx/cx231xx-video.c index ecea76fe07f6..f3d1a488dfa7 100644 --- a/drivers/media/usb/cx231xx/cx231xx-video.c +++ b/drivers/media/usb/cx231xx/cx231xx-video.c @@ -2121,7 +2121,12 @@ int cx231xx_register_analog_devices(struct cx231xx *dev) dev_err(dev-dev, cannot allocate video_device.\n); return -ENODEV; } - +#if defined(CONFIG_MEDIA_CONTROLLER) + dev-video_pad.flags = MEDIA_PAD_FL_SINK; + ret = media_entity_init(dev-vdev-entity, 1, dev-video_pad, 0); + if (ret 0) + dev_err(dev-dev, failed to initialize video media entity!\n); +#endif dev-vdev-ctrl_handler = dev-ctrl_handler; /* register v4l2 video video_device */ ret = video_register_device(dev-vdev, VFL_TYPE_GRABBER, @@ -2147,6 +2152,12 @@ int cx231xx_register_analog_devices(struct cx231xx *dev) dev_err(dev-dev, cannot allocate video_device.\n); return -ENODEV; } +#if defined(CONFIG_MEDIA_CONTROLLER) + dev-vbi_pad.flags = MEDIA_PAD_FL_SINK; + ret = media_entity_init(dev-vbi_dev-entity, 1, dev-vbi_pad, 0); + if (ret 0) + dev_err(dev-dev, failed to initialize vbi media entity!\n); +#endif dev-vbi_dev-ctrl_handler = dev-ctrl_handler; /* register v4l2 vbi video_device */ ret = video_register_device(dev-vbi_dev, VFL_TYPE_VBI, diff --git a/drivers/media/usb/cx231xx/cx231xx.h b/drivers/media/usb/cx231xx/cx231xx.h index af9d6c4041dc..e0d3106f6b44 100644 --- a/drivers/media/usb/cx231xx/cx231xx.h +++ b/drivers/media/usb/cx231xx/cx231xx.h @@ -660,6 +660,7 @@ struct cx231xx { #if defined(CONFIG_MEDIA_CONTROLLER) struct media_device *media_dev; + struct media_pad video_pad, vbi_pad; #endif unsigned char eedata[256]; -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCHv3 12/20] cx231xx: create media links for analog mode
Now that we have entities and pads, let's create media links between them, for analog setup. We may not have all the links for digital yet, as the dvb extention may not be loaded yet. Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c b/drivers/media/usb/cx231xx/cx231xx-cards.c index 7e1c73a5172d..5cc4efcf82d6 100644 --- a/drivers/media/usb/cx231xx/cx231xx-cards.c +++ b/drivers/media/usb/cx231xx/cx231xx-cards.c @@ -1159,6 +1159,42 @@ static void cx231xx_media_device_register(struct cx231xx *dev, #endif } +static void cx231xx_create_media_graph(struct cx231xx *dev) +{ +#ifdef CONFIG_MEDIA_CONTROLLER + struct media_device *mdev = dev-media_dev; + struct media_entity *entity; + struct media_entity *tuner = NULL, *decoder = NULL; + + if (!mdev) + return; + + media_device_for_each_entity(entity, mdev) { + switch (entity-type) { + case MEDIA_ENT_T_V4L2_SUBDEV_TUNER: + tuner = entity; + break; + case MEDIA_ENT_T_V4L2_SUBDEV_DECODER: + decoder = entity; + break; + } + } + + /* Analog setup, using tuner as a link */ + + if (!decoder) + return; + + if (tuner) + media_entity_create_link(tuner, 0, decoder, 0, +MEDIA_LNK_FL_ENABLED); + media_entity_create_link(decoder, 1, dev-vdev-entity, 0, +MEDIA_LNK_FL_ENABLED); + media_entity_create_link(decoder, 2, dev-vbi_dev-entity, 0, +MEDIA_LNK_FL_ENABLED); +#endif +} + /* * cx231xx_init_dev() * allocates and inits the device structs, registers i2c bus and v4l device @@ -1615,6 +1651,8 @@ static int cx231xx_usb_probe(struct usb_interface *interface, /* load other modules required */ request_modules(dev); + cx231xx_create_media_graph(dev); + return 0; err_video_alt: /* cx231xx_uninit_dev: */ -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCHv3 05/20] dmxdev: add support for demux/dvr nodes at media controller
Make the dvb core demux support aware of the media controller and register the corresponding devices. Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com diff --git a/drivers/media/dvb-core/dmxdev.c b/drivers/media/dvb-core/dmxdev.c index abff803ad69a..a2ccd8095aed 100644 --- a/drivers/media/dvb-core/dmxdev.c +++ b/drivers/media/dvb-core/dmxdev.c @@ -1136,10 +1136,13 @@ static const struct file_operations dvb_demux_fops = { .llseek = default_llseek, }; -static struct dvb_device dvbdev_demux = { +static const struct dvb_device dvbdev_demux = { .priv = NULL, .users = 1, .writers = 1, +#if defined(CONFIG_MEDIA_CONTROLLER) + .name = demux, +#endif .fops = dvb_demux_fops }; @@ -1209,13 +1212,15 @@ static const struct file_operations dvb_dvr_fops = { .llseek = default_llseek, }; -static struct dvb_device dvbdev_dvr = { +static const struct dvb_device dvbdev_dvr = { .priv = NULL, .readers = 1, .users = 1, +#if defined(CONFIG_MEDIA_CONTROLLER) + .name = dvr, +#endif .fops = dvb_dvr_fops }; - int dvb_dmxdev_init(struct dmxdev *dmxdev, struct dvb_adapter *dvb_adapter) { int i; -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCHv3 15/20] cx231xx: create DVB graph
cx231xx is simple with regards to DVB: all boards have just one DVB adapter. So, we can use the default DVB helper function to create the DVB media graph. Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com diff --git a/drivers/media/usb/cx231xx/cx231xx-dvb.c b/drivers/media/usb/cx231xx/cx231xx-dvb.c index 05d21b9f30d8..1d7e9a719caa 100644 --- a/drivers/media/usb/cx231xx/cx231xx-dvb.c +++ b/drivers/media/usb/cx231xx/cx231xx-dvb.c @@ -539,6 +539,7 @@ static int register_dvb(struct cx231xx_dvb *dvb, /* register network adapter */ dvb_net_init(dvb-adapter, dvb-net, dvb-demux.dmx); + dvb_create_media_graph(dev-media_dev); return 0; fail_fe_conn: -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCHv3 03/20] cx231xx: add media controller support
Let's add media controller support for this driver and register it for both V4L and DVB. The media controller on this driver is not mandatory, as it can fully work without it. So, if the media controller register fails, just print an error message, but proceed with device registering. Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c b/drivers/media/usb/cx231xx/cx231xx-cards.c index ae05d591f228..7e1c73a5172d 100644 --- a/drivers/media/usb/cx231xx/cx231xx-cards.c +++ b/drivers/media/usb/cx231xx/cx231xx-cards.c @@ -912,9 +912,6 @@ static inline void cx231xx_set_model(struct cx231xx *dev) */ void cx231xx_pre_card_setup(struct cx231xx *dev) { - - cx231xx_set_model(dev); - dev_info(dev-dev, Identified as %s (card=%d)\n, dev-board.name, dev-model); @@ -1092,6 +1089,17 @@ void cx231xx_config_i2c(struct cx231xx *dev) call_all(dev, video, s_stream, 1); } +static void cx231xx_unregister_media_device(struct cx231xx *dev) +{ +#ifdef CONFIG_MEDIA_CONTROLLER + if (dev-media_dev) { + media_device_unregister(dev-media_dev); + kfree(dev-media_dev); + dev-media_dev = NULL; + } +#endif +} + /* * cx231xx_realease_resources() * unregisters the v4l2,i2c and usb devices @@ -1099,6 +1107,8 @@ void cx231xx_config_i2c(struct cx231xx *dev) */ void cx231xx_release_resources(struct cx231xx *dev) { + cx231xx_unregister_media_device(dev); + cx231xx_release_analog_resources(dev); cx231xx_remove_from_devlist(dev); @@ -1117,6 +1127,38 @@ void cx231xx_release_resources(struct cx231xx *dev) clear_bit(dev-devno, cx231xx_devused); } +static void cx231xx_media_device_register(struct cx231xx *dev, + struct usb_device *udev) +{ +#ifdef CONFIG_MEDIA_CONTROLLER + struct media_device *mdev; + int ret; + + mdev = kzalloc(sizeof(*mdev), GFP_KERNEL); + if (!mdev) + return; + + mdev-dev = dev-dev; + strlcpy(mdev-model, dev-board.name, sizeof(mdev-model)); + if (udev-serial) + strlcpy(mdev-serial, udev-serial, sizeof(mdev-serial)); + strcpy(mdev-bus_info, udev-devpath); + mdev-hw_revision = le16_to_cpu(udev-descriptor.bcdDevice); + mdev-driver_version = LINUX_VERSION_CODE; + + ret = media_device_register(mdev); + if (ret) { + dev_err(dev-dev, + Couldn't create a media device. Error: %d\n, + ret); + kfree(mdev); + return; + } + + dev-media_dev = mdev; +#endif +} + /* * cx231xx_init_dev() * allocates and inits the device structs, registers i2c bus and v4l device @@ -1225,10 +1267,8 @@ static int cx231xx_init_dev(struct cx231xx *dev, struct usb_device *udev, } retval = cx231xx_register_analog_devices(dev); - if (retval) { - cx231xx_release_analog_resources(dev); + if (retval) goto err_analog; - } cx231xx_ir_init(dev); @@ -1236,6 +1276,8 @@ static int cx231xx_init_dev(struct cx231xx *dev, struct usb_device *udev, return 0; err_analog: + cx231xx_unregister_media_device(dev); + cx231xx_release_analog_resources(dev); cx231xx_remove_from_devlist(dev); err_dev_init: cx231xx_dev_uninit(dev); @@ -1437,6 +1479,8 @@ static int cx231xx_usb_probe(struct usb_interface *interface, dev-video_mode.alt = -1; dev-dev = d; + cx231xx_set_model(dev); + dev-interface_count++; /* reset gpio dir and value */ dev-gpio_dir = 0; @@ -1501,7 +1545,11 @@ static int cx231xx_usb_probe(struct usb_interface *interface, /* save our data pointer in this interface device */ usb_set_intfdata(interface, dev); + /* Register the media controller */ + cx231xx_media_device_register(dev, udev); + /* Create v4l2 device */ + dev-v4l2_dev.mdev = dev-media_dev; retval = v4l2_device_register(interface-dev, dev-v4l2_dev); if (retval) { dev_err(d, v4l2_device_register failed\n); diff --git a/drivers/media/usb/cx231xx/cx231xx-dvb.c b/drivers/media/usb/cx231xx/cx231xx-dvb.c index dd600b994e69..05d21b9f30d8 100644 --- a/drivers/media/usb/cx231xx/cx231xx-dvb.c +++ b/drivers/media/usb/cx231xx/cx231xx-dvb.c @@ -455,6 +455,7 @@ static int register_dvb(struct cx231xx_dvb *dvb, mutex_init(dvb-lock); + /* register adapter */ result = dvb_register_adapter(dvb-adapter, dev-name, module, device, adapter_nr); @@ -465,6 +466,8 @@ static int register_dvb(struct cx231xx_dvb *dvb, goto fail_adapter; } + dvb-adapter.mdev = dev-media_dev; + /* Ensure all frontends negotiate bus access */ dvb-frontend-ops.ts_bus_ctrl =
Re: [PATCH 1/2] V4L: remove clock name from v4l2_clk API
Hi, Guennadi On 1/7/2015 6:17 AM, Guennadi Liakhovetski wrote: Hi Josh, On Tue, 6 Jan 2015, Josh Wu wrote: Hi, Guennadi After look deep into this patch, I found you miss one line that should be changed as well. It's In function v4l2_clk_get(), there still has one line code called v4l2_clk_find(dev_id, id). You need to change it to v4l2_clk_find(dev_id, NULL) as well. Otherwise the code that many sensor used: v4l2_clk_get(client-dev, mclk) cannot acquired the mclk clock. After above changes, this patch works for me. I think you're right, in fact, since we now don't store CCF-based v4l2_clk wrappers on the list, this can be simplified even further, I'll update the patch. Did you only test this patch or both? I tested both patches with Atmel-isi driver. For the 2/2 patch I applied the modification Laurent suggested. Those patches works for me. The only concern is in ov2640 I still need to acquired two v4l2 clocks: xvclk that will get the xvclk CCF clock directly. mclk that make ISI driver call his clock_start()/stop() to enable/disable ISI's peripheral clock. If I only get xvclk clock, then the camera capture will be failed with a ISI timeout error. But I think this is acceptable as we will keep go forward. Finally we'll switch to CCF and removed the v4l2_clock then we will move the clock_start()/stop() caller code to soc_camera.c. Best Regards, Josh Wu Thanks Guennadi On 1/2/2015 7:48 PM, Guennadi Liakhovetski wrote: All uses of the v4l2_clk API so far only register one clock with a fixed name. This allows us to get rid of it, which also will make CCF and DT integration easier. Signed-off-by: Guennadi Liakhovetski g.liakhovet...@gmx.de --- drivers/media/platform/soc_camera/soc_camera.c | 6 +++--- drivers/media/usb/em28xx/em28xx-camera.c | 2 +- drivers/media/v4l2-core/v4l2-clk.c | 24 +++- include/media/v4l2-clk.h | 7 +++ 4 files changed, 18 insertions(+), 21 deletions(-) diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c index f4be2a1..ce192b6 100644 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c @@ -1380,7 +1380,7 @@ static int soc_camera_i2c_init(struct soc_camera_device *icd, snprintf(clk_name, sizeof(clk_name), %d-%04x, shd-i2c_adapter_id, shd-board_info-addr); -icd-clk = v4l2_clk_register(soc_camera_clk_ops, clk_name, mclk, icd); + icd-clk = v4l2_clk_register(soc_camera_clk_ops, clk_name, icd); if (IS_ERR(icd-clk)) { ret = PTR_ERR(icd-clk); goto eclkreg; @@ -1561,7 +1561,7 @@ static int scan_async_group(struct soc_camera_host *ici, snprintf(clk_name, sizeof(clk_name), %d-%04x, sasd-asd.match.i2c.adapter_id, sasd-asd.match.i2c.address); -icd-clk = v4l2_clk_register(soc_camera_clk_ops, clk_name, mclk, icd); + icd-clk = v4l2_clk_register(soc_camera_clk_ops, clk_name, icd); if (IS_ERR(icd-clk)) { ret = PTR_ERR(icd-clk); goto eclkreg; @@ -1666,7 +1666,7 @@ static int soc_of_bind(struct soc_camera_host *ici, snprintf(clk_name, sizeof(clk_name), of-%s, of_node_full_name(remote)); -icd-clk = v4l2_clk_register(soc_camera_clk_ops, clk_name, mclk, icd); + icd-clk = v4l2_clk_register(soc_camera_clk_ops, clk_name, icd); if (IS_ERR(icd-clk)) { ret = PTR_ERR(icd-clk); goto eclkreg; diff --git a/drivers/media/usb/em28xx/em28xx-camera.c b/drivers/media/usb/em28xx/em28xx-camera.c index 7be661f..a4b22c2 100644 --- a/drivers/media/usb/em28xx/em28xx-camera.c +++ b/drivers/media/usb/em28xx/em28xx-camera.c @@ -330,7 +330,7 @@ int em28xx_init_camera(struct em28xx *dev) v4l2_clk_name_i2c(clk_name, sizeof(clk_name), i2c_adapter_id(adap), client-addr); - v4l2-clk = v4l2_clk_register_fixed(clk_name, mclk, -EINVAL); + v4l2-clk = v4l2_clk_register_fixed(clk_name, -EINVAL); if (IS_ERR(v4l2-clk)) return PTR_ERR(v4l2-clk); diff --git a/drivers/media/v4l2-core/v4l2-clk.c b/drivers/media/v4l2-core/v4l2-clk.c index e18cc04..c210906 100644 --- a/drivers/media/v4l2-core/v4l2-clk.c +++ b/drivers/media/v4l2-core/v4l2-clk.c @@ -31,7 +31,8 @@ static struct v4l2_clk *v4l2_clk_find(const char *dev_id, const char *id) if (strcmp(dev_id, clk-dev_id)) continue; -if (!id || !clk-id || !strcmp(clk-id, id)) + if ((!id !clk-id) || + (id clk-id !strcmp(clk-id, id))) return clk; } @@ -127,8 +128,8 @@ void v4l2_clk_disable(struct v4l2_clk *clk) mutex_lock(clk-lock); enable = --clk-enable; - if (WARN(enable 0, Unbalanced %s() on %s:%s!\n, __func__, -
[PATCH] lirc_dev: avoid potential null-dereference
We have to check pointer for NULL and then dereference it. Signed-off-by: Andy Shevchenko andy.shevche...@gmail.com --- drivers/media/rc/lirc_dev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c index 1e0545a..4de0e85 100644 --- a/drivers/media/rc/lirc_dev.c +++ b/drivers/media/rc/lirc_dev.c @@ -553,14 +553,14 @@ unsigned int lirc_dev_fop_poll(struct file *file, poll_table *wait) if (!ir-attached) return POLLERR; - poll_wait(file, ir-buf-wait_poll, wait); + if (ir-buf) { + poll_wait(file, ir-buf-wait_poll, wait); - if (ir-buf) if (lirc_buffer_empty(ir-buf)) ret = 0; else ret = POLLIN | POLLRDNORM; - else + } else ret = POLLERR; dev_dbg(ir-d.dev, LOGHEAD poll result = %d\n, -- 1.8.3.101.g727a46b -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] V4L: remove clock name from v4l2_clk API
Hi, Guennadi On 1/7/2015 6:17 AM, Guennadi Liakhovetski wrote: Hi Josh, On Tue, 6 Jan 2015, Josh Wu wrote: Hi, Guennadi After look deep into this patch, I found you miss one line that should be changed as well. It's In function v4l2_clk_get(), there still has one line code called v4l2_clk_find(dev_id, id). You need to change it to v4l2_clk_find(dev_id, NULL) as well. Otherwise the code that many sensor used: v4l2_clk_get(client-dev, mclk) cannot acquired the mclk clock. After above changes, this patch works for me. I think you're right, in fact, since we now don't store CCF-based v4l2_clk wrappers on the list, this can be simplified even further, I'll update the patch. Did you only test this patch or both? I tested both patches with Atmel-isi driver. For the 2/2 patch I applied the modification Laurent suggested. Those patches works for me. The only concern is in ov2640 I still need to acquired two v4l2 clocks: xvclk that will get the xvclk CCF clock directly. mclk that make ISI driver call his clock_start()/stop() to enable/disable ISI's peripheral clock. If I only get xvclk clock, then the camera capture will be failed with a ISI timeout error. But I think this is acceptable as we will keep go forward. Finally we'll switch to CCF and removed the v4l2_clock then we will move the clock_start()/stop() caller code to soc_camera.c. Best Regards, Josh Wu Thanks Guennadi On 1/2/2015 7:48 PM, Guennadi Liakhovetski wrote: All uses of the v4l2_clk API so far only register one clock with a fixed name. This allows us to get rid of it, which also will make CCF and DT integration easier. Signed-off-by: Guennadi Liakhovetski g.liakhovet...@gmx.de --- drivers/media/platform/soc_camera/soc_camera.c | 6 +++--- drivers/media/usb/em28xx/em28xx-camera.c | 2 +- drivers/media/v4l2-core/v4l2-clk.c | 24 +++- include/media/v4l2-clk.h | 7 +++ 4 files changed, 18 insertions(+), 21 deletions(-) diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c index f4be2a1..ce192b6 100644 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c @@ -1380,7 +1380,7 @@ static int soc_camera_i2c_init(struct soc_camera_device *icd, snprintf(clk_name, sizeof(clk_name), %d-%04x, shd-i2c_adapter_id, shd-board_info-addr); -icd-clk = v4l2_clk_register(soc_camera_clk_ops, clk_name, mclk, icd); + icd-clk = v4l2_clk_register(soc_camera_clk_ops, clk_name, icd); if (IS_ERR(icd-clk)) { ret = PTR_ERR(icd-clk); goto eclkreg; @@ -1561,7 +1561,7 @@ static int scan_async_group(struct soc_camera_host *ici, snprintf(clk_name, sizeof(clk_name), %d-%04x, sasd-asd.match.i2c.adapter_id, sasd-asd.match.i2c.address); -icd-clk = v4l2_clk_register(soc_camera_clk_ops, clk_name, mclk, icd); + icd-clk = v4l2_clk_register(soc_camera_clk_ops, clk_name, icd); if (IS_ERR(icd-clk)) { ret = PTR_ERR(icd-clk); goto eclkreg; @@ -1666,7 +1666,7 @@ static int soc_of_bind(struct soc_camera_host *ici, snprintf(clk_name, sizeof(clk_name), of-%s, of_node_full_name(remote)); -icd-clk = v4l2_clk_register(soc_camera_clk_ops, clk_name, mclk, icd); + icd-clk = v4l2_clk_register(soc_camera_clk_ops, clk_name, icd); if (IS_ERR(icd-clk)) { ret = PTR_ERR(icd-clk); goto eclkreg; diff --git a/drivers/media/usb/em28xx/em28xx-camera.c b/drivers/media/usb/em28xx/em28xx-camera.c index 7be661f..a4b22c2 100644 --- a/drivers/media/usb/em28xx/em28xx-camera.c +++ b/drivers/media/usb/em28xx/em28xx-camera.c @@ -330,7 +330,7 @@ int em28xx_init_camera(struct em28xx *dev) v4l2_clk_name_i2c(clk_name, sizeof(clk_name), i2c_adapter_id(adap), client-addr); - v4l2-clk = v4l2_clk_register_fixed(clk_name, mclk, -EINVAL); + v4l2-clk = v4l2_clk_register_fixed(clk_name, -EINVAL); if (IS_ERR(v4l2-clk)) return PTR_ERR(v4l2-clk); diff --git a/drivers/media/v4l2-core/v4l2-clk.c b/drivers/media/v4l2-core/v4l2-clk.c index e18cc04..c210906 100644 --- a/drivers/media/v4l2-core/v4l2-clk.c +++ b/drivers/media/v4l2-core/v4l2-clk.c @@ -31,7 +31,8 @@ static struct v4l2_clk *v4l2_clk_find(const char *dev_id, const char *id) if (strcmp(dev_id, clk-dev_id)) continue; -if (!id || !clk-id || !strcmp(clk-id, id)) + if ((!id !clk-id) || + (id clk-id !strcmp(clk-id, id))) return clk; } @@ -127,8 +128,8 @@ void v4l2_clk_disable(struct v4l2_clk *clk) mutex_lock(clk-lock); enable = --clk-enable; - if (WARN(enable 0, Unbalanced %s() on %s:%s!\n, __func__, -
[PATCH] [media] soc_camera: avoid potential null-dereference
We have to check the pointer before dereferencing it. Signed-off-by: Andy Shevchenko andy.shevche...@gmail.com --- drivers/media/platform/soc_camera/soc_camera.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c index b3db51c..8c665c4 100644 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c @@ -2166,7 +2166,7 @@ static int soc_camera_video_start(struct soc_camera_device *icd) static int soc_camera_pdrv_probe(struct platform_device *pdev) { struct soc_camera_desc *sdesc = pdev-dev.platform_data; - struct soc_camera_subdev_desc *ssdd = sdesc-subdev_desc; + struct soc_camera_subdev_desc *ssdd; struct soc_camera_device *icd; int ret; @@ -2177,6 +2177,8 @@ static int soc_camera_pdrv_probe(struct platform_device *pdev) if (!icd) return -ENOMEM; + ssdd = sdesc-subdev_desc; + /* * In the asynchronous case ssdd-num_regulators == 0 yet, so, the below * regulator allocation is a dummy. They are actually requested by the -- 1.8.3.101.g727a46b -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
cron job: media_tree daily build: ERRORS
This message is generated daily by a cron job that builds media_tree for the kernels and architectures in the list below. Results of the daily build of media_tree: date: Wed Jan 7 04:00:11 CET 2015 git branch: test git hash: 99f3cd52aee21091ce62442285a68873e3be833f gcc version:i686-linux-gcc (GCC) 4.9.1 sparse version: v0.5.0-41-g6c2d743 smatch version: 0.4.1-3153-g7d56ab3 host hardware: x86_64 host os:3.18.0-1.slh.1-amd64 linux-git-arm-at91: OK linux-git-arm-davinci: OK linux-git-arm-exynos: OK linux-git-arm-mx: OK linux-git-arm-omap: OK linux-git-arm-omap1: OK linux-git-arm-pxa: OK linux-git-blackfin: OK 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.32.27-i686: ERRORS linux-2.6.33.7-i686: ERRORS linux-2.6.34.7-i686: ERRORS linux-2.6.35.9-i686: ERRORS linux-2.6.36.4-i686: ERRORS linux-2.6.37.6-i686: ERRORS linux-2.6.38.8-i686: ERRORS linux-2.6.39.4-i686: ERRORS linux-3.0.60-i686: ERRORS linux-3.1.10-i686: ERRORS linux-3.2.37-i686: ERRORS linux-3.3.8-i686: ERRORS linux-3.4.27-i686: ERRORS linux-3.5.7-i686: ERRORS linux-3.6.11-i686: ERRORS linux-3.7.4-i686: ERRORS linux-3.8-i686: ERRORS linux-3.9.2-i686: ERRORS linux-3.10.1-i686: ERRORS linux-3.11.1-i686: ERRORS linux-3.12.23-i686: ERRORS linux-3.13.11-i686: ERRORS linux-3.14.9-i686: ERRORS linux-3.15.2-i686: ERRORS linux-3.16-i686: ERRORS linux-3.17-i686: ERRORS linux-3.18-i686: ERRORS linux-2.6.32.27-x86_64: ERRORS linux-2.6.33.7-x86_64: ERRORS linux-2.6.34.7-x86_64: ERRORS linux-2.6.35.9-x86_64: ERRORS linux-2.6.36.4-x86_64: ERRORS linux-2.6.37.6-x86_64: ERRORS linux-2.6.38.8-x86_64: ERRORS linux-2.6.39.4-x86_64: ERRORS linux-3.0.60-x86_64: ERRORS linux-3.1.10-x86_64: ERRORS linux-3.2.37-x86_64: ERRORS linux-3.3.8-x86_64: ERRORS linux-3.4.27-x86_64: ERRORS linux-3.5.7-x86_64: ERRORS linux-3.6.11-x86_64: ERRORS linux-3.7.4-x86_64: ERRORS linux-3.8-x86_64: ERRORS linux-3.9.2-x86_64: ERRORS linux-3.10.1-x86_64: ERRORS linux-3.11.1-x86_64: ERRORS linux-3.12.23-x86_64: ERRORS linux-3.13.11-x86_64: ERRORS linux-3.14.9-x86_64: ERRORS linux-3.15.2-x86_64: ERRORS linux-3.16-x86_64: ERRORS linux-3.17-x86_64: ERRORS linux-3.18-x86_64: ERRORS apps: OK spec-git: OK sparse: WARNINGS smatch: ERRORS Detailed results are available here: http://www.xs4all.nl/~hverkuil/logs/Wednesday.log Full logs are available here: http://www.xs4all.nl/~hverkuil/logs/Wednesday.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
[PATCH 2/2] [media] v4l: vsp1: Fix VI6_DISP_IRQ_STA_LNE macro
LNE bit in VI6_DISP_IRQ_STA register are from the 0 bit to 4 bit. This fixes bit position specified by VI6_DISP_IRQ_STA_LNE. Signed-off-by: Nobuhiro Iwamatsu nobuhiro.iwamatsu...@renesas.com --- drivers/media/platform/vsp1/vsp1_regs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/vsp1/vsp1_regs.h b/drivers/media/platform/vsp1/vsp1_regs.h index 79d4063..da3c573 100644 --- a/drivers/media/platform/vsp1/vsp1_regs.h +++ b/drivers/media/platform/vsp1/vsp1_regs.h @@ -48,7 +48,7 @@ #define VI6_DISP_IRQ_STA 0x007c #define VI6_DISP_IRQ_STA_DSE (1 8) #define VI6_DISP_IRQ_STA_MAE (1 5) -#define VI6_DISP_IRQ_STA_LNE(n)(1 ((n) + 4)) +#define VI6_DISP_IRQ_STA_LNE(n)(1 (n)) #define VI6_WPF_LINE_COUNT(n) (0x0084 + (n) * 4) #define VI6_WPF_LINE_COUNT_MASK(0x1f 0) -- 2.1.3 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] [media] v4l: vsp1: Fix VI6_DISP_IRQ_ENB_LNEE macro
LNEE bit in VI6_DISP_IRQ_ENB register are from the 0 bit to 4 bit. This fixes bit position specified by VI6_DISP_IRQ_ENB_LNEE. Signed-off-by: Nobuhiro Iwamatsu nobuhiro.iwamatsu...@renesas.com --- drivers/media/platform/vsp1/vsp1_regs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/vsp1/vsp1_regs.h b/drivers/media/platform/vsp1/vsp1_regs.h index 55f163d..79d4063 100644 --- a/drivers/media/platform/vsp1/vsp1_regs.h +++ b/drivers/media/platform/vsp1/vsp1_regs.h @@ -43,7 +43,7 @@ #define VI6_DISP_IRQ_ENB 0x0078 #define VI6_DISP_IRQ_ENB_DSTE (1 8) #define VI6_DISP_IRQ_ENB_MAEE (1 5) -#define VI6_DISP_IRQ_ENB_LNEE(n) (1 ((n) + 4)) +#define VI6_DISP_IRQ_ENB_LNEE(n) (1 (n)) #define VI6_DISP_IRQ_STA 0x007c #define VI6_DISP_IRQ_STA_DSE (1 8) -- 2.1.3 -- 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