Commit Graph

243 Commits (e589333f346b58f8da5bb8152e1219c52d375ccc)

Author SHA1 Message Date
Hans Verkuil 859f0277a6 V4L/DVB (11278): bttv: convert to v4l2_subdev since i2c autoprobing will 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>
2009-03-30 12:43:46 -03:00
Trent Piepho 601bc29845 V4L/DVB (11262): bttv: Remove buffer type check from vidioc_g_parm
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>
2009-03-30 12:43:44 -03:00
Alan McIvor dceaddb978 V4L/DVB (11124): Add support for ProVideo PV-183 to bttv
Add support for ProVideo PV-183 to bttv

This patch adds support for the ProVideo PV-183 card to the bttv
device driver. The PV-183 is a PCI card with 8 BT878 devices plus a Hint
Corp HiNT HB4 PCI-PCI Bridge. Each BT878 has two composite input channels
available. There are no tuners on this card.

Signed-off-by: Alan McIvor <alan.mcivor@reveal.co.nz>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:31 -03:00
Hans Verkuil 15965f063d V4L/DVB (11051): v4l-dvb: replace remaining references to the old mailinglist.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:23 -03:00
Hans Verkuil 74fc7bd9ce V4L/DVB (11046): bttv: convert to v4l2_device.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:23 -03:00
Robert Millan 76ecf4599e V4L/DVB (10944): Conceptronic CTVFMI2 PCI Id
My BTTV_BOARD_CONCEPTRONIC_CTVFMI2 card wasn't auto-detected, here's a patch
that adds its PCI id.

lspci -nnv output:

05:06.0 Multimedia video controller [0400]: Brooktree Corporation Bt878 Video Capture [109e:036e] (rev 11)
05:06.1 Multimedia controller [0480]: Brooktree Corporation Bt878 Audio Capture [109e:0878] (rev 11)

Press <break> within 3 seconds if this is wrong.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:17 -03:00
Mauro Carvalho Chehab 7e0a16f611 V4L/DVB (10907): avoid loading the entire videodev.h header on V4L2 drivers
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:15 -03:00
Bruno Christo 0c5db42551 V4L/DVB (10827): Add support for GeoVision GV-800(S)
I have a GeoVision GV-800(S) card, it has 4 CONEXANT BT878A chips.
It has 16 video inputs and 4 audio inputs, and it is almost identical
to the GV-800, as seen on http://bttv-gallery.de .
The only difference appears to be the analog mux, it has a CD22M3494
in place of the MT8816AP. The card has a blue PCB, as seen in this
picture: http://www.gsbr.com.br/imagem/kits/GeoVision%20GV%20800.jpg .

This card wasn't originally supported, and it was detected as
UNKNOWN/GENERIC. The video inputs weren't working, so I tried
"forcing" a few cards like the GeoVision GV-600, but there was still
no video. So I made a patch to support this card, based on the Kodicom
4400r.

The GV-800(S) is identified as follows:

...
02:00.0 Multimedia video controller: Brooktree Corporation Bt878 Video
Capture (rev 11)
02:00.1 Multimedia controller: Brooktree Corporation Bt878 Audio
Capture (rev 11)
02:04.0 Multimedia video controller: Brooktree Corporation Bt878 Video
Capture (rev 11)
02:04.1 Multimedia controller: Brooktree Corporation Bt878 Audio
Capture (rev 11)
02:08.0 Multimedia video controller: Brooktree Corporation Bt878 Video
Capture (rev 11)
02:08.1 Multimedia controller: Brooktree Corporation Bt878 Audio
Capture (rev 11)
02:0c.0 Multimedia video controller: Brooktree Corporation Bt878 Video
Capture (rev 11)
02:0c.1 Multimedia controller: Brooktree Corporation Bt878 Audio
Capture (rev 11)

...
02:00.0 0400: 109e:036e (rev 11)
       Subsystem: 800a:763d
       Flags: bus master, medium devsel, latency 32, IRQ 10
       Memory at cdfff000 (32-bit, prefetchable) [size=4K]
       Capabilities: [44] Vital Product Data <?>
       Capabilities: [4c] Power Management version 2
       Kernel modules: bttv

02:00.1 0480: 109e:0878 (rev 11)
       Subsystem: 800a:763d
       Flags: bus master, medium devsel, latency 32, IRQ 10
       Memory at cdffe000 (32-bit, prefetchable) [size=4K]
       Capabilities: [44] Vital Product Data <?>
       Capabilities: [4c] Power Management version 2

02:04.0 0400: 109e:036e (rev 11)
       Subsystem: 800b:763d
       Flags: bus master, medium devsel, latency 32, IRQ 10
       Memory at cdffd000 (32-bit, prefetchable) [size=4K]
       Capabilities: [44] Vital Product Data <?>
       Capabilities: [4c] Power Management version 2
       Kernel modules: bttv

02:04.1 0480: 109e:0878 (rev 11)
       Subsystem: 800b:763d
       Flags: bus master, medium devsel, latency 32, IRQ 10
       Memory at cdffc000 (32-bit, prefetchable) [size=4K]
       Capabilities: [44] Vital Product Data <?>
       Capabilities: [4c] Power Management version 2

02:08.0 0400: 109e:036e (rev 11)
       Subsystem: 800c:763d
       Flags: bus master, medium devsel, latency 32, IRQ 10
       Memory at cdffb000 (32-bit, prefetchable) [size=4K]
       Capabilities: [44] Vital Product Data <?>
       Capabilities: [4c] Power Management version 2
       Kernel modules: bttv

02:08.1 0480: 109e:0878 (rev 11)
       Subsystem: 800c:763d
       Flags: bus master, medium devsel, latency 32, IRQ 10
       Memory at cdffa000 (32-bit, prefetchable) [size=4K]
       Capabilities: [44] Vital Product Data <?>
       Capabilities: [4c] Power Management version 2

