Hans de Goede [Sun, 1 Jan 2012 19:35:01 +0000 (16:35 -0300)]
[media] gspca: Add a need_max_bandwidth flag to sd_desc
Some cameras will pretty much entirely fill all the image buffers all the
time even though they are using compression.
This patch adds a flag to sd_desc, which drivers for such cameras can set.
When this flag is set the bandwidth calculation code will no longer
assume that the image buffer size is a worst case and less bandwidth than
imagebufsize * fps will be used on average.
This patch sets this new flag for 3 drivers:
* For spca561 (for rev12a cameras) and nw80x cams as these simply don't work
when given less bandwidth than imagebufsize * fps.
* For sn9c20x cameras, because these show severy jpeg artifacts when
given less bandwidth than imagebufsize * fps and since these are usb2
cameras there is plenty bandwidth anyways.
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jean-François Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Hans de Goede [Sun, 1 Jan 2012 20:20:14 +0000 (17:20 -0300)]
[media] gspca: Check dev->actconfig rather than dev->config
Check dev->actconfig rather than dev->config when checking various
configuration things. dev->config points to the array of configs for the
device so dev->config->foo boils down to dev->config[0].foo and the first
config is not necessarily always the active config.
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jean-François Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Hans de Goede [Fri, 30 Dec 2011 11:20:50 +0000 (08:20 -0300)]
[media] gspca - main: Correct use of interval in bandwidth calculation
The calculated bandwidth should not be multiplied by the interval, but be
divided by it. Also bInterbval should be interpreted as a power of 2
for isochronous endpoints.
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jean-François Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] gspca - main: Change the bandwidth estimation of isochronous transfer
Having:
- a mean image size of 0.375 time the max compressed image size and
- a frame rate of 30 fps for small images or with USB 2.0/3.0
seems more realistic and gives less image freezes.
[media] drxk: create only one frontend for both DVB-C and DVB-T
Instead of creating two DVB frontend entries for the same device,
create just one entry, and fill the delivery_system according with
the supported standards.
Steven Toth [Thu, 5 Jan 2012 00:15:18 +0000 (21:15 -0300)]
[media] cx25840: Hauppauge HVR1850 Analog driver support
Adding support for the CX23888 DIF.
Changes regression tested against the HVR1700 and HVR1800.
Split out much of the set and init handling of the cx23885 based
cards into their own functions. Added the DIF initialization code
for each supported IF.
Updated the cx23885 code to correctly initialize cx23888 based
video/audio decoders.
Enabled Closed Caption support for CX23885 based cards during
initialization.
Signed-off-by: Steven Toth <stoth@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
The card names are being truncated in the video4linux sys class name file.
Prior to this patch they were shown as:
cx23885[0] mpeg (Hauppauge WinT
cx23885[0] video (Hauppauge WinT
cx23885[0] vbi (Hauppauge WinT
After this patch they are shown as:
Hauppauge WinTV-HVR1850 (video)
Hauppauge WinTV-HVR1850 (mpeg)
Hauppauge WinTV-HVR1850 (vbi)
Signed-off-by: Steven Toth <stoth@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Steven Toth [Thu, 5 Jan 2012 00:11:55 +0000 (21:11 -0300)]
[media] cx23885: Control cleanup on the MPEG Encoder
Added three new control calls (g_std, querystd and g_ctrl) to
the -417 driver. Also routed other controls through the main
cx23885 driver meaning that the controls for the 417 and the
raw video device all enter the driver code and are handled
in a single place.
Signed-off-by: Steven Toth <stoth@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Steven Toth [Thu, 5 Jan 2012 00:08:35 +0000 (21:08 -0300)]
[media] cx23885: Hauppauge HVR1850 Analog driver support
First in a series of patches that adds support to the cx23885 driver
for CX23888 analog video handling. Raw and MPEG video support is
being added for the HVR1850 driver in the patch, and the following
series of patches.
Some basic cx23885 driver cleanup. Partly to add HVR1850 support
and partly to allow -417.c V4L2 calls to be routed through thr
driver core and handled in a single place.
Make a number of core driver functions available to the -417.c
driver to streamline the driver.
Add the analog tuner ops definition so we can reach/tune the
hardware when we need to. Added the tff field so 888 based cards
(which have a weird field ordering issue) can be accomodated
and worked around in the driver.
Signed-off-by: Steven Toth <stoth@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Steven Toth [Thu, 5 Jan 2012 00:06:13 +0000 (21:06 -0300)]
[media] cx25840: Add a flag to enable the CX23888 DIF to be enabled or not
The CX23888 (HVR1850 and other new cards) contain a DIF which is responsible
for demodulating the audio and video. It's built directly into the CX23888
PCIe bridge. It needs to be enabled and disabled on a per-card and per-input
basis. We pass this flag from the cx23885 core driver to the sub-device
when we need the cx25840 driver to enable/disable with the DIF correctly.
Signed-off-by: Steven Toth <stoth@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] Don't test for ops->info.type inside drivers
Now, ops->info.type is handled inside the dvb_frontend
core, only for DVBv3 calls, and according with the
delivery system. So, drivers should not care or use it,
otherwise, it may have issues with DVBv5 calls.
The drivers that were still using it were detected via
this small temporary hack:
[media] drxk: Add support for parallel mode and prints mpeg mode
While the driver has support for both serial and parallel mode,
There's was way to select serial mode via configuration. Add
a config option for that, while keeping the default in serial mode.
Also, at debug mode, it will now print a message when mpeg is
enabled/disabled, and showing if parallel or serial mode were
selected, helping developers to double-check if the DRX-K is at
the right mode.
[media] mt2063: add some useful info for the dvb callback calls
The per-delivery system tables are confusing.
Add an extra table that explains them, and some
dprintk calls, that allows to check if mt2063 driver
is working as expected.
mt2063.c:1531:12: warning: variable 'ofout' set but not used [-Wunused-but-set-variable]
mt2063.c:1531:6: warning: variable 'ofin' set but not used [-Wunused-but-set-variable]
Several vars at set_parms functions were set, but unused.
Remove them and change the logic to return -EINVAL if the
analog set_param is used for digital mode.
At the analog side, cleans the logic that sets the several
analog standards.
[media] mt2063: Rearrange the delivery system functions
No functional changes on this patch. Better organize the delivery
system information and data types, putting everything together,
to improve readability.
[media] mt2063: Fix analog/digital set params logic
The driver were using a hacky way of setting analog and digital
frequencies. Remove the hack and properly add the tuner logic for
each supported type of standard.
I was tempted to add more standards there, like SECAM and to fix
radio (as stepping seems broken), but I opted to keep it as-is,
as tests would be needed to add additional standards.
[media] mt2063: Remove the code for more than one adjacent mt2063 tuners
Such code is disabled via ifdef's. Also, they're ugly and rely
on some static structures. Just remove. If ever needed, the git
log can be used to recover it.
Steven Toth [Wed, 4 Jan 2012 13:56:14 +0000 (10:56 -0300)]
[media] cx23885: Configure the MPEG encoder early to avoid jerky video
Found an odd bug while implementing support for the HVR1850 that
lead to jerky video during the first capture, if the encoder was
not initialized early. I've modied the driver to configure the
encoder early, and this avoids the issue - a reasonable workaround.
Regression tested against the HVR1800 and soon to be added HVR1850
[mchehab@redhat.com: Fix this compilation issue: drivers/media/video/cx23885/cx23885-417.c:1351:2: error: too few arguments to function ‘cx23885_initialize_codec’] Signed-off-by: Steven Toth <stoth@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
During initialization the prior GPIO's were not being preserved
and restore correctly. Small cleanups to configure the GPIO's
for the HVR1700, HVR1800 and HVR1850.
Signed-off-by: Steven Toth <stoth@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Since the conversion to subdev in Oct 2010 the audio controls have
not functioned correctly in the cx23885 driver. Passing values of
0-3f did not translate into meaningfull register writes. I've
converted the cx23885 driver to match the cx25840 volume control
definition and now audio is working reliably again.
Signed-off-by: Steven Toth <stoth@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
matthieu castet [Fri, 16 Dec 2011 17:15:07 +0000 (14:15 -0300)]
[media] tm6000: improve loading speed on hauppauge 900H
- enable fast usb quirk
- use usleep_range instead on msleep for short sleep
- merge i2c out and usb delay
- do like the windows driver that upload the tuner firmware
with 80 bytes packets
This var were used during DVBv3 times, in order to keep a copy
of the parameters used by the events. This is not needed anymore,
as the parameters are now dynamically generated from the DVBv5
structure.
So, just get rid of it. That means that a DVBv5 pure call won't
use anymore any DVBv3 parameters.
For frontends with ISDB-T, DVB-T2, CMDBTH, etc, some code is
needed, in order to provide emulation. Add such code, and check
if the desired delivery system is supported by the frontend.
[media] dvb_frontend: Don't use ops->info.type anymore
Get rid of using ops->info.type defined on DVB drivers,
as it doesn't apply anymore.
Currently, one driver (cxd2820) supports more than one different
info.type, as it can be used for DVB-T/T2 and DVB-C. There are more
drivers like that to come. So, the same frontend will have
different DVBv3 types, depending on the current delivery system.
This breaks the existing logic at dvb_frontend, that assumes that
just one delivery system DVBv3 type is supported by all delsys.
In order to easy the DVBv3->DVBv5 conversion, an ancillary function
that maps DVBv3 delivery systems into DVBv5 were added.
Also, on all places, except for the event logic, the DVBv5 cache
will be used to check parameters, instead of the DVBv5 copy.
This patch simplifies the cache sync logic, and warrants that the
cache will be in a clear state at DVB frontend register. This way,
ops->info.type will be filled to reflect the first delivery system,
providing backward compatibility support for it.
For example, in the cases like cxd2820, where the delivery systems
are defined as:
.delsys = { SYS_DVBT, SYS_DVBT2, SYS_DVBC_ANNEX_A },
A pure DVBv3 will be able to use both DVB-T and DVB-T2, as, at
DVB cache clear, the ops->info.type will be equal to FE_OFDM.
However, DVB-C won't be visible. A quick workaround would be to
do a DVBv5 call to set the delivery system to SYS_DVBC_ANNEX_A.
After such call, ops->info.type will be equal to FE_QAM, and a
DVBv3 application will see the frontend as a DVB-C one.
[media] dvb: move dvb_set_frontend logic into a separate routine
This change is there in order to prepare the code to avoid calling
dvb_frontend_ioctl_legacy() from FE_SET_PROPERTY.
A call to dvb_frontend_ioctl_legacy() would require to update the
DVBv3 cache without need, mangling calls for newer delivery system
without any reason.
[media] dvb_frontend: Handle all possible DVBv3 values for bandwidth
Due to DVB-T2, several new possible values for bandwidth were added.
As the DVBv3 struct were updated to handle them, the core needs to
handle all of them, as a DVBv3 application might try to use it.
By default, initialize the frontend current delivery system with
the first one. This warrants that a DVBv3 application will be able
to tune to it, after the removal of ops->init.type filling at
the drivers.
[media] fs/compat_ioctl: it needs to see the DVBv3 compat stuff
Only the ioctl core should see the DVBv3 compat stuff, as its
contents are not available anymore to the drivers.
As fs/compat_ioctl also handles DVBv3 ioctl's, it needs those
definitions:
fs/compat_ioctl.c:1345: error: invalid application of ‘sizeof’ to incomplete type ‘struct dvb_frontend_parameters’
fs/compat_ioctl.c:1345: error: array type has incomplete element type
fs/compat_ioctl.c:1345: error: invalid application of ‘sizeof’ to incomplete type ‘struct dvb_frontend_parameters’
fs/compat_ioctl.c:1345: error: invalid application of ‘sizeof’ to incomplete type ‘struct dvb_frontend_parameters’
fs/compat_ioctl.c:1345: error: invalid application of ‘sizeof’ to incomplete type ‘struct dvb_frontend_parameters’
fs/compat_ioctl.c:1345: error: array type has incomplete element type
fs/compat_ioctl.c:1345: error: invalid application of ‘sizeof’ to incomplete type ‘struct dvb_frontend_parameters’
fs/compat_ioctl.c:1345: error: invalid application of ‘sizeof’ to incomplete type ‘struct dvb_frontend_parameters’
fs/compat_ioctl.c:1345: error: invalid application of ‘sizeof’ to incomplete type ‘struct dvb_frontend_parameters’
fs/compat_ioctl.c:1345: error: array type has incomplete element type
fs/compat_ioctl.c:1345: error: invalid application of ‘sizeof’ to incomplete type ‘struct dvb_frontend_parameters’
fs/compat_ioctl.c:1345: error: invalid application of ‘sizeof’ to incomplete type ‘struct dvb_frontend_parameters’
fs/compat_ioctl.c:1345: error: initializer element is not constant
fs/compat_ioctl.c:1345: error: (near initialization for ‘ioctl_pointer[462]’)
fs/compat_ioctl.c:1346: error: invalid application of ‘sizeof’ to incomplete type ‘struct dvb_frontend_parameters’
fs/compat_ioctl.c:1346: error: array type has incomplete element type
fs/compat_ioctl.c:1346: error: invalid application of ‘sizeof’ to incomplete type ‘struct dvb_frontend_parameters’
fs/compat_ioctl.c:1346: error: invalid application of ‘sizeof’ to incomplete type ‘struct dvb_frontend_parameters’
fs/compat_ioctl.c:1346: error: invalid application of ‘sizeof’ to incomplete type ‘struct dvb_frontend_parameters’
fs/compat_ioctl.c:1346: error: array type has incomplete element type
fs/compat_ioctl.c:1346: error: invalid application of ‘sizeof’ to incomplete type ‘struct dvb_frontend_parameters’
fs/compat_ioctl.c:1346: error: invalid application of ‘sizeof’ to incomplete type ‘struct dvb_frontend_parameters’
fs/compat_ioctl.c:1346: error: invalid application of ‘sizeof’ to incomplete type ‘struct dvb_frontend_parameters’
fs/compat_ioctl.c:1346: error: array type has incomplete element type
fs/compat_ioctl.c:1346: error: invalid application of ‘sizeof’ to incomplete type ‘struct dvb_frontend_parameters’
fs/compat_ioctl.c:1346: error: invalid application of ‘sizeof’ to incomplete type ‘struct dvb_frontend_parameters’
fs/compat_ioctl.c:1346: error: initializer element is not constant
fs/compat_ioctl.c:1346: error: (near initialization for ‘ioctl_pointer[463]’)
fs/compat_ioctl.c:1347: error: invalid application of ‘sizeof’ to incomplete type ‘struct dvb_frontend_event’
fs/compat_ioctl.c:1347: error: array type has incomplete element type
fs/compat_ioctl.c:1347: error: invalid application of ‘sizeof’ to incomplete type ‘struct dvb_frontend_event’
fs/compat_ioctl.c:1347: error: invalid application of ‘sizeof’ to incomplete type ‘struct dvb_frontend_event’
fs/compat_ioctl.c:1347: error: invalid application of ‘sizeof’ to incomplete type ‘struct dvb_frontend_event’
fs/compat_ioctl.c:1347: error: array type has incomplete element type
fs/compat_ioctl.c:1347: error: invalid application of ‘sizeof’ to incomplete type ‘struct dvb_frontend_event’
fs/compat_ioctl.c:1347: error: invalid application of ‘sizeof’ to incomplete type ‘struct dvb_frontend_event’
fs/compat_ioctl.c:1347: error: invalid application of ‘sizeof’ to incomplete type ‘struct dvb_frontend_event’
fs/compat_ioctl.c:1347: error: array type has incomplete element type
fs/compat_ioctl.c:1347: error: invalid application of ‘sizeof’ to incomplete type ‘struct dvb_frontend_event’
fs/compat_ioctl.c:1347: error: invalid application of ‘sizeof’ to incomplete type ‘struct dvb_frontend_event’
fs/compat_ioctl.c:1347: error: initializer element is not constant
fs/compat_ioctl.c:1347: error: (near initialization for ‘ioctl_pointer[464]’)
Reported-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] dvb: don't require a parameter for get_frontend
Just like set_frontend, use the dvb cache properties for get_frontend.
This is more consistent, as both functions are now symetric. Also,
at the places get_frontend is called, it makes sense to update the
cache.
Most of this patch were generated by this small perl script:
while (<>) { $file .= $_; }
if ($file =~ m/\.get_frontend\s*=\s*([\d\w_]+)/) {
my $get = $1;
$file =~ s/($get)(\s*\([^\,\)]+)\,\s*struct\s+dtv_frontend_properties\s*\*\s*([_\d\w]+)\)\s*\{/\1\2)\n{\n\tstruct dtv_frontend_properties *\3 = &fe->dtv_property_cache;/g;
}
print $file;
Of course, the changes at dvb_frontend.[ch] were made by hand,
as well as the changes on a few other places, where get_frontend()
is called internally inside the driver.
On some places, get_frontend() were just a void function. Those
occurrences were removed, as the DVB core handles such cases.
[media] dvb_frontend: Fix inversion breakage due to DVBv5 conversion
On several places inside dvb_frontend, only the DVBv3 parameters
were updated. Change it to be sure that, on all places, the DVBv5
parameters will be changed instead.
[media] dvb-core: be sure that drivers won't use DVBv3 internally
Now that all frontends are implementing DVBv5, don't export the
DVBv3 specific stuff to the drivers. Only the core should be
aware of that, as it will keep providing DVBv3 backward compatibility.
[media] cx23885-dvb: Remove a dirty hack that would require DVBv3
The cx23885-dvb driver has a dirty hack:
1) it hooks the DVBv3 legacy call to FE_SET_FRONTEND;
2) it uses internally the DVBv3 struct to decide some
configs.
Replace it by a change during the gate control. This will
likely work, but requires testing. Anyway, the current way
will break, as soon as we stop copying data for DVBv3 for
pure DVBv5 calls.
Compile-tested only.
Cc: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>