aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/bt8xx/bttv-driver.c
Commit message (Collapse)AuthorAgeFilesLines
* more driver stuff from 3.2.72Wolfgang Wiedmeyer2015-10-231-151/+153
|
* [media] bttv: fix s_tuner for radioHans Verkuil2011-07-071-1/+1
| | | | | | | | | | Fix typo: g_tuner should have been s_tuner. Tested with a bttv card. Cc: stable@kernel.org Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* [media] use pci_dev->revisionBjørn Mork2011-05-201-1/+1
| | | | | | | | | pci_setup_device() has saved the PCI revision in the pci_dev struct since Linux 2.6.23. Use it. Cc: Auke Kok <auke-jan.h.kok@intel.com> Signed-off-by: Bjørn Mork <bjorn@mork.no> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* Merge branch 'for-2.6.38' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wqLinus Torvalds2011-01-071-0/+9
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'for-2.6.38' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq: (33 commits) usb: don't use flush_scheduled_work() speedtch: don't abuse struct delayed_work media/video: don't use flush_scheduled_work() media/video: explicitly flush request_module work ioc4: use static work_struct for ioc4_load_modules() init: don't call flush_scheduled_work() from do_initcalls() s390: don't use flush_scheduled_work() rtc: don't use flush_scheduled_work() mmc: update workqueue usages mfd: update workqueue usages dvb: don't use flush_scheduled_work() leds-wm8350: don't use flush_scheduled_work() mISDN: don't use flush_scheduled_work() macintosh/ams: don't use flush_scheduled_work() vmwgfx: don't use flush_scheduled_work() tpm: don't use flush_scheduled_work() sonypi: don't use flush_scheduled_work() hvsi: don't use flush_scheduled_work() xen: don't use flush_scheduled_work() gdrom: don't use flush_scheduled_work() ... Fixed up trivial conflict in drivers/media/video/bt8xx/bttv-input.c as per Tejun.
| * media/video: explicitly flush request_module workTejun Heo2010-12-241-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Video drivers request submodules using a work during probe and calls flush_scheduled_work() on exit to make sure the work is complete before being unloaded. This patch makes these drivers flush the work directly instead of using flush_scheduled_work(). While at it, relocate request_submodules() call in saa7134_initdev() right right before successful return as in other drivers to avoid failing after the work is scheduled and returning failure without the work still active. This is in preparation for the deprecation of flush_scheduled_work(). Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
* | [media] saa6588: rename rds.h to saa6588.hHans Verkuil2010-12-291-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The naming of the media/rds.h header suggested that it was a generic RDS header, when in fact it is just a saa6588 module API that is internal to the kernel. Rename the header and the struct and defines in it to make this clear. Also removed the header include in radio-si470x.h (not used anymore) and from ioctl-number.txt (it's internal to the kernel and never called from userspace). Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* | [media] V4L: remove V4L1 compatibility modeHans Verkuil2010-12-291-28/+0
| | | | | | | | | | Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* | [media] bttv: remove custom_irq and gpioq from bttv structMauro Carvalho Chehab2010-12-291-6/+0
| | | | | | | | | | | | | | | | | | | | | | The RC5 old decoder used custom_irq to indicate the need of handling the IRQ on a different way. Instead of doing it, let the core just call the bttv input IRQ handler, and add the code there to call the legacy decoder. While here, remove the gpioq waitqueue, as this is not used anywhere, and add a debug msg to help removing the legacy RC5 code. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* | Merge branch 'v4l_for_linus' of ↵Linus Torvalds2010-12-201-114/+3
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6 * 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6: [media] gspca - sonixj: Better handling of the bridge registers 0x01 and 0x17 [media] gspca - sonixj: Add the bit definitions of the bridge reg 0x01 and 0x17 [media] gspca - sonixj: Set the flag for some devices [media] gspca - sonixj: Add a flag in the driver_info table [media] gspca - sonixj: Fix a bad probe exchange [media] gspca - sonixj: Move bridge init to sd start [media] bttv: remove unneeded locking comments [media] bttv: fix mutex use before init (BZ#24602) [media] Don't export format_by_forcc on two different drivers
| * [media] bttv: remove unneeded locking commentsBrandon Philips2010-12-171-20/+0
| | | | | | | | | | | | | | | | | | After Mauro's "bttv: Fix locking issues due to BKL removal code" there are a number of comments that are no longer needed about lock ordering. Remove them. Signed-off-by: Brandon Philips <bphilips@suse.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
| * [media] bttv: fix mutex use before init (BZ#24602)Mauro Carvalho Chehab2010-12-171-94/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix a regression where bttv driver causes oopses when loading, since it were using some non-initialized mutexes. While it would be possible to fix the issue, there are some other lock troubles, like to the presence of lock code at free_btres_lock(). It is possible to fix, but the better is to just use the core-assisted locking schema. This way, V4L2 core will serialize access to all ioctl's/open/close/mmap/read/poll operations, avoiding to have two processes accessing the hardware at the same time. Also, as there's just one lock, instead of 3, there's no risk of dead locks. The net result is a cleaner code, with just one lock. Reported-by: Dan Carpenter <error27@gmail.com> Reported-by: Brandon Philips<brandon@ifup.org> Reported-by: Chris Clayton <chris2553@googlemail.com> Reported-by: Torsten Kaiser <just.for.lkml@googlemail.com> Tested-by: Chris Clayton <chris2553@googlemail.com> Tested-by: Torsten Kaiser <just.for.lkml@googlemail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* | BKL: remove extraneous #include <smp_lock.h>Arnd Bergmann2010-11-171-1/+0
|/ | | | | | | | | | The big kernel lock has been removed from all these files at some point, leaving only the #include. Remove this too as a cleanup. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* V4L/DVB: videobuf: add ext_lock argument to the queue init functionsHans Verkuil2010-10-211-2/+2
| | | | | | | | | Add an ext_lock argument to the videobuf init functions. This allows drivers to pass the vdev->lock pointer (or any other externally held lock) to videobuf. For now all drivers just pass NULL. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* V4L/DVB: bttv: use unlocked ioctlMauro Carvalho Chehab2010-10-211-7/+7
| | | | Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* V4L/DVB: bttv: fix driver lock and remove explicit calls to BKLMauro Carvalho Chehab2010-10-211-58/+143
| | | | Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* V4L/DVB: bttv: Fix mutex unbalance at bttv_pollMauro Carvalho Chehab2010-10-211-3/+1
| | | | | | Don't do double mutex_unlock when reading a stream at bttv_poll. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* V4L/DVB: bttv-driver: document functions using mutex_lockMauro Carvalho Chehab2010-10-211-25/+25
| | | | | | | | | There are a few ancillary static routines used by ioctl functions that takes bttv lock internally. As we'll be adding the same lock for all ioctl's that need, we need to properly document them, to avoid doing double locks Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* V4L/DVB: v4l2-common: simplify prio utility functionsHans Verkuil2010-05-191-9/+9
| | | | | | | | | | | | | | | v4l2_prio_init/open/close returned an int when in fact they would always return 0. Make these void functions. v4l2_prio_close and v4l2_prio_check pass an enum v4l2_priority as a pointer for no good reason. Replace with a normal enum v4l2_priority argument. These changes will simplify the work of moving priority handling into the v4l core. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* V4L/DVB: bttv: remove bogus prio check in g_frequencyHans Verkuil2010-05-191-5/+0
| | | | | Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* V4L/DVB: V4L2: Replace loops for finding max buffers in VIDIOC_REQBUFS callbacksAndreas Bombe2010-05-191-2/+2
| | | | | | | | | | | | | Due to obvious copy and paste coding a number of video capture drivers which implement a limit on the buffer memory decremented the user supplied buffer count in a while loop until it reaches an acceptable value. This is a silly thing to do when the maximum value can be directly computed. Signed-off-by: Andreas Bombe <aeb@debian.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* include cleanup: Update gfp.h and slab.h includes to prepare for breaking ↵Tejun Heo2010-03-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | implicit slab.h inclusion from percpu.h percpu.h is included by sched.h and module.h and thus ends up being included when building most .c files. percpu.h includes slab.h which in turn includes gfp.h making everything defined by the two files universally available and complicating inclusion dependencies. percpu.h -> slab.h dependency is about to be removed. Prepare for this change by updating users of gfp and slab facilities include those headers directly instead of assuming availability. As this conversion needs to touch large number of source files, the following script is used as the basis of conversion. http://userweb.kernel.org/~tj/misc/slabh-sweep.py The script does the followings. * Scan files for gfp and slab usages and update includes such that only the necessary includes are there. ie. if only gfp is used, gfp.h, if slab is used, slab.h. * When the script inserts a new include, it looks at the include blocks and try to put the new include such that its order conforms to its surrounding. It's put in the include block which contains core kernel includes, in the same order that the rest are ordered - alphabetical, Christmas tree, rev-Xmas-tree or at the end if there doesn't seem to be any matching order. * If the script can't find a place to put a new include (mostly because the file doesn't have fitting include block), it prints out an error message indicating which .h file needs to be added to the file. The conversion was done in the following steps. 1. The initial automatic conversion of all .c files updated slightly over 4000 files, deleting around 700 includes and adding ~480 gfp.h and ~3000 slab.h inclusions. The script emitted errors for ~400 files. 2. Each error was manually checked. Some didn't need the inclusion, some needed manual addition while adding it to implementation .h or embedding .c file was more appropriate for others. This step added inclusions to around 150 files. 3. The script was run again and the output was compared to the edits from #2 to make sure no file was left behind. 4. Several build tests were done and a couple of problems were fixed. e.g. lib/decompress_*.c used malloc/free() wrappers around slab APIs requiring slab.h to be added manually. 5. The script was run on all .h files but without automatically editing them as sprinkling gfp.h and slab.h inclusions around .h files could easily lead to inclusion dependency hell. Most gfp.h inclusion directives were ignored as stuff from gfp.h was usually wildly available and often used in preprocessor macros. Each slab.h inclusion directive was examined and added manually as necessary. 6. percpu.h was updated not to include slab.h. 7. Build test were done on the following configurations and failures were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my distributed build env didn't work with gcov compiles) and a few more options had to be turned off depending on archs to make things build (like ipr on powerpc/64 which failed due to missing writeq). * x86 and x86_64 UP and SMP allmodconfig and a custom test config. * powerpc and powerpc64 SMP allmodconfig * sparc and sparc64 SMP allmodconfig * ia64 SMP allmodconfig * s390 SMP allmodconfig * alpha SMP allmodconfig * um on x86_64 SMP allmodconfig 8. percpu.h modifications were reverted so that it could be applied as a separate patch and serve as bisection point. Given the fact that I had only a couple of failures from tests on step 6, I'm fairly confident about the coverage of this conversion patch. If there is a breakage, it's likely to be something in one of the arch headers which should be easily discoverable easily on most builds of the specific arch. Signed-off-by: Tejun Heo <tj@kernel.org> Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
* V4L/DVB: bttv: Let the user disable IR supportJean Delvare2010-02-261-2/+7
| | | | | | | | | Add a new module parameter "disable_ir" to disable IR support. Several other drivers do that already, and this can be very handy for debugging purposes. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* V4L/DVB: bttv: Move I2C IR initializationJean Delvare2010-02-191-0/+1
| | | | | | | | | | | | | | | Move I2C IR initialization from just after I2C bus setup to right before non-I2C IR initialization. This avoids the case where an I2C IR device is blocking audio support (at least the PV951 suffers from this). It is also more logical to group IR support together, regardless of the connectivity. This fixes bug #15184: http://bugzilla.kernel.org/show_bug.cgi?id=15184 Signed-off-by: Jean Delvare <khali@linux-fr.org> CC: stable@kernel.org Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* V4L/DVB (13557): v4l: Remove unneeded video_device::minor usage in driversLaurent Pinchart2009-12-161-11/+4
| | | | | | | | | | | | | | | | The video_device::minor field is used where it shouldn't, either to - test for error conditions that can't happen anymore with the current v4l-dvb core, - store the value in a driver private field that isn't used anymore, - check the video device type where video_device::vfl_type should be used, or - create the name of a kernel thread that should get a stable name. Remove or fix those use cases. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* V4L/DVB (13556): v4l: Remove unneeded video_device::minor assignmentsLaurent Pinchart2009-12-161-2/+0
| | | | | | | | | | | | | Now that the video_device registration is tested using video_is_registered(), drivers don't need to initialize the video_device::minor field to -1 anymore. Remove those unneeded assignments. [mchehab.redhat.com: removed tm6000 changes as tm6000 is not ready yet for submission even on staging] Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* V4L/DVB (13555): v4l: Use video_device_node_name() instead of the minor numberLaurent Pinchart2009-12-161-2/+4
| | | | | | | | | | | | Instead of using the minor number in kernel log messages, use the device node name as returned by the video_device_node_name() function. This makes debug, informational and error messages easier to understand for end users. [mchehab.redhat.com: removed tm6000 changes as tm6000 is not ready yet for submission even on staging] Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* V4L/DVB (13553): v4l: Use the video_is_registered function in device driversLaurent Pinchart2009-12-161-3/+3
| | | | | | | | Fix all device drivers to use the video_is_registered function instead of checking video_device::minor. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* V4L/DVB (13550): v4l: Use the new video_device_node_name functionLaurent Pinchart2009-12-161-6/+6
| | | | | | | | | | Fix all device drivers to use the new video_device_node_name function. This also strips kernel log messages from the "/dev/" prefix, has the device node location is a userspace policy decision unknown to the kernel. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* V4L/DVB (13170): bttv: Fix reversed polarity error when switching video standardMike Isely2009-11-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bttv driver function which handles switching of the video standard (set_tvnorm() in bttv-driver.c) includes a check which can optionally also reset the cropping configuration to a default value. It is "optional" based on a comparison of the cropcap parameters of the previous vs the newly requested video standard. The comparison is being done with a memcmp(), a function which only returns a true value if the comparison actually fails. This if-statement appears to have been written to assume wrong memcmp() semantics. That is, it was re-initializing the cropping configuration only if the new video standard did NOT have different cropcap values. That doesn't make any sense. One definitely should reset things if the cropcap parameters are different - if there's any comparison to made at all. The effect of this problem was that a transition from, say, PAL to NTSC would leave in place old cropping setup that made sense for the PAL geometry but not for NTSC. If the application doesn't care about cropping it also won't try to reset the cropping configuration, resulting in an improperly cropped video frame. In the case I was testing this actually caused black video frames to be displayed. Another interesting effect of this bug is that if one does something which does NOT change the video standard and this function is run, then the cropping setup gets reset anyway - again because of the backwards comparison. It turns out that just running anything which merely opens and closes the video device node (e.g. v4l-info) will cause this to happen. One can argue that simply opening the device node and not doing anything to it should not mess with any of its state - but because of this behavior, any TV app which does such things (e.g. xawtv) probably therefore doesn't see the problem. The solution is to fix the sense of the if-statement. It's easy to see how this mistake could have been made given how memcmp() works. The patch is therefore removal of a single "!" character from the if-statement in set_tvnorm in bttv-driver.c. Signed-off-by: Mike Isely <isely@pobox.com> CC: stable@kernel.org Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* V4L/DVB (13169): bttv: Fix potential out-of-order field processingMike Isely2009-11-071-4/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is a subtle interaction in the bttv driver which can result in fields being repeatedly processed out of order. This is a problem specifically when running in V4L2_FIELD_ALTERNATE mode (probably the most common case). 1. The determination of which fields are associated with which buffers happens in videobuf, before the bttv driver gets a chance to queue the corresponding DMA. Thus by the point when the DMA is queued for a given buffer, the algorithm has to do the queuing based on the buffer's already assigned field type - not based on which field is "next" in the video stream. 2. The driver normally tries to queue both the top and bottom fields at the same time (see bttv_irq_next_video()). It tries to sort out top vs bottom by looking at the field type for the next 2 available buffers and assigning them appropriately. 3. However the bttv driver *always* actually processes the top field first. There's even an interrupt set aside for specifically recognizing when the top field has been processed so that it can be marked done even while the bottom field is still being DMAed. Given all of the above, if one gets into a situation where bttv_irq_next_video() gets entered when the first available buffer has been pre-associated as a bottom field, then the function is going to process the buffers out of order. That first available buffer will be put into the bottom field slot and the buffer after that will be put into the top field slot. Problem is, since the top field is always processed first by the driver, then that second buffer (the one after the first available buffer) will be the first one to be finished. Because of the strict fifo handling of all video buffers, then that top field won't be seen by the app until after the bottom field is also processed. Worse still, the app will get back the chronologically later bottom field first, *before* the top field is received. The buffer's timestamps will even be backwards. While not fatal to most TV apps, this behavior can subtlely degrade userspace deinterlacing (probably will cause jitter). That's probably why it has gone unnoticed. But it will also cause serious problems if the app in question discards all but the latest received buffer (a latency minimizing tactic) - causing one field to only ever be displayed since the other is now always late. Unfortunately once you get into this state, you're stuck this way - because having consumed two buffers, now the next time around the "first" available buffer will again be a bottom field and the same thing happens. How can we get into this state? In a perfect world, where there's always a few free buffers queued to the driver, it should be impossible. However if something disrupts streaming, e.g. if the userspace app can't queue free buffers fast enough for a moment due perhaps to a CPU scheduling glitch, then the driver can get momentarily starved and some number of fields will be dropped. That's OK. But if an odd number of fields get dropped, then that "first" available buffer might be the bottom field and now we're stuck... This patch fixes that problem by deliberately only setting up a single field for one frame if we don't get a top field as the first available buffer. By purposely skipping the other field, then we only handle a single buffer thus bringing things back into proper sync (i.e. top field first) for the next frame. To do this we just drop the few lines in bttv_irq_next_video() that attempt to set up the second buffer when that second buffer isn't for the bottom field. This is definitely a problem in when in V4L2_FIELD_ALTERNATE mode. In the other modes this change either has no effect or doesn't harm things any further anyway. Signed-off-by: Mike Isely <isely@pobox.com> CC: stable@kernel.org Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* V4L/DVB (12214): bttv: set RDS capability if applicable.Hans Verkuil2009-09-121-0/+2
| | | | | Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* V4L/DVB (12204): bttv and meye: Use PCI_VDEVICEJoe Perches2009-09-121-8/+4
| | | | | | Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* V4L/DVB (12300): bttv: fix regression: tvaudio must be loaded before tunerHans Verkuil2009-07-241-0/+1
| | | | | | | | | | | | Both tvaudio and the tuner share i2c address 0x42. The tvaudio module can check whether it really is a tda9840, but the tuner can't. So the tvaudio module must be loaded before the tuner module. This was also the case for 2.6.29, but the order was swapped in 2.6.30. Thanks to Krzysztof Grygiencz for reporting and testing this. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* headers: smp_lock.h reduxAlexey Dobriyan2009-07-121-0/+1
| | | | | | | | | | | | | * Remove smp_lock.h from files which don't need it (including some headers!) * Add smp_lock.h to files which do need it * Make smp_lock.h include conditional in hardirq.h It's needed only for one kernel_locked() usage which is under CONFIG_PREEMPT This will make hardirq.h inclusion cheaper for every PREEMPT=n config (which includes allmodconfig/allyesconfig, BTW) Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* V4L/DVB (12004): poll method lose race conditionFigo.zhang2009-06-161-4/+7
| | | | | | | bttv-driver.c,cx23885-video.c,cx88-video.c: poll method lose race condition for capture video. Signed-off-by: Figo.zhang <figo1802@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* V4L/DVB (11895): bt8xx: remove always false ifFilipe Rosset2009-06-161-1/+1
| | | | | | | | Remove always false if over unsigned int variable Signed-off-by: Filipe Rosset <rosset.filipe@gmail.com> Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* V4L/DVB (11853): minor have assigned value twicefigo.zhang2009-06-161-1/+0
| | | | | | | | | | | The variable minor have assigned value twice, the first time is in the initial "video_device" data struct in those drivers, pls see saa7134-video.c,line 2503. --- Signed-off-by: Figo.zhang <figo.zhang@kolorific.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* dma-mapping: replace all DMA_32BIT_MASK macro with DMA_BIT_MASK(32)Yang Hongyang2009-04-071-1/+1
| | | | | | | | Replace all DMA_32BIT_MASK macro with DMA_BIT_MASK(32) Signed-off-by: Yang Hongyang<yanghy@cn.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* V4L/DVB (11380): v4l2-subdev: change s_routing prototypeHans Verkuil2009-04-061-13/+10
| | | | | | | | | It is no longer needed to use a struct pointer as argument, since v4l2_subdev doesn't require that ioctl-like approach anymore. Instead just pass the input, output and config (new!) arguments directly. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* V4L/DVB (11370): v4l2-subdev: move s_std from tuner to core.Hans Verkuil2009-04-061-1/+1
| | | | | | | | | s_std didn't belong in the tuner ops. Stricly speaking it should be part of the video ops, but it is used by audio and tuner devices as well, so it is more efficient to make it part of the core ops. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* V4L/DVB (11278): bttv: convert to v4l2_subdev since i2c autoprobing will ↵Hans Verkuil2009-03-301-22/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | disappear. Since i2c autoprobing will disappear bttv needs to be converted to use v4l2_subdev instead. Without autoprobing the autoload module option has become obsolete. A warning is generated if it is set, but it is otherwise ignored. Since the bttv card definitions are of questionable value a new option was introduced to allow the user to control which audio module is selected: msp3400, tda7432 or tvaudio (or none at all). By default bttv will use the card definitions and fallback on tvaudio as the last resort. If no audio device was found a warning is printed. The saa6588 RDS device is now also explicitly probed since it is no longer possible to autoprobe it. A new saa6588 module option was added to override the card definition since I suspect more cards have this device than one would guess from the card definitions. Note that the probe addresses of the i2c modules are hardcoded in this driver. Once all v4l drivers are converted to v4l2_subdev this will be cleaned up. Such data belongs in an i2c driver header. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* V4L/DVB (11262): bttv: Remove buffer type check from vidioc_g_parmTrent Piepho2009-03-301-2/+0
| | | | | | | | | | | | | | | | The v4l2-ioctl core only allows buffer types for which the corresponding ->vidioc_try_fmt_xxx() methods are defined to be used with vidioc_(q|dq|query)bufs(), vidioc_reqbufs() and now vidioc_(s|g)_parm. The driver was only allowing VIDEO_CAPTURE buffers for g_parm, but since the driver defines ->vidioc_try_fmt_vid_overlay() and ->vidioc_try_fmt_vbi_cap() it will now allow VIDEO_OVERLAY and VBI_CAPTURE buffers as well. This should be fine as the driver only fills in the frame rate field, which is just as valid for video overlay and vbi capture as it is for video capture. Signed-off-by: Trent Piepho <xyzzy@speakeasy.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* V4L/DVB (11046): bttv: convert to v4l2_device.Hans Verkuil2009-03-301-16/+31
| | | | | Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* V4L/DVB (10815): bttv: Don't need to zero ioctl parameter fieldsTrent Piepho2009-03-301-9/+2
| | | | | | | | | | | The v4l2 core code in v4l2_ioctl will zero out the structure the driver is supposed to fill in for read-only ioctls. For read/write ioctls, all the fields which aren't supplied from userspace will be zeroed out. Zeroing code is removed from enum_input and g_tuner. Signed-off-by: Trent Piepho <xyzzy@speakeasy.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* V4L/DVB (10813): v4l2: New function v4l2_video_std_frame_periodTrent Piepho2009-03-301-4/+2
| | | | | | | | | | | | | | | | Some code was calling v4l2_video_std_construct() when all it cared about was the frame period. So make a function that just returns that and have v4l2_video_std_construct() use it. At this point there are no users of v4l2_video_std_construct() left outside of v4l2-ioctl, so it could be un-exported and made static. Change v4l2_video_std_construct() so that it doesn't zero out the struct v4l2_standard passed in. It's already been zeroed out in the common ioctl code. Signed-off-by: Trent Piepho <xyzzy@speakeasy.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* V4L/DVB (10568): bttv: dynamically allocate device dataTrent Piepho2009-03-301-29/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | The bttv driver had static array of structures for up to 16 possible bttv devices, even though few users have more than one or two. The structures were quite large and this resulted in a huge BSS segment. Change the driver to allocate the bttv device data dynamically, which changes "struct bttv bttvs[BTTV_MAX]" to "struct bttv *bttvs[BTTV_MAX]". It would be nice to get ride of "bttvs" entirely but there are some complications with gpio access from the audio & mpeg drivers. To help bttvs removal along anyway, I changed the open() methods use the video device's drvdata to get the driver data instead of looking it up in the bttvs array. This is also more efficient. Some WARN_ON()s are added in cases the device node exists by the bttv device doesn't, which I don't think should be possible. The gpio access functions need to check if bttvs[card] is NULL now. Though calling them on a non-existent card in the first place is wrong, but hard to solve given the fundamental problems in how the gpio access code works. This patch reduces the bss size by 66560 bytes on ia32. Overall change is a reduction of 66398 bytes, as the WARN_ON()s add some 198 bytes. Signed-off-by: Trent Piepho <xyzzy@speakeasy.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* V4L/DVB (10567): bttv: shrink muxsel data in card databaseTrent Piepho2009-03-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Over half of the card database was used to store muxsel data. 64 bytes were used to store one 32 bit word for each of up to 16 inputs. The Bt8x8 only has two bits to control its mux, so muxsel data for 16 inputs will fit into a single 32 bit word. There were a couple cards that had special muxsel data that didn't fit in two bits, but I cleaned them up in earlier patches. Unfortunately, C doesn't allow us to have an array of bit fields. This makes initializing the structure more of a pain. But with some cpp magic, we can do it by changing: .muxsel = { 2, 3, 0, 1 }, .muxsel = { 2, 2, 2, 2, 3, 3, 3, 3, 1, 1 }, Into: .muxsel = MUXSEL(2, 3, 0, 1), .muxsel = MUXSEL(2, 2, 2, 2, 3, 3, 3, 3, 1, 1), That's not so bad. MUXSEL is a fancy macro that packs the arguments (of which there can be one to sixteen!) into a single word two bits at a time. It's a compile time constant (a variadic function wouldn't be) so we can use it to initialize the structure. It's important the the arguments to the macro only be plain decimal integers. Stuff like "0x01", "(2)", or "MUX3" won't work properly. I also created an accessor function, bttv_muxsel(btv, input), that gets the mux bits for the selected input. It makes it cleaner to change the way the muxsel data is stored. This patch doesn't change the code size and decreases the datasegment by 9440 bytes. Signed-off-by: Trent Piepho <xyzzy@speakeasy.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* V4L/DVB (10562): bttv: rework the way digital inputs are indicatedTrent Piepho2009-03-301-1/+1
| | | | | | | | | | | | | | | The code was using a muxsel value of -1U to indicate a digital input. A couple places in were checking of muxsel < 0 to detect this, which doesn't work of course because muxsel is unsigned and can't be negative. Only a couple cards had digital inputs and it was always the last one, so for the card database create a one bit field that indicates the last input is digital. On init, this is used to set a new field in the bttv struct to the digital input's number or UNSET for none. This makes it easier to check if the current input is digital. Signed-off-by: Trent Piepho <xyzzy@speakeasy.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* V4L/DVB (10560): bttv: make tuner card info more consistentTrent Piepho2009-03-301-8/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bttv card database structure had a "tuner" field that was the input number of the tuner input or UNSET for no tuner. However, the only values it could ever be are 0 and UNSET. Having a tuner on an input other than 0 didn't work and was never used. There is also a "tuner_type" field that can be set to TUNER_ABSENT to indicate no tuner, which makes "tuner = UNSET" redundant. In many cases, tuner_type was set to UNSET when there was no tuner, which isn't quite correct. tuner_type == UNSET is supposed to mean the tuner type isn't yet known. So, I changed cards where "tuner == UNSET" to always have tuner_type of TUNER_ABSENT. At this point the tuner field is redundant, so I deleted it. I have the card setup code set the card's tuner_type (not the card type's tuner_type!) to TUNER_ABSENT if it hasn't yet been set at the end of the setup code. Various places that check if the card has a tuner will now look for this instead of checking the card type's "tuner" field. Also autoload the tuner module before issuing the TUNER_SET_TYPE_ADDR I2C client call instead of after issuing it. Overall, on ia32 this decreases compiled code size by about 24 bytes and reduces the data size by 640 bytes. Signed-off-by: Trent Piepho <xyzzy@speakeasy.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* V4L/DVB (10559): bttv: Fix TDA9880 norm setting codeTrent Piepho2009-03-301-2/+11
| | | | | | | | | | | | | | | | | | | | The code to set the norm for the TDA9880 analog demod was comparing btv->norm, an index into the bttv driver's norm array, to V4L2_STD_NTSC, which is a bit flag that's part of the V4L2 API. This doesn't work of course and results in the PAL path always being taken. What's more, it modified the bttv_tvcards[] entries for cards using the TDA9880. This is wrong because changing the norm on one card will also affect other cards of the same type. Writing to bttv_tvcards is also bad because it should be read-only or even devinitdata. Changing the norm would also cause the audio to become unmuted. Have the code get called for both norm setting and audio input setting (which where the gpios are set) to avoid needed to modify bttv_tvcards. Signed-off-by: Trent Piepho <xyzzy@speakeasy.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>