Commit Graph

215 Commits (7640ea99339c687864f6131598e2eee2ca73cb9c)

Author SHA1 Message Date
Devin Heitmueller 7640ea9933 V4L/DVB (7609): em28xx-core: speed-up firmware load
em28xx-core.c:
 - Remove sleep in i2c message routine which slows down i2c by a factor
   10x.  Load time for BASE firmware went from 13s to .973s

Signed-off-by: Devin Heitmueller <devin.heitmueller@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:09:41 -03:00
Devin Heitmueller 83244025e7 V4L/DVB (7608): em28xx-dvb: Some cleanups and fixes
em28xx-dvb.c:
 - Remove unneeded xc3028_ctrl structure.  The driver automatically preserves
   the previous value

tuner-xc2028.c:
 - Make the return type for xc2028_get_reg signed, since all of the callers
   are looking for "< 0" to detect errors.

Signed-off-by: Devin Heitmueller <devin.heitmueller@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:09:41 -03:00
Douglas Schilling Landgraf 6ea54d938b V4L/DVB (7607): CodingStyle fixes
Signed-off-by: Douglas Schilling Landgraf <dougsland@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:09:41 -03:00
Mauro Carvalho Chehab e6a353b0dc V4L/DVB (7606): em28xx-dvb: Program GPO as well
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:09:41 -03:00
Mauro Carvalho Chehab 102a0b0879 V4L/DVB (7604): em28xx-dvb: Fix analog mode
The analog entries are wrong. Fix it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:09:41 -03:00
Aidan Thornton 3421b7787a V4L/DVB (7603): em28xx-dvb: don't use videobuf-dvb
Modifies em28xx-dvb not to use videobuf-dvb, but instead to include the code
for registering dvb devices locally and use the URB management code in the
em28xx driver directly. DVB data streaming should now work.

Signed-off-by: Aidan Thornton <makosoft@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:09:41 -03:00
Aidan Thornton 579f72e44f V4L/DVB (7602): em28xx: generalise URB setup code
Move the URB setup and management code to em28xx-core.c and generalise
it slighlty so that the DVB code can use it.

Signed-off-by: Aidan Thornton <makosoft@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:09:41 -03:00
Aidan Thornton 7e6388a1b9 V4L/DVB (7601): em28xx-dvb: add support for the HVR-900
Adds the correct GPIOs and demod attach code for the HVR-900


Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:09:41 -03:00
Mauro Carvalho Chehab d2d9fbfd73 V4L/DVB (7600): em28xx: Sets frequency when changing to analog mode
This will make tuner-xc2028 to change to analog, if needed.

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:09:41 -03:00
Mauro Carvalho Chehab 52284c3e47 V4L/DVB (7599): em28xx-dvb: videobuf callbacks are waiting for em28xx_fh
Thanks to Devin Heitmueller <devin.heitmueller@gmail.com> for pointing
this issue.

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:09:41 -03:00
Devin Heitmueller bdfbf95203 V4L/DVB (7598): em28xx: several fixes on gpio programming
em28xx-cards.c:
 - Fix reversed val/rst values in both analog_gpio and digital_gpio
   vectors
 - Fix crash that would was occurring during every analog startup
   while looping over gpio_ctl
 - Remove what appears to be a redundant setting of gpio_ctl->val
 - Don't use OREN538 demodulation for the HVR-950 (prevents ATSC
   scanning from working)

em28xx-dvb.c:
 - Tuner should be in digital mode when issuing the reset
 - Add copyright
 - Change struct definition (corresponds to fix in em28xx-cards.c for
   gpio_ctl looping)

Signed-off-by: Devin Heitmueller <devin.heitmueller@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:09:41 -03:00
Mauro Carvalho Chehab 3ca9c09379 V4L/DVB (7597): em28xx: share the same xc3028 setup for analog and digital modes
Thanks to Devin Heitmueller <devin.heitmueller@gmail.com> and Aidan
Thornton" <makosoft@googlemail.com> for pointing some errors with the
previous scenario.

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:09:41 -03:00
Mauro Carvalho Chehab 227ad4ab90 V4L/DVB (7596): em28xx-dvb: Add support for HVR950
This patch adds DVB support for Hauppauge HVR950.

