History log of /drivers/media/dvb/dvb-core/dvb_frontend.c
Revision Date Author Comments
910a5f2e9642d5be373beae3d29e1c4a3bc7d83b 07-May-2012 Mauro Carvalho Chehab <mchehab@redhat.com> [media] dvb_frontend: fix a regression with DVB-S zig-zag

Changeset 5bfaadde broke zig-zag for DVB-S drivers that don't
implement get_tune_settings() callback.

Fix the code, in order to allow it to work as before, otherwise
some channels may not be tuned anymore.

Fix Fedora Bugzilla:
https://bugzilla.redhat.com/show_bug.cgi?id=814404

Cc: stable@kernel.org # for Kernel v3.3
Reported-by: Michael Heijenga <database.worker@googlemail.com>
Tested-by: Michael Heijenga <database.worker@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
3626479e482aa3247aac03724094ba6c13ea1e46 17-Apr-2012 Mauro Carvalho Chehab <mchehab@redhat.com> [media] dvb_frontend: Fix a regression when switching back to DVB-S

There are some softwares (Kaffeine and likely xine) that uses a
DVBv5 call to switch to DVB-S2, but expects that a DVBv3 call to
switch back to DVB-S. Well, this is not right, as a DVBv3 call
doesn't know anything about delivery systems.

However, as, by accident, this used to work, we need to restore its
behavior, in order to avoid regressions with those softwares.

Reported on this Fedora 16 bugzilla:
https://bugzilla.redhat.com/show_bug.cgi?id=812895

Reported-by: Dieter Roever <Dieter.Roever@gmx.de>
Cc: stable@kernel.org # for version 3.3
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
c065f5b4ee4487bbd411049be6eea1b59a90db96 27-Mar-2012 Hans Petter Selasky <hselasky@c2i.net> [media] dvb_frontend: fix compiler warning

has_get_frontend() should return a boolean, not a pointer.

Signed-off-by: Hans Petter Selasky <hselasky@c2i.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
556a0442e08a8bc8541587a349cbf26ed14ec6de 06-Apr-2012 Chris Rankin <rankincj@yahoo.com> [media] dvb_frontend: regression fix: userspace ABI broken for xine

The commit e399ce77e6e has broken the DVB ABI for xine:

The problem is that xine is expecting every event after a successful
FE_SET_FRONTEND ioctl to have a non-zero frequency parameter, regardless
of whether the tuning process has LOCKed yet. What used to happen is
that the events inherited the initial tuning parameters from the
FE_SET_FRONTEND call. However, the fepriv->parameters_out struct is now
not initialised until the status contains the FE_HAS_LOCK bit.

You might argue that this behaviour is intentional, except that if an
application other than xine uses the DVB adapter and manages to set the
parameters_out.frequency field to something other than zero, then xine
no longer has any problems until either the adapter is replugged or the
kernel modules reloaded. This can only mean that the
fepriv->parameters_out struct still contains the (stale) tuning
information from the previous application.

Signed-off-by: Chris Rankin <rankincj@yahoo.com>
Cc: stable@kernel.org # for kernel version 3.3
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
45145b67f5895ff92207cffd74e65460a87920b2 06-Feb-2012 Simon Arlott <simon@fire.lp0.eu> [media] dvb-core: fix DVBFE_ALGO_HW retune bug

Commit 7e07222 breaks DVBFE_ALGO_HW tuning after a retune is requested,
which causes bad tuning on my TBS 6920.

[ 0.769091] pci 0000:06:00.0: [14f1:8852] type 0 class 0x000400
[ 19.733530] CORE cx23885[0]: subsystem: 6920:8888, board: TurboSight TBS 6920 [card=14,autodetected]
[ 762.824912] cx24116_load_firmware: FW version 1.23.86.1

7e0722215a510921cbb73ab4c37477d4dcb91bf8 [media] dvb-core: Don't pass DVBv3 parameters on tune() fops

Although re_tune is set to true when FESTATE_RETUNE occurs, it is never
set back to false which the old code used to do when !FESTATE_RETUNE.

This patch sets re_tune to false if !(state & FESTATE_RETUNE).

$ szap-s2 -a 2 "Channel 5"
reading channels from file '/home/simon/.szap/channels.conf'
zapping to 247 'Channel 5':
delivery DVB-S, modulation QPSK
sat 0, frequency 10964 MHz H, symbolrate 22000000, coderate 5/6, rolloff 0.35
vpid 0x092a, apid 0x092b, sid 0x092d
using '/dev/dvb/adapter2/frontend0' and '/dev/dvb/adapter2/demux0'
status 1f | signal cf40 | snr 0000 | ber 00000000 | unc 00000000 | FE_HAS_LOCK
status 1f | signal cf40 | snr eccd | ber 00000000 | unc 00000000 | FE_HAS_LOCK
status 1f | signal cf40 | snr 0000 | ber 00000000 | unc 00000000 | FE_HAS_LOCK
status 1f | signal cf40 | snr 0000 | ber 00000000 | unc 00000000 | FE_HAS_LOCK
status 1f | signal cf40 | snr eccd | ber 00000000 | unc 00000000 | FE_HAS_LOCK
status 1f | signal cf40 | snr 0000 | ber 00000000 | unc 00000000 | FE_HAS_LOCK
status 1f | signal cf40 | snr 0000 | ber 00000000 | unc 00000000 | FE_HAS_LOCK
status 1f | signal cf40 | snr eb33 | ber 00000000 | unc 00000000 | FE_HAS_LOCK
status 1f | signal cf40 | snr eccd | ber 00000000 | unc 00000000 | FE_HAS_LOCK
status 1f | signal cf40 | snr eccd | ber 00000000 | unc 00000000 | FE_HAS_LOCK
status 1f | signal cf40 | snr 0000 | ber 00000000 | unc 00000000 | FE_HAS_LOCK
status 1f | signal cf40 | snr eccd | ber 00000000 | unc 00000000 | FE_HAS_LOCK
status 1f | signal cf40 | snr eccd | ber 00000000 | unc 00000000 | FE_HAS_LOCK
status 1f | signal cf40 | snr 0000 | ber 00000000 | unc 00000000 | FE_HAS_LOCK
status 1f | signal cec0 | snr eccd | ber 00000000 | unc 00000000 | FE_HAS_LOCK
status 1f | signal cec0 | snr 0000 | ber 00000000 | unc 00000000 | FE_HAS_LOCK

Signed-off-by: Simon Arlott <simon@fire.lp0.eu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
bad321f1bb8f45adc348a3913632387891dd6ac6 17-Jan-2012 Patrick Boettcher <Patrick.Boettcher@parrot.com> [media] DVB-CORE: remove superfluous DTV_CMDs

This small patch removes superfluous DTV_CMDs from dvb_frontend.c which were added in the initially when ISBD-T support was added.
They were there unnoticed even though compilers should have warning about those duplicates. Finally they did and now we can remove them.

Thanks to Dan Carpenter <dan.carpenter@oracle.com> for pointing that out.

Signed-off-by: Patrick Boettcher <pboettcher@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
51dcb19aaf9448f6547f653b60a9f083845aad4a 17-Jan-2012 Mauro Carvalho Chehab <mchehab@redhat.com> [media] dvb_frontend: Don't call get_frontend() if idle

If the frontend is in idle state, don't call get_frontend.

Calling get_frontend() when the device is not tuned may
result in wrong parameters to be returned to the
userspace.

I was tempted to not call get_frontend() at all, except
inside the dvb frontend thread, but this won't work for
all cases. The ISDB-T specs (ABNT NBR 15601 and ARIB
STD-B31) allow the broadcaster to dynamically change the
channel specs at runtime. That means that an ISDB-T optimized
application may want/need to monitor the TMCC tables, decoded
at the frontends via get_frontend call.

So, let's do the simpler change here.

Eventually, the logic could be changed to work only if
the device is tuned and has lock, but, even so, the
lock is also standard-dependent. For ISDB-T, the right
lock to wait is that the demod has TMCC lock. So, drivers
may need to implement some logic to detect if the get_frontend
info was retrieved or not.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
149709f5b8a4a8678401facb5c670119751f6087 13-Jan-2012 Mauro Carvalho Chehab <mchehab@redhat.com> [media] dvb-core: preserve the delivery system at cache clear

The changeset 240ab508aa is incomplete, as the first thing that
happens at cache clear is to do a memset with 0 to the cache.

So, the delivery system needs to be explicitly preserved there.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
f4b1952a453f4b4b4c4cd3436b9cd632bf4202aa 13-Jan-2012 Mauro Carvalho Chehab <mchehab@redhat.com> [media] dvb-core: fix a regression with MythTV

As reported by Lawrence[1], MythTV 0.24.1 does the wrong thing
with a DVBv5 call: it fills the delivery system with
SYS_UNDEFINED, expecting that the DVB core would work with that.

This used to work by accident, as the DVB core were missing the
check for the supported delivery systems. Yet, fixing it
is easy, so let's add a logic to handle this case, to
provide backward compatibility.

[1] http://patchwork.linuxtv.org/patch/8314/

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
240ab508aa9fb7a294b0ecb563b19ead000b2463 10-Jan-2012 Mauro Carvalho Chehab <mchehab@redhat.com> [media] [PATCH] don't reset the delivery system on DTV_CLEAR

As a DVBv3 application may be relying on the delivery system,
don't reset it at DTV_CLEAR. For DVBv5 applications, the
delivery system should be set anyway.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
b247377ace5d965809d0ba8de158dc2e8d28af77 07-Jan-2012 Mauro Carvalho Chehab <mchehab@redhat.com> [media] dvb: remove bogus modulation check

This code is wrong as I should have coded it as SYS_DVBC, instead of
SYS_DVBS & friends. Anyway, this check has other problems

1) it does some "magic" by assuming that all QAM modulations are below
QAM_AUTO;

2) it checks modulation parameters only for one delivery system.
Or the core should check invalid parameters for all delivery
systems, or it should let the frontend drivers do it;

3) frontend drivers should already be checking for invalid parameters
(most of them do it, anyway);

4) not all modulations are mapped at fe->ops.info.caps, so it is not
even possible to check for the valid modulations inside the core
for some delivery systems;

5) The core check is incomplete anyway: it only checks for a few
parameters. If moved into the core other parameters like bandwidth
and fec should also be checked;

6) 2nd gen DVB-C uses OFDM. So, that test would fail for it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
37fa53c6a13ac9e82f9c6d334862b514e34de2a4 05-Jan-2012 Mauro Carvalho Chehab <mchehab@redhat.com> [media] dvb_frontend: improve documentation on set_delivery_system()

While this patch change some things, the updated fields there are
used just on printk, so it shouldn't cause any functional changes.

Yet, this routine is a little complex, so explain a little more
how it works.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
9474c5e63f61d052ac218b9f7c4c0b3c7c2b083a 05-Jan-2012 Mauro Carvalho Chehab <mchehab@redhat.com> [media] dvb_frontend: Update the dynamic info->type

Instead of changing the ops.info.type struct, updates only
the data that will be returned to userspace.

Also add some debug messages to help tracking such issues.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
6c4b78cbe64fad1c7a561d22014842f8eafbda47 05-Jan-2012 Mauro Carvalho Chehab <mchehab@redhat.com> [media] dvb_frontend: regression fix: add a missing inc inside the loop

without it, the loop will run forever!

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
e399ce77e6e8f0ff2e0b8ef808cbb88fc824c610 01-Jan-2012 Mauro Carvalho Chehab <mchehab@redhat.com> [media] dvb: get rid of fepriv->parameters_in

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.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
a520ca97a51941f13a802b9e00ed27fc26e0ead6 01-Jan-2012 Mauro Carvalho Chehab <mchehab@redhat.com> [media] dvb-core: Fix ISDB-T defaults