02:0c.0 0400: 109e:036e (rev 11)
       Subsystem: 800d:763d
       Flags: bus master, medium devsel, latency 32, IRQ 10
       Memory at cdff9000 (32-bit, prefetchable) [size=4K]
       Capabilities: [44] Vital Product Data <?>
       Capabilities: [4c] Power Management version 2
       Kernel modules: bttv

02:0c.1 0480: 109e:0878 (rev 11)
       Subsystem: 800d:763d
       Flags: bus master, medium devsel, latency 32, IRQ 10
       Memory at cdff8000 (32-bit, prefetchable) [size=4K]
       Capabilities: [44] Vital Product Data <?>
       Capabilities: [4c] Power Management version 2

As you can see, the GV-800(S) card is almost identical to the GV-800
on bttv-gallery, so this patch might also work for that card. If not,
only a few changes should be required on the gv800s_write() function.

After this patch, the video inputs work correctly on linux 2.6.24 and
2.6.27 using the software 'motion'. The input order may seem a little
odd, but it's the order the original software/driver uses, and I decided
to keep that order to get the most out of the card.

I tried to get the audio working with the snd-bt87x module, but I only
get noise from every audio input, even after selecting a different mux
with alsamixer. Also, after trying to play sound from those sources, I
randomly get a RISC error about an invalid RISC opcode, and then that
output stops working. I also can't change the sampling rate when
recording. Any pointers to adding audio support are welcome.

Signed-off-by: Bruno Christo <bchristo@inf.ufsm.br>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:07 -03:00
Trent Piepho 522a5f1430 V4L/DVB (10815): bttv: Don't need to zero ioctl parameter fields
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>
2009-03-30 12:43:06 -03:00
Trent Piepho 51f0b8d57a V4L/DVB (10813): v4l2: New function v4l2_video_std_frame_period
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>
2009-03-30 12:43:05 -03:00
Trent Piepho 4b10d3b626 V4L/DVB (10568): bttv: dynamically allocate device data
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>
2009-03-30 12:42:47 -03:00
Trent Piepho 6f98700a5b V4L/DVB (10567): bttv: shrink muxsel data in card database
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>
2009-03-30 12:42:47 -03:00
Trent Piepho 430390e67b V4L/DVB (10566): bttv: clean up mux code for IDS Eagle
This card apparently uses an external mux and the Bt878's mux should always
be set to MUX2.  The values for the external mux control bits were stored
in the muxsel field.  This meant that when changing inputs the driver would
switch the Bt878's mux to whatever value the external mux was supposed to
be set to, then eagle_muxsel() would switch it back to MUX2 and program the
external mux.  This creates an unnecessary switch of the Bt878's mux.

So change muxsel to be 2 for each input.  The external mux bits are just
"input&3" so they don't really need to be stored anywhere.  This also
eliminates the last non-standard use of the muxsel data.

Cc: M G Berberich <berberic@fmi.uni-passau.de>
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:47 -03:00
Trent Piepho 13afaefc03 V4L/DVB (10565): bttv: fix external mux for RemoteVision MX
Old versions of the bttv driver would use the high nibble of an input's
muxsel value to program the GPIO lines enabled via gpiomask2.  Apparently
this was supposed to be for switching external audio muxes.  Anyway, the
code that did this was removed sometime in the pre-git 2.6 series.

The RemoteVision MX board used this feature to control an external video
mux and I guess no one noticed when they removed the code.

Move the extra gpio mux data out of the high nibble of muxsel and to
rv605_muxsel(), then have that function set the gpio lines with it.

From looking at the CD22M3494E datasheet, it seems like the mdelay(1) is a
much longer delay than necessary.  It looks like only around 20 ns is
necessary.

Cc: Miguel Freitas <miguel@cetuc.puc-rio.br>
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:47 -03:00
Trent Piepho 15f8eeb2a8 V4L/DVB (10564): bttv: fix external mux for PHYTEC VD-009
Old versions of the bttv driver would use the high nibble of an input's
muxsel value to program the GPIO lines enabled via gpiomask2.  Apparently
this was supposed to be for switching external audio muxes.  Anyway, the
code that did this was removed sometime in the pre-git 2.6 series.

These phytec boards used this feature to control an external video mux and
I guess no one noticed when they removed the code.

So add a muxsel_hook for these boards that does the necessary gpio setting.

BTW, I doubt the needs_tvaudio setting for these cards is correct.

Cc: Dirk Heer <d.heer@phytec.de>
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:47 -03:00
Trent Piepho fb5deb1b9e V4L/DVB (10563): bttv: clean up mux code for IVC-120G
The card data for BTTV_BOARD_IVC120 set muxsel to a bunch of bogus values
(1 to 16), which the common mux code would use to set the Bt878's mux to
some random value.  Then the custom code in ivc120_muxsel() would change
the Bt878's mux to the right value (always MUX0).

Better to just make the muxsel data correct (all zeros, easy!) and get the
mux right to begin with.  Then the extra Bt878 mux setting code in
ivc120_muxsel() can be eliminated (the rest of the code for the IVC-120G's
external mux is still there of course).

This will help me clean up muxsel for some other changes.  It should also
get rid of an unnecessary mux switch when changing from certain inputs to
certain other inputs on the IVC-120G.

Cc: Alan Garfield <alan@fromorbit.com>
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:47 -03:00
Trent Piepho 5221e21e5e V4L/DVB (10562): bttv: rework the way digital inputs are indicated
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>
2009-03-30 12:42:47 -03:00
Trent Piepho 4c548d4b28 V4L/DVB (10561): bttv: store card database more efficiently
The bttv card database is quite large and the data structure used to store
it wasn't very efficient.  Most of the field are only used at card
initialization time so it doesn't matter if they aren't efficient to
access.

