aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb-core (follow)
AgeCommit message (Collapse)AuthorFilesLines
2016-07-23[media] doc-rst: add some needed escape codesMauro Carvalho Chehab2-15/+15
Some extra escape codes are needed to avoid Sphinx to not identify the tags. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-07-23[media] dvb_ringbuffer.h: some documentation improvementsMauro Carvalho Chehab1-5/+10
Better document a note on this header. While here, better format dvb_ringbuffer_pkt_read_user() to adjust it to CodingStyle. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-07-23[media] doc-rst: Fix some Sphinx warningsMauro Carvalho Chehab1-0/+7
Fix all remaining media warnings with ReST that are fixable without changing at the Sphinx code. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-07-23Merge branch 'patchwork' into topic/docs-nextMauro Carvalho Chehab8-38/+120
* patchwork: (1492 commits) [media] cec: always check all_device_types and features [media] cec: poll should check if there is room in the tx queue [media] vivid: support monitor all mode [media] cec: fix test for unconfigured adapter in main message loop [media] cec: limit the size of the transmit queue [media] cec: zero unused msg part after msg->len [media] cec: don't set fh to NULL in CEC_TRANSMIT [media] cec: clear all status fields before transmit and always fill in sequence [media] cec: CEC_RECEIVE overwrote the timeout field [media] cxd2841er: Reading SNR for DVB-C added [media] cxd2841er: Reading BER and UCB for DVB-C added [media] cxd2841er: fix switch-case for DVB-C [media] cxd2841er: fix signal strength scale for ISDB-T [media] cxd2841er: adjust the dB scale for DVB-C [media] cxd2841er: provide signal strength for DVB-C [media] cxd2841er: fix BER report via DVBv5 stats API [media] mb86a20s: apply mask to val after checking for read failure [media] airspy: fix error logic during device register [media] s5p-cec/TODO: add TODO item [media] cec/TODO: drop comment about sphinx documentation ... Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-07-17[media] doc-rst: Fix conversion for dvb-core.rstMauro Carvalho Chehab1-45/+45
The conversion from DocBook required some fixes: - Now, the C files with the exported symbols also need to be added. So, all headers need to be included twice: one to get the structs/enums/.. and another one for the functions; - Notes should use the ReST tag, as kernel-doc doesn't recognizes it anymore; - Identation needs to be fixed, as ReST uses it to identify when a format "tag" ends. - Fix the cross-references at the media controller description. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-07-17[media] doc-rst: Convert media API to rstMauro Carvalho Chehab2-90/+8
Move the contents of the media section at DocBooks/DocBook/device-drivers.tmpl to a new ReST book. For now, the contents is kept as-is. Next patches will fix the warnings and add cross-references that were removed due to the conversion. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-07-13[media] dvb-core/en50221: use kref to manage struct dvb_ca_privateMax Kellermann1-1/+23
Don't free the object until the file handle has been closed. Fixes use-after-free bug which occurs when I disconnect my DVB-S received while VDR is running. This is a crash dump of such a use-after-free: general protection fault: 0000 [#1] SMP CPU: 0 PID: 2541 Comm: CI adapter on d Not tainted 4.7.0-rc1-hosting+ #49 Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011 task: ffff880027d7ce00 ti: ffff88003d8f8000 task.ti: ffff88003d8f8000 RIP: 0010:[<ffffffff812f3d1f>] [<ffffffff812f3d1f>] dvb_ca_en50221_io_read_condition.isra.7+0x6f/0x150 RSP: 0018:ffff88003d8fba98 EFLAGS: 00010206 RAX: 0000000059534255 RBX: 000000753d470f90 RCX: ffff88003c74d181 RDX: 00000001bea04ba9 RSI: ffff88003d8fbaf4 RDI: 3a3030a56d763fc0 RBP: ffff88003d8fbae0 R08: ffff88003c74d180 R09: 0000000000000000 R10: 0000000000000001 R11: 0000000000000000 R12: ffff88003c480e00 R13: 00000000ffffffff R14: 0000000059534255 R15: 0000000000000000 FS: 00007fb4209b4700(0000) GS:ffff88003fc00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f06445f4078 CR3: 000000003c55b000 CR4: 00000000000006b0 Stack: ffff88003d8fbaf4 000000003c2170c0 0000000000004000 0000000000000000 ffff88003c480e00 ffff88003d8fbc80 ffff88003c74d180 ffff88003d8fbb8c 0000000000000000 ffff88003d8fbb10 ffffffff812f3e37 ffff88003d8fbb00 Call Trace: [<ffffffff812f3e37>] dvb_ca_en50221_io_poll+0x37/0xa0 [<ffffffff8113109b>] do_sys_poll+0x2db/0x520 This is a backtrace of the kernel attempting to lock a freed mutex: #0 0xffffffff81083d40 in rep_nop () at ./arch/x86/include/asm/processor.h:569 #1 cpu_relax () at ./arch/x86/include/asm/processor.h:574 #2 virt_spin_lock (lock=<optimized out>) at ./arch/x86/include/asm/qspinlock.h:57 #3 native_queued_spin_lock_slowpath (lock=0xffff88003c480e90, val=761492029) at kernel/locking/qspinlock.c:304 #4 0xffffffff810d1a06 in pv_queued_spin_lock_slowpath (val=<optimized out>, lock=<optimized out>) at ./arch/x86/include/asm/paravirt.h:669 #5 queued_spin_lock_slowpath (val=<optimized out>, lock=<optimized out>) at ./arch/x86/include/asm/qspinlock.h:28 #6 queued_spin_lock (lock=<optimized out>) at include/asm-generic/qspinlock.h:107 #7 __mutex_lock_common (use_ww_ctx=<optimized out>, ww_ctx=<optimized out>, ip=<optimized out>, nest_lock=<optimized out>, subclass=<optimized out>, state=<optimized out>, lock=<optimized out>) at kernel/locking/mutex.c:526 #8 mutex_lock_interruptible_nested (lock=0xffff88003c480e88, subclass=<optimized out>) at kernel/locking/mutex.c:647 #9 0xffffffff812f49fe in dvb_ca_en50221_io_do_ioctl (file=<optimized out>, cmd=761492029, parg=0x1 <irq_stack_union+1>) at drivers/media/dvb-core/dvb_ca_en50221.c:1210 #10 0xffffffff812ee660 in dvb_usercopy (file=<optimized out>, cmd=761492029, arg=<optimized out>, func=<optimized out>) at drivers/media/dvb-core/dvbdev.c:883 #11 0xffffffff812f3410 in dvb_ca_en50221_io_ioctl (file=<optimized out>, cmd=<optimized out>, arg=<optimized out>) at drivers/media/dvb-core/dvb_ca_en50221.c:1284 #12 0xffffffff8112eddd in vfs_ioctl (arg=<optimized out>, cmd=<optimized out>, filp=<optimized out>) at fs/ioctl.c:43 #13 do_vfs_ioctl (filp=0xffff88003c480e90, fd=<optimized out>, cmd=<optimized out>, arg=<optimized out>) at fs/ioctl.c:674 #14 0xffffffff8112f30c in SYSC_ioctl (arg=<optimized out>, cmd=<optimized out>, fd=<optimized out>) at fs/ioctl.c:689 #15 SyS_ioctl (fd=6, cmd=2148298626, arg=140734533693696) at fs/ioctl.c:680 #16 0xffffffff8103feb2 in entry_SYSCALL_64 () at arch/x86/entry/entry_64.S:207 Signed-off-by: Max Kellermann <max@duempel.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-07-13[media] dvb_frontend: eliminate blocking wait in dvb_unregister_frontend()Max Kellermann1-8/+25
The wait_event() call in dvb_unregister_frontend() waits synchronously for other tasks to free a file descriptor, but it does that while holding several mutexes. That alone is a bad idea, but if one user process happens to keep a (defunct) file descriptor open indefinitely, the kernel will correctly detect a hung task: INFO: task kworker/0:1:314 blocked for more than 30 seconds. Not tainted 4.7.0-rc1-hosting+ #50 "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. kworker/0:1 D ffff88003daf7a50 0 314 2 0x00000000 Workqueue: usb_hub_wq hub_event ffff88003daf7a50 0000000000000296 ffff88003daf7a30 ffff88003fc13f98 ffff88003dadce00 ffff88003daf8000 ffff88003e3fc010 ffff88003d48d4f8 ffff88003e3b5030 ffff88003e3f8898 ffff88003daf7a68 ffffffff810cf860 Call Trace: [<ffffffff810cf860>] schedule+0x30/0x80 [<ffffffff812f88d3>] dvb_unregister_frontend+0x93/0xc0 [<ffffffff8107a000>] ? __wake_up_common+0x80/0x80 [<ffffffff813019c7>] dvb_usb_adapter_frontend_exit+0x37/0x70 [<ffffffff81300614>] dvb_usb_exit+0x34/0xb0 [<ffffffff81300d4a>] dvb_usb_device_exit+0x3a/0x50 [<ffffffff81302dc2>] pctv452e_usb_disconnect+0x52/0x60 [<ffffffff81295a07>] usb_unbind_interface+0x67/0x1e0 [<ffffffff810609f3>] ? __blocking_notifier_call_chain+0x53/0x70 [<ffffffff8127ba67>] __device_release_driver+0x77/0x110 [<ffffffff8127c2d3>] device_release_driver+0x23/0x30 [<ffffffff8127ab5d>] bus_remove_device+0x10d/0x150 [<ffffffff8127879b>] device_del+0x13b/0x260 [<ffffffff81299dea>] ? usb_remove_ep_devs+0x1a/0x30 [<ffffffff8129468e>] usb_disable_device+0x9e/0x1e0 [<ffffffff8128bb09>] usb_disconnect+0x89/0x260 [<ffffffff8128db8d>] hub_event+0x30d/0xfc0 [<ffffffff81059475>] process_one_work+0x1c5/0x4a0 [<ffffffff8105940c>] ? process_one_work+0x15c/0x4a0 [<ffffffff81059799>] worker_thread+0x49/0x480 [<ffffffff81059750>] ? process_one_work+0x4a0/0x4a0 [<ffffffff81059750>] ? process_one_work+0x4a0/0x4a0 [<ffffffff8105f65e>] kthread+0xee/0x110 [<ffffffff810400bf>] ret_from_fork+0x1f/0x40 [<ffffffff8105f570>] ? __kthread_unpark+0x70/0x70 5 locks held by kworker/0:1/314: #0: ("usb_hub_wq"){......}, at: [<ffffffff8105940c>] process_one_work+0x15c/0x4a0 #1: ((&hub->events)){......}, at: [<ffffffff8105940c>] process_one_work+0x15c/0x4a0 #2: (&dev->mutex){......}, at: [<ffffffff8128d8cb>] hub_event+0x4b/0xfc0 #3: (&dev->mutex){......}, at: [<ffffffff8128bad2>] usb_disconnect+0x52/0x260 #4: (&dev->mutex){......}, at: [<ffffffff8127c2cb>] device_release_driver+0x1b/0x30 This patch removes the blocking wait, and postpones the kfree() call until all file handles have been closed by using struct kref. Signed-off-by: Max Kellermann <max@duempel.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-07-09[media] media: dvb_ringbuffer: Add memory barriersSoeren Moch1-13/+61
Implement memory barriers according to Documentation/circular-buffers.txt: - use smp_store_release() to update ringbuffer read/write pointers - use smp_load_acquire() to load write pointer on reader side - use ACCESS_ONCE() to load read pointer on writer side This fixes data stream corruptions observed e.g. on an ARM Cortex-A9 quad core system with different types (PCI, USB) of DVB tuners. Signed-off-by: Soeren Moch <smoch@web.de> Cc: stable@vger.kernel.org # 3.14+ Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-07-08[media] dvb: use ktime_t for internal timeoutArnd Bergmann5-16/+11
The dvb demuxer code uses a 'struct timespec' to pass a timeout as absolute time. This will cause problems on 32-bit architectures in 2038 when time_t overflows, and it is racy with a concurrent settimeofday() call. This patch changes the code to use ktime_get() instead, using the monotonic time base to avoid both the race and the overflow. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-06-07[media] drivers/media/dvb-core/en50221: move code to dvb_ca_private_free()Max Kellermann1-4/+13
Prepare for postponing the call until all file handles have been closed. [mchehab@osg.samsung.com: make checkpatch happy] Signed-off-by: Max Kellermann <max@duempel.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-05-07[media] media/dvb-core: forward media_create_pad_links() return valueMax Kellermann1-2/+2
Instead of always return -ENOMEM, return the real error that should come from media_create_pad_link(). Signed-off-by: Max Kellermann <max@duempel.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-05-06[media] az6027: Add support for Elgato EyeTV Sat v3Olli Salonen1-0/+1
Another version of Elgato EyeTV Sat USB DVB-S2 adapter needs just a USB ID addition. Signed-off-by: Christian Knippel <namerp@gmail.com> Reported-by: Olli Salonen <olli.salonen@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-05-06[media] dw2102: move USB IDs to dvb-usb-ids.hMauro Carvalho Chehab1-0/+13
Right now, dw2102 assumes that the USB IDs will be either at an external header or defined internally. That doesn't sound right. So, let's move the definitions to just one place. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-03-03[media] dvb-core: fix return code checking for devices with CAOlli Salonen1-1/+1
The test for the return code was mistakenly inverted. This caused DVB devices with CA module to fail on modprobe. Tested with TechnoTrend CT2-4650 CI USB tuner. Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-03-03[media] Add support for Avermedia AverTV Volar HD 2 (TD110)Philippe Valembois1-0/+1
Signed-off-by: Philippe Valembois <lephilousophe@users.sourceforge.net> Reviewed-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-27[media] media: dvb-frontend invoke enable/disable_source handlersShuah Khan1-114/+21
Change dvb frontend to check if tuner is free when device opened in RW mode. Call to enable_source handler either returns with an active pipeline to tuner or error if tuner is busy. Tuner is released when frontend is released calling the disable_source handler. Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-04[media] dvb_frontend: Don't let drivers to trash data at cacheMauro Carvalho Chehab1-8/+19
GET_FRONTEND and G_PROPERTY can be called anytime, even when the tuner/demod is not fully locked. However, several parameters returned by those calls are available only after the demod get VITERBI lock. While several drivers do the right thing by checking the status before returning the parameter, some drivers simply blindly update the DTV properties cache without checking if the registers at the hardware contain valid values. Due to that, programs that call G_PROPERTY (or GET_FRONTEND) before having a tuner lock may interfere at the zigzag logic, as the DVB kthread calls the set_frontend() callback several times, to fine tune the frequency and to identify if the signal is inverted or not. While the drivers should be fixed to report the right status, we should prevent that such bugs would actually interfere at the device operation. So, let's use a separate var for userspace calls to get frontend. As we copy the content of the cache, this should not cause any troubles. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-04[media] dvb_frontend: pass the props cache to get_frontend() as argMauro Carvalho Chehab2-2/+3
Instead of using the DTV properties cache directly, pass the get frontend data as an argument. For now, everything should remain the same, but the next patch will prevent get_frontend to affect the global cache. This is needed because several drivers don't care enough to only change the properties if locked. Due to that, calling G_PROPERTY before locking on those drivers will make them to never lock. Ok, those drivers are crap and should never be merged like that, but the core should not rely that the drivers would be doing the right thing. Reviewed-by: Michael Ira Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-04[media] dvb_frontend: add props argument to dtv_get_frontend()Mauro Carvalho Chehab1-12/+18
Instead of implicitly using the DTV cache properties at dtv_get_frontend(), pass it as an additional argument. This patch prepares to use a separate cache for G_PROPERTY, in order to avoid it to mangle with the DVB thread zigzag logic. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-04[media] dvb_frontend: print DTV property dump also for SET_PROPERTYMauro Carvalho Chehab1-6/+14
When debugging troubles with DTV properties get/set, it is important to be able to see not only the properties from get, but also the ones from set. So, improve the dumps to allow reporting both. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-01[media] dvb-frontend: Use boottimeAbhilash Jindal1-4/+4
Wall time obtained from ktime_get_real is susceptible to sudden jumps due to user setting the time or due to NTP. Boot time is constantly increasing time better suited for comparing two timestamps. [mchehab@osg.samsung.com: fix trivial merge conflicts] Signed-off-by: Abhilash Jindal <klock.android@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-01[media] dvbdev: the space is required after ','Xiubo Li1-3/+3
The space is missing after ',', and this will be introduce much noise when checking new patch around them. Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-01[media] dvbdev: replace kcalloc with kzallocXiubo Li1-2/+1
Since the number of elements equals to 1, so just use kzalloc to simplify the code and make it more readable. Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-01[media] dvbdev: remove useless parentheses after returnXiubo Li1-1/+1
The parentheses are not required after return, and just remove it. Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-01[media] dvb-usb-dvbsky: add new product id for TT CT2-4650 CITorbjörn Jansson1-0/+1
Add a new product id to dvb-usb-dvbsky for new version of TechnoTrend CT2-4650 CI Signed-off-by: Torbjörn Jansson <torbjorn.jansson@mbox200.swipnet.se> Reviewed-by: Olli Salonen <olli.salonen@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-01[media] tuner.h: rename TUNER_PAD_IF_OUTPUT to TUNER_PAD_OUTPUTMauro Carvalho Chehab1-1/+1
The output of a tuner is not only IF frequencies. They may also output audio on some of its pins, and may even be a zero-IF tuner, with outputs a baseband. So, rename the PAD name to make it clearer and add a proper documentation about that at tuner.h. No functional changes. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-25[media] Add support for Terratec Cinergy S2 Rev.4Benjamin Larsson1-0/+4
Also Add Terratec Cinergy S2 usb id's Signed-off-by: Benjamin Larsson <benjamin@southpole.se> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-25[media] dib8000: Add support for Mygica/Geniatech S2870Nicolas Sugino1-0/+1
MyGica/Geniatech S2870 is very similar to the S870 but with dual tuner. The card is recognised as Geniatech STK8096-PVR. [mchehab@osg.samsung.com: Fix some checkpatch.pl issues] Signed-off-by: Nicolas Sugino <nsugino@3way.com.ar> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-25[media] media: change email addressPatrick Boettcher1-1/+1
Soon my dibcom.fr/parrot.com-address won't respond anymore. Thus I'm replacing it. And, while being at it, let's adapt some other (old) email-addresses as well. Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] mxl111sf: Add a tuner entityMauro Carvalho Chehab1-0/+6
While mxl111sf may have multiple frontends, it has just one tuner. Reflect that on the media graph. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] dvbdev: create links on devices with multiple frontendsMauro Carvalho Chehab2-13/+51
Devices like mxl111sf-based WinTV Aero-m have multiple frontends, all linked on the same demod. Currently, the dvb_create_graph() function is not smart enough to create multiple links. Fix it. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] dvbdev: Add RF connector if neededMauro Carvalho Chehab2-4/+65
Several pure digital TV devices have a frontend with the tuner integrated on it. Add the RF connector when dvb_create_media_graph() is called on such devices. Tested with siano and dvb_usb_mxl111sf drivers. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] dvbdev: remove two dead functions if !CONFIG_MEDIA_CONTROLLER_DVBMauro Carvalho Chehab1-4/+2
Those functions are used only if CONFIG_MEDIA_CONTROLLER_DVB. Without that, if !CONFIG_MEDIA_CONTROLLER_DVB, it would produce two warnings: drivers/media/dvb-core/dvbdev.c:219:12: warning: 'dvb_create_tsout_entity' defined but not used [-Wunused-function] static int dvb_create_tsout_entity(struct dvb_device *dvbdev, ^ drivers/media/dvb-core/dvbdev.c:264:12: warning: 'dvb_create_media_entity' defined but not used [-Wunused-function] static int dvb_create_media_entity(struct dvb_device *dvbdev, ^ Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] dvbdev: Document the new MC-related fieldsMauro Carvalho Chehab1-2/+10
The Media Controller next gen patchset added several new fields to be used with it. Document them. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] media framework: rename pads init function to media_entity_pads_init()Mauro Carvalho Chehab1-2/+2
With the MC next gen rework, what's left for media_entity_init() is to just initialize the PADs. However, certain devices, like a FLASH led/light doesn't have any input or output PAD. So, there's no reason why calling media_entity_init() would be mandatory. Also, despite its name, what this function actually does is to initialize the PADs data. So, rename it to media_entity_pads_init() in order to reflect that. The media entity actual init happens during entity register, at media_device_register_entity(). We should move init of num_links and num_backlinks to it. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] media_entity: remove gfp_flags argumentMauro Carvalho Chehab1-2/+1
We should not be creating device nodes at IRQ contexts. So, the only flags we'll be using will be GFP_KERNEL. Let's remove the gfp_flags, in order to make the interface simpler. If we ever need it, it would be easy to revert those changes. While here, remove an extra blank line. Suggested-by: Sakari Ailus <sakari.ailus@iki.fi> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] dvbdev: Don't create indirect linksMauro Carvalho Chehab1-2/+8
Indirect links are those whose interface indirectly controls other functions. There are two interfaces that have indirect controls at the DVB side: - the network interface, which also controls the demux; - the DVR interface which also controls the demux. One could argue that the frontend control to the tuner is indirect. Well, that's debatable. There's no way to create subdev interfaces for tuner and demod, as those devices are tightly coupled. So, it was decided that just one interface is the best to control both entities, and there's no plan (or easy way) to decouple both. So, the DVB frontend interface should link to both entities. Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] dvbdev: move indirect links on dvr/demux to a separate functionMauro Carvalho Chehab1-19/+31
Cleanup the code a little bit by moving the routine that creates links between DVR and demux to the I/O entitis into a separate function. While here, fix the code to use strncmp() instead of strcmp(). Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] uapi/media.h: Rename entities types to functionsMauro Carvalho Chehab1-10/+10
Rename the userspace types from MEDIA_ENT_T_ to MEDIA_ENT_F_ and add the backward compatibility bits. The changes at the .c files was generated by the following coccinelle script: @@ @@ -MEDIA_ENT_T_UNKNOWN +MEDIA_ENT_F_UNKNOWN @@ @@ -MEDIA_ENT_T_DVB_BASE +MEDIA_ENT_F_DVB_BASE @@ @@ -MEDIA_ENT_T_V4L2_BASE +MEDIA_ENT_F_V4L2_BASE @@ @@ -MEDIA_ENT_T_V4L2_SUBDEV_BASE +MEDIA_ENT_F_V4L2_SUBDEV_BASE @@ @@ -MEDIA_ENT_T_CONNECTOR_BASE +MEDIA_ENT_F_CONNECTOR_BASE @@ @@ -MEDIA_ENT_T_V4L2_VIDEO +MEDIA_ENT_F_IO_V4L @@ @@ -MEDIA_ENT_T_V4L2_VBI +MEDIA_ENT_F_IO_VBI @@ @@ -MEDIA_ENT_T_V4L2_SWRADIO +MEDIA_ENT_F_IO_SWRADIO @@ @@ -MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN +MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN @@ @@ -MEDIA_ENT_T_CONN_RF +MEDIA_ENT_F_CONN_RF @@ @@ -MEDIA_ENT_T_CONN_SVIDEO +MEDIA_ENT_F_CONN_SVIDEO @@ @@ -MEDIA_ENT_T_CONN_COMPOSITE +MEDIA_ENT_F_CONN_COMPOSITE @@ @@ -MEDIA_ENT_T_CONN_TEST +MEDIA_ENT_F_CONN_TEST @@ @@ -MEDIA_ENT_T_V4L2_SUBDEV_SENSOR +MEDIA_ENT_F_CAM_SENSOR @@ @@ -MEDIA_ENT_T_V4L2_SUBDEV_FLASH +MEDIA_ENT_F_FLASH @@ @@ -MEDIA_ENT_T_V4L2_SUBDEV_LENS +MEDIA_ENT_F_LENS @@ @@ -MEDIA_ENT_T_V4L2_SUBDEV_DECODER +MEDIA_ENT_F_ATV_DECODER @@ @@ -MEDIA_ENT_T_V4L2_SUBDEV_TUNER +MEDIA_ENT_F_TUNER @@ @@ -MEDIA_ENT_T_DVB_DEMOD +MEDIA_ENT_F_DTV_DEMOD @@ @@ -MEDIA_ENT_T_DVB_DEMUX +MEDIA_ENT_F_TS_DEMUX @@ @@ -MEDIA_ENT_T_DVB_TSOUT +MEDIA_ENT_F_IO_DTV @@ @@ -MEDIA_ENT_T_DVB_CA +MEDIA_ENT_F_DTV_CA @@ @@ -MEDIA_ENT_T_DVB_NET_DECAP +MEDIA_ENT_F_DTV_NET_DECAP Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] media-entity.h: rename entity.type to entity.functionMauro Carvalho Chehab1-7/+7
Entities should have one or more functions. Calling it as a type proofed to not be correct, as an entity could eventually have more than one type. So, rename the field as function. Please notice that this patch doesn't extend support for multiple function entities. Such change will happen when we have real case drivers using it. No functional changes. Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] dvb core: must check dvb_create_media_graph()Mauro Carvalho Chehab1-1/+1
If media controller is enabled and mdev is filled, it should ensure that the media graph will be properly initialized. Enforce that. Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] dvbdev: returns error if graph object creation failsMauro Carvalho Chehab2-132/+188
Right now, if something gets wrong at dvb_create_media_entity() or at dvb_create_media_graph(), the device will still be registered. Change the logic to properly handle it and free all media graph objects if something goes wrong at dvb_register_device(). Also, change the logic at dvb_create_media_graph() to return an error code if something goes wrong. It is up to the caller to implement the right logic and to call dvb_unregister_device() to unregister the already-created objects. While here, add a missing logic to unregister the created interfaces. Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] dvbdev: enable all interface links at initMauro Carvalho Chehab1-6/+11
Interface links are normally enabled, meaning that the interfaces are bound to the entities. So, any ioctl sent to the interface are reflected at the entities managed by the interface. However, when a device is in use, other interfaces for the same hardware could be decoupled from the entities linked to them, because the hardware may have some parts busy. That's for example, what happens when an hybrid TV device is in use. If it is streaming analog TV or capturing signals from S-Video/Composite connectors, typically the digital part of the hardware can't be used and vice-versa. This is generally due to some internal hardware or firmware limitation, that it is not easily mapped via data pipelines. What the Kernel drivers do internally is that they decouple the hardware from the interface. So, all changes, if allowed, are done only at some interface cache, but not physically changed at the hardware. The usage is similar to the usage of the MEDIA_LNK_FL_ENABLED on data links. So, let's use the same flag to indicate if either the interface to entity link is bound/enabled or not. Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] tuner-core: add an input padMauro Carvalho Chehab1-1/+4
Tuners actually have at least one connector on its input. Add a PAD to connect it. Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] media: Use a macro to interate between all interfacesMauro Carvalho Chehab1-1/+2
Just like we do with entities, use a similar macro for the interfaces loop. Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] dvb: modify core to implement interfaces/entities at MC new genMauro Carvalho Chehab6-26/+139
The Media Controller New Generation redefines the types for both interfaces and entities to be used on DVB. Make the needed changes at the DVB core for all interfaces, entities and data and interface links to appear in the graph. Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] uapi/media.h: Fix entity namespaceMauro Carvalho Chehab1-13/+13
Now that interfaces got created, we need to fix the entity namespace. So, let's create a consistent new namespace and add backward compatibility macros to keep the old namespace preserved. Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] dvbdev: add support for indirect interface linksMauro Carvalho Chehab1-0/+11
Some interfaces indirectly control multiple entities. Add support for those. Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] dvbdev: add support for interfacesMauro Carvalho Chehab2-24/+79
Now that the infrastruct for that is set, add support for interfaces. Please notice that we're missing two links: DVB FE intf -> tuner DVB demux intf -> dvr Those should be added latter, after having the entire graph set. With the current infrastructure, those should be added at dvb_create_media_graph(), but it would also require some extra core changes, to allow the function to enumerate the interfaces. Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>