Commit Graph

154 Commits

Author SHA1 Message Date
Hans Verkuil
80f23305ba [media] Fix undefined reference to `au8522_attach'
au8522_attach is dependent on CONFIG_DVB_AU8522_DTV, not CONFIG_DVB_AU8522.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-26 08:37:48 -03:00
Hans Verkuil
dc6d2a2f66 [media] au8522_decoder: remove obsolete control ops
Now that au0828 has been converted to the control framework these
compatilibity ops are no longer needed.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-25 15:10:29 -03:00
Hans Verkuil
5a4bdb4b34 [media] au8522_decoder: convert to the control framework
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-25 15:09:59 -03:00
Hans Verkuil
977ba3b1b7 [media] v4l2: add const to argument of write-only s_register ioctl
This ioctl is defined as IOW, so pass the argument as const.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-24 08:47:01 -03:00
Jean Delvare
a3ad56d0ab [media] drxk_hard: Drop unused parameter
Last parameter of function GetLockStatus() isn't used so drop it.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-23 10:44:31 -03:00
Mauro Carvalho Chehab
782d8b743a [media] dvb-frontends: use IS_ENABLED
Instead of checking everywhere there for 3 symbols, use instead
IS_ENABLED macro.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-23 09:03:59 -03:00
Mauro Carvalho Chehab
48f72a1a4c [media] drxk: fix CNR calculus
Changeset 8f3741e accidentally broke the CNR estimation. It should
be calculated as "a + b - c". However, previously, the subtraction
by c only occurred if SNR would be positive, due to a bad binding
to DVBv3 API.

This also fixes the following warning:
	drivers/media/dvb-frontends/drxk_hard.c:2556:6: warning: variable 'c' set but not used [-Wunused-but-set-variable]

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-22 09:46:45 -03:00
Antti Palosaari
3bf5e55299 [media] af9033: implement i/o optimized reg table writer
Use register address auto increment to reduce I/O when large
register / values tables are written.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 19:06:00 -03:00
Antti Palosaari
0c13c54d85 [media] af9033: sleep on attach()
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 19:05:45 -03:00
Antti Palosaari
086991dd10 [media] af9033: move code from it913x to af9033
That register is property of demodulator so move it correct place.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 19:05:24 -03:00
Antti Palosaari
d423e108c1 [media] it913x: remove unused af9033 demod tuner config inits
Those are demodulator init tables according to used tuner tuner
config. af9033 demod driver does those inits currently and due
to that these duplicate inits could be removed.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 19:05:00 -03:00
Antti Palosaari
dc4a2c40f8 [media] af9033: add IT9135 tuner config "62" init table
Dumped out from the Windows driver version 12.07.06.1

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 19:04:25 -03:00
Antti Palosaari
85211323fa [media] af9033: add IT9135 tuner config "61" init table
Dumped out from the Windows driver version 12.07.06.1

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 19:04:15 -03:00
Antti Palosaari
a49f53a080 [media] af9033: add IT9135 tuner config "60" init table
Dumped out from the Windows driver version 12.07.06.1

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 19:04:01 -03:00
Antti Palosaari
22d729f30e [media] af9033: add IT9135 tuner config "52" init table
Dumped out from the Windows driver version 12.07.06.1

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 19:03:41 -03:00
Antti Palosaari
bb2e12a6f9 [media] af9033: add IT9135 tuner config "51" init table
Dumped out from the Windows driver version 12.07.06.1

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 19:03:20 -03:00
Antti Palosaari
a72cbb77c1 [media] af9033: add IT9135 tuner config "38" init table
Dumped out from the Windows driver version 12.07.06.1

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 19:03:08 -03:00
Antti Palosaari
463c399c2a [media] af9033: add IT9135 demod reg init tables
Dumped out from Windows driver version 12.07.06.1, 07/06/2012.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 19:00:01 -03:00
Antti Palosaari
fe8eece1fd [media] af9033: IT9135 v2 supported related changes
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 18:55:45 -03:00
Antti Palosaari
4902bb39b6 [media] af9033: support for it913x tuners
Add support for tuners integrated to the IT9135 and IT9137.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 18:46:47 -03:00
Paul Bolle
d65fcbb000 [media] ts2020: use customise option correctly
The Kconfig entry for "TS2020 based tuners" defaults to modular if
DVB_FE_CUSTOMISE is set. But that Kconfig symbol was replaced with
MEDIA_SUBDRV_AUTOSELECT as of v3.7. So use the new symbol. And negate
the logic, so we are in line with all the similar entries in this file.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 14:11:12 -03:00
Mauro Carvalho Chehab
340e76965c [media] drxk: Fix bogus signal strength indicator
The DVBv3 signal strength indicator is bogus: it doesn't range
from 0 to 65535 as it would be expected. Also, 0 means the max
signal strength.
Now that a better way to estimate it was added, use the new
way.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 10:27:21 -03:00
Mauro Carvalho Chehab
59a7a23c47 [media] drxk: use a better calculus for RF strength
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>
2013-03-21 10:27:05 -03:00
Mauro Carvalho Chehab
8f3741e028 [media] drxk: Add pre/post BER and PER/UCB stats
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>
2013-03-21 10:26:50 -03:00
Mauro Carvalho Chehab
2b0e1f3afd [media] drxk: remove dummy BER read code
The BER code does nothing but filling it with zero. Remove it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-21 10:25:59 -03:00
Alexey Khoroshilov
c67d2f0740 [media] stv090x: do not unlock unheld mutex in stv090x_sleep()
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>
2013-03-14 11:40:32 -03:00
Mauro Carvalho Chehab
0e4bbedd63 [media] mb86a20s: Don't assume a 32.57142MHz clock
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>
2013-03-04 16:37:07 -03:00
Mauro Carvalho Chehab
04fa725e7b [media] mb86a20s: Implement set_frontend cache logic
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>
2013-03-04 16:36:40 -03:00
Mauro Carvalho Chehab
3a2e47519e [media] mb86a20s: cleanup the status at set_frontend()
As the device got re-initialized, the stats should vanish
until the device gets lock again.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-04 16:35:16 -03:00
Mauro Carvalho Chehab
8b8e444a27 [media] mb86a20s: Don't reset strength with the other stats
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>
2013-03-04 16:34:52 -03:00
Mauro Carvalho Chehab
a78b41d5fd [media] mb86a20s: Always reset the frontend with set_frontend
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>
2013-03-04 16:34:31 -03:00
Mauro Carvalho Chehab
17e67d4c7f [media] mb86a20s: change AGC tuning parameters
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>
2013-03-04 16:34:05 -03:00
Mauro Carvalho Chehab
0921ecfdc2 [media] mb86a20s: don't allow updating signal strength too fast
Getting signal strength requires some loop poking with I2C.
Don't let it happen too fast.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-04 16:33:43 -03:00
Mauro Carvalho Chehab
dad78c5662 [media] mb86a20s: Fix signal strength calculus
A register typo made the calculation to not work. Fix it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-04 16:33:20 -03:00
Mauro Carvalho Chehab
15b1c5a068 [media] mb86a20s: provide CNR stats before FE_HAS_SYNC
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>
2013-03-04 16:32:55 -03:00
Mauro Carvalho Chehab
768e6dadd7 [media] mb86a20s: adjust IF based on what's set on the tuner
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>
2013-03-04 16:32:33 -03:00
Mauro Carvalho Chehab
d56e326f7b [media] mb86a20s: don't pollute dmesg with debug messages
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>
2013-03-04 16:32:08 -03:00
Cong Ding
4880f56438 [media] stv0900: remove unnecessary null pointer check
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>
2013-02-08 18:05:48 -02:00
Peter Senna Tschudin
7b34be71db [media] use IS_ENABLED() macro
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>
2013-02-06 09:24:09 -02:00
Andreas Regel
6b9e50c463 [media] stv090x: On STV0903 do not set registers of the second path
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>
2013-01-24 18:31:00 -02:00
Mauro Carvalho Chehab
f67102c49a [media] mb86a20s: remove global BER/PER counters if per-layer counters vanish
If, for any reason, all per-layers counters stop, remove the
corresponding global counter.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-24 14:28:32 -02:00
Mauro Carvalho Chehab
d9b6f08a7f [media] mb86a20s: add a logic for post-BER measurement
The logic here is similar to the preBER.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-24 14:28:14 -02:00
Mauro Carvalho Chehab
313cf4efa4 [media] mb86a20s: fix the PER reset logic
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>
2013-01-24 14:27:16 -02:00
Mauro Carvalho Chehab
ad0abbf118 [media] mb86a20s: some fixes at preBER logic
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>
2013-01-24 14:26:55 -02:00
Mauro Carvalho Chehab
593ae89a3f [media] mb86a20s: add block count measures (PER/UCB)
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>
2013-01-24 14:24:59 -02:00
Mauro Carvalho Chehab
25188bd0e6 [media] mb86a20s: add CNR measurement
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>
2013-01-23 19:10:49 -02:00
Mauro Carvalho Chehab
d01a8ee37a [media] mb86a20s: improve bit error count for BER
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>
2013-01-23 19:10:42 -02:00
Mauro Carvalho Chehab
149d518ad0 [media] mb86a20s: add BER measurement
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>
2013-01-23 19:10:35 -02:00
Mauro Carvalho Chehab
09b6d21e10 [media] mb86a20s: calculate statistics at .read_status()
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>
2013-01-23 19:10:27 -02:00
Mauro Carvalho Chehab
f167e302c6 [media] mb86a20s: don't use state before initializing it
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>
2013-01-23 13:22:22 -02:00