Overall the changes reduce code size by 60 bytes in ia32.  The data size is
decreased by 5024 byes.  It is probably even more for 64-bit kernels.

Move the fields in the struct around to be sorted from largest to smallest.
This saves on padding space used for alignment.

Get rid of the unused digital_mode field.  Leave the setting as a comment
in the few cards entries that set it, in case someone ever writes the code.

Get rid of the unused audio_inputs field.  Leave the values in the card
entries in case someone ever writes code that might use it.

Get ride of the unused radio_addr field.  No card entries even set it to
anything interesting so it's not left as comments.  All the code that used
it was removed in commit v2.6.14-3466-g291d1d7 from Nov 8th 2005.

Reduce video_inputs to u8 as no card has more than 255 inputs (the most is
16).

Change tuner_addr to u8.  I2C addresses are only seven bits and 255 means
ADDR_UNSET, so everything fits.

Make has_radio a one bit flag.

Make the pll setting a two bit field.

Reduce svhs to four bits as no card has an s-video input above 9.  Change
the value for no s-video input from UNSET (which is -1U and out of range of
four bits) to NO_SVHS (which is now 15).

Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:47 -03:00
Trent Piepho abb0362f49 V4L/DVB (10560): bttv: make tuner card info more consistent
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>
2009-03-30 12:42:46 -03:00
Trent Piepho 72134a6d51 V4L/DVB (10559): bttv: Fix TDA9880 norm setting code
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>
2009-03-30 12:42:46 -03:00
Trent Piepho 4ef2ccc261 V4L/DVB (10558): bttv: norm value should be unsigned
The norm value in the driver is an index into an array and the the driver
doesn't allow it to be negative or otherwise invalid.  It should be
unsigned but wasn't in all places.

Fix some structs and functions to have the norm be unsigned.  Get rid of
useless checks for "< 0".  Most of the driver code can't handle a norm
value that's out of range, so change some ">= BTTV_TVNORMS" checks to
BUG_ON().  There's no point in silently ignoring invalid driver state just
to crash because of it later.

Reported-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:46 -03:00
Douglas Kosovic ade0815c16 V4L/DVB (10299): bttv: Add support for IVCE-8784 support for V4L2 bttv driver
It's a quad Bt878 PCI-e x1 capture board that's basically the same as the
IVC-200 (quad Bt878 PCI) capture board that's currently supported in
the V4L2 bttv driver.

Manufacturer's web page for IVCE-8784 with photo and info:
  http://www.iei.com.tw/en/product_IPC.asp?model=IVCE-8784

Signed-off-by: Douglas Kosovic <douglask@itee.uq.edu.au>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:26 -03:00
Udo Steinberg b15dd79ea0 V4L/DVB (10173): Missing v4l2_prio_close in radio_release
The radio_release function of the BTTV driver is missing a call to
v4l2_prio_close. As a result, after the radio device has been opened at
least once (e.g., by HAL during bootup), v4l2_priority will never drop below
V4L2_PRIORITY_INTERACTIVE again. With the following patch against 2.6.28,
applications that run with V4L2_PRIORITY_BACKGROUND are able to open devices
again. Previous Linux versions are affected as well.

Signed-off-by: Udo Steinberg <udo@hypervisor.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-01-03 10:50:38 -02:00
Hans Verkuil aecde8b53b V4L/DVB (10141): v4l2: debugging API changed to match against driver name instead of ID.
Since the i2c driver ID will be removed in the near future we have to
modify the v4l2 debugging API to use the driver name instead of driver ID.

Note that this API is not used in applications other than v4l2-dbg.cpp
as it is for debugging and testing only.

Should anyone use the old VIDIOC_G_CHIP_IDENT, then this will be logged
with a warning that it is deprecated and will be removed in 2.6.30.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-01-02 17:11:52 -02:00
Hans Verkuil bec43661b1 V4L/DVB (10135): v4l2: introduce v4l2_file_operations.
Introduce a struct v4l2_file_operations for v4l2 drivers.

Remove the unnecessary inode argument.

Move compat32 handling (and llseek) into the v4l2-dev core: this is now
handled in the v4l2 core and no longer in the drivers themselves.

Note that this changeset reverts an earlier patch that changed the return
type of__video_ioctl2 from int to long. This change will be reinstated
later in a much improved version.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-01-02 17:11:12 -02:00
Hans Verkuil 77587c5627 V4L/DVB (9940): bt832: remove this driver
The bt832 i2c driver was never used or even compiled and is no longer
maintained. It is now removed completely.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30 09:39:25 -02:00
Dirk Heer 0558362571 V4L/DVB (9677): bttv: fix some entries on Phytec boards and add missing ones
This Patch does modify the bttv-cards.c and bttc.h so that the driver
supports VD-011, VD-012, VD-012-X1 and VD-012-X2 Framegrabber from
Phytec Messtechnik GmbH.

Signed-off-by: Dirk Heer <d.heer@phytec.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-29 17:53:37 -02:00
Alan McIvor 2499abe710 V4L/DVB (9523): Increase number of BT8XX devices supported in a system
The BT8XX device driver currently only supports 16 such devices in a
system. This is too small for many surveillance applications. This
patch increases the number to 32.

Signed-off-by: Alan McIvor <alan.mcivor@reveal.co.nz>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-29 17:53:27 -02:00
Kay Sievers af128a102c V4L/DVB (9521): V4L: struct device - replace bus_id with dev_name(), dev_set_name()
This patch is part of a larger patch series which will remove
the "char bus_id[20]" name string from struct device. The device
name is managed in the kobject anyway, and without any size
limitation, and just needlessly copied into "struct device".