Thanks to Michael Krufky <mkrufky@linuxtv.org> for getting those values.

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:09:41 -03:00
Mauro Carvalho Chehab ee6e3a865a V4L/DVB (7595): Improve generic support for setting gpio values
em28xx based devices with xc3028 may require some specific gpio values.
This patch adds a generic handling for such values.

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:09:40 -03:00
Mauro Carvalho Chehab acaa4b609f V4L/DVB (7594): em28xx: Fix Kconfig
Some devices have msp3400 audio decoder chip. Selects it, if em28xx.

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:09:40 -03:00
Mauro Carvalho Chehab 3aefb79af8 V4L/DVB (7593): em28xx: add a module to handle dvb
This patch adds em28xx-dvb. This driver is highly based on cx88-dvb and
saa7134-dvb.

This code currently loads and unloads successfully. However, some
changes are needed to properly support the mpeg streams and to setup
em28xx to work on DVB mode.

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:09:40 -03:00
Mauro Carvalho Chehab 44dc733cd9 V4L/DVB (7567): em28xx: Some cleanups
Removes some fields from data structs.

There are some fields that are just caching some calculus for buffer
size. The calculus were moved to the places it were needed and the now
unused fields were removed.

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:09:39 -03:00
Aidan Thornton 3b5fa928a6 V4L/DVB (7565): em28xx: fix buffer underrun handling
This patch fixes three related issues and a fourth trivial one:

- Use buffers even if no-one's currently waiting for them (fixes
  underrun issues);

- Don't return incomplete/mangled frames at the start of streaming and
  in the case of buffer underruns;

- Fix an issue which could cause the driver to write to a buffer that's
  been freed after videobuf_queue_cancel is called (exposed by the
  previous two fixes - for some reason, ignoring buffers that weren't
  being waited on worked around the issue);

- Fix a bug which could cause only one field to be filled in the first
  buffer (or first few buffers) after streaming is started.

Signed-off-by: Aidan Thornton <makosoft@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:09:39 -03:00
Mauro Carvalho Chehab b4916f8ca1 V4L/DVB (7564): em28xx: Some fixes to display logic
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:09:39 -03:00
Mauro Carvalho Chehab dbecb44c11 V4L/DVB (7563): em28xx: Add missing checks
There are some cases where nobody is waiting for a buffer. Due to the
lack of check, if you try to abort the userspace app, machine were
hanging, since IRQ were trying to use a buffer that were disallocated.

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:09:39 -03:00
Mauro Carvalho Chehab cb7847249f V4L/DVB (7559): em28xx: Fills the entire buffer, before getting another one
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:08:48 -03:00
Mauro Carvalho Chehab e9e6040df6 V4L/DVB (7557): em28xx: honour video_debug modprobe parameter
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:08:48 -03:00
Aidan Thornton 0ea13e6e59 V4L/DVB (7556): em28xx: fix locking on vidioc_s_fmt_cap
Currently, vidioc_s_fmt_cap is allowed even if streaming is running on some
other fh. This is likely to cause issues.

Block use of vidioc_s_fmt_cap if someone else has claimed access to the device.

Signed-off-by: Aidan Thornton <makosoft@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:08:48 -03:00
Mauro Carvalho Chehab b957dfdc31 V4L/DVB (7555): em28xx: remove timeout
It seems that we don't need a timeout for em28xx.

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:08:48 -03:00
Brandon Philips 0561297501 V4L/DVB (7550): em28xx: Fix a possible memory leak
I did notice a possible memory leak since iolock is could possibly be
called before a buffer has been freed.

This ensure s_fmt isn't called while the queue is busy thereby avoiding
iolock on already allocated buffers.

Signed-off-by: Brandon Philips <bphilips@suse.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:08:48 -03:00
Mauro Carvalho Chehab 78bb3949a9 V4L/DVB (7549): em28xx: some small cleanups
- Remove dead code;
- Fix a few CodingStyle issues;
- Prints frame number, if debug is enabled.

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:08:47 -03:00
Aidan Thornton e0fadfd34d V4L/DVB (7548): Various fixes for the em28xx videobuf code
- Aborting buffer_filled if no-one's waiting on the waitqueue probably isn't
  what we want, since just because no-one's waiting for it now doesn't mean they
  wouldn't dequeue it in time. (vivi gets away with this, possibly because it
  can fill each buffer much faster.)