using -1 for ISDB-T parameters do the wrong thing. Fix it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
04be0f76a8d0ea8099a58227b4775bd398ea7088 01-Jan-2012 Mauro Carvalho Chehab <mchehab@redhat.com> [media] dvb_frontend: Fix DVBv3 emulation

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.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
5bfaaddef8d46ca274e8ff819311e1eef1554e74 01-Jan-2012 Mauro Carvalho Chehab <mchehab@redhat.com> [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.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
9682cea27e9ce7ede8e5c608900a52edaeb57a6b 01-Jan-2012 Mauro Carvalho Chehab <mchehab@redhat.com> [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.

No functional changes here.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
9a27e6a0b70966ee141c8f576cc4836d5001d44f 01-Jan-2012 Mauro Carvalho Chehab <mchehab@redhat.com> [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.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
26c924febc2a840fc232bfb3771df39810f5d362 01-Jan-2012 Mauro Carvalho Chehab <mchehab@redhat.com> [media] dvb: Initialize all cache values

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.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
7c61d80a9bcfc3fdec8ffd75756cad6a64678229 30-Dec-2011 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.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
ac3852c41b36cb408bea1400892dd6c61c3b225a 30-Dec-2011 Mauro Carvalho Chehab <mchehab@redhat.com> [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.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
63aad05b8d27f4e62227061f7e4ecc7041b92f58 27-Dec-2011 Mauro Carvalho Chehab <mchehab@redhat.com> [media] s921: Properly report the delivery system

Before this patch, a query for the delivery systems were
returned SYS_UNDEFINED.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
8de8594a79ae43b08d115c94f09373f6c673f202 27-Dec-2011 Mauro Carvalho Chehab <mchehab@redhat.com> [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.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
1b5d8716b1663ed00718d738a16f43ebeeeaf81d 26-Dec-2011 Mauro Carvalho Chehab <mchehab@redhat.com> [media] dvb: remove the track() fops

This callback is not used anywhere. Maybe it were used in the
past to optimize the custom algo, but, as it is not used anymore,
let's just remove it.

If later needed, some patch may re-add it with a proper
implementation.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
41da5320df6decec7efce0d936ccadfa9deb49d1 26-Dec-2011 Mauro Carvalho Chehab <mchehab@redhat.com> [media] dvb: don't pass a DVBv3 parameter for search() fops

Just like the other DVB algorithms, drivers should use the DVBv5
way to retrieve parameters: via the cache struct.

Actually, several drivers were partially using the DVBv3 struct
and partially using the DVBv5 way, with is confusing and may
lead into troubles.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
7e0722215a510921cbb73ab4c37477d4dcb91bf8 26-Dec-2011 Mauro Carvalho Chehab <mchehab@redhat.com> [media] dvb-core: Don't pass DVBv3 parameters on tune() fops

As all parameters are passed via DVBv5 to the frontends, there's
no need to pass them again via fops. Also, most drivers weren't using
it anyway. So, instead, just pass a parameter to indicate if the
hardware algorithm wants the driver to re-tune or not.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
5581e130ad288af745706c30de050bc2cf6e37b3 26-Dec-2011 Mauro Carvalho Chehab <mchehab@redhat.com> [media] dvb: simplify get_tune_settings() struct

In the past, dvb_frontent_parameters were passed inside the
struct where get_tuner_settings should store their result.

This is not needed anymore, as all parameters needed are stored
already at the fe property cache. So, use it, where needed.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
b1e9a650104111036ac7176024c8bb685882fe02 26-Dec-2011 Mauro Carvalho Chehab <mchehab@redhat.com> [media] dvb-core: remove get|set_frontend_legacy

Now that all drivers were converted, we can get rid of those
emulation calls.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
a689e3657d7e82c2271008553c709fc79fb2e038 22-Dec-2011 Mauro Carvalho Chehab <mchehab@redhat.com> [media] dvb-core: add support for a DVBv5 get_frontend() callback

Creates a DVBv5 get_frontend call, renaming the DVBv3 one to
get_frontend_legacy(), while not all frontends are converted.

After the conversion for all drivers, get_frontend_legacy()
will be removed.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
bc9cd2736b34619b58961d506210fe0e6dfaa27d 20-Dec-2011 Mauro Carvalho Chehab <mchehab@redhat.com> [media] Rename set_frontend fops to set_frontend_legacy

Passing DVBv3 parameters to set_frontend is not fun, as the
core doesn't have any way to know if the driver is using the
v3 or v5 parameters. So, rename the callback and add a new
one to allow distinguish between a mixed v3/v5 paramenter call
from a pure v5 call.

After having all frontends to use the new way, the legacy
call can be removed.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
eeacf1477b4460e2dbc37c9164bb46a65ab8f084 22-Dec-2011 Mauro Carvalho Chehab <mchehab@redhat.com> [media] dvb-core: allow demods to specify the supported delsys

The dvb were originally written for DVB-T/C/S and ATSC. So,
the original frontend struct has fields to describe only those three
standards.

While 2nd gen standards are similar to these, new standards
like DSS, ISDB and CTTB don't fit on any of the above types.

While there's a way for the drivers to explicitly change whatever
default DELSYS were filled inside the core, still a fake value is
needed there, and a "compat" code to allow DVBv3 applications to
work with those delivery systems is needed. This is good for a
short term solution, while applications aren't using DVBv5 directly.

However, at long term, this is bad, as the compat code runs even
if the application is using DVBv5. Also, the compat code is not
perfect, and only works when the frontend is capable of auto-detecting
the parameters that aren't visible by the faked delivery systems.

So, let the frontend fill the supported delivery systems at the
device properties directly.

The future plan is that the drivers will stop filling ops->info.type,
filling, instead, ops->delsys. This will allow multi-frontend
devices like drx-k to use just one frontend structure for all supported
delivery systems.

Of course, the core will keep using it, in order to keep allowing
DVBv3 calls.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
0607d077809014082965061e9e88f38459c070ac 21-Dec-2011 Mauro Carvalho Chehab <mchehab@redhat.com> [media] dvb_core: estimate bw for all non-terrestial systems

Instead of just estimating the bandwidth for DVB-C annex A/C,
also fill it at the core for ATSC and DVB-C annex B. This
simplifies the logic inside the tuners, as all non-satellite
tuners can just use c->bandwidth_hz for all supported
delivery systems.

It could make sense to latter use it also for satellite
systems, as several DVB-S drivers have their own calculus.
However, on DVB-S2 the bw estimation is a little more complex,
and the existing drivers have some optimized calculus for
bandwidth. So, let's not touch on it for now.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
0349471bc556d5ecd3e9214af7774fbf2d956931 22-Dec-2011 Mauro Carvalho Chehab <mchehab@redhat.com> [media] dvb: replace SYS_DVBC_ANNEX_AC by the right delsys

SYS_DVBC_ANNEX_AC is an alias for SYS_DVBC_ANNEX_A. However,
the first one is incorrect, as not all devices support both.
So, replace its occurrences by the proper value (either
SYS_DVBC_ANNEX_A or both SYS_DVBC_ANNEX_A and SYS_DVBC_ANNEX_C).

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
b9d5efcceb6b34ee20111b62cf7be61ae79af4e9 10-Dec-2011 Andreas Oberritter <obi@linuxtv.org> [media] DVB: dvb_frontend: fix delayed thread exit

There are some issues and miss-behaves at the dvb fe thread:

1) dvb_shutdown_timeout should be dvb_shutdown_timeout * HZ
instead of (dvb_shutdown_timeout * HZ + 1);

2) add a memory barrier to warrant that all CPU's will consider the
new value for release_jiffies;

3) wake up dvb thread also when fepriv->exit == DVB_FE_NO_EXIT.

Signed-off-by: Andreas Oberritter <obi@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
fd66c45dd51000ff444231a94ac15ccab8cffd3d 18-Dec-2011 Mauro Carvalho Chehab <mchehab@redhat.com> [media] Remove Annex A/C selection via roll-off factor

Instead of using a roll-off factor, change DRX-K & friends to select
the bandwidth filter and the Nyquist half roll-off via delivery system.

This provides a cleaner support for Annex A/C switch.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
ba2780c796badfc3741c7cb499a575ca49f17e6d 13-Nov-2011 Manu Abraham <abraham.manu@gmail.com> [media] DVB: Query DVB frontend delivery capabilities

Currently, for any multi-standard frontend it is assumed that it just
has a single standard capability. This is fine in some cases, but
makes things hard when there are incompatible standards in conjuction.
Eg: DVB-S can be seen as a subset of DVB-S2, but the same doesn't hold
the same for DSS. This is not specific to any driver as it is, but a
generic issue. This was handled correctly in the multiproto tree,
while such functionality is missing from the v5 API update.

http://www.linuxtv.org/pipermail/vdr/2008-November/018417.html

Later on a FE_CAN_2G_MODULATION was added as a hack to workaround this
issue in the v5 API, but that hack is incapable of addressing the
issue, as it can be used to simply distinguish between DVB-S and
DVB-S2 alone, or another X vs X2 modulation. If there are more systems,
then you have a potential issue.

An application needs to query the device capabilities before requesting
any operation from the device.

Signed-off-by: Manu Abraham <abraham.manu@gmail.com>
Acked-by: Andreas Oberritter <obi@linuxtv.org>
Acked-by: Oliver Endriss <o.endriss@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
39ce61a846c8e1fa00cb57ad5af021542e6e8403 11-Nov-2011 Mauro Carvalho Chehab <mchehab@redhat.com> [media] dvb: Allow select between DVB-C Annex A and Annex C

DVB-C, as defined by ITU-T J.83 has 3 annexes. The differences between
Annex A and Annex C is that Annex C uses a subset of the modulation
types, and uses a different rolloff factor. A different rolloff means
that the bandwidth required is slicely different, and may affect the
saw filter configuration at the tuners. Also, some demods have different
configurations, depending on using Annex A or Annex C.

So, allow userspace to specify it, by changing the rolloff factor.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
94238e9b1946a300b7aeb8bc1ab7f55f6f27e225 27-Aug-2011 Hans Verkuil <hans.verkuil@cisco.com> [media] dvb_frontend: fix compile warning

Andreas Oberritter <obi@linuxtv.org> has looked at this and agreed that it is
safe to remove the 'timeout' variable.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
42f4e774a30d0e9894741b62af4174c73ecc53da 24-Aug-2011 Andreas Oberritter <obi@linuxtv.org> [media] DVB: dvb_frontend: check function pointers on reinitialize

Signed-off-by: Andreas Oberritter <obi@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
674ce34333f49a5aea778e7659e7fe637dc1dab3 16-Aug-2011 Andreas Oberritter <obi@linuxtv.org> [media] DVB: dvb_frontend: remove static assignments from dtv_property_cache_sync()

dtv_property_cache_init().
dtv_property_process_get().
overwritten with invalid values, leading to partially incorrect
results when calling FE_GET_PROPERTY.

Signed-off-by: Andreas Oberritter <obi@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14f55794b24506a82e995a92e599a3aa9d08781e 08-Aug-2011 Andreas Oberritter <obi@linuxtv.org> [media] DVB: dvb_frontend: Fix compatibility criteria for satellite receivers

identify a satellite receiver by its 'delivery_system' instead of
'modulation', which may overlap between different delivery systems.

Signed-off-by: Andreas Oberritter <obi@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
77b1e2fbbdfa0ee5cdf6c928b711493a3738468e 04-Aug-2011 Andreas Oberritter <obi@linuxtv.org> [media] DVB: dvb_frontend: update locking in dvb_frontend_{add, get_event}

- fepriv->parameters_out isn't protected by events->mtx, so
move the call to fe->ops.get_frontend out of the locked area.
- move the assignment of e->status into the locked area.

- use direct assignment instead of memcpy.

- use mutex_lock instead of mutex_lock_interruptible, because
all code paths protected by this mutex won't block.

Signed-off-by: Andreas Oberritter <obi@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
20640bea87c31a823dba3756b1a5248197f0905f 04-Aug-2011 Andreas Oberritter <obi@linuxtv.org> [media] DVB: dvb_frontend: clear stale events on FE_SET_FRONTEND

the first event after an attempt to tune.

Signed-off-by: Andreas Oberritter <obi@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
5c9f480bdb584944b5af390ccdd8c3e586bdafdb 04-Aug-2011 Andreas Oberritter <obi@linuxtv.org> [media] DVB: dvb_frontend: avoid possible race condition on first event

enqueued before the frontend thread wakes up.

Signed-off-by: Andreas Oberritter <obi@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
56ce5ac41af87c157cf4c6e4e6fec31d7d48025e 04-Aug-2011 Andreas Oberritter <obi@linuxtv.org> [media] DVB: dvb_frontend: fix stale parameters on initial frontend event

Modify it to use the data given by the user.

Signed-off-by: Andreas Oberritter <obi@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
106ff9e013f60e2f40687d4f8b43c164873b5544 15-Jul-2011 Mauro Carvalho Chehab <mchehab@redhat.com> Revert "[media] DVB: dvb_frontend: off by one in dtv_property_dump()"

This reverts commit a3e4adf274f86b2363fedaa964297cb38526cef0.

As pointed by Andread Oberritter <obi@linuxtv.org>:

That's wrong, because the array size is DTV_MAX_COMMAND + 1.
Using the ARRAY_SIZE macro instead might reduce the confusion.

Also, changeset 3995223038 already fixed this issue.

Reported-by: Andread Oberritter <obi@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
bca3ba7904426bb94ee1a91e6e88831483fb5d53 26-May-2011 Dan Carpenter <error27@gmail.com> [media] DVB: dvb_frontend: off by one in dtv_property_dump()

If the tvp->cmd == DTV_MAX_COMMAND then we read past the end of the
array.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
ec05a642140c7c34f7ba1cb8a94be9b1154286ae 26-May-2011 Andreas Oberritter <obi@linuxtv.org> [media] DVB: dvb_frontend: fix dtv_property_dump for DTV_DVBT2_PLP_ID

- Add missing entry to array "dtv_cmds".
- Set array size to DTV_MAX_COMMAND + 1 to avoid future off-by-ones.

Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Andreas Oberritter <obi@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2d1969312d6319d28ae9609a84f969b6933bd51c 05-Jul-2011 Devin Heitmueller <dheitmueller@kernellabs.com> [media] dvb_frontend: fix race condition in stopping/starting frontend

Attached is a patch which addresses a race condition in the DVB core
related to closing/reopening the DVB frontend device in quick
succession. This is the reason that devices such as the HVR-1300,
HVR-3000, and HVR-4000 have been failing to scan properly under MythTV
and w_scan.

The gory details of the race are described in the patch.

Devin

There is a race condition exhibited when channel scanners such as w_scan and
MythTV quickly close and then reopen the frontend device node.

Under normal conditions, the behavior is as follows:

1. Application closes the device node
2. DVB frontend ioctl calls dvb_frontend_release which sets
fepriv->release_jiffies
3. DVB frontend thread *eventually* calls dvb_frontend_is_exiting() which
compares fepriv->release_jiffies, and shuts down the thread if timeout has
expired
4. Thread goes away
5. Application opens frontend device
6. DVB frontend ioctl() calls ts_bus_ctrl(1)
7. DVB frontend ioctl() creates new frontend thread, which calls
dvb_frontend_init(), which has demod driver init() routine setup initial
register state for demod chip.
8. Tuning request is issued.

The race occurs when the application in step 5 performs the new open() call
before the frontend thread is shutdown. In this case the ts_bus_ctrl() call
is made, which strobes the RESET pin on the demodulator, but the
dvb_frontend_init() function never gets called because the frontend thread
hasn't gone away yet. As a result, the initial register config for the demod
is *never* setup, causing subsequent tuning requests to fail.

If there is time between the close and open (enough for the dvb frontend
thread to be torn down), then in that case the new frontend thread is created
and thus the dvb_frontend_init() function does get called.

The fix is to set the flag which forces reinitialization if we did in fact
call ts_bus_ctrl().

This problem has been seen on the HVR-1300, HVR-3000, and HVR-4000, and is
likely occuring on other designs as well where ts_bus_ctrl() actually strobes
the reset pin on the demodulator.

Note that this patch should supercede any patches submitted for the
1300/3000/4000 which remove the code that removes GPIO code in
cx8802_dvb_advise_acquire(), which have been circulating by users for some
time now...

Canonical tracking this issue in Launchpad 439163:

Thanks to Jon Sayers from Hauppauge and Florent Audebert from Anevia S.A. for
providing hardware to test/debug with.

Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Cc: Jon Sayers <j.sayers@hauppauge.co.uk>
Cc: Florent Audebert <florent.audebert@anevia.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
bbe880b4a7c66ba14b67ee7acfbaaaa1c7be2d03 09-May-2011 Andreas Oberritter <obi@linuxtv.org> [media] DVB: allow to read back of detected parameters through S2API

Signed-off-by: Andreas Oberritter <obi@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
a5959dbea37973a2440eeba39fba32c79d862ec2 09-May-2011 Andreas Oberritter <obi@linuxtv.org> [media] DVB: dvb_frontend: add parameters_out

- Holds the parameters detected by the demod.
- Updated on every call to get_frontend, either through ioctl or when
a frontend event occurs.
- Reset to input parameters after every call to set_frontend, tune or
search/track.

Signed-off-by: Andreas Oberritter <obi@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
507277193253cd4ea44d0a55ade37bdef20f3a44 09-May-2011 Andreas Oberritter <obi@linuxtv.org> [media] DVB: dvb_frontend: use shortcut to access fe->dtv_property_cache

Signed-off-by: Andreas Oberritter <obi@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
68bdee041317116bccaf830a9ff8f46f9aa857bd 09-May-2011 Andreas Oberritter <obi@linuxtv.org> [media] DVB: dvb_frontend: remove unused assignments

Signed-off-by: Andreas Oberritter <obi@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
61cb27af660168e3ad9a8922508c44a7d7453927 09-May-2011 Andreas Oberritter <obi@linuxtv.org> [media] DVB: dvb_frontend: rename parameters to parameters_in

- Preparation to distinguish input parameters from output parameters.

Signed-off-by: Andreas Oberritter <obi@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
e23d9ae343f9d196382ab213612d76126f9c99af 09-May-2011 Andreas Oberritter <obi@linuxtv.org> [media] DVB: call get_property at the end of dtv_property_process_get

- Drivers should be able to override properties returned to the user.
- The default values get prefilled from the cache.

Signed-off-by: Andreas Oberritter <obi@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
15cc2bb385ced95be35d13895a67bfe52066778c 09-May-2011 Andreas Oberritter <obi@linuxtv.org> [media] DVB: dtv_property_cache_submit shouldn't modifiy the cache

- Use const pointers and remove assignments.
- delivery_system already gets assigned by DTV_DELIVERY_SYSTEM
and dtv_property_cache_sync.

Signed-off-by: Andreas Oberritter <obi@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
94d56ffa0a9bf11dfb602dae9223089e09a8e050 12-May-2011 Andreas Oberritter <obi@linuxtv.org> [media] DVB: Add basic API support for DVB-T2 and bump minor version

[steve@stevekerrison.com: Remove private definitions from cxd2820r that existed before API was defined]
Signed-off-by: Andreas Oberritter <obi@linuxtv.org>
Signed-off-by: Steve Kerrison <steve@stevekerrison.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
aff8ab5cc11c2c14b7ae3bb38cbe012c43b7dcef 09-May-2011 Andreas Oberritter <obi@linuxtv.org> [media] DVB: return meaningful error codes in dvb_frontend

- Return values should not be ORed. Abort early instead.
- Return -EINVAL instead of -1.

Signed-off-by: Andreas Oberritter <obi@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
25985edcedea6396277003854657b5f3cb31a628 31-Mar-2011 Lucas De Marchi <lucas.demarchi@profusion.mobi> Fix common misspellings

Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
451a3c24b0135bce54542009b5fde43846c7cf67 17-Nov-2010 Arnd Bergmann <arnd@arndb.de> BKL: remove extraneous #include <smp_lock.h>

The big kernel lock has been removed from all these files at some point,
leaving only the #include.

Remove this too as a cleanup.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
a0a4714c404dfd0c28092743dd8bc244fcda357a 07-Sep-2010 Thomas Gleixner <tglx@linutronix.de> V4L/DVB: dvb: Convert "mutex" to semaphore

Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
6038f373a3dc1f1c26496e60b6c40b164716f07e 15-Aug-2010 Arnd Bergmann <arnd@arndb.de> llseek: automatically add .llseek fop

All file_operations should get a .llseek operation so we can make
nonseekable_open the default for future file operations without a
.llseek pointer.

The three cases that we can automatically detect are no_llseek, seq_lseek
and default_llseek. For cases where we can we can automatically prove that
the file offset is always ignored, we use noop_llseek, which maintains
the current behavior of not returning an error from a seek.

New drivers should normally not use noop_llseek but instead use no_llseek
and call nonseekable_open at open time. Existing drivers can be converted
to do the same when the maintainer knows for certain that no user code
relies on calling seek on the device file.

The generated code is often incorrectly indented and right now contains
comments that clarify for each added line why a specific variant was
chosen. In the version that gets submitted upstream, the comments will
be gone and I will manually fix the indentation, because there does not
seem to be a way to do that using coccinelle.

Some amount of new code is currently sitting in linux-next that should get
the same modifications, which I will do at the end of the merge window.

Many thanks to Julia Lawall for helping me learn to write a semantic
patch that does all this.

===== begin semantic patch =====
// This adds an llseek= method to all file operations,
// as a preparation for making no_llseek the default.
//
// The rules are
// - use no_llseek explicitly if we do nonseekable_open
// - use seq_lseek for sequential files
// - use default_llseek if we know we access f_pos
// - use noop_llseek if we know we don't access f_pos,
// but we still want to allow users to call lseek
//
@ open1 exists @
identifier nested_open;
@@
nested_open(...)
{
<+...
nonseekable_open(...)
...+>
}

@ open exists@
identifier open_f;
identifier i, f;
identifier open1.nested_open;
@@
int open_f(struct inode *i, struct file *f)
{
<+...
(
nonseekable_open(...)
|
nested_open(...)
)
...+>
}

@ read disable optional_qualifier exists @
identifier read_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
expression E;
identifier func;
@@
ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
{
<+...
(
*off = E
|
*off += E
|
func(..., off, ...)
|
E = *off
)
...+>
}

@ read_no_fpos disable optional_qualifier exists @
identifier read_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
@@
ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
{
... when != off
}

@ write @
identifier write_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
expression E;
identifier func;
@@
ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
{
<+...
(
*off = E
|
*off += E
|
func(..., off, ...)
|
E = *off
)
...+>
}

@ write_no_fpos @
identifier write_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
@@
ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
{
... when != off
}

@ fops0 @
identifier fops;
@@
struct file_operations fops = {
...
};

@ has_llseek depends on fops0 @
identifier fops0.fops;
identifier llseek_f;
@@
struct file_operations fops = {
...
.llseek = llseek_f,
...
};

@ has_read depends on fops0 @
identifier fops0.fops;
identifier read_f;
@@
struct file_operations fops = {
...
.read = read_f,
...
};

@ has_write depends on fops0 @
identifier fops0.fops;
identifier write_f;
@@
struct file_operations fops = {
...
.write = write_f,
...
};

@ has_open depends on fops0 @
identifier fops0.fops;
identifier open_f;
@@
struct file_operations fops = {
...
.open = open_f,
...
};

// use no_llseek if we call nonseekable_open
////////////////////////////////////////////
@ nonseekable1 depends on !has_llseek && has_open @
identifier fops0.fops;
identifier nso ~= "nonseekable_open";
@@
struct file_operations fops = {
... .open = nso, ...
+.llseek = no_llseek, /* nonseekable */
};

@ nonseekable2 depends on !has_llseek @
identifier fops0.fops;
identifier open.open_f;
@@
struct file_operations fops = {
... .open = open_f, ...
+.llseek = no_llseek, /* open uses nonseekable */
};

// use seq_lseek for sequential files
/////////////////////////////////////
@ seq depends on !has_llseek @
identifier fops0.fops;
identifier sr ~= "seq_read";
@@
struct file_operations fops = {
... .read = sr, ...
+.llseek = seq_lseek, /* we have seq_read */
};

// use default_llseek if there is a readdir
///////////////////////////////////////////
@ fops1 depends on !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
identifier readdir_e;
@@
// any other fop is used that changes pos
struct file_operations fops = {
... .readdir = readdir_e, ...
+.llseek = default_llseek, /* readdir is present */
};

// use default_llseek if at least one of read/write touches f_pos
/////////////////////////////////////////////////////////////////
@ fops2 depends on !fops1 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
identifier read.read_f;
@@
// read fops use offset
struct file_operations fops = {
... .read = read_f, ...
+.llseek = default_llseek, /* read accesses f_pos */
};

@ fops3 depends on !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
identifier write.write_f;
@@
// write fops use offset
struct file_operations fops = {
... .write = write_f, ...
+ .llseek = default_llseek, /* write accesses f_pos */
};

// Use noop_llseek if neither read nor write accesses f_pos
///////////////////////////////////////////////////////////

@ fops4 depends on !fops1 && !fops2 && !fops3 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
identifier read_no_fpos.read_f;
identifier write_no_fpos.write_f;
@@
// write fops use offset
struct file_operations fops = {
...
.write = write_f,
.read = read_f,
...
+.llseek = noop_llseek, /* read and write both use no f_pos */
};

@ depends on has_write && !has_read && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
identifier write_no_fpos.write_f;
@@
struct file_operations fops = {
... .write = write_f, ...
+.llseek = noop_llseek, /* write uses no f_pos */
};

@ depends on has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
identifier read_no_fpos.read_f;
@@
struct file_operations fops = {
... .read = read_f, ...
+.llseek = noop_llseek, /* read uses no f_pos */
};

@ depends on !has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
@@
struct file_operations fops = {
...
+.llseek = noop_llseek, /* no read or write fn */
};
===== End semantic patch =====

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Julia Lawall <julia@diku.dk>
Cc: Christoph Hellwig <hch@infradead.org>
2030c0325aa3d430b7bb9ec99da0295f49d183ef 06-May-2010 Guillaume Audirac <guillaume.audirac@webag.fr> V4L/DVB: dvb_frontend: fix typos in comments and one function

Signed-off-by: Guillaume Audirac <guillaume.audirac@webag.fr>
Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
e36309f54a6196792fce74100356ebdeaecabd56 05-May-2010 matthieu castet <castet.matthieu@free.fr> V4L/DVB: fix dvb frontend lockup

If my dvb device is removed while in use, I got the following oops:

[ 4920.484084] Call Trace:
[ 4920.484102] [<c102daad>] ? default_wake_function+0x0/0x8
[ 4920.484147] [<f8cb09e1>] ? dvb_unregister_frontend+0x95/0xcc [dvb_core]
[ 4920.484157] [<c1044412>] ? autoremove_wake_function+0x0/0x2d
[ 4920.484168] [<f8dd1af2>] ? dvb_usb_adapter_frontend_exit+0x12/0x21 [dvb_usb]
[ 4920.484176] [<f8dd12f1>] ? dvb_usb_exit+0x26/0x88 [dvb_usb]
[ 4920.484184] [<f8dd138d>] ? dvb_usb_device_exit+0x3a/0x4a [dvb_usb]
[ 4920.484217] [<f7fe1b08>] ? usb_unbind_interface+0x3f/0xb4 [usbcore]
[ 4920.484227] [<c11a4178>] ? __device_release_driver+0x74/0xb7
[ 4920.484233] [<c11a4247>] ? device_release_driver+0x15/0x1e
[ 4920.484243] [<c11a3a33>] ? bus_remove_device+0x6e/0x87
[ 4920.484249] [<c11a26d6>] ? device_del+0xfa/0x152
[ 4920.484264] [<f7fdf609>] ? usb_disable_device+0x59/0xb9 [usbcore]
[ 4920.484279] [<f7fdb9ee>] ? usb_disconnect+0x70/0xdc [usbcore]
[ 4920.484294] [<f7fdc728>] ? hub_thread+0x521/0xe1d [usbcore]
[ 4920.484301] [<c1044412>] ? autoremove_wake_function+0x0/0x2d
[ 4920.484316] [<f7fdc207>] ? hub_thread+0x0/0xe1d [usbcore]
[ 4920.484321] [<c10441e0>] ? kthread+0x61/0x66
[ 4920.484327] [<c104417f>] ? kthread+0x0/0x66
[ 4920.484336] [<c1003d47>] ? kernel_thread_helper+0x7/0x10

If there are users (for example users == -2) :
- dvb_unregister_frontend :
- stop kernel thread with dvb_frontend_stop :
- fepriv->exit = 1;
- thread loop catch stop event and break while loop
- fepriv->thread = NULL; and fepriv->exit = 0;
- dvb_unregister_frontend wait on "fepriv->dvbdev->wait_queue" that fepriv->dvbdev->users==-1.
The user finish :
- dvb_frontend_release - set users to -1
- don't wait wait_queue because fepriv->exit != 1

=> dvb_unregister_frontend never exit the wait queue.

Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
16ef8def80ea97c3cacdcaa765bdf62b2d94f86d 27-Apr-2010 Arnd Bergmann <arnd@arndb.de> dvb: Push down BKL into ioctl functions

This requires changing all users of dvb_usercopy to
omit the inode argument.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
6e3924aa8dad3ac7d5cbfb4e27b6cdd2dc7b7e68 16-Jan-2010 Thiago Farina <tfransosi@gmail.com> V4L/DVB: dvb-core: remove unnecessary casting of kmalloc

drivers/media/dvb/dvb-core/dvb_frontend.c | 6 ++----

Signed-off-by: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
fb8253baa0852bb628b6f4fed1ed0b8ae20e4e3c 31-Dec-2009 Mauro Carvalho Chehab <mchehab@redhat.com> V4L/DVB (13879): dvb_frontend: report what ioctl were called on debug mode

When printing that an iocl were called, report the ioctl number.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
639544d78c430fef875f3bb31083a60f3e2e0344 31-Dec-2009 Mauro Carvalho Chehab <mchehab@redhat.com> V4L/DVB (13878): dvb_frontend: Print dump on get after filling the data

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
06d3a396b26e48012ce0f2ee21b1fdff092d8d4a 24-Oct-2009 Mauro Carvalho Chehab <mchehab@redhat.com> V4L/DVB (13157): dvb_frontend: represent all DVBS2API commands via macro

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
9133aee09e3689c116c526fa9011c33b872e65c1 23-May-2009 Michael Krufky <mkrufky@kernellabs.com> V4L/DVB (13103): create a standard method for dvb adapter drivers to override frontend ioctls

Signed-off-by: Michael Krufky <mkrufky@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
4c4cb1b1605e50983afd7924980c9434b214599f 01-Dec-2009 Andrew Morton <akpm@linux-foundation.org> drivers/media/dvb/dvb-core/dvb_frontend.c: needs semaphore.h

Fixes:

v4l/dvb_frontend.c: In function 'dvb_frontend_stop':
v4l/dvb_frontend.c:707: error: implicit declaration of function 'init_MUTEX'

Addresses http://bugzilla.kernel.org/show_bug.cgi?id=14609

Reported-by: <tstrelar@gmail.com>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
98293ef3e54f9f2175f11b4d14c119a2ff753d61 18-Sep-2009 HIRANO Takahito <hiranotaka@zng.info> V4L/DVB (12997): Add the DTV_ISDB_TS_ID property for ISDB_S

In ISDB-S, time-devision duplex is used to multiplexing several waves
in the same frequency. Each wave is identified by its own transport
stream ID, or TS ID. We need to provide some way to specify this ID
from user applications to handle ISDB-S frontends.

This code has been tested with the Earthsoft PT1 driver.

[mchehab@infradead.org: Fix merge conflicts with isdbt and rename the new parameter to DTV_ISDBS_TS_ID]
Signed-off-by: HIRANO Takahito <hiranotaka@zng.info>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
e7b7949a95441affe937fa25f4d6d8f3df0ca271 14-Aug-2009 Patrick Boettcher <pboettcher@dibcom.fr> V4L/DVB (12896): ISDB-T: add mapping of LAYER_ENABLED to frontend-cache

It was forgotten to map the LAYER_ENABLED ioctl to the frontend-cache and back.

Signed-off-by: Patrick Boettcher <pboettcher@dibcom.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
b6e760f3097501e60e76fbcb7a313d42da930c1f 03-Aug-2009 Patrick Boettcher <pboettcher@dibcom.fr> V4L/DVB (12892): DVB-API: add support for ISDB-T and ISDB-Tsb (version 5.1)

This patch increments the DVB-API to version 5.1 in order to reflect the addition of ISDB-T and ISDB-Tsb on Linux' DVB-API.

Changes in detail:
- added a small document to describe how to use the API to tune to an ISDB-T or ISDB-Tsb channel
- added necessary fields to dtv_frontend_cache
- added a smarter clear-cache function which resets all fields of the dtv_frontend_cache
- added a TRANSMISSION_MODE_4K to fe_transmit_mode_t

Signed-off-by: Olivier Grenie <olgrenie@dibcom.fr>
Signed-off-by: Patrick Boettcher <pboettcher@dibcom.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
f51fad85af7b296b56031747c873c309b24ff77c 02-Sep-2009 Janne Grunau <j@jannau.net> V4L/DVB (12686): dvb-core: check supported QAM modulations

Check the modulation in dvb_frontend_check_parameters against
frontend's capabilties for FE_QAM devices.

Signed-off-by: Janne Grunau <j@jannau.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
01886255ddf440eb21d3388bfc5343c966904d0e 02-Sep-2009 Janne Grunau <j@jannau.net> V4L/DVB (12685): dvb-core: check fe->ops.set_frontend return value

Various frontend driver have parameter checks in their set_frontend
functions and return an error if the parameters are not supported,
tda10021 and cx24116 to name two.

The tuning ioctls FE_SET_FRONTEND/FE_SET_PROPERTY only change values
in the property cache and return before set_frontend is called. If a
set_frontend call in software zigzag algorithm fails and the card was
previously locked it will report a lock and the new parameters but is
still tuned to the old transport. This is not detectable from
userspace.

This change checks the return values of fe->ops.set_frontend and
changes the state to the added FESTATE_ERROR for software zigzag.
No lock will be reported to userspace if the State is FESTATE_ERROR.

Signed-off-by: Janne Grunau <j@jannau.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
a5beb7b32364a236e833631c3ee5c910cbbfa5bb 21-May-2009 Devin Heitmueller <dheitmueller@kernellabs.com> V4L/DVB (11875): dvb_frontend: fix case where fepriv->exit not reset

The fact that we now explicitly set fepriv->exit = 1 when the thread is
shutting down exposed an edge case where it was not being reset back to zero
once the thread went away in some cases. This resulted in failures in cases
where the frontend was closed, and then opened O_RDONLY, since in that case
the thread is not being restarted but it was checking the fepriv->exit flag.

Thanks to Thierry Lelegard, who and encountered and debugged a large portion
of the issue in the same twelve hours that I did (as well as testing my patch).

Cc: Thierry Lelegard <thierry.lelegard@tv-numeric.com>
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
57594a586f3353286d64c30f397494a834cac238 05-May-2009 Devin Heitmueller <dheitmueller@kernellabs.com> V4L/DVB (11785): dvb_frontend: fix race condition resulting in dropped tuning commands

A race condition was detected in the case that putting the tuner to sleep takes
an unusually long period of time, combined with applications that quickly
close/open the dvb frontend.

The kaffeine channel scanner closes and reopens the dvb frontend between each
tuning attempt. If it takes an unusually longer period of time to put the
tuner to sleep (for example, the Pinnacle 801e takes 660 ms), the dvb_frontend
thread will still be in a running state (and hence fepriv->thread is still set)
but the fepriv->exit field will still be zero. As a result, if a
dvb_frontend_start() call arrives while the frontend thread is in the process
of terminating, the call will return 0 without actually starting a new thread.
This results in the tuning request being dropped.

To address this, mark fepriv->exit as soon as we know the thread is going to
be terminated, so that dvb_frontend_start() knows to start a new instance.

Problem encountered with Kaffeine 0.8.7 doing ATSC scanning against the
Pinnacle 801e tuner, in conjunction with new code to power down the xc5000
when not in use.

Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
784e29d2031b535637f65a8b81fb0871c7c51b3f 11-Jan-2009 Jan Engelhardt <jengelh@medozas.de> V4L/DVB (10391): dvb: constify VFTs

dvb: constify VFTs

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
1d06059c13fc64b67027334507f734ec0f2f4b6c 09-Nov-2008 Igor M. Liplianin <liplianin@me.by> V4L/DVB (10976): Bug fix: For legacy applications stv0899 performs search only first time after insmod.

For legacy applications stv0899 performs search only first time after insmod
due to not set DVBFE_ALGO_SEARCH_AGAIN bit

Signed-off-by: Igor M. Liplianin <liplianin@me.by>
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
072ce0c50983033d35c63314e2be849568f116c2 05-Jan-2009 Mauro Carvalho Chehab <mchehab@redhat.com> V4L/DVB (10178): dvb_frontend: Fix some sparse warnings due to static symbols

/home/v4l/master/v4l/dvb_frontend.c:838:19: warning: symbol 'dtv_cmds' was not declared. Should it be static?
/home/v4l/master/v4l/dvb_frontend.c:1035:6: warning: symbol 'dtv_property_dump' was not declared. Should it be static?
/home/v4l/master/v4l/dvb_frontend.c:1066:5: warning: symbol 'is_legacy_delivery_system' was not declared. Should it be static?
/home/v4l/master/v4l/dvb_frontend.c:1080:6: warning: symbol 'dtv_property_cache_sync' was not declared. Should it be static?
/home/v4l/master/v4l/dvb_frontend.c:1132:6: warning: symbol 'dtv_property_legacy_params_sync' was not declared. Should it be static?
/home/v4l/master/v4l/dvb_frontend.c:1187:6: warning: symbol 'dtv_property_adv_params_sync' was not declared. Should it be static?
/home/v4l/master/v4l/dvb_frontend.c:1222:6: warning: symbol 'dtv_property_cache_submit' was not declared. Should it be static?
/home/v4l/master/v4l/dvb_frontend.c:1253:5: warning: symbol 'dtv_property_process_get' was not declared. Should it be static?
/home/v4l/master/v4l/dvb_frontend.c:1362:5: warning: symbol 'dtv_property_process_set' was not declared. Should it be static?

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2fac9a0f44d1950abb0e16f5d43f88866962ca3c 18-Dec-2008 Darron Broad <darron@kewl.org> V4L/DVB (9916): dvb-core: don't add an event when in ONE SHOT mode for algo type HW

It has been noticed that in HW tuning mode in cx24123.c that
a check is made to not alter the status var when in one shot
mode, a simpler solution is to not update here for all cards.

Cc: Steven Toth <stoth@hauppauge.com>
Signed-off-by: Darron Broad <darron@kewl.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
9962ac5331d79362cc538f2da257c0663fb609e1 30-Oct-2008 Marco Schluessler <marco@lordzodiac.de> V4L/DVB (9480): Fix frontend DVBFE_ALGO_CUSTOM Search

Issue: Currently, the DVBFE_ALGO_CUSTOM is called only at the first tuning.
After the first call, the status is never set to force a new tuning.

Signed-off-by: Marco Schluessler <marco@lordzodiac.de>
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
f04c3ca8a2677816af1c0ae7170c2e56ac5d7042 28-Oct-2008 Manu Abraham <abraham.manu@gmail.com> V4L/DVB (9478): Fix: parameters not supplied in the search process

Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
f7c9bf96ad3f65e80762c190be6aad6b2ce997f6 28-Oct-2008 Matthias Schwarzott <zzam@gentoo.org> V4L/DVB (9477): Fix: Commit 9344 breaks tning of cx24123

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
7bcbdf386bdc2ea2bcd916a7b972ad7bca14db04 20-Oct-2008 Arvo Jarve <arvo@softshark.ee> V4L/DVB (9345): Add event with changed status only

Signed-off-by: Arvo Jarve <arvo@softshark.ee>
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
c59e7870fddbbc232221f92fb24958c605be404c 14-Oct-2008 Manu Abraham <abraham.manu@gmail.com> V4L/DVB (9344): DVB-Core update

Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
41286d972530b7a47acb48376d714b6b121a6c22 16-Nov-2008 Devin Heitmueller <devin.heitmueller@gmail.com> V4L/DVB (9634): Make sure the i2c gate is open before powering down tuner

It is not safe to assume that the i2c gate will be open before issuing the
command to power down the tuner. In fact, many demods only open the gate
long enough to issue the tuning command.

This fix allows power management to work properly for those tuners behind an
i2c gate (in my case the problem was with the HVR-950Q)

Signed-off-by: Devin Heitmueller <devin.heitmueller@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
3fa37deb1a287e100c7db5b4f964784fd664bee9 16-Nov-2008 Devin Heitmueller <devin.heitmueller@gmail.com> V4L/DVB (9631): Make s2api work for ATSC support

ATSC should be considered a legacy delivery system, or else fields such as
p->u.vsb.modulation do not get populated (resulting in set_frontend failures)

Cc: Steven Toth <stoth@linuxtv.org>
Signed-off-by: Devin Heitmueller <devin.heitmueller@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
3b37a15c2d75585cc0da49b8e69345af91e227ce 20-Oct-2008 Manu Abraham <abraham.manu@gmail.com> V4L/DVB (9346): Optimization: Enable gate in a symmetric/disciplined way,

rather than implementing different ways leading to confusion.

This allows multiple gate_enable/disable's in the tuner_read/write
functions, thereby lesser number of I/O operations throughout,
eventually leading to better results. As a side effect demods that
detect the STOP bit for auto closing of the gate can be avoided, thereby
a very minimal gain in disabling the auto detect feature as well.
Improves readability on the device control.

Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
a1bc84c083af059cb93d57c9caff7b382fe8b574 17-Oct-2008 Steven Toth <stoth@linuxtv.org> V4L/DVB (9274): Remove spurious messages and turn into debug.

Remove spurious messages and turn into debug.

Signed-off-by: Steven Toth <stoth@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
6594690b39f9f9fcadafb1caf019bfd7a326e2e5 15-Oct-2008 Darron Broad <darron@kewl.org> V4L/DVB (9264): MFE: bugfix: multi-frontend mutual exclusion parallel open

When moving from one frontend to another
an application could spawn multiple threads opening
the same new frontend and in some circumstances all of
these could become delayed waiting for the previous
frontend readers or previous frontend writer thread to
complete.

In this scenario the first thread will succeed on open
to bring the new frontend online but any others will return
EBUSY. This is a fault. If the first succeeds and all others
are on the same frontend then they should succeed also.

Signed-off-by: Darron Broad <darron@kewl.org>
Signed-off-by: Steven Toth <stoth@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
59b1842da1c6f33ad2e8da82d3dfb3445751d964 11-Oct-2008 Darron Broad <darron@kewl.org> V4L/DVB (9227): MFE: Add multi-frontend mutual exclusion

This add frontend R/W mutual exclusion.
Prior to this point in time it was possible to open both
frontends simultaneously which an MFE card cannot support.

In order to stop this, a delayed open is performed which
has the following function:

- Return EBUSY after a configurable amount of time
if a frontend is unavailable due to the other being
in use.

- Only allow opening of a frontend if the kernel thread
of the other has stopped.

This solution was chosen to allow switching between
frontends to work as seamlessly as possible. When both
frontends are actually opened simultaneously then one
will only open, but if quick switching is performed
between one of many then the new open will succeed in
a clean fashion rather than interrupting a kernel
thread.

Signed-off-by: Darron Broad <darron@kewl.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
363c35fc448943c3d6121332d28bcda2d2fbf87c 11-Oct-2008 Steven Toth <stoth@linuxtv.org> V4L/DVB (9222): S2API: Add Multiple-frontend on a single adapter support.

A detailed description from the original patches 2 years ago:

"The WinTV-HVR3000 has a single transport bus which is shared between
a DVB-T and DVB-S modulator. These patches build on the bus acquisition
cx88 work from a few weeks ago to add support for this.

So to applications the HVR3000 looks like this:
/dev/dvb/adapter0/fe0 (cx24123 DVB-S demod)
/dev/dvb/adapter0/fe1 (cx22702 DVB-T demod)

Additional boards continue as before, eg:
/dev/dvb/adapter1/fe0 (lgdt3302 ATSC demod)

The basic change is removing the single instance of the videobuf_dvb in
cx8802_dev and saa7134_dev(?) and replacing it with a list and some
supporting functions.

*NOTE* This branch was taken before v4l-dvb was closed for 2.6.19 so
two or three current cx88 patches appear to be reversed by this tree,
this will be cleaned up in the near future. The patches missing change
the mutex handing to core->lock, fix an enumeration problem."

It should be recognised that a number of people have been maintaining
this patchset. Significant levels of Kudos to everyone one involved,
including but not limited to:

Darron Broad
Fabio M. Di Nitto
Carlo Scarfoglio
Hans Werner

Without the work of these people, and countless others, my two year old
patches would of died on the Mercurial linuxtv.org vine a long time
ago.

TODO: Revise these patches a little further so that the need for
demux1 and dvr0 is optional, not mandatory on the HVR3000.

HISTORY (darron):
This is the last update to MFE prepared by Hans which is based
upon the `scratchpad' diff created by Carlo.
All MFE work prior to that point must be attributed to Fabio
who ported and maintained Steve's original patch up to that
time.

Signed-off-by: Steven Toth <stoth@linuxtv.org>
Signed-off-by: Darron Broad <darron@kewl.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
97854829b97093ae172144a2597fc49ea203dcf3 15-Oct-2008 Manu Abraham <abraham.manu@gmail.com> V4L/DVB (9195): Frontend API Fix: 32APSK is a valid modulation for the DVB-S2 delivery

Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
6068f5063850984fe6c2490bc8384a7afa2728dc 07-Oct-2008 Steven Toth <stoth@linuxtv.org> V4L/DVB (9183): S2API: Return error of the caller provides 0 commands.

S2API: Return error of the caller provides 0 commands.

Signed-off-by: Steven Toth <stoth@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
ef526f4246f566370218bb6e639f7549244ca5a2 07-Oct-2008 Steven Toth <stoth@linuxtv.org> V4L/DVB (9182): S2API: Added support for DTV_HIERARCHY

A user tuning DVB-T via the S2API reports that this was not implemented,
and his tuning was failing.

Signed-off-by: Steven Toth <stoth@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
b87625f0ccbbc67efba356e73502fa9bbb784b1c 07-Oct-2008 Steven Toth <stoth@linuxtv.org> V4L/DVB (9181): S2API: Add support fot DTV_GUARD_INTERVAL and DTV_TRANSMISSION_MODE

Tuning DVB-T via the S2API was failing, missing some essential items.

Signed-off-by: Steven Toth <stoth@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
a4de91be46b73ec6743b9d76155550e49507723c 07-Oct-2008 Steven Toth <stoth@linuxtv.org> V4L/DVB (9180): S2API: Added support for DTV_CODE_RATE_HP/LP

Reports from users that using the new API for tuning DTV was failing,
and the cache was missing some essential items.

Signed-off-by: Steven Toth <stoth@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
0a6393ae21d58e85882185ce1e6b0fe28ff2dfa6 07-Oct-2008 Steven Toth <stoth@linuxtv.org> V4L/DVB (9177): S2API: Change _8PSK / _16APSK to PSK_8 and APSK_16

... and cleanup any drivers using them.
I've also removed NBC_QPSK and modified the cx24116 driver to check
the delivery_type also, removing some excess namespace baggage.

Signed-off-by: Steven Toth <stoth@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
82d7669dc3c0e795c24111fed88e9d5d70f209e0 07-Oct-2008 Steven Toth <stoth@linuxtv.org> V4L/DVB (9173): S2API: Remove the hardcoded command limit during validation

This means that when developers add new commands then they'll be see
the DTV_MAX_COMMAND define and will be more likely to modify it, without
having to modify the command validation code.

Signed-off-by: Steven Toth <stoth@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
e5cefa82ce31b14574947e570d638a6d58225338 03-Oct-2008 Darron Broad <darron@kewl.org> V4L/DVB (9172): S2API: Bugfix related to DVB-S / DVB-S2 tuning for the legacy API.

Fixes switching from S2API to legacy where legacy params given to S2API
aware demods are cached ones and not those implied in the legacy API.

It was found (on an S2API aware demod at least) that after using
an S2API aware application and then switching to a legacy application
that prior S2API params were in effect were legacy has only
implied values. This fixes this.

Signed-off-by: Darron Broad <darron@kewl.org>
Signed-off-by: Steven Toth <stoth@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
4aae8efb4908fa3f80dc1177d093443bc09adf5f 03-Oct-2008 Darron Broad <darron@kewl.org> V4L/DVB (9171): S2API: Stop an OOPS if illegal commands are dumped in S2API.

Quick fix to stop an OOPS if illegal commands are dumped in S2API.

Signed-off-by: Darron Broad <darron@kewl.org>
Signed-off-by: Steven Toth <stoth@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
eacf8d8d6bc6798f6870a2cf2c159bfcde3759ac 26-Sep-2008 Steven Toth <stoth@linuxtv.org> V4L/DVB (9072): S2API: Add DTV_API_VERSION command

This allows application developers to query the dvb-core API version
dynamically, helping developers understand whether certain features
will be available.

Signed-off-by: Steven Toth <stoth@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
d48cb402a1ba48c4ad4a36c3c561386027318459 26-Sep-2008 Steven Toth <stoth@linuxtv.org> V4L/DVB (9071): S2API: Implement result codes for individual commands

This allows application developers to determine which particular
command in a sequence is invalid, or failing with error.

Signed-off-by: Steven Toth <stoth@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
8316568930074723bdc47d6777f822be0422a5b7 24-Sep-2008 Steven Toth <stoth@linuxtv.org> V4L/DVB (9025): S2API: Deactivate the ISDB-T definitions

We don't want to push the ISDB-T definitions into the kernel until
we have a high level of confidence in the ISDB-T API. More testing
is required before this code is released.

Signed-off-by: Steven Toth <stoth@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
1d78cac4779be3ae6bef4791b3b12928e2499fef 13-Sep-2008 Steven Toth <stoth@linuxtv.org> V4L/DVB (9008): S2API: Bugfix related to syncing the cache when used with the old API.

Many thanks to Darron Broad for pointing out the obvious.

Signed-off-by: Steven Toth <stoth@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
75b7f9437b1cf63750bb58efaaeb6d72d04b3c7f 13-Sep-2008 Steven Toth <stoth@linuxtv.org> V4L/DVB (9007): S2API: Changed bandwidth to be expressed in HZ

Also added some compat code for the older API.

Added more ISDB message/command suggestions, current not connected in dvb-core.

Signed-off-by: Steven Toth <stoth@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
4dd88bec368a6e4caa86a511f7adbc4c08992c5c 13-Sep-2008 Steven Toth <stoth@linuxtv.org> V4L/DVB (9006): S2API: Allow reliable use of old and new api on the same frontend, regardless.

Signed-off-by: Steven Toth <stoth@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
e6f9ec86575358309cf9d4b2643df2f3b1f6f9fa 12-Sep-2008 Igor M. Liplianin <liplianin@me.by> V4L/DVB (9005): Bug fix: ioctl FE_SET_PROPERTY/FE_GET_PROPERTY always return error

Bug fix: ioctl FE_SET_PROPERTY/FE_GET_PROPERTY always return error

Signed-off-by: Igor M. Liplianin <liplianin@me.by>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
bfbf2dae30ed75bceccc6a88d2d9368694d6bf40 12-Sep-2008 Steven Toth <stoth@linuxtv.org> V4L/DVB (9004): S2API: Implement GET/SET handing to the demods

The frontends will be notified (if they chose) of all _get and _set commands
so they can help determine result or action. Results are now returned
to userspace correctly.

Signed-off-by: Steven Toth <stoth@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
363429a089590f3f4071ebc492b3712fdcba770b 12-Sep-2008 Steven Toth <stoth@linuxtv.org> V4L/DVB (9003): S2API: Remove the DTV_SET_ and DTV_GET_ prefixes

The API now assumes that ioctl calls for FE_SET_PROPERTY and all
set commands, and FE_GET_PROPERTY are get commands.

Simplification.

Signed-off-by: Steven Toth <stoth@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
80a773c9bcc6f67944e186de3d2ab8b582889bc8 12-Sep-2008 Steven Toth <stoth@linuxtv.org> V4L/DVB (9002): S2API: Ensure cache->delivery_system is set at all times.

This helps complex demods which support different modulation types
be better informed.

Signed-off-by: Steven Toth <stoth@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
d7c1500183bc138b634377ed90c046e722b887d8 12-Sep-2008 Steven Toth <stoth@linuxtv.org> V4L/DVB (9001): S2API: ISDBT_SEGMENT_NUM -> ISDBT_SEGMENT_IDX

Signed-off-by: Steven Toth <stoth@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
d5748f1079c01c8861b05e0de7c4cda271532cb9 12-Sep-2008 Steven Toth <stoth@linuxtv.org> V4L/DVB (9000): S2API: Cleanup code that prepares tuning structures.

Signed-off-by: Steven Toth <stoth@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
ee33c525c4d09756156cd4c18e6586da900eb310 12-Sep-2008 Steven Toth <stoth@linuxtv.org> V4L/DVB (8999): S2API: Reduce demod driver complexity by using a cache sync

For demod drivers, we want a single tuning function (set_frontend) to have
access to the properly constructed dvb_frontend_parameters structure, or
the cache values - regardless of whether the legacy or new API is being used.

This cuts down on redundant code in the demod drivers and ensures the
tuning parameters are consistent regardless of the API entry type.

Signed-off-by: Steven Toth <stoth@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
177b868d93861077619261dcecd0147d1c033026 11-Sep-2008 Steven Toth <stoth@linuxtv.org> V4L/DVB (8997): S2API: Cleanup SYMBOLRATE, INNERFEC -> SYMBOL_RATE, INNER_FEC

This is now consistent with the existing API.

Signed-off-by: Steven Toth <stoth@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
e7fee0f3aa111d42cdcfc1470cfdc21dde0cdbe2 11-Sep-2008 Steven Toth <stoth@linuxtv.org> V4L/DVB (8996): S2API: typedefs replaced, _SEQ_'s removed, fixed 16 command arrays replaced

After discussion the following changes were made:
1. Removed the typedefs in frontend.h, use structures.
2. In the frontend.h, remove the 16 command limit on the API and
switch to a flexible variable length API. For practical reasons
a #define limits this to 64, this should be discussed.
3. Changed dvb-core ioctl handing to deal with variable sequences
of commands.

tune-v0.0.3.c is required to use this API, it contains the interface changes.

Signed-off-by: Steven Toth <stoth@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
56f0680a28397f4b412fc14f60ac380b910ee328 11-Sep-2008 Steven Toth <stoth@linuxtv.org> V4L/DVB (8995): S2API: tv_ / TV_ to dtv_ / DTV_ namespace changes

The group preferred dtv_ over tv_, this implements it.

Signed-off-by: Steven Toth <stoth@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2cf801e3e38f649d25fe3b4e236976f45e26289f 08-Sep-2008 Steven Toth <stoth@linuxtv.org> V4L/DVB (8990): S2API: DVB-S/S2 voltage selection bug fix

Thanks to Hans Werner for finding the problem.

Signed-off-by: Steven Toth <stoth@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
13c97bf56724b4f2d3dac139fb4cb081a3c401dc 05-Sep-2008 Steven Toth <stoth@linuxtv.org> V4L/DVB (8988): S2API: Allow the properties to call legacy ioctls

SET_TONE and SET_VOLTAGE were not previously implemented. Two options
existed. Either cut/paste from the previous ioctl handler into the
process_properties function, which is code duplication. Or, split
the current ioctl handler into it's two major pieces.

Piece 1, responsible for input validation and semaphore acquiring
Piece 2 the processing of the previous ioctls

and finally, a new third pieces where the array of properties
is processed, and can freely call the legacy ioctl handler without
having to re-acquire the fepriv->sem semaphore. This is a clean approach
and ensures the existing legacy ioctls are processed as they were previously
(but with an extra function call) and allows the new API to share code
without duplication.

Signed-off-by: Steven Toth <stoth@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
6b73eeafbc856c0cef7166242f0e55403407f355 04-Sep-2008 Steven Toth <stoth@linuxtv.org> V4L/DVB (8985): S2API: Added dvb frontend changes to support a newer tuning API

This is an experimental patch to add a new tuning mechanism for
dvb frontends. Rather than passing fixed structures across the
user/kernel boundary, which need to be revised for each new modulation
type (or feature the kernel developers want to add), this implements
a simpler message based approach, allowing fe commands to be broken
down into a series of small fixed size transactions, presented
in an array.

The goal is to avoid changing the user/kernel ABI in the future, by
simply creating new frontend commands (and sequencies of commands) that
help us add support for brand new demodulator, delivery system or
statistics related commmands.

known issues:
checkpatch voilations
feedback from various developers yet to be implemented, relating
to namespace conventions, variable length array passing conventions,
and generally some optimization.

This patch should support all existing tuning mechanisms through the
new API, as well as adding 8PSK, DVB-S2 NBC-QPSK and ISDB-T API support.

For testing and exercise purposes, see the latest tune.c tool
available from http://www.steventoth.net/linux/s2

Signed-off-by: Steven Toth <stoth@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
c6eb8eafdba4ad18b4520a0d28a38bc9e61883ea 03-Sep-2008 Hans Verkuil <hverkuil@xs4all.nl> 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>
149ef72deeba57078216c9fa678baff392295853 30-Apr-2008 Mauro Carvalho Chehab <mchehab@infradead.org> Rename common tuner Kconfig names to use the same
namespace for all of them.
46b4f7c176a2dd4c60ddb7c80bd09ea2f3220674 09-Apr-2008 Harvey Harrison <harvey.harrison@gmail.com> V4L/DVB (7512): media/dvb/dvb-core replace remaining __FUNCTION__ occurrences

__FUNCTION__ is gcc-specific, use __func__

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Acked-by: Oliver Endriss <o.endriss@gmx.de>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2426a27e4d25cf932ce73aa84a085ee94b4189a8 21-Dec-2007 Michael Krufky <mkrufky@linuxtv.org> V4L/DVB (6882): dvb_frontend: release analog demod in dvb_frontend_detach

Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
e42837bcd35b75bb59ae5d3e62f87be1aeeb05c3 18-Oct-2007 Rafael J. Wysocki <rjw@sisk.pl> freezer: introduce freezer-friendly waiting macros

Introduce freezer-friendly wrappers around wait_event_interruptible() and
wait_event_interruptible_timeout(), originally defined in <linux/wait.h>, to
be used in freezable kernel threads. Make some of the freezable kernel
threads use them.

This is necessary for the freezer to stop sending signals to kernel threads,
which is implemented in the next patch.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Cc: Nigel Cunningham <nigel@nigel.suspend2.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
608f62d6ffbc21067e8b9a09f887a5d6cbfe7617 25-Aug-2007 Oliver Endriss <o.endriss@gmx.de> V4L/DVB (6107): dvb_frontend: clean-up shutdown handling

Now dvb_powerdown_on_sleep controls whether
- whether LNB power is turned off
- whether the tuner/frontend enters sleep mode

Signed-off-by: Oliver Endriss <o.endriss@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
849be2cdf11eef830ec2a3f916c8e7d1e51bc9fb 25-Aug-2007 Oliver Endriss <o.endriss@gmx.de> V4L/DVB (6106): dvb_frontend: Default for dvb_shutdown_timeout set to 0

Default for dvb_shutdown_timeout set to 0.
dvb_shutdown_timeout > 0 is used for debugging only.

Signed-off-by: Oliver Endriss <o.endriss@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
48136e1e93195b56dc3d9b0730917241b3365633 25-Aug-2007 Oliver Endriss <o.endriss@gmx.de> V4L/DVB (6105): dvb_frontend: ts_bus_ctrl() handling fixed

ts_bus_ctrl() should only be called by
- the first open
- the last release call.

Signed-off-by: Oliver Endriss <o.endriss@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
9c12224a607a4b22ab86784e3394b52810b9507c 21-Aug-2007 Mauro Carvalho Chehab <mchehab@infradead.org> V4L/DVB (6079): Cleanup: remove linux/moduleparam.h from drivers/media files

Since at least kernel 2.6.12-rc2, module.h includes moduleparm.h. This
patch removes all occurences of moduleparm.h from drivers/media files.

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
c471b331dda9fdfaf67832998d0b2c848777ab4a 09-Aug-2007 Oliver Endriss <o.endriss@gmx.de> V4L/DVB (5986): dvb_frontend: Fixed GET_INFO ioctl and check of frequency limits

The calculation of frequency limits ignored tuner-specific frequency limits.
Range checks and GET_INFO ioctl updated accordingly.

Signed-off-by: Oliver Endriss <o.endriss@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
813ce47cee33964ff710d2c91063548773cb4cd5 01-Aug-2007 Adrian Bunk <bunk@stusta.de> V4L/DVB (5965): Frontend_ioctl(): fix check-after-use

The Coverity checker spotted that we have already oops'ed if "fe" was NULL.

Since "fe" being NULL seems impossible at this point this patch removes
the NULL check.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Acked-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
03b7612336560c6799852acaaaeac70e1f00e483 30-Jul-2007 Matthias Kaehlcke <matthias.kaehlcke@gmail.com> V4L/DVB (5946): Use mutex instead of semaphore in the DVB frontend tuning interface

The DVB frontend tuning interface uses a semaphore as mutex. Use the
mutex API instead of the (binary) semaphore.

Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
1fab46f0decd226fcbae73b23d7f8ed478416fbb 24-Jul-2007 Oliver Endriss <o.endriss@gmx.de> V4L/DVB (5935): dvb_frontend: Range check of frequency and symbol rate

Add range check of frequency and symbol rate to the FE_SET_FRONTEND ioctl.

This will also avoid a divide-by zero exception in the stv0297 driver,
if symbol rate is set to 0.

Signed-off-by: Oliver Endriss <o.endriss@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
831441862956fffa17b9801db37e6ea1650b0f69 17-Jul-2007 Rafael J. Wysocki <rjw@sisk.pl> Freezer: make kernel threads nonfreezable by default

Currently, the freezer treats all tasks as freezable, except for the kernel
threads that explicitly set the PF_NOFREEZE flag for themselves. This
approach is problematic, since it requires every kernel thread to either
set PF_NOFREEZE explicitly, or call try_to_freeze(), even if it doesn't
care for the freezing of tasks at all.

It seems better to only require the kernel threads that want to or need to
be frozen to use some freezer-related code and to remove any
freezer-related code from the other (nonfreezable) kernel threads, which is
done in this patch.

The patch causes all kernel threads to be nonfreezable by default (ie. to
have PF_NOFREEZE set by default) and introduces the set_freezable()
function that should be called by the freezable kernel threads in order to
unset PF_NOFREEZE. It also makes all of the currently freezable kernel
threads call set_freezable(), so it shouldn't cause any (intentional)
change of behaviour to appear. Additionally, it updates documentation to
describe the freezing of tasks more accurately.

[akpm@linux-foundation.org: build fixes]
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Nigel Cunningham <nigel@nigel.suspend2.net>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Gautham R Shenoy <ego@in.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
57861b432bda77f8bfafda2fb6f5a922d5f3aef1 14-Apr-2007 Markus Rechberger <markus.rechberger@amd.com> V4L/DVB (5511): Fix 2/3 for bug 7819: demux and dvr

fixing hotplug issue for demux[n] and dvr[n]

Signed-off-by: Michal CIJOML Semler <cijoml@volny.cz>
Signed-off-by: Markus Rechberger <markus.rechberger@amd.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
ca5be9cd0516629cb8ee335b7dad076e66d72a22 14-Apr-2007 Markus Rechberger <markus.rechberger@amd.com> V4L/DVB (5510): Fix 1/3 for bug 7819: fixed frontend hotplug issue

fixed frontend hotplug issue

Signed-off-by: Michal CIJOML Semler <cijoml@volny.cz>
Signed-off-by: Markus Rechberger <markus.rechberger@amd.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
6591691b259f9487f374f35c0c310aa220f829c6 08-Feb-2007 akpm@linux-foundation.org <akpm@linux-foundation.org> V4L/DVB (5209): Kthread api conversion for dvb_frontend and av7110 fix

avoid double-up(), pointed out by Oliver.

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Oliver Endriss <o.endriss@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
8eec14295e03f9dfe2be7bb75c8004a5fa867cdb 08-Feb-2007 Herbert Poetzl <herbert@13thfloor.at> V4L/DVB (5208): Kthread API conversion for dvb_frontend and av7110

dvb kernel_thread to kthread API port.
It is running fine here, including module load/unload and software suspend
(which doesn't work as expected with or without this patch :).
I didn't convert the dvb_ca_en50221 as I do not have such an interface, but
if the conversion process is fine with the v4l-dvb maintainers, it should not
be a problem to send a patch for that too ...
Acked-by: Oliver Endriss <o.endriss@gmx.de>

Signed-off-by: Herbert Poetzl <herbert@13thfloor.at>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Oliver Endriss <o.endriss@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
1b3c3714cb4767d00f507cc6854d3339d82c5b9d 17-Feb-2007 Uwe Kleine-König <zeisberg@informatik.uni-freiburg.de> Fix typos concerning hierarchy

heirarchical, hierachical -> hierarchical
heirarchy, hierachy -> hierarchy

Signed-off-by: Uwe Kleine-König <zeisberg@informatik.uni-freiburg.de>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
7dfb71030f7636a0d65200158113c37764552f93 07-Dec-2006 Nigel Cunningham <ncunningham@linuxmail.org> [PATCH] Add include/linux/freezer.h and move definitions from sched.h

Move process freezing functions from include/linux/sched.h to freezer.h, so
that modifications to the freezer or the kernel configuration don't require
recompiling just about everything.

[akpm@osdl.org: fix ueagle driver]
Signed-off-by: Nigel Cunningham <nigel@suspend2.net>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
30d9464c76743160612e7de0b2f5f656c78915d3 17-Nov-2006 Andrew de Quincey <adq_dvb@lidskialf.net> V4L/DVB (4832): Fix uninitialised variable in dvb_frontend_swzigzag

Spotted by coverity/Adrian Bunk.

Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
ba7e6f3e3e639de2597afffaae3fda75f6e6082d 25-Sep-2006 Steven Toth <stoth@hauppauge.com> V4L/DVB (4665): Add frontend structure callback for bus acquisition.

This patch enables generic bus arbitration callbacks enabling
dvbcore frontend_open and frontend_release to pass 'acquire'
and 'release' hardware messages back into the DVB bridge frameworks.
Frameworks like cx88 can then implement single bus multiple demod
card sharing features, which would prohibit two frontends from attempting
to use a single transport bus at the same time.

Signed-off-by: Steven Toth <stoth@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
7df0994d7bda8eb30b459e31f8b6be97a8f1b0b0 09-Aug-2006 Oliver Endriss <o.endriss@gmx.de> V4L/DVB (4492): [dvb_attach] dvb_frontend_detach fix

dvb_frontend_detach() used invalid config option CONFIG_DVB_DETACH,
so dvb_frontend_detach() did not call symbol_put_addr().
Replaced CONFIG_DVB_DETACH by CONFIG_DVB_CORE_ATTACH.

Signed-off-by: Oliver Endriss <o.endriss@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
f52a838b74be70b4054ab27e435e9acb92d8c50a 08-Aug-2006 Andrew de Quincey <adq_dvb@lidskialf.net> V4L/DVB (4391): Refactor dvb_detach calls into a single dvb_frontend_detach function.

Remove buggy dvb_detach() macro and replace with unified
dvb_frontend_detach() call.

Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net>
Acked-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
d995506062c974133ba66d0822e58a923d4d74d9 08-Aug-2006 Andrew de Quincey <adq_dvb@lidskialf.net> V4L/DVB (4385): Add dvb_attach() macro and supporting routines

Add dvb_attach() macro and supporting routines

Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net>
Acked-by: Michael Krufky <mkrufky@linuxtv.org>
Acked-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
13fef9335f4fe2a73e1733f8807e69711736faef 08-Aug-2006 Andrew de Quincey <adq_dvb@lidskialf.net> V4L/DVB (4383): Convert SEC drivers to new frontend API

Convert SEC drivers to new frontend API

Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net>
Acked-by: Michael Krufky <mkrufky@linuxtv.org>
Acked-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
04c56d0e5b27f1f65e4d20b46731d55341d42a6a 10-Jul-2006 Andrew de Quincey <adq_dvb@lidskialf.net> V4L/DVB (4292): Fix DISEQC regression

The changes to add frontend reinitialisation moved the position where the
init() op is called into the frontend thread. Unfortunately, since DISEQC
operations do not use the frontend thread, this meant that DISEQC could be
called against an uninitalised frontend, leading to all sorts of trouble.
Patch fixes this by reinstating the original fronted intialisation call.

Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
70d906354fd7fe3956366ade15ab36d6b7aed971 30-Jun-2006 Manu Abraham <abraham.manu@gmail.com> V4L/DVB (4282): Fix: use swzigzag for swalgo

Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
1b172e0c4e44151cd239c1e9260c7822a4eecdbf 29-Jun-2006 Trent Piepho <xyzzy@speakeasy.org> V4L/DVB (4275): The FE_SET_FRONTEND_TUNE_MODE ioctl always returns EOPNOTSUPP

When someone added the front-end ioctl FE_SET_FRONTEND_TUNE_MODE, they
forgot to set the return value to 0. It always returns EOPNOTSUPP,
causing problems for programmers who actually check for error conditions.

Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
4a4edcca22bf46622f34db74a876a7eb91d95865 25-Jun-2006 Manu Abraham <abraham.manu@gmail.com> V4L/DVB (4217): Fix a misplaced closing bracket/else, which caused swzigzag not to be called

Thanks to Oliver Endriss for spotting this.

Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
d772bd03bc38794c84811be9d2537c225e08c9b8 24-Jun-2006 Manu Abraham <abraham.manu@gmail.com> V4L/DVB (4211): Fix an Oops for all fe that have get_frontend_algo == NULL

Thanks to Johannes Stezenbach for pointing it out

Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
0249ef16fa1eb4a85411d0e1b6e6a906e26ed1ac 21-Jun-2006 Manu Abraham <abraham.manu@gmail.com> V4L/DVB (4160): Use device specific algorithms

Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
4821fb1d8447a5786ea12c861b4ab5f69d400bfa 21-Jun-2006 Manu Abraham <abraham.manu@gmail.com> V4L/DVB (4155): ATSC frontend support

Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
dea74869f3c62b0b7addd67017b22b394e942aac 14-May-2006 Patrick Boettcher <pb@linuxtv.org> V4L/DVB (4028): Change dvb_frontend_ops to be a real field instead of a pointer field inside dvb_frontend

The dvb_frontend_ops is a pointer inside dvb_frontend. That's why every demod-driver
is having a field of dvb_frontend_ops in its private-state-struct and
using the reference for filling the pointer-field in dvb_frontend.
- It saves at least two lines of code per demod-driver,
- reduces object size (one less dereference per frontend_ops-access),
- be coherent with dvb_tuner_ops,
- makes it a little bit easier for newbies to understand how it works and
- avoids stupid mistakes because you would have to copy the dvb_frontend_ops
always, before you could assign the static pointer directly, which was
dangerous.

Signed-off-by: Patrick Boettcher <pb@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
7eef5dd6daecf3ee305116c9cf41ae7166270c4c 18-Apr-2006 Andrew de Quincey <adq_dvb@lidskialf.net> V4L/DVB (3845): DVB core changes for PLL refactoring

Add tuner_ops structure.
Add calls into dvb_frontend to support the new tuner architecture.

Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
a8558577ff5562fe52c2c493e5bbc3dcdec7ce2f 11-Apr-2006 Uwe Bugla <uwe.bugla@gmx.de> V4L/DVB (3769): Fix a type error in dvb_frontend.c

Signed-off-by: Uwe Bugla <uwe.bugla@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
6445401673fe486ba15a39370d41100df6d73b1f 06-Apr-2006 Andrew de Quincey <adq_dvb@lidskialf.net> V4L/DVB (3742): Set tone/voltage again if the frontend was reinitialised

Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
86f40cc3c994822ffeb226753526d87be21bd79a 30-Mar-2006 Andrew de Quincey <adq_dvb@lidskialf.net> V4L/DVB (3673): Fix budget-av CAM reset

Unfortunately on the budget-av board, the CAM reset line is tied to the
frontend reset line, so resetting the CAM also zaps the frontend. This
breaks the tda1004x at least, and causes it to fail to tune until the
budget-av module is reloaded. This patch adds an exported function to dvb_frontend
that allows a card to forcibly reinitialise a frontend. The budget-av now
does this on CAM reset, which corrects this problem.
since they do not tie the CAM reset line to the frontend reset line.

Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
6baad3f041eec7c31ad88b52eb44205987148eba 27-Feb-2006 Manu Abraham <manu@linuxtv.org> V4L/DVB (3390): Fix module parameters

Now, root may change parameters while module is running.
Thanks to Edgar Toerning

Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
3593cab5d62c4c7abced1076710f9bc2d8847433 07-Feb-2006 Ingo Molnar <mingo@elte.hu> V4L/DVB (3318b): sem2mutex: drivers/media/, #2

Semaphore to mutex conversion.

The conversion was generated via scripts, and the result was validated
automatically via a script as well.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
7408187d223f63d46a13b6a35b8f96b032c2f623 11-Jan-2006 Panagiotis Issaris <takis@issaris.org> V4L/DVB (3344a): Conversions from kmalloc+memset to k(z|c)alloc


Conversions from kmalloc+memset to k(z|c)alloc.

Signed-off-by: Panagiotis Issaris <takis@issaris.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
400b7083fbcc8e7a1157a82aa126977179873268 09-Jan-2006 Peter Beutner <p.beutner@gmx.net> V4L/DVB (3194): Revert one 64-bit fix and improved other 64-bit fixes

- Reverted objectionable fix in saa7146_hlp.c
- Merged in improved dvb 64-bit fixes from Peter Beutner.

Signed-off-by: Peter Beutner <p.beutner@gmx.net>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
e18828e43a52fb9a792938840cc32cbb2a9e1a5c 09-Jan-2006 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB (3179): Fix 64-bit compile warnings

- Fix 64-bit compile warnings

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
36cb557a2f64513e2fdc1a542167e5e8a6c1c67e 09-Jan-2006 Andrew de Quincey <adq_dvb@lidskialf.net> DVB (2444): Implement frontend-specific tuning and the ability to disable zigzag

- Implement frontend-specific tuning and the ability to disable zigzag

Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
afd1a0c9ac281eed3b22b293ccd92af7b0d60889 12-Dec-2005 Mauro Carvalho Chehab <mchehab@brturbo.com.br> [PATCH] V4L/DVB: (3086c) Whitespaces cleanups part 3

Clean up whitespaces at v4l/dvb files

Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
f7b67195ea571b8540ac79daf27f5932ec40c098 09-Nov-2005 Andrew de Quincey <adq_dvb@lidskialf.net> [PATCH] dvb: Remove DEBUG_LOCKLOSS stuff

Remove DEBUG_LOCKLOSS stuff - as the problem has been found and resolved

Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Cc: Johannes Stezenbach <js@linuxtv.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
83b75b049be981e579ba2cb88aa9bf3534bbbdb1 09-Nov-2005 NooneImportant <nxhxzi702@sneakemail.com> [PATCH] dvb: let other frontends support FE_DISHNETWORK_SEND_LEGACY_CMD

Add support to FE_DISHNETWORK_SEND_LEGACY_CMD code to support other frontends
besides stv0299. The generic code is a fallback in the case that it doesn't
work for some specific frontends (again stv0299 being a good example).

Signed-off-by: NooneImportant <nxhxzi702@sneakemail.com>
Signed-off-by: Johannes Stezenbach <js@linuxtv.org>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Cc: Johannes Stezenbach <js@linuxtv.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
4992775c8287145e86b94fe8d19bbb5f20148cc0 08-Jul-2005 Andrew de Quincey <adq_dvb@lidskialf.net> [PATCH] dvb: core: add workaround for tuning problem

Add workaround for signal lock loss issue, where the frontend loses the signal
after some hours without any visible reason.

Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net>
Signed-off-by: Johannes Stezenbach <js@linuxtv.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
6757ccc57d2cc4ab4e63d8aee97f2e6b9f998990 08-Jul-2005 Peter Beutner <p.beutner@gmx.net> [PATCH] dvb: core: fix race condition in FE_READ_STATUS ioctl

Fix a race condition where an application which issued a FE_READ_STATUS ioctl
directly after FE_SET_FRONTEND would see an old status, i.e. FE_READ_STATUS
would be executed before the frontend thread has even seen the tungin request
from FE_SET_FRONTEND.

Signed-off-by: Peter Beutner <p.beutner@gmx.net>
Signed-off-by: Johannes Stezenbach <js@linuxtv.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
3e1d1d28d99dabe63c64f7f40f1ca1d646de1f73 25-Jun-2005 Christoph Lameter <christoph@lameter.com> [PATCH] Cleanup patch for process freezing

1. Establish a simple API for process freezing defined in linux/include/sched.h:

frozen(process) Check for frozen process
freezing(process) Check if a process is being frozen
freeze(process) Tell a process to freeze (go to refrigerator)
thaw_process(process) Restart process
frozen_process(process) Process is frozen now

2. Remove all references to PF_FREEZE and PF_FROZEN from all
kernel sources except sched.h

3. Fix numerous locations where try_to_freeze is manually done by a driver

4. Remove the argument that is no longer necessary from two function calls.

5. Some whitespace cleanup

6. Clear potential race in refrigerator (provides an open window of PF_FREEZE
cleared before setting PF_FROZEN, recalc_sigpending does not check
PF_FROZEN).

This patch does not address the problem of freeze_processes() violating the rule
that a task may only modify its own flags by setting PF_FREEZE. This is not clean
in an SMP environment. freeze(process) is therefore not SMP safe!

Signed-off-by: Christoph Lameter <christoph@lameter.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
cc89c229d9d7ec63cd33e960c20e75b77bc987d0 24-Jun-2005 Johannes Stezenbach <js@linuxtv.org> [PATCH] dvb: dvb_frontend: use time_after()

Use time_after() macro.

Signed-off-by: Marcelo Feitoza Parisi <marcelo@feitoza.com.br>
Signed-off-by: Domen Puncer <domen@coderock.org>
Signed-off-by: Johannes Stezenbach <js@linuxtv.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
0c53c70f6afa2d3f4d416d8c0e9a219c2f6b7cb6 17-May-2005 Johannes Stezenbach <js@linuxtv.org> [PATCH] dvb: remove unnecessary casts in dvb-core

remove unnecessary casts in dvb-core (Kenneth Aafloy)

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
f4f009a776c1db9b27346846b0db052e04a6d5ad 17-May-2005 Johannes Stezenbach <js@linuxtv.org> [PATCH] dvb: dvb_frontend: fix module param

Remove incorrect "dvb_"-prefix from parameter description. Error detected
with section2text.rb, see autoparam patch.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Johannes Stezenbach <js@linuxtv.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 17-Apr-2005 Linus Torvalds <torvalds@ppc970.osdl.org> Linux-2.6.12-rc2

Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.

Let it rip!