To set and read the device name dev_name(dev) and dev_set_name(dev)
must be used. If your code uses static kobjects, which it shouldn't
do, "const char *init_name" can be used to statically provide the
name the registered device should have. At registration time, the
init_name field is cleared, to enforce the use of dev_name(dev) to
access the device name at a later time.

We need to get rid of all occurrences of bus_id in the entire tree
to be able to enable the new interface. Please apply this patch,
and possibly convert any remaining remaining occurrences of bus_id.

We want to submit a patch to -next, which will remove bus_id from
"struct device", to find the remaining pieces to convert, and finally
switch over to the new api, which will remove the 20 bytes array
and does no longer have a size limitation.

Thanks,
Kay

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-29 17:53:26 -02:00
Hans Verkuil c6330fb86f V4L/DVB (9327): v4l: use video_device.num instead of minor in video%d
The kernel number of a v4l2 node (e.g. videoX, radioX or vbiX) is now
independent of the minor number. So instead of using the minor field
of the video_device struct one has to use the num field: this always
contains the kernel number of the device node.

I forgot about this when I did the v4l2 core change, so this patch
converts all drivers that use it in one go. Luckily the change is
trivial.

Cc: michael@mihu.de
Cc: mchehab@infradead.org
Cc: corbet@lwn.net
Cc: luca.risolia@studio.unibo.it
Cc: isely@pobox.com
Cc: pe1rxq@amsat.org
Cc: royale@zerezo.com
Cc: mkrufky@linuxtv.org
Cc: stoth@linuxtv.org
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-10-21 14:31:37 -02:00
Hans Verkuil 3c7b933bea V4L/DVB (9160): v4l: remove vidioc_enum_fmt_vbi_cap
Remove the vidioc_enum_fmt_vbi_cap ops: it was scheduled for removal in
2.6.28 since the v4l2 specification says that V4L2_BUF_TYPE_VBI_CAPTURE should
not support VIDIOC_ENUM_FMT. It's also pretty pointless.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-10-13 09:07:55 -02:00
Jean Delvare 176c2f3415 V4L/DVB (8956): bttv: Turn video_nr, vbi_nr and radio_nr into arrays
With video_nr, vbi_nr and radio_nr being simple integers, it is not
possible to use these parameters on a system with multiple bttv
adapters (which happens to be my case.) video_register_device() will
always fail on the second and later adapters. Turn these parameters
into arrays, as many other V4L drivers are already doing, so that they
can be used on such systems.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-10-12 09:37:01 -02:00
Jean Delvare eb1b27bd86 V4L/DVB (8879): bttv: Don't unmask VPRES interrupt
When the input is set to tuner and no antenna is connected, the BT848
can flood VPRES interrupts. So we don't want to enable this type of
interrupts when the input it set to tuner.

