summaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r--drivers/media/dvb/Kconfig4
-rw-r--r--drivers/media/dvb/b2c2/Kconfig2
-rw-r--r--drivers/media/dvb/b2c2/Makefile2
-rw-r--r--drivers/media/dvb/bt8xx/Kconfig2
-rw-r--r--drivers/media/dvb/bt8xx/Makefile2
-rw-r--r--drivers/media/dvb/bt8xx/dst.c2
-rw-r--r--drivers/media/dvb/dvb-core/Kconfig34
-rw-r--r--drivers/media/dvb/dvb-core/dvb_frontend.c2
-rw-r--r--drivers/media/dvb/dvb-core/dvbdev.h2
-rw-r--r--drivers/media/dvb/dvb-usb/Kconfig26
-rw-r--r--drivers/media/dvb/dvb-usb/Makefile2
-rw-r--r--drivers/media/dvb/frontends/Kconfig121
-rw-r--r--drivers/media/dvb/frontends/Makefile11
-rw-r--r--drivers/media/dvb/frontends/mt2060.c369
-rw-r--r--drivers/media/dvb/frontends/mt2060.h43
-rw-r--r--drivers/media/dvb/frontends/mt2060_priv.h105
-rw-r--r--drivers/media/dvb/frontends/mt2131.c314
-rw-r--r--drivers/media/dvb/frontends/mt2131.h54
-rw-r--r--drivers/media/dvb/frontends/mt2131_priv.h49
-rw-r--r--drivers/media/dvb/frontends/mt2266.c351
-rw-r--r--drivers/media/dvb/frontends/mt2266.h37
-rw-r--r--drivers/media/dvb/frontends/qt1010.c485
-rw-r--r--drivers/media/dvb/frontends/qt1010.h53
-rw-r--r--drivers/media/dvb/frontends/qt1010_priv.h105
-rw-r--r--drivers/media/dvb/frontends/s5h1420.c2
-rw-r--r--drivers/media/dvb/frontends/tda18271-common.c666
-rw-r--r--drivers/media/dvb/frontends/tda18271-fe.c1153
-rw-r--r--drivers/media/dvb/frontends/tda18271-priv.h220
-rw-r--r--drivers/media/dvb/frontends/tda18271-tables.c1313
-rw-r--r--drivers/media/dvb/frontends/tda18271.h99
-rw-r--r--drivers/media/dvb/frontends/tda827x.c852
-rw-r--r--drivers/media/dvb/frontends/tda827x.h69
-rw-r--r--drivers/media/dvb/frontends/xc5000.c964
-rw-r--r--drivers/media/dvb/frontends/xc5000.h63
-rw-r--r--drivers/media/dvb/frontends/xc5000_priv.h36
35 files changed, 60 insertions, 7554 deletions
diff --git a/drivers/media/dvb/Kconfig b/drivers/media/dvb/Kconfig
index 03ef88acd9b..7b21b49f194 100644
--- a/drivers/media/dvb/Kconfig
+++ b/drivers/media/dvb/Kconfig
@@ -1,9 +1,7 @@
#
-# Multimedia device configuration
+# DVB device configuration
#
-source "drivers/media/dvb/dvb-core/Kconfig"
-
menuconfig DVB_CAPTURE_DRIVERS
bool "DVB/ATSC adapters"
depends on DVB_CORE
diff --git a/drivers/media/dvb/b2c2/Kconfig b/drivers/media/dvb/b2c2/Kconfig
index 6ec5afba1ca..73dc2ee9b01 100644
--- a/drivers/media/dvb/b2c2/Kconfig
+++ b/drivers/media/dvb/b2c2/Kconfig
@@ -9,7 +9,7 @@ config DVB_B2C2_FLEXCOP
select DVB_STV0297 if !DVB_FE_CUSTOMISE
select DVB_BCM3510 if !DVB_FE_CUSTOMISE
select DVB_LGDT330X if !DVB_FE_CUSTOMISE
- select TUNER_SIMPLE if !DVB_FE_CUSTOMISE
+ select MEDIA_TUNER_SIMPLE if !DVB_FE_CUSTOMISE
select DVB_S5H1420 if !DVB_FE_CUSTOMISE
select DVB_TUNER_ITD1000 if !DVB_FE_CUSTOMISE
select DVB_ISL6421 if !DVB_FE_CUSTOMISE
diff --git a/drivers/media/dvb/b2c2/Makefile b/drivers/media/dvb/b2c2/Makefile
index 870e2848c29..d9db066f985 100644
--- a/drivers/media/dvb/b2c2/Makefile
+++ b/drivers/media/dvb/b2c2/Makefile
@@ -14,4 +14,4 @@ b2c2-flexcop-usb-objs = flexcop-usb.o
obj-$(CONFIG_DVB_B2C2_FLEXCOP_USB) += b2c2-flexcop-usb.o
EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/
-EXTRA_CFLAGS += -Idrivers/media/video/
+EXTRA_CFLAGS += -Idrivers/media/common/tuners/
diff --git a/drivers/media/dvb/bt8xx/Kconfig b/drivers/media/dvb/bt8xx/Kconfig
index 902c762e0b7..d1239b8342f 100644
--- a/drivers/media/dvb/bt8xx/Kconfig
+++ b/drivers/media/dvb/bt8xx/Kconfig
@@ -8,7 +8,7 @@ config DVB_BT8XX
select DVB_OR51211 if !DVB_FE_CUSTOMISE
select DVB_LGDT330X if !DVB_FE_CUSTOMISE
select DVB_ZL10353 if !DVB_FE_CUSTOMISE
- select TUNER_SIMPLE if !DVB_FE_CUSTOMISE
+ select MEDIA_TUNER_SIMPLE if !DVB_FE_CUSTOMISE
select FW_LOADER
help
Support for PCI cards based on the Bt8xx PCI bridge. Examples are
diff --git a/drivers/media/dvb/bt8xx/Makefile b/drivers/media/dvb/bt8xx/Makefile
index 9d3e68b5d6e..d98f1d49ffa 100644
--- a/drivers/media/dvb/bt8xx/Makefile
+++ b/drivers/media/dvb/bt8xx/Makefile
@@ -3,4 +3,4 @@ obj-$(CONFIG_DVB_BT8XX) += bt878.o dvb-bt8xx.o dst.o dst_ca.o
EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core
EXTRA_CFLAGS += -Idrivers/media/dvb/frontends
EXTRA_CFLAGS += -Idrivers/media/video/bt8xx
-EXTRA_CFLAGS += -Idrivers/media/video
+EXTRA_CFLAGS += -Idrivers/media/common/tuners
diff --git a/drivers/media/dvb/bt8xx/dst.c b/drivers/media/dvb/bt8xx/dst.c
index 75711bde23a..a7637562e74 100644
--- a/drivers/media/dvb/bt8xx/dst.c
+++ b/drivers/media/dvb/bt8xx/dst.c
@@ -1714,7 +1714,7 @@ static void dst_release(struct dvb_frontend *fe)
struct dst_state *state = fe->demodulator_priv;
if (state->dst_ca) {
dvb_unregister_device(state->dst_ca);
-#ifdef CONFIG_DVB_CORE_ATTACH
+#ifdef CONFIG_MEDIA_ATTACH
symbol_put(dst_ca_attach);
#endif
}
diff --git a/drivers/media/dvb/dvb-core/Kconfig b/drivers/media/dvb/dvb-core/Kconfig
deleted file mode 100644
index e3e6839f807..00000000000
--- a/drivers/media/dvb/dvb-core/Kconfig
+++ /dev/null
@@ -1,34 +0,0 @@
-config DVB_CORE
- tristate "DVB for Linux"
- depends on NET && INET
- select CRC32
- help
- Support Digital Video Broadcasting hardware. Enable this if you
- own a DVB adapter and want to use it or if you compile Linux for
- a digital SetTopBox.
-
- DVB core utility functions for device handling, software fallbacks etc.
- Say Y when you have a DVB card and want to use it. Say Y if your want
- to build your drivers outside the kernel, but need the DVB core. All
- in-kernel drivers will select this automatically if needed.
-
- API specs and user tools are available from <http://www.linuxtv.org/>.
-
- Please report problems regarding this driver to the LinuxDVB
- mailing list.
-
- If unsure say N.
-
-config DVB_CORE_ATTACH
- bool "Load and attach frontend modules as needed"
- depends on DVB_CORE
- depends on MODULES
- help
- Remove the static dependency of DVB card drivers on all
- frontend modules for all possible card variants. Instead,
- allow the card drivers to only load the frontend modules
- they require. This saves several KBytes of memory.
-
- Note: You will need module-init-tools v3.2 or later for this feature.
-
- If unsure say Y.
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c
index 2dddd08c544..8cbdb218952 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -1189,7 +1189,7 @@ int dvb_unregister_frontend(struct dvb_frontend* fe)
}
EXPORT_SYMBOL(dvb_unregister_frontend);
-#ifdef CONFIG_DVB_CORE_ATTACH
+#ifdef CONFIG_MEDIA_ATTACH
void dvb_frontend_detach(struct dvb_frontend* fe)
{
void *ptr;
diff --git a/drivers/media/dvb/dvb-core/dvbdev.h b/drivers/media/dvb/dvb-core/dvbdev.h
index 5f9a737c6de..89d12dc477a 100644
--- a/drivers/media/dvb/dvb-core/dvbdev.h
+++ b/drivers/media/dvb/dvb-core/dvbdev.h
@@ -115,7 +115,7 @@ extern int dvb_usercopy(struct inode *inode, struct file *file,
unsigned int cmd, void *arg));
/** generic DVB attach function. */
-#ifdef CONFIG_DVB_CORE_ATTACH
+#ifdef CONFIG_MEDIA_ATTACH
#define dvb_attach(FUNCTION, ARGS...) ({ \
void *__r = NULL; \
typeof(&FUNCTION) __a = symbol_request(FUNCTION); \
diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig
index 3c8493d2026..4c1cff9feb2 100644
--- a/drivers/media/dvb/dvb-usb/Kconfig
+++ b/drivers/media/dvb/dvb-usb/Kconfig
@@ -25,7 +25,7 @@ config DVB_USB_A800
tristate "AVerMedia AverTV DVB-T USB 2.0 (A800)"
depends on DVB_USB
select DVB_DIB3000MC
- select DVB_TUNER_MT2060 if !DVB_FE_CUSTOMISE
+ select MEDIA_TUNER_MT2060 if !DVB_FE_CUSTOMISE
select DVB_PLL if !DVB_FE_CUSTOMISE
help
Say Y here to support the AVerMedia AverTV DVB-T USB 2.0 (A800) receiver.
@@ -35,7 +35,7 @@ config DVB_USB_DIBUSB_MB
depends on DVB_USB
select DVB_PLL if !DVB_FE_CUSTOMISE
select DVB_DIB3000MB
- select DVB_TUNER_MT2060 if !DVB_FE_CUSTOMISE
+ select MEDIA_TUNER_MT2060 if !DVB_FE_CUSTOMISE
help
Support for USB 1.1 and 2.0 DVB-T receivers based on reference designs made by
DiBcom (<http://www.dibcom.fr>) equipped with a DiB3000M-B demodulator.
@@ -56,7 +56,7 @@ config DVB_USB_DIBUSB_MC
tristate "DiBcom USB DVB-T devices (based on the DiB3000M-C/P) (see help for device list)"
depends on DVB_USB
select DVB_DIB3000MC
- select DVB_TUNER_MT2060 if !DVB_FE_CUSTOMISE
+ select MEDIA_TUNER_MT2060 if !DVB_FE_CUSTOMISE
help
Support for USB2.0 DVB-T receivers based on reference designs made by
DiBcom (<http://www.dibcom.fr>) equipped with a DiB3000M-C/P demodulator.
@@ -73,8 +73,8 @@ config DVB_USB_DIB0700
select DVB_DIB7000P
select DVB_DIB7000M
select DVB_DIB3000MC
- select DVB_TUNER_MT2060 if !DVB_FE_CUSTOMISE
- select DVB_TUNER_MT2266 if !DVB_FE_CUSTOMISE
+ select MEDIA_TUNER_MT2060 if !DVB_FE_CUSTOMISE
+ select MEDIA_TUNER_MT2266 if !DVB_FE_CUSTOMISE
select DVB_TUNER_DIB0070
help
Support for USB2.0/1.1 DVB receivers based on the DiB0700 USB bridge. The
@@ -93,7 +93,7 @@ config DVB_USB_UMT_010
depends on DVB_USB
select DVB_PLL if !DVB_FE_CUSTOMISE
select DVB_DIB3000MC
- select DVB_TUNER_MT2060 if !DVB_FE_CUSTOMISE
+ select MEDIA_TUNER_MT2060 if !DVB_FE_CUSTOMISE
help
Say Y here to support the HanfTek UMT-010 USB2.0 stick-sized DVB-T receiver.
@@ -105,7 +105,7 @@ config DVB_USB_CXUSB
select DVB_LGDT330X if !DVB_FE_CUSTOMISE
select DVB_MT352 if !DVB_FE_CUSTOMISE
select DVB_ZL10353 if !DVB_FE_CUSTOMISE
- select TUNER_SIMPLE if !DVB_FE_CUSTOMISE
+ select MEDIA_TUNER_SIMPLE if !DVB_FE_CUSTOMISE
help
Say Y here to support the Conexant USB2.0 hybrid reference design.
Currently, only DVB and ATSC modes are supported, analog mode
@@ -118,7 +118,7 @@ config DVB_USB_M920X
tristate "Uli m920x DVB-T USB2.0 support"
depends on DVB_USB
select DVB_MT352 if !DVB_FE_CUSTOMISE
- select DVB_TUNER_QT1010 if !DVB_FE_CUSTOMISE
+ select MEDIA_TUNER_QT1010 if !DVB_FE_CUSTOMISE
help
Say Y here to support the MSI Mega Sky 580 USB2.0 DVB-T receiver.
Currently, only devices with a product id of
@@ -129,7 +129,7 @@ config DVB_USB_GL861
tristate "Genesys Logic GL861 USB2.0 support"
depends on DVB_USB
select DVB_ZL10353 if !DVB_FE_CUSTOMISE
- select DVB_TUNER_QT1010 if !DVB_FE_CUSTOMISE
+ select MEDIA_TUNER_QT1010 if !DVB_FE_CUSTOMISE
help
Say Y here to support the MSI Megasky 580 (55801) DVB-T USB2.0
receiver with USB ID 0db0:5581.
@@ -138,7 +138,7 @@ config DVB_USB_AU6610
tristate "Alcor Micro AU6610 USB2.0 support"
depends on DVB_USB
select DVB_ZL10353 if !DVB_FE_CUSTOMISE
- select DVB_TUNER_QT1010 if !DVB_FE_CUSTOMISE
+ select MEDIA_TUNER_QT1010 if !DVB_FE_CUSTOMISE
help
Say Y here to support the Sigmatek DVB-110 DVB-T USB2.0 receiver.
@@ -190,7 +190,7 @@ config DVB_USB_NOVA_T_USB2
tristate "Hauppauge WinTV-NOVA-T usb2 DVB-T USB2.0 support"
depends on DVB_USB
select DVB_DIB3000MC
- select DVB_TUNER_MT2060 if !DVB_FE_CUSTOMISE
+ select MEDIA_TUNER_MT2060 if !DVB_FE_CUSTOMISE
select DVB_PLL if !DVB_FE_CUSTOMISE
help
Say Y here to support the Hauppauge WinTV-NOVA-T usb2 DVB-T USB2.0 receiver.
@@ -227,8 +227,8 @@ config DVB_USB_OPERA1
config DVB_USB_AF9005
tristate "Afatech AF9005 DVB-T USB1.1 support"
depends on DVB_USB && EXPERIMENTAL
- select DVB_TUNER_MT2060 if !DVB_FE_CUSTOMISE
- select DVB_TUNER_QT1010 if !DVB_FE_CUSTOMISE
+ select MEDIA_TUNER_MT2060 if !DVB_FE_CUSTOMISE
+ select MEDIA_TUNER_QT1010 if !DVB_FE_CUSTOMISE
help
Say Y here to support the Afatech AF9005 based DVB-T USB1.1 receiver
and the TerraTec Cinergy T USB XE (Rev.1)
diff --git a/drivers/media/dvb/dvb-usb/Makefile b/drivers/media/dvb/dvb-usb/Makefile
index 60a910052c1..c6511a6c0ab 100644
--- a/drivers/media/dvb/dvb-usb/Makefile
+++ b/drivers/media/dvb/dvb-usb/Makefile
@@ -63,5 +63,5 @@ obj-$(CONFIG_DVB_USB_AF9005_REMOTE) += dvb-usb-af9005-remote.o
EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/
# due to tuner-xc3028
-EXTRA_CFLAGS += -Idrivers/media/video
+EXTRA_CFLAGS += -Idrivers/media/common/tuners
diff --git a/drivers/media/dvb/frontends/Kconfig b/drivers/media/dvb/frontends/Kconfig
index f5fceb3cdb3..6d238460592 100644
--- a/drivers/media/dvb/frontends/Kconfig
+++ b/drivers/media/dvb/frontends/Kconfig
@@ -15,22 +15,36 @@ config DVB_FE_CUSTOMISE
comment "DVB-S (satellite) frontends"
depends on DVB_CORE
-config DVB_STV0299
- tristate "ST STV0299 based"
+config DVB_CX24110
+ tristate "Conexant CX24110 based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
help
A DVB-S tuner module. Say Y when you want to support this frontend.
-config DVB_CX24110
- tristate "Conexant CX24110 based"
+config DVB_CX24123
+ tristate "Conexant CX24123 based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
help
A DVB-S tuner module. Say Y when you want to support this frontend.
-config DVB_CX24123
- tristate "Conexant CX24123 based"
+config DVB_MT312
+ tristate "Zarlink VP310/MT312 based"
+ depends on DVB_CORE && I2C
+ default m if DVB_FE_CUSTOMISE
+ help
+ A DVB-S tuner module. Say Y when you want to support this frontend.
+
+config DVB_S5H1420
+ tristate "Samsung S5H1420 based"
+ depends on DVB_CORE && I2C
+ default m if DVB_FE_CUSTOMISE
+ help
+ A DVB-S tuner module. Say Y when you want to support this frontend.
+
+config DVB_STV0299
+ tristate "ST STV0299 based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
help
@@ -43,8 +57,8 @@ config DVB_TDA8083
help
A DVB-S tuner module. Say Y when you want to support this frontend.
-config DVB_MT312
- tristate "Zarlink VP310/MT312 based"
+config DVB_TDA10086
+ tristate "Philips TDA10086 based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
help
@@ -57,19 +71,26 @@ config DVB_VES1X93
help
A DVB-S tuner module. Say Y when you want to support this frontend.
-config DVB_S5H1420
- tristate "Samsung S5H1420 based"
+config DVB_TUNER_ITD1000
+ tristate "Integrant ITD1000 Zero IF tuner for DVB-S/DSS"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
help
A DVB-S tuner module. Say Y when you want to support this frontend.
-config DVB_TDA10086
- tristate "Philips TDA10086 based"
+config DVB_TDA826X
+ tristate "Philips TDA826X silicon tuner"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
help
- A DVB-S tuner module. Say Y when you want to support this frontend.
+ A DVB-S silicon tuner module. Say Y when you want to support this tuner.
+
+config DVB_TUA6100
+ tristate "Infineon TUA6100 PLL"
+ depends on DVB_CORE && I2C
+ default m if DVB_FE_CUSTOMISE
+ help
+ A DVB-S PLL chip.
comment "DVB-T (terrestrial) frontends"
depends on DVB_CORE
@@ -315,7 +336,7 @@ config DVB_S5H1411
An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want
to support this frontend.
-comment "Tuners/PLL support"
+comment "Digital terrestrial only tuners/PLL"
depends on DVB_CORE
config DVB_PLL
@@ -326,55 +347,6 @@ config DVB_PLL
This module drives a number of tuners based on PLL chips with a
common I2C interface. Say Y when you want to support these tuners.
-config DVB_TDA826X
- tristate "Philips TDA826X silicon tuner"
- depends on DVB_CORE && I2C
- default m if DVB_FE_CUSTOMISE
- help
- A DVB-S silicon tuner module. Say Y when you want to support this tuner.
-
-config DVB_TDA827X
- tristate "Philips TDA827X silicon tuner"
- depends on DVB_CORE && I2C
- default m if DVB_FE_CUSTOMISE
- help
- A DVB-T silicon tuner module. Say Y when you want to support this tuner.
-
-config DVB_TDA18271
- tristate "NXP TDA18271 silicon tuner"
- depends on I2C
- default m if DVB_FE_CUSTOMISE
- help
- A silicon tuner module. Say Y when you want to support this tuner.
-
-config DVB_TUNER_QT1010
- tristate "Quantek QT1010 silicon tuner"
- depends on DVB_CORE && I2C
- default m if DVB_FE_CUSTOMISE
- help
- A driver for the silicon tuner QT1010 from Quantek.
-
-config DVB_TUNER_MT2060
- tristate "Microtune MT2060 silicon IF tuner"
- depends on I2C
- default m if DVB_FE_CUSTOMISE
- help
- A driver for the silicon IF tuner MT2060 from Microtune.
-
-config DVB_TUNER_MT2266
- tristate "Microtune MT2266 silicon tuner"
- depends on I2C
- default m if DVB_FE_CUSTOMISE
- help
- A driver for the silicon baseband tuner MT2266 from Microtune.
-
-config DVB_TUNER_MT2131
- tristate "Microtune MT2131 silicon tuner"
- depends on I2C
- default m if DVB_FE_CUSTOMISE
- help
- A driver for the silicon baseband tuner MT2131 from Microtune.
-
config DVB_TUNER_DIB0070
tristate "DiBcom DiB0070 silicon base-band tuner"
depends on I2C
@@ -384,21 +356,7 @@ config DVB_TUNER_DIB0070
This device is only used inside a SiP called togther with a
demodulator for now.
-config DVB_TUNER_XC5000
- tristate "Xceive XC5000 silicon tuner"
- depends on I2C
- default m if DVB_FE_CUSTOMISE
- help
- A driver for the silicon tuner XC5000 from Xceive.
- This device is only used inside a SiP called togther with a
- demodulator for now.
-
-config DVB_TUNER_ITD1000
- tristate "Integrant ITD1000 Zero IF tuner for DVB-S/DSS"
- depends on DVB_CORE && I2C
- default m if DVB_FE_CUSTOMISE
-
-comment "Miscellaneous devices"
+comment "SEC control devices for DVB-S"
depends on DVB_CORE
config DVB_LNBP21
@@ -422,11 +380,4 @@ config DVB_ISL6421
help
An SEC control chip.
-config DVB_TUA6100
- tristate "TUA6100 PLL"
- depends on DVB_CORE && I2C
- default m if DVB_FE_CUSTOMISE
- help
- A DVBS PLL chip.
-
endmenu
diff --git a/drivers/media/dvb/frontends/Makefile b/drivers/media/dvb/frontends/Makefile
index 9747c73dc82..a89dc0fc4c6 100644
--- a/drivers/media/dvb/frontends/Makefile
+++ b/drivers/media/dvb/frontends/Makefile
@@ -3,9 +3,7 @@
#
EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/
-EXTRA_CFLAGS += -Idrivers/media/video/
-
-tda18271-objs := tda18271-tables.o tda18271-common.o tda18271-fe.o
+EXTRA_CFLAGS += -Idrivers/media/common/tuners/
obj-$(CONFIG_DVB_PLL) += dvb-pll.o
obj-$(CONFIG_DVB_STV0299) += stv0299.o
@@ -42,16 +40,9 @@ obj-$(CONFIG_DVB_ISL6405) += isl6405.o
obj-$(CONFIG_DVB_ISL6421) += isl6421.o
obj-$(CONFIG_DVB_TDA10086) += tda10086.o
obj-$(CONFIG_DVB_TDA826X) += tda826x.o
-obj-$(CONFIG_DVB_TDA827X) += tda827x.o
-obj-$(CONFIG_DVB_TDA18271) += tda18271.o
-obj-$(CONFIG_DVB_TUNER_MT2060) += mt2060.o
-obj-$(CONFIG_DVB_TUNER_MT2266) += mt2266.o
obj-$(CONFIG_DVB_TUNER_DIB0070) += dib0070.o
-obj-$(CONFIG_DVB_TUNER_QT1010) += qt1010.o
obj-$(CONFIG_DVB_TUA6100) += tua6100.o
-obj-$(CONFIG_DVB_TUNER_MT2131) += mt2131.o
obj-$(CONFIG_DVB_S5H1409) += s5h1409.o
-obj-$(CONFIG_DVB_TUNER_XC5000) += xc5000.o
obj-$(CONFIG_DVB_TUNER_ITD1000) += itd1000.o
obj-$(CONFIG_DVB_AU8522) += au8522.o
obj-$(CONFIG_DVB_TDA10048) += tda10048.o
diff --git a/drivers/media/dvb/frontends/mt2060.c b/drivers/media/dvb/frontends/mt2060.c
deleted file mode 100644
index 1305b0e63ce..00000000000
--- a/drivers/media/dvb/frontends/mt2060.c
+++ /dev/null
@@ -1,369 +0,0 @@
-/*
- * Driver for Microtune MT2060 "Single chip dual conversion broadband tuner"
- *
- * Copyright (c) 2006 Olivier DANET <odanet@caramail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.=
- */
-
-/* In that file, frequencies are expressed in kiloHertz to avoid 32 bits overflows */
-
-#include <linux/module.h>
-#include <linux/delay.h>
-#include <linux/dvb/frontend.h>
-#include <linux/i2c.h>
-
-#include "dvb_frontend.h"
-
-#include "mt2060.h"
-#include "mt2060_priv.h"
-
-static int debug;
-module_param(debug, int, 0644);
-MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off).");
-
-#define dprintk(args...) do { if (debug) {printk(KERN_DEBUG "MT2060: " args); printk("\n"); }} while (0)
-
-// Reads a single register
-static int mt2060_readreg(struct mt2060_priv *priv, u8 reg, u8 *val)
-{
- struct i2c_msg msg[2] = {
- { .addr = priv->cfg->i2c_address, .flags = 0, .buf = &reg, .len = 1 },
- { .addr = priv->cfg->i2c_address, .flags = I2C_M_RD, .buf = val, .len = 1 },
- };
-
- if (i2c_transfer(priv->i2c, msg, 2) != 2) {
- printk(KERN_WARNING "mt2060 I2C read failed\n");
- return -EREMOTEIO;
- }
- return 0;
-}
-
-// Writes a single register
-static int mt2060_writereg(struct mt2060_priv *priv, u8 reg, u8 val)
-{
- u8 buf[2] = { reg, val };
- struct i2c_msg msg = {
- .addr = priv->cfg->i2c_address, .flags = 0, .buf = buf, .len = 2
- };
-
- if (i2c_transfer(priv->i2c, &msg, 1) != 1) {
- printk(KERN_WARNING "mt2060 I2C write failed\n");
- return -EREMOTEIO;
- }
- return 0;
-}
-
-// Writes a set of consecutive registers
-static int mt2060_writeregs(struct mt2060_priv *priv,u8 *buf, u8 len)
-{
- struct i2c_msg msg = {
- .addr = priv->cfg->i2c_address, .flags = 0, .buf = buf, .len = len
- };
- if (i2c_transfer(priv->i2c, &msg, 1) != 1) {
- printk(KERN_WARNING "mt2060 I2C write failed (len=%i)\n",(int)len);
- return -EREMOTEIO;
- }
- return 0;
-}
-
-// Initialisation sequences
-// LNABAND=3, NUM1=0x3C, DIV1=0x74, NUM2=0x1080, DIV2=0x49
-static u8 mt2060_config1[] = {
- REG_LO1C1,
- 0x3F, 0x74, 0x00, 0x08, 0x93
-};
-
-// FMCG=2, GP2=0, GP1=0
-static u8 mt2060_config2[] = {
- REG_MISC_CTRL,
- 0x20, 0x1E, 0x30, 0xff, 0x80, 0xff, 0x00, 0x2c, 0x42
-};
-
-// VGAG=3, V1CSE=1
-
-#ifdef MT2060_SPURCHECK
-/* The function below calculates the frequency offset between the output frequency if2
- and the closer cross modulation subcarrier between lo1 and lo2 up to the tenth harmonic */
-static int mt2060_spurcalc(u32 lo1,u32 lo2,u32 if2)
-{
- int I,J;
- int dia,diamin,diff;
- diamin=1000000;
- for (I = 1; I < 10; I++) {
- J = ((2*I*lo1)/lo2+1)/2;
- diff = I*(int)lo1-J*(int)lo2;
- if (diff < 0) diff=-diff;
- dia = (diff-(int)if2);
- if (dia < 0) dia=-dia;
- if (diamin > dia) diamin=dia;
- }
- return diamin;
-}
-
-#define BANDWIDTH 4000 // kHz
-
-/* Calculates the frequency offset to add to avoid spurs. Returns 0 if no offset is needed */
-static int mt2060_spurcheck(u32 lo1,u32 lo2,u32 if2)
-{
- u32 Spur,Sp1,Sp2;
- int I,J;
- I=0;
- J=1000;
-
- Spur=mt2060_spurcalc(lo1,lo2,if2);
- if (Spur < BANDWIDTH) {
- /* Potential spurs detected */
- dprintk("Spurs before : f_lo1: %d f_lo2: %d (kHz)",
- (int)lo1,(int)lo2);
- I=1000;
- Sp1 = mt2060_spurcalc(lo1+I,lo2+I,if2);
- Sp2 = mt2060_spurcalc(lo1-I,lo2-I,if2);
-
- if (Sp1 < Sp2) {
- J=-J; I=-I; Spur=Sp2;
- } else
- Spur=Sp1;
-
- while (Spur < BANDWIDTH) {
- I += J;
- Spur = mt2060_spurcalc(lo1+I,lo2+I,if2);
- }
- dprintk("Spurs after : f_lo1: %d f_lo2: %d (kHz)",
- (int)(lo1+I),(int)(lo2+I));
- }
- return I;
-}
-#endif
-
-#define IF2 36150 // IF2 frequency = 36.150 MHz
-#define FREF 16000 // Quartz oscillator 16 MHz
-
-static int mt2060_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
-{
- struct mt2060_priv *priv;
- int ret=0;
- int i=0;
- u32 freq;
- u8 lnaband;
- u32 f_lo1,f_lo2;
- u32 div1,num1,div2,num2;
- u8 b[8];
- u32 if1;
-
- priv = fe->tuner_priv;
-
- if1 = priv->if1_freq;
- b[0] = REG_LO1B1;
- b[1] = 0xFF;
-
- mt2060_writeregs(priv,b,2);
-
- freq = params->frequency / 1000; // Hz -> kHz
- priv->bandwidth = (fe->ops.info.type == FE_OFDM) ? params->u.ofdm.bandwidth : 0;
-
- f_lo1 = freq + if1 * 1000;
- f_lo1 = (f_lo1 / 250) * 250;
- f_lo2 = f_lo1 - freq - IF2;
- // From the Comtech datasheet, the step used is 50kHz. The tuner chip could be more precise
- f_lo2 = ((f_lo2 + 25) / 50) * 50;
- priv->frequency = (f_lo1 - f_lo2 - IF2) * 1000,
-
-#ifdef MT2060_SPURCHECK
- // LO-related spurs detection and correction
- num1 = mt2060_spurcheck(f_lo1,f_lo2,IF2);
- f_lo1 += num1;
- f_lo2 += num1;
-#endif
- //Frequency LO1 = 16MHz * (DIV1 + NUM1/64 )
- num1 = f_lo1 / (FREF / 64);
- div1 = num1 / 64;
- num1 &= 0x3f;
-
- // Frequency LO2 = 16MHz * (DIV2 + NUM2/8192 )
- num2 = f_lo2 * 64 / (FREF / 128);
- div2 = num2 / 8192;
- num2 &= 0x1fff;
-
- if (freq <= 95000) lnaband = 0xB0; else
- if (freq <= 180000) lnaband = 0xA0; else
- if (freq <= 260000) lnaband = 0x90; else
- if (freq <= 335000) lnaband = 0x80; else
- if (freq <= 425000) lnaband = 0x70; else
- if (freq <= 480000) lnaband = 0x60; else
- if (freq <= 570000) lnaband = 0x50; else
- if (freq <= 645000) lnaband = 0x40; else
- if (freq <= 730000) lnaband = 0x30; else
- if (freq <= 810000) lnaband = 0x20; else lnaband = 0x10;
-
- b[0] = REG_LO1C1;
- b[1] = lnaband | ((num1 >>2) & 0x0F);
- b[2] = div1;
- b[3] = (num2 & 0x0F) | ((num1 & 3) << 4);
- b[4] = num2 >> 4;
- b[5] = ((num2 >>12) & 1) | (div2 << 1);
-
- dprintk("IF1: %dMHz",(int)if1);
- dprintk("PLL freq=%dkHz f_lo1=%dkHz f_lo2=%dkHz",(int)freq,(int)f_lo1,(int)f_lo2);
- dprintk("PLL div1=%d num1=%d div2=%d num2=%d",(int)div1,(int)num1,(int)div2,(int)num2);
- dprintk("PLL [1..5]: %2x %2x %2x %2x %2x",(int)b[1],(int)b[2],(int)b[3],(int)b[4],(int)b[5]);
-
- mt2060_writeregs(priv,b,6);
-
- //Waits for pll lock or timeout
- i = 0;
- do {
- mt2060_readreg(priv,REG_LO_STATUS,b);
- if ((b[0] & 0x88)==0x88)
- break;
- msleep(4);
- i++;
- } while (i<10);
-
- return ret;
-}
-
-static void mt2060_calibrate(struct mt2060_priv *priv)
-{
- u8 b = 0;
- int i = 0;
-
- if (mt2060_writeregs(priv,mt2060_config1,sizeof(mt2060_config1)))
- return;
- if (mt2060_writeregs(priv,mt2060_config2,sizeof(mt2060_config2)))
- return;
-
- /* initialize the clock output */
- mt2060_writereg(priv, REG_VGAG, (priv->cfg->clock_out << 6) | 0x30);
-
- do {
- b |= (1 << 6); // FM1SS;
- mt2060_writereg(priv, REG_LO2C1,b);
- msleep(20);
-
- if (i == 0) {
- b |= (1 << 7); // FM1CA;
- mt2060_writereg(priv, REG_LO2C1,b);
- b &= ~(1 << 7); // FM1CA;
- msleep(20);
- }
-
- b &= ~(1 << 6); // FM1SS
- mt2060_writereg(priv, REG_LO2C1,b);
-
- msleep(20);
- i++;
- } while (i < 9);
-
- i = 0;
- while (i++ < 10 && mt2060_readreg(priv, REG_MISC_STAT, &b) == 0 && (b & (1 << 6)) == 0)
- msleep(20);
-
- if (i < 10) {
- mt2060_readreg(priv, REG_FM_FREQ, &priv->fmfreq); // now find out, what is fmreq used for :)
- dprintk("calibration was successful: %d", (int)priv->fmfreq);
- } else
- dprintk("FMCAL timed out");
-}
-
-static int mt2060_get_frequency(struct dvb_frontend *fe, u32 *frequency)
-{
- struct mt2060_priv *priv = fe->tuner_priv;
- *frequency = priv->frequency;
- return 0;
-}
-
-static int mt2060_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
-{
- struct mt2060_priv *priv = fe->tuner_priv;
- *bandwidth = priv->bandwidth;
- return 0;
-}
-
-static int mt2060_init(struct dvb_frontend *fe)
-{
- struct mt2060_priv *priv = fe->tuner_priv;
- return mt2060_writereg(priv, REG_VGAG, (priv->cfg->clock_out << 6) | 0x33);
-}
-
-static int mt2060_sleep(struct dvb_frontend *fe)
-{
- struct mt2060_priv *priv = fe->tuner_priv;
- return mt2060_writereg(priv, REG_VGAG, (priv->cfg->clock_out << 6) | 0x30);
-}
-
-static int mt2060_release(struct dvb_frontend *fe)
-{
- kfree(fe->tuner_priv);
- fe->tuner_priv = NULL;
- return 0;
-}
-
-static const struct dvb_tuner_ops mt2060_tuner_ops = {
- .info = {
- .name = "Microtune MT2060",
- .frequency_min = 48000000,
- .frequency_max = 860000000,
- .frequency_step = 50000,
- },
-
- .release = mt2060_release,
-
- .init = mt2060_init,
- .sleep = mt2060_sleep,
-
- .set_params = mt2060_set_params,
- .get_frequency = mt2060_get_frequency,
- .get_bandwidth = mt2060_get_bandwidth
-};
-
-/* This functions tries to identify a MT2060 tuner by reading the PART/REV register. This is hasty. */
-struct dvb_frontend * mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2060_config *cfg, u16 if1)
-{
- struct mt2060_priv *priv = NULL;
- u8 id = 0;
-
- priv = kzalloc(sizeof(struct mt2060_priv), GFP_KERNEL);
- if (priv == NULL)
- return NULL;
-
- priv->cfg = cfg;
- priv->i2c = i2c;
- priv->if1_freq = if1;
-
- if (mt2060_readreg(priv,REG_PART_REV,&id) != 0) {
- kfree(priv);
- return NULL;
- }
-
- if (id != PART_REV) {
- kfree(priv);
- return NULL;
- }
- printk(KERN_INFO "MT2060: successfully identified (IF1 = %d)\n", if1);
- memcpy(&fe->ops.tuner_ops, &mt2060_tuner_ops, sizeof(struct dvb_tuner_ops));
-
- fe->tuner_priv = priv;
-
- mt2060_calibrate(priv);
-
- return fe;
-}
-EXPORT_SYMBOL(mt2060_attach);
-
-MODULE_AUTHOR("Olivier DANET");
-MODULE_DESCRIPTION("Microtune MT2060 silicon tuner driver");
-MODULE_LICENSE("GPL");
diff --git a/drivers/media/dvb/frontends/mt2060.h b/drivers/media/dvb/frontends/mt2060.h
deleted file mode 100644
index acba0058f51..00000000000
--- a/drivers/media/dvb/frontends/mt2060.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Driver for Microtune MT2060 "Single chip dual conversion broadband tuner"
- *
- * Copyright (c) 2006 Olivier DANET <odanet@caramail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.=
- */
-
-#ifndef MT2060_H
-#define MT2060_H
-
-struct dvb_frontend;
-struct i2c_adapter;
-
-struct mt2060_config {
- u8 i2c_address;
- u8 clock_out; /* 0 = off, 1 = CLK/4, 2 = CLK/2, 3 = CLK/1 */
-};
-
-#if defined(CONFIG_DVB_TUNER_MT2060) || (defined(CONFIG_DVB_TUNER_MT2060_MODULE) && defined(MODULE))
-extern struct dvb_frontend * mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2060_config *cfg, u16 if1);
-#else
-static inline struct dvb_frontend * mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2060_config *cfg, u16 if1)
-{
- printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
- return NULL;
-}
-#endif // CONFIG_DVB_TUNER_MT2060
-
-#endif
diff --git a/drivers/media/dvb/frontends/mt2060_priv.h b/drivers/media/dvb/frontends/mt2060_priv.h
deleted file mode 100644
index 5eaccdefd0b..00000000000
--- a/drivers/media/dvb/frontends/mt2060_priv.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Driver for Microtune MT2060 "Single chip dual conversion broadband tuner"
- *
- * Copyright (c) 2006 Olivier DANET <odanet@caramail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.=
- */
-
-#ifndef MT2060_PRIV_H
-#define MT2060_PRIV_H
-
-// Uncomment the #define below to enable spurs checking. The results where quite unconvincing.
-// #define MT2060_SPURCHECK
-
-/* This driver is based on the information available in the datasheet of the
- "Comtech SDVBT-3K6M" tuner ( K1000737843.pdf ) which features the MT2060 register map :
-
- I2C Address : 0x60
-
- Reg.No | B7 | B6 | B5 | B4 | B3 | B2 | B1 | B0 | ( defaults )
- --------------------------------------------------------------------------------
- 00 | [ PART ] | [ REV ] | R = 0x63
- 01 | [ LNABAND ] | [ NUM1(5:2) ] | RW = 0x3F
- 02 | [ DIV1 ] | RW = 0x74
- 03 | FM1CA | FM1SS | [ NUM1(1:0) ] | [ NUM2(3:0) ] | RW = 0x00
- 04 | NUM2(11:4) ] | RW = 0x08
- 05 | [ DIV2 ] |NUM2(12)| RW = 0x93
- 06 | L1LK | [ TAD1 ] | L2LK | [ TAD2 ] | R
- 07 | [ FMF ] | R
- 08 | ? | FMCAL | ? | ? | ? | ? | ? | TEMP | R
- 09 | 0 | 0 | [ FMGC ] | 0 | GP02 | GP01 | 0 | RW = 0x20
- 0A | ??
- 0B | 0 | 0 | 1 | 1 | 0 | 0 | [ VGAG ] | RW = 0x30
- 0C | V1CSE | 1 | 1 | 1 | 1 | 1 | 1 | 1 | RW = 0xFF
- 0D | 1 | 0 | [ V1CS ] | RW = 0xB0
- 0E | ??
- 0F | ??
- 10 | ??
- 11 | [ LOTO ] | 0 | 0 | 1 | 0 | RW = 0x42
-
- PART : Part code : 6 for MT2060
- REV : Revision code : 3 for current revision
- LNABAND : Input frequency range : ( See code for details )
- NUM1 / DIV1 / NUM2 / DIV2 : Frequencies programming ( See code for details )
- FM1CA : Calibration Start Bit
- FM1SS : Calibration Single Step bit
- L1LK : LO1 Lock Detect
- TAD1 : Tune Line ADC ( ? )
- L2LK : LO2 Lock Detect
- TAD2 : Tune Line ADC ( ? )
- FMF : Estimated first IF Center frequency Offset ( ? )
- FM1CAL : Calibration done bit
- TEMP : On chip temperature sensor
- FMCG : Mixer 1 Cap Gain ( ? )
- GP01 / GP02 : Programmable digital outputs. Unconnected pins ?
- V1CSE : LO1 VCO Automatic Capacitor Select Enable ( ? )
- V1CS : LO1 Capacitor Selection Value ( ? )
- LOTO : LO Timeout ( ? )
- VGAG : Tuner Output gain
-*/
-
-#define I2C_ADDRESS 0x60
-
-#define REG_PART_REV 0
-#define REG_LO1C1 1
-#define REG_LO1C2 2
-#define REG_LO2C1 3
-#define REG_LO2C2 4
-#define REG_LO2C3 5
-#define REG_LO_STATUS 6
-#define REG_FM_FREQ 7
-#define REG_MISC_STAT 8
-#define REG_MISC_CTRL 9
-#define REG_RESERVED_A 0x0A
-#define REG_VGAG 0x0B
-#define REG_LO1B1 0x0C
-#define REG_LO1B2 0x0D
-#define REG_LOTO 0x11
-
-#define PART_REV 0x63 // The current driver works only with PART=6 and REV=3 chips
-
-struct mt2060_priv {
- struct mt2060_config *cfg;
- struct i2c_adapter *i2c;
-
- u32 frequency;
- u32 bandwidth;
- u16 if1_freq;
- u8 fmfreq;
-};
-
-#endif
diff --git a/drivers/media/dvb/frontends/mt2131.c b/drivers/media/dvb/frontends/mt2131.c
deleted file mode 100644
index e254bcfc2ef..00000000000
--- a/drivers/media/dvb/frontends/mt2131.c
+++ /dev/null
@@ -1,314 +0,0 @@
-/*
- * Driver for Microtune MT2131 "QAM/8VSB single chip tuner"
- *
- * Copyright (c) 2006 Steven Toth <stoth@hauppauge.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <linux/module.h>
-#include <linux/delay.h>
-#include <linux/dvb/frontend.h>
-#include <linux/i2c.h>
-
-#include "dvb_frontend.h"
-
-#include "mt2131.h"
-#include "mt2131_priv.h"
-
-static int debug;
-module_param(debug, int, 0644);
-MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off).");
-
-#define dprintk(level,fmt, arg...) if (debug >= level) \
- printk(KERN_INFO "%s: " fmt, "mt2131", ## arg)
-
-static u8 mt2131_config1[] = {
- 0x01,
- 0x50, 0x00, 0x50, 0x80, 0x00, 0x49, 0xfa, 0x88,
- 0x08, 0x77, 0x41, 0x04, 0x00, 0x00, 0x00, 0x32,
- 0x7f, 0xda, 0x4c, 0x00, 0x10, 0xaa, 0x78, 0x80,
- 0xff, 0x68, 0xa0, 0xff, 0xdd, 0x00, 0x00
-};
-
-static u8 mt2131_config2[] = {
- 0x10,
- 0x7f, 0xc8, 0x0a, 0x5f, 0x00, 0x04
-};
-
-static int mt2131_readreg(struct mt2131_priv *priv, u8 reg, u8 *val)
-{
- struct i2c_msg msg[2] = {
- { .addr = priv->cfg->i2c_address, .flags = 0,
- .buf = &reg, .len = 1 },
- { .addr = priv->cfg->i2c_address, .flags = I2C_M_RD,
- .buf = val, .len = 1 },
- };
-
- if (i2c_transfer(priv->i2c, msg, 2) != 2) {
- printk(KERN_WARNING "mt2131 I2C read failed\n");
- return -EREMOTEIO;
- }
- return 0;
-}
-
-static int mt2131_writereg(struct mt2131_priv *priv, u8 reg, u8 val)
-{
- u8 buf[2] = { reg, val };
- struct i2c_msg msg = { .addr = priv->cfg->i2c_address, .flags = 0,
- .buf = buf, .len = 2 };
-
- if (i2c_transfer(priv->i2c, &msg, 1) != 1) {
- printk(KERN_WARNING "mt2131 I2C write failed\n");
- return -EREMOTEIO;
- }
- return 0;
-}
-
-static int mt2131_writeregs(struct mt2131_priv *priv,u8 *buf, u8 len)
-{
- struct i2c_msg msg = { .addr = priv->cfg->i2c_address,
- .flags = 0, .buf = buf, .len = len };
-
- if (i2c_transfer(priv->i2c, &msg, 1) != 1) {
- printk(KERN_WARNING "mt2131 I2C write failed (len=%i)\n",
- (int)len);
- return -EREMOTEIO;
- }
- return 0;
-}
-
-static int mt2131_set_params(struct dvb_frontend *fe,
- struct dvb_frontend_parameters *params)
-{
- struct mt2131_priv *priv;
- int ret=0, i;
- u32 freq;
- u8 if_band_center;
- u32 f_lo1, f_lo2;
- u32 div1, num1, div2, num2;
- u8 b[8];
- u8 lockval = 0;
-
- priv = fe->tuner_priv;
- if (fe->ops.info.type == FE_OFDM)
- priv->bandwidth = params->u.ofdm.bandwidth;
- else
- priv->bandwidth = 0;
-
- freq = params->frequency / 1000; // Hz -> kHz
- dprintk(1, "%s() freq=%d\n", __func__, freq);
-
- f_lo1 = freq + MT2131_IF1 * 1000;
- f_lo1 = (f_lo1 / 250) * 250;
- f_lo2 = f_lo1 - freq - MT2131_IF2;
-
- priv->frequency = (f_lo1 - f_lo2 - MT2131_IF2) * 1000;
-
- /* Frequency LO1 = 16MHz * (DIV1 + NUM1/8192 ) */
- num1 = f_lo1 * 64 / (MT2131_FREF / 128);
- div1 = num1 / 8192;
- num1 &= 0x1fff;
-
- /* Frequency LO2 = 16MHz * (DIV2 + NUM2/8192 ) */
- num2 = f_lo2 * 64 / (MT2131_FREF / 128);
- div2 = num2 / 8192;
- num2 &= 0x1fff;
-
- if (freq <= 82500) if_band_center = 0x00; else
- if (freq <= 137500) if_band_center = 0x01; else
- if (freq <= 192500) if_band_center = 0x02; else
- if (freq <= 247500) if_band_center = 0x03; else
- if (freq <= 302500) if_band_center = 0x04; else
- if (freq <= 357500) if_band_center = 0x05; else
- if (freq <= 412500) if_band_center = 0x06; else
- if (freq <= 467500) if_band_center = 0x07; else
- if (freq <= 522500) if_band_center = 0x08; else
- if (freq <= 577500) if_band_center = 0x09; else
- if (freq <= 632500) if_band_center = 0x0A; else
- if (freq <= 687500) if_band_center = 0x0B; else
- if (freq <= 742500) if_band_center = 0x0C; else
- if (freq <= 797500) if_band_center = 0x0D; else
- if (freq <= 852500) if_band_center = 0x0E; else
- if (freq <= 907500) if_band_center = 0x0F; else
- if (freq <= 962500) if_band_center = 0x10; else
- if (freq <= 1017500) if_band_center = 0x11; else
- if (freq <= 1072500) if_band_center = 0x12; else if_band_center = 0x13;
-
- b[0] = 1;
- b[1] = (num1 >> 5) & 0xFF;
- b[2] = (num1 & 0x1F);
- b[3] = div1;
- b[4] = (num2 >> 5) & 0xFF;
- b[5] = num2 & 0x1F;
- b[6] = div2;
-
- dprintk(1, "IF1: %dMHz IF2: %dMHz\n", MT2131_IF1, MT2131_IF2);
- dprintk(1, "PLL freq=%dkHz band=%d\n", (int)freq, (int)if_band_center);
- dprintk(1, "PLL f_lo1=%dkHz f_lo2=%dkHz\n", (int)f_lo1, (int)f_lo2);
- dprintk(1, "PLL div1=%d num1=%d div2=%d num2=%d\n",
- (int)div1, (int)num1, (int)div2, (int)num2);
- dprintk(1, "PLL [1..6]: %2x %2x %2x %2x %2x %2x\n",
- (int)b[1], (int)b[2], (int)b[3], (int)b[4], (int)b[5],
- (int)b[6]);
-
- ret = mt2131_writeregs(priv,b,7);
- if (ret < 0)
- return ret;
-
- mt2131_writereg(priv, 0x0b, if_band_center);
-
- /* Wait for lock */
- i = 0;
- do {
- mt2131_readreg(priv, 0x08, &lockval);
- if ((lockval & 0x88) == 0x88)
- break;
- msleep(4);
- i++;
- } while (i < 10);
-
- return ret;
-}
-
-static int mt2131_get_frequency(struct dvb_frontend *fe, u32 *frequency)
-{
- struct mt2131_priv *priv = fe->tuner_priv;
- dprintk(1, "%s()\n", __func__);
- *frequency = priv->frequency;
- return 0;
-}
-
-static int mt2131_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
-{
- struct mt2131_priv *priv = fe->tuner_priv;
- dprintk(1, "%s()\n", __func__);
- *bandwidth = priv->bandwidth;
- return 0;
-}
-
-static int mt2131_get_status(struct dvb_frontend *fe, u32 *status)
-{
- struct mt2131_priv *priv = fe->tuner_priv;
- u8 lock_status = 0;
- u8 afc_status = 0;
-
- *status = 0;
-
- mt2131_readreg(priv, 0x08, &lock_status);
- if ((lock_status & 0x88) == 0x88)
- *status = TUNER_STATUS_LOCKED;
-
- mt2131_readreg(priv, 0x09, &afc_status);
- dprintk(1, "%s() - LO Status = 0x%x, AFC Status = 0x%x\n",
- __func__, lock_status, afc_status);
-
- return 0;
-}
-
-static int mt2131_init(struct dvb_frontend *fe)
-{
- struct mt2131_priv *priv = fe->tuner_priv;
- int ret;
- dprintk(1, "%s()\n", __func__);
-
- if ((ret = mt2131_writeregs(priv, mt2131_config1,
- sizeof(mt2131_config1))) < 0)
- return ret;
-
- mt2131_writereg(priv, 0x0b, 0x09);
- mt2131_writereg(priv, 0x15, 0x47);
- mt2131_writereg(priv, 0x07, 0xf2);
- mt2131_writereg(priv, 0x0b, 0x01);
-
- if ((ret = mt2131_writeregs(priv, mt2131_config2,
- sizeof(mt2131_config2))) < 0)
- return ret;
-
- return ret;
-}
-
-static int mt2131_release(struct dvb_frontend *fe)
-{
- dprintk(1, "%s()\n", __func__);
- kfree(fe->tuner_priv);
- fe->tuner_priv = NULL;
- return 0;
-}
-
-static const struct dvb_tuner_ops mt2131_tuner_ops = {
- .info = {
- .name = "Microtune MT2131",
- .frequency_min = 48000000,
- .frequency_max = 860000000,
- .frequency_step = 50000,
- },
-
- .release = mt2131_release,
- .init = mt2131_init,
-
- .set_params = mt2131_set_params,
- .get_frequency = mt2131_get_frequency,
- .get_bandwidth = mt2131_get_bandwidth,
- .get_status = mt2131_get_status
-};
-
-struct dvb_frontend * mt2131_attach(struct dvb_frontend *fe,
- struct i2c_adapter *i2c,
- struct mt2131_config *cfg, u16 if1)
-{
- struct mt2131_priv *priv = NULL;
- u8 id = 0;
-
- dprintk(1, "%s()\n", __func__);
-
- priv = kzalloc(sizeof(struct mt2131_priv), GFP_KERNEL);
- if (priv == NULL)
- return NULL;
-
- priv->cfg = cfg;
- priv->bandwidth = 6000000; /* 6MHz */
- priv->i2c = i2c;
-
- if (mt2131_readreg(priv, 0, &id) != 0) {
- kfree(priv);
- return NULL;
- }
- if ( (id != 0x3E) && (id != 0x3F) ) {
- printk(KERN_ERR "MT2131: Device not found at addr 0x%02x\n",
- cfg->i2c_address);
- kfree(priv);
- return NULL;
- }
-
- printk(KERN_INFO "MT2131: successfully identified at address 0x%02x\n",
- cfg->i2c_address);
- memcpy(&fe->ops.tuner_ops, &mt2131_tuner_ops,
- sizeof(struct dvb_tuner_ops));
-
- fe->tuner_priv = priv;
- return fe;
-}
-EXPORT_SYMBOL(mt2131_attach);
-
-MODULE_AUTHOR("Steven Toth");
-MODULE_DESCRIPTION("Microtune MT2131 silicon tuner driver");
-MODULE_LICENSE("GPL");
-
-/*
- * Local variables:
- * c-basic-offset: 8
- */
diff --git a/drivers/media/dvb/frontends/mt2131.h b/drivers/media/dvb/frontends/mt2131.h
deleted file mode 100644
index 606d8576bc9..00000000000
--- a/drivers/media/dvb/frontends/mt2131.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Driver for Microtune MT2131 "QAM/8VSB single chip tuner"
- *
- * Copyright (c) 2006 Steven Toth <stoth@hauppauge.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef __MT2131_H__
-#define __MT2131_H__
-
-struct dvb_frontend;
-struct i2c_adapter;
-
-struct mt2131_config {
- u8 i2c_address;
- u8 clock_out; /* 0 = off, 1 = CLK/4, 2 = CLK/2, 3 = CLK/1 */
-};
-
-#if defined(CONFIG_DVB_TUNER_MT2131) || (defined(CONFIG_DVB_TUNER_MT2131_MODULE) && defined(MODULE))
-extern struct dvb_frontend* mt2131_attach(struct dvb_frontend *fe,
- struct i2c_adapter *i2c,
- struct mt2131_config *cfg,
- u16 if1);
-#else
-static inline struct dvb_frontend* mt2131_attach(struct dvb_frontend *fe,
- struct i2c_adapter *i2c,
- struct mt2131_config *cfg,
- u16 if1)
-{
- printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
- return NULL;
-}
-#endif /* CONFIG_DVB_TUNER_MT2131 */
-
-#endif /* __MT2131_H__ */
-
-/*
- * Local variables:
- * c-basic-offset: 8
- */
diff --git a/drivers/media/dvb/frontends/mt2131_priv.h b/drivers/media/dvb/frontends/mt2131_priv.h
deleted file mode 100644
index e930759c2c0..00000000000
--- a/drivers/media/dvb/frontends/mt2131_priv.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Driver for Microtune MT2131 "QAM/8VSB single chip tuner"
- *
- * Copyright (c) 2006 Steven Toth <stoth@hauppauge.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef __MT2131_PRIV_H__
-#define __MT2131_PRIV_H__
-
-/* Regs */
-#define MT2131_PWR 0x07
-#define MT2131_UPC_1 0x0b
-#define MT2131_AGC_RL 0x10
-#define MT2131_MISC_2 0x15
-
-/* frequency values in KHz */
-#define MT2131_IF1 1220
-#define MT2131_IF2 44000
-#define MT2131_FREF 16000
-
-struct mt2131_priv {
- struct mt2131_config *cfg;
- struct i2c_adapter *i2c;
-
- u32 frequency;
- u32 bandwidth;
-};
-
-#endif /* __MT2131_PRIV_H__ */
-
-/*
- * Local variables:
- * c-basic-offset: 8
- */
diff --git a/drivers/media/dvb/frontends/mt2266.c b/drivers/media/dvb/frontends/mt2266.c
deleted file mode 100644
index 54b18f94b14..00000000000
--- a/drivers/media/dvb/frontends/mt2266.c
+++ /dev/null
@@ -1,351 +0,0 @@
-/*
- * Driver for Microtune MT2266 "Direct conversion low power broadband tuner"
- *
- * Copyright (c) 2007 Olivier DANET <odanet@caramail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-#include <linux/module.h>
-#include <linux/delay.h>
-#include <linux/dvb/frontend.h>
-#include <linux/i2c.h>
-
-#include "dvb_frontend.h"
-#include "mt2266.h"
-
-#define I2C_ADDRESS 0x60
-
-#define REG_PART_REV 0
-#define REG_TUNE 1
-#define REG_BAND 6
-#define REG_BANDWIDTH 8
-#define REG_LOCK 0x12
-
-#define PART_REV 0x85
-
-struct mt2266_priv {
- struct mt2266_config *cfg;
- struct i2c_adapter *i2c;
-
- u32 frequency;
- u32 bandwidth;
- u8 band;
-};
-
-#define MT2266_VHF 1
-#define MT2266_UHF 0
-
-/* Here, frequencies are expressed in kiloHertz to avoid 32 bits overflows */
-
-static int debug;
-module_param(debug, int, 0644);
-MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off).");
-
-#define dprintk(args...) do { if (debug) {printk(KERN_DEBUG "MT2266: " args); printk("\n"); }} while (0)
-
-// Reads a single register
-static int mt2266_readreg(struct mt2266_priv *priv, u8 reg, u8 *val)
-{
- struct i2c_msg msg[2] = {
- { .addr = priv->cfg->i2c_address, .flags = 0, .buf = &reg, .len = 1 },
- { .addr = priv->cfg->i2c_address, .flags = I2C_M_RD, .buf = val, .len = 1 },
- };
- if (i2c_transfer(priv->i2c, msg, 2) != 2) {
- printk(KERN_WARNING "MT2266 I2C read failed\n");
- return -EREMOTEIO;
- }
- return 0;
-}
-
-// Writes a single register
-static int mt2266_writereg(struct mt2266_priv *priv, u8 reg, u8 val)
-{
- u8 buf[2] = { reg, val };
- struct i2c_msg msg = {
- .addr = priv->cfg->i2c_address, .flags = 0, .buf = buf, .len = 2
- };
- if (i2c_transfer(priv->i2c, &msg, 1) != 1) {
- printk(KERN_WARNING "MT2266 I2C write failed\n");
- return -EREMOTEIO;
- }
- return 0;
-}
-
-// Writes a set of consecutive registers
-static int mt2266_writeregs(struct mt2266_priv *priv,u8 *buf, u8 len)
-{
- struct i2c_msg msg = {
- .addr = priv->cfg->i2c_address, .flags = 0, .buf = buf, .len = len
- };
- if (i2c_transfer(priv->i2c, &msg, 1) != 1) {
- printk(KERN_WARNING "MT2266 I2C write failed (len=%i)\n",(int)len);
- return -EREMOTEIO;
- }
- return 0;
-}
-
-// Initialisation sequences
-static u8 mt2266_init1[] = { REG_TUNE, 0x00, 0x00, 0x28,
- 0x00, 0x52, 0x99, 0x3f };
-
-static u8 mt2266_init2[] = {
- 0x17, 0x6d, 0x71, 0x61, 0xc0, 0xbf, 0xff, 0xdc, 0x00, 0x0a, 0xd4,
- 0x03, 0x64, 0x64, 0x64, 0x64, 0x22, 0xaa, 0xf2, 0x1e, 0x80, 0x14,
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x7f, 0x5e, 0x3f, 0xff, 0xff,
- 0xff, 0x00, 0x77, 0x0f, 0x2d
-};
-
-static u8 mt2266_init_8mhz[] = { REG_BANDWIDTH, 0x22, 0x22, 0x22, 0x22,
- 0x22, 0x22, 0x22, 0x22 };
-
-static u8 mt2266_init_7mhz[] = { REG_BANDWIDTH, 0x32, 0x32, 0x32, 0x32,
- 0x32, 0x32, 0x32, 0x32 };
-
-static u8 mt2266_init_6mhz[] = { REG_BANDWIDTH, 0xa7, 0xa7, 0xa7, 0xa7,
- 0xa7, 0xa7, 0xa7, 0xa7 };
-
-static u8 mt2266_uhf[] = { 0x1d, 0xdc, 0x00, 0x0a, 0xd4, 0x03, 0x64, 0x64,
- 0x64, 0x64, 0x22, 0xaa, 0xf2, 0x1e, 0x80, 0x14 };
-
-static u8 mt2266_vhf[] = { 0x1d, 0xfe, 0x00, 0x00, 0xb4, 0x03, 0xa5, 0xa5,
- 0xa5, 0xa5, 0x82, 0xaa, 0xf1, 0x17, 0x80, 0x1f };
-
-#define FREF 30000 // Quartz oscillator 30 MHz
-
-static int mt2266_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
-{
- struct mt2266_priv *priv;
- int ret=0;
- u32 freq;
- u32 tune;
- u8 lnaband;
- u8 b[10];
- int i;
- u8 band;
-
- priv = fe->tuner_priv;
-
- freq = params->frequency / 1000; // Hz -> kHz
- if (freq < 470000 && freq > 230000)
- return -EINVAL; /* Gap between VHF and UHF bands */
- priv->bandwidth = (fe->ops.info.type == FE_OFDM) ? params->u.ofdm.bandwidth : 0;
- priv->frequency = freq * 1000;
-
- tune = 2 * freq * (8192/16) / (FREF/16);
- band = (freq < 300000) ? MT2266_VHF : MT2266_UHF;
- if (band == MT2266_VHF)
- tune *= 2;
-
- switch (params->u.ofdm.bandwidth) {
- case BANDWIDTH_6_MHZ:
- mt2266_writeregs(priv, mt2266_init_6mhz,
- sizeof(mt2266_init_6mhz));
- break;
- case BANDWIDTH_7_MHZ:
- mt2266_writeregs(priv, mt2266_init_7mhz,
- sizeof(mt2266_init_7mhz));
- break;
- case BANDWIDTH_8_MHZ:
- default:
- mt2266_writeregs(priv, mt2266_init_8mhz,
- sizeof(mt2266_init_8mhz));
- break;
- }
-
- if (band == MT2266_VHF && priv->band == MT2266_UHF) {
- dprintk("Switch from UHF to VHF");
- mt2266_writereg(priv, 0x05, 0x04);
- mt2266_writereg(priv, 0x19, 0x61);
- mt2266_writeregs(priv, mt2266_vhf, sizeof(mt2266_vhf));
- } else if (band == MT2266_UHF && priv->band == MT2266_VHF) {
- dprintk("Switch from VHF to UHF");
- mt2266_writereg(priv, 0x05, 0x52);
- mt2266_writereg(priv, 0x19, 0x61);
- mt2266_writeregs(priv, mt2266_uhf, sizeof(mt2266_uhf));
- }
- msleep(10);
-
- if (freq <= 495000)
- lnaband = 0xEE;
- else if (freq <= 525000)
- lnaband = 0xDD;
- else if (freq <= 550000)
- lnaband = 0xCC;
- else if (freq <= 580000)
- lnaband = 0xBB;
- else if (freq <= 605000)
- lnaband = 0xAA;
- else if (freq <= 630000)
- lnaband = 0x99;
- else if (freq <= 655000)
- lnaband = 0x88;
- else if (freq <= 685000)
- lnaband = 0x77;
- else if (freq <= 710000)
- lnaband = 0x66;
- else if (freq <= 735000)
- lnaband = 0x55;
- else if (freq <= 765000)
- lnaband = 0x44;
- else if (freq <= 802000)
- lnaband = 0x33;
- else if (freq <= 840000)
- lnaband = 0x22;
- else
- lnaband = 0x11;
-
- b[0] = REG_TUNE;
- b[1] = (tune >> 8) & 0x1F;
- b[2] = tune & 0xFF;
- b[3] = tune >> 13;
- mt2266_writeregs(priv,b,4);
-
- dprintk("set_parms: tune=%d band=%d %s",
- (int) tune, (int) lnaband,
- (band == MT2266_UHF) ? "UHF" : "VHF");
- dprintk("set_parms: [1..3]: %2x %2x %2x",
- (int) b[1], (int) b[2], (int)b[3]);
-
- if (band == MT2266_UHF) {
- b[0] = 0x05;
- b[1] = (priv->band == MT2266_VHF) ? 0x52 : 0x62;
- b[2] = lnaband;
- mt2266_writeregs(priv, b, 3);
- }
-
- /* Wait for pll lock or timeout */
- i = 0;
- do {
- mt2266_readreg(priv,REG_LOCK,b);
- if (b[0] & 0x40)
- break;
- msleep(10);
- i++;
- } while (i<10);
- dprintk("Lock when i=%i",(int)i);
-
- if (band == MT2266_UHF && priv->band == MT2266_VHF)
- mt2266_writereg(priv, 0x05, 0x62);
-
- priv->band = band;
-
- return ret;
-}
-
-static void mt2266_calibrate(struct mt2266_priv *priv)
-{
- mt2266_writereg(priv, 0x11, 0x03);
- mt2266_writereg(priv, 0x11, 0x01);
- mt2266_writeregs(priv, mt2266_init1, sizeof(mt2266_init1));
- mt2266_writeregs(priv, mt2266_init2, sizeof(mt2266_init2));
- mt2266_writereg(priv, 0x33, 0x5e);
- mt2266_writereg(priv, 0x10, 0x10);
- mt2266_writereg(priv, 0x10, 0x00);
- mt2266_writeregs(priv, mt2266_init_8mhz, sizeof(mt2266_init_8mhz));
- msleep(25);
- mt2266_writereg(priv, 0x17, 0x6d);
- mt2266_writereg(priv, 0x1c, 0x00);
- msleep(75);
- mt2266_writereg(priv, 0x17, 0x6d);
- mt2266_writereg(priv, 0x1c, 0xff);
-}
-
-static int mt2266_get_frequency(struct dvb_frontend *fe, u32 *frequency)
-{
- struct mt2266_priv *priv = fe->tuner_priv;
- *frequency = priv->frequency;
- return 0;
-}
-
-static int mt2266_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
-{
- struct mt2266_priv *priv = fe->tuner_priv;
- *bandwidth = priv->bandwidth;
- return 0;
-}
-
-static int mt2266_init(struct dvb_frontend *fe)
-{
- int ret;
- struct mt2266_priv *priv = fe->tuner_priv;
- ret = mt2266_writereg(priv, 0x17, 0x6d);
- if (ret < 0)
- return ret;
- ret = mt2266_writereg(priv, 0x1c, 0xff);
- if (ret < 0)
- return ret;
- return 0;
-}
-
-static int mt2266_sleep(struct dvb_frontend *fe)
-{
- struct mt2266_priv *priv = fe->tuner_priv;
- mt2266_writereg(priv, 0x17, 0x6d);
- mt2266_writereg(priv, 0x1c, 0x00);
- return 0;
-}
-
-static int mt2266_release(struct dvb_frontend *fe)
-{
- kfree(fe->tuner_priv);
- fe->tuner_priv = NULL;
- return 0;
-}
-
-static const struct dvb_tuner_ops mt2266_tuner_ops = {
- .info = {
- .name = "Microtune MT2266",
- .frequency_min = 174000000,
- .frequency_max = 862000000,
- .frequency_step = 50000,
- },
- .release = mt2266_release,
- .init = mt2266_init,
- .sleep = mt2266_sleep,
- .set_params = mt2266_set_params,
- .get_frequency = mt2266_get_frequency,
- .get_bandwidth = mt2266_get_bandwidth
-};
-
-struct dvb_frontend * mt2266_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2266_config *cfg)
-{
- struct mt2266_priv *priv = NULL;
- u8 id = 0;
-
- priv = kzalloc(sizeof(struct mt2266_priv), GFP_KERNEL);
- if (priv == NULL)
- return NULL;
-
- priv->cfg = cfg;
- priv->i2c = i2c;
- priv->band = MT2266_UHF;
-
- if (mt2266_readreg(priv, 0, &id)) {
- kfree(priv);
- return NULL;
- }
- if (id != PART_REV) {
- kfree(priv);
- return NULL;
- }
- printk(KERN_INFO "MT2266: successfully identified\n");
- memcpy(&fe->ops.tuner_ops, &mt2266_tuner_ops, sizeof(struct dvb_tuner_ops));
-
- fe->tuner_priv = priv;
- mt2266_calibrate(priv);
- return fe;
-}
-EXPORT_SYMBOL(mt2266_attach);
-
-MODULE_AUTHOR("Olivier DANET");
-MODULE_DESCRIPTION("Microtune MT2266 silicon tuner driver");
-MODULE_LICENSE("GPL");
diff --git a/drivers/media/dvb/frontends/mt2266.h b/drivers/media/dvb/frontends/mt2266.h
deleted file mode 100644
index c5113efe333..00000000000
--- a/drivers/media/dvb/frontends/mt2266.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Driver for Microtune MT2266 "Direct conversion low power broadband tuner"
- *
- * Copyright (c) 2007 Olivier DANET <odanet@caramail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-#ifndef MT2266_H
-#define MT2266_H
-
-struct dvb_frontend;
-struct i2c_adapter;
-
-struct mt2266_config {
- u8 i2c_address;
-};
-
-#if defined(CONFIG_DVB_TUNER_MT2266) || (defined(CONFIG_DVB_TUNER_MT2266_MODULE) && defined(MODULE))
-extern struct dvb_frontend * mt2266_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2266_config *cfg);
-#else
-static inline struct dvb_frontend * mt2266_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2266_config *cfg)
-{
- printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
- return NULL;
-}
-#endif // CONFIG_DVB_TUNER_MT2266
-
-#endif
diff --git a/drivers/media/dvb/frontends/qt1010.c b/drivers/media/dvb/frontends/qt1010.c
deleted file mode 100644
index 825aa1412e6..00000000000
--- a/drivers/media/dvb/frontends/qt1010.c
+++ /dev/null
@@ -1,485 +0,0 @@
-/*
- * Driver for Quantek QT1010 silicon tuner
- *
- * Copyright (C) 2006 Antti Palosaari <crope@iki.fi>
- * Aapo Tahkola <aet@rasterburn.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "qt1010.h"
-#include "qt1010_priv.h"
-
-static int debug;
-module_param(debug, int, 0644);
-MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off).");
-
-#define dprintk(args...) \
- do { \
- if (debug) printk(KERN_DEBUG "QT1010: " args); \
- } while (0)
-
-/* read single register */
-static int qt1010_readreg(struct qt1010_priv *priv, u8 reg, u8 *val)
-{
- struct i2c_msg msg[2] = {
- { .addr = priv->cfg->i2c_address,
- .flags = 0, .buf = &reg, .len = 1 },
- { .addr = priv->cfg->i2c_address,
- .flags = I2C_M_RD, .buf = val, .len = 1 },
- };
-
- if (i2c_transfer(priv->i2c, msg, 2) != 2) {
- printk(KERN_WARNING "qt1010 I2C read failed\n");
- return -EREMOTEIO;
- }
- return 0;
-}
-
-/* write single register */
-static int qt1010_writereg(struct qt1010_priv *priv, u8 reg, u8 val)
-{
- u8 buf[2] = { reg, val };
- struct i2c_msg msg = { .addr = priv->cfg->i2c_address,
- .flags = 0, .buf = buf, .len = 2 };
-
- if (i2c_transfer(priv->i2c, &msg, 1) != 1) {
- printk(KERN_WARNING "qt1010 I2C write failed\n");
- return -EREMOTEIO;
- }
- return 0;
-}
-
-/* dump all registers */
-static void qt1010_dump_regs(struct qt1010_priv *priv)
-{
- char buf[52], buf2[4];
- u8 reg, val;
-
- for (reg = 0; ; reg++) {
- if (reg % 16 == 0) {
- if (reg)
- printk("%s\n", buf);
- sprintf(buf, "%02x: ", reg);
- }
- if (qt1010_readreg(priv, reg, &val) == 0)
- sprintf(buf2, "%02x ", val);
- else
- strcpy(buf2, "-- ");
- strcat(buf, buf2);
- if (reg == 0x2f)
- break;
- }
- printk("%s\n", buf);
-}
-
-static int qt1010_set_params(struct dvb_frontend *fe,
- struct dvb_frontend_parameters *params)
-{
- struct qt1010_priv *priv;
- int err;
- u32 freq, div, mod1, mod2;
- u8 i, tmpval, reg05;
- qt1010_i2c_oper_t rd[48] = {
- { QT1010_WR, 0x01, 0x80 },
- { QT1010_WR, 0x02, 0x3f },
- { QT1010_WR, 0x05, 0xff }, /* 02 c write */
- { QT1010_WR, 0x06, 0x44 },
- { QT1010_WR, 0x07, 0xff }, /* 04 c write */
- { QT1010_WR, 0x08, 0x08 },
- { QT1010_WR, 0x09, 0xff }, /* 06 c write */
- { QT1010_WR, 0x0a, 0xff }, /* 07 c write */
- { QT1010_WR, 0x0b, 0xff }, /* 08 c write */
- { QT1010_WR, 0x0c, 0xe1 },
- { QT1010_WR, 0x1a, 0xff }, /* 10 c write */
- { QT1010_WR, 0x1b, 0x00 },
- { QT1010_WR, 0x1c, 0x89 },
- { QT1010_WR, 0x11, 0xff }, /* 13 c write */
- { QT1010_WR, 0x12, 0xff }, /* 14 c write */
- { QT1010_WR, 0x22, 0xff }, /* 15 c write */
- { QT1010_WR, 0x1e, 0x00 },
- { QT1010_WR, 0x1e, 0xd0 },
- { QT1010_RD, 0x22, 0xff }, /* 16 c read */
- { QT1010_WR, 0x1e, 0x00 },
- { QT1010_RD, 0x05, 0xff }, /* 20 c read */
- { QT1010_RD, 0x22, 0xff }, /* 21 c read */
- { QT1010_WR, 0x23, 0xd0 },
- { QT1010_WR, 0x1e, 0x00 },
- { QT1010_WR, 0x1e, 0xe0 },
- { QT1010_RD, 0x23, 0xff }, /* 25 c read */
- { QT1010_RD, 0x23, 0xff }, /* 26 c read */
- { QT1010_WR, 0x1e, 0x00 },
- { QT1010_WR, 0x24, 0xd0 },
- { QT1010_WR, 0x1e, 0x00 },
- { QT1010_WR, 0x1e, 0xf0 },
- { QT1010_RD, 0x24, 0xff }, /* 31 c read */
- { QT1010_WR, 0x1e, 0x00 },
- { QT1010_WR, 0x14, 0x7f },
- { QT1010_WR, 0x15, 0x7f },
- { QT1010_WR, 0x05, 0xff }, /* 35 c write */
- { QT1010_WR, 0x06, 0x00 },
- { QT1010_WR, 0x15, 0x1f },
- { QT1010_WR, 0x16, 0xff },
- { QT1010_WR, 0x18, 0xff },
- { QT1010_WR, 0x1f, 0xff }, /* 40 c write */
- { QT1010_WR, 0x20, 0xff }, /* 41 c write */
- { QT1010_WR, 0x21, 0x53 },
- { QT1010_WR, 0x25, 0xff }, /* 43 c write */
- { QT1010_WR, 0x26, 0x15 },
- { QT1010_WR, 0x00, 0xff }, /* 45 c write */
- { QT1010_WR, 0x02, 0x00 },
- { QT1010_WR, 0x01, 0x00 }
- };
-
-#define FREQ1 32000000 /* 32 MHz */
-#define FREQ2 4000000 /* 4 MHz Quartz oscillator in the stick? */
-
- priv = fe->tuner_priv;
- freq = params->frequency;
- div = (freq + QT1010_OFFSET) / QT1010_STEP;
- freq = (div * QT1010_STEP) - QT1010_OFFSET;
- mod1 = (freq + QT1010_OFFSET) % FREQ1;
- mod2 = (freq + QT1010_OFFSET) % FREQ2;
- priv->bandwidth =
- (fe->ops.info.type == FE_OFDM) ? params->u.ofdm.bandwidth : 0;
- priv->frequency = freq;
-
- if (fe->ops.i2c_gate_ctrl)
- fe->ops.i2c_gate_ctrl(fe, 1); /* open i2c_gate */
-
- /* reg 05 base value */
- if (freq < 290000000) reg05 = 0x14; /* 290 MHz */
- else if (freq < 610000000) reg05 = 0x34; /* 610 MHz */
- else if (freq < 802000000) reg05 = 0x54; /* 802 MHz */
- else reg05 = 0x74;
-
- /* 0x5 */
- rd[2].val = reg05;
-
- /* 07 - set frequency: 32 MHz scale */
- rd[4].val = (freq + QT1010_OFFSET) / FREQ1;
-
- /* 09 - changes every 8/24 MHz */
- if (mod1 < 8000000) rd[6].val = 0x1d;
- else rd[6].val = 0x1c;
-
- /* 0a - set frequency: 4 MHz scale (max 28 MHz) */
- if (mod1 < 1*FREQ2) rd[7].val = 0x09; /* +0 MHz */
- else if (mod1 < 2*FREQ2) rd[7].val = 0x08; /* +4 MHz */
- else if (mod1 < 3*FREQ2) rd[7].val = 0x0f; /* +8 MHz */
- else if (mod1 < 4*FREQ2) rd[7].val = 0x0e; /* +12 MHz */
- else if (mod1 < 5*FREQ2) rd[7].val = 0x0d; /* +16 MHz */
- else if (mod1 < 6*FREQ2) rd[7].val = 0x0c; /* +20 MHz */
- else if (mod1 < 7*FREQ2) rd[7].val = 0x0b; /* +24 MHz */
- else rd[7].val = 0x0a; /* +28 MHz */
-
- /* 0b - changes every 2/2 MHz */
- if (mod2 < 2000000) rd[8].val = 0x45;
- else rd[8].val = 0x44;
-
- /* 1a - set frequency: 125 kHz scale (max 3875 kHz)*/
- tmpval = 0x78; /* byte, overflows intentionally */
- rd[10].val = tmpval-((mod2/QT1010_STEP)*0x08);
-
- /* 11 */
- rd[13].val = 0xfd; /* TODO: correct value calculation */
-
- /* 12 */
- rd[14].val = 0x91; /* TODO: correct value calculation */
-
- /* 22 */
- if (freq < 450000000) rd[15].val = 0xd0; /* 450 MHz */
- else if (freq < 482000000) rd[15].val = 0xd1; /* 482 MHz */
- else if (freq < 514000000) rd[15].val = 0xd4; /* 514 MHz */
- else if (freq < 546000000) rd[15].val = 0xd7; /* 546 MHz */
- else if (freq < 610000000) rd[15].val = 0xda; /* 610 MHz */
- else rd[15].val = 0xd0;
-
- /* 05 */
- rd[35].val = (reg05 & 0xf0);
-
- /* 1f */
- if (mod1 < 8000000) tmpval = 0x00;
- else if (mod1 < 12000000) tmpval = 0x01;
- else if (mod1 < 16000000) tmpval = 0x02;
- else if (mod1 < 24000000) tmpval = 0x03;
- else if (mod1 < 28000000) tmpval = 0x04;
- else tmpval = 0x05;
- rd[40].val = (priv->reg1f_init_val + 0x0e + tmpval);
-
- /* 20 */
- if (mod1 < 8000000) tmpval = 0x00;
- else if (mod1 < 12000000) tmpval = 0x01;
- else if (mod1 < 20000000) tmpval = 0x02;
- else if (mod1 < 24000000) tmpval = 0x03;
- else if (mod1 < 28000000) tmpval = 0x04;
- else tmpval = 0x05;
- rd[41].val = (priv->reg20_init_val + 0x0d + tmpval);
-
- /* 25 */
- rd[43].val = priv->reg25_init_val;
-
- /* 00 */
- rd[45].val = 0x92; /* TODO: correct value calculation */
-
- dprintk("freq:%u 05:%02x 07:%02x 09:%02x 0a:%02x 0b:%02x " \
- "1a:%02x 11:%02x 12:%02x 22:%02x 05:%02x 1f:%02x " \
- "20:%02x 25:%02x 00:%02x", \
- freq, rd[2].val, rd[4].val, rd[6].val, rd[7].val, rd[8].val, \
- rd[10].val, rd[13].val, rd[14].val, rd[15].val, rd[35].val, \
- rd[40].val, rd[41].val, rd[43].val, rd[45].val);
-
- for (i = 0; i < ARRAY_SIZE(rd); i++) {
- if (rd[i].oper == QT1010_WR) {
- err = qt1010_writereg(priv, rd[i].reg, rd[i].val);
- } else { /* read is required to proper locking */
- err = qt1010_readreg(priv, rd[i].reg, &tmpval);
- }
- if (err) return err;
- }
-
- if (debug)
- qt1010_dump_regs(priv);
-
- if (fe->ops.i2c_gate_ctrl)
- fe->ops.i2c_gate_ctrl(fe, 0); /* close i2c_gate */
-
- return 0;
-}
-
-static int qt1010_init_meas1(struct qt1010_priv *priv,
- u8 oper, u8 reg, u8 reg_init_val, u8 *retval)
-{
- u8 i, val1, val2;
- int err;
-
- qt1010_i2c_oper_t i2c_data[] = {
- { QT1010_WR, reg, reg_init_val },
- { QT1010_WR, 0x1e, 0x00 },
- { QT1010_WR, 0x1e, oper },
- { QT1010_RD, reg, 0xff }
- };
-
- for (i = 0; i < ARRAY_SIZE(i2c_data); i++) {
- if (i2c_data[i].oper == QT1010_WR) {
- err = qt1010_writereg(priv, i2c_data[i].reg,
- i2c_data[i].val);
- } else {
- err = qt1010_readreg(priv, i2c_data[i].reg, &val2);
- }
- if (err) return err;
- }
-
- do {
- val1 = val2;
- err = qt1010_readreg(priv, reg, &val2);
- if (err) return err;
- dprintk("compare reg:%02x %02x %02x", reg, val1, val2);
- } while (val1 != val2);
- *retval = val1;
-
- return qt1010_writereg(priv, 0x1e, 0x00);
-}
-
-static u8 qt1010_init_meas2(struct qt1010_priv *priv,
- u8 reg_init_val, u8 *retval)
-{
- u8 i, val;
- int err;
- qt1010_i2c_oper_t i2c_data[] = {
- { QT1010_WR, 0x07, reg_init_val },
- { QT1010_WR, 0x22, 0xd0 },
- { QT1010_WR, 0x1e, 0x00 },
- { QT1010_WR, 0x1e, 0xd0 },
- { QT1010_RD, 0x22, 0xff },
- { QT1010_WR, 0x1e, 0x00 },
- { QT1010_WR, 0x22, 0xff }
- };
- for (i = 0; i < ARRAY_SIZE(i2c_data); i++) {
- if (i2c_data[i].oper == QT1010_WR) {
- err = qt1010_writereg(priv, i2c_data[i].reg,
- i2c_data[i].val);
- } else {
- err = qt1010_readreg(priv, i2c_data[i].reg, &val);
- }
- if (err) return err;
- }
- *retval = val;
- return 0;
-}
-
-static int qt1010_init(struct dvb_frontend *fe)
-{
- struct qt1010_priv *priv = fe->tuner_priv;
- struct dvb_frontend_parameters params;
- int err = 0;
- u8 i, tmpval, *valptr = NULL;
-
- qt1010_i2c_oper_t i2c_data[] = {
- { QT1010_WR, 0x01, 0x80 },
- { QT1010_WR, 0x0d, 0x84 },
- { QT1010_WR, 0x0e, 0xb7 },
- { QT1010_WR, 0x2a, 0x23 },
- { QT1010_WR, 0x2c, 0xdc },
- { QT1010_M1, 0x25, 0x40 }, /* get reg 25 init value */
- { QT1010_M1, 0x81, 0xff }, /* get reg 25 init value */
- { QT1010_WR, 0x2b, 0x70 },
- { QT1010_WR, 0x2a, 0x23 },
- { QT1010_M1, 0x26, 0x08 },
- { QT1010_M1, 0x82, 0xff },
- { QT1010_WR, 0x05, 0x14 },
- { QT1010_WR, 0x06, 0x44 },
- { QT1010_WR, 0x07, 0x28 },
- { QT1010_WR, 0x08, 0x0b },
- { QT1010_WR, 0x11, 0xfd },
- { QT1010_M1, 0x22, 0x0d },
- { QT1010_M1, 0xd0, 0xff },
- { QT1010_WR, 0x06, 0x40 },
- { QT1010_WR, 0x16, 0xf0 },
- { QT1010_WR, 0x02, 0x38 },
- { QT1010_WR, 0x03, 0x18 },
- { QT1010_WR, 0x20, 0xe0 },
- { QT1010_M1, 0x1f, 0x20 }, /* get reg 1f init value */
- { QT1010_M1, 0x84, 0xff }, /* get reg 1f init value */
- { QT1010_RD, 0x20, 0x20 }, /* get reg 20 init value */
- { QT1010_WR, 0x03, 0x19 },
- { QT1010_WR, 0x02, 0x3f },
- { QT1010_WR, 0x21, 0x53 },
- { QT1010_RD, 0x21, 0xff },
- { QT1010_WR, 0x11, 0xfd },
- { QT1010_WR, 0x05, 0x34 },
- { QT1010_WR, 0x06, 0x44 },
- { QT1010_WR, 0x08, 0x08 }
- };
-
- if (fe->ops.i2c_gate_ctrl)
- fe->ops.i2c_gate_ctrl(fe, 1); /* open i2c_gate */
-
- for (i = 0; i < ARRAY_SIZE(i2c_data); i++) {
- switch (i2c_data[i].oper) {
- case QT1010_WR:
- err = qt1010_writereg(priv, i2c_data[i].reg,
- i2c_data[i].val);
- break;
- case QT1010_RD:
- if (i2c_data[i].val == 0x20)
- valptr = &priv->reg20_init_val;
- else
- valptr = &tmpval;
- err = qt1010_readreg(priv, i2c_data[i].reg, valptr);
- break;
- case QT1010_M1:
- if (i2c_data[i].val == 0x25)
- valptr = &priv->reg25_init_val;
- else if (i2c_data[i].val == 0x1f)
- valptr = &priv->reg1f_init_val;
- else
- valptr = &tmpval;
- err = qt1010_init_meas1(priv, i2c_data[i+1].reg,
- i2c_data[i].reg,
- i2c_data[i].val, valptr);
- i++;
- break;
- }
- if (err) return err;
- }
-
- for (i = 0x31; i < 0x3a; i++) /* 0x31 - 0x39 */
- if ((err = qt1010_init_meas2(priv, i, &tmpval)))
- return err;
-
- params.frequency = 545000000; /* Sigmatek DVB-110 545000000 */
- /* MSI Megasky 580 GL861 533000000 */
- return qt1010_set_params(fe, &params);
-}
-
-static int qt1010_release(struct dvb_frontend *fe)
-{
- kfree(fe->tuner_priv);
- fe->tuner_priv = NULL;
- return 0;
-}
-
-static int qt1010_get_frequency(struct dvb_frontend *fe, u32 *frequency)
-{
- struct qt1010_priv *priv = fe->tuner_priv;
- *frequency = priv->frequency;
- return 0;
-}
-
-static int qt1010_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
-{
- struct qt1010_priv *priv = fe->tuner_priv;
- *bandwidth = priv->bandwidth;
- return 0;
-}
-
-static const struct dvb_tuner_ops qt1010_tuner_ops = {
- .info = {
- .name = "Quantek QT1010",
- .frequency_min = QT1010_MIN_FREQ,
- .frequency_max = QT1010_MAX_FREQ,
- .frequency_step = QT1010_STEP,
- },
-
- .release = qt1010_release,
- .init = qt1010_init,
- /* TODO: implement sleep */
-
- .set_params = qt1010_set_params,
- .get_frequency = qt1010_get_frequency,
- .get_bandwidth = qt1010_get_bandwidth
-};
-
-struct dvb_frontend * qt1010_attach(struct dvb_frontend *fe,
- struct i2c_adapter *i2c,
- struct qt1010_config *cfg)
-{
- struct qt1010_priv *priv = NULL;
- u8 id;
-
- priv = kzalloc(sizeof(struct qt1010_priv), GFP_KERNEL);
- if (priv == NULL)
- return NULL;
-
- priv->cfg = cfg;
- priv->i2c = i2c;
-
- if (fe->ops.i2c_gate_ctrl)
- fe->ops.i2c_gate_ctrl(fe, 1); /* open i2c_gate */
-
-
- /* Try to detect tuner chip. Probably this is not correct register. */
- if (qt1010_readreg(priv, 0x29, &id) != 0 || (id != 0x39)) {
- kfree(priv);
- return NULL;
- }
-
- if (fe->ops.i2c_gate_ctrl)
- fe->ops.i2c_gate_ctrl(fe, 0); /* close i2c_gate */
-
- printk(KERN_INFO "Quantek QT1010 successfully identified.\n");
- memcpy(&fe->ops.tuner_ops, &qt1010_tuner_ops,
- sizeof(struct dvb_tuner_ops));
-
- fe->tuner_priv = priv;
- return fe;
-}
-EXPORT_SYMBOL(qt1010_attach);
-
-MODULE_DESCRIPTION("Quantek QT1010 silicon tuner driver");
-MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>");
-MODULE_AUTHOR("Aapo Tahkola <aet@rasterburn.org>");
-MODULE_VERSION("0.1");
-MODULE_LICENSE("GPL");
diff --git a/drivers/media/dvb/frontends/qt1010.h b/drivers/media/dvb/frontends/qt1010.h
deleted file mode 100644
index cff6a7ca538..00000000000
--- a/drivers/media/dvb/frontends/qt1010.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Driver for Quantek QT1010 silicon tuner
- *
- * Copyright (C) 2006 Antti Palosaari <crope@iki.fi>
- * Aapo Tahkola <aet@rasterburn.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef QT1010_H
-#define QT1010_H
-
-#include "dvb_frontend.h"
-
-struct qt1010_config {
- u8 i2c_address;
-};
-
-/**
- * Attach a qt1010 tuner to the supplied frontend structure.
- *
- * @param fe frontend to attach to
- * @param i2c i2c adapter to use
- * @param cfg tuner hw based configuration
- * @return fe pointer on success, NULL on failure
- */
-#if defined(CONFIG_DVB_TUNER_QT1010) || (defined(CONFIG_DVB_TUNER_QT1010_MODULE) && defined(MODULE))
-extern struct dvb_frontend *qt1010_attach(struct dvb_frontend *fe,
- struct i2c_adapter *i2c,
- struct qt1010_config *cfg);
-#else
-static inline struct dvb_frontend *qt1010_attach(struct dvb_frontend *fe,
- struct i2c_adapter *i2c,
- struct qt1010_config *cfg)
-{
- printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
- return NULL;
-}
-#endif // CONFIG_DVB_TUNER_QT1010
-
-#endif
diff --git a/drivers/media/dvb/frontends/qt1010_priv.h b/drivers/media/dvb/frontends/qt1010_priv.h
deleted file mode 100644
index 090cf475f09..00000000000
--- a/drivers/media/dvb/frontends/qt1010_priv.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Driver for Quantek QT1010 silicon tuner
- *
- * Copyright (C) 2006 Antti Palosaari <crope@iki.fi>
- * Aapo Tahkola <aet@rasterburn.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef QT1010_PRIV_H
-#define QT1010_PRIV_H
-
-/*
-reg def meaning
-=== === =======
-00 00 ?
-01 a0 ? operation start/stop; start=80, stop=00
-02 00 ?
-03 19 ?
-04 00 ?
-05 00 ? maybe band selection
-06 00 ?
-07 2b set frequency: 32 MHz scale, n*32 MHz
-08 0b ?
-09 10 ? changes every 8/24 MHz; values 1d/1c
-0a 08 set frequency: 4 MHz scale, n*4 MHz
-0b 41 ? changes every 2/2 MHz; values 45/45
-0c e1 ?
-0d 94 ?
-0e b6 ?
-0f 2c ?
-10 10 ?
-11 f1 ? maybe device specified adjustment
-12 11 ? maybe device specified adjustment
-13 3f ?
-14 1f ?
-15 3f ?
-16 ff ?
-17 ff ?
-18 f7 ?
-19 80 ?
-1a d0 set frequency: 125 kHz scale, n*125 kHz
-1b 00 ?
-1c 89 ?
-1d 00 ?
-1e 00 ? looks like operation register; write cmd here, read result from 1f-26
-1f 20 ? chip initialization
-20 e0 ? chip initialization
-21 20 ?
-22 d0 ?
-23 d0 ?
-24 d0 ?
-25 40 ? chip initialization
-26 08 ?
-27 29 ?
-28 55 ?
-29 39 ?
-2a 13 ?
-2b 01 ?
-2c ea ?
-2d 00 ?
-2e 00 ? not used?
-2f 00 ? not used?
-*/
-
-#define QT1010_STEP 125000 /* 125 kHz used by Windows drivers,
- hw could be more precise but we don't
- know how to use */
-#define QT1010_MIN_FREQ 48000000 /* 48 MHz */
-#define QT1010_MAX_FREQ 860000000 /* 860 MHz */
-#define QT1010_OFFSET 1246000000 /* 1246 MHz */
-
-#define QT1010_WR 0
-#define QT1010_RD 1
-#define QT1010_M1 3
-
-typedef struct {
- u8 oper, reg, val;
-} qt1010_i2c_oper_t;
-
-struct qt1010_priv {
- struct qt1010_config *cfg;
- struct i2c_adapter *i2c;
-
- u8 reg1f_init_val;
- u8 reg20_init_val;
- u8 reg25_init_val;
-
- u32 frequency;
- u32 bandwidth;
-};
-
-#endif
diff --git a/drivers/media/dvb/frontends/s5h1420.c b/drivers/media/dvb/frontends/s5h1420.c
index 281e1cb2edc..720ed9ff7c5 100644
--- a/drivers/media/dvb/frontends/s5h1420.c
+++ b/drivers/media/dvb/frontends/s5h1420.c
@@ -481,7 +481,7 @@ static void s5h1420_setsymbolrate(struct s5h1420_state* state,
val *= 2;
do_div(val, (state->fclk / 1000));
- dprintk("symbol rate register: %06llx\n", val);
+ dprintk("symbol rate register: %06llx\n", (unsigned long long)val);
v = s5h1420_readreg(state, Loop01);
s5h1420_writereg(state, Loop01, v & 0x7f);
diff --git a/drivers/media/dvb/frontends/tda18271-common.c b/drivers/media/dvb/frontends/tda18271-common.c
deleted file mode 100644
index e27a7620a32..00000000000
--- a/drivers/media/dvb/frontends/tda18271-common.c
+++ /dev/null
@@ -1,666 +0,0 @@
-/*
- tda18271-common.c - driver for the Philips / NXP TDA18271 silicon tuner
-
- Copyright (C) 2007, 2008 Michael Krufky <mkrufky@linuxtv.org>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "tda18271-priv.h"
-
-static int tda18271_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
-{
- struct tda18271_priv *priv = fe->tuner_priv;
- enum tda18271_i2c_gate gate;
- int ret = 0;
-
- switch (priv->gate) {
- case TDA18271_GATE_DIGITAL:
- case TDA18271_GATE_ANALOG:
- gate = priv->gate;
- break;
- case TDA18271_GATE_AUTO:
- default:
- switch (priv->mode) {
- case TDA18271_DIGITAL:
- gate = TDA18271_GATE_DIGITAL;
- break;
- case TDA18271_ANALOG:
- default:
- gate = TDA18271_GATE_ANALOG;
- break;
- }
- }
-
- switch (gate) {
- case TDA18271_GATE_ANALOG:
- if (fe->ops.analog_ops.i2c_gate_ctrl)
- ret = fe->ops.analog_ops.i2c_gate_ctrl(fe, enable);
- break;
- case TDA18271_GATE_DIGITAL:
- if (fe->ops.i2c_gate_ctrl)
- ret = fe->ops.i2c_gate_ctrl(fe, enable);
- break;
- default:
- ret = -EINVAL;
- break;
- }
-
- return ret;
-};
-
-/*---------------------------------------------------------------------*/
-
-static void tda18271_dump_regs(struct dvb_frontend *fe, int extended)
-{
- struct tda18271_priv *priv = fe->tuner_priv;
- unsigned char *regs = priv->tda18271_regs;
-
- tda_reg("=== TDA18271 REG DUMP ===\n");
- tda_reg("ID_BYTE = 0x%02x\n", 0xff & regs[R_ID]);
- tda_reg("THERMO_BYTE = 0x%02x\n", 0xff & regs[R_TM]);
- tda_reg("POWER_LEVEL_BYTE = 0x%02x\n", 0xff & regs[R_PL]);
- tda_reg("EASY_PROG_BYTE_1 = 0x%02x\n", 0xff & regs[R_EP1]);
- tda_reg("EASY_PROG_BYTE_2 = 0x%02x\n", 0xff & regs[R_EP2]);
- tda_reg("EASY_PROG_BYTE_3 = 0x%02x\n", 0xff & regs[R_EP3]);
- tda_reg("EASY_PROG_BYTE_4 = 0x%02x\n", 0xff & regs[R_EP4]);
- tda_reg("EASY_PROG_BYTE_5 = 0x%02x\n", 0xff & regs[R_EP5]);
- tda_reg("CAL_POST_DIV_BYTE = 0x%02x\n", 0xff & regs[R_CPD]);
- tda_reg("CAL_DIV_BYTE_1 = 0x%02x\n", 0xff & regs[R_CD1]);
- tda_reg("CAL_DIV_BYTE_2 = 0x%02x\n", 0xff & regs[R_CD2]);
- tda_reg("CAL_DIV_BYTE_3 = 0x%02x\n", 0xff & regs[R_CD3]);
- tda_reg("MAIN_POST_DIV_BYTE = 0x%02x\n", 0xff & regs[R_MPD]);
- tda_reg("MAIN_DIV_BYTE_1 = 0x%02x\n", 0xff & regs[R_MD1]);
- tda_reg("MAIN_DIV_BYTE_2 = 0x%02x\n", 0xff & regs[R_MD2]);
- tda_reg("MAIN_DIV_BYTE_3 = 0x%02x\n", 0xff & regs[R_MD3]);
-
- /* only dump extended regs if DBG_ADV is set */
- if (!(tda18271_debug & DBG_ADV))
- return;
-
- /* W indicates write-only registers.
- * Register dump for write-only registers shows last value written. */
-
- tda_reg("EXTENDED_BYTE_1 = 0x%02x\n", 0xff & regs[R_EB1]);
- tda_reg("EXTENDED_BYTE_2 = 0x%02x\n", 0xff & regs[R_EB2]);
- tda_reg("EXTENDED_BYTE_3 = 0x%02x\n", 0xff & regs[R_EB3]);
- tda_reg("EXTENDED_BYTE_4 = 0x%02x\n", 0xff & regs[R_EB4]);
- tda_reg("EXTENDED_BYTE_5 = 0x%02x\n", 0xff & regs[R_EB5]);
- tda_reg("EXTENDED_BYTE_6 = 0x%02x\n", 0xff & regs[R_EB6]);
- tda_reg("EXTENDED_BYTE_7 = 0x%02x\n", 0xff & regs[R_EB7]);
- tda_reg("EXTENDED_BYTE_8 = 0x%02x\n", 0xff & regs[R_EB8]);
- tda_reg("EXTENDED_BYTE_9 W = 0x%02x\n", 0xff & regs[R_EB9]);
- tda_reg("EXTENDED_BYTE_10 = 0x%02x\n", 0xff & regs[R_EB10]);
- tda_reg("EXTENDED_BYTE_11 = 0x%02x\n", 0xff & regs[R_EB11]);
- tda_reg("EXTENDED_BYTE_12 = 0x%02x\n", 0xff & regs[R_EB12]);
- tda_reg("EXTENDED_BYTE_13 = 0x%02x\n", 0xff & regs[R_EB13]);
- tda_reg("EXTENDED_BYTE_14 = 0x%02x\n", 0xff & regs[R_EB14]);
- tda_reg("EXTENDED_BYTE_15 = 0x%02x\n", 0xff & regs[R_EB15]);
- tda_reg("EXTENDED_BYTE_16 W = 0x%02x\n", 0xff & regs[R_EB16]);
- tda_reg("EXTENDED_BYTE_17 W = 0x%02x\n", 0xff & regs[R_EB17]);
- tda_reg("EXTENDED_BYTE_18 = 0x%02x\n", 0xff & regs[R_EB18]);
- tda_reg("EXTENDED_BYTE_19 W = 0x%02x\n", 0xff & regs[R_EB19]);
- tda_reg("EXTENDED_BYTE_20 W = 0x%02x\n", 0xff & regs[R_EB20]);
- tda_reg("EXTENDED_BYTE_21 = 0x%02x\n", 0xff & regs[R_EB21]);
- tda_reg("EXTENDED_BYTE_22 = 0x%02x\n", 0xff & regs[R_EB22]);
- tda_reg("EXTENDED_BYTE_23 = 0x%02x\n", 0xff & regs[R_EB23]);
-}
-
-int tda18271_read_regs(struct dvb_frontend *fe)
-{
- struct tda18271_priv *priv = fe->tuner_priv;
- unsigned char *regs = priv->tda18271_regs;
- unsigned char buf = 0x00;
- int ret;
- struct i2c_msg msg[] = {
- { .addr = priv->i2c_props.addr, .flags = 0,
- .buf = &buf, .len = 1 },
- { .addr = priv->i2c_props.addr, .flags = I2C_M_RD,
- .buf = regs, .len = 16 }
- };
-
- tda18271_i2c_gate_ctrl(fe, 1);
-
- /* read all registers */
- ret = i2c_transfer(priv->i2c_props.adap, msg, 2);
-
- tda18271_i2c_gate_ctrl(fe, 0);
-
- if (ret != 2)
- tda_err("ERROR: i2c_transfer returned: %d\n", ret);
-
- if (tda18271_debug & DBG_REG)
- tda18271_dump_regs(fe, 0);
-
- return (ret == 2 ? 0 : ret);
-}
-
-int tda18271_read_extended(struct dvb_frontend *fe)
-{
- struct tda18271_priv *priv = fe->tuner_priv;
- unsigned char *regs = priv->tda18271_regs;
- unsigned char regdump[TDA18271_NUM_REGS];
- unsigned char buf = 0x00;
- int ret, i;
- struct i2c_msg msg[] = {
- { .addr = priv->i2c_props.addr, .flags = 0,
- .buf = &buf, .len = 1 },
- { .addr = priv->i2c_props.addr, .flags = I2C_M_RD,
- .buf = regdump, .len = TDA18271_NUM_REGS }
- };
-
- tda18271_i2c_gate_ctrl(fe, 1);
-
- /* read all registers */
- ret = i2c_transfer(priv->i2c_props.adap, msg, 2);
-
- tda18271_i2c_gate_ctrl(fe, 0);
-
- if (ret != 2)
- tda_err("ERROR: i2c_transfer returned: %d\n", ret);
-
- for (i = 0; i < TDA18271_NUM_REGS; i++) {
- /* don't update write-only registers */
- if ((i != R_EB9) &&
- (i != R_EB16) &&
- (i != R_EB17) &&
- (i != R_EB19) &&
- (i != R_EB20))
- regs[i] = regdump[i];
- }
-
- if (tda18271_debug & DBG_REG)
- tda18271_dump_regs(fe, 1);
-
- return (ret == 2 ? 0 : ret);
-}
-
-int tda18271_write_regs(struct dvb_frontend *fe, int idx, int len)
-{
- struct tda18271_priv *priv = fe->tuner_priv;
- unsigned char *regs = priv->tda18271_regs;
- unsigned char buf[TDA18271_NUM_REGS + 1];
- struct i2c_msg msg = { .addr = priv->i2c_props.addr, .flags = 0,
- .buf = buf, .len = len + 1 };
- int i, ret;
-
- BUG_ON((len == 0) || (idx + len > sizeof(buf)));
-
- buf[0] = idx;
- for (i = 1; i <= len; i++)
- buf[i] = regs[idx - 1 + i];
-
- tda18271_i2c_gate_ctrl(fe, 1);
-
- /* write registers */
- ret = i2c_transfer(priv->i2c_props.adap, &msg, 1);
-
- tda18271_i2c_gate_ctrl(fe, 0);
-
- if (ret != 1)
- tda_err("ERROR: i2c_transfer returned: %d\n", ret);
-
- return (ret == 1 ? 0 : ret);
-}
-
-/*---------------------------------------------------------------------*/
-
-int tda18271_charge_pump_source(struct dvb_frontend *fe,
- enum tda18271_pll pll, int force)
-{
- struct tda18271_priv *priv = fe->tuner_priv;
- unsigned char *regs = priv->tda18271_regs;
-
- int r_cp = (pll == TDA18271_CAL_PLL) ? R_EB7 : R_EB4;
-
- regs[r_cp] &= ~0x20;
- regs[r_cp] |= ((force & 1) << 5);
- tda18271_write_regs(fe, r_cp, 1);
-
- return 0;
-}
-
-int tda18271_init_regs(struct dvb_frontend *fe)
-{
- struct tda18271_priv *priv = fe->tuner_priv;
- unsigned char *regs = priv->tda18271_regs;
-
- tda_dbg("initializing registers for device @ %d-%04x\n",
- i2c_adapter_id(priv->i2c_props.adap),
- priv->i2c_props.addr);
-
- /* initialize registers */
- switch (priv->id) {
- case TDA18271HDC1:
- regs[R_ID] = 0x83;
- break;
- case TDA18271HDC2:
- regs[R_ID] = 0x84;
- break;
- };
-
- regs[R_TM] = 0x08;
- regs[R_PL] = 0x80;
- regs[R_EP1] = 0xc6;
- regs[R_EP2] = 0xdf;
- regs[R_EP3] = 0x16;
- regs[R_EP4] = 0x60;
- regs[R_EP5] = 0x80;
- regs[R_CPD] = 0x80;
- regs[R_CD1] = 0x00;
- regs[R_CD2] = 0x00;
- regs[R_CD3] = 0x00;
- regs[R_MPD] = 0x00;
- regs[R_MD1] = 0x00;
- regs[R_MD2] = 0x00;
- regs[R_MD3] = 0x00;
-
- switch (priv->id) {
- case TDA18271HDC1:
- regs[R_EB1] = 0xff;
- break;
- case TDA18271HDC2:
- regs[R_EB1] = 0xfc;
- break;
- };
-
- regs[R_EB2] = 0x01;
- regs[R_EB3] = 0x84;
- regs[R_EB4] = 0x41;
- regs[R_EB5] = 0x01;
- regs[R_EB6] = 0x84;
- regs[R_EB7] = 0x40;
- regs[R_EB8] = 0x07;
- regs[R_EB9] = 0x00;
- regs[R_EB10] = 0x00;
- regs[R_EB11] = 0x96;
-
- switch (priv->id) {
- case TDA18271HDC1:
- regs[R_EB12] = 0x0f;
- break;
- case TDA18271HDC2:
- regs[R_EB12] = 0x33;
- break;
- };
-
- regs[R_EB13] = 0xc1;
- regs[R_EB14] = 0x00;
- regs[R_EB15] = 0x8f;
- regs[R_EB16] = 0x00;
- regs[R_EB17] = 0x00;
-
- switch (priv->id) {
- case TDA18271HDC1:
- regs[R_EB18] = 0x00;
- break;
- case TDA18271HDC2:
- regs[R_EB18] = 0x8c;
- break;
- };
-
- regs[R_EB19] = 0x00;
- regs[R_EB20] = 0x20;
-
- switch (priv->id) {
- case TDA18271HDC1:
- regs[R_EB21] = 0x33;
- break;
- case TDA18271HDC2:
- regs[R_EB21] = 0xb3;
- break;
- };
-
- regs[R_EB22] = 0x48;
- regs[R_EB23] = 0xb0;
-
- if (priv->small_i2c) {
- tda18271_write_regs(fe, 0x00, 0x10);
- tda18271_write_regs(fe, 0x10, 0x10);
- tda18271_write_regs(fe, 0x20, 0x07);
- } else
- tda18271_write_regs(fe, 0x00, TDA18271_NUM_REGS);
-
- /* setup agc1 gain */
- regs[R_EB17] = 0x00;
- tda18271_write_regs(fe, R_EB17, 1);
- regs[R_EB17] = 0x03;
- tda18271_write_regs(fe, R_EB17, 1);
- regs[R_EB17] = 0x43;
- tda18271_write_regs(fe, R_EB17, 1);
- regs[R_EB17] = 0x4c;
- tda18271_write_regs(fe, R_EB17, 1);
-
- /* setup agc2 gain */
- if ((priv->id) == TDA18271HDC1) {
- regs[R_EB20] = 0xa0;
- tda18271_write_regs(fe, R_EB20, 1);
- regs[R_EB20] = 0xa7;
- tda18271_write_regs(fe, R_EB20, 1);
- regs[R_EB20] = 0xe7;
- tda18271_write_regs(fe, R_EB20, 1);
- regs[R_EB20] = 0xec;
- tda18271_write_regs(fe, R_EB20, 1);
- }
-
- /* image rejection calibration */
-
- /* low-band */
- regs[R_EP3] = 0x1f;
- regs[R_EP4] = 0x66;
- regs[R_EP5] = 0x81;
- regs[R_CPD] = 0xcc;
- regs[R_CD1] = 0x6c;
- regs[R_CD2] = 0x00;
- regs[R_CD3] = 0x00;
- regs[R_MPD] = 0xcd;
- regs[R_MD1] = 0x77;
- regs[R_MD2] = 0x08;
- regs[R_MD3] = 0x00;
-
- tda18271_write_regs(fe, R_EP3, 11);
-
- if ((priv->id) == TDA18271HDC2) {
- /* main pll cp source on */
- tda18271_charge_pump_source(fe, TDA18271_MAIN_PLL, 1);
- msleep(1);
-
- /* main pll cp source off */
- tda18271_charge_pump_source(fe, TDA18271_MAIN_PLL, 0);
- }
-
- msleep(5); /* pll locking */
-
- /* launch detector */
- tda18271_write_regs(fe, R_EP1, 1);
- msleep(5); /* wanted low measurement */
-
- regs[R_EP5] = 0x85;
- regs[R_CPD] = 0xcb;
- regs[R_CD1] = 0x66;
- regs[R_CD2] = 0x70;
-
- tda18271_write_regs(fe, R_EP3, 7);
- msleep(5); /* pll locking */
-
- /* launch optimization algorithm */
- tda18271_write_regs(fe, R_EP2, 1);
- msleep(30); /* image low optimization completion */
-
- /* mid-band */
- regs[R_EP5] = 0x82;
- regs[R_CPD] = 0xa8;
- regs[R_CD2] = 0x00;
- regs[R_MPD] = 0xa9;
- regs[R_MD1] = 0x73;
- regs[R_MD2] = 0x1a;
-
- tda18271_write_regs(fe, R_EP3, 11);
- msleep(5); /* pll locking */
-
- /* launch detector */
- tda18271_write_regs(fe, R_EP1, 1);
- msleep(5); /* wanted mid measurement */
-
- regs[R_EP5] = 0x86;
- regs[R_CPD] = 0xa8;
- regs[R_CD1] = 0x66;
- regs[R_CD2] = 0xa0;
-
- tda18271_write_regs(fe, R_EP3, 7);
- msleep(5); /* pll locking */
-
- /* launch optimization algorithm */
- tda18271_write_regs(fe, R_EP2, 1);
- msleep(30); /* image mid optimization completion */
-
- /* high-band */
- regs[R_EP5] = 0x83;
- regs[R_CPD] = 0x98;
- regs[R_CD1] = 0x65;
- regs[R_CD2] = 0x00;
- regs[R_MPD] = 0x99;
- regs[R_MD1] = 0x71;
- regs[R_MD2] = 0xcd;
-
- tda18271_write_regs(fe, R_EP3, 11);
- msleep(5); /* pll locking */
-
- /* launch detector */
- tda18271_write_regs(fe, R_EP1, 1);
- msleep(5); /* wanted high measurement */
-
- regs[R_EP5] = 0x87;
- regs[R_CD1] = 0x65;
- regs[R_CD2] = 0x50;
-
- tda18271_write_regs(fe, R_EP3, 7);
- msleep(5); /* pll locking */
-
- /* launch optimization algorithm */
- tda18271_write_regs(fe, R_EP2, 1);
- msleep(30); /* image high optimization completion */
-
- /* return to normal mode */
- regs[R_EP4] = 0x64;
- tda18271_write_regs(fe, R_EP4, 1);
-
- /* synchronize */
- tda18271_write_regs(fe, R_EP1, 1);
-
- return 0;
-}
-
-/*---------------------------------------------------------------------*/
-
-/*
- * Standby modes, EP3 [7:5]
- *
- * | SM || SM_LT || SM_XT || mode description
- * |=====\\=======\\=======\\===================================
- * | 0 || 0 || 0 || normal mode
- * |-----||-------||-------||-----------------------------------
- * | || || || standby mode w/ slave tuner output
- * | 1 || 0 || 0 || & loop thru & xtal oscillator on
- * |-----||-------||-------||-----------------------------------
- * | 1 || 1 || 0 || standby mode w/ xtal oscillator on
- * |-----||-------||-------||-----------------------------------
- * | 1 || 1 || 1 || power off
- *
- */
-
-int tda18271_set_standby_mode(struct dvb_frontend *fe,
- int sm, int sm_lt, int sm_xt)
-{
- struct tda18271_priv *priv = fe->tuner_priv;
- unsigned char *regs = priv->tda18271_regs;
-
- tda_dbg("sm = %d, sm_lt = %d, sm_xt = %d\n", sm, sm_lt, sm_xt);
-
- regs[R_EP3] &= ~0xe0; /* clear sm, sm_lt, sm_xt */
- regs[R_EP3] |= sm ? (1 << 7) : 0 |
- sm_lt ? (1 << 6) : 0 |
- sm_xt ? (1 << 5) : 0;
-
- tda18271_write_regs(fe, R_EP3, 1);
-
- return 0;
-}
-
-/*---------------------------------------------------------------------*/
-
-int tda18271_calc_main_pll(struct dvb_frontend *fe, u32 freq)
-{
- /* sets main post divider & divider bytes, but does not write them */
- struct tda18271_priv *priv = fe->tuner_priv;
- unsigned char *regs = priv->tda18271_regs;
- u8 d, pd;
- u32 div;
-
- int ret = tda18271_lookup_pll_map(fe, MAIN_PLL, &freq, &pd, &d);
- if (ret < 0)
- goto fail;
-
- regs[R_MPD] = (0x77 & pd);
-
- switch (priv->mode) {
- case TDA18271_ANALOG:
- regs[R_MPD] &= ~0x08;
- break;
- case TDA18271_DIGITAL:
- regs[R_MPD] |= 0x08;
- break;
- }
-
- div = ((d * (freq / 1000)) << 7) / 125;
-
- regs[R_MD1] = 0x7f & (div >> 16);
- regs[R_MD2] = 0xff & (div >> 8);
- regs[R_MD3] = 0xff & div;
-fail:
- return ret;
-}
-
-int tda18271_calc_cal_pll(struct dvb_frontend *fe, u32 freq)
-{
- /* sets cal post divider & divider bytes, but does not write them */
- struct tda18271_priv *priv = fe->tuner_priv;
- unsigned char *regs = priv->tda18271_regs;
- u8 d, pd;
- u32 div;
-
- int ret = tda18271_lookup_pll_map(fe, CAL_PLL, &freq, &pd, &d);
- if (ret < 0)
- goto fail;
-
- regs[R_CPD] = pd;
-
- div = ((d * (freq / 1000)) << 7) / 125;
-
- regs[R_CD1] = 0x7f & (div >> 16);
- regs[R_CD2] = 0xff & (div >> 8);
- regs[R_CD3] = 0xff & div;
-fail:
- return ret;
-}
-
-/*---------------------------------------------------------------------*/
-
-int tda18271_calc_bp_filter(struct dvb_frontend *fe, u32 *freq)
-{
- /* sets bp filter bits, but does not write them */
- struct tda18271_priv *priv = fe->tuner_priv;
- unsigned char *regs = priv->tda18271_regs;
- u8 val;
-
- int ret = tda18271_lookup_map(fe, BP_FILTER, freq, &val);
- if (ret < 0)
- goto fail;
-
- regs[R_EP1] &= ~0x07; /* clear bp filter bits */
- regs[R_EP1] |= (0x07 & val);
-fail:
- return ret;
-}
-
-int tda18271_calc_km(struct dvb_frontend *fe, u32 *freq)
-{
- /* sets K & M bits, but does not write them */
- struct tda18271_priv *priv = fe->tuner_priv;
- unsigned char *regs = priv->tda18271_regs;
- u8 val;
-
- int ret = tda18271_lookup_map(fe, RF_CAL_KMCO, freq, &val);
- if (ret < 0)
- goto fail;
-
- regs[R_EB13] &= ~0x7c; /* clear k & m bits */
- regs[R_EB13] |= (0x7c & val);
-fail:
- return ret;
-}
-
-int tda18271_calc_rf_band(struct dvb_frontend *fe, u32 *freq)
-{
- /* sets rf band bits, but does not write them */
- struct tda18271_priv *priv = fe->tuner_priv;
- unsigned char *regs = priv->tda18271_regs;
- u8 val;
-
- int ret = tda18271_lookup_map(fe, RF_BAND, freq, &val);
- if (ret < 0)
- goto fail;
-
- regs[R_EP2] &= ~0xe0; /* clear rf band bits */
- regs[R_EP2] |= (0xe0 & (val << 5));
-fail:
- return ret;
-}
-
-int tda18271_calc_gain_taper(struct dvb_frontend *fe, u32 *freq)
-{
- /* sets gain taper bits, but does not write them */
- struct tda18271_priv *priv = fe->tuner_priv;
- unsigned char *regs = priv->tda18271_regs;
- u8 val;
-
- int ret = tda18271_lookup_map(fe, GAIN_TAPER, freq, &val);
- if (ret < 0)
- goto fail;
-
- regs[R_EP2] &= ~0x1f; /* clear gain taper bits */
- regs[R_EP2] |= (0x1f & val);
-fail:
- return ret;
-}
-
-int tda18271_calc_ir_measure(struct dvb_frontend *fe, u32 *freq)
-{
- /* sets IR Meas bits, but does not write them */
- struct tda18271_priv *priv = fe->tuner_priv;
- unsigned char *regs = priv->tda18271_regs;
- u8 val;
-
- int ret = tda18271_lookup_map(fe, IR_MEASURE, freq, &val);
- if (ret < 0)
- goto fail;
-
- regs[R_EP5] &= ~0x07;
- regs[R_EP5] |= (0x07 & val);
-fail:
- return ret;
-}
-
-int tda18271_calc_rf_cal(struct dvb_frontend *fe, u32 *freq)
-{
- /* sets rf cal byte (RFC_Cprog), but does not write it */
- struct tda18271_priv *priv = fe->tuner_priv;
- unsigned char *regs = priv->tda18271_regs;
- u8 val;
-
- tda18271_lookup_map(fe, RF_CAL, freq, &val);
-
- regs[R_EB14] = val;
-
- return 0;
-}
-
-/*
- * Overrides for Emacs so that we follow Linus's tabbing style.
- * ---------------------------------------------------------------------------
- * Local variables:
- * c-basic-offset: 8
- * End:
- */
diff --git a/drivers/media/dvb/frontends/tda18271-fe.c b/drivers/media/dvb/frontends/tda18271-fe.c
deleted file mode 100644
index b262100ae89..00000000000
--- a/drivers/media/dvb/frontends/tda18271-fe.c
+++ /dev/null
@@ -1,1153 +0,0 @@
-/*
- tda18271-fe.c - driver for the Philips / NXP TDA18271 silicon tuner
-
- Copyright (C) 2007, 2008 Michael Krufky <mkrufky@linuxtv.org>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include <linux/delay.h>
-#include <linux/videodev2.h>
-#include "tda18271-priv.h"
-
-int tda18271_debug;
-module_param_named(debug, tda18271_debug, int, 0644);
-MODULE_PARM_DESC(debug, "set debug level "
- "(info=1, map=2, reg=4, adv=8, cal=16 (or-able))");
-
-static int tda18271_cal_on_startup;
-module_param_named(cal, tda18271_cal_on_startup, int, 0644);
-MODULE_PARM_DESC(cal, "perform RF tracking filter calibration on startup");
-
-static DEFINE_MUTEX(tda18271_list_mutex);
-static LIST_HEAD(hybrid_tuner_instance_list);
-
-/*---------------------------------------------------------------------*/
-
-static inline int charge_pump_source(struct dvb_frontend *fe, int force)
-{
- struct tda18271_priv *priv = fe->tuner_priv;
- return tda18271_charge_pump_source(fe,
- (priv->role == TDA18271_SLAVE) ?
- TDA18271_CAL_PLL :
- TDA18271_MAIN_PLL, force);
-}
-
-static int tda18271_channel_configuration(struct dvb_frontend *fe,
- struct tda18271_std_map_item *map,
- u32 freq, u32 bw)
-{
- struct tda18271_priv *priv = fe->tuner_priv;
- unsigned char *regs = priv->tda18271_regs;
- u32 N;
-
- /* update TV broadcast parameters */
-
- /* set standard */
- regs[R_EP3] &= ~0x1f; /* clear std bits */
- regs[R_EP3] |= (map->agc_mode << 3) | map->std;
-
- /* set rfagc to high speed mode */
- regs[R_EP3] &= ~0x04;
-
- /* set cal mode to normal */
- regs[R_EP4] &= ~0x03;
-
- /* update IF output level & IF notch frequency */
- regs[R_EP4] &= ~0x1c; /* clear if level bits */
- regs[R_EP4] |= (map->if_lvl << 2);
-
- switch (priv->mode) {
- case TDA18271_ANALOG:
- regs[R_MPD] &= ~0x80; /* IF notch = 0 */
- break;
- case TDA18271_DIGITAL:
- regs[R_MPD] |= 0x80; /* IF notch = 1 */
- break;
- }
-
- /* update FM_RFn */
- regs[R_EP4] &= ~0x80;
- regs[R_EP4] |= map->fm_rfn << 7;
-
- /* update rf top / if top */
- regs[R_EB22] = 0x00;
- regs[R_EB22] |= map->rfagc_top;
- tda18271_write_regs(fe, R_EB22, 1);
-
- /* --------------------------------------------------------------- */
-
- /* disable Power Level Indicator */
- regs[R_EP1] |= 0x40;
-
- /* frequency dependent parameters */
-
- tda18271_calc_ir_measure(fe, &freq);
-
- tda18271_calc_bp_filter(fe, &freq);
-
- tda18271_calc_rf_band(fe, &freq);
-
- tda18271_calc_gain_taper(fe, &freq);
-
- /* --------------------------------------------------------------- */
-
- /* dual tuner and agc1 extra configuration */
-
- switch (priv->role) {
- case TDA18271_MASTER:
- regs[R_EB1] |= 0x04; /* main vco */
- break;
- case TDA18271_SLAVE:
- regs[R_EB1] &= ~0x04; /* cal vco */
- break;
- }
-
- /* agc1 always active */
- regs[R_EB1] &= ~0x02;
-
- /* agc1 has priority on agc2 */
- regs[R_EB1] &= ~0x01;
-
- tda18271_write_regs(fe, R_EB1, 1);
-
- /* --------------------------------------------------------------- */
-
- N = map->if_freq * 1000 + freq;
-
- switch (priv->role) {
- case TDA18271_MASTER:
- tda18271_calc_main_pll(fe, N);
- tda18271_write_regs(fe, R_MPD, 4);
- break;
- case TDA18271_SLAVE:
- tda18271_calc_cal_pll(fe, N);
- tda18271_write_regs(fe, R_CPD, 4);
-
- regs[R_MPD] = regs[R_CPD] & 0x7f;
- tda18271_write_regs(fe, R_MPD, 1);
- break;
- }
-
- tda18271_write_regs(fe, R_TM, 7);
-
- /* force charge pump source */
- charge_pump_source(fe, 1);
-
- msleep(1);
-
- /* return pll to normal operation */
- charge_pump_source(fe, 0);
-
- msleep(20);
-
- /* set rfagc to normal speed mode */
- if (map->fm_rfn)
- regs[R_EP3] &= ~0x04;
- else
- regs[R_EP3] |= 0x04;
- tda18271_write_regs(fe, R_EP3, 1);
-
- return 0;
-}
-
-static int tda18271_read_thermometer(struct dvb_frontend *fe)
-{
- struct tda18271_priv *priv = fe->tuner_priv;
- unsigned char *regs = priv->tda18271_regs;
- int tm;
-
- /* switch thermometer on */
- regs[R_TM] |= 0x10;
- tda18271_write_regs(fe, R_TM, 1);
-
- /* read thermometer info */
- tda18271_read_regs(fe);
-
- if ((((regs[R_TM] & 0x0f) == 0x00) && ((regs[R_TM] & 0x20) == 0x20)) ||
- (((regs[R_TM] & 0x0f) == 0x08) && ((regs[R_TM] & 0x20) == 0x00))) {
-
- if ((regs[R_TM] & 0x20) == 0x20)
- regs[R_TM] &= ~0x20;
- else
- regs[R_TM] |= 0x20;
-
- tda18271_write_regs(fe, R_TM, 1);
-
- msleep(10); /* temperature sensing */
-
- /* read thermometer info */
- tda18271_read_regs(fe);
- }
-
- tm = tda18271_lookup_thermometer(fe);
-
- /* switch thermometer off */
- regs[R_TM] &= ~0x10;
- tda18271_write_regs(fe, R_TM, 1);
-
- /* set CAL mode to normal */
- regs[R_EP4] &= ~0x03;
- tda18271_write_regs(fe, R_EP4, 1);
-
- return tm;
-}
-
-/* ------------------------------------------------------------------ */
-
-static int tda18271c2_rf_tracking_filters_correction(struct dvb_frontend *fe,
- u32 freq)
-{
- struct tda18271_priv *priv = fe->tuner_priv;
- struct tda18271_rf_tracking_filter_cal *map = priv->rf_cal_state;
- unsigned char *regs = priv->tda18271_regs;
- int tm_current, rfcal_comp, approx, i;
- u8 dc_over_dt, rf_tab;
-
- /* power up */
- tda18271_set_standby_mode(fe, 0, 0, 0);
-
- /* read die current temperature */
- tm_current = tda18271_read_thermometer(fe);
-
- /* frequency dependent parameters */
-
- tda18271_calc_rf_cal(fe, &freq);
- rf_tab = regs[R_EB14];
-
- i = tda18271_lookup_rf_band(fe, &freq, NULL);
- if (i < 0)
- return -EINVAL;
-
- if ((0 == map[i].rf3) || (freq / 1000 < map[i].rf2)) {
- approx = map[i].rf_a1 *
- (freq / 1000 - map[i].rf1) + map[i].rf_b1 + rf_tab;
- } else {
- approx = map[i].rf_a2 *
- (freq / 1000 - map[i].rf2) + map[i].rf_b2 + rf_tab;
- }
-
- if (approx < 0)
- approx = 0;
- if (approx > 255)
- approx = 255;
-
- tda18271_lookup_map(fe, RF_CAL_DC_OVER_DT, &freq, &dc_over_dt);
-
- /* calculate temperature compensation */
- rfcal_comp = dc_over_dt * (tm_current - priv->tm_rfcal);
-
- regs[R_EB14] = approx + rfcal_comp;
- tda18271_write_regs(fe, R_EB14, 1);
-
- return 0;
-}
-
-static int tda18271_por(struct dvb_frontend *fe)
-{
- struct tda18271_priv *priv = fe->tuner_priv;
- unsigned char *regs = priv->tda18271_regs;
-
- /* power up detector 1 */
- regs[R_EB12] &= ~0x20;
- tda18271_write_regs(fe, R_EB12, 1);
-
- regs[R_EB18] &= ~0x80; /* turn agc1 loop on */
- regs[R_EB18] &= ~0x03; /* set agc1_gain to 6 dB */
- tda18271_write_regs(fe, R_EB18, 1);
-
- regs[R_EB21] |= 0x03; /* set agc2_gain to -6 dB */
-
- /* POR mode */
- tda18271_set_standby_mode(fe, 1, 0, 0);
-
- /* disable 1.5 MHz low pass filter */
- regs[R_EB23] &= ~0x04; /* forcelp_fc2_en = 0 */
- regs[R_EB23] &= ~0x02; /* XXX: lp_fc[2] = 0 */
- tda18271_write_regs(fe, R_EB21, 3);
-
- return 0;
-}
-
-static int tda18271_calibrate_rf(struct dvb_frontend *fe, u32 freq)
-{
- struct tda18271_priv *priv = fe->tuner_priv;
- unsigned char *regs = priv->tda18271_regs;
- u32 N;
-
- /* set CAL mode to normal */
- regs[R_EP4] &= ~0x03;
- tda18271_write_regs(fe, R_EP4, 1);
-
- /* switch off agc1 */
- regs[R_EP3] |= 0x40; /* sm_lt = 1 */
-
- regs[R_EB18] |= 0x03; /* set agc1_gain to 15 dB */
- tda18271_write_regs(fe, R_EB18, 1);
-
- /* frequency dependent parameters */
-
- tda18271_calc_bp_filter(fe, &freq);
- tda18271_calc_gain_taper(fe, &freq);
- tda18271_calc_rf_band(fe, &freq);
- tda18271_calc_km(fe, &freq);
-
- tda18271_write_regs(fe, R_EP1, 3);
- tda18271_write_regs(fe, R_EB13, 1);
-
- /* main pll charge pump source */
- tda18271_charge_pump_source(fe, TDA18271_MAIN_PLL, 1);
-
- /* cal pll charge pump source */
- tda18271_charge_pump_source(fe, TDA18271_CAL_PLL, 1);
-
- /* force dcdc converter to 0 V */
- regs[R_EB14] = 0x00;
- tda18271_write_regs(fe, R_EB14, 1);
-
- /* disable plls lock */
- regs[R_EB20] &= ~0x20;
- tda18271_write_regs(fe, R_EB20, 1);
-
- /* set CAL mode to RF tracking filter calibration */
- regs[R_EP4] |= 0x03;
- tda18271_write_regs(fe, R_EP4, 2);
-
- /* --------------------------------------------------------------- */
-
- /* set the internal calibration signal */
- N = freq;
-
- tda18271_calc_cal_pll(fe, N);
- tda18271_write_regs(fe, R_CPD, 4);
-
- /* downconvert internal calibration */
- N += 1000000;
-
- tda18271_calc_main_pll(fe, N);
- tda18271_write_regs(fe, R_MPD, 4);
-
- msleep(5);
-
- tda18271_write_regs(fe, R_EP2, 1);
- tda18271_write_regs(fe, R_EP1, 1);
- tda18271_write_regs(fe, R_EP2, 1);
- tda18271_write_regs(fe, R_EP1, 1);
-
- /* --------------------------------------------------------------- */
-
- /* normal operation for the main pll */
- tda18271_charge_pump_source(fe, TDA18271_MAIN_PLL, 0);
-
- /* normal operation for the cal pll */
- tda18271_charge_pump_source(fe, TDA18271_CAL_PLL, 0);
-
- msleep(10); /* plls locking */
-
- /* launch the rf tracking filters calibration */
- regs[R_EB20] |= 0x20;
- tda18271_write_regs(fe, R_EB20, 1);
-
- msleep(60); /* calibration */
-
- /* --------------------------------------------------------------- */
-
- /* set CAL mode to normal */
- regs[R_EP4] &= ~0x03;
-
- /* switch on agc1 */
- regs[R_EP3] &= ~0x40; /* sm_lt = 0 */
-
- regs[R_EB18] &= ~0x03; /* set agc1_gain to 6 dB */
- tda18271_write_regs(fe, R_EB18, 1);
-
- tda18271_write_regs(fe, R_EP3, 2);
-
- /* synchronization */
- tda18271_write_regs(fe, R_EP1, 1);
-
- /* get calibration result */
- tda18271_read_extended(fe);
-
- return regs[R_EB14];
-}
-
-static int tda18271_powerscan(struct dvb_frontend *fe,
- u32 *freq_in, u32 *freq_out)
-{
- struct tda18271_priv *priv = fe->tuner_priv;
- unsigned char *regs = priv->tda18271_regs;
- int sgn, bcal, count, wait;
- u8 cid_target;
- u16 count_limit;
- u32 freq;
-
- freq = *freq_in;
-
- tda18271_calc_rf_band(fe, &freq);
- tda18271_calc_rf_cal(fe, &freq);
- tda18271_calc_gain_taper(fe, &freq);
- tda18271_lookup_cid_target(fe, &freq, &cid_target, &count_limit);
-
- tda18271_write_regs(fe, R_EP2, 1);
- tda18271_write_regs(fe, R_EB14, 1);
-
- /* downconvert frequency */
- freq += 1000000;
-
- tda18271_calc_main_pll(fe, freq);
- tda18271_write_regs(fe, R_MPD, 4);
-
- msleep(5); /* pll locking */
-
- /* detection mode */
- regs[R_EP4] &= ~0x03;
- regs[R_EP4] |= 0x01;
- tda18271_write_regs(fe, R_EP4, 1);
-
- /* launch power detection measurement */
- tda18271_write_regs(fe, R_EP2, 1);
-
- /* read power detection info, stored in EB10 */
- tda18271_read_extended(fe);
-
- /* algorithm initialization */
- sgn = 1;
- *freq_out = *freq_in;
- bcal = 0;
- count = 0;
- wait = false;
-
- while ((regs[R_EB10] & 0x3f) < cid_target) {
- /* downconvert updated freq to 1 MHz */
- freq = *freq_in + (sgn * count) + 1000000;
-
- tda18271_calc_main_pll(fe, freq);
- tda18271_write_regs(fe, R_MPD, 4);
-
- if (wait) {
- msleep(5); /* pll locking */
- wait = false;
- } else
- udelay(100); /* pll locking */
-
- /* launch power detection measurement */
- tda18271_write_regs(fe, R_EP2, 1);
-
- /* read power detection info, stored in EB10 */
- tda18271_read_extended(fe);
-
- count += 200;
-
- if (count <= count_limit)
- continue;
-
- if (sgn <= 0)
- break;
-
- sgn = -1 * sgn;
- count = 200;
- wait = true;
- }
-
- if ((regs[R_EB10] & 0x3f) >= cid_target) {
- bcal = 1;
- *freq_out = freq - 1000000;
- } else
- bcal = 0;
-
- tda_cal("bcal = %d, freq_in = %d, freq_out = %d (freq = %d)\n",
- bcal, *freq_in, *freq_out, freq);
-
- return bcal;
-}
-
-static int tda18271_powerscan_init(struct dvb_frontend *fe)
-{
- struct tda18271_priv *priv = fe->tuner_priv;
- unsigned char *regs = priv->tda18271_regs;
-
- /* set standard to digital */
- regs[R_EP3] &= ~0x1f; /* clear std bits */
- regs[R_EP3] |= 0x12;
-
- /* set cal mode to normal */
- regs[R_EP4] &= ~0x03;
-
- /* update IF output level & IF notch frequency */
- regs[R_EP4] &= ~0x1c; /* clear if level bits */
-
- tda18271_write_regs(fe, R_EP3, 2);
-
- regs[R_EB18] &= ~0x03; /* set agc1_gain to 6 dB */
- tda18271_write_regs(fe, R_EB18, 1);
-
- regs[R_EB21] &= ~0x03; /* set agc2_gain to -15 dB */
-
- /* 1.5 MHz low pass filter */
- regs[R_EB23] |= 0x04; /* forcelp_fc2_en = 1 */
- regs[R_EB23] |= 0x02; /* lp_fc[2] = 1 */
-
- tda18271_write_regs(fe, R_EB21, 3);
-
- return 0;
-}
-
-static int tda18271_rf_tracking_filters_init(struct dvb_frontend *fe, u32 freq)
-{
- struct tda18271_priv *priv = fe->tuner_priv;
- struct tda18271_rf_tracking_filter_cal *map = priv->rf_cal_state;
- unsigned char *regs = priv->tda18271_regs;
- int bcal, rf, i;
-#define RF1 0
-#define RF2 1
-#define RF3 2
- u32 rf_default[3];
- u32 rf_freq[3];
- u8 prog_cal[3];
- u8 prog_tab[3];
-
- i = tda18271_lookup_rf_band(fe, &freq, NULL);
-
- if (i < 0)
- return i;
-
- rf_default[RF1] = 1000 * map[i].rf1_def;
- rf_default[RF2] = 1000 * map[i].rf2_def;
- rf_default[RF3] = 1000 * map[i].rf3_def;
-
- for (rf = RF1; rf <= RF3; rf++) {
- if (0 == rf_default[rf])
- return 0;
- tda_cal("freq = %d, rf = %d\n", freq, rf);
-
- /* look for optimized calibration frequency */
- bcal = tda18271_powerscan(fe, &rf_default[rf], &rf_freq[rf]);
-
- tda18271_calc_rf_cal(fe, &rf_freq[rf]);
- prog_tab[rf] = regs[R_EB14];
-
- if (1 == bcal)
- prog_cal[rf] = tda18271_calibrate_rf(fe, rf_freq[rf]);
- else
- prog_cal[rf] = prog_tab[rf];
-
- switch (rf) {
- case RF1:
- map[i].rf_a1 = 0;
- map[i].rf_b1 = prog_cal[RF1] - prog_tab[RF1];
- map[i].rf1 = rf_freq[RF1] / 1000;
- break;
- case RF2:
- map[i].rf_a1 = (prog_cal[RF2] - prog_tab[RF2] -
- prog_cal[RF1] + prog_tab[RF1]) /
- ((rf_freq[RF2] - rf_freq[RF1]) / 1000);
- map[i].rf2 = rf_freq[RF2] / 1000;
- break;
- case RF3:
- map[i].rf_a2 = (prog_cal[RF3] - prog_tab[RF3] -
- prog_cal[RF2] + prog_tab[RF2]) /
- ((rf_freq[RF3] - rf_freq[RF2]) / 1000);
- map[i].rf_b2 = prog_cal[RF2] - prog_tab[RF2];
- map[i].rf3 = rf_freq[RF3] / 1000;
- break;
- default:
- BUG();
- }
- }
-
- return 0;
-}
-
-static int tda18271_calc_rf_filter_curve(struct dvb_frontend *fe)
-{
- struct tda18271_priv *priv = fe->tuner_priv;
- unsigned int i;
-
- tda_info("tda18271: performing RF tracking filter calibration\n");
-
- /* wait for die temperature stabilization */
- msleep(200);
-
- tda18271_powerscan_init(fe);
-
- /* rf band calibration */
- for (i = 0; priv->rf_cal_state[i].rfmax != 0; i++)
- tda18271_rf_tracking_filters_init(fe, 1000 *
- priv->rf_cal_state[i].rfmax);
-
- priv->tm_rfcal = tda18271_read_thermometer(fe);
-
- return 0;
-}
-
-/* ------------------------------------------------------------------ */
-
-static int tda18271c2_rf_cal_init(struct dvb_frontend *fe)
-{
- struct tda18271_priv *priv = fe->tuner_priv;
- unsigned char *regs = priv->tda18271_regs;
-
- /* test RF_CAL_OK to see if we need init */
- if ((regs[R_EP1] & 0x10) == 0)
- priv->cal_initialized = false;
-
- if (priv->cal_initialized)
- return 0;
-
- tda18271_calc_rf_filter_curve(fe);
-
- tda18271_por(fe);
-
- tda_info("tda18271: RF tracking filter calibration complete\n");
-
- priv->cal_initialized = true;
-
- return 0;
-}
-
-static int tda18271c1_rf_tracking_filter_calibration(struct dvb_frontend *fe,
- u32 freq, u32 bw)
-{
- struct tda18271_priv *priv = fe->tuner_priv;
- unsigned char *regs = priv->tda18271_regs;
- u32 N = 0;
-
- /* calculate bp filter */
- tda18271_calc_bp_filter(fe, &freq);
- tda18271_write_regs(fe, R_EP1, 1);
-
- regs[R_EB4] &= 0x07;
- regs[R_EB4] |= 0x60;
- tda18271_write_regs(fe, R_EB4, 1);
-
- regs[R_EB7] = 0x60;
- tda18271_write_regs(fe, R_EB7, 1);
-
- regs[R_EB14] = 0x00;
- tda18271_write_regs(fe, R_EB14, 1);
-
- regs[R_EB20] = 0xcc;
- tda18271_write_regs(fe, R_EB20, 1);
-
- /* set cal mode to RF tracking filter calibration */
- regs[R_EP4] |= 0x03;
-
- /* calculate cal pll */
-
- switch (priv->mode) {
- case TDA18271_ANALOG:
- N = freq - 1250000;
- break;
- case TDA18271_DIGITAL:
- N = freq + bw / 2;
- break;
- }
-
- tda18271_calc_cal_pll(fe, N);
-
- /* calculate main pll */
-
- switch (priv->mode) {
- case TDA18271_ANALOG:
- N = freq - 250000;
- break;
- case TDA18271_DIGITAL:
- N = freq + bw / 2 + 1000000;
- break;
- }
-
- tda18271_calc_main_pll(fe, N);
-
- tda18271_write_regs(fe, R_EP3, 11);
- msleep(5); /* RF tracking filter calibration initialization */
-
- /* search for K,M,CO for RF calibration */
- tda18271_calc_km(fe, &freq);
- tda18271_write_regs(fe, R_EB13, 1);
-
- /* search for rf band */
- tda18271_calc_rf_band(fe, &freq);
-
- /* search for gain taper */
- tda18271_calc_gain_taper(fe, &freq);
-
- tda18271_write_regs(fe, R_EP2, 1);
- tda18271_write_regs(fe, R_EP1, 1);
- tda18271_write_regs(fe, R_EP2, 1);
- tda18271_write_regs(fe, R_EP1, 1);
-
- regs[R_EB4] &= 0x07;
- regs[R_EB4] |= 0x40;
- tda18271_write_regs(fe, R_EB4, 1);
-
- regs[R_EB7] = 0x40;
- tda18271_write_regs(fe, R_EB7, 1);
- msleep(10); /* pll locking */
-
- regs[R_EB20] = 0xec;
- tda18271_write_regs(fe, R_EB20, 1);
- msleep(60); /* RF tracking filter calibration completion */
-
- regs[R_EP4] &= ~0x03; /* set cal mode to normal */
- tda18271_write_regs(fe, R_EP4, 1);
-
- tda18271_write_regs(fe, R_EP1, 1);
-
- /* RF tracking filter correction for VHF_Low band */
- if (0 == tda18271_calc_rf_cal(fe, &freq))
- tda18271_write_regs(fe, R_EB14, 1);
-
- return 0;
-}
-
-/* ------------------------------------------------------------------ */
-
-static int tda18271_ir_cal_init(struct dvb_frontend *fe)
-{
- struct tda18271_priv *priv = fe->tuner_priv;
- unsigned char *regs = priv->tda18271_regs;
-
- tda18271_read_regs(fe);
-
- /* test IR_CAL_OK to see if we need init */
- if ((regs[R_EP1] & 0x08) == 0)
- tda18271_init_regs(fe);
-
- return 0;
-}
-
-static int tda18271_init(struct dvb_frontend *fe)
-{
- struct tda18271_priv *priv = fe->tuner_priv;
-
- mutex_lock(&priv->lock);
-
- /* power up */
- tda18271_set_standby_mode(fe, 0, 0, 0);
-
- /* initialization */
- tda18271_ir_cal_init(fe);
-
- if (priv->id == TDA18271HDC2)
- tda18271c2_rf_cal_init(fe);
-
- mutex_unlock(&priv->lock);
-
- return 0;
-}
-
-static int tda18271_tune(struct dvb_frontend *fe,
- struct tda18271_std_map_item *map, u32 freq, u32 bw)
-{
- struct tda18271_priv *priv = fe->tuner_priv;
-
- tda_dbg("freq = %d, ifc = %d, bw = %d, agc_mode = %d, std = %d\n",
- freq, map->if_freq, bw, map->agc_mode, map->std);
-
- tda18271_init(fe);
-
- mutex_lock(&priv->lock);
-
- switch (priv->id) {
- case TDA18271HDC1:
- tda18271c1_rf_tracking_filter_calibration(fe, freq, bw);
- break;
- case TDA18271HDC2:
- tda18271c2_rf_tracking_filters_correction(fe, freq);
- break;
- }
- tda18271_channel_configuration(fe, map, freq, bw);
-
- mutex_unlock(&priv->lock);
-
- return 0;
-}
-
-/* ------------------------------------------------------------------ */
-
-static int tda18271_set_params(struct dvb_frontend *fe,
- struct dvb_frontend_parameters *params)
-{
- struct tda18271_priv *priv = fe->tuner_priv;
- struct tda18271_std_map *std_map = &priv->std;
- struct tda18271_std_map_item *map;
- int ret;
- u32 bw, freq = params->frequency;
-
- priv->mode = TDA18271_DIGITAL;
-
- if (fe->ops.info.type == FE_ATSC) {
- switch (params->u.vsb.modulation) {
- case VSB_8:
- case VSB_16:
- map = &std_map->atsc_6;
- break;
- case QAM_64:
- case QAM_256:
- map = &std_map->qam_6;
- break;
- default:
- tda_warn("modulation not set!\n");
- return -EINVAL;
- }
-#if 0
- /* userspace request is already center adjusted */
- freq += 1750000; /* Adjust to center (+1.75MHZ) */
-#endif
- bw = 6000000;
- } else if (fe->ops.info.type == FE_OFDM) {
- switch (params->u.ofdm.bandwidth) {
- case BANDWIDTH_6_MHZ:
- bw = 6000000;
- map = &std_map->dvbt_6;
- break;
- case BANDWIDTH_7_MHZ:
- bw = 7000000;
- map = &std_map->dvbt_7;
- break;
- case BANDWIDTH_8_MHZ:
- bw = 8000000;
- map = &std_map->dvbt_8;
- break;
- default:
- tda_warn("bandwidth not set!\n");
- return -EINVAL;
- }
- } else {
- tda_warn("modulation type not supported!\n");
- return -EINVAL;
- }
-
- /* When tuning digital, the analog demod must be tri-stated */
- if (fe->ops.analog_ops.standby)
- fe->ops.analog_ops.standby(fe);
-
- ret = tda18271_tune(fe, map, freq, bw);
-
- if (ret < 0)
- goto fail;
-
- priv->frequency = freq;
- priv->bandwidth = (fe->ops.info.type == FE_OFDM) ?
- params->u.ofdm.bandwidth : 0;
-fail:
- return ret;
-}
-
-static int tda18271_set_analog_params(struct dvb_frontend *fe,
- struct analog_parameters *params)
-{
- struct tda18271_priv *priv = fe->tuner_priv;
- struct tda18271_std_map *std_map = &priv->std;
- struct tda18271_std_map_item *map;
- char *mode;
- int ret;
- u32 freq = params->frequency * 62500;
-
- priv->mode = TDA18271_ANALOG;
-
- if (params->mode == V4L2_TUNER_RADIO) {
- freq = freq / 1000;
- map = &std_map->fm_radio;
- mode = "fm";
- } else if (params->std & V4L2_STD_MN) {
- map = &std_map->atv_mn;
- mode = "MN";
- } else if (params->std & V4L2_STD_B) {
- map = &std_map->atv_b;
- mode = "B";
- } else if (params->std & V4L2_STD_GH) {
- map = &std_map->atv_gh;
- mode = "GH";
- } else if (params->std & V4L2_STD_PAL_I) {
- map = &std_map->atv_i;
- mode = "I";
- } else if (params->std & V4L2_STD_DK) {
- map = &std_map->atv_dk;
- mode = "DK";
- } else if (params->std & V4L2_STD_SECAM_L) {
- map = &std_map->atv_l;
- mode = "L";
- } else if (params->std & V4L2_STD_SECAM_LC) {
- map = &std_map->atv_lc;
- mode = "L'";
- } else {
- map = &std_map->atv_i;
- mode = "xx";
- }
-
- tda_dbg("setting tda18271 to system %s\n", mode);
-
- ret = tda18271_tune(fe, map, freq, 0);
-
- if (ret < 0)
- goto fail;
-
- priv->frequency = freq;
- priv->bandwidth = 0;
-fail:
- return ret;
-}
-
-static int tda18271_sleep(struct dvb_frontend *fe)
-{
- struct tda18271_priv *priv = fe->tuner_priv;
-
- mutex_lock(&priv->lock);
-
- /* standby mode w/ slave tuner output
- * & loop thru & xtal oscillator on */
- tda18271_set_standby_mode(fe, 1, 0, 0);
-
- mutex_unlock(&priv->lock);
-
- return 0;
-}
-
-static int tda18271_release(struct dvb_frontend *fe)
-{
- struct tda18271_priv *priv = fe->tuner_priv;
-
- mutex_lock(&tda18271_list_mutex);
-
- if (priv)
- hybrid_tuner_release_state(priv);
-
- mutex_unlock(&tda18271_list_mutex);
-
- fe->tuner_priv = NULL;
-
- return 0;
-}
-
-static int tda18271_get_frequency(struct dvb_frontend *fe, u32 *frequency)
-{
- struct tda18271_priv *priv = fe->tuner_priv;
- *frequency = priv->frequency;
- return 0;
-}
-
-static int tda18271_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
-{
- struct tda18271_priv *priv = fe->tuner_priv;
- *bandwidth = priv->bandwidth;
- return 0;
-}
-
-/* ------------------------------------------------------------------ */
-
-#define tda18271_update_std(std_cfg, name) do { \
- if (map->std_cfg.if_freq + \
- map->std_cfg.agc_mode + map->std_cfg.std + \
- map->std_cfg.if_lvl + map->std_cfg.rfagc_top > 0) { \
- tda_dbg("Using custom std config for %s\n", name); \
- memcpy(&std->std_cfg, &map->std_cfg, \
- sizeof(struct tda18271_std_map_item)); \
- } } while (0)
-
-#define tda18271_dump_std_item(std_cfg, name) do { \
- tda_dbg("(%s) if_freq = %d, agc_mode = %d, std = %d, " \
- "if_lvl = %d, rfagc_top = 0x%02x\n", \
- name, std->std_cfg.if_freq, \
- std->std_cfg.agc_mode, std->std_cfg.std, \
- std->std_cfg.if_lvl, std->std_cfg.rfagc_top); \
- } while (0)
-
-static int tda18271_dump_std_map(struct dvb_frontend *fe)
-{
- struct tda18271_priv *priv = fe->tuner_priv;
- struct tda18271_std_map *std = &priv->std;
-
- tda_dbg("========== STANDARD MAP SETTINGS ==========\n");
- tda18271_dump_std_item(fm_radio, " fm ");
- tda18271_dump_std_item(atv_b, "atv b ");
- tda18271_dump_std_item(atv_dk, "atv dk");
- tda18271_dump_std_item(atv_gh, "atv gh");
- tda18271_dump_std_item(atv_i, "atv i ");
- tda18271_dump_std_item(atv_l, "atv l ");
- tda18271_dump_std_item(atv_lc, "atv l'");
- tda18271_dump_std_item(atv_mn, "atv mn");
- tda18271_dump_std_item(atsc_6, "atsc 6");
- tda18271_dump_std_item(dvbt_6, "dvbt 6");
- tda18271_dump_std_item(dvbt_7, "dvbt 7");
- tda18271_dump_std_item(dvbt_8, "dvbt 8");
- tda18271_dump_std_item(qam_6, "qam 6 ");
- tda18271_dump_std_item(qam_8, "qam 8 ");
-
- return 0;
-}
-
-static int tda18271_update_std_map(struct dvb_frontend *fe,
- struct tda18271_std_map *map)
-{
- struct tda18271_priv *priv = fe->tuner_priv;
- struct tda18271_std_map *std = &priv->std;
-
- if (!map)
- return -EINVAL;
-
- tda18271_update_std(fm_radio, "fm");
- tda18271_update_std(atv_b, "atv b");
- tda18271_update_std(atv_dk, "atv dk");
- tda18271_update_std(atv_gh, "atv gh");
- tda18271_update_std(atv_i, "atv i");
- tda18271_update_std(atv_l, "atv l");
- tda18271_update_std(atv_lc, "atv l'");
- tda18271_update_std(atv_mn, "atv mn");
- tda18271_update_std(atsc_6, "atsc 6");
- tda18271_update_std(dvbt_6, "dvbt 6");
- tda18271_update_std(dvbt_7, "dvbt 7");
- tda18271_update_std(dvbt_8, "dvbt 8");
- tda18271_update_std(qam_6, "qam 6");
- tda18271_update_std(qam_8, "qam 8");
-
- return 0;
-}
-
-static int tda18271_get_id(struct dvb_frontend *fe)
-{
- struct tda18271_priv *priv = fe->tuner_priv;
- unsigned char *regs = priv->tda18271_regs;
- char *name;
- int ret = 0;
-
- mutex_lock(&priv->lock);
- tda18271_read_regs(fe);
- mutex_unlock(&priv->lock);
-
- switch (regs[R_ID] & 0x7f) {
- case 3:
- name = "TDA18271HD/C1";
- priv->id = TDA18271HDC1;
- break;
- case 4:
- name = "TDA18271HD/C2";
- priv->id = TDA18271HDC2;
- break;
- default:
- name = "Unknown device";
- ret = -EINVAL;
- break;
- }
-
- tda_info("%s detected @ %d-%04x%s\n", name,
- i2c_adapter_id(priv->i2c_props.adap),
- priv->i2c_props.addr,
- (0 == ret) ? "" : ", device not supported.");
-
- return ret;
-}
-
-static struct dvb_tuner_ops tda18271_tuner_ops = {
- .info = {
- .name = "NXP TDA18271HD",
- .frequency_min = 45000000,
- .frequency_max = 864000000,
- .frequency_step = 62500
- },
- .init = tda18271_init,
- .sleep = tda18271_sleep,
- .set_params = tda18271_set_params,
- .set_analog_params = tda18271_set_analog_params,
- .release = tda18271_release,
- .get_frequency = tda18271_get_frequency,
- .get_bandwidth = tda18271_get_bandwidth,
-};
-
-struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
- struct i2c_adapter *i2c,
- struct tda18271_config *cfg)
-{
- struct tda18271_priv *priv = NULL;
- int instance;
-
- mutex_lock(&tda18271_list_mutex);
-
- instance = hybrid_tuner_request_state(struct tda18271_priv, priv,
- hybrid_tuner_instance_list,
- i2c, addr, "tda18271");
- switch (instance) {
- case 0:
- goto fail;
- break;
- case 1:
- /* new tuner instance */
- priv->gate = (cfg) ? cfg->gate : TDA18271_GATE_AUTO;
- priv->role = (cfg) ? cfg->role : TDA18271_MASTER;
- priv->cal_initialized = false;
- mutex_init(&priv->lock);
-
- fe->tuner_priv = priv;
-
- if (cfg)
- priv->small_i2c = cfg->small_i2c;
-
- if (tda18271_get_id(fe) < 0)
- goto fail;
-
- if (tda18271_assign_map_layout(fe) < 0)
- goto fail;
-
- mutex_lock(&priv->lock);
- tda18271_init_regs(fe);
-
- if ((tda18271_cal_on_startup) && (priv->id == TDA18271HDC2))
- tda18271c2_rf_cal_init(fe);
-
- mutex_unlock(&priv->lock);
- break;
- default:
- /* existing tuner instance */
- fe->tuner_priv = priv;
-
- /* allow dvb driver to override i2c gate setting */
- if ((cfg) && (cfg->gate != TDA18271_GATE_ANALOG))
- priv->gate = cfg->gate;
- break;
- }
-
- /* override default std map with values in config struct */
- if ((cfg) && (cfg->std_map))
- tda18271_update_std_map(fe, cfg->std_map);
-
- mutex_unlock(&tda18271_list_mutex);
-
- memcpy(&fe->ops.tuner_ops, &tda18271_tuner_ops,
- sizeof(struct dvb_tuner_ops));
-
- if (tda18271_debug & (DBG_MAP | DBG_ADV))
- tda18271_dump_std_map(fe);
-
- return fe;
-fail:
- mutex_unlock(&tda18271_list_mutex);
-
- tda18271_release(fe);
- return NULL;
-}
-EXPORT_SYMBOL_GPL(tda18271_attach);
-MODULE_DESCRIPTION("NXP TDA18271HD analog / digital tuner driver");
-MODULE_AUTHOR("Michael Krufky <mkrufky@linuxtv.org>");
-MODULE_LICENSE("GPL");
-MODULE_VERSION("0.3");
-
-/*
- * Overrides for Emacs so that we follow Linus's tabbing style.
- * ---------------------------------------------------------------------------
- * Local variables:
- * c-basic-offset: 8
- * End:
- */
diff --git a/drivers/media/dvb/frontends/tda18271-priv.h b/drivers/media/dvb/frontends/tda18271-priv.h
deleted file mode 100644
index 2bc5eb368ea..00000000000
--- a/drivers/media/dvb/frontends/tda18271-priv.h
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- tda18271-priv.h - private header for the NXP TDA18271 silicon tuner
-
- Copyright (C) 2007, 2008 Michael Krufky <mkrufky@linuxtv.org>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef __TDA18271_PRIV_H__
-#define __TDA18271_PRIV_H__
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/mutex.h>
-#include "tuner-i2c.h"
-#include "tda18271.h"
-
-#define R_ID 0x00 /* ID byte */
-#define R_TM 0x01 /* Thermo byte */
-#define R_PL 0x02 /* Power level byte */
-#define R_EP1 0x03 /* Easy Prog byte 1 */
-#define R_EP2 0x04 /* Easy Prog byte 2 */
-#define R_EP3 0x05 /* Easy Prog byte 3 */
-#define R_EP4 0x06 /* Easy Prog byte 4 */
-#define R_EP5 0x07 /* Easy Prog byte 5 */
-#define R_CPD 0x08 /* Cal Post-Divider byte */
-#define R_CD1 0x09 /* Cal Divider byte 1 */
-#define R_CD2 0x0a /* Cal Divider byte 2 */
-#define R_CD3 0x0b /* Cal Divider byte 3 */
-#define R_MPD 0x0c /* Main Post-Divider byte */
-#define R_MD1 0x0d /* Main Divider byte 1 */
-#define R_MD2 0x0e /* Main Divider byte 2 */
-#define R_MD3 0x0f /* Main Divider byte 3 */
-#define R_EB1 0x10 /* Extended byte 1 */
-#define R_EB2 0x11 /* Extended byte 2 */
-#define R_EB3 0x12 /* Extended byte 3 */
-#define R_EB4 0x13 /* Extended byte 4 */
-#define R_EB5 0x14 /* Extended byte 5 */
-#define R_EB6 0x15 /* Extended byte 6 */
-#define R_EB7 0x16 /* Extended byte 7 */
-#define R_EB8 0x17 /* Extended byte 8 */
-#define R_EB9 0x18 /* Extended byte 9 */
-#define R_EB10 0x19 /* Extended byte 10 */
-#define R_EB11 0x1a /* Extended byte 11 */
-#define R_EB12 0x1b /* Extended byte 12 */
-#define R_EB13 0x1c /* Extended byte 13 */
-#define R_EB14 0x1d /* Extended byte 14 */
-#define R_EB15 0x1e /* Extended byte 15 */
-#define R_EB16 0x1f /* Extended byte 16 */
-#define R_EB17 0x20 /* Extended byte 17 */
-#define R_EB18 0x21 /* Extended byte 18 */
-#define R_EB19 0x22 /* Extended byte 19 */
-#define R_EB20 0x23 /* Extended byte 20 */
-#define R_EB21 0x24 /* Extended byte 21 */
-#define R_EB22 0x25 /* Extended byte 22 */
-#define R_EB23 0x26 /* Extended byte 23 */
-
-#define TDA18271_NUM_REGS 39
-
-/*---------------------------------------------------------------------*/
-
-struct tda18271_rf_tracking_filter_cal {
- u32 rfmax;
- u8 rfband;
- u32 rf1_def;
- u32 rf2_def;
- u32 rf3_def;
- u32 rf1;
- u32 rf2;
- u32 rf3;
- int rf_a1;
- int rf_b1;
- int rf_a2;
- int rf_b2;
-};
-
-enum tda18271_pll {
- TDA18271_MAIN_PLL,
- TDA18271_CAL_PLL,
-};
-
-enum tda18271_mode {
- TDA18271_ANALOG,
- TDA18271_DIGITAL,
-};
-
-struct tda18271_map_layout;
-
-enum tda18271_ver {
- TDA18271HDC1,
- TDA18271HDC2,
-};
-
-struct tda18271_priv {
- unsigned char tda18271_regs[TDA18271_NUM_REGS];
-
- struct list_head hybrid_tuner_instance_list;
- struct tuner_i2c_props i2c_props;
-
- enum tda18271_mode mode;
- enum tda18271_role role;
- enum tda18271_i2c_gate gate;
- enum tda18271_ver id;
-
- unsigned int tm_rfcal;
- unsigned int cal_initialized:1;
- unsigned int small_i2c:1;
-
- struct tda18271_map_layout *maps;
- struct tda18271_std_map std;
- struct tda18271_rf_tracking_filter_cal rf_cal_state[8];
-
- struct mutex lock;
-
- u32 frequency;
- u32 bandwidth;
-};
-
-/*---------------------------------------------------------------------*/
-
-extern int tda18271_debug;
-
-#define DBG_INFO 1
-#define DBG_MAP 2
-#define DBG_REG 4
-#define DBG_ADV 8
-#define DBG_CAL 16
-
-#define tda_printk(kern, fmt, arg...) \
- printk(kern "%s: " fmt, __func__, ##arg)
-
-#define dprintk(kern, lvl, fmt, arg...) do {\
- if (tda18271_debug & lvl) \
- tda_printk(kern, fmt, ##arg); } while (0)
-
-#define tda_info(fmt, arg...) printk(KERN_INFO fmt, ##arg)
-#define tda_warn(fmt, arg...) tda_printk(KERN_WARNING, fmt, ##arg)
-#define tda_err(fmt, arg...) tda_printk(KERN_ERR, fmt, ##arg)
-#define tda_dbg(fmt, arg...) dprintk(KERN_DEBUG, DBG_INFO, fmt, ##arg)
-#define tda_map(fmt, arg...) dprintk(KERN_DEBUG, DBG_MAP, fmt, ##arg)
-#define tda_reg(fmt, arg...) dprintk(KERN_DEBUG, DBG_REG, fmt, ##arg)
-#define tda_cal(fmt, arg...) dprintk(KERN_DEBUG, DBG_CAL, fmt, ##arg)
-
-/*---------------------------------------------------------------------*/
-
-enum tda18271_map_type {
- /* tda18271_pll_map */
- MAIN_PLL,
- CAL_PLL,
- /* tda18271_map */
- RF_CAL,
- RF_CAL_KMCO,
- RF_CAL_DC_OVER_DT,
- BP_FILTER,
- RF_BAND,
- GAIN_TAPER,
- IR_MEASURE,
-};
-
-extern int tda18271_lookup_pll_map(struct dvb_frontend *fe,
- enum tda18271_map_type map_type,
- u32 *freq, u8 *post_div, u8 *div);
-extern int tda18271_lookup_map(struct dvb_frontend *fe,
- enum tda18271_map_type map_type,
- u32 *freq, u8 *val);
-
-extern int tda18271_lookup_thermometer(struct dvb_frontend *fe);
-
-extern int tda18271_lookup_rf_band(struct dvb_frontend *fe,
- u32 *freq, u8 *rf_band);
-
-extern int tda18271_lookup_cid_target(struct dvb_frontend *fe,
- u32 *freq, u8 *cid_target,
- u16 *count_limit);
-
-extern int tda18271_assign_map_layout(struct dvb_frontend *fe);
-
-/*---------------------------------------------------------------------*/
-
-extern int tda18271_read_regs(struct dvb_frontend *fe);
-extern int tda18271_read_extended(struct dvb_frontend *fe);
-extern int tda18271_write_regs(struct dvb_frontend *fe, int idx, int len);
-extern int tda18271_init_regs(struct dvb_frontend *fe);
-
-extern int tda18271_charge_pump_source(struct dvb_frontend *fe,
- enum tda18271_pll pll, int force);
-extern int tda18271_set_standby_mode(struct dvb_frontend *fe,
- int sm, int sm_lt, int sm_xt);
-
-extern int tda18271_calc_main_pll(struct dvb_frontend *fe, u32 freq);
-extern int tda18271_calc_cal_pll(struct dvb_frontend *fe, u32 freq);
-
-extern int tda18271_calc_bp_filter(struct dvb_frontend *fe, u32 *freq);
-extern int tda18271_calc_km(struct dvb_frontend *fe, u32 *freq);
-extern int tda18271_calc_rf_band(struct dvb_frontend *fe, u32 *freq);
-extern int tda18271_calc_gain_taper(struct dvb_frontend *fe, u32 *freq);
-extern int tda18271_calc_ir_measure(struct dvb_frontend *fe, u32 *freq);
-extern int tda18271_calc_rf_cal(struct dvb_frontend *fe, u32 *freq);
-
-#endif /* __TDA18271_PRIV_H__ */
-
-/*
- * Overrides for Emacs so that we follow Linus's tabbing style.
- * ---------------------------------------------------------------------------
- * Local variables:
- * c-basic-offset: 8
- * End:
- */
diff --git a/drivers/media/dvb/frontends/tda18271-tables.c b/drivers/media/dvb/frontends/tda18271-tables.c
deleted file mode 100644
index 83e7561960c..00000000000
--- a/drivers/media/dvb/frontends/tda18271-tables.c
+++ /dev/null
@@ -1,1313 +0,0 @@
-/*
- tda18271-tables.c - driver for the Philips / NXP TDA18271 silicon tuner
-
- Copyright (C) 2007, 2008 Michael Krufky <mkrufky@linuxtv.org>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "tda18271-priv.h"
-
-struct tda18271_pll_map {
- u32 lomax;
- u8 pd; /* post div */
- u8 d; /* div */
-};
-
-struct tda18271_map {
- u32 rfmax;
- u8 val;
-};
-
-/*---------------------------------------------------------------------*/
-
-static struct tda18271_pll_map tda18271c1_main_pll[] = {
- { .lomax = 32000, .pd = 0x5f, .d = 0xf0 },
- { .lomax = 35000, .pd = 0x5e, .d = 0xe0 },
- { .lomax = 37000, .pd = 0x5d, .d = 0xd0 },
- { .lomax = 41000, .pd = 0x5c, .d = 0xc0 },
- { .lomax = 44000, .pd = 0x5b, .d = 0xb0 },
- { .lomax = 49000, .pd = 0x5a, .d = 0xa0 },
- { .lomax = 54000, .pd = 0x59, .d = 0x90 },
- { .lomax = 61000, .pd = 0x58, .d = 0x80 },
- { .lomax = 65000, .pd = 0x4f, .d = 0x78 },
- { .lomax = 70000, .pd = 0x4e, .d = 0x70 },
- { .lomax = 75000, .pd = 0x4d, .d = 0x68 },
- { .lomax = 82000, .pd = 0x4c, .d = 0x60 },
- { .lomax = 89000, .pd = 0x4b, .d = 0x58 },
- { .lomax = 98000, .pd = 0x4a, .d = 0x50 },
- { .lomax = 109000, .pd = 0x49, .d = 0x48 },
- { .lomax = 123000, .pd = 0x48, .d = 0x40 },
- { .lomax = 131000, .pd = 0x3f, .d = 0x3c },
- { .lomax = 141000, .pd = 0x3e, .d = 0x38 },
- { .lomax = 151000, .pd = 0x3d, .d = 0x34 },
- { .lomax = 164000, .pd = 0x3c, .d = 0x30 },
- { .lomax = 179000, .pd = 0x3b, .d = 0x2c },
- { .lomax = 197000, .pd = 0x3a, .d = 0x28 },
- { .lomax = 219000, .pd = 0x39, .d = 0x24 },
- { .lomax = 246000, .pd = 0x38, .d = 0x20 },
- { .lomax = 263000, .pd = 0x2f, .d = 0x1e },
- { .lomax = 282000, .pd = 0x2e, .d = 0x1c },
- { .lomax = 303000, .pd = 0x2d, .d = 0x1a },
- { .lomax = 329000, .pd = 0x2c, .d = 0x18 },
- { .lomax = 359000, .pd = 0x2b, .d = 0x16 },
- { .lomax = 395000, .pd = 0x2a, .d = 0x14 },
- { .lomax = 438000, .pd = 0x29, .d = 0x12 },
- { .lomax = 493000, .pd = 0x28, .d = 0x10 },
- { .lomax = 526000, .pd = 0x1f, .d = 0x0f },
- { .lomax = 564000, .pd = 0x1e, .d = 0x0e },
- { .lomax = 607000, .pd = 0x1d, .d = 0x0d },
- { .lomax = 658000, .pd = 0x1c, .d = 0x0c },
- { .lomax = 718000, .pd = 0x1b, .d = 0x0b },
- { .lomax = 790000, .pd = 0x1a, .d = 0x0a },
- { .lomax = 877000, .pd = 0x19, .d = 0x09 },
- { .lomax = 987000, .pd = 0x18, .d = 0x08 },
- { .lomax = 0, .pd = 0x00, .d = 0x00 }, /* end */
-};
-
-static struct tda18271_pll_map tda18271c2_main_pll[] = {
- { .lomax = 33125, .pd = 0x57, .d = 0xf0 },
- { .lomax = 35500, .pd = 0x56, .d = 0xe0 },
- { .lomax = 38188, .pd = 0x55, .d = 0xd0 },
- { .lomax = 41375, .pd = 0x54, .d = 0xc0 },
- { .lomax = 45125, .pd = 0x53, .d = 0xb0 },
- { .lomax = 49688, .pd = 0x52, .d = 0xa0 },
- { .lomax = 55188, .pd = 0x51, .d = 0x90 },
- { .lomax = 62125, .pd = 0x50, .d = 0x80 },
- { .lomax = 66250, .pd = 0x47, .d = 0x78 },
- { .lomax = 71000, .pd = 0x46, .d = 0x70 },
- { .lomax = 76375, .pd = 0x45, .d = 0x68 },
- { .lomax = 82750, .pd = 0x44, .d = 0x60 },
- { .lomax = 90250, .pd = 0x43, .d = 0x58 },
- { .lomax = 99375, .pd = 0x42, .d = 0x50 },
- { .lomax = 110375, .pd = 0x41, .d = 0x48 },
- { .lomax = 124250, .pd = 0x40, .d = 0x40 },
- { .lomax = 132500, .pd = 0x37, .d = 0x3c },
- { .lomax = 142000, .pd = 0x36, .d = 0x38 },
- { .lomax = 152750, .pd = 0x35, .d = 0x34 },
- { .lomax = 165500, .pd = 0x34, .d = 0x30 },
- { .lomax = 180500, .pd = 0x33, .d = 0x2c },
- { .lomax = 198750, .pd = 0x32, .d = 0x28 },
- { .lomax = 220750, .pd = 0x31, .d = 0x24 },
- { .lomax = 248500, .pd = 0x30, .d = 0x20 },
- { .lomax = 265000, .pd = 0x27, .d = 0x1e },
- { .lomax = 284000, .pd = 0x26, .d = 0x1c },
- { .lomax = 305500, .pd = 0x25, .d = 0x1a },
- { .lomax = 331000, .pd = 0x24, .d = 0x18 },
- { .lomax = 361000, .pd = 0x23, .d = 0x16 },
- { .lomax = 397500, .pd = 0x22, .d = 0x14 },
- { .lomax = 441500, .pd = 0x21, .d = 0x12 },
- { .lomax = 497000, .pd = 0x20, .d = 0x10 },
- { .lomax = 530000, .pd = 0x17, .d = 0x0f },
- { .lomax = 568000, .pd = 0x16, .d = 0x0e },
- { .lomax = 611000, .pd = 0x15, .d = 0x0d },
- { .lomax = 662000, .pd = 0x14, .d = 0x0c },
- { .lomax = 722000, .pd = 0x13, .d = 0x0b },
- { .lomax = 795000, .pd = 0x12, .d = 0x0a },
- { .lomax = 883000, .pd = 0x11, .d = 0x09 },
- { .lomax = 994000, .pd = 0x10, .d = 0x08 },
- { .lomax = 0, .pd = 0x00, .d = 0x00 }, /* end */
-};
-
-static struct tda18271_pll_map tda18271c1_cal_pll[] = {
- { .lomax = 33000, .pd = 0xdd, .d = 0xd0 },
- { .lomax = 36000, .pd = 0xdc, .d = 0xc0 },
- { .lomax = 40000, .pd = 0xdb, .d = 0xb0 },
- { .lomax = 44000, .pd = 0xda, .d = 0xa0 },
- { .lomax = 49000, .pd = 0xd9, .d = 0x90 },
- { .lomax = 55000, .pd = 0xd8, .d = 0x80 },
- { .lomax = 63000, .pd = 0xd3, .d = 0x70 },
- { .lomax = 67000, .pd = 0xcd, .d = 0x68 },
- { .lomax = 73000, .pd = 0xcc, .d = 0x60 },
- { .lomax = 80000, .pd = 0xcb, .d = 0x58 },
- { .lomax = 88000, .pd = 0xca, .d = 0x50 },
- { .lomax = 98000, .pd = 0xc9, .d = 0x48 },
- { .lomax = 110000, .pd = 0xc8, .d = 0x40 },
- { .lomax = 126000, .pd = 0xc3, .d = 0x38 },
- { .lomax = 135000, .pd = 0xbd, .d = 0x34 },
- { .lomax = 147000, .pd = 0xbc, .d = 0x30 },
- { .lomax = 160000, .pd = 0xbb, .d = 0x2c },
- { .lomax = 176000, .pd = 0xba, .d = 0x28 },
- { .lomax = 196000, .pd = 0xb9, .d = 0x24 },
- { .lomax = 220000, .pd = 0xb8, .d = 0x20 },
- { .lomax = 252000, .pd = 0xb3, .d = 0x1c },
- { .lomax = 271000, .pd = 0xad, .d = 0x1a },
- { .lomax = 294000, .pd = 0xac, .d = 0x18 },
- { .lomax = 321000, .pd = 0xab, .d = 0x16 },
- { .lomax = 353000, .pd = 0xaa, .d = 0x14 },
- { .lomax = 392000, .pd = 0xa9, .d = 0x12 },
- { .lomax = 441000, .pd = 0xa8, .d = 0x10 },
- { .lomax = 505000, .pd = 0xa3, .d = 0x0e },
- { .lomax = 543000, .pd = 0x9d, .d = 0x0d },
- { .lomax = 589000, .pd = 0x9c, .d = 0x0c },
- { .lomax = 642000, .pd = 0x9b, .d = 0x0b },
- { .lomax = 707000, .pd = 0x9a, .d = 0x0a },
- { .lomax = 785000, .pd = 0x99, .d = 0x09 },
- { .lomax = 883000, .pd = 0x98, .d = 0x08 },
- { .lomax = 1010000, .pd = 0x93, .d = 0x07 },
- { .lomax = 0, .pd = 0x00, .d = 0x00 }, /* end */
-};
-
-static struct tda18271_pll_map tda18271c2_cal_pll[] = {
- { .lomax = 33813, .pd = 0xdd, .d = 0xd0 },
- { .lomax = 36625, .pd = 0xdc, .d = 0xc0 },
- { .lomax = 39938, .pd = 0xdb, .d = 0xb0 },
- { .lomax = 43938, .pd = 0xda, .d = 0xa0 },
- { .lomax = 48813, .pd = 0xd9, .d = 0x90 },
- { .lomax = 54938, .pd = 0xd8, .d = 0x80 },
- { .lomax = 62813, .pd = 0xd3, .d = 0x70 },
- { .lomax = 67625, .pd = 0xcd, .d = 0x68 },
- { .lomax = 73250, .pd = 0xcc, .d = 0x60 },
- { .lomax = 79875, .pd = 0xcb, .d = 0x58 },
- { .lomax = 87875, .pd = 0xca, .d = 0x50 },
- { .lomax = 97625, .pd = 0xc9, .d = 0x48 },
- { .lomax = 109875, .pd = 0xc8, .d = 0x40 },
- { .lomax = 125625, .pd = 0xc3, .d = 0x38 },
- { .lomax = 135250, .pd = 0xbd, .d = 0x34 },
- { .lomax = 146500, .pd = 0xbc, .d = 0x30 },
- { .lomax = 159750, .pd = 0xbb, .d = 0x2c },
- { .lomax = 175750, .pd = 0xba, .d = 0x28 },
- { .lomax = 195250, .pd = 0xb9, .d = 0x24 },
- { .lomax = 219750, .pd = 0xb8, .d = 0x20 },
- { .lomax = 251250, .pd = 0xb3, .d = 0x1c },
- { .lomax = 270500, .pd = 0xad, .d = 0x1a },
- { .lomax = 293000, .pd = 0xac, .d = 0x18 },
- { .lomax = 319500, .pd = 0xab, .d = 0x16 },
- { .lomax = 351500, .pd = 0xaa, .d = 0x14 },
- { .lomax = 390500, .pd = 0xa9, .d = 0x12 },
- { .lomax = 439500, .pd = 0xa8, .d = 0x10 },
- { .lomax = 502500, .pd = 0xa3, .d = 0x0e },
- { .lomax = 541000, .pd = 0x9d, .d = 0x0d },
- { .lomax = 586000, .pd = 0x9c, .d = 0x0c },
- { .lomax = 639000, .pd = 0x9b, .d = 0x0b },
- { .lomax = 703000, .pd = 0x9a, .d = 0x0a },
- { .lomax = 781000, .pd = 0x99, .d = 0x09 },
- { .lomax = 879000, .pd = 0x98, .d = 0x08 },
- { .lomax = 0, .pd = 0x00, .d = 0x00 }, /* end */
-};
-
-static struct tda18271_map tda18271_bp_filter[] = {
- { .rfmax = 62000, .val = 0x00 },
- { .rfmax = 84000, .val = 0x01 },
- { .rfmax = 100000, .val = 0x02 },
- { .rfmax = 140000, .val = 0x03 },
- { .rfmax = 170000, .val = 0x04 },
- { .rfmax = 180000, .val = 0x05 },
- { .rfmax = 865000, .val = 0x06 },
- { .rfmax = 0, .val = 0x00 }, /* end */
-};
-
-static struct tda18271_map tda18271c1_km[] = {
- { .rfmax = 61100, .val = 0x74 },
- { .rfmax = 350000, .val = 0x40 },
- { .rfmax = 720000, .val = 0x30 },
- { .rfmax = 865000, .val = 0x40 },
- { .rfmax = 0, .val = 0x00 }, /* end */
-};
-
-static struct tda18271_map tda18271c2_km[] = {
- { .rfmax = 47900, .val = 0x38 },
- { .rfmax = 61100, .val = 0x44 },
- { .rfmax = 350000, .val = 0x30 },
- { .rfmax = 720000, .val = 0x24 },
- { .rfmax = 865000, .val = 0x3c },
- { .rfmax = 0, .val = 0x00 }, /* end */
-};
-
-static struct tda18271_map tda18271_rf_band[] = {
- { .rfmax = 47900, .val = 0x00 },
- { .rfmax = 61100, .val = 0x01 },
-/* { .rfmax = 152600, .val = 0x02 }, */
- { .rfmax = 121200, .val = 0x02 },
- { .rfmax = 164700, .val = 0x03 },
- { .rfmax = 203500, .val = 0x04 },
- { .rfmax = 457800, .val = 0x05 },
- { .rfmax = 865000, .val = 0x06 },
- { .rfmax = 0, .val = 0x00 }, /* end */
-};
-
-static struct tda18271_map tda18271_gain_taper[] = {
- { .rfmax = 45400, .val = 0x1f },
- { .rfmax = 45800, .val = 0x1e },
- { .rfmax = 46200, .val = 0x1d },
- { .rfmax = 46700, .val = 0x1c },
- { .rfmax = 47100, .val = 0x1b },
- { .rfmax = 47500, .val = 0x1a },
- { .rfmax = 47900, .val = 0x19 },
- { .rfmax = 49600, .val = 0x17 },
- { .rfmax = 51200, .val = 0x16 },
- { .rfmax = 52900, .val = 0x15 },
- { .rfmax = 54500, .val = 0x14 },
- { .rfmax = 56200, .val = 0x13 },
- { .rfmax = 57800, .val = 0x12 },
- { .rfmax = 59500, .val = 0x11 },
- { .rfmax = 61100, .val = 0x10 },
- { .rfmax = 67600, .val = 0x0d },
- { .rfmax = 74200, .val = 0x0c },
- { .rfmax = 80700, .val = 0x0b },
- { .rfmax = 87200, .val = 0x0a },
- { .rfmax = 93800, .val = 0x09 },
- { .rfmax = 100300, .val = 0x08 },
- { .rfmax = 106900, .val = 0x07 },
- { .rfmax = 113400, .val = 0x06 },
- { .rfmax = 119900, .val = 0x05 },
- { .rfmax = 126500, .val = 0x04 },
- { .rfmax = 133000, .val = 0x03 },
- { .rfmax = 139500, .val = 0x02 },
- { .rfmax = 146100, .val = 0x01 },
- { .rfmax = 152600, .val = 0x00 },
- { .rfmax = 154300, .val = 0x1f },
- { .rfmax = 156100, .val = 0x1e },
- { .rfmax = 157800, .val = 0x1d },
- { .rfmax = 159500, .val = 0x1c },
- { .rfmax = 161200, .val = 0x1b },
- { .rfmax = 163000, .val = 0x1a },
- { .rfmax = 164700, .val = 0x19 },
- { .rfmax = 170200, .val = 0x17 },
- { .rfmax = 175800, .val = 0x16 },
- { .rfmax = 181300, .val = 0x15 },
- { .rfmax = 186900, .val = 0x14 },
- { .rfmax = 192400, .val = 0x13 },
- { .rfmax = 198000, .val = 0x12 },
- { .rfmax = 203500, .val = 0x11 },
- { .rfmax = 216200, .val = 0x14 },
- { .rfmax = 228900, .val = 0x13 },
- { .rfmax = 241600, .val = 0x12 },
- { .rfmax = 254400, .val = 0x11 },
- { .rfmax = 267100, .val = 0x10 },
- { .rfmax = 279800, .val = 0x0f },
- { .rfmax = 292500, .val = 0x0e },
- { .rfmax = 305200, .val = 0x0d },
- { .rfmax = 317900, .val = 0x0c },
- { .rfmax = 330700, .val = 0x0b },
- { .rfmax = 343400, .val = 0x0a },
- { .rfmax = 356100, .val = 0x09 },
- { .rfmax = 368800, .val = 0x08 },
- { .rfmax = 381500, .val = 0x07 },
- { .rfmax = 394200, .val = 0x06 },
- { .rfmax = 406900, .val = 0x05 },
- { .rfmax = 419700, .val = 0x04 },
- { .rfmax = 432400, .val = 0x03 },
- { .rfmax = 445100, .val = 0x02 },
- { .rfmax = 457800, .val = 0x01 },
- { .rfmax = 476300, .val = 0x19 },
- { .rfmax = 494800, .val = 0x18 },
- { .rfmax = 513300, .val = 0x17 },
- { .rfmax = 531800, .val = 0x16 },
- { .rfmax = 550300, .val = 0x15 },
- { .rfmax = 568900, .val = 0x14 },
- { .rfmax = 587400, .val = 0x13 },
- { .rfmax = 605900, .val = 0x12 },
- { .rfmax = 624400, .val = 0x11 },
- { .rfmax = 642900, .val = 0x10 },
- { .rfmax = 661400, .val = 0x0f },
- { .rfmax = 679900, .val = 0x0e },
- { .rfmax = 698400, .val = 0x0d },
- { .rfmax = 716900, .val = 0x0c },
- { .rfmax = 735400, .val = 0x0b },
- { .rfmax = 753900, .val = 0x0a },
- { .rfmax = 772500, .val = 0x09 },
- { .rfmax = 791000, .val = 0x08 },
- { .rfmax = 809500, .val = 0x07 },
- { .rfmax = 828000, .val = 0x06 },
- { .rfmax = 846500, .val = 0x05 },
- { .rfmax = 865000, .val = 0x04 },
- { .rfmax = 0, .val = 0x00 }, /* end */
-};
-
-static struct tda18271_map tda18271c1_rf_cal[] = {
- { .rfmax = 41000, .val = 0x1e },
- { .rfmax = 43000, .val = 0x30 },
- { .rfmax = 45000, .val = 0x43 },
- { .rfmax = 46000, .val = 0x4d },
- { .rfmax = 47000, .val = 0x54 },
- { .rfmax = 47900, .val = 0x64 },
- { .rfmax = 49100, .val = 0x20 },
- { .rfmax = 50000, .val = 0x22 },
- { .rfmax = 51000, .val = 0x2a },
- { .rfmax = 53000, .val = 0x32 },
- { .rfmax = 55000, .val = 0x35 },
- { .rfmax = 56000, .val = 0x3c },
- { .rfmax = 57000, .val = 0x3f },
- { .rfmax = 58000, .val = 0x48 },
- { .rfmax = 59000, .val = 0x4d },
- { .rfmax = 60000, .val = 0x58 },
- { .rfmax = 61100, .val = 0x5f },
- { .rfmax = 0, .val = 0x00 }, /* end */
-};
-
-static struct tda18271_map tda18271c2_rf_cal[] = {
- { .rfmax = 41000, .val = 0x0f },
- { .rfmax = 43000, .val = 0x1c },
- { .rfmax = 45000, .val = 0x2f },
- { .rfmax = 46000, .val = 0x39 },
- { .rfmax = 47000, .val = 0x40 },
- { .rfmax = 47900, .val = 0x50 },
- { .rfmax = 49100, .val = 0x16 },
- { .rfmax = 50000, .val = 0x18 },
- { .rfmax = 51000, .val = 0x20 },
- { .rfmax = 53000, .val = 0x28 },
- { .rfmax = 55000, .val = 0x2b },
- { .rfmax = 56000, .val = 0x32 },
- { .rfmax = 57000, .val = 0x35 },
- { .rfmax = 58000, .val = 0x3e },
- { .rfmax = 59000, .val = 0x43 },
- { .rfmax = 60000, .val = 0x4e },
- { .rfmax = 61100, .val = 0x55 },
- { .rfmax = 63000, .val = 0x0f },
- { .rfmax = 64000, .val = 0x11 },
- { .rfmax = 65000, .val = 0x12 },
- { .rfmax = 66000, .val = 0x15 },
- { .rfmax = 67000, .val = 0x16 },
- { .rfmax = 68000, .val = 0x17 },
- { .rfmax = 70000, .val = 0x19 },
- { .rfmax = 71000, .val = 0x1c },
- { .rfmax = 72000, .val = 0x1d },
- { .rfmax = 73000, .val = 0x1f },
- { .rfmax = 74000, .val = 0x20 },
- { .rfmax = 75000, .val = 0x21 },
- { .rfmax = 76000, .val = 0x24 },
- { .rfmax = 77000, .val = 0x25 },
- { .rfmax = 78000, .val = 0x27 },
- { .rfmax = 80000, .val = 0x28 },
- { .rfmax = 81000, .val = 0x29 },
- { .rfmax = 82000, .val = 0x2d },
- { .rfmax = 83000, .val = 0x2e },
- { .rfmax = 84000, .val = 0x2f },
- { .rfmax = 85000, .val = 0x31 },
- { .rfmax = 86000, .val = 0x33 },
- { .rfmax = 87000, .val = 0x34 },
- { .rfmax = 88000, .val = 0x35 },
- { .rfmax = 89000, .val = 0x37 },
- { .rfmax = 90000, .val = 0x38 },
- { .rfmax = 91000, .val = 0x39 },
- { .rfmax = 93000, .val = 0x3c },
- { .rfmax = 94000, .val = 0x3e },
- { .rfmax = 95000, .val = 0x3f },
- { .rfmax = 96000, .val = 0x40 },
- { .rfmax = 97000, .val = 0x42 },
- { .rfmax = 99000, .val = 0x45 },
- { .rfmax = 100000, .val = 0x46 },
- { .rfmax = 102000, .val = 0x48 },
- { .rfmax = 103000, .val = 0x4a },
- { .rfmax = 105000, .val = 0x4d },
- { .rfmax = 106000, .val = 0x4e },
- { .rfmax = 107000, .val = 0x50 },
- { .rfmax = 108000, .val = 0x51 },
- { .rfmax = 110000, .val = 0x54 },
- { .rfmax = 111000, .val = 0x56 },
- { .rfmax = 112000, .val = 0x57 },
- { .rfmax = 113000, .val = 0x58 },
- { .rfmax = 114000, .val = 0x59 },
- { .rfmax = 115000, .val = 0x5c },
- { .rfmax = 116000, .val = 0x5d },
- { .rfmax = 117000, .val = 0x5f },
- { .rfmax = 119000, .val = 0x60 },
- { .rfmax = 120000, .val = 0x64 },
- { .rfmax = 121000, .val = 0x65 },
- { .rfmax = 122000, .val = 0x66 },
- { .rfmax = 123000, .val = 0x68 },
- { .rfmax = 124000, .val = 0x69 },
- { .rfmax = 125000, .val = 0x6c },
- { .rfmax = 126000, .val = 0x6d },
- { .rfmax = 127000, .val = 0x6e },
- { .rfmax = 128000, .val = 0x70 },
- { .rfmax = 129000, .val = 0x71 },
- { .rfmax = 130000, .val = 0x75 },
- { .rfmax = 131000, .val = 0x77 },
- { .rfmax = 132000, .val = 0x78 },
- { .rfmax = 133000, .val = 0x7b },
- { .rfmax = 134000, .val = 0x7e },
- { .rfmax = 135000, .val = 0x81 },
- { .rfmax = 136000, .val = 0x82 },
- { .rfmax = 137000, .val = 0x87 },
- { .rfmax = 138000, .val = 0x88 },
- { .rfmax = 139000, .val = 0x8d },
- { .rfmax = 140000, .val = 0x8e },
- { .rfmax = 141000, .val = 0x91 },
- { .rfmax = 142000, .val = 0x95 },
- { .rfmax = 143000, .val = 0x9a },
- { .rfmax = 144000, .val = 0x9d },
- { .rfmax = 145000, .val = 0xa1 },
- { .rfmax = 146000, .val = 0xa2 },
- { .rfmax = 147000, .val = 0xa4 },
- { .rfmax = 148000, .val = 0xa9 },
- { .rfmax = 149000, .val = 0xae },
- { .rfmax = 150000, .val = 0xb0 },
- { .rfmax = 151000, .val = 0xb1 },
- { .rfmax = 152000, .val = 0xb7 },
- { .rfmax = 153000, .val = 0xbd },
- { .rfmax = 154000, .val = 0x20 },
- { .rfmax = 155000, .val = 0x22 },
- { .rfmax = 156000, .val = 0x24 },
- { .rfmax = 157000, .val = 0x25 },
- { .rfmax = 158000, .val = 0x27 },
- { .rfmax = 159000, .val = 0x29 },
- { .rfmax = 160000, .val = 0x2c },
- { .rfmax = 161000, .val = 0x2d },
- { .rfmax = 163000, .val = 0x2e },
- { .rfmax = 164000, .val = 0x2f },
- { .rfmax = 165000, .val = 0x30 },
- { .rfmax = 166000, .val = 0x11 },
- { .rfmax = 167000, .val = 0x12 },
- { .rfmax = 168000, .val = 0x13 },
- { .rfmax = 169000, .val = 0x14 },
- { .rfmax = 170000, .val = 0x15 },
- { .rfmax = 172000, .val = 0x16 },
- { .rfmax = 173000, .val = 0x17 },
- { .rfmax = 174000, .val = 0x18 },
- { .rfmax = 175000, .val = 0x1a },
- { .rfmax = 176000, .val = 0x1b },
- { .rfmax = 178000, .val = 0x1d },
- { .rfmax = 179000, .val = 0x1e },
- { .rfmax = 180000, .val = 0x1f },
- { .rfmax = 181000, .val = 0x20 },
- { .rfmax = 182000, .val = 0x21 },
- { .rfmax = 183000, .val = 0x22 },
- { .rfmax = 184000, .val = 0x24 },
- { .rfmax = 185000, .val = 0x25 },
- { .rfmax = 186000, .val = 0x26 },
- { .rfmax = 187000, .val = 0x27 },
- { .rfmax = 188000, .val = 0x29 },
- { .rfmax = 189000, .val = 0x2a },
- { .rfmax = 190000, .val = 0x2c },
- { .rfmax = 191000, .val = 0x2d },
- { .rfmax = 192000, .val = 0x2e },
- { .rfmax = 193000, .val = 0x2f },
- { .rfmax = 194000, .val = 0x30 },
- { .rfmax = 195000, .val = 0x33 },
- { .rfmax = 196000, .val = 0x35 },
- { .rfmax = 198000, .val = 0x36 },
- { .rfmax = 200000, .val = 0x38 },
- { .rfmax = 201000, .val = 0x3c },
- { .rfmax = 202000, .val = 0x3d },
- { .rfmax = 203500, .val = 0x3e },
- { .rfmax = 206000, .val = 0x0e },
- { .rfmax = 208000, .val = 0x0f },
- { .rfmax = 212000, .val = 0x10 },
- { .rfmax = 216000, .val = 0x11 },
- { .rfmax = 217000, .val = 0x12 },
- { .rfmax = 218000, .val = 0x13 },
- { .rfmax = 220000, .val = 0x14 },
- { .rfmax = 222000, .val = 0x15 },
- { .rfmax = 225000, .val = 0x16 },
- { .rfmax = 228000, .val = 0x17 },
- { .rfmax = 231000, .val = 0x18 },
- { .rfmax = 234000, .val = 0x19 },
- { .rfmax = 235000, .val = 0x1a },
- { .rfmax = 236000, .val = 0x1b },
- { .rfmax = 237000, .val = 0x1c },
- { .rfmax = 240000, .val = 0x1d },
- { .rfmax = 242000, .val = 0x1f },
- { .rfmax = 247000, .val = 0x20 },
- { .rfmax = 249000, .val = 0x21 },
- { .rfmax = 252000, .val = 0x22 },
- { .rfmax = 253000, .val = 0x23 },
- { .rfmax = 254000, .val = 0x24 },
- { .rfmax = 256000, .val = 0x25 },
- { .rfmax = 259000, .val = 0x26 },
- { .rfmax = 262000, .val = 0x27 },
- { .rfmax = 264000, .val = 0x28 },
- { .rfmax = 267000, .val = 0x29 },
- { .rfmax = 269000, .val = 0x2a },
- { .rfmax = 271000, .val = 0x2b },
- { .rfmax = 273000, .val = 0x2c },
- { .rfmax = 275000, .val = 0x2d },
- { .rfmax = 277000, .val = 0x2e },
- { .rfmax = 279000, .val = 0x2f },
- { .rfmax = 282000, .val = 0x30 },
- { .rfmax = 284000, .val = 0x31 },
- { .rfmax = 286000, .val = 0x32 },
- { .rfmax = 287000, .val = 0x33 },
- { .rfmax = 290000, .val = 0x34 },
- { .rfmax = 293000, .val = 0x35 },
- { .rfmax = 295000, .val = 0x36 },
- { .rfmax = 297000, .val = 0x37 },
- { .rfmax = 300000, .val = 0x38 },
- { .rfmax = 303000, .val = 0x39 },
- { .rfmax = 305000, .val = 0x3a },
- { .rfmax = 306000, .val = 0x3b },
- { .rfmax = 307000, .val = 0x3c },
- { .rfmax = 310000, .val = 0x3d },
- { .rfmax = 312000, .val = 0x3e },
- { .rfmax = 315000, .val = 0x3f },
- { .rfmax = 318000, .val = 0x40 },
- { .rfmax = 320000, .val = 0x41 },
- { .rfmax = 323000, .val = 0x42 },
- { .rfmax = 324000, .val = 0x43 },
- { .rfmax = 325000, .val = 0x44 },
- { .rfmax = 327000, .val = 0x45 },
- { .rfmax = 331000, .val = 0x46 },
- { .rfmax = 334000, .val = 0x47 },
- { .rfmax = 337000, .val = 0x48 },
- { .rfmax = 339000, .val = 0x49 },
- { .rfmax = 340000, .val = 0x4a },
- { .rfmax = 341000, .val = 0x4b },
- { .rfmax = 343000, .val = 0x4c },
- { .rfmax = 345000, .val = 0x4d },
- { .rfmax = 349000, .val = 0x4e },
- { .rfmax = 352000, .val = 0x4f },
- { .rfmax = 353000, .val = 0x50 },
- { .rfmax = 355000, .val = 0x51 },
- { .rfmax = 357000, .val = 0x52 },
- { .rfmax = 359000, .val = 0x53 },
- { .rfmax = 361000, .val = 0x54 },
- { .rfmax = 362000, .val = 0x55 },
- { .rfmax = 364000, .val = 0x56 },
- { .rfmax = 368000, .val = 0x57 },
- { .rfmax = 370000, .val = 0x58 },
- { .rfmax = 372000, .val = 0x59 },
- { .rfmax = 375000, .val = 0x5a },
- { .rfmax = 376000, .val = 0x5b },
- { .rfmax = 377000, .val = 0x5c },
- { .rfmax = 379000, .val = 0x5d },
- { .rfmax = 382000, .val = 0x5e },
- { .rfmax = 384000, .val = 0x5f },
- { .rfmax = 385000, .val = 0x60 },
- { .rfmax = 386000, .val = 0x61 },
- { .rfmax = 388000, .val = 0x62 },
- { .rfmax = 390000, .val = 0x63 },
- { .rfmax = 393000, .val = 0x64 },
- { .rfmax = 394000, .val = 0x65 },
- { .rfmax = 396000, .val = 0x66 },
- { .rfmax = 397000, .val = 0x67 },
- { .rfmax = 398000, .val = 0x68 },
- { .rfmax = 400000, .val = 0x69 },
- { .rfmax = 402000, .val = 0x6a },
- { .rfmax = 403000, .val = 0x6b },
- { .rfmax = 407000, .val = 0x6c },
- { .rfmax = 408000, .val = 0x6d },
- { .rfmax = 409000, .val = 0x6e },
- { .rfmax = 410000, .val = 0x6f },
- { .rfmax = 411000, .val = 0x70 },
- { .rfmax = 412000, .val = 0x71 },
- { .rfmax = 413000, .val = 0x72 },
- { .rfmax = 414000, .val = 0x73 },
- { .rfmax = 417000, .val = 0x74 },
- { .rfmax = 418000, .val = 0x75 },
- { .rfmax = 420000, .val = 0x76 },
- { .rfmax = 422000, .val = 0x77 },
- { .rfmax = 423000, .val = 0x78 },
- { .rfmax = 424000, .val = 0x79 },
- { .rfmax = 427000, .val = 0x7a },
- { .rfmax = 428000, .val = 0x7b },
- { .rfmax = 429000, .val = 0x7d },
- { .rfmax = 432000, .val = 0x7f },
- { .rfmax = 434000, .val = 0x80 },
- { .rfmax = 435000, .val = 0x81 },
- { .rfmax = 436000, .val = 0x83 },
- { .rfmax = 437000, .val = 0x84 },
- { .rfmax = 438000, .val = 0x85 },
- { .rfmax = 439000, .val = 0x86 },
- { .rfmax = 440000, .val = 0x87 },
- { .rfmax = 441000, .val = 0x88 },
- { .rfmax = 442000, .val = 0x89 },
- { .rfmax = 445000, .val = 0x8a },
- { .rfmax = 446000, .val = 0x8b },
- { .rfmax = 447000, .val = 0x8c },
- { .rfmax = 448000, .val = 0x8e },
- { .rfmax = 449000, .val = 0x8f },
- { .rfmax = 450000, .val = 0x90 },
- { .rfmax = 452000, .val = 0x91 },
- { .rfmax = 453000, .val = 0x93 },
- { .rfmax = 454000, .val = 0x94 },
- { .rfmax = 456000, .val = 0x96 },
- { .rfmax = 457000, .val = 0x98 },
- { .rfmax = 461000, .val = 0x11 },
- { .rfmax = 468000, .val = 0x12 },
- { .rfmax = 472000, .val = 0x13 },
- { .rfmax = 473000, .val = 0x14 },
- { .rfmax = 474000, .val = 0x15 },
- { .rfmax = 481000, .val = 0x16 },
- { .rfmax = 486000, .val = 0x17 },
- { .rfmax = 491000, .val = 0x18 },
- { .rfmax = 498000, .val = 0x19 },
- { .rfmax = 499000, .val = 0x1a },
- { .rfmax = 501000, .val = 0x1b },
- { .rfmax = 506000, .val = 0x1c },
- { .rfmax = 511000, .val = 0x1d },
- { .rfmax = 516000, .val = 0x1e },
- { .rfmax = 520000, .val = 0x1f },
- { .rfmax = 521000, .val = 0x20 },
- { .rfmax = 525000, .val = 0x21 },
- { .rfmax = 529000, .val = 0x22 },
- { .rfmax = 533000, .val = 0x23 },
- { .rfmax = 539000, .val = 0x24 },
- { .rfmax = 541000, .val = 0x25 },
- { .rfmax = 547000, .val = 0x26 },
- { .rfmax = 549000, .val = 0x27 },
- { .rfmax = 551000, .val = 0x28 },
- { .rfmax = 556000, .val = 0x29 },
- { .rfmax = 561000, .val = 0x2a },
- { .rfmax = 563000, .val = 0x2b },
- { .rfmax = 565000, .val = 0x2c },
- { .rfmax = 569000, .val = 0x2d },
- { .rfmax = 571000, .val = 0x2e },
- { .rfmax = 577000, .val = 0x2f },
- { .rfmax = 580000, .val = 0x30 },
- { .rfmax = 582000, .val = 0x31 },
- { .rfmax = 584000, .val = 0x32 },
- { .rfmax = 588000, .val = 0x33 },
- { .rfmax = 591000, .val = 0x34 },
- { .rfmax = 596000, .val = 0x35 },
- { .rfmax = 598000, .val = 0x36 },
- { .rfmax = 603000, .val = 0x37 },
- { .rfmax = 604000, .val = 0x38 },
- { .rfmax = 606000, .val = 0x39 },
- { .rfmax = 612000, .val = 0x3a },
- { .rfmax = 615000, .val = 0x3b },
- { .rfmax = 617000, .val = 0x3c },
- { .rfmax = 621000, .val = 0x3d },
- { .rfmax = 622000, .val = 0x3e },
- { .rfmax = 625000, .val = 0x3f },
- { .rfmax = 632000, .val = 0x40 },
- { .rfmax = 633000, .val = 0x41 },
- { .rfmax = 634000, .val = 0x42 },
- { .rfmax = 642000, .val = 0x43 },
- { .rfmax = 643000, .val = 0x44 },
- { .rfmax = 647000, .val = 0x45 },
- { .rfmax = 650000, .val = 0x46 },
- { .rfmax = 652000, .val = 0x47 },
- { .rfmax = 657000, .val = 0x48 },
- { .rfmax = 661000, .val = 0x49 },
- { .rfmax = 662000, .val = 0x4a },
- { .rfmax = 665000, .val = 0x4b },
- { .rfmax = 667000, .val = 0x4c },
- { .rfmax = 670000, .val = 0x4d },
- { .rfmax = 673000, .val = 0x4e },
- { .rfmax = 676000, .val = 0x4f },
- { .rfmax = 677000, .val = 0x50 },
- { .rfmax = 681000, .val = 0x51 },
- { .rfmax = 683000, .val = 0x52 },
- { .rfmax = 686000, .val = 0x53 },
- { .rfmax = 688000, .val = 0x54 },
- { .rfmax = 689000, .val = 0x55 },
- { .rfmax = 691000, .val = 0x56 },
- { .rfmax = 695000, .val = 0x57 },
- { .rfmax = 698000, .val = 0x58 },
- { .rfmax = 703000, .val = 0x59 },
- { .rfmax = 704000, .val = 0x5a },
- { .rfmax = 705000, .val = 0x5b },
- { .rfmax = 707000, .val = 0x5c },
- { .rfmax = 710000, .val = 0x5d },
- { .rfmax = 712000, .val = 0x5e },
- { .rfmax = 717000, .val = 0x5f },
- { .rfmax = 718000, .val = 0x60 },
- { .rfmax = 721000, .val = 0x61 },
- { .rfmax = 722000, .val = 0x62 },
- { .rfmax = 723000, .val = 0x63 },
- { .rfmax = 725000, .val = 0x64 },
- { .rfmax = 727000, .val = 0x65 },
- { .rfmax = 730000, .val = 0x66 },
- { .rfmax = 732000, .val = 0x67 },
- { .rfmax = 735000, .val = 0x68 },
- { .rfmax = 740000, .val = 0x69 },
- { .rfmax = 741000, .val = 0x6a },
- { .rfmax = 742000, .val = 0x6b },
- { .rfmax = 743000, .val = 0x6c },
- { .rfmax = 745000, .val = 0x6d },
- { .rfmax = 747000, .val = 0x6e },
- { .rfmax = 748000, .val = 0x6f },
- { .rfmax = 750000, .val = 0x70 },
- { .rfmax = 752000, .val = 0x71 },
- { .rfmax = 754000, .val = 0x72 },
- { .rfmax = 757000, .val = 0x73 },
- { .rfmax = 758000, .val = 0x74 },
- { .rfmax = 760000, .val = 0x75 },
- { .rfmax = 763000, .val = 0x76 },
- { .rfmax = 764000, .val = 0x77 },
- { .rfmax = 766000, .val = 0x78 },
- { .rfmax = 767000, .val = 0x79 },
- { .rfmax = 768000, .val = 0x7a },
- { .rfmax = 773000, .val = 0x7b },
- { .rfmax = 774000, .val = 0x7c },
- { .rfmax = 776000, .val = 0x7d },
- { .rfmax = 777000, .val = 0x7e },
- { .rfmax = 778000, .val = 0x7f },
- { .rfmax = 779000, .val = 0x80 },
- { .rfmax = 781000, .val = 0x81 },
- { .rfmax = 783000, .val = 0x82 },
- { .rfmax = 784000, .val = 0x83 },
- { .rfmax = 785000, .val = 0x84 },
- { .rfmax = 786000, .val = 0x85 },
- { .rfmax = 793000, .val = 0x86 },
- { .rfmax = 794000, .val = 0x87 },
- { .rfmax = 795000, .val = 0x88 },
- { .rfmax = 797000, .val = 0x89 },
- { .rfmax = 799000, .val = 0x8a },
- { .rfmax = 801000, .val = 0x8b },
- { .rfmax = 802000, .val = 0x8c },
- { .rfmax = 803000, .val = 0x8d },
- { .rfmax = 804000, .val = 0x8e },
- { .rfmax = 810000, .val = 0x90 },
- { .rfmax = 811000, .val = 0x91 },
- { .rfmax = 812000, .val = 0x92 },
- { .rfmax = 814000, .val = 0x93 },
- { .rfmax = 816000, .val = 0x94 },
- { .rfmax = 817000, .val = 0x96 },
- { .rfmax = 818000, .val = 0x97 },
- { .rfmax = 820000, .val = 0x98 },
- { .rfmax = 821000, .val = 0x99 },
- { .rfmax = 822000, .val = 0x9a },
- { .rfmax = 828000, .val = 0x9b },
- { .rfmax = 829000, .val = 0x9d },
- { .rfmax = 830000, .val = 0x9f },
- { .rfmax = 831000, .val = 0xa0 },
- { .rfmax = 833000, .val = 0xa1 },
- { .rfmax = 835000, .val = 0xa2 },
- { .rfmax = 836000, .val = 0xa3 },
- { .rfmax = 837000, .val = 0xa4 },
- { .rfmax = 838000, .val = 0xa6 },
- { .rfmax = 840000, .val = 0xa8 },
- { .rfmax = 842000, .val = 0xa9 },
- { .rfmax = 845000, .val = 0xaa },
- { .rfmax = 846000, .val = 0xab },
- { .rfmax = 847000, .val = 0xad },
- { .rfmax = 848000, .val = 0xae },
- { .rfmax = 852000, .val = 0xaf },
- { .rfmax = 853000, .val = 0xb0 },
- { .rfmax = 858000, .val = 0xb1 },
- { .rfmax = 860000, .val = 0xb2 },
- { .rfmax = 861000, .val = 0xb3 },
- { .rfmax = 862000, .val = 0xb4 },
- { .rfmax = 863000, .val = 0xb6 },
- { .rfmax = 864000, .val = 0xb8 },
- { .rfmax = 865000, .val = 0xb9 },
- { .rfmax = 0, .val = 0x00 }, /* end */
-};
-
-static struct tda18271_map tda18271_ir_measure[] = {
- { .rfmax = 30000, .val = 4 },
- { .rfmax = 200000, .val = 5 },
- { .rfmax = 600000, .val = 6 },
- { .rfmax = 865000, .val = 7 },
- { .rfmax = 0, .val = 0 }, /* end */
-};
-
-static struct tda18271_map tda18271_rf_cal_dc_over_dt[] = {
- { .rfmax = 47900, .val = 0x00 },
- { .rfmax = 55000, .val = 0x00 },
- { .rfmax = 61100, .val = 0x0a },
- { .rfmax = 64000, .val = 0x0a },
- { .rfmax = 82000, .val = 0x14 },
- { .rfmax = 84000, .val = 0x19 },
- { .rfmax = 119000, .val = 0x1c },
- { .rfmax = 124000, .val = 0x20 },
- { .rfmax = 129000, .val = 0x2a },
- { .rfmax = 134000, .val = 0x32 },
- { .rfmax = 139000, .val = 0x39 },
- { .rfmax = 144000, .val = 0x3e },
- { .rfmax = 149000, .val = 0x3f },
- { .rfmax = 152600, .val = 0x40 },
- { .rfmax = 154000, .val = 0x40 },
- { .rfmax = 164700, .val = 0x41 },
- { .rfmax = 203500, .val = 0x32 },
- { .rfmax = 353000, .val = 0x19 },
- { .rfmax = 356000, .val = 0x1a },
- { .rfmax = 359000, .val = 0x1b },
- { .rfmax = 363000, .val = 0x1c },
- { .rfmax = 366000, .val = 0x1d },
- { .rfmax = 369000, .val = 0x1e },
- { .rfmax = 373000, .val = 0x1f },
- { .rfmax = 376000, .val = 0x20 },
- { .rfmax = 379000, .val = 0x21 },
- { .rfmax = 383000, .val = 0x22 },
- { .rfmax = 386000, .val = 0x23 },
- { .rfmax = 389000, .val = 0x24 },
- { .rfmax = 393000, .val = 0x25 },
- { .rfmax = 396000, .val = 0x26 },
- { .rfmax = 399000, .val = 0x27 },
- { .rfmax = 402000, .val = 0x28 },
- { .rfmax = 404000, .val = 0x29 },
- { .rfmax = 407000, .val = 0x2a },
- { .rfmax = 409000, .val = 0x2b },
- { .rfmax = 412000, .val = 0x2c },
- { .rfmax = 414000, .val = 0x2d },
- { .rfmax = 417000, .val = 0x2e },
- { .rfmax = 419000, .val = 0x2f },
- { .rfmax = 422000, .val = 0x30 },
- { .rfmax = 424000, .val = 0x31 },
- { .rfmax = 427000, .val = 0x32 },
- { .rfmax = 429000, .val = 0x33 },
- { .rfmax = 432000, .val = 0x34 },
- { .rfmax = 434000, .val = 0x35 },
- { .rfmax = 437000, .val = 0x36 },
- { .rfmax = 439000, .val = 0x37 },
- { .rfmax = 442000, .val = 0x38 },
- { .rfmax = 444000, .val = 0x39 },
- { .rfmax = 447000, .val = 0x3a },
- { .rfmax = 449000, .val = 0x3b },
- { .rfmax = 457800, .val = 0x3c },
- { .rfmax = 465000, .val = 0x0f },
- { .rfmax = 477000, .val = 0x12 },
- { .rfmax = 483000, .val = 0x14 },
- { .rfmax = 502000, .val = 0x19 },
- { .rfmax = 508000, .val = 0x1b },
- { .rfmax = 519000, .val = 0x1c },
- { .rfmax = 522000, .val = 0x1d },
- { .rfmax = 524000, .val = 0x1e },
- { .rfmax = 534000, .val = 0x1f },
- { .rfmax = 549000, .val = 0x20 },
- { .rfmax = 554000, .val = 0x22 },
- { .rfmax = 584000, .val = 0x24 },
- { .rfmax = 589000, .val = 0x26 },
- { .rfmax = 658000, .val = 0x27 },
- { .rfmax = 664000, .val = 0x2c },
- { .rfmax = 669000, .val = 0x2d },
- { .rfmax = 699000, .val = 0x2e },
- { .rfmax = 704000, .val = 0x30 },
- { .rfmax = 709000, .val = 0x31 },
- { .rfmax = 714000, .val = 0x32 },
- { .rfmax = 724000, .val = 0x33 },
- { .rfmax = 729000, .val = 0x36 },
- { .rfmax = 739000, .val = 0x38 },
- { .rfmax = 744000, .val = 0x39 },
- { .rfmax = 749000, .val = 0x3b },
- { .rfmax = 754000, .val = 0x3c },
- { .rfmax = 759000, .val = 0x3d },
- { .rfmax = 764000, .val = 0x3e },
- { .rfmax = 769000, .val = 0x3f },
- { .rfmax = 774000, .val = 0x40 },
- { .rfmax = 779000, .val = 0x41 },
- { .rfmax = 784000, .val = 0x43 },
- { .rfmax = 789000, .val = 0x46 },
- { .rfmax = 794000, .val = 0x48 },
- { .rfmax = 799000, .val = 0x4b },
- { .rfmax = 804000, .val = 0x4f },
- { .rfmax = 809000, .val = 0x54 },
- { .rfmax = 814000, .val = 0x59 },
- { .rfmax = 819000, .val = 0x5d },
- { .rfmax = 824000, .val = 0x61 },
- { .rfmax = 829000, .val = 0x68 },
- { .rfmax = 834000, .val = 0x6e },
- { .rfmax = 839000, .val = 0x75 },
- { .rfmax = 844000, .val = 0x7e },
- { .rfmax = 849000, .val = 0x82 },
- { .rfmax = 854000, .val = 0x84 },
- { .rfmax = 859000, .val = 0x8f },
- { .rfmax = 865000, .val = 0x9a },
- { .rfmax = 0, .val = 0x00 }, /* end */
-};
-
-/*---------------------------------------------------------------------*/
-
-struct tda18271_thermo_map {
- u8 d;
- u8 r0;
- u8 r1;
-};
-
-static struct tda18271_thermo_map tda18271_thermometer[] = {
- { .d = 0x00, .r0 = 60, .r1 = 92 },
- { .d = 0x01, .r0 = 62, .r1 = 94 },
- { .d = 0x02, .r0 = 66, .r1 = 98 },
- { .d = 0x03, .r0 = 64, .r1 = 96 },
- { .d = 0x04, .r0 = 74, .r1 = 106 },
- { .d = 0x05, .r0 = 72, .r1 = 104 },
- { .d = 0x06, .r0 = 68, .r1 = 100 },
- { .d = 0x07, .r0 = 70, .r1 = 102 },
- { .d = 0x08, .r0 = 90, .r1 = 122 },
- { .d = 0x09, .r0 = 88, .r1 = 120 },
- { .d = 0x0a, .r0 = 84, .r1 = 116 },
- { .d = 0x0b, .r0 = 86, .r1 = 118 },
- { .d = 0x0c, .r0 = 76, .r1 = 108 },
- { .d = 0x0d, .r0 = 78, .r1 = 110 },
- { .d = 0x0e, .r0 = 82, .r1 = 114 },
- { .d = 0x0f, .r0 = 80, .r1 = 112 },
- { .d = 0x00, .r0 = 0, .r1 = 0 }, /* end */
-};
-
-int tda18271_lookup_thermometer(struct dvb_frontend *fe)
-{
- struct tda18271_priv *priv = fe->tuner_priv;
- unsigned char *regs = priv->tda18271_regs;
- int val, i = 0;
-
- while (tda18271_thermometer[i].d < (regs[R_TM] & 0x0f)) {
- if (tda18271_thermometer[i + 1].d == 0)
- break;
- i++;
- }
-
- if ((regs[R_TM] & 0x20) == 0x20)
- val = tda18271_thermometer[i].r1;
- else
- val = tda18271_thermometer[i].r0;
-
- tda_map("(%d) tm = %d\n", i, val);
-
- return val;
-}
-
-/*---------------------------------------------------------------------*/
-
-struct tda18271_cid_target_map {
- u32 rfmax;
- u8 target;
- u16 limit;
-};
-
-static struct tda18271_cid_target_map tda18271_cid_target[] = {
- { .rfmax = 46000, .target = 0x04, .limit = 1800 },
- { .rfmax = 52200, .target = 0x0a, .limit = 1500 },
- { .rfmax = 79100, .target = 0x01, .limit = 4000 },
- { .rfmax = 136800, .target = 0x18, .limit = 4000 },
- { .rfmax = 156700, .target = 0x18, .limit = 4000 },
- { .rfmax = 156700, .target = 0x18, .limit = 4000 },
- { .rfmax = 186250, .target = 0x0a, .limit = 4000 },
- { .rfmax = 230000, .target = 0x0a, .limit = 4000 },
- { .rfmax = 345000, .target = 0x18, .limit = 4000 },
- { .rfmax = 426000, .target = 0x0e, .limit = 4000 },
- { .rfmax = 489500, .target = 0x1e, .limit = 4000 },
- { .rfmax = 697500, .target = 0x32, .limit = 4000 },
- { .rfmax = 842000, .target = 0x3a, .limit = 4000 },
- { .rfmax = 0, .target = 0x00, .limit = 0 }, /* end */
-};
-
-int tda18271_lookup_cid_target(struct dvb_frontend *fe,
- u32 *freq, u8 *cid_target, u16 *count_limit)
-{
- int i = 0;
-
- while ((tda18271_cid_target[i].rfmax * 1000) < *freq) {
- if (tda18271_cid_target[i + 1].rfmax == 0)
- break;
- i++;
- }
- *cid_target = tda18271_cid_target[i].target;
- *count_limit = tda18271_cid_target[i].limit;
-
- tda_map("(%d) cid_target = %02x, count_limit = %d\n", i,
- tda18271_cid_target[i].target, tda18271_cid_target[i].limit);
-
- return 0;
-}
-
-/*---------------------------------------------------------------------*/
-
-static struct tda18271_rf_tracking_filter_cal tda18271_rf_band_template[] = {
- { .rfmax = 47900, .rfband = 0x00,
- .rf1_def = 46000, .rf2_def = 0, .rf3_def = 0 },
- { .rfmax = 61100, .rfband = 0x01,
- .rf1_def = 52200, .rf2_def = 0, .rf3_def = 0 },
- { .rfmax = 152600, .rfband = 0x02,
- .rf1_def = 70100, .rf2_def = 136800, .rf3_def = 0 },
- { .rfmax = 164700, .rfband = 0x03,
- .rf1_def = 156700, .rf2_def = 0, .rf3_def = 0 },
- { .rfmax = 203500, .rfband = 0x04,
- .rf1_def = 186250, .rf2_def = 0, .rf3_def = 0 },
- { .rfmax = 457800, .rfband = 0x05,
- .rf1_def = 230000, .rf2_def = 345000, .rf3_def = 426000 },
- { .rfmax = 865000, .rfband = 0x06,
- .rf1_def = 489500, .rf2_def = 697500, .rf3_def = 842000 },
- { .rfmax = 0, .rfband = 0x00,
- .rf1_def = 0, .rf2_def = 0, .rf3_def = 0 }, /* end */
-};
-
-int tda18271_lookup_rf_band(struct dvb_frontend *fe, u32 *freq, u8 *rf_band)
-{
- struct tda18271_priv *priv = fe->tuner_priv;
- struct tda18271_rf_tracking_filter_cal *map = priv->rf_cal_state;
- int i = 0;
-
- while ((map[i].rfmax * 1000) < *freq) {
- if (tda18271_debug & DBG_ADV)
- tda_map("(%d) rfmax = %d < freq = %d, "
- "rf1_def = %d, rf2_def = %d, rf3_def = %d, "
- "rf1 = %d, rf2 = %d, rf3 = %d, "
- "rf_a1 = %d, rf_a2 = %d, "
- "rf_b1 = %d, rf_b2 = %d\n",
- i, map[i].rfmax * 1000, *freq,
- map[i].rf1_def, map[i].rf2_def, map[i].rf3_def,
- map[i].rf1, map[i].rf2, map[i].rf3,
- map[i].rf_a1, map[i].rf_a2,
- map[i].rf_b1, map[i].rf_b2);
- if (map[i].rfmax == 0)
- return -EINVAL;
- i++;
- }
- if (rf_band)
- *rf_band = map[i].rfband;
-
- tda_map("(%d) rf_band = %02x\n", i, map[i].rfband);
-
- return i;
-}
-
-/*---------------------------------------------------------------------*/
-
-struct tda18271_map_layout {
- struct tda18271_pll_map *main_pll;
- struct tda18271_pll_map *cal_pll;
-
- struct tda18271_map *rf_cal;
- struct tda18271_map *rf_cal_kmco;
- struct tda18271_map *rf_cal_dc_over_dt;
-
- struct tda18271_map *bp_filter;
- struct tda18271_map *rf_band;
- struct tda18271_map *gain_taper;
- struct tda18271_map *ir_measure;
-};
-
-/*---------------------------------------------------------------------*/
-
-int tda18271_lookup_pll_map(struct dvb_frontend *fe,
- enum tda18271_map_type map_type,
- u32 *freq, u8 *post_div, u8 *div)
-{
- struct tda18271_priv *priv = fe->tuner_priv;
- struct tda18271_pll_map *map = NULL;
- unsigned int i = 0;
- char *map_name;
- int ret = 0;
-
- BUG_ON(!priv->maps);
-
- switch (map_type) {
- case MAIN_PLL:
- map = priv->maps->main_pll;
- map_name = "main_pll";
- break;
- case CAL_PLL:
- map = priv->maps->cal_pll;
- map_name = "cal_pll";
- break;
- default:
- /* we should never get here */
- map_name = "undefined";
- break;
- }
-
- if (!map) {
- tda_warn("%s map is not set!\n", map_name);
- ret = -EINVAL;
- goto fail;
- }
-
- while ((map[i].lomax * 1000) < *freq) {
- if (map[i + 1].lomax == 0) {
- tda_map("%s: frequency (%d) out of range\n",
- map_name, *freq);
- ret = -ERANGE;
- break;
- }
- i++;
- }
- *post_div = map[i].pd;
- *div = map[i].d;
-
- tda_map("(%d) %s: post div = 0x%02x, div = 0x%02x\n",
- i, map_name, *post_div, *div);
-fail:
- return ret;
-}
-
-int tda18271_lookup_map(struct dvb_frontend *fe,
- enum tda18271_map_type map_type,
- u32 *freq, u8 *val)
-{
- struct tda18271_priv *priv = fe->tuner_priv;
- struct tda18271_map *map = NULL;
- unsigned int i = 0;
- char *map_name;
- int ret = 0;
-
- BUG_ON(!priv->maps);
-
- switch (map_type) {
- case BP_FILTER:
- map = priv->maps->bp_filter;
- map_name = "bp_filter";
- break;
- case RF_CAL_KMCO:
- map = priv->maps->rf_cal_kmco;
- map_name = "km";
- break;
- case RF_BAND:
- map = priv->maps->rf_band;
- map_name = "rf_band";
- break;
- case GAIN_TAPER:
- map = priv->maps->gain_taper;
- map_name = "gain_taper";
- break;
- case RF_CAL:
- map = priv->maps->rf_cal;
- map_name = "rf_cal";
- break;
- case IR_MEASURE:
- map = priv->maps->ir_measure;
- map_name = "ir_measure";
- break;
- case RF_CAL_DC_OVER_DT:
- map = priv->maps->rf_cal_dc_over_dt;
- map_name = "rf_cal_dc_over_dt";
- break;
- default:
- /* we should never get here */
- map_name = "undefined";
- break;
- }
-
- if (!map) {
- tda_warn("%s map is not set!\n", map_name);
- ret = -EINVAL;
- goto fail;
- }
-
- while ((map[i].rfmax * 1000) < *freq) {
- if (map[i + 1].rfmax == 0) {
- tda_map("%s: frequency (%d) out of range\n",
- map_name, *freq);
- ret = -ERANGE;
- break;
- }
- i++;
- }
- *val = map[i].val;
-
- tda_map("(%d) %s: 0x%02x\n", i, map_name, *val);
-fail:
- return ret;
-}
-
-/*---------------------------------------------------------------------*/
-
-static struct tda18271_std_map tda18271c1_std_map = {
- .fm_radio = { .if_freq = 1250, .fm_rfn = 1, .agc_mode = 3, .std = 0,
- .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x18 */
- .atv_b = { .if_freq = 6750, .fm_rfn = 0, .agc_mode = 1, .std = 6,
- .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0e */
- .atv_dk = { .if_freq = 7750, .fm_rfn = 0, .agc_mode = 1, .std = 7,
- .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0f */
- .atv_gh = { .if_freq = 7750, .fm_rfn = 0, .agc_mode = 1, .std = 7,
- .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0f */
- .atv_i = { .if_freq = 7750, .fm_rfn = 0, .agc_mode = 1, .std = 7,
- .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0f */
- .atv_l = { .if_freq = 7750, .fm_rfn = 0, .agc_mode = 1, .std = 7,
- .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0f */
- .atv_lc = { .if_freq = 1250, .fm_rfn = 0, .agc_mode = 1, .std = 7,
- .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0f */
- .atv_mn = { .if_freq = 5750, .fm_rfn = 0, .agc_mode = 1, .std = 5,
- .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0d */
- .atsc_6 = { .if_freq = 3250, .fm_rfn = 0, .agc_mode = 3, .std = 4,
- .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1c */
- .dvbt_6 = { .if_freq = 3300, .fm_rfn = 0, .agc_mode = 3, .std = 4,
- .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1c */
- .dvbt_7 = { .if_freq = 3800, .fm_rfn = 0, .agc_mode = 3, .std = 5,
- .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1d */
- .dvbt_8 = { .if_freq = 4300, .fm_rfn = 0, .agc_mode = 3, .std = 6,
- .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1e */
- .qam_6 = { .if_freq = 4000, .fm_rfn = 0, .agc_mode = 3, .std = 5,
- .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1d */
- .qam_8 = { .if_freq = 5000, .fm_rfn = 0, .agc_mode = 3, .std = 7,
- .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1f */
-};
-
-static struct tda18271_std_map tda18271c2_std_map = {
- .fm_radio = { .if_freq = 1250, .fm_rfn = 1, .agc_mode = 3, .std = 0,
- .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x18 */
- .atv_b = { .if_freq = 6000, .fm_rfn = 0, .agc_mode = 1, .std = 5,
- .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0d */
- .atv_dk = { .if_freq = 6900, .fm_rfn = 0, .agc_mode = 1, .std = 6,
- .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0e */
- .atv_gh = { .if_freq = 7100, .fm_rfn = 0, .agc_mode = 1, .std = 6,
- .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0e */
- .atv_i = { .if_freq = 7250, .fm_rfn = 0, .agc_mode = 1, .std = 6,
- .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0e */
- .atv_l = { .if_freq = 6900, .fm_rfn = 0, .agc_mode = 1, .std = 6,
- .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0e */
- .atv_lc = { .if_freq = 1250, .fm_rfn = 0, .agc_mode = 1, .std = 6,
- .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0e */
- .atv_mn = { .if_freq = 5400, .fm_rfn = 0, .agc_mode = 1, .std = 4,
- .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0c */
- .atsc_6 = { .if_freq = 3250, .fm_rfn = 0, .agc_mode = 3, .std = 4,
- .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1c */
- .dvbt_6 = { .if_freq = 3300, .fm_rfn = 0, .agc_mode = 3, .std = 4,
- .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1c */
- .dvbt_7 = { .if_freq = 3500, .fm_rfn = 0, .agc_mode = 3, .std = 4,
- .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1c */
- .dvbt_8 = { .if_freq = 4000, .fm_rfn = 0, .agc_mode = 3, .std = 5,
- .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1d */
- .qam_6 = { .if_freq = 4000, .fm_rfn = 0, .agc_mode = 3, .std = 5,
- .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1d */
- .qam_8 = { .if_freq = 5000, .fm_rfn = 0, .agc_mode = 3, .std = 7,
- .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1f */
-};
-
-/*---------------------------------------------------------------------*/
-
-static struct tda18271_map_layout tda18271c1_map_layout = {
- .main_pll = tda18271c1_main_pll,
- .cal_pll = tda18271c1_cal_pll,
-
- .rf_cal = tda18271c1_rf_cal,
- .rf_cal_kmco = tda18271c1_km,
-
- .bp_filter = tda18271_bp_filter,
- .rf_band = tda18271_rf_band,
- .gain_taper = tda18271_gain_taper,
- .ir_measure = tda18271_ir_measure,
-};
-
-static struct tda18271_map_layout tda18271c2_map_layout = {
- .main_pll = tda18271c2_main_pll,
- .cal_pll = tda18271c2_cal_pll,
-
- .rf_cal = tda18271c2_rf_cal,
- .rf_cal_kmco = tda18271c2_km,
-
- .rf_cal_dc_over_dt = tda18271_rf_cal_dc_over_dt,
-
- .bp_filter = tda18271_bp_filter,
- .rf_band = tda18271_rf_band,
- .gain_taper = tda18271_gain_taper,
- .ir_measure = tda18271_ir_measure,
-};
-
-int tda18271_assign_map_layout(struct dvb_frontend *fe)
-{
- struct tda18271_priv *priv = fe->tuner_priv;
- int ret = 0;
-
- switch (priv->id) {
- case TDA18271HDC1:
- priv->maps = &tda18271c1_map_layout;
- memcpy(&priv->std, &tda18271c1_std_map,
- sizeof(struct tda18271_std_map));
- break;
- case TDA18271HDC2:
- priv->maps = &tda18271c2_map_layout;
- memcpy(&priv->std, &tda18271c2_std_map,
- sizeof(struct tda18271_std_map));
- break;
- default:
- ret = -EINVAL;
- break;
- }
- memcpy(priv->rf_cal_state, &tda18271_rf_band_template,
- sizeof(tda18271_rf_band_template));
-
- return ret;
-}
-
-/*
- * Overrides for Emacs so that we follow Linus's tabbing style.
- * ---------------------------------------------------------------------------
- * Local variables:
- * c-basic-offset: 8
- * End:
- */
diff --git a/drivers/media/dvb/frontends/tda18271.h b/drivers/media/dvb/frontends/tda18271.h
deleted file mode 100644
index 0e7af8d05a3..00000000000
--- a/drivers/media/dvb/frontends/tda18271.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- tda18271.h - header for the Philips / NXP TDA18271 silicon tuner
-
- Copyright (C) 2007, 2008 Michael Krufky <mkrufky@linuxtv.org>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef __TDA18271_H__
-#define __TDA18271_H__
-
-#include <linux/i2c.h>
-#include "dvb_frontend.h"
-
-struct tda18271_std_map_item {
- u16 if_freq;
-
- /* EP3[4:3] */
- unsigned int agc_mode:2;
- /* EP3[2:0] */
- unsigned int std:3;
- /* EP4[7] */
- unsigned int fm_rfn:1;
- /* EP4[4:2] */
- unsigned int if_lvl:3;
- /* EB22[6:0] */
- unsigned int rfagc_top:7;
-};
-
-struct tda18271_std_map {
- struct tda18271_std_map_item fm_radio;
- struct tda18271_std_map_item atv_b;
- struct tda18271_std_map_item atv_dk;
- struct tda18271_std_map_item atv_gh;
- struct tda18271_std_map_item atv_i;
- struct tda18271_std_map_item atv_l;
- struct tda18271_std_map_item atv_lc;
- struct tda18271_std_map_item atv_mn;
- struct tda18271_std_map_item atsc_6;
- struct tda18271_std_map_item dvbt_6;
- struct tda18271_std_map_item dvbt_7;
- struct tda18271_std_map_item dvbt_8;
- struct tda18271_std_map_item qam_6;
- struct tda18271_std_map_item qam_8;
-};
-
-enum tda18271_role {
- TDA18271_MASTER = 0,
- TDA18271_SLAVE,
-};
-
-enum tda18271_i2c_gate {
- TDA18271_GATE_AUTO = 0,
- TDA18271_GATE_ANALOG,
- TDA18271_GATE_DIGITAL,
-};
-
-struct tda18271_config {
- /* override default if freq / std settings (optional) */
- struct tda18271_std_map *std_map;
-
- /* master / slave tuner: master uses main pll, slave uses cal pll */
- enum tda18271_role role;
-
- /* use i2c gate provided by analog or digital demod */
- enum tda18271_i2c_gate gate;
-
- /* some i2c providers cant write all 39 registers at once */
- unsigned int small_i2c:1;
-};
-
-#if defined(CONFIG_DVB_TDA18271) || (defined(CONFIG_DVB_TDA18271_MODULE) && defined(MODULE))
-extern struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
- struct i2c_adapter *i2c,
- struct tda18271_config *cfg);
-#else
-static inline struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe,
- u8 addr,
- struct i2c_adapter *i2c,
- struct tda18271_config *cfg)
-{
- printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
- return NULL;
-}
-#endif
-
-#endif /* __TDA18271_H__ */
diff --git a/drivers/media/dvb/frontends/tda827x.c b/drivers/media/dvb/frontends/tda827x.c
deleted file mode 100644
index d30d2c9094d..00000000000
--- a/drivers/media/dvb/frontends/tda827x.c
+++ /dev/null
@@ -1,852 +0,0 @@
-/*
- *
- * (c) 2005 Hartmut Hackmann
- * (c) 2007 Michael Krufky
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <linux/module.h>
-#include <asm/types.h>
-#include <linux/dvb/frontend.h>
-#include <linux/videodev2.h>
-
-#include "tda827x.h"
-
-static int debug;
-module_param(debug, int, 0644);
-MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off).");
-
-#define dprintk(args...) \
- do { \
- if (debug) printk(KERN_DEBUG "tda827x: " args); \
- } while (0)
-
-struct tda827x_priv {
- int i2c_addr;
- struct i2c_adapter *i2c_adap;
- struct tda827x_config *cfg;
-
- unsigned int sgIF;
- unsigned char lpsel;
-
- u32 frequency;
- u32 bandwidth;
-};
-
-static void tda827x_set_std(struct dvb_frontend *fe,
- struct analog_parameters *params)
-{
- struct tda827x_priv *priv = fe->tuner_priv;
- char *mode;
-
- priv->lpsel = 0;
- if (params->std & V4L2_STD_MN) {
- priv->sgIF = 92;
- priv->lpsel = 1;
- mode = "MN";
- } else if (params->std & V4L2_STD_B) {
- priv->sgIF = 108;
- mode = "B";
- } else if (params->std & V4L2_STD_GH) {
- priv->sgIF = 124;
- mode = "GH";
- } else if (params->std & V4L2_STD_PAL_I) {
- priv->sgIF = 124;
- mode = "I";
- } else if (params->std & V4L2_STD_DK) {
- priv->sgIF = 124;
- mode = "DK";
- } else if (params->std & V4L2_STD_SECAM_L) {
- priv->sgIF = 124;
- mode = "L";
- } else if (params->std & V4L2_STD_SECAM_LC) {
- priv->sgIF = 20;
- mode = "LC";
- } else {
- priv->sgIF = 124;
- mode = "xx";
- }
-
- if (params->mode == V4L2_TUNER_RADIO)
- priv->sgIF = 88; /* if frequency is 5.5 MHz */
-
- dprintk("setting tda827x to system %s\n", mode);
-}
-
-
-/* ------------------------------------------------------------------ */
-
-struct tda827x_data {
- u32 lomax;
- u8 spd;
- u8 bs;
- u8 bp;
- u8 cp;
- u8 gc3;
- u8 div1p5;
-};
-
-static const struct tda827x_data tda827x_table[] = {
- { .lomax = 62000000, .spd = 3, .bs = 2, .bp = 0, .cp = 0, .gc3 = 3, .div1p5 = 1},
- { .lomax = 66000000, .spd = 3, .bs = 3, .bp = 0, .cp = 0, .gc3 = 3, .div1p5 = 1},
- { .lomax = 76000000, .spd = 3, .bs = 1, .bp = 0, .cp = 0, .gc3 = 3, .div1p5 = 0},
- { .lomax = 84000000, .spd = 3, .bs = 2, .bp = 0, .cp = 0, .gc3 = 3, .div1p5 = 0},
- { .lomax = 93000000, .spd = 3, .bs = 2, .bp = 0, .cp = 0, .gc3 = 1, .div1p5 = 0},
- { .lomax = 98000000, .spd = 3, .bs = 3, .bp = 0, .cp = 0, .gc3 = 1, .div1p5 = 0},
- { .lomax = 109000000, .spd = 3, .bs = 3, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 0},
- { .lomax = 123000000, .spd = 2, .bs = 2, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 1},
- { .lomax = 133000000, .spd = 2, .bs = 3, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 1},
- { .lomax = 151000000, .spd = 2, .bs = 1, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 0},
- { .lomax = 154000000, .spd = 2, .bs = 2, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 0},
- { .lomax = 181000000, .spd = 2, .bs = 2, .bp = 1, .cp = 0, .gc3 = 0, .div1p5 = 0},
- { .lomax = 185000000, .spd = 2, .bs = 2, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 0},
- { .lomax = 217000000, .spd = 2, .bs = 3, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 0},
- { .lomax = 244000000, .spd = 1, .bs = 2, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 1},
- { .lomax = 265000000, .spd = 1, .bs = 3, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 1},
- { .lomax = 302000000, .spd = 1, .bs = 1, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 0},
- { .lomax = 324000000, .spd = 1, .bs = 2, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 0},
- { .lomax = 370000000, .spd = 1, .bs = 2, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 0},
- { .lomax = 454000000, .spd = 1, .bs = 3, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 0},
- { .lomax = 493000000, .spd = 0, .bs = 2, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 1},
- { .lomax = 530000000, .spd = 0, .bs = 3, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 1},
- { .lomax = 554000000, .spd = 0, .bs = 1, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 0},
- { .lomax = 604000000, .spd = 0, .bs = 1, .bp = 4, .cp = 0, .gc3 = 0, .div1p5 = 0},
- { .lomax = 696000000, .spd = 0, .bs = 2, .bp = 4, .cp = 0, .gc3 = 0, .div1p5 = 0},
- { .lomax = 740000000, .spd = 0, .bs = 2, .bp = 4, .cp = 1, .gc3 = 0, .div1p5 = 0},
- { .lomax = 820000000, .spd = 0, .bs = 3, .bp = 4, .cp = 0, .gc3 = 0, .div1p5 = 0},
- { .lomax = 865000000, .spd = 0, .bs = 3, .bp = 4, .cp = 1, .gc3 = 0, .div1p5 = 0},
- { .lomax = 0, .spd = 0, .bs = 0, .bp = 0, .cp = 0, .gc3 = 0, .div1p5 = 0}
-};
-
-static int tda827xo_set_params(struct dvb_frontend *fe,
- struct dvb_frontend_parameters *params)
-{
- struct tda827x_priv *priv = fe->tuner_priv;
- u8 buf[14];
-
- struct i2c_msg msg = { .addr = priv->i2c_addr, .flags = 0,
- .buf = buf, .len = sizeof(buf) };
- int i, tuner_freq, if_freq;
- u32 N;
-
- dprintk("%s:\n", __func__);
- switch (params->u.ofdm.bandwidth) {
- case BANDWIDTH_6_MHZ:
- if_freq = 4000000;
- break;
- case BANDWIDTH_7_MHZ:
- if_freq = 4500000;
- break;
- default: /* 8 MHz or Auto */
- if_freq = 5000000;
- break;
- }
- tuner_freq = params->frequency + if_freq;
-
- i = 0;
- while (tda827x_table[i].lomax < tuner_freq) {
- if (tda827x_table[i + 1].lomax == 0)
- break;
- i++;
- }
-
- N = ((tuner_freq + 125000) / 250000) << (tda827x_table[i].spd + 2);
- buf[0] = 0;
- buf[1] = (N>>8) | 0x40;
- buf[2] = N & 0xff;
- buf[3] = 0;
- buf[4] = 0x52;
- buf[5] = (tda827x_table[i].spd << 6) + (tda827x_table[i].div1p5 << 5) +
- (tda827x_table[i].bs << 3) +
- tda827x_table[i].bp;
- buf[6] = (tda827x_table[i].gc3 << 4) + 0x8f;
- buf[7] = 0xbf;
- buf[8] = 0x2a;
- buf[9] = 0x05;
- buf[10] = 0xff;
- buf[11] = 0x00;
- buf[12] = 0x00;
- buf[13] = 0x40;
-
- msg.len = 14;
- if (fe->ops.i2c_gate_ctrl)
- fe->ops.i2c_gate_ctrl(fe, 1);
- if (i2c_transfer(priv->i2c_adap, &msg, 1) != 1) {
- printk("%s: could not write to tuner at addr: 0x%02x\n",
- __func__, priv->i2c_addr << 1);
- return -EIO;
- }
- msleep(500);
- /* correct CP value */
- buf[0] = 0x30;
- buf[1] = 0x50 + tda827x_table[i].cp;
- msg.len = 2;
-
- if (fe->ops.i2c_gate_ctrl)
- fe->ops.i2c_gate_ctrl(fe, 1);
- i2c_transfer(priv->i2c_adap, &msg, 1);
-
- priv->frequency = tuner_freq - if_freq; // FIXME
- priv->bandwidth = (fe->ops.info.type == FE_OFDM) ? params->u.ofdm.bandwidth : 0;
-
- return 0;
-}
-
-static int tda827xo_sleep(struct dvb_frontend *fe)
-{
- struct tda827x_priv *priv = fe->tuner_priv;
- static u8 buf[] = { 0x30, 0xd0 };
- struct i2c_msg msg = { .addr = priv->i2c_addr, .flags = 0,
- .buf = buf, .len = sizeof(buf) };
-
- dprintk("%s:\n", __func__);
- if (fe->ops.i2c_gate_ctrl)
- fe->ops.i2c_gate_ctrl(fe, 1);
- i2c_transfer(priv->i2c_adap, &msg, 1);
-
- if (priv->cfg && priv->cfg->sleep)
- priv->cfg->sleep(fe);
-
- return 0;
-}
-
-/* ------------------------------------------------------------------ */
-
-static int tda827xo_set_analog_params(struct dvb_frontend *fe,
- struct analog_parameters *params)
-{
- unsigned char tuner_reg[8];
- unsigned char reg2[2];
- u32 N;
- int i;
- struct tda827x_priv *priv = fe->tuner_priv;
- struct i2c_msg msg = { .addr = priv->i2c_addr, .flags = 0 };
- unsigned int freq = params->frequency;
-
- tda827x_set_std(fe, params);
-
- if (params->mode == V4L2_TUNER_RADIO)
- freq = freq / 1000;
-
- N = freq + priv->sgIF;
-
- i = 0;
- while (tda827x_table[i].lomax < N * 62500) {
- if (tda827x_table[i + 1].lomax == 0)
- break;
- i++;
- }
-
- N = N << tda827x_table[i].spd;
-
- tuner_reg[0] = 0;
- tuner_reg[1] = (unsigned char)(N>>8);
- tuner_reg[2] = (unsigned char) N;
- tuner_reg[3] = 0x40;
- tuner_reg[4] = 0x52 + (priv->lpsel << 5);
- tuner_reg[5] = (tda827x_table[i].spd << 6) +
- (tda827x_table[i].div1p5 << 5) +
- (tda827x_table[i].bs << 3) + tda827x_table[i].bp;
- tuner_reg[6] = 0x8f + (tda827x_table[i].gc3 << 4);
- tuner_reg[7] = 0x8f;
-
- msg.buf = tuner_reg;
- msg.len = 8;
- i2c_transfer(priv->i2c_adap, &msg, 1);
-
- msg.buf = reg2;
- msg.len = 2;
- reg2[0] = 0x80;
- reg2[1] = 0;
- i2c_transfer(priv->i2c_adap, &msg, 1);
-
- reg2[0] = 0x60;
- reg2[1] = 0xbf;
- i2c_transfer(priv->i2c_adap, &msg, 1);
-
- reg2[0] = 0x30;
- reg2[1] = tuner_reg[4] + 0x80;
- i2c_transfer(priv->i2c_adap, &msg, 1);
-
- msleep(1);
- reg2[0] = 0x30;
- reg2[1] = tuner_reg[4] + 4;
- i2c_transfer(priv->i2c_adap, &msg, 1);
-
- msleep(1);
- reg2[0] = 0x30;
- reg2[1] = tuner_reg[4];
- i2c_transfer(priv->i2c_adap, &msg, 1);
-
- msleep(550);
- reg2[0] = 0x30;
- reg2[1] = (tuner_reg[4] & 0xfc) + tda827x_table[i].cp;
- i2c_transfer(priv->i2c_adap, &msg, 1);
-
- reg2[0] = 0x60;
- reg2[1] = 0x3f;
- i2c_transfer(priv->i2c_adap, &msg, 1);
-
- reg2[0] = 0x80;
- reg2[1] = 0x08; /* Vsync en */
- i2c_transfer(priv->i2c_adap, &msg, 1);
-
- priv->frequency = freq * 62500;
-
- return 0;
-}
-
-static void tda827xo_agcf(struct dvb_frontend *fe)
-{
- struct tda827x_priv *priv = fe->tuner_priv;
- unsigned char data[] = { 0x80, 0x0c };
- struct i2c_msg msg = { .addr = priv->i2c_addr, .flags = 0,
- .buf = data, .len = 2};
-
- i2c_transfer(priv->i2c_adap, &msg, 1);
-}
-
-/* ------------------------------------------------------------------ */
-
-struct tda827xa_data {
- u32 lomax;
- u8 svco;
- u8 spd;
- u8 scr;
- u8 sbs;
- u8 gc3;
-};
-
-static const struct tda827xa_data tda827xa_dvbt[] = {
- { .lomax = 56875000, .svco = 3, .spd = 4, .scr = 0, .sbs = 0, .gc3 = 1},
- { .lomax = 67250000, .svco = 0, .spd = 3, .scr = 0, .sbs = 0, .gc3 = 1},
- { .lomax = 81250000, .svco = 1, .spd = 3, .scr = 0, .sbs = 0, .gc3 = 1},
- { .lomax = 97500000, .svco = 2, .spd = 3, .scr = 0, .sbs = 0, .gc3 = 1},
- { .lomax = 113750000, .svco = 3, .spd = 3, .scr = 0, .sbs = 1, .gc3 = 1},
- { .lomax = 134500000, .svco = 0, .spd = 2, .scr = 0, .sbs = 1, .gc3 = 1},
- { .lomax = 154000000, .svco = 1, .spd = 2, .scr = 0, .sbs = 1, .gc3 = 1},
- { .lomax = 162500000, .svco = 1, .spd = 2, .scr = 0, .sbs = 1, .gc3 = 1},
- { .lomax = 183000000, .svco = 2, .spd = 2, .scr = 0, .sbs = 1, .gc3 = 1},
- { .lomax = 195000000, .svco = 2, .spd = 2, .scr = 0, .sbs = 2, .gc3 = 1},
- { .lomax = 227500000, .svco = 3, .spd = 2, .scr = 0, .sbs = 2, .gc3 = 1},
- { .lomax = 269000000, .svco = 0, .spd = 1, .scr = 0, .sbs = 2, .gc3 = 1},
- { .lomax = 290000000, .svco = 1, .spd = 1, .scr = 0, .sbs = 2, .gc3 = 1},
- { .lomax = 325000000, .svco = 1, .spd = 1, .scr = 0, .sbs = 3, .gc3 = 1},
- { .lomax = 390000000, .svco = 2, .spd = 1, .scr = 0, .sbs = 3, .gc3 = 1},
- { .lomax = 455000000, .svco = 3, .spd = 1, .scr = 0, .sbs = 3, .gc3 = 1},
- { .lomax = 520000000, .svco = 0, .spd = 0, .scr = 0, .sbs = 3, .gc3 = 1},
- { .lomax = 538000000, .svco = 0, .spd = 0, .scr = 1, .sbs = 3, .gc3 = 1},
- { .lomax = 550000000, .svco = 1, .spd = 0, .scr = 0, .sbs = 3, .gc3 = 1},
- { .lomax = 620000000, .svco = 1, .spd = 0, .scr = 0, .sbs = 4, .gc3 = 0},
- { .lomax = 650000000, .svco = 1, .spd = 0, .scr = 1, .sbs = 4, .gc3 = 0},
- { .lomax = 700000000, .svco = 2, .spd = 0, .scr = 0, .sbs = 4, .gc3 = 0},
- { .lomax = 780000000, .svco = 2, .spd = 0, .scr = 1, .sbs = 4, .gc3 = 0},
- { .lomax = 820000000, .svco = 3, .spd = 0, .scr = 0, .sbs = 4, .gc3 = 0},
- { .lomax = 870000000, .svco = 3, .spd = 0, .scr = 1, .sbs = 4, .gc3 = 0},
- { .lomax = 911000000, .svco = 3, .spd = 0, .scr = 2, .sbs = 4, .gc3 = 0},
- { .lomax = 0, .svco = 0, .spd = 0, .scr = 0, .sbs = 0, .gc3 = 0}
-};
-
-static struct tda827xa_data tda827xa_analog[] = {
- { .lomax = 56875000, .svco = 3, .spd = 4, .scr = 0, .sbs = 0, .gc3 = 3},
- { .lomax = 67250000, .svco = 0, .spd = 3, .scr = 0, .sbs = 0, .gc3 = 3},
- { .lomax = 81250000, .svco = 1, .spd = 3, .scr = 0, .sbs = 0, .gc3 = 3},
- { .lomax = 97500000, .svco = 2, .spd = 3, .scr = 0, .sbs = 0, .gc3 = 3},
- { .lomax = 113750000, .svco = 3, .spd = 3, .scr = 0, .sbs = 1, .gc3 = 1},
- { .lomax = 134500000, .svco = 0, .spd = 2, .scr = 0, .sbs = 1, .gc3 = 1},
- { .lomax = 154000000, .svco = 1, .spd = 2, .scr = 0, .sbs = 1, .gc3 = 1},
- { .lomax = 162500000, .svco = 1, .spd = 2, .scr = 0, .sbs = 1, .gc3 = 1},
- { .lomax = 183000000, .svco = 2, .spd = 2, .scr = 0, .sbs = 1, .gc3 = 1},
- { .lomax = 195000000, .svco = 2, .spd = 2, .scr = 0, .sbs = 2, .gc3 = 1},
- { .lomax = 227500000, .svco = 3, .spd = 2, .scr = 0, .sbs = 2, .gc3 = 3},
- { .lomax = 269000000, .svco = 0, .spd = 1, .scr = 0, .sbs = 2, .gc3 = 3},
- { .lomax = 325000000, .svco = 1, .spd = 1, .scr = 0, .sbs = 2, .gc3 = 1},
- { .lomax = 390000000, .svco = 2, .spd = 1, .scr = 0, .sbs = 3, .gc3 = 3},
- { .lomax = 455000000, .svco = 3, .spd = 1, .scr = 0, .sbs = 3, .gc3 = 3},
- { .lomax = 520000000, .svco = 0, .spd = 0, .scr = 0, .sbs = 3, .gc3 = 1},
- { .lomax = 538000000, .svco = 0, .spd = 0, .scr = 1, .sbs = 3, .gc3 = 1},
- { .lomax = 554000000, .svco = 1, .spd = 0, .scr = 0, .sbs = 3, .gc3 = 1},
- { .lomax = 620000000, .svco = 1, .spd = 0, .scr = 0, .sbs = 4, .gc3 = 0},
- { .lomax = 650000000, .svco = 1, .spd = 0, .scr = 1, .sbs = 4, .gc3 = 0},
- { .lomax = 700000000, .svco = 2, .spd = 0, .scr = 0, .sbs = 4, .gc3 = 0},
- { .lomax = 780000000, .svco = 2, .spd = 0, .scr = 1, .sbs = 4, .gc3 = 0},
- { .lomax = 820000000, .svco = 3, .spd = 0, .scr = 0, .sbs = 4, .gc3 = 0},
- { .lomax = 870000000, .svco = 3, .spd = 0, .scr = 1, .sbs = 4, .gc3 = 0},
- { .lomax = 911000000, .svco = 3, .spd = 0, .scr = 2, .sbs = 4, .gc3 = 0},
- { .lomax = 0, .svco = 0, .spd = 0, .scr = 0, .sbs = 0, .gc3 = 0}
-};
-
-static int tda827xa_sleep(struct dvb_frontend *fe)
-{
- struct tda827x_priv *priv = fe->tuner_priv;
- static u8 buf[] = { 0x30, 0x90 };
- struct i2c_msg msg = { .addr = priv->i2c_addr, .flags = 0,
- .buf = buf, .len = sizeof(buf) };
-
- dprintk("%s:\n", __func__);
- if (fe->ops.i2c_gate_ctrl)
- fe->ops.i2c_gate_ctrl(fe, 1);
-
- i2c_transfer(priv->i2c_adap, &msg, 1);
-
- if (fe->ops.i2c_gate_ctrl)
- fe->ops.i2c_gate_ctrl(fe, 0);
-
- if (priv->cfg && priv->cfg->sleep)
- priv->cfg->sleep(fe);
-
- return 0;
-}
-
-static void tda827xa_lna_gain(struct dvb_frontend *fe, int high,
- struct analog_parameters *params)
-{
- struct tda827x_priv *priv = fe->tuner_priv;
- unsigned char buf[] = {0x22, 0x01};
- int arg;
- int gp_func;
- struct i2c_msg msg = { .addr = priv->cfg->switch_addr, .flags = 0,
- .buf = buf, .len = sizeof(buf) };
-
- if (NULL == priv->cfg) {
- dprintk("tda827x_config not defined, cannot set LNA gain!\n");
- return;
- }
- if (priv->cfg->config) {
- if (high)
- dprintk("setting LNA to high gain\n");
- else
- dprintk("setting LNA to low gain\n");
- }
- switch (priv->cfg->config) {
- case 0: /* no LNA */
- break;
- case 1: /* switch is GPIO 0 of tda8290 */
- case 2:
- if (params == NULL) {
- gp_func = 0;
- arg = 0;
- } else {
- /* turn Vsync on */
- gp_func = 1;
- if (params->std & V4L2_STD_MN)
- arg = 1;
- else
- arg = 0;
- }
- if (priv->cfg->tuner_callback)
- priv->cfg->tuner_callback(priv->i2c_adap->algo_data,
- gp_func, arg);
- buf[1] = high ? 0 : 1;
- if (priv->cfg->config == 2)
- buf[1] = high ? 1 : 0;
- i2c_transfer(priv->i2c_adap, &msg, 1);
- break;
- case 3: /* switch with GPIO of saa713x */
- if (priv->cfg->tuner_callback)
- priv->cfg->tuner_callback(priv->i2c_adap->algo_data, 0, high);
- break;
- }
-}
-
-static int tda827xa_set_params(struct dvb_frontend *fe,
- struct dvb_frontend_parameters *params)
-{
- struct tda827x_priv *priv = fe->tuner_priv;
- u8 buf[11];
-
- struct i2c_msg msg = { .addr = priv->i2c_addr, .flags = 0,
- .buf = buf, .len = sizeof(buf) };
-
- int i, tuner_freq, if_freq;
- u32 N;
-
- dprintk("%s:\n", __func__);
-
- tda827xa_lna_gain(fe, 1, NULL);
- msleep(20);
-
- switch (params->u.ofdm.bandwidth) {
- case BANDWIDTH_6_MHZ:
- if_freq = 4000000;
- break;
- case BANDWIDTH_7_MHZ:
- if_freq = 4500000;
- break;
- default: /* 8 MHz or Auto */
- if_freq = 5000000;
- break;
- }
- tuner_freq = params->frequency + if_freq;
-
- i = 0;
- while (tda827xa_dvbt[i].lomax < tuner_freq) {
- if(tda827xa_dvbt[i + 1].lomax == 0)
- break;
- i++;
- }
-
- N = ((tuner_freq + 31250) / 62500) << tda827xa_dvbt[i].spd;
- buf[0] = 0; // subaddress
- buf[1] = N >> 8;
- buf[2] = N & 0xff;
- buf[3] = 0;
- buf[4] = 0x16;
- buf[5] = (tda827xa_dvbt[i].spd << 5) + (tda827xa_dvbt[i].svco << 3) +
- tda827xa_dvbt[i].sbs;
- buf[6] = 0x4b + (tda827xa_dvbt[i].gc3 << 4);
- buf[7] = 0x1c;
- buf[8] = 0x06;
- buf[9] = 0x24;
- buf[10] = 0x00;
- msg.len = 11;
- if (fe->ops.i2c_gate_ctrl)
- fe->ops.i2c_gate_ctrl(fe, 1);
- if (i2c_transfer(priv->i2c_adap, &msg, 1) != 1) {
- printk("%s: could not write to tuner at addr: 0x%02x\n",
- __func__, priv->i2c_addr << 1);
- return -EIO;
- }
- buf[0] = 0x90;
- buf[1] = 0xff;
- buf[2] = 0x60;
- buf[3] = 0x00;
- buf[4] = 0x59; // lpsel, for 6MHz + 2
- msg.len = 5;
- if (fe->ops.i2c_gate_ctrl)
- fe->ops.i2c_gate_ctrl(fe, 1);
- i2c_transfer(priv->i2c_adap, &msg, 1);
-
- buf[0] = 0xa0;
- buf[1] = 0x40;
- msg.len = 2;
- if (fe->ops.i2c_gate_ctrl)
- fe->ops.i2c_gate_ctrl(fe, 1);
- i2c_transfer(priv->i2c_adap, &msg, 1);
-
- msleep(11);
- msg.flags = I2C_M_RD;
- if (fe->ops.i2c_gate_ctrl)
- fe->ops.i2c_gate_ctrl(fe, 1);
- i2c_transfer(priv->i2c_adap, &msg, 1);
- msg.flags = 0;
-
- buf[1] >>= 4;
- dprintk("tda8275a AGC2 gain is: %d\n", buf[1]);
- if ((buf[1]) < 2) {
- tda827xa_lna_gain(fe, 0, NULL);
- buf[0] = 0x60;
- buf[1] = 0x0c;
- if (fe->ops.i2c_gate_ctrl)
- fe->ops.i2c_gate_ctrl(fe, 1);
- i2c_transfer(priv->i2c_adap, &msg, 1);
- }
-
- buf[0] = 0xc0;
- buf[1] = 0x99; // lpsel, for 6MHz + 2
- if (fe->ops.i2c_gate_ctrl)
- fe->ops.i2c_gate_ctrl(fe, 1);
- i2c_transfer(priv->i2c_adap, &msg, 1);
-
- buf[0] = 0x60;
- buf[1] = 0x3c;
- if (fe->ops.i2c_gate_ctrl)
- fe->ops.i2c_gate_ctrl(fe, 1);
- i2c_transfer(priv->i2c_adap, &msg, 1);
-
- /* correct CP value */
- buf[0] = 0x30;
- buf[1] = 0x10 + tda827xa_dvbt[i].scr;
- if (fe->ops.i2c_gate_ctrl)
- fe->ops.i2c_gate_ctrl(fe, 1);
- i2c_transfer(priv->i2c_adap, &msg, 1);
-
- msleep(163);
- buf[0] = 0xc0;
- buf[1] = 0x39; // lpsel, for 6MHz + 2
- if (fe->ops.i2c_gate_ctrl)
- fe->ops.i2c_gate_ctrl(fe, 1);
- i2c_transfer(priv->i2c_adap, &msg, 1);
-
- msleep(3);
- /* freeze AGC1 */
- buf[0] = 0x50;
- buf[1] = 0x4f + (tda827xa_dvbt[i].gc3 << 4);
- if (fe->ops.i2c_gate_ctrl)
- fe->ops.i2c_gate_ctrl(fe, 1);
- i2c_transfer(priv->i2c_adap, &msg, 1);
-
- priv->frequency = tuner_freq - if_freq; // FIXME
- priv->bandwidth = (fe->ops.info.type == FE_OFDM) ? params->u.ofdm.bandwidth : 0;
-
- return 0;
-}
-
-
-static int tda827xa_set_analog_params(struct dvb_frontend *fe,
- struct analog_parameters *params)
-{
- unsigned char tuner_reg[11];
- u32 N;
- int i;
- struct tda827x_priv *priv = fe->tuner_priv;
- struct i2c_msg msg = { .addr = priv->i2c_addr, .flags = 0,
- .buf = tuner_reg, .len = sizeof(tuner_reg) };
- unsigned int freq = params->frequency;
-
- tda827x_set_std(fe, params);
-
- tda827xa_lna_gain(fe, 1, params);
- msleep(10);
-
- if (params->mode == V4L2_TUNER_RADIO)
- freq = freq / 1000;
-
- N = freq + priv->sgIF;
-
- i = 0;
- while (tda827xa_analog[i].lomax < N * 62500) {
- if (tda827xa_analog[i + 1].lomax == 0)
- break;
- i++;
- }
-
- N = N << tda827xa_analog[i].spd;
-
- tuner_reg[0] = 0;
- tuner_reg[1] = (unsigned char)(N>>8);
- tuner_reg[2] = (unsigned char) N;
- tuner_reg[3] = 0;
- tuner_reg[4] = 0x16;
- tuner_reg[5] = (tda827xa_analog[i].spd << 5) +
- (tda827xa_analog[i].svco << 3) +
- tda827xa_analog[i].sbs;
- tuner_reg[6] = 0x8b + (tda827xa_analog[i].gc3 << 4);
- tuner_reg[7] = 0x1c;
- tuner_reg[8] = 4;
- tuner_reg[9] = 0x20;
- tuner_reg[10] = 0x00;
- msg.len = 11;
- i2c_transfer(priv->i2c_adap, &msg, 1);
-
- tuner_reg[0] = 0x90;
- tuner_reg[1] = 0xff;
- tuner_reg[2] = 0xe0;
- tuner_reg[3] = 0;
- tuner_reg[4] = 0x99 + (priv->lpsel << 1);
- msg.len = 5;
- i2c_transfer(priv->i2c_adap, &msg, 1);
-
- tuner_reg[0] = 0xa0;
- tuner_reg[1] = 0xc0;
- msg.len = 2;
- i2c_transfer(priv->i2c_adap, &msg, 1);
-
- tuner_reg[0] = 0x30;
- tuner_reg[1] = 0x10 + tda827xa_analog[i].scr;
- i2c_transfer(priv->i2c_adap, &msg, 1);
-
- msg.flags = I2C_M_RD;
- i2c_transfer(priv->i2c_adap, &msg, 1);
- msg.flags = 0;
- tuner_reg[1] >>= 4;
- dprintk("AGC2 gain is: %d\n", tuner_reg[1]);
- if (tuner_reg[1] < 1)
- tda827xa_lna_gain(fe, 0, params);
-
- msleep(100);
- tuner_reg[0] = 0x60;
- tuner_reg[1] = 0x3c;
- i2c_transfer(priv->i2c_adap, &msg, 1);
-
- msleep(163);
- tuner_reg[0] = 0x50;
- tuner_reg[1] = 0x8f + (tda827xa_analog[i].gc3 << 4);
- i2c_transfer(priv->i2c_adap, &msg, 1);
-
- tuner_reg[0] = 0x80;
- tuner_reg[1] = 0x28;
- i2c_transfer(priv->i2c_adap, &msg, 1);
-
- tuner_reg[0] = 0xb0;
- tuner_reg[1] = 0x01;
- i2c_transfer(priv->i2c_adap, &msg, 1);
-
- tuner_reg[0] = 0xc0;
- tuner_reg[1] = 0x19 + (priv->lpsel << 1);
- i2c_transfer(priv->i2c_adap, &msg, 1);
-
- priv->frequency = freq * 62500;
-
- return 0;
-}
-
-static void tda827xa_agcf(struct dvb_frontend *fe)
-{
- struct tda827x_priv *priv = fe->tuner_priv;
- unsigned char data[] = {0x80, 0x2c};
- struct i2c_msg msg = {.addr = priv->i2c_addr, .flags = 0,
- .buf = data, .len = 2};
- i2c_transfer(priv->i2c_adap, &msg, 1);
-}
-
-/* ------------------------------------------------------------------ */
-
-static int tda827x_release(struct dvb_frontend *fe)
-{
- kfree(fe->tuner_priv);
- fe->tuner_priv = NULL;
- return 0;
-}
-
-static int tda827x_get_frequency(struct dvb_frontend *fe, u32 *frequency)
-{
- struct tda827x_priv *priv = fe->tuner_priv;
- *frequency = priv->frequency;
- return 0;
-}
-
-static int tda827x_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
-{
- struct tda827x_priv *priv = fe->tuner_priv;
- *bandwidth = priv->bandwidth;
- return 0;
-}
-
-static int tda827x_init(struct dvb_frontend *fe)
-{
- struct tda827x_priv *priv = fe->tuner_priv;
- dprintk("%s:\n", __func__);
- if (priv->cfg && priv->cfg->init)
- priv->cfg->init(fe);
-
- return 0;
-}
-
-static int tda827x_probe_version(struct dvb_frontend *fe);
-
-static int tda827x_initial_init(struct dvb_frontend *fe)
-{
- int ret;
- ret = tda827x_probe_version(fe);
- if (ret)
- return ret;
- return fe->ops.tuner_ops.init(fe);
-}
-
-static int tda827x_initial_sleep(struct dvb_frontend *fe)
-{
- int ret;
- ret = tda827x_probe_version(fe);
- if (ret)
- return ret;
- return fe->ops.tuner_ops.sleep(fe);
-}
-
-static struct dvb_tuner_ops tda827xo_tuner_ops = {
- .info = {
- .name = "Philips TDA827X",
- .frequency_min = 55000000,
- .frequency_max = 860000000,
- .frequency_step = 250000
- },
- .release = tda827x_release,
- .init = tda827x_initial_init,
- .sleep = tda827x_initial_sleep,
- .set_params = tda827xo_set_params,
- .set_analog_params = tda827xo_set_analog_params,
- .get_frequency = tda827x_get_frequency,
- .get_bandwidth = tda827x_get_bandwidth,
-};
-
-static struct dvb_tuner_ops tda827xa_tuner_ops = {
- .info = {
- .name = "Philips TDA827XA",
- .frequency_min = 44000000,
- .frequency_max = 906000000,
- .frequency_step = 62500
- },
- .release = tda827x_release,
- .init = tda827x_init,
- .sleep = tda827xa_sleep,
- .set_params = tda827xa_set_params,
- .set_analog_params = tda827xa_set_analog_params,
- .get_frequency = tda827x_get_frequency,
- .get_bandwidth = tda827x_get_bandwidth,
-};
-
-static int tda827x_probe_version(struct dvb_frontend *fe)
-{ u8 data;
- struct tda827x_priv *priv = fe->tuner_priv;
- struct i2c_msg msg = { .addr = priv->i2c_addr, .flags = I2C_M_RD,
- .buf = &data, .len = 1 };
- if (fe->ops.i2c_gate_ctrl)
- fe->ops.i2c_gate_ctrl(fe, 1);
- if (i2c_transfer(priv->i2c_adap, &msg, 1) != 1) {
- printk("%s: could not read from tuner at addr: 0x%02x\n",
- __func__, msg.addr << 1);
- return -EIO;
- }
- if ((data & 0x3c) == 0) {
- dprintk("tda827x tuner found\n");
- fe->ops.tuner_ops.init = tda827x_init;
- fe->ops.tuner_ops.sleep = tda827xo_sleep;
- if (priv->cfg)
- priv->cfg->agcf = tda827xo_agcf;
- } else {
- dprintk("tda827xa tuner found\n");
- memcpy(&fe->ops.tuner_ops, &tda827xa_tuner_ops, sizeof(struct dvb_tuner_ops));
- if (priv->cfg)
- priv->cfg->agcf = tda827xa_agcf;
- }
- return 0;
-}
-
-struct dvb_frontend *tda827x_attach(struct dvb_frontend *fe, int addr,
- struct i2c_adapter *i2c,
- struct tda827x_config *cfg)
-{
- struct tda827x_priv *priv = NULL;
-
- dprintk("%s:\n", __func__);
- priv = kzalloc(sizeof(struct tda827x_priv), GFP_KERNEL);
- if (priv == NULL)
- return NULL;
-
- priv->i2c_addr = addr;
- priv->i2c_adap = i2c;
- priv->cfg = cfg;
- memcpy(&fe->ops.tuner_ops, &tda827xo_tuner_ops, sizeof(struct dvb_tuner_ops));
- fe->tuner_priv = priv;
-
- dprintk("type set to %s\n", fe->ops.tuner_ops.info.name);
-
- return fe;
-}
-EXPORT_SYMBOL_GPL(tda827x_attach);
-
-MODULE_DESCRIPTION("DVB TDA827x driver");
-MODULE_AUTHOR("Hartmut Hackmann <hartmut.hackmann@t-online.de>");
-MODULE_AUTHOR("Michael Krufky <mkrufky@linuxtv.org>");
-MODULE_LICENSE("GPL");
-
-/*
- * Overrides for Emacs so that we follow Linus's tabbing style.
- * ---------------------------------------------------------------------------
- * Local variables:
- * c-basic-offset: 8
- * End:
- */
diff --git a/drivers/media/dvb/frontends/tda827x.h b/drivers/media/dvb/frontends/tda827x.h
deleted file mode 100644
index b73c23570da..00000000000
--- a/drivers/media/dvb/frontends/tda827x.h
+++ /dev/null
@@ -1,69 +0,0 @@
- /*
- DVB Driver for Philips tda827x / tda827xa Silicon tuners
-
- (c) 2005 Hartmut Hackmann
- (c) 2007 Michael Krufky
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- */
-
-#ifndef __DVB_TDA827X_H__
-#define __DVB_TDA827X_H__
-
-#include <linux/i2c.h>
-#include "dvb_frontend.h"
-
-struct tda827x_config
-{
- /* saa7134 - provided callbacks */
- int (*init) (struct dvb_frontend *fe);
- int (*sleep) (struct dvb_frontend *fe);
-
- /* interface to tda829x driver */
- unsigned int config;
- int switch_addr;
- int (*tuner_callback) (void *dev, int command, int arg);
-
- void (*agcf)(struct dvb_frontend *fe);
-};
-
-
-/**
- * Attach a tda827x tuner to the supplied frontend structure.
- *
- * @param fe Frontend to attach to.
- * @param addr i2c address of the tuner.
- * @param i2c i2c adapter to use.
- * @param cfg optional callback function pointers.
- * @return FE pointer on success, NULL on failure.
- */
-#if defined(CONFIG_DVB_TDA827X) || (defined(CONFIG_DVB_TDA827X_MODULE) && defined(MODULE))
-extern struct dvb_frontend* tda827x_attach(struct dvb_frontend *fe, int addr,
- struct i2c_adapter *i2c,
- struct tda827x_config *cfg);
-#else
-static inline struct dvb_frontend* tda827x_attach(struct dvb_frontend *fe,
- int addr,
- struct i2c_adapter *i2c,
- struct tda827x_config *cfg)
-{
- printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
- return NULL;
-}
-#endif // CONFIG_DVB_TDA827X
-
-#endif // __DVB_TDA827X_H__
diff --git a/drivers/media/dvb/frontends/xc5000.c b/drivers/media/dvb/frontends/xc5000.c
deleted file mode 100644
index 43d35bdb221..00000000000
--- a/drivers/media/dvb/frontends/xc5000.c
+++ /dev/null
@@ -1,964 +0,0 @@
-/*
- * Driver for Xceive XC5000 "QAM/8VSB single chip tuner"
- *
- * Copyright (c) 2007 Xceive Corporation
- * Copyright (c) 2007 Steven Toth <stoth@hauppauge.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <linux/module.h>
-#include <linux/moduleparam.h>
-#include <linux/videodev2.h>
-#include <linux/delay.h>
-#include <linux/dvb/frontend.h>
-#include <linux/i2c.h>
-
-#include "dvb_frontend.h"
-
-#include "xc5000.h"
-#include "xc5000_priv.h"
-
-static int debug;
-module_param(debug, int, 0644);
-MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off).");
-
-#define dprintk(level,fmt, arg...) if (debug >= level) \
- printk(KERN_INFO "%s: " fmt, "xc5000", ## arg)
-
-#define XC5000_DEFAULT_FIRMWARE "dvb-fe-xc5000-1.1.fw"
-#define XC5000_DEFAULT_FIRMWARE_SIZE 12332
-
-/* Misc Defines */
-#define MAX_TV_STANDARD 23
-#define XC_MAX_I2C_WRITE_LENGTH 64
-
-/* Signal Types */
-#define XC_RF_MODE_AIR 0
-#define XC_RF_MODE_CABLE 1
-
-/* Result codes */
-#define XC_RESULT_SUCCESS 0
-#define XC_RESULT_RESET_FAILURE 1
-#define XC_RESULT_I2C_WRITE_FAILURE 2
-#define XC_RESULT_I2C_READ_FAILURE 3
-#define XC_RESULT_OUT_OF_RANGE 5
-
-/* Product id */
-#define XC_PRODUCT_ID_FW_NOT_LOADED 0x2000
-#define XC_PRODUCT_ID_FW_LOADED 0x1388
-
-/* Registers */
-#define XREG_INIT 0x00
-#define XREG_VIDEO_MODE 0x01
-#define XREG_AUDIO_MODE 0x02
-#define XREG_RF_FREQ 0x03
-#define XREG_D_CODE 0x04
-#define XREG_IF_OUT 0x05
-#define XREG_SEEK_MODE 0x07
-#define XREG_POWER_DOWN 0x0A
-#define XREG_SIGNALSOURCE 0x0D /* 0=Air, 1=Cable */
-#define XREG_SMOOTHEDCVBS 0x0E
-#define XREG_XTALFREQ 0x0F
-#define XREG_FINERFFREQ 0x10
-#define XREG_DDIMODE 0x11
-
-#define XREG_ADC_ENV 0x00
-#define XREG_QUALITY 0x01
-#define XREG_FRAME_LINES 0x02
-#define XREG_HSYNC_FREQ 0x03
-#define XREG_LOCK 0x04
-#define XREG_FREQ_ERROR 0x05
-#define XREG_SNR 0x06
-#define XREG_VERSION 0x07
-#define XREG_PRODUCT_ID 0x08
-#define XREG_BUSY 0x09
-
-/*
- Basic firmware description. This will remain with
- the driver for documentation purposes.
-
- This represents an I2C firmware file encoded as a
- string of unsigned char. Format is as follows:
-
- char[0 ]=len0_MSB -> len = len_MSB * 256 + len_LSB
- char[1 ]=len0_LSB -> length of first write transaction
- char[2 ]=data0 -> first byte to be sent
- char[3 ]=data1
- char[4 ]=data2
- char[ ]=...
- char[M ]=dataN -> last byte to be sent
- char[M+1]=len1_MSB -> len = len_MSB * 256 + len_LSB
- char[M+2]=len1_LSB -> length of second write transaction
- char[M+3]=data0
- char[M+4]=data1
- ...
- etc.
-
- The [len] value should be interpreted as follows:
-
- len= len_MSB _ len_LSB
- len=1111_1111_1111_1111 : End of I2C_SEQUENCE
- len=0000_0000_0000_0000 : Reset command: Do hardware reset
- len=0NNN_NNNN_NNNN_NNNN : Normal transaction: number of bytes = {1:32767)
- len=1WWW_WWWW_WWWW_WWWW : Wait command: wait for {1:32767} ms
-
- For the RESET and WAIT commands, the two following bytes will contain
- immediately the length of the following transaction.
-
-*/
-typedef struct {
- char *Name;
- u16 AudioMode;
- u16 VideoMode;
-} XC_TV_STANDARD;
-
-/* Tuner standards */
-#define MN_NTSC_PAL_BTSC 0
-#define MN_NTSC_PAL_A2 1
-#define MN_NTSC_PAL_EIAJ 2
-#define MN_NTSC_PAL_Mono 3
-#define BG_PAL_A2 4
-#define BG_PAL_NICAM 5
-#define BG_PAL_MONO 6
-#define I_PAL_NICAM 7
-#define I_PAL_NICAM_MONO 8
-#define DK_PAL_A2 9
-#define DK_PAL_NICAM 10
-#define DK_PAL_MONO 11
-#define DK_SECAM_A2DK1 12
-#define DK_SECAM_A2LDK3 13
-#define DK_SECAM_A2MONO 14
-#define L_SECAM_NICAM 15
-#define LC_SECAM_NICAM 16
-#define DTV6 17
-#define DTV8 18
-#define DTV7_8 19
-#define DTV7 20
-#define FM_Radio_INPUT2 21
-#define FM_Radio_INPUT1 22
-
-static XC_TV_STANDARD XC5000_Standard[MAX_TV_STANDARD] = {
- {"M/N-NTSC/PAL-BTSC", 0x0400, 0x8020},
- {"M/N-NTSC/PAL-A2", 0x0600, 0x8020},
- {"M/N-NTSC/PAL-EIAJ", 0x0440, 0x8020},
- {"M/N-NTSC/PAL-Mono", 0x0478, 0x8020},
- {"B/G-PAL-A2", 0x0A00, 0x8049},
- {"B/G-PAL-NICAM", 0x0C04, 0x8049},
- {"B/G-PAL-MONO", 0x0878, 0x8059},
- {"I-PAL-NICAM", 0x1080, 0x8009},
- {"I-PAL-NICAM-MONO", 0x0E78, 0x8009},
- {"D/K-PAL-A2", 0x1600, 0x8009},
- {"D/K-PAL-NICAM", 0x0E80, 0x8009},
- {"D/K-PAL-MONO", 0x1478, 0x8009},
- {"D/K-SECAM-A2 DK1", 0x1200, 0x8009},
- {"D/K-SECAM-A2 L/DK3",0x0E00, 0x8009},
- {"D/K-SECAM-A2 MONO", 0x1478, 0x8009},
- {"L-SECAM-NICAM", 0x8E82, 0x0009},
- {"L'-SECAM-NICAM", 0x8E82, 0x4009},
- {"DTV6", 0x00C0, 0x8002},
- {"DTV8", 0x00C0, 0x800B},
- {"DTV7/8", 0x00C0, 0x801B},
- {"DTV7", 0x00C0, 0x8007},
- {"FM Radio-INPUT2", 0x9802, 0x9002},
- {"FM Radio-INPUT1", 0x0208, 0x9002}
-};
-
-static int xc5000_writeregs(struct xc5000_priv *priv, u8 *buf, u8 len);
-static int xc5000_readregs(struct xc5000_priv *priv, u8 *buf, u8 len);
-static void xc5000_TunerReset(struct dvb_frontend *fe);
-
-static int xc_send_i2c_data(struct xc5000_priv *priv, u8 *buf, int len)
-{
- return xc5000_writeregs(priv, buf, len)
- ? XC_RESULT_I2C_WRITE_FAILURE : XC_RESULT_SUCCESS;
-}
-
-static int xc_read_i2c_data(struct xc5000_priv *priv, u8 *buf, int len)
-{
- return xc5000_readregs(priv, buf, len)
- ? XC_RESULT_I2C_READ_FAILURE : XC_RESULT_SUCCESS;
-}
-
-static int xc_reset(struct dvb_frontend *fe)
-{
- xc5000_TunerReset(fe);
- return XC_RESULT_SUCCESS;
-}
-
-static void xc_wait(int wait_ms)
-{
- msleep(wait_ms);
-}
-
-static void xc5000_TunerReset(struct dvb_frontend *fe)
-{
- struct xc5000_priv *priv = fe->tuner_priv;
- int ret;
-
- dprintk(1, "%s()\n", __func__);
-
- if (priv->cfg->tuner_callback) {
- ret = priv->cfg->tuner_callback(priv->cfg->priv,
- XC5000_TUNER_RESET, 0);
- if (ret)
- printk(KERN_ERR "xc5000: reset failed\n");
- } else
- printk(KERN_ERR "xc5000: no tuner reset callback function, fatal\n");
-}
-
-static int xc_write_reg(struct xc5000_priv *priv, u16 regAddr, u16 i2cData)
-{
- u8 buf[4];
- int WatchDogTimer = 5;
- int result;
-
- buf[0] = (regAddr >> 8) & 0xFF;
- buf[1] = regAddr & 0xFF;
- buf[2] = (i2cData >> 8) & 0xFF;
- buf[3] = i2cData & 0xFF;
- result = xc_send_i2c_data(priv, buf, 4);
- if (result == XC_RESULT_SUCCESS) {
- /* wait for busy flag to clear */
- while ((WatchDogTimer > 0) && (result == XC_RESULT_SUCCESS)) {
- buf[0] = 0;
- buf[1] = XREG_BUSY;
-
- result = xc_send_i2c_data(priv, buf, 2);
- if (result == XC_RESULT_SUCCESS) {
- result = xc_read_i2c_data(priv, buf, 2);
- if (result == XC_RESULT_SUCCESS) {
- if ((buf[0] == 0) && (buf[1] == 0)) {
- /* busy flag cleared */
- break;
- } else {
- xc_wait(100); /* wait 5 ms */
- WatchDogTimer--;
- }
- }
- }
- }
- }
- if (WatchDogTimer < 0)
- result = XC_RESULT_I2C_WRITE_FAILURE;
-
- return result;
-}
-
-static int xc_read_reg(struct xc5000_priv *priv, u16 regAddr, u16 *i2cData)
-{
- u8 buf[2];
- int result;
-
- buf[0] = (regAddr >> 8) & 0xFF;
- buf[1] = regAddr & 0xFF;
- result = xc_send_i2c_data(priv, buf, 2);
- if (result != XC_RESULT_SUCCESS)
- return result;
-
- result = xc_read_i2c_data(priv, buf, 2);
- if (result != XC_RESULT_SUCCESS)
- return result;
-
- *i2cData = buf[0] * 256 + buf[1];
- return result;
-}
-
-static int xc_load_i2c_sequence(struct dvb_frontend *fe, u8 i2c_sequence[])
-{
- struct xc5000_priv *priv = fe->tuner_priv;
-
- int i, nbytes_to_send, result;
- unsigned int len, pos, index;
- u8 buf[XC_MAX_I2C_WRITE_LENGTH];
-
- index=0;
- while ((i2c_sequence[index]!=0xFF) || (i2c_sequence[index+1]!=0xFF)) {
- len = i2c_sequence[index]* 256 + i2c_sequence[index+1];
- if (len == 0x0000) {
- /* RESET command */
- result = xc_reset(fe);
- index += 2;
- if (result != XC_RESULT_SUCCESS)
- return result;
- } else if (len & 0x8000) {
- /* WAIT command */
- xc_wait(len & 0x7FFF);
- index += 2;
- } else {
- /* Send i2c data whilst ensuring individual transactions
- * do not exceed XC_MAX_I2C_WRITE_LENGTH bytes.
- */
- index += 2;
- buf[0] = i2c_sequence[index];
- buf[1] = i2c_sequence[index + 1];
- pos = 2;
- while (pos < len) {
- if ((len - pos) > XC_MAX_I2C_WRITE_LENGTH - 2) {
- nbytes_to_send = XC_MAX_I2C_WRITE_LENGTH;
- } else {
- nbytes_to_send = (len - pos + 2);
- }
- for (i=2; i<nbytes_to_send; i++) {
- buf[i] = i2c_sequence[index + pos + i - 2];
- }
- result = xc_send_i2c_data(priv, buf, nbytes_to_send);
-
- if (result != XC_RESULT_SUCCESS)
- return result;
-
- pos += nbytes_to_send - 2;
- }
- index += len;
- }
- }
- return XC_RESULT_SUCCESS;
-}
-
-static int xc_initialize(struct xc5000_priv *priv)
-{
- dprintk(1, "%s()\n", __func__);
- return xc_write_reg(priv, XREG_INIT, 0);
-}
-
-static int xc_SetTVStandard(struct xc5000_priv *priv,
- u16 VideoMode, u16 AudioMode)
-{
- int ret;
- dprintk(1, "%s(0x%04x,0x%04x)\n", __func__, VideoMode, AudioMode);
- dprintk(1, "%s() Standard = %s\n",
- __func__,
- XC5000_Standard[priv->video_standard].Name);
-
- ret = xc_write_reg(priv, XREG_VIDEO_MODE, VideoMode);
- if (ret == XC_RESULT_SUCCESS)
- ret = xc_write_reg(priv, XREG_AUDIO_MODE, AudioMode);
-
- return ret;
-}
-
-static int xc_shutdown(struct xc5000_priv *priv)
-{
- return 0;
- /* Fixme: cannot bring tuner back alive once shutdown
- * without reloading the driver modules.
- * return xc_write_reg(priv, XREG_POWER_DOWN, 0);
- */
-}
-
-static int xc_SetSignalSource(struct xc5000_priv *priv, u16 rf_mode)
-{
- dprintk(1, "%s(%d) Source = %s\n", __func__, rf_mode,
- rf_mode == XC_RF_MODE_AIR ? "ANTENNA" : "CABLE");
-
- if ((rf_mode != XC_RF_MODE_AIR) && (rf_mode != XC_RF_MODE_CABLE))
- {
- rf_mode = XC_RF_MODE_CABLE;
- printk(KERN_ERR
- "%s(), Invalid mode, defaulting to CABLE",
- __func__);
- }
- return xc_write_reg(priv, XREG_SIGNALSOURCE, rf_mode);
-}
-
-static const struct dvb_tuner_ops xc5000_tuner_ops;
-
-static int xc_set_RF_frequency(struct xc5000_priv *priv, u32 freq_hz)
-{
- u16 freq_code;
-
- dprintk(1, "%s(%u)\n", __func__, freq_hz);
-
- if ((freq_hz > xc5000_tuner_ops.info.frequency_max) ||
- (freq_hz < xc5000_tuner_ops.info.frequency_min))
- return XC_RESULT_OUT_OF_RANGE;
-
- freq_code = (u16)(freq_hz / 15625);
-
- return xc_write_reg(priv, XREG_RF_FREQ, freq_code);
-}
-
-
-static int xc_set_IF_frequency(struct xc5000_priv *priv, u32 freq_khz)
-{
- u32 freq_code = (freq_khz * 1024)/1000;
- dprintk(1, "%s(freq_khz = %d) freq_code = 0x%x\n",
- __func__, freq_khz, freq_code);
-
- return xc_write_reg(priv, XREG_IF_OUT, freq_code);
-}
-
-
-static int xc_get_ADC_Envelope(struct xc5000_priv *priv, u16 *adc_envelope)
-{
- return xc_read_reg(priv, XREG_ADC_ENV, adc_envelope);
-}
-
-static int xc_get_frequency_error(struct xc5000_priv *priv, u32 *freq_error_hz)
-{
- int result;
- u16 regData;
- u32 tmp;
-
- result = xc_read_reg(priv, XREG_FREQ_ERROR, &regData);
- if (result)
- return result;
-
- tmp = (u32)regData;
- (*freq_error_hz) = (tmp * 15625) / 1000;
- return result;
-}
-
-static int xc_get_lock_status(struct xc5000_priv *priv, u16 *lock_status)
-{
- return xc_read_reg(priv, XREG_LOCK, lock_status);
-}
-
-static int xc_get_version(struct xc5000_priv *priv,
- u8 *hw_majorversion, u8 *hw_minorversion,
- u8 *fw_majorversion, u8 *fw_minorversion)
-{
- u16 data;
- int result;
-
- result = xc_read_reg(priv, XREG_VERSION, &data);
- if (result)
- return result;
-
- (*hw_majorversion) = (data >> 12) & 0x0F;
- (*hw_minorversion) = (data >> 8) & 0x0F;
- (*fw_majorversion) = (data >> 4) & 0x0F;
- (*fw_minorversion) = data & 0x0F;
-
- return 0;
-}
-
-static int xc_get_hsync_freq(struct xc5000_priv *priv, u32 *hsync_freq_hz)
-{
- u16 regData;
- int result;
-
- result = xc_read_reg(priv, XREG_HSYNC_FREQ, &regData);
- if (result)
- return result;
-
- (*hsync_freq_hz) = ((regData & 0x0fff) * 763)/100;
- return result;
-}
-
-static int xc_get_frame_lines(struct xc5000_priv *priv, u16 *frame_lines)
-{
- return xc_read_reg(priv, XREG_FRAME_LINES, frame_lines);
-}
-
-static int xc_get_quality(struct xc5000_priv *priv, u16 *quality)
-{
- return xc_read_reg(priv, XREG_QUALITY, quality);
-}
-
-static u16 WaitForLock(struct xc5000_priv *priv)
-{
- u16 lockState = 0;
- int watchDogCount = 40;
-
- while ((lockState == 0) && (watchDogCount > 0)) {
- xc_get_lock_status(priv, &lockState);
- if (lockState != 1) {
- xc_wait(5);
- watchDogCount--;
- }
- }
- return lockState;
-}
-
-static int xc_tune_channel(struct xc5000_priv *priv, u32 freq_hz)
-{
- int found = 0;
-
- dprintk(1, "%s(%u)\n", __func__, freq_hz);
-
- if (xc_set_RF_frequency(priv, freq_hz) != XC_RESULT_SUCCESS)
- return 0;
-
- if (WaitForLock(priv) == 1)
- found = 1;
-
- return found;
-}
-
-static int xc5000_readreg(struct xc5000_priv *priv, u16 reg, u16 *val)
-{
- u8 buf[2] = { reg >> 8, reg & 0xff };
- u8 bval[2] = { 0, 0 };
- struct i2c_msg msg[2] = {
- { .addr = priv->cfg->i2c_address,
- .flags = 0, .buf = &buf[0], .len = 2 },
- { .addr = priv->cfg->i2c_address,
- .flags = I2C_M_RD, .buf = &bval[0], .len = 2 },
- };
-
- if (i2c_transfer(priv->i2c, msg, 2) != 2) {
- printk(KERN_WARNING "xc5000: I2C read failed\n");
- return -EREMOTEIO;
- }
-
- *val = (bval[0] << 8) | bval[1];
- return 0;
-}
-
-static int xc5000_writeregs(struct xc5000_priv *priv, u8 *buf, u8 len)
-{
- struct i2c_msg msg = { .addr = priv->cfg->i2c_address,
- .flags = 0, .buf = buf, .len = len };
-
- if (i2c_transfer(priv->i2c, &msg, 1) != 1) {
- printk(KERN_ERR "xc5000: I2C write failed (len=%i)\n",
- (int)len);
- return -EREMOTEIO;
- }
- return 0;
-}
-
-static int xc5000_readregs(struct xc5000_priv *priv, u8 *buf, u8 len)
-{
- struct i2c_msg msg = { .addr = priv->cfg->i2c_address,
- .flags = I2C_M_RD, .buf = buf, .len = len };
-
- if (i2c_transfer(priv->i2c, &msg, 1) != 1) {
- printk(KERN_ERR "xc5000 I2C read failed (len=%i)\n",(int)len);
- return -EREMOTEIO;
- }
- return 0;
-}
-
-static int xc5000_fwupload(struct dvb_frontend* fe)
-{
- struct xc5000_priv *priv = fe->tuner_priv;
- const struct firmware *fw;
- int ret;
-
- /* request the firmware, this will block and timeout */
- printk(KERN_INFO "xc5000: waiting for firmware upload (%s)...\n",
- XC5000_DEFAULT_FIRMWARE);
-
- ret = request_firmware(&fw, XC5000_DEFAULT_FIRMWARE, &priv->i2c->dev);
- if (ret) {
- printk(KERN_ERR "xc5000: Upload failed. (file not found?)\n");
- ret = XC_RESULT_RESET_FAILURE;
- goto out;
- } else {
- printk(KERN_INFO "xc5000: firmware read %Zu bytes.\n",
- fw->size);
- ret = XC_RESULT_SUCCESS;
- }
-
- if (fw->size != XC5000_DEFAULT_FIRMWARE_SIZE) {
- printk(KERN_ERR "xc5000: firmware incorrect size\n");
- ret = XC_RESULT_RESET_FAILURE;
- } else {
- printk(KERN_INFO "xc5000: firmware upload\n");
- ret = xc_load_i2c_sequence(fe, fw->data );
- }
-
-out:
- release_firmware(fw);
- return ret;
-}
-
-static void xc_debug_dump(struct xc5000_priv *priv)
-{
- u16 adc_envelope;
- u32 freq_error_hz = 0;
- u16 lock_status;
- u32 hsync_freq_hz = 0;
- u16 frame_lines;
- u16 quality;
- u8 hw_majorversion = 0, hw_minorversion = 0;
- u8 fw_majorversion = 0, fw_minorversion = 0;
-
- /* Wait for stats to stabilize.
- * Frame Lines needs two frame times after initial lock
- * before it is valid.
- */
- xc_wait(100);
-
- xc_get_ADC_Envelope(priv, &adc_envelope);
- dprintk(1, "*** ADC envelope (0-1023) = %d\n", adc_envelope);
-
- xc_get_frequency_error(priv, &freq_error_hz);
- dprintk(1, "*** Frequency error = %d Hz\n", freq_error_hz);
-
- xc_get_lock_status(priv, &lock_status);
- dprintk(1, "*** Lock status (0-Wait, 1-Locked, 2-No-signal) = %d\n",
- lock_status);
-
- xc_get_version(priv, &hw_majorversion, &hw_minorversion,
- &fw_majorversion, &fw_minorversion);
- dprintk(1, "*** HW: V%02x.%02x, FW: V%02x.%02x\n",
- hw_majorversion, hw_minorversion,
- fw_majorversion, fw_minorversion);
-
- xc_get_hsync_freq(priv, &hsync_freq_hz);
- dprintk(1, "*** Horizontal sync frequency = %d Hz\n", hsync_freq_hz);
-
- xc_get_frame_lines(priv, &frame_lines);
- dprintk(1, "*** Frame lines = %d\n", frame_lines);
-
- xc_get_quality(priv, &quality);
- dprintk(1, "*** Quality (0:<8dB, 7:>56dB) = %d\n", quality);
-}
-
-static int xc5000_set_params(struct dvb_frontend *fe,
- struct dvb_frontend_parameters *params)
-{
- struct xc5000_priv *priv = fe->tuner_priv;
- int ret;
-
- dprintk(1, "%s() frequency=%d (Hz)\n", __func__, params->frequency);
-
- switch(params->u.vsb.modulation) {
- case VSB_8:
- case VSB_16:
- dprintk(1, "%s() VSB modulation\n", __func__);
- priv->rf_mode = XC_RF_MODE_AIR;
- priv->freq_hz = params->frequency - 1750000;
- priv->bandwidth = BANDWIDTH_6_MHZ;
- priv->video_standard = DTV6;
- break;
- case QAM_64:
- case QAM_256:
- case QAM_AUTO:
- dprintk(1, "%s() QAM modulation\n", __func__);
- priv->rf_mode = XC_RF_MODE_CABLE;
- priv->freq_hz = params->frequency - 1750000;
- priv->bandwidth = BANDWIDTH_6_MHZ;
- priv->video_standard = DTV6;
- break;
- default:
- return -EINVAL;
- }
-
- dprintk(1, "%s() frequency=%d (compensated)\n",
- __func__, priv->freq_hz);
-
- ret = xc_SetSignalSource(priv, priv->rf_mode);
- if (ret != XC_RESULT_SUCCESS) {
- printk(KERN_ERR
- "xc5000: xc_SetSignalSource(%d) failed\n",
- priv->rf_mode);
- return -EREMOTEIO;
- }
-
- ret = xc_SetTVStandard(priv,
- XC5000_Standard[priv->video_standard].VideoMode,
- XC5000_Standard[priv->video_standard].AudioMode);
- if (ret != XC_RESULT_SUCCESS) {
- printk(KERN_ERR "xc5000: xc_SetTVStandard failed\n");
- return -EREMOTEIO;
- }
-
- ret = xc_set_IF_frequency(priv, priv->cfg->if_khz);
- if (ret != XC_RESULT_SUCCESS) {
- printk(KERN_ERR "xc5000: xc_Set_IF_frequency(%d) failed\n",
- priv->cfg->if_khz);
- return -EIO;
- }
-
- xc_tune_channel(priv, priv->freq_hz);
-
- if (debug)
- xc_debug_dump(priv);
-
- return 0;
-}
-
-static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe);
-
-static int xc5000_set_analog_params(struct dvb_frontend *fe,
- struct analog_parameters *params)
-{
- struct xc5000_priv *priv = fe->tuner_priv;
- int ret;
-
- if(priv->fwloaded == 0)
- xc_load_fw_and_init_tuner(fe);
-
- dprintk(1, "%s() frequency=%d (in units of 62.5khz)\n",
- __func__, params->frequency);
-
- priv->rf_mode = XC_RF_MODE_CABLE; /* Fix me: it could be air. */
-
- /* params->frequency is in units of 62.5khz */
- priv->freq_hz = params->frequency * 62500;
-
- /* FIX ME: Some video standards may have several possible audio
- standards. We simply default to one of them here.
- */
- if(params->std & V4L2_STD_MN) {
- /* default to BTSC audio standard */
- priv->video_standard = MN_NTSC_PAL_BTSC;
- goto tune_channel;
- }
-
- if(params->std & V4L2_STD_PAL_BG) {
- /* default to NICAM audio standard */
- priv->video_standard = BG_PAL_NICAM;
- goto tune_channel;
- }
-
- if(params->std & V4L2_STD_PAL_I) {
- /* default to NICAM audio standard */
- priv->video_standard = I_PAL_NICAM;
- goto tune_channel;
- }
-
- if(params->std & V4L2_STD_PAL_DK) {
- /* default to NICAM audio standard */
- priv->video_standard = DK_PAL_NICAM;
- goto tune_channel;
- }
-
- if(params->std & V4L2_STD_SECAM_DK) {
- /* default to A2 DK1 audio standard */
- priv->video_standard = DK_SECAM_A2DK1;
- goto tune_channel;
- }
-
- if(params->std & V4L2_STD_SECAM_L) {
- priv->video_standard = L_SECAM_NICAM;
- goto tune_channel;
- }
-
- if(params->std & V4L2_STD_SECAM_LC) {
- priv->video_standard = LC_SECAM_NICAM;
- goto tune_channel;
- }
-
-tune_channel:
- ret = xc_SetSignalSource(priv, priv->rf_mode);
- if (ret != XC_RESULT_SUCCESS) {
- printk(KERN_ERR
- "xc5000: xc_SetSignalSource(%d) failed\n",
- priv->rf_mode);
- return -EREMOTEIO;
- }
-
- ret = xc_SetTVStandard(priv,
- XC5000_Standard[priv->video_standard].VideoMode,
- XC5000_Standard[priv->video_standard].AudioMode);
- if (ret != XC_RESULT_SUCCESS) {
- printk(KERN_ERR "xc5000: xc_SetTVStandard failed\n");
- return -EREMOTEIO;
- }
-
- xc_tune_channel(priv, priv->freq_hz);
-
- if (debug)
- xc_debug_dump(priv);
-
- return 0;
-}
-
-static int xc5000_get_frequency(struct dvb_frontend *fe, u32 *freq)
-{
- struct xc5000_priv *priv = fe->tuner_priv;
- dprintk(1, "%s()\n", __func__);
- *freq = priv->freq_hz;
- return 0;
-}
-
-static int xc5000_get_bandwidth(struct dvb_frontend *fe, u32 *bw)
-{
- struct xc5000_priv *priv = fe->tuner_priv;
- dprintk(1, "%s()\n", __func__);
-
- *bw = priv->bandwidth;
- return 0;
-}
-
-static int xc5000_get_status(struct dvb_frontend *fe, u32 *status)
-{
- struct xc5000_priv *priv = fe->tuner_priv;
- u16 lock_status = 0;
-
- xc_get_lock_status(priv, &lock_status);
-
- dprintk(1, "%s() lock_status = 0x%08x\n", __func__, lock_status);
-
- *status = lock_status;
-
- return 0;
-}
-
-static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe)
-{
- struct xc5000_priv *priv = fe->tuner_priv;
- int ret = 0;
-
- if (priv->fwloaded == 0) {
- ret = xc5000_fwupload(fe);
- if (ret != XC_RESULT_SUCCESS)
- return ret;
- priv->fwloaded = 1;
- }
-
- /* Start the tuner self-calibration process */
- ret |= xc_initialize(priv);
-
- /* Wait for calibration to complete.
- * We could continue but XC5000 will clock stretch subsequent
- * I2C transactions until calibration is complete. This way we
- * don't have to rely on clock stretching working.
- */
- xc_wait( 100 );
-
- /* Default to "CABLE" mode */
- ret |= xc_write_reg(priv, XREG_SIGNALSOURCE, XC_RF_MODE_CABLE);
-
- return ret;
-}
-
-static int xc5000_sleep(struct dvb_frontend *fe)
-{
- struct xc5000_priv *priv = fe->tuner_priv;
- int ret;
-
- dprintk(1, "%s()\n", __func__);
-
- /* On Pinnacle PCTV HD 800i, the tuner cannot be reinitialized
- * once shutdown without reloading the driver. Maybe I am not
- * doing something right.
- *
- */
-
- ret = xc_shutdown(priv);
- if(ret != XC_RESULT_SUCCESS) {
- printk(KERN_ERR
- "xc5000: %s() unable to shutdown tuner\n",
- __func__);
- return -EREMOTEIO;
- }
- else {
- /* priv->fwloaded = 0; */
- return XC_RESULT_SUCCESS;
- }
-}
-
-static int xc5000_init(struct dvb_frontend *fe)
-{
- struct xc5000_priv *priv = fe->tuner_priv;
- dprintk(1, "%s()\n", __func__);
-
- if (xc_load_fw_and_init_tuner(fe) != XC_RESULT_SUCCESS) {
- printk(KERN_ERR "xc5000: Unable to initialise tuner\n");
- return -EREMOTEIO;
- }
-
- if (debug)
- xc_debug_dump(priv);
-
- return 0;
-}
-
-static int xc5000_release(struct dvb_frontend *fe)
-{
- dprintk(1, "%s()\n", __func__);
- kfree(fe->tuner_priv);
- fe->tuner_priv = NULL;
- return 0;
-}
-
-static const struct dvb_tuner_ops xc5000_tuner_ops = {
- .info = {
- .name = "Xceive XC5000",
- .frequency_min = 1000000,
- .frequency_max = 1023000000,
- .frequency_step = 50000,
- },
-
- .release = xc5000_release,
- .init = xc5000_init,
- .sleep = xc5000_sleep,
-
- .set_params = xc5000_set_params,
- .set_analog_params = xc5000_set_analog_params,
- .get_frequency = xc5000_get_frequency,
- .get_bandwidth = xc5000_get_bandwidth,
- .get_status = xc5000_get_status
-};
-
-struct dvb_frontend * xc5000_attach(struct dvb_frontend *fe,
- struct i2c_adapter *i2c,
- struct xc5000_config *cfg)
-{
- struct xc5000_priv *priv = NULL;
- u16 id = 0;
-
- dprintk(1, "%s()\n", __func__);
-
- priv = kzalloc(sizeof(struct xc5000_priv), GFP_KERNEL);
- if (priv == NULL)
- return NULL;
-
- priv->cfg = cfg;
- priv->bandwidth = BANDWIDTH_6_MHZ;
- priv->i2c = i2c;
-
- /* Check if firmware has been loaded. It is possible that another
- instance of the driver has loaded the firmware.
- */
- if (xc5000_readreg(priv, XREG_PRODUCT_ID, &id) != 0) {
- kfree(priv);
- return NULL;
- }
-
- switch(id) {
- case XC_PRODUCT_ID_FW_LOADED:
- printk(KERN_INFO
- "xc5000: Successfully identified at address 0x%02x\n",
- cfg->i2c_address);
- printk(KERN_INFO
- "xc5000: Firmware has been loaded previously\n");
- priv->fwloaded = 1;
- break;
- case XC_PRODUCT_ID_FW_NOT_LOADED:
- printk(KERN_INFO
- "xc5000: Successfully identified at address 0x%02x\n",
- cfg->i2c_address);
- printk(KERN_INFO
- "xc5000: Firmware has not been loaded previously\n");
- priv->fwloaded = 0;
- break;
- default:
- printk(KERN_ERR
- "xc5000: Device not found at addr 0x%02x (0x%x)\n",
- cfg->i2c_address, id);
- kfree(priv);
- return NULL;
- }
-
- memcpy(&fe->ops.tuner_ops, &xc5000_tuner_ops,
- sizeof(struct dvb_tuner_ops));
-
- fe->tuner_priv = priv;
-
- return fe;
-}
-EXPORT_SYMBOL(xc5000_attach);
-
-MODULE_AUTHOR("Steven Toth");
-MODULE_DESCRIPTION("Xceive xc5000 silicon tuner driver");
-MODULE_LICENSE("GPL");
diff --git a/drivers/media/dvb/frontends/xc5000.h b/drivers/media/dvb/frontends/xc5000.h
deleted file mode 100644
index b890883a0cd..00000000000
--- a/drivers/media/dvb/frontends/xc5000.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Driver for Xceive XC5000 "QAM/8VSB single chip tuner"
- *
- * Copyright (c) 2007 Steven Toth <stoth@hauppauge.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef __XC5000_H__
-#define __XC5000_H__
-
-#include <linux/firmware.h>
-
-struct dvb_frontend;
-struct i2c_adapter;
-
-struct xc5000_config {
- u8 i2c_address;
- u32 if_khz;
-
- /* For each bridge framework, when it attaches either analog or digital,
- * it has to store a reference back to its _core equivalent structure,
- * so that it can service the hardware by steering gpio's etc.
- * Each bridge implementation is different so cast priv accordingly.
- * The xc5000 driver cares not for this value, other than ensuring
- * it's passed back to a bridge during tuner_callback().
- */
- void *priv;
- int (*tuner_callback) (void *priv, int command, int arg);
-};
-
-/* xc5000 callback command */
-#define XC5000_TUNER_RESET 0
-
-#if defined(CONFIG_DVB_TUNER_XC5000) || \
- (defined(CONFIG_DVB_TUNER_XC5000_MODULE) && defined(MODULE))
-extern struct dvb_frontend* xc5000_attach(struct dvb_frontend *fe,
- struct i2c_adapter *i2c,
- struct xc5000_config *cfg);
-#else
-static inline struct dvb_frontend* xc5000_attach(struct dvb_frontend *fe,
- struct i2c_adapter *i2c,
- struct xc5000_config *cfg)
-{
- printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
- return NULL;
-}
-#endif // CONFIG_DVB_TUNER_XC5000
-
-#endif // __XC5000_H__
diff --git a/drivers/media/dvb/frontends/xc5000_priv.h b/drivers/media/dvb/frontends/xc5000_priv.h
deleted file mode 100644
index 13b2d19341d..00000000000
--- a/drivers/media/dvb/frontends/xc5000_priv.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Driver for Xceive XC5000 "QAM/8VSB single chip tuner"
- *
- * Copyright (c) 2007 Steven Toth <stoth@hauppauge.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef XC5000_PRIV_H
-#define XC5000_PRIV_H
-
-struct xc5000_priv {
- struct xc5000_config *cfg;
- struct i2c_adapter *i2c;
-
- u32 freq_hz;
- u32 bandwidth;
- u8 video_standard;
- u8 rf_mode;
- u8 fwloaded;
-};
-
-#endif