The v4l2_ctrl_query_fill_std() function wasn't one the best idea I ever had.
It doesn't add anything valuable that cannot be expressed equally well with
v4l2_ctrl_query_fill and only adds overhead.
Replace it with v4l2_ctrl_query_fill() everywhere it is used and remove it
from v4l2_common.c.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Hans Verkuil [Fri, 20 Feb 2009 09:30:12 +0000 (06:30 -0300)]
V4L/DVB (10687): v4l2-common/v4l2-spec: support/document write-only and button controls
The controls V4L2_CID_PAN_RESET and V4L2_CID_TILT_RESET changed their type
to button controls (these are unused at the moment, so this is a safe change).
The controls V4L2_CID_PAN_RELATIVE, V4L2_CID_TILT_RELATIVE, V4L2_CID_FOCUS_RELATIVE
and V4L2_CID_ZOOM_RELATIVE are marked as write-only controls.
V4L/DVB (10673): mt9t031: fix gain and hflip controls, register update, and scaling
Multiple fixes:
1. allow register update by setting the Output Control register to 2 and not 3
2. fix scaling factor calculations
3. recover lost HFLIP control
4. fix Global Gain calculation
V4L/DVB (10672): sh_mobile_ceu_camera: include NV* formats into the format list only once.
Currently, if an soc-camera device, connected to the sh_mobile_ceu_camera
camera host driver, supports several formats from the UYVY, VYUY, YUYV, YVYU
set, the driver would add four NV* formats for each of them. This patch fixes
this misbehaviour.
V4L/DVB (10671): sh_mobile_ceu: SOCAM flags are not platform dependent
sh_mobile_ceu_camera.c support for signal polarity flags isn't platform
dependent, provide them locally. Only the bus width is implementation
specific.
V4L/DVB (10667): ov772x: setting method to register is changed.
Color format regs array had been used, but it was not easy to understand
what to want to do, and additional bit became complex.
This patch modify this problem.
V4L/DVB (10666): ov772x: move configuration from start_capture() to set_fmt()
soc_camera framework requires, that camera configuration is performed in
set_fmt, and start_capture and stop_capture only turn the camera on/off.
This patch modifies ov772x to comply to this requirement.
V4L/DVB (10665): soc-camera: add data signal polarity flags to drivers
All soc-camera camera and host drivers must specify supported data signal
polarity, after all drivers are fixed, we'll add a suitable test to
soc_camera_bus_param_compatible().
V4L/DVB (10662): remove redundant memset after kzalloc
Hi there!
While having a look at the allocation of struct dvb_frontend in *_attach
functions, I found some cases calling memset after kzalloc. This is
redundant, and the attached patch removes these calls.
I also changed one case calling kmalloc and memset to kzalloc.
V4L/DVB (10654): em28xx: VideoMate For You USB TV box requires tvaudio
As reported by Vitaly Wool <vital@embeddedalley.com>:
> about half a year ago I posted the patch that basically enabled Compro
> VideoMate For You USB TV box support.
> The main problem is I couldn't get the sound working.
> So I kind of decomposed the box and found out the audio decoder chip
> used there was Philips TDA9874A. As far as I can see, it's not supported
> within the em28xx suite although it is for other TV tuner drivers.
A tvaudio modprobing confirms that tda9874a chip is accessible via i2c:
Laurent Pinchart [Mon, 16 Feb 2009 20:41:52 +0000 (17:41 -0300)]
V4L/DVB (10652): uvcvideo: Add quirk to override wrong bandwidth value for Vimicro devices
At least 3 Vimicro cameras (0x332d, 0x3410 and 0x3420) fail to return correct
bandwidth information. The first model rounds the value provided by the host
to the nearest supported packet size, while the other two always request the
maximum bandwidth.
Introduce a device quirk to override the value returned by the device with an
estimated bandwidth computed by the driver from the frame size and frame rate,
and enable it for all Vimicro cameras.
Laurent Pinchart [Sat, 14 Feb 2009 22:39:08 +0000 (19:39 -0300)]
V4L/DVB (10651): uvcvideo: Ignore empty bulk URBs
Devices may send a zero-length packet to signal the end of a bulk payload. If
the payload size is a multiple of the URB size the zero-length packet will be
received by the URB completion handler. Handle this by ignoring all empty URBs.
Laurent Pinchart [Sat, 14 Feb 2009 22:26:56 +0000 (19:26 -0300)]
V4L/DVB (10650): uvcvideo: Initialize streaming parameters with the probe control value
The UVC specification requires SET_CUR requests on the streaming commit control
to use values retrieved from a successful GET_CUR request on the probe control.
Initialize streaming parameters with the probe control current value to make
sure the driver always complies.
Hans Verkuil [Sat, 14 Feb 2009 15:00:53 +0000 (12:00 -0300)]
V4L/DVB (10644): v4l2-subdev: rename dev field to v4l2_dev
Remain consistent in the naming: fields pointing to v4l2_device should
be called v4l2_dev. There are too many device-like entities without
adding to the confusion by mixing naming conventions.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Hans Verkuil [Sat, 14 Feb 2009 14:54:23 +0000 (11:54 -0300)]
V4L/DVB (10643): v4l2-device: allow a NULL parent device when registering.
Some drivers (e.g. for ISA devices) have no parent device because there
is no associated bus driver. Allow the parent device to be NULL in
those cases when registering v4l2_device.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Hans Verkuil [Sat, 14 Feb 2009 14:31:01 +0000 (11:31 -0300)]
V4L/DVB (10641): v4l2-dev: remove limit of 32 devices per driver in get_index()
get_index() had a limitation of 32 devices per driver. This was
unnecessarily strict and has been replaced with the maximum number
of devices. That should really satisfy anyone!
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Adam Baker [Fri, 6 Feb 2009 18:12:46 +0000 (15:12 -0300)]
V4L/DVB (10639): gspca - sq905: New subdriver.
Add initial support for cameras based on the SQ Technologies SQ-905
chipset (USB ID 2770:9120) to V4L2 using the gspca infrastructure.
Currently only supports one resolution and doesn't attempt to inform
libv4l what image flipping options are needed.
V4L/DVB (10620): gspca - main: More checks of the device disconnection.
- prevent application oops when the device is disconnected
- wake up the application at disconnection time
- check the disconnection in ioctl dqbuf and poll
Tobias Lorenz [Thu, 12 Feb 2009 17:56:30 +0000 (14:56 -0300)]
V4L/DVB (10534): Output HW/SW version from scratchpad
This patch adds functions to access the scratchpad.
For it is this good for? In the first two bytes, the developers
stored the HW/PCB version and the software release of the firmware.
This is now written to syslog, so debugging get's easier.
Also knowing the versions is the key for flash upgrades later on.
There are also some cleanups of the flash report sizes.
Altogether this should justify the new version number 1.0.9.
Oldřich Jedlička [Thu, 12 Feb 2009 06:43:11 +0000 (03:43 -0300)]
V4L/DVB (10632): Added support for AVerMedia Cardbus Hybrid remote control
Added support for I2C device at address 0x40 and subaddress 0x0d/0x0b
that provides remote control key reading support for AVerMedia Cardbus
Hybrid card, possibly for other AVerMedia Cardbus cards.
The I2C address 0x40 doesn't like the SAA7134's 0xfd quirk, so it was
disabled.
Trent Piepho [Thu, 29 Jan 2009 00:32:59 +0000 (21:32 -0300)]
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.
Trent Piepho [Thu, 29 Jan 2009 00:32:59 +0000 (21:32 -0300)]
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.
Trent Piepho [Thu, 29 Jan 2009 00:32:59 +0000 (21:32 -0300)]
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>
Trent Piepho [Thu, 29 Jan 2009 00:32:59 +0000 (21:32 -0300)]
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.
Trent Piepho [Thu, 29 Jan 2009 00:32:59 +0000 (21:32 -0300)]
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.
Trent Piepho [Thu, 29 Jan 2009 00:32:59 +0000 (21:32 -0300)]
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.
Trent Piepho [Thu, 29 Jan 2009 00:32:59 +0000 (21:32 -0300)]
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.
Trent Piepho [Thu, 29 Jan 2009 00:32:59 +0000 (21:32 -0300)]
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).
Trent Piepho [Thu, 29 Jan 2009 00:32:59 +0000 (21:32 -0300)]
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.
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.
Trent Piepho [Thu, 29 Jan 2009 00:32:58 +0000 (21:32 -0300)]
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.
Hans Verkuil [Fri, 13 Feb 2009 08:12:02 +0000 (05:12 -0300)]
V4L/DVB (10540): cx2341x: fixed bug causing several audio controls to be no longer listed
The cx2341x_mpeg_ctrls array must be ordered by control ID. I know that
this is bad design, but for now I will just fix this bug and revisit it
when all drivers have moved to v4l2_device/v4l2_subdev, since that will
allow me to do greatly improve control handling.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tobias Lorenz [Thu, 12 Feb 2009 17:55:45 +0000 (14:55 -0300)]
V4L/DVB (10530): Documentation and code cleanups
- "DealExtreme" sells the "PCear" radio and that comes from "Sanei Electric".
- MPlayer is also usable as radio application.
- Consistent usage of tabulators and blanks in the code.
Nicola Soranzo [Wed, 11 Feb 2009 02:28:24 +0000 (23:28 -0300)]
V4L/DVB (10525): em28xx: Coding style fixes and a typo correction
Lots of coding style fixes and a typo correction for em28xx.
[dougsland@redhat.com: fixed a reject due to a change on em28xx-audio.c] Signed-off-by: Nicola Soranzo <nsoranzo@tiscali.it> Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>