As we don't do anything when receiving such an interrupt anyway, the
easiest fix is to simply not unmask this specific interrupt.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-10-12 09:36:56 -02:00
Mauro Carvalho Chehab 7d341a6a52 V4L/DVB (8628): bttv: Add support for Encore ENLTV2-FM
Thanks to Sistema Fenix (http://www.sistemafenix.com.br/) and CDI Brasil
(www.cdibrasil.com.br/) for sponsoring this development.

Signed-off-by: Gilberto <gilberto@sistemafenix.com.br>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-10-12 09:36:47 -02:00
Mauro Carvalho Chehab b46a9c8b7a V4L/DVB (8627): Fix mute on bttv driver
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-10-12 09:36:47 -02:00
Hans Verkuil d56dc61265 V4L/DVB (8613): v4l: move BKL down to the driver level.
The BKL is now moved from the video_open function in v4l2-dev.c to the
various drivers. It seems about a third of the drivers already has a
lock of some sort protecting the open(), another third uses
video_exclusive_open (yuck!) and the last third required adding the
BKL in their open function.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-10-12 09:36:47 -02:00
Jean Delvare c37396c194 V4L/DVB (8955): bttv: Prevent NULL pointer dereference in radio_open
Fix the following crash in the bttv driver:

BUG: unable to handle kernel NULL pointer dereference at 000000000000036c
IP: [<ffffffffa037860a>] radio_open+0x3a/0x170 [bttv]

This happens because radio_open assumes that all present bttv devices
have a radio function. If a bttv device without radio and one with
radio are installed on the same system, and the one without radio is
registered first, then radio_open checks for the radio device number
of a bttv device that has no radio function, and this breaks. All we
have to do to fix it is to skip bttv devices without a radio function.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-10-04 22:38:12 -03:00
Thierry MERLE c4e3fd940c V4L/DVB (8877): b2c2 and bt8xx: udelay to mdelay
b2c2-flexcop, dvb/bt8xx and video/bt8xx fails to build on ARM with:

__bad_udelay is specifically designed on ARM to fail when udelay is
called in a bad way.  arch/arm/include/asm/delay.h has this to say
about __bad_udelay:

/*
 * This function intentionally does not exist; if you see references to
 * it, it means that you're calling udelay() with an out of range value.
 *
 * With currently imposed limits, this means that we support a max delay
 * of 2000us. Further limits: HZ<=1000 and bogomips<=3355
 */
extern void __bad_udelay(void);

Solution is to replace udelay by a mdelay and udelay with value less than 2000

Signed-off-by: Thierry MERLE <thierry.merle@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-09-04 18:27:03 -03:00
Hans Verkuil c6eb8eafdb V4L/DVB (8757): v4l-dvb: fix a bunch of sparse warnings
Fixed a lot of sparse warnings: mostly warnings about shadowed variables
and signed/unsigned mismatches.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-09-03 18:37:13 -03:00
Adrian Bunk 445c2714cf V4L/DVB (8534): remove select's of FW_LOADER
After commit d9b19199e4
(always enable FW_LOADER unless EMBEDDED=y) we can remove
the FW_LOADER select's and corresponding dependencies
on HOTPLUG.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-07-27 12:24:37 -03:00
Hans Verkuil 0ea6bc8d43 V4L/DVB (8523): v4l2-dev: remove unused type and type2 field from video_device
The type and type2 fields were unused and so could be removed.
Instead add a vfl_type field that contains the type of the video
device.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-07-27 11:07:10 -03:00
Hans Verkuil a399810ca6 V4L/DVB (8482): videodev: move all ioctl callbacks to a new v4l2_ioctl_ops struct
All ioctl callbacks are now stored in a new v4l2_ioctl_ops struct. Drivers fill in
a const struct v4l2_ioctl_ops and video_device just contains a const pointer to it.

This ensures a clean separation between the const ops struct and the non-const
video_device struct.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-07-26 12:54:58 -03:00
Hans Verkuil 35ea11ff84 V4L/DVB (8430): videodev: move some functions from v4l2-dev.h to v4l2-common.h or v4l2-ioctl.h
The functions in a header should not belong to another module. The prio functions
belong to v4l2-common.c, so move them to v4l2-common.h.

The ioctl functions belong to v4l2-ioctl.c, so create a new v4l2-ioctl.h header
and move those functions to it.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-07-23 19:00:17 -03:00
Hans Verkuil 22a04f1063 V4L/DVB (8429): videodev: renamed 'class_dev' to 'dev'
The class_dev field is a normal device, not a class device. This is very
confusing and now that the old 'dev' field has been renamed to 'parent'
we can rename 'class_dev' to just 'dev'.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-07-23 16:42:52 -03:00
Hans Verkuil 5e85e732f0 V4L/DVB (8428): videodev: rename 'dev' to 'parent'
The field 'dev' is not the video device, but the parent of the video device.
Rename accordingly.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-07-23 16:42:49 -03:00
Hans Verkuil f87086e302 v4l-dvb: remove legacy checks to allow support for kernels < 2.6.10
Also remove some blank lines that were used to split compat code at -devel
tree.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-07-20 07:17:52 -03:00
Al Viro 3aa7110e1c V4L/DVB (8132): bt8xx endianness annotations and fixes
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-07-20 07:13:31 -03:00
Mauro Carvalho Chehab 1d0a436256 V4L/DVB (8110): bttv: allow debug ioctl's
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-07-20 07:12:09 -03:00
Jean Delvare df9b5d4cf6 V4L/DVB (8047): bt8xx: i2c structure templates clean-up
Clean up the use of structure templates in bttv-i2c. For one thing, a
real template is supposed to be read-only. And in some cases it's more
efficient to initialize the few fields we need individually.

This clean-up shrinks bttv-i2c.o by 29% (x86_64).

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-07-20 07:09:41 -03:00
Hans Verkuil 78b526a435 V4L/DVB (7949): videodev: renamed the vidioc_*_fmt_* callbacks
The naming for the callbacks that handle the VIDIOC_ENUM_FMT and
VIDIOC_S/G/TRY_FMT ioctls was very confusing. Renamed it to match
the v4l2_buf_type name.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-07-20 07:07:32 -03:00
David Woodhouse 4f2a0c3cdb bt8xx: treat firmware data as const
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-07-10 14:26:28 +01:00
Al Viro c1c36f3128 V4L/DVB (7967): bt8xx: unaligned access
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-06-05 06:35:52 -03:00
Al Viro d8eaa58b06 V4L/DVB (7965): annotate bcx_riscmem
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-06-05 06:35:51 -03:00
Arjan van de Ven 81b2dbcad8 Fix a deadlock in the bttv driver
vidiocgmbuf() does this:
        mutex_lock(&fh->cap.vb_lock);
        retval = videobuf_mmap_setup(&fh->cap, gbuffers, gbufsize,
                                     V4L2_MEMORY_MMAP);

and videobuf_mmap_setup() then just does
        mutex_lock(&q->vb_lock);
        ret = __videobuf_mmap_setup(q, bcount, bsize, memory);
        mutex_unlock(&q->vb_lock);

which is an obvious double-take deadlock.

This patch fixes this by having vidiocgmbuf() just call the
__videobuf_mmap_setup function instead.

Acked-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Reported-by: Koos Vriezen <koos.vriezen@gmail.com>
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-05-20 10:12:26 -07:00
Mauro Carvalho Chehab 755a18baad V4L/DVB (7851): Fix FW_LOADER depencency at v4l/dvb
Since:
1) FW_LOADER is defined as:

config FW_LOADER
        tristate "Userspace firmware loading support"
        depends on HOTPLUG

2) several V4L/DVB driver just selects it;

3) select is not smart enough to auto-select HOTPLUG, if select FW_LOADER.

So, All drivers that select FW_LOADER should also depend on HOTPLUG.

An easier solution (for the end-user perspective) would be to "select HOTPLUG".
However, live is not simple. This would cause recursive dependency issues like
this one:

drivers/usb/Kconfig:62:error: found recursive dependency: USB -> USB_OHCI_HCD
-> I2C -> MEDIA_TUNER -> MEDIA_TUNER_XC2028 -> HOTPLUG -> PCCARD -> PCMCIA ->
USB_ARCH_HAS_HCD -> MOUSE_APPLETOUCH -> USB

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-05-14 02:54:08 -03:00
Mauro Carvalho Chehab fdbbfb092c V4L/DVB (7846): Re-creates VIDEO_TUNER
VIDEO_TUNER is responsible for compilation of tuners.ko module. This were the
previous behaviour before the creation of MEDIA_TUNER.

