Commit graph

578 commits

Author SHA1 Message Date
Miroslav Slugen
304bce414e [media] Add registers names to XC2028 tuner from datahseet and use them
Signed-off-by: Miroslav Slugen <thunder.mmm@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-16 12:24:39 -02:00
Miroslav Slugen
8a538a8855 [media] xc4000: add support for signal strength measures
In xc4000 chipsets real signal and noise level is stored in register
0x0A and 0x0B,so we can use those registers to monitor signal strength.

I tested this patch on 2 different cards Leadtek DVR3200 and DTV2000H
Plus, both with same results, I used special antenna hubs (toner 4x, 6x,
8x and 12x) with mesured signal lost, both registers are in dB value,
first represent signal with limit value -113.5dB (should be -114dB) and
exactly match with test results. Second represents noise level also in
dB and there is no maximum value, but from tests we can drop everything
above 32dB which tuner realy can't use, signal was usable till 20dB
noise level.

In digital mode we can take signal strength but sadly noise level is not
relevant and real value is stored in demodulator for now just zl10353,
also digital mode is just for testing, because it needs changing other
parts of code which reads data only from demodulator.

In analog mode I was able to test only FM radio, signal level is not
important, it says something about cable and hub losts, but nothing
about real quality of reception, so even if we have signal level at
minimum 113dB we can still here radio, because of that it is displaied
only in debug mode, but for real signal level is used noise register
which is again very accurate, radio noise level was betwen 6-20dB for
good signal, 20-25dB for medium signal, and above 25dB signal is
unusable.

For now real benefit of this patch is only for FM radio mode.

Signed-off-by: Miroslav Slugen <thunder.mmm@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-16 12:23:15 -02:00
Antti Palosaari
9e94136d36 [media] mxl5007t: bugfix DVB-T 7 MHz and 8 MHz bandwidth
DVB-T did not work at all - only 6 MHz was working but it is not
commonly used.
Fix it.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-10 22:38:15 -02:00
Mauro Carvalho Chehab
083b6b8a23 [media] tda18271-fe: Fix support for ISDB-T
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-10 22:35:33 -02:00
Gianluca Gennari
98ab8550ae [media] xc3028: fix center frequency calculation for DTV78 firmware
This patch replaces the previous one proposed in the thread "xc3028:
force reload of DTV7 firmware in VHF band with Zarlink demodulator",
at the linux-media@vger.kernel.org ML.

The problem is that the firmware DTV78 works fine in UHF band (8 MHz
bandwidth) but is not working at all in VHF band (7 MHz bandwidth).
Reading the comments inside the code, I figured out that the real
problem could be connected to the formula used to calculate the center
frequency offset in VHF band.

In fact, removing this adjustment fixes the problem:

		if ((priv->cur_fw.type & DTV78) && freq < 470000000)
			offset -= 500000;

This is coherent to what was implemented for the DTV7 firmware by an
Australian user:

		if (priv->cur_fw.type & DTV7)
			offset += 500000;

In the end, now the center frequency is the same for all firmwares
(DTV7, DTV8, DTV78) and doesn't depend on channel bandwidth.

The final code looks clean and simple, and there is no need for any
"magic" adjustment:

		if (priv->cur_fw.type & DTV6)
			offset = 1750000;
		else	/* DTV7 or DTV8 or DTV78 */
			offset = 2750000;

Signed-off-by: Gianluca Gennari <gennarone@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-06 17:13:48 -02:00
Fabio Estevam
2e6cbd2b08 [media] drivers: media: tuners: Fix dependency for MEDIA_TUNER_TEA5761
Fix the following build warning:

warning: (MEDIA_TUNER) selects MEDIA_TUNER_TEA5761 which has unmet direct
dependencies (MEDIA_SUPPORT && VIDEO_MEDIA && I2C && EXPERIMENTAL)

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-06 13:17:15 -02:00
Stefan Ringel
eeecd0caaf [media] mt2063: fix get_if_frequency call
[mchehab@redhat.com: patch rebased to apply]
Signed-off-by: Stefan Ringel <linuxtv@stefanringel.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-05 11:06:12 -02:00
Mauro Carvalho Chehab
6225f18b88 [media] Don't test for ops->info.type inside drivers
Now, ops->info.type is handled inside the dvb_frontend
core, only for DVBv3 calls, and according with the
delivery system. So, drivers should not care or use it,
otherwise, it may have issues with DVBv5 calls.

