The AZ6007 driver released by Terratec has a better way to
estimate the signal strength, at CtrlSigStrength(). Port it
to the driver.
It should be noticed that there are two parameters there that
are tuner-specific.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
The original az6007 driver has the code to calculate such
stats. Add it to the driver, reporting them via DVBv5
stats API.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
goto err and goto err_gateoff before mutex_lock(&state->internal->demod_lock)
lead to unlock of unheld mutex in stv090x_sleep().
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Cc: Manu Abraham <abraham.manu@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Now that some devices initialize register 0x2a with different
values, add the calculus formula, instead of hardcoding it.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Up to now, the driver was simply assuming TV mode, 13 segs.
Implement the logic to control the ISDB operational mode.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signal strength is always available. There's no reason to reset
it, as it has its own logic to reset it already.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Always init the frontend when set_frontend is called. The rationale
is: it was noticed that, on some devices, it fails to lock with a
different channel. It seems that some other registers need to be
restored to its initial state, when the channel changes.
As it is better to reset everything, even wasting a few more
miliseconds than to loose channel lock, let's change the logic
to always reset.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Use the AGC settings present on a newer device.
The initial settings were taken from one of the first devices with
mb86a20s, and there are several reports that this is not working
properly on some places.
So, instead of keeping using it, get the parameters taken from a
newer device. Tests are welcomed.
Tested also with cx231xx PixelView SBTVD Hybrid with no regressions
noticed so far.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
State 9 means TS started to be output, and it should be
associated with FE_HAS_SYNC.
The mb86a20scan get CNR statistics at state 7, when frame sync
is obtained.
As CNR may help to adjust the antenna, provide it earlier.
A latter patch could eventually start outputing MER measures
earlier, but that would require a bigger change, and probably
won't be better than the current way, as the time between
changing from state 8 to 9 is generally lower than the time
to get the stats collected.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Instead of hardcoding a fixed IF frequency of 3.3 MHz, use
the IF frequency provided by the tuner driver.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
There are a few debug tests that are shown with dev_err() or
dev_info(). Replace them by dev_dbg().
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
The address of a variable is impossible to be null, so we remove the check.
Signed-off-by: Cong Ding <dinggnu@gmail.com>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This patch introduces the use of IS_ENABLED() macro. For example,
replacing:
#if defined(CONFIG_I2C) || (defined(CONFIG_I2C_MODULE) && defined(MODULE))
with:
#if IS_ENABLED(CONFIG_I2C)
All changes made by this patch respect the same replacement pattern.
Reported-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Acked-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Sometimes there is a problem when trying to access the non-existing registers
of the second demodulator path on the STV0903.
This change removes the calls in case the driver is used on a STV0903.
Signed-off-by: Andreas Regel <andreas.regel@gmx.de>
Acked-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
The logic that resets the device is wrong. It should be resetting
just the layer that got read. Also, stop is needed before updating
the counters.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
The logic that resets the device is wrong. It should be resetting
just the layer that got read. Also, stop is needed before updating
the counters.
While there, rename it, as we'll soon introduce a postBER logic
there.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Add both per-layer and global block error count and block count,
for PER and UCB measurements.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Add Signal/Noise ratio measurement. On this device, a global measure
is taken by the demod. It also provides per-layer CNR measurements,
based on Modulation Error measures (MER).
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Do a better job on setting the bit error counters, in order to
have all layer measures to happen in a little less than one
second.
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Add the methods to read bit error/bit count measurements from
mb86a20s. On ISDB-T devices, those reads are done per layer.
However, as userspace applications may not be aware of that,
add a global measure that will sum the bit errors and bit
counts for each layer, storing them into a global value.
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Instead of providing separate callbacks to read the several FE
stats properties, the better seems to use just one method that will:
- Read lock status;
- Read signal strength;
- if locked, get TMCC data;
- if locked, get DVB statistics.
As the DVB frontend thread will call this read_status callback
on every 3 seconds, and userspace can even call it earlier,
all stats data and layers layout will be updated together if
available, with is a good thing.
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
As reported by Feng's kbuild test:
From: kbuild test robot <fengguang.wu@intel.com>
Subject: drivers/media/dvb-frontends/mb86a20s.c:706 mb86a20s_attach() error: potential null dereference 'state'. (kzalloc returns null)
Date: Wed, 23 Jan 2013 19:30:43 +0800
commit: f66d81b54d [media] mb86a20s: convert it to use dev_info/dev_err/dev_dbg
drivers/media/dvb-frontends/mb86a20s.c:706 mb86a20s_attach() error: potential null dereference 'state'. (kzalloc returns null)
drivers/media/dvb-frontends/mb86a20s.c:706 mb86a20s_attach() error: we previously assumed 'state' could be null (see line 705)
As, at mb86a20s_attach(), we have an i2c pointer, use it for all printk
messages there, instead of state->i2c.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Instead of having its own set of macros, use the Kernel default
ones for debug, error and info.
While here, do some cleanup on the debug printk's.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Reorder functions to have everything related to stats/status read
close. That will make the file more organized as other stats
routines will be added.
No functional changes.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Split the logic that reads the status from the DVB callback. That
helps to properly return an error code, if status read fails.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
The read/write errors are not handled well on get_frontend. Fix it,
by letting the frontend cached values to represent the DVB properties
that were successfully retrieved.
While here, use "c" for dtv_frontend_properties cache, instead of
"p", as this is more common.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Multistream support for stv0900. For Netup Dual S2 CI with STV0900BAC/AAC.
Signed-off-by: Evgeny Plehov <EvgenyPlehov@ukr.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Restore ds3000.c read_signal_strength.
Call tuner get_rf_strength from frontend read_signal_strength.
We are able to do a NULL check and doesn't limit the tuner
attach to the frontend attach area.
At the moment the lmedm04 tuner attach is stuck in frontend
attach area.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Various small changes and fixes releated to dual mode.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tuner part of Montage rs2000 chip is similar to ts2020 tuner.
Patch to use ts2020 code.
[mchehab@redhat.com: a few CodingStyle fixes]
Signed-off-by: Igor M. Liplianin <liplianin@me.by>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
TeVii s660 and others have LED for lock indication.
Let's use it in right order.
Signed-off-by: Igor M. Liplianin <liplianin@me.by>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
One register needs to be changed to TS to work. So we use separate inittab.
Signed-off-by: Igor M. Liplianin <liplianin@me.by>
Acked-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
- if kmalloc() returns NULL, we can return immediately without trying
to kfree() a NULL pointer.
- if i2c_transfer() fails, error out immediately instead of trying to
upload the remaining bytes of the firmware.
- the error code is then properly propagated down to ds3000_initfe().
Signed-off-by: Rémi Cardona <remi.cardona@smartjog.com>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>