Before this patch, tuner.ko were created even for drivers that don't need a
tuner (like webcam drivers).

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-05-14 02:54:07 -03:00
Harvey Harrison bdf4bbaaee Add macros similar to min/max/min_t/max_t
Also, change the variable names used in the min/max macros to avoid shadowed
variable warnings when min/max min_t/max_t are nested.

Small formatting changes to make all the macros have a similar form.

[akpm@linux-foundation.org: coding-style fixes]
[akpm@linux-foundation.org: fix v4l build]
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: Tejun Heo <htejun@gmail.com>
Cc: Michael Buesch <mb@bu3sch.de>
Cc: "John W. Linville" <linville@tuxdriver.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>
Cc: Dmitry Torokhov <dtor@mail.ru>
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-30 08:29:53 -07:00
Mauro Carvalho Chehab 149ef72dee Rename common tuner Kconfig names to use the same
namespace for all of them.
2008-04-29 18:41:38 -03:00
Mauro Carvalho Chehab 7c91f0624a V4L/DVB(7767): Move tuners to common/tuners
There were several issues in the past, caused by the hybrid tuner design, since
now, the same tuner can be used by drivers/media/dvb and drivers/media/video.

Kconfig items were rearranged, to split V4L/DVB core from their drivers.

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-29 18:41:37 -03:00
Robert Fitzsimons b9bc07a006 V4L/DVB (7579): bttv: Fix memory leak in radio_release
Fix the leak of the bttv_fh structure allocated in radio_open which
was introduced by commit 5cd3955cb8.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:09:40 -03:00
Mauro Carvalho Chehab d69b2e41a5 V4L/DVB (7462): bttv: Fix some API non-compliances for some audio/input V4L2 calls
Thanks to Cyrill Gorcunov <gorcunov@gmail.com> for pointing this
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:07:56 -03:00
Michael Krufky 967be9a9cd V4L/DVB (7411): use tuner-simple for Philips FCV1236D digital tuning support
Convert dvb-bt8xx to use tuner-simple instead of dvb-pll for Philips FCV1236D

Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:07:53 -03:00
Andrew Morton c1e6393e24 V4L/DVB (7389): git-dvb: drivers/media/video/bt8xx/bttv-cards.c: fix warnings
drivers/media/video/bt8xx/bttv-cards.c:3030:38: warning: "/*" within comment
drivers/media/video/bt8xx/bttv-cards.c:3032:20: warning: "/*" within comment

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:07:52 -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
Mauro Lacy e80faad3d7 V4L/DVB (7368): bttv: added support for Kozumi KTV-01C card
Signed-off-by: Mauro Lacy <mauro@lacy.com.ar>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:07:51 -03:00
Ernesto Hernández-Novich 97275ac514 V4L/DVB (7366): Support for a 16-channel bt878 card
I have what looks like a Geovision GV-600 (or 650) card. It has a large
chip in the middle labeled

CONEXANT
FUSION 878A
25878-13
E345881.1
0312 TAIWAN

It has an audio connector coming out from a chip labeled

ATMEL
0242
AT89C2051-24PI

It is identified as follows on my Debian GNU/Linux Etch (kernel 2.6.18)

...
01:0a.0 Multimedia video controller: Brooktree Corporation Bt878 Video Capture (rev 11)
01:0a.1 Multimedia controller: Brooktree Corporation Bt878 Audio Capture (rev 11)
...
01:0a.0 0400: 109e:036e (rev 11)
        Subsystem: 008a:763c
        Flags: bus master, medium devsel, latency 64, IRQ 58
        Memory at dfffe000 (32-bit, prefetchable) [size=4K]
        Capabilities: [44] Vital Product Data
        Capabilities: [4c] Power Management version 2

01:0a.1 0480: 109e:0878 (rev 11)
        Subsystem: 008a:763c
        Flags: bus master, medium devsel, latency 64, IRQ 58
        Memory at dffff000 (32-bit, prefetchable) [size=4K]
        Capabilities: [44] Vital Product Data
        Capabilities: [4c] Power Management version 2

It was being detected as a GENERIC UNKNOWN CARD both by the 2.6.18
kernel and the latest v4l-dvb drivers, but it did not work at all. The
card has sixteen (16) BNC video inputs, four of them on the board itself
and twelve on three daughter-cards. It has a single bt878 chip, no tuner
and what looks like and audio input. After doing some research I managed
to get only eight channels working by forcing card=125 and those DID NOT
match channels 0-7 on the card, and no audio.

Based on what was working for card=125, I added the card definition
block, added a specific muxsel routine and got the card working fully
with xawtv, where the sixteen channels show up as Composite0 to
Composite15, matching the channel labels in the card and daughter-cards.
I have made no efforts yet to get audio working, but would appreciate
any pointers.

Signed-off-by: Ernesto Hernández-Novich <emhn@usb.ve>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:07:51 -03:00
Wojciech Migda 27dea3eb66 V4L/DVB (7294): : tuner and radio addresses are missing for the PixelView PlayTV card
The PixelView PlayTV card definition structure was missing initialization of
the tuner_addr and radio_addr fields. As a result it was impossible to have the
tuner initialized using parameters specified while loading the bttv.ko module.

This regression became visible after the v4l rearrangements introduced
somewhere around 2.6.15 kernel version.

The root cause for the tuner initialization failure is located in the
attach_inform function in the bttv-i2c.c file.

There at the very beginning the addr variable holding the tuner device address
is initialized with the value taken from the bttv_tvcards array.

For the PixelView PlayTV card the tuner address field (and the radio address as
well) was uninitialized, and thus equal 0. Later in that function execution of
the TUNER_SET_TYPE_ADDR tuner command is guarded with check for the tuner
address either equal ADDR_UNSET, or client->addr.