- The first BUG_ON(lencopy <= 0); really isn't worth causing a kernel panic
  over, especially since there are some reasons why it could trigger in normal use.

- The top and botom frames are actually the wrong way around.

Signed-off-by: Aidan Thornton <makosoft@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:08:47 -03:00
Mauro Carvalho Chehab e74153d44a V4L/DVB (7547): em28xx: Fix a broken lock
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:08:10 -03:00
Mauro Carvalho Chehab f245e549f0 V4L/DVB (7545): em28xx: Fix CodingStyle errors and most warnings introduced by videobuf
The last videobuf changes introduced several CodingStyle errors. Fixes all those
errors, as reported by checkpatch.pl

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:08:00 -03:00
Mauro Carvalho Chehab ca21d2dc94 V4L/DVB (7544): em28xx: Fix timeout code
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:08:00 -03:00
Mauro Carvalho Chehab 47625da2ab V4L/DVB (7543): Fix capture start/stop and timeout
Also removes the dead restart_video_queue() function

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:08:00 -03:00
Mauro Carvalho Chehab ea8df7e09d V4L/DVB (7542): em28xx: Fix some warnings
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:08:00 -03:00
Aidan Thornton d7aa80207b V4L/DVB (7541): em28xx: Some fixes to videobuf
It fixes a couple of minor bugs, comments out a bogus BUG_ON, sets fh->type
correctly, uses dev->width and dev->height for now, and adds a missing spinlock
init (nasty - caused a system lockup). It also adds some debug code which
probably isn't all that useful. I haven't tested this version of the patch yet,
though, so I'm not sure what you can expect if you try it.

Signed-off-by: Aidan Thornton <makosoft@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:08:00 -03:00
Mauro Carvalho Chehab ad0ebb96c2 V4L/DVB (7540): em28xx: convert to use videobuf-vmalloc
The usage of videobuf-vmalloc allows to cleanup em28xx logic.

Also, it reduced its size by about 5.42% on i386 arch (and about 7.5% on x86_64):

  39113    4876      40   44029    abfd old/em28xx.ko
  36731    4868      40   41639    a2a7 /home/v4l/master/v4l/em28xx.ko

Also, the preliminary tests, made on a single core 1.5 MHz Centrino showed
that CPU usage reduced from 42%-75% to 28%-33% (reports from "top") command.

A test with time command presented an even better result:

This is the performance tests I did, running code_example to get 1,000 frames
@29.995 Hz (about 35 seconds of stream), tested on a i386 machine, running at
1,5GHz:

	The old driver:

$ time -f "%E: %Us User time, %Ss Kernel time, %P CPU used" ./capture_example
0:34.21: 8.22s User time, 25.16s Kernel time, 97% CPU used

	The videobuf-based driver:

$ time -f "%E: %Us User time, %Ss Kernel time, %P CPU used" ./capture_example
0:35.36: 0.01s User time, 0.05s Kernel time, 0% CPU used

	Conclusion:

The time consumption to receive the stream where reduced from about 33.38
seconds to 0.05 seconds.

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:08:00 -03:00
Harvey Harrison d80e134dc8 V4L/DVB (7522): media/video/em28xx replace remaining __FUNCTION__ occurrences
__FUNCTION__ is gcc-specific, use __func__

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:07:59 -03:00
Michael Krufky ab8b870e43 V4L/DVB (7381): tuner: rename TUNER_PHILIPS_ATSC to TUNER_PHILIPS_FCV1236D
TUNER_PHILIPS_ATSC is an ambiguous name for a tuner.  Rename it to
TUNER_PHILIPS_FCV1236D to be more descriptive.

Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:07:52 -03:00
Sascha Sommer 2c4a07b2da V4L/DVB (7331): Fix em2800 altsetting selection
Signed-off-by: Sascha Sommer <saschasommer@freenet.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:07:49 -03:00
Douglas Schilling Landgraf ff699e6bd0 V4L/DVB (7094): static memory
- Static memory is always initialized with 0.
- Replaced in some cases C99 comments for /* */

