The driver should be switched to digital mode, when trying to access the
frontend or when streaming.
This patch provides the correct code to support this feature.
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Before this patch, HVR900/HVR950 were incorreclty going back to analog. The
result is that only digital were working.
This patch provides the proper setup for analog/digital and tuner callback.
It also properly resets analog into a sane state at open().
Thanks to Steven Toth <stoth@linuxtv.org> and Michael Krufky <mkrufky@linuxtv.org>
for helping to set the proper parameters to GPO/GPIO em2883 ports.
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Now, all registers will follow the same convension:
EM28XX_R<reg_number>_<reg_name>
This allows to associate a register with its value, and also with a canonical
name. Also, registers that are specific to a given chip were renamed accordingly,
as EM2800_foo (for 2800 only registers) or EM2880_foo (for registers that started
to appear on em2880).
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Before this patch, registers 0x04 and 0x08 were referenced by its value. This is
bad, since makes harder for someone to understand what this is doing.
This patch renames those two registers into an appropriate name.
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
em28xx.h contains lots of different stuff inside. The better is to break it on
some files.
This patch removes the register names, moving them to a separate file.
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
This is more conservative than just removing the msleep() from
em28xx_write_regs_req(), since some old hardware may still need it.
So, it will remove the sleep time only for those chips where this
removal were tested.
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
- Remove dead code;
- Fix a few CodingStyle issues;
- Prints frame number, if debug is enabled.
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
- 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>
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>
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>
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>
__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>
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>
- 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>