Since both are non-zero (the latter in case of the card owned by me at the
runtime is equal 0x61) the TUNER_SET_TYPE_ADDR command is not executed, and
consequently in the tuner_attach function in the tuner-core.c file call to
i2c_attach_client does not result in assigning the tuner type variable with the
requested value.

Providing initialization of the tuner_addr and radio_addr with ADDR_UNSET
values as it is already done for other tv cards defined in bttv-cards.c ensures
that the tuner initialization is done correctly, just as it used to be in the
2.6.14 kernel.

Signed-off-by: Wojciech Migda <wojtek.golf@interia.pl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:07:46 -03:00
Guennadi Liakhovetski 0705135e59 V4L/DVB (7237): Convert videobuf-dma-sg to generic DMA API
videobuf-dma-sg does not need to depend on PCI. Switch it to using generic
DMA API, convert all affected drivers, relax Kconfig restriction, improve
compile-time type checking, fix some Coding Style violations while at it.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24 14:07:44 -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
Cyrill Gorcunov 4a8f3a5727 V4L/DVB (7460): bttv: Bt832 - fix possible NULL pointer deref
This patch does fix potential NULL pointer dereference

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-06 17:13:18 -03:00
Cyrill Gorcunov 1a002ebf60 V4L/DVB (7461): bttv: fix missed index check
We should check for proper index first

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-01 19:35:45 -03:00
Robert Fitzsimons c137918978 V4L/DVB (7400): bttv: Add a radio compat_ioctl file operation
Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-01 19:35:45 -03:00
Robert Fitzsimons 1b0690134e V4L/DVB (7278): bttv: Re-enable radio tuner support for VIDIOCGFREQ/VIDIOCSFREQ ioctls
Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-01 19:35:44 -03:00
Robert Fitzsimons 5cd3955cb8 V4L/DVB (7277): bttv: Re-enabling radio support requires the use of struct bttv_fh
A number of the radio tuner ioctl functions are shared with the TV
tuner, these functions require a struct bttv_fh data structure to be
allocated and initialized.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-01 19:35:44 -03:00
Harvey Harrison e8d35932e9 V4L/DVB (7236): bttv: struct member initialized twice
fixes sparse warning:
drivers/media/video/bt8xx/bttv-driver.c:3391:3: warning: Initializer entry defined twice
drivers/media/video/bt8xx/bttv-driver.c:3392:3:   also defined here

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-03-20 12:38:57 -03:00
Robert Fitzsimons 7c018804c0 V4L/DVB (7197): bttv: Fix overlay divide error
The initial work to convert the bttv driver to V4L2 "Partial conversion
from V4L1 to V4L2" (e84619b174), missed
the line which set the appropriate overlay crop structure in the newly
allocated bttv_buffer.  This then causes a divide error in the
bttv_calc_geo function.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-02-18 12:18:03 -03:00
Mauro Carvalho Chehab 64f9477f95 V4L/DVB (7121): Renames videobuf lock to vb_lock
This helps to identify where vb_lock is being used, and find missusages of the
locks.

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-02-18 11:15:12 -03:00
Joe Perches c84e6036ba drivers/media/: Spelling fixes
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Adrian Bunk <bunk@kernel.org>
2008-02-03 17:18:59 +02:00
Zoltan Devai 438468359e V4L/DVB (7037): Fix build breakage of the bttv driver, when advanced debugging is not enabled
Signed-off-by: Zoltan Devai <zdevai@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-01-25 19:05:03 -02:00
Mauro Carvalho Chehab b3d98135aa V4L/DVB (6981): Fix bugzillas 9686 and 9691
IR were not working for Winfast XP 2000 TV.

Gabor Nyekhelyi <n0gabor@vipmail.hu> wrote a hack some time ago:
http://marc.info/?l=linux-video&m=116362609323281&w=2

This patch fixes CodingStyle and commits the hack. I suspect that the proper
solution would be to find the proper mask_keydown for this IR. Anyway, better
to have this patch as a workaround.

Thanks to Stafan Talpalaru <stefantalpalaru@yahoo.com> for pointing the issue.
CC: Gabor Nyekhelyi <n0gabor@vipmail.hu>
CC: Stafan Talpalaru <stefantalpalaru@yahoo.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-01-25 19:04:43 -02:00
Mauro Carvalho Chehab 9134be0376 V4L/DVB (6914): Fix a few issues at the bttv conversion
bttv driver is working as previously. An additional gain of about 1,5Kb were
obtained with the driver conversion to vidioc_ioctl2:

   text    data     bss     dec     hex filename
  89208   40244   57556  187008   2da80 old/bttv.ko
  88960   38740   57556  185256   2d3a8 new/bttv.ko

(measured on a x86_64)

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-01-25 19:04:21 -02:00
Mauro Carvalho Chehab 04a94d3ca2 V4L/DVB (6913): Preserve the previous order to make easier to check the conversion
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-01-25 19:04:21 -02:00
Mauro Carvalho Chehab e5ae3db461 V4L/DVB (6912): Replace vidioc_ to bttv_
Since there are a few vidioc_ functions that were exported, rename those
functions to bttv_ in order to avoid poluting namespace.

The other functions were also renamed, to standardize inside the driver.

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-01-25 19:04:21 -02:00
Douglas Schilling Landgraf 402aa76aa5 V4L/DVB (6911): Converted bttv to use video_ioctl2
Signed-off-by: Douglas Schilling Landgraf <dougsland@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-01-25 19:04:20 -02:00
Akinobu Mita 9e7e85ebae V4L/DVB (6848): bttv: check pci_register_driver() error
Check pci_register_driver() error in module_init.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-01-25 19:03:57 -02:00
Brandon Philips 0fc0686e64 V4L/DVB (6600): V4L: videobuf: don't chew up namespace STATE_.*, convert to VIDEOBUF_
s/STATE_NEEDS_INIT/VIDEOBUF_NEEDS_INIT/g
s/STATE_PREPARED/VIDEOBUF_PREPARED/g
s/STATE_QUEUED/VIDEOBUF_QUEUED/g
s/STATE_ACTIVE/VIDEOBUF_ACTIVE/g
s/STATE_DONE/VIDEOBUF_DONE/g
s/STATE_ERROR/VIDEOBUF_ERROR/g
s/STATE_IDLE/VIDEOBUF_IDLE/g