Signed-off-by: Douglas Schilling Landgraf <dougsland@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 13:42:20 -03:00
Andrew Morton 46cb57e628 V4L/DVB (7291): em28xx: correct use of and fix
be less silly while we're there.

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-03-20 12:39:00 -03:00
Julia Lawall 8281db3b52 V4L/DVB (7285): em28xx: Correct use of ! and &
In commit e6bafba5b4, a bug was fixed that
involved converting !x & y to !(x & y).  The code below shows the same
pattern, and thus should perhaps be fixed in the same way.

This is not tested and clearly changes the semantics, so it is only
something to consider.

The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@ expression E1,E2; @@
(
  !E1 & !E2
|
- !E1 & E2
+ !(E1 & E2)
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-03-20 12:39:00 -03:00
Mauro Carvalho Chehab 61b080d214 V4L/DVB (7180): em28xx: add URB_NO_TRANSFER_DMA_MAP, since urb->transfer_dma is set
Thanks to Alan Stern <stern@rowland.harvard.edu> for pointing this issue.

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-02-18 11:15:17 -03:00
Mauro Carvalho Chehab 3687e1e67e V4L/DVB (7179): Allow more than one em28xx board
em28xx driver is capable of handling more than one usb device. However, isoc
transfers require a large amount of data to be transfered.

Before this patch, just one em28xx board were enough to allocate more than 50%
URBs:

T:  Bus=02 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=480 MxCh= 8
B:  Alloc=480/800 us (60%), #Int=  0, #Iso=  2
D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=01 MxPS=64 #Cfgs=  1

So, only one board could use an USB host at the same time. After the patch, it
is possible to use more than one em28xx at the same time, on the same usb host,
if the image size is slower or equal to 345600, since those images will
require about 30% of the URBs:

T:  Bus=02 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=480 MxCh= 8
B:  Alloc=232/800 us (29%), #Int=  0, #Iso=  2
D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=01 MxPS=64 #Cfgs=  1

So, in thesis, after the patch, it would be possible to use up to 3 boards by
each usb host, if the devices are generating small images.

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-02-18 11:15:17 -03:00
Mauro Carvalho Chehab 92ea42f442 V4L/DVB (7164): em28xx-alsa: Add a missing mutex
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-02-18 11:15:16 -03:00
Mauro Carvalho Chehab 00b8730f5d V4L/DVB (7163): em28xx: makes audio settings more stable
Improves audio configurations on em28xx:
        - mutes audio before changing amux;
        - adds a delay after setting audio src;
        - waits up to 50ms for ac97 busy.

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-02-18 11:15:16 -03:00
Mauro Carvalho Chehab 0df8130fe8 V4L/DVB (7162): em28xx: Fix endian and returns the correct values
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-02-18 11:15:15 -03:00
Mauro Carvalho Chehab 0da5176f4e V4L/DVB (7161): em28xx: Fix printing debug values higher than 127
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-02-18 11:15:15 -03:00
Mauro Carvalho Chehab 1e7ad56f1f V4L/DVB (7160): em28xx: Allow register dump/setting for debug
Adds vidioc_[g|s]_register handlers. This allows getting/setting register
from em28xx.

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-02-18 11:15:14 -03:00
Mauro Carvalho Chehab 7463dda2ae V4L/DVB (7158): Fix em28xx audio initialization
AC97 register initialization seem to always be needed. This patch fixes audio
for Prolink/Pixelview USB2 board.

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-02-18 11:15:14 -03:00
Andrew Morton 1685a6fed2 V4L/DVB (7156): em28xx/em28xx-core.c: fix use of potentially uninitialized variable
drivers/media/video/em28xx/em28xx-core.c: In function 'em28xx_set_audio_source':
drivers/media/video/em28xx/em28xx-core.c:276: warning: 'no_ac97' may be used uninitialized in this function

This looks like a genuine bug to me.

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-02-18 11:15:13 -03:00
Luc Saillard 427d20c4e6 V4L/DVB (7132): Add USB ID for a newer variant of Hauppauge WinTV-HVR 900
Device description:
WinTV-HVR-900
M/R: 65018/B3C0 ##4207

Signed-off-by: Luc Saillard <luc@saillard.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-02-18 11:15:12 -03:00