The drivers that were still using it were detected via
this small temporary hack:

--- a/include/linux/dvb/frontend.h
+++ b/include/linux/dvb/frontend.h
@@ -29,13 +29,16 @@
 #include <linux/types.h>

 typedef enum fe_type {
+#if defined(__DVB_CORE__) || !defined (__KERNEL__)
        FE_QPSK,
        FE_QAM,
        FE_OFDM,
        FE_ATSC
+#else
+FE_FOOO
+#endif
 } fe_type_t;

-
 typedef enum fe_caps {
        FE_IS_STUPID                    = 0,
        FE_CAN_INVERSION_AUTO           = 0x1,

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 23:10:19 -02:00
Mauro Carvalho Chehab
79636fa2d8 [media] mt2063: Add it to the building system
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:49:07 -02:00
Mauro Carvalho Chehab
5160e81b99 [media] mt2063: Add support for get_if_frequency()
get_if_frequency() is needed, in order to work with DRX-K.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:49:05 -02:00
Mauro Carvalho Chehab
b52e7c7687 [media] mt2063: add some useful info for the dvb callback calls
The per-delivery system tables are confusing.
Add an extra table that explains them, and some
dprintk calls, that allows to check if mt2063 driver
is working as expected.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:49:04 -02:00
Mauro Carvalho Chehab
d1244f77d9 [media] mt2063: print the detected version
Instead of printing it just for debug purposes, outputs the detected
version at the logs. This may be useful if someone wants to report
a problem.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:49:02 -02:00
Mauro Carvalho Chehab
36ae6df083 [media] mt2063: Fix i2c read message
While here, improve a few debug messages that helped to track the
issue and may be useful in the future.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:49:01 -02:00
Mauro Carvalho Chehab
19ad6a01bb [media] mt2063: Print a message about the detected mt2063 type
This also helps to identify when a device is not initialized,
if the bridge doesn't return an error for a I2C failed transfer.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:49:00 -02:00
Mauro Carvalho Chehab
1b0bfee39d [media] mt2063: don't crash if device is not initialized
Instead of crash, return -ENODEV, if the device is not poperly
initialized.

Also, give a second chance for it to initialize, at set_params
calls.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:48:59 -02:00
Mauro Carvalho Chehab
b5a910679b [media] mt2063: Remove two unused temporary vars
mt2063.c:1531:12: warning: variable 'ofout' set but not used [-Wunused-but-set-variable]
mt2063.c:1531:6: warning: variable 'ofin' set but not used [-Wunused-but-set-variable]

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:48:58 -02:00
Mauro Carvalho Chehab
2e1d5885f4 [media] mt2063: Rewrite tuning logic
Several vars at set_parms functions were set, but unused.
 Remove them and change the logic to return -EINVAL if the
analog set_param is used for digital mode.

At the analog side, cleans the logic that sets the several
analog standards.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:48:57 -02:00
Mauro Carvalho Chehab
db6587bfd2 [media] mt2063: Add some debug printk's
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:48:56 -02:00
Mauro Carvalho Chehab
669b67d959 [media] mt2063: Convert it to the DVBv5 way for set_params()
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:31:40 -02:00
Mauro Carvalho Chehab
d76f28f2c3 [media] mt2063: Properly document the author of the original driver
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:31:26 -02:00
Mauro Carvalho Chehab
8fdb226ee1 [media] mt2063: Rearrange the delivery system functions
No functional changes on this patch. Better organize the delivery
system information and data types, putting everything together,
to improve readability.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:22:20 -02:00
Mauro Carvalho Chehab
54a4613fdb [media] mt2063: Fix comments
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:21:43 -02:00
Mauro Carvalho Chehab
99ac541254 [media] mt2063: Fix analog/digital set params logic
The driver were using a hacky way of setting analog and digital
frequencies. Remove the hack and properly add the tuner logic for
each supported type of standard.

I was tempted to add more standards there, like SECAM and to fix
radio (as stepping seems broken), but I opted to keep it as-is,
as tests would be needed to add additional standards.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:21:34 -02:00
Mauro Carvalho Chehab
6fb167000e [media] mt2063: make checkpatch.pl happy
Fix everything but 80 columns and two msleep warnings

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:21:16 -02:00
Mauro Carvalho Chehab
e3f94fb8c5 [media] mt2063: Cleanup some function prototypes
No functional changes here.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:21:05 -02:00
Mauro Carvalho Chehab
8294e3ed41 [media] mt2063: Reorder the code to avoid function prototypes
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:20:58 -02:00
Mauro Carvalho Chehab
4713e225a5 [media] mt2063: Remove setParm/getParm abstraction layer
This layer just increases the code size for no good reason,
and makes harder to debug.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:20:48 -02:00
Mauro Carvalho Chehab
3d49700fb1 [media] mt2063: Rework on the publicly-exported functions
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:20:34 -02:00
Mauro Carvalho Chehab
fad11dbc93 [media] mt2063: Simplify mt2063_setTune logic
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:20:27 -02:00
Mauro Carvalho Chehab
31e67faeaf [media] mt2063: simplify lockstatus logic
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:20:21 -02:00
Mauro Carvalho Chehab
66aea30d32 [media] mt2063: Remove several unused parameters
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:20:16 -02:00
Mauro Carvalho Chehab
fd1126cac0 [media] mt2063: Use linux default max function
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:20:09 -02:00
Mauro Carvalho Chehab
8c64f93285 [media] mt2063: Don't violate the DVB API
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:20:01 -02:00
Mauro Carvalho Chehab
01e0dafc64 [media] mt2063: Simplify device init logic
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:19:53 -02:00
Mauro Carvalho Chehab
e930b3a03e [media] mt2063: Simplify some functions
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:19:44 -02:00
Mauro Carvalho Chehab
e1de3d18d4 [media] mt2063: Rewrite read/write logic at the driver
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:19:38 -02:00
Mauro Carvalho Chehab
d0dcc2da26 [media] mt2063: Remove the code for more than one adjacent mt2063 tuners
Such code is disabled via ifdef's. Also, they're ugly and rely
on some static structures. Just remove. If ever needed, the git
log can be used to recover it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:19:31 -02:00
Mauro Carvalho Chehab
dcd52d20d3 [media] mt2063: Use state for the state structure
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:19:21 -02:00
Mauro Carvalho Chehab
51f0f7b3ed [media] mt2063: Merge the two state structures into one
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:19:11 -02:00
Mauro Carvalho Chehab
29a0a4fec5 [media] mt2063: Remove unused data structures
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:19:04 -02:00
Mauro Carvalho Chehab
fdf77a4f8e [media] mt2063: Use Unix standard error handling
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:18:59 -02:00
Mauro Carvalho Chehab
065719a768 [media] mt2063: Remove internal version checks
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:18:49 -02:00
Mauro Carvalho Chehab
6d3d748a62 [media] mt2063: Move data structures to the driver
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:18:43 -02:00
Mauro Carvalho Chehab
f867695a0f [media] mt2063: get rid of compilation warnings
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:18:32 -02:00
Mauro Carvalho Chehab
059cd82d25 [media] mt2063: Remove unused stuff
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:18:07 -02:00
Mauro Carvalho Chehab
bf97555e08 [media] mt2063: Re-define functions as static
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:17:59 -02:00
Mauro Carvalho Chehab
a0813ea340 [media] mt2063: Remove most of the #if's
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:16:24 -02:00
Mauro Carvalho Chehab
cfde89258a [media] mt2063: Use standard Linux types, instead of redefining them
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:16:23 -02:00
Mauro Carvalho Chehab
b675668aaf [media] mt2063: Fix the driver to make it compile
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:16:22 -02:00
Mauro Carvalho Chehab
0ff4843218 [media] mt2063: Move code from mt2063_cfg.h
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-04 22:16:15 -02:00