Signed-off-by: Brandon Philips <bphilips@suse.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-01-25 19:02:11 -02:00
Trent Piepho 00405f8f11 V4L/DVB (6507): bttv: whitespace cleanup
Someone wasn't using the v4l-dvb commit scripts and so didn't run the
automatic whitespace cleaner on their code.

Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-01-25 19:01:53 -02:00
Randy Dunlap 073ad9a00c V4L/DVB (6480): bttv: uses input functions, should depend on INPUT
Several media drivers use input_(*) functions so they need to depend on
the INPUT config symbol.

drivers/built-in.o: In function `bttv_input_fini':
linux-2.6.24-rc1-git4/drivers/media/video/bt8xx/bttv-input.c:346: undefined reference to `input_unregister_device'
drivers/built-in.o: In function `bttv_input_init':
linux-2.6.24-rc1-git4/drivers/media/video/bt8xx/bttv-input.c:204: undefined reference to `input_allocate_device'
linux-2.6.24-rc1-git4/drivers/media/video/bt8xx/bttv-input.c:335: undefined reference to `input_free_device'
linux-2.6.24-rc1-git4/drivers/media/video/bt8xx/bttv-input.c:321: undefined reference to `input_register_device'
linux-2.6.24-rc1-git4/drivers/media/video/bt8xx/bttv-input.c:335: undefined reference to `input_free_device'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-01-25 19:01:41 -02:00
Nickolay V. Shmyrev 155c6ab9ed V4L/DVB (6417): Report detected sound carrier into rxsubchans
Signed-off-by: Nickolay V. Shmyrev <nshmyrev@yandex.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-01-25 19:00:59 -02:00
Nickolay V. Shmyrev 4b9b936f27 V4L/DVB (6416): Split hooks on volume and audio mode and rework their handling
Also convert audio_mode_gpio functions from audio_hook

Signed-off-by: Nickolay V. Shmyrev <nshmyrev@yandex.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-01-25 19:00:59 -02:00
Nickolay V. Shmyrev 40c6e683a2 V4L/DVB (6415): Restructurize volume hook and drop unused mute hook
Signed-off-by: Nickolay V. Shmyrev <nshmyrev@yandex.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-01-25 19:00:59 -02:00
Nickolay V. Shmyrev de5bec6bb5 V4L/DVB (6414): Remove bass, treble and balance from audio hook since they are unused
Signed-off-by: Nickolay V. Shmyrev <nshmyrev@yandex.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-01-25 19:00:59 -02:00
Nickolay V. Shmyrev 5b261016f0 V4L/DVB (6413): Forward VIDIOCGAUDIO and VIDIOCSAUDIO through v4l1-compat
Signed-off-by: Nickolay V. Shmyrev <nshmyrev@yandex.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-01-25 19:00:58 -02:00
Mauro Carvalho Chehab c2806d03c0 V4L/DVB (6412): Audio hooks moved to another file
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-01-25 19:00:58 -02:00
Mauro Carvalho Chehab c96dd07106 V4L/DVB (6411): remove V4L1 from being compiled when V4L2 only is selected
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-01-25 19:00:57 -02:00
Nickolay V. Shmyrev e84619b174 V4L/DVB (6410): Partial conversion from V4L1 to V4L2
This is part of the old V4L1->V4L2 bttv patch, ported to current tree
by Mauro Carvalho Chehab <mchehab@infradead.org>

Signed-off-by: Nickolay V. Shmyrev <nshmyrev@yandex.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-01-25 19:00:57 -02:00
Nickolay V. Shmyrev 302f61ad5d V4L/DVB (6409): Cleanup: removed i2c_vidiocschan
This is part of the old V4L1->V4L2 bttv patch, ported to current tree
by Mauro Carvalho Chehab <mchehab@infradead.org>

Signed-off-by: Nickolay V. Shmyrev <nshmyrev@yandex.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-01-25 19:00:56 -02:00
Nickolay V. Shmyrev 012cf21975 V4L/DVB (6408): Cleanup: Removed obsoleted code from bttv-cards
This is part of the old V4L1->V4L2 bttv patch, ported to current tree
by Mauro Carvalho Chehab <mchehab@infradead.org>

Signed-off-by: Nickolay V. Shmyrev <nshmyrev@yandex.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-01-25 19:00:56 -02:00
Mauro Carvalho Chehab 7f1711234e V4L/DVB (6384): Replace TDA9887_SET_CONFIG by TUNER_SET_CONFIG
Currently, the only tuner-specific device that allows special
configurations is tda9887. However, tea5767 also may require some
special configurations (for example, to specify a different Xtal freq).

This patch replaces TDA9887_SET_CONFIG by a more generic internal ioctl
(TUNER_SET_CONFIG). The newer one allows specifying what tuner is
appliable to a configuration set, and allows an arbitrary configuration
struct.

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-01-25 19:00:54 -02:00
Gregor Jasny d9030f5730 V4L/DVB (6944a): Fix Regression VIDIOCGMBUF ioctl hangs on bttv driver
Fix bttv VIDIOCGMBUF locking like done in commit
820eacd84c. 

Signed-off-by: Gregor Jasny <gjasny@web.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-01-07 06:12:57 -02:00