diff options
Diffstat (limited to 'linux/drivers/media/common/tuners')
-rw-r--r-- | linux/drivers/media/common/tuners/Kconfig | 60 | ||||
-rw-r--r-- | linux/drivers/media/common/tuners/mxl5005s.c | 7 | ||||
-rw-r--r-- | linux/drivers/media/common/tuners/mxl5007t.c | 435 | ||||
-rw-r--r-- | linux/drivers/media/common/tuners/tda18271-fe.c | 37 | ||||
-rw-r--r-- | linux/drivers/media/common/tuners/tda18271-priv.h | 6 | ||||
-rw-r--r-- | linux/drivers/media/common/tuners/tda18271.h | 10 | ||||
-rw-r--r-- | linux/drivers/media/common/tuners/tda827x.c | 54 | ||||
-rw-r--r-- | linux/drivers/media/common/tuners/tda8290.c | 1 | ||||
-rw-r--r-- | linux/drivers/media/common/tuners/xc5000.c | 14 |
9 files changed, 279 insertions, 345 deletions
diff --git a/linux/drivers/media/common/tuners/Kconfig b/linux/drivers/media/common/tuners/Kconfig index 7969b695c..52c3f65b1 100644 --- a/linux/drivers/media/common/tuners/Kconfig +++ b/linux/drivers/media/common/tuners/Kconfig @@ -21,17 +21,17 @@ config MEDIA_TUNER tristate default VIDEO_MEDIA && I2C depends on VIDEO_MEDIA && I2C - select MEDIA_TUNER_XC2028 if !MEDIA_TUNER_CUSTOMIZE - select MEDIA_TUNER_XC5000 if !MEDIA_TUNER_CUSTOMIZE - select MEDIA_TUNER_MT20XX if !MEDIA_TUNER_CUSTOMIZE - select MEDIA_TUNER_TDA8290 if !MEDIA_TUNER_CUSTOMIZE - select MEDIA_TUNER_TEA5761 if !MEDIA_TUNER_CUSTOMIZE - select MEDIA_TUNER_TEA5767 if !MEDIA_TUNER_CUSTOMIZE - select MEDIA_TUNER_SIMPLE if !MEDIA_TUNER_CUSTOMIZE - select MEDIA_TUNER_TDA9887 if !MEDIA_TUNER_CUSTOMIZE - select MEDIA_TUNER_MC44S803 if !MEDIA_TUNER_CUSTOMIZE - -menuconfig MEDIA_TUNER_CUSTOMIZE + select MEDIA_TUNER_XC2028 if !MEDIA_TUNER_CUSTOMISE + select MEDIA_TUNER_XC5000 if !MEDIA_TUNER_CUSTOMISE + select MEDIA_TUNER_MT20XX if !MEDIA_TUNER_CUSTOMISE + select MEDIA_TUNER_TDA8290 if !MEDIA_TUNER_CUSTOMISE + select MEDIA_TUNER_TEA5761 if !MEDIA_TUNER_CUSTOMISE + select MEDIA_TUNER_TEA5767 if !MEDIA_TUNER_CUSTOMISE + select MEDIA_TUNER_SIMPLE if !MEDIA_TUNER_CUSTOMISE + select MEDIA_TUNER_TDA9887 if !MEDIA_TUNER_CUSTOMISE + select MEDIA_TUNER_MC44S803 if !MEDIA_TUNER_CUSTOMISE + +menuconfig MEDIA_TUNER_CUSTOMISE bool "Customize analog and hybrid tuner modules to build" depends on MEDIA_TUNER default n @@ -44,13 +44,13 @@ menuconfig MEDIA_TUNER_CUSTOMIZE If unsure say N. -if MEDIA_TUNER_CUSTOMIZE +if MEDIA_TUNER_CUSTOMISE config MEDIA_TUNER_SIMPLE tristate "Simple tuner support" depends on VIDEO_MEDIA && I2C select MEDIA_TUNER_TDA9887 - default m if MEDIA_TUNER_CUSTOMIZE + default m if MEDIA_TUNER_CUSTOMISE help Say Y here to include support for various simple tuners. @@ -59,28 +59,28 @@ config MEDIA_TUNER_TDA8290 depends on VIDEO_MEDIA && I2C select MEDIA_TUNER_TDA827X select MEDIA_TUNER_TDA18271 - default m if MEDIA_TUNER_CUSTOMIZE + default m if MEDIA_TUNER_CUSTOMISE help Say Y here to include support for Philips TDA8290+8275(a) tuner. config MEDIA_TUNER_TDA827X tristate "Philips TDA827X silicon tuner" depends on VIDEO_MEDIA && I2C - default m if DVB_FE_CUSTOMISE + default m if MEDIA_TUNER_CUSTOMISE help A DVB-T silicon tuner module. Say Y when you want to support this tuner. config MEDIA_TUNER_TDA18271 tristate "NXP TDA18271 silicon tuner" depends on VIDEO_MEDIA && I2C - default m if DVB_FE_CUSTOMISE + default m if MEDIA_TUNER_CUSTOMISE help A silicon tuner module. Say Y when you want to support this tuner. config MEDIA_TUNER_TDA9887 tristate "TDA 9885/6/7 analog IF demodulator" depends on VIDEO_MEDIA && I2C - default m if MEDIA_TUNER_CUSTOMIZE + default m if MEDIA_TUNER_CUSTOMISE help Say Y here to include support for Philips TDA9885/6/7 analog IF demodulator. @@ -89,63 +89,63 @@ config MEDIA_TUNER_TEA5761 tristate "TEA 5761 radio tuner (EXPERIMENTAL)" depends on VIDEO_MEDIA && I2C depends on EXPERIMENTAL - default m if MEDIA_TUNER_CUSTOMIZE + default m if MEDIA_TUNER_CUSTOMISE help Say Y here to include support for the Philips TEA5761 radio tuner. config MEDIA_TUNER_TEA5767 tristate "TEA 5767 radio tuner" depends on VIDEO_MEDIA && I2C - default m if MEDIA_TUNER_CUSTOMIZE + default m if MEDIA_TUNER_CUSTOMISE help Say Y here to include support for the Philips TEA5767 radio tuner. config MEDIA_TUNER_MT20XX tristate "Microtune 2032 / 2050 tuners" depends on VIDEO_MEDIA && I2C - default m if MEDIA_TUNER_CUSTOMIZE + default m if MEDIA_TUNER_CUSTOMISE help Say Y here to include support for the MT2032 / MT2050 tuner. config MEDIA_TUNER_MT2060 tristate "Microtune MT2060 silicon IF tuner" depends on VIDEO_MEDIA && I2C - default m if DVB_FE_CUSTOMISE + default m if MEDIA_TUNER_CUSTOMISE help A driver for the silicon IF tuner MT2060 from Microtune. config MEDIA_TUNER_MT2266 tristate "Microtune MT2266 silicon tuner" depends on VIDEO_MEDIA && I2C - default m if DVB_FE_CUSTOMISE + default m if MEDIA_TUNER_CUSTOMISE help A driver for the silicon baseband tuner MT2266 from Microtune. config MEDIA_TUNER_MT2131 tristate "Microtune MT2131 silicon tuner" depends on VIDEO_MEDIA && I2C - default m if DVB_FE_CUSTOMISE + default m if MEDIA_TUNER_CUSTOMISE help A driver for the silicon baseband tuner MT2131 from Microtune. config MEDIA_TUNER_QT1010 tristate "Quantek QT1010 silicon tuner" depends on VIDEO_MEDIA && I2C - default m if DVB_FE_CUSTOMISE + default m if MEDIA_TUNER_CUSTOMISE help A driver for the silicon tuner QT1010 from Quantek. config MEDIA_TUNER_XC2028 tristate "XCeive xc2028/xc3028 tuners" depends on VIDEO_MEDIA && I2C - default m if MEDIA_TUNER_CUSTOMIZE + default m if MEDIA_TUNER_CUSTOMISE help Say Y here to include support for the xc2028/xc3028 tuners. config MEDIA_TUNER_XC5000 tristate "Xceive XC5000 silicon tuner" depends on VIDEO_MEDIA && I2C - default m if DVB_FE_CUSTOMISE + default m if MEDIA_TUNER_CUSTOMISE help A driver for the silicon tuner XC5000 from Xceive. This device is only used inside a SiP called togther with a @@ -154,22 +154,22 @@ config MEDIA_TUNER_XC5000 config MEDIA_TUNER_MXL5005S tristate "MaxLinear MSL5005S silicon tuner" depends on VIDEO_MEDIA && I2C - default m if DVB_FE_CUSTOMISE + default m if MEDIA_TUNER_CUSTOMISE help A driver for the silicon tuner MXL5005S from MaxLinear. config MEDIA_TUNER_MXL5007T tristate "MaxLinear MxL5007T silicon tuner" depends on VIDEO_MEDIA && I2C - default m if DVB_FE_CUSTOMISE + default m if MEDIA_TUNER_CUSTOMISE help A driver for the silicon tuner MxL5007T from MaxLinear. config MEDIA_TUNER_MC44S803 tristate "Freescale MC44S803 Low Power CMOS Broadband tuners" depends on VIDEO_MEDIA && I2C - default m if DVB_FE_CUSTOMISE + default m if MEDIA_TUNER_CUSTOMISE help Say Y here to support the Freescale MC44S803 based tuners -endif # MEDIA_TUNER_CUSTOMIZE +endif # MEDIA_TUNER_CUSTOMISE diff --git a/linux/drivers/media/common/tuners/mxl5005s.c b/linux/drivers/media/common/tuners/mxl5005s.c index 58418277a..bea599fbc 100644 --- a/linux/drivers/media/common/tuners/mxl5005s.c +++ b/linux/drivers/media/common/tuners/mxl5005s.c @@ -4005,12 +4005,11 @@ static int mxl5005s_set_params(struct dvb_frontend *fe, /* Change tuner for new modulation type if reqd */ if (req_mode != state->current_mode) { switch (req_mode) { - case VSB_8: - case QAM_64: - case QAM_256: - case QAM_AUTO: + case MXL_ATSC: + case MXL_QAM: req_bw = MXL5005S_BANDWIDTH_6MHZ; break; + case MXL_DVBT: default: /* Assume DVB-T */ switch (params->u.ofdm.bandwidth) { diff --git a/linux/drivers/media/common/tuners/mxl5007t.c b/linux/drivers/media/common/tuners/mxl5007t.c index c7aa69df1..09d93144d 100644 --- a/linux/drivers/media/common/tuners/mxl5007t.c +++ b/linux/drivers/media/common/tuners/mxl5007t.c @@ -1,7 +1,7 @@ /* * mxl5007t.c - driver for the MaxLinear MxL5007T silicon tuner * - * Copyright (C) 2008 Michael Krufky <mkrufky@linuxtv.org> + * Copyright (C) 2008, 2009 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 @@ -67,22 +67,17 @@ MODULE_PARM_DESC(debug, "set debug level"); #define MHz 1000000 enum mxl5007t_mode { - MxL_MODE_OTA_DVBT_ATSC = 0, - MxL_MODE_OTA_NTSC_PAL_GH = 1, - MxL_MODE_OTA_PAL_IB = 2, - MxL_MODE_OTA_PAL_D_SECAM_KL = 3, - MxL_MODE_OTA_ISDBT = 4, - MxL_MODE_CABLE_DIGITAL = 0x10, - MxL_MODE_CABLE_NTSC_PAL_GH = 0x11, - MxL_MODE_CABLE_PAL_IB = 0x12, - MxL_MODE_CABLE_PAL_D_SECAM_KL = 0x13, - MxL_MODE_CABLE_SCTE40 = 0x14, + MxL_MODE_ISDBT = 0, + MxL_MODE_DVBT = 1, + MxL_MODE_ATSC = 2, + MxL_MODE_CABLE = 0x10, }; enum mxl5007t_chip_version { MxL_UNKNOWN_ID = 0x00, MxL_5007_V1_F1 = 0x11, MxL_5007_V1_F2 = 0x12, + MxL_5007_V4 = 0x14, MxL_5007_V2_100_F1 = 0x21, MxL_5007_V2_100_F2 = 0x22, MxL_5007_V2_200_F1 = 0x23, @@ -97,67 +92,61 @@ struct reg_pair_t { /* ------------------------------------------------------------------------- */ static struct reg_pair_t init_tab[] = { - { 0x0b, 0x44 }, /* XTAL */ - { 0x0c, 0x60 }, /* IF */ - { 0x10, 0x00 }, /* MISC */ - { 0x12, 0xca }, /* IDAC */ - { 0x16, 0x90 }, /* MODE */ - { 0x32, 0x38 }, /* MODE Analog/Digital */ - { 0xd8, 0x18 }, /* CLK_OUT_ENABLE */ - { 0x2c, 0x34 }, /* OVERRIDE */ - { 0x4d, 0x40 }, /* OVERRIDE */ - { 0x7f, 0x02 }, /* OVERRIDE */ - { 0x9a, 0x52 }, /* OVERRIDE */ - { 0x48, 0x5a }, /* OVERRIDE */ - { 0x76, 0x1a }, /* OVERRIDE */ - { 0x6a, 0x48 }, /* OVERRIDE */ - { 0x64, 0x28 }, /* OVERRIDE */ - { 0x66, 0xe6 }, /* OVERRIDE */ - { 0x35, 0x0e }, /* OVERRIDE */ - { 0x7e, 0x01 }, /* OVERRIDE */ - { 0x83, 0x00 }, /* OVERRIDE */ - { 0x04, 0x0b }, /* OVERRIDE */ - { 0x05, 0x01 }, /* TOP_MASTER_ENABLE */ + { 0x02, 0x06 }, + { 0x03, 0x48 }, + { 0x05, 0x04 }, + { 0x06, 0x10 }, + { 0x2e, 0x15 }, /* OVERRIDE */ + { 0x30, 0x10 }, /* OVERRIDE */ + { 0x45, 0x58 }, /* OVERRIDE */ + { 0x48, 0x19 }, /* OVERRIDE */ + { 0x52, 0x03 }, /* OVERRIDE */ + { 0x53, 0x44 }, /* OVERRIDE */ + { 0x6a, 0x4b }, /* OVERRIDE */ + { 0x76, 0x00 }, /* OVERRIDE */ + { 0x78, 0x18 }, /* OVERRIDE */ + { 0x7a, 0x17 }, /* OVERRIDE */ + { 0x85, 0x06 }, /* OVERRIDE */ + { 0x01, 0x01 }, /* TOP_MASTER_ENABLE */ { 0, 0 } }; static struct reg_pair_t init_tab_cable[] = { - { 0x0b, 0x44 }, /* XTAL */ - { 0x0c, 0x60 }, /* IF */ - { 0x10, 0x00 }, /* MISC */ - { 0x12, 0xca }, /* IDAC */ - { 0x16, 0x90 }, /* MODE */ - { 0x32, 0x38 }, /* MODE A/D */ - { 0x71, 0x3f }, /* TOP1 */ - { 0x72, 0x3f }, /* TOP2 */ - { 0x74, 0x3f }, /* TOP3 */ - { 0xd8, 0x18 }, /* CLK_OUT_ENABLE */ - { 0x2c, 0x34 }, /* OVERRIDE */ - { 0x4d, 0x40 }, /* OVERRIDE */ - { 0x7f, 0x02 }, /* OVERRIDE */ - { 0x9a, 0x52 }, /* OVERRIDE */ - { 0x48, 0x5a }, /* OVERRIDE */ - { 0x76, 0x1a }, /* OVERRIDE */ - { 0x6a, 0x48 }, /* OVERRIDE */ - { 0x64, 0x28 }, /* OVERRIDE */ - { 0x66, 0xe6 }, /* OVERRIDE */ - { 0x35, 0x0e }, /* OVERRIDE */ - { 0x7e, 0x01 }, /* OVERRIDE */ - { 0x04, 0x0b }, /* OVERRIDE */ - { 0x68, 0xb4 }, /* OVERRIDE */ - { 0x36, 0x00 }, /* OVERRIDE */ - { 0x05, 0x01 }, /* TOP_MASTER_ENABLE */ + { 0x02, 0x06 }, + { 0x03, 0x48 }, + { 0x05, 0x04 }, + { 0x06, 0x10 }, + { 0x09, 0x3f }, + { 0x0a, 0x3f }, + { 0x0b, 0x3f }, + { 0x2e, 0x15 }, /* OVERRIDE */ + { 0x30, 0x10 }, /* OVERRIDE */ + { 0x45, 0x58 }, /* OVERRIDE */ + { 0x48, 0x19 }, /* OVERRIDE */ + { 0x52, 0x03 }, /* OVERRIDE */ + { 0x53, 0x44 }, /* OVERRIDE */ + { 0x6a, 0x4b }, /* OVERRIDE */ + { 0x76, 0x00 }, /* OVERRIDE */ + { 0x78, 0x18 }, /* OVERRIDE */ + { 0x7a, 0x17 }, /* OVERRIDE */ + { 0x85, 0x06 }, /* OVERRIDE */ + { 0x01, 0x01 }, /* TOP_MASTER_ENABLE */ { 0, 0 } }; /* ------------------------------------------------------------------------- */ static struct reg_pair_t reg_pair_rftune[] = { - { 0x11, 0x00 }, /* abort tune */ - { 0x13, 0x15 }, - { 0x14, 0x40 }, - { 0x15, 0x0e }, - { 0x11, 0x02 }, /* start tune */ + { 0x0f, 0x00 }, /* abort tune */ + { 0x0c, 0x15 }, + { 0x0d, 0x40 }, + { 0x0e, 0x0e }, + { 0x1f, 0x87 }, /* OVERRIDE */ + { 0x20, 0x1f }, /* OVERRIDE */ + { 0x21, 0x87 }, /* OVERRIDE */ + { 0x22, 0x1f }, /* OVERRIDE */ + { 0x80, 0x01 }, /* freq dependent */ + { 0x0f, 0x01 }, /* start tune */ { 0, 0 } }; @@ -232,63 +221,20 @@ static void mxl5007t_set_mode_bits(struct mxl5007t_state *state, s32 if_diff_out_level) { switch (mode) { - case MxL_MODE_OTA_DVBT_ATSC: - set_reg_bits(state->tab_init, 0x32, 0x0f, 0x06); - set_reg_bits(state->tab_init, 0x35, 0xff, 0x0e); + case MxL_MODE_ATSC: + set_reg_bits(state->tab_init, 0x06, 0x1f, 0x12); break; - case MxL_MODE_OTA_ISDBT: - set_reg_bits(state->tab_init, 0x32, 0x0f, 0x06); - set_reg_bits(state->tab_init, 0x35, 0xff, 0x12); + case MxL_MODE_DVBT: + set_reg_bits(state->tab_init, 0x06, 0x1f, 0x11); break; - case MxL_MODE_OTA_NTSC_PAL_GH: - set_reg_bits(state->tab_init, 0x16, 0x70, 0x00); - set_reg_bits(state->tab_init, 0x32, 0xff, 0x85); + case MxL_MODE_ISDBT: + set_reg_bits(state->tab_init, 0x06, 0x1f, 0x10); break; - case MxL_MODE_OTA_PAL_IB: - set_reg_bits(state->tab_init, 0x16, 0x70, 0x10); - set_reg_bits(state->tab_init, 0x32, 0xff, 0x85); - break; - case MxL_MODE_OTA_PAL_D_SECAM_KL: - set_reg_bits(state->tab_init, 0x16, 0x70, 0x20); - set_reg_bits(state->tab_init, 0x32, 0xff, 0x85); - break; - case MxL_MODE_CABLE_DIGITAL: - set_reg_bits(state->tab_init_cable, 0x71, 0xff, 0x01); - set_reg_bits(state->tab_init_cable, 0x72, 0xff, - 8 - if_diff_out_level); - set_reg_bits(state->tab_init_cable, 0x74, 0xff, 0x17); - break; - case MxL_MODE_CABLE_NTSC_PAL_GH: - set_reg_bits(state->tab_init, 0x16, 0x70, 0x00); - set_reg_bits(state->tab_init, 0x32, 0xff, 0x85); - set_reg_bits(state->tab_init_cable, 0x71, 0xff, 0x01); - set_reg_bits(state->tab_init_cable, 0x72, 0xff, - 8 - if_diff_out_level); - set_reg_bits(state->tab_init_cable, 0x74, 0xff, 0x17); - break; - case MxL_MODE_CABLE_PAL_IB: - set_reg_bits(state->tab_init, 0x16, 0x70, 0x10); - set_reg_bits(state->tab_init, 0x32, 0xff, 0x85); - set_reg_bits(state->tab_init_cable, 0x71, 0xff, 0x01); - set_reg_bits(state->tab_init_cable, 0x72, 0xff, + case MxL_MODE_CABLE: + set_reg_bits(state->tab_init_cable, 0x09, 0xff, 0xc1); + set_reg_bits(state->tab_init_cable, 0x0a, 0xff, 8 - if_diff_out_level); - set_reg_bits(state->tab_init_cable, 0x74, 0xff, 0x17); - break; - case MxL_MODE_CABLE_PAL_D_SECAM_KL: - set_reg_bits(state->tab_init, 0x16, 0x70, 0x20); - set_reg_bits(state->tab_init, 0x32, 0xff, 0x85); - set_reg_bits(state->tab_init_cable, 0x71, 0xff, 0x01); - set_reg_bits(state->tab_init_cable, 0x72, 0xff, - 8 - if_diff_out_level); - set_reg_bits(state->tab_init_cable, 0x74, 0xff, 0x17); - break; - case MxL_MODE_CABLE_SCTE40: - set_reg_bits(state->tab_init_cable, 0x36, 0xff, 0x08); - set_reg_bits(state->tab_init_cable, 0x68, 0xff, 0xbc); - set_reg_bits(state->tab_init_cable, 0x71, 0xff, 0x01); - set_reg_bits(state->tab_init_cable, 0x72, 0xff, - 8 - if_diff_out_level); - set_reg_bits(state->tab_init_cable, 0x74, 0xff, 0x17); + set_reg_bits(state->tab_init_cable, 0x0b, 0xff, 0x17); break; default: mxl_fail(-EINVAL); @@ -307,43 +253,43 @@ static void mxl5007t_set_if_freq_bits(struct mxl5007t_state *state, val = 0x00; break; case MxL_IF_4_5_MHZ: - val = 0x20; + val = 0x02; break; case MxL_IF_4_57_MHZ: - val = 0x30; + val = 0x03; break; case MxL_IF_5_MHZ: - val = 0x40; + val = 0x04; break; case MxL_IF_5_38_MHZ: - val = 0x50; + val = 0x05; break; case MxL_IF_6_MHZ: - val = 0x60; + val = 0x06; break; case MxL_IF_6_28_MHZ: - val = 0x70; + val = 0x07; break; case MxL_IF_9_1915_MHZ: - val = 0x80; + val = 0x08; break; case MxL_IF_35_25_MHZ: - val = 0x90; + val = 0x09; break; case MxL_IF_36_15_MHZ: - val = 0xa0; + val = 0x0a; break; case MxL_IF_44_MHZ: - val = 0xb0; + val = 0x0b; break; default: mxl_fail(-EINVAL); return; } - set_reg_bits(state->tab_init, 0x0c, 0xf0, val); + set_reg_bits(state->tab_init, 0x02, 0x0f, val); /* set inverted IF or normal IF */ - set_reg_bits(state->tab_init, 0x0c, 0x08, invert_if ? 0x08 : 0x00); + set_reg_bits(state->tab_init, 0x02, 0x10, invert_if ? 0x10 : 0x00); return; } @@ -351,56 +297,68 @@ static void mxl5007t_set_if_freq_bits(struct mxl5007t_state *state, static void mxl5007t_set_xtal_freq_bits(struct mxl5007t_state *state, enum mxl5007t_xtal_freq xtal_freq) { - u8 val; - switch (xtal_freq) { case MxL_XTAL_16_MHZ: - val = 0x00; /* select xtal freq & Ref Freq */ + /* select xtal freq & ref freq */ + set_reg_bits(state->tab_init, 0x03, 0xf0, 0x00); + set_reg_bits(state->tab_init, 0x05, 0x0f, 0x00); break; case MxL_XTAL_20_MHZ: - val = 0x11; + set_reg_bits(state->tab_init, 0x03, 0xf0, 0x10); + set_reg_bits(state->tab_init, 0x05, 0x0f, 0x01); break; case MxL_XTAL_20_25_MHZ: - val = 0x22; + set_reg_bits(state->tab_init, 0x03, 0xf0, 0x20); + set_reg_bits(state->tab_init, 0x05, 0x0f, 0x02); break; case MxL_XTAL_20_48_MHZ: - val = 0x33; + set_reg_bits(state->tab_init, 0x03, 0xf0, 0x30); + set_reg_bits(state->tab_init, 0x05, 0x0f, 0x03); break; case MxL_XTAL_24_MHZ: - val = 0x44; + set_reg_bits(state->tab_init, 0x03, 0xf0, 0x40); + set_reg_bits(state->tab_init, 0x05, 0x0f, 0x04); break; case MxL_XTAL_25_MHZ: - val = 0x55; + set_reg_bits(state->tab_init, 0x03, 0xf0, 0x50); + set_reg_bits(state->tab_init, 0x05, 0x0f, 0x05); break; case MxL_XTAL_25_14_MHZ: - val = 0x66; + set_reg_bits(state->tab_init, 0x03, 0xf0, 0x60); + set_reg_bits(state->tab_init, 0x05, 0x0f, 0x06); break; case MxL_XTAL_27_MHZ: - val = 0x77; + set_reg_bits(state->tab_init, 0x03, 0xf0, 0x70); + set_reg_bits(state->tab_init, 0x05, 0x0f, 0x07); break; case MxL_XTAL_28_8_MHZ: - val = 0x88; + set_reg_bits(state->tab_init, 0x03, 0xf0, 0x80); + set_reg_bits(state->tab_init, 0x05, 0x0f, 0x08); break; case MxL_XTAL_32_MHZ: - val = 0x99; + set_reg_bits(state->tab_init, 0x03, 0xf0, 0x90); + set_reg_bits(state->tab_init, 0x05, 0x0f, 0x09); break; case MxL_XTAL_40_MHZ: - val = 0xaa; + set_reg_bits(state->tab_init, 0x03, 0xf0, 0xa0); + set_reg_bits(state->tab_init, 0x05, 0x0f, 0x0a); break; case MxL_XTAL_44_MHZ: - val = 0xbb; + set_reg_bits(state->tab_init, 0x03, 0xf0, 0xb0); + set_reg_bits(state->tab_init, 0x05, 0x0f, 0x0b); break; case MxL_XTAL_48_MHZ: - val = 0xcc; + set_reg_bits(state->tab_init, 0x03, 0xf0, 0xc0); + set_reg_bits(state->tab_init, 0x05, 0x0f, 0x0c); break; case MxL_XTAL_49_3811_MHZ: - val = 0xdd; + set_reg_bits(state->tab_init, 0x03, 0xf0, 0xd0); + set_reg_bits(state->tab_init, 0x05, 0x0f, 0x0d); break; default: mxl_fail(-EINVAL); return; } - set_reg_bits(state->tab_init, 0x0b, 0xff, val); return; } @@ -417,16 +375,11 @@ static struct reg_pair_t *mxl5007t_calc_init_regs(struct mxl5007t_state *state, mxl5007t_set_if_freq_bits(state, cfg->if_freq_hz, cfg->invert_if); mxl5007t_set_xtal_freq_bits(state, cfg->xtal_freq_hz); - set_reg_bits(state->tab_init, 0x10, 0x40, cfg->loop_thru_enable << 6); - - set_reg_bits(state->tab_init, 0xd8, 0x08, cfg->clk_out_enable << 3); - - set_reg_bits(state->tab_init, 0x10, 0x07, cfg->clk_out_amp); + set_reg_bits(state->tab_init, 0x04, 0x01, cfg->loop_thru_enable); + set_reg_bits(state->tab_init, 0x03, 0x08, cfg->clk_out_enable << 3); + set_reg_bits(state->tab_init, 0x03, 0x07, cfg->clk_out_amp); - /* set IDAC to automatic mode control by AGC */ - set_reg_bits(state->tab_init, 0x12, 0x80, 0x00); - - if (mode >= MxL_MODE_CABLE_DIGITAL) { + if (mode >= MxL_MODE_CABLE) { copy_reg_bits(state->tab_init, state->tab_init_cable); return state->tab_init_cable; } else @@ -452,7 +405,7 @@ static void mxl5007t_set_bw_bits(struct mxl5007t_state *state, * and DIG_MODEINDEX_CSF */ break; case MxL_BW_7MHz: - val = 0x21; + val = 0x2a; break; case MxL_BW_8MHz: val = 0x3f; @@ -461,7 +414,7 @@ static void mxl5007t_set_bw_bits(struct mxl5007t_state *state, mxl_fail(-EINVAL); return; } - set_reg_bits(state->tab_rftune, 0x13, 0x3f, val); + set_reg_bits(state->tab_rftune, 0x0c, 0x3f, val); return; } @@ -498,8 +451,11 @@ reg_pair_t *mxl5007t_calc_rf_tune_regs(struct mxl5007t_state *state, if (temp > 7812) dig_rf_freq++; - set_reg_bits(state->tab_rftune, 0x14, 0xff, (u8)dig_rf_freq); - set_reg_bits(state->tab_rftune, 0x15, 0xff, (u8)(dig_rf_freq >> 8)); + set_reg_bits(state->tab_rftune, 0x0d, 0xff, (u8) dig_rf_freq); + set_reg_bits(state->tab_rftune, 0x0e, 0xff, (u8) (dig_rf_freq >> 8)); + + if (rf_freq >= 333000000) + set_reg_bits(state->tab_rftune, 0x80, 0x40, 0x40); return state->tab_rftune; } @@ -556,9 +512,10 @@ static int mxl5007t_read_reg(struct mxl5007t_state *state, u8 reg, u8 *val) static int mxl5007t_soft_reset(struct mxl5007t_state *state) { u8 d = 0xff; - struct i2c_msg msg = { .addr = state->i2c_props.addr, .flags = 0, - .buf = &d, .len = 1 }; - + struct i2c_msg msg = { + .addr = state->i2c_props.addr, .flags = 0, + .buf = &d, .len = 1 + }; int ret = i2c_transfer(state->i2c_props.adap, &msg, 1); if (ret != 1) { @@ -585,9 +542,6 @@ static int mxl5007t_tuner_init(struct mxl5007t_state *state, if (mxl_fail(ret)) goto fail; mdelay(1); - - ret = mxl5007t_write_reg(state, 0x2c, 0x35); - mxl_fail(ret); fail: return ret; } @@ -620,7 +574,7 @@ static int mxl5007t_synth_lock_status(struct mxl5007t_state *state, *rf_locked = 0; *ref_locked = 0; - ret = mxl5007t_read_reg(state, 0xcf, &d); + ret = mxl5007t_read_reg(state, 0xd8, &d); if (mxl_fail(ret)) goto fail; @@ -633,37 +587,14 @@ fail: return ret; } -static int mxl5007t_check_rf_input_power(struct mxl5007t_state *state, - s32 *rf_input_level) -{ - u8 d1, d2; - int ret; - - ret = mxl5007t_read_reg(state, 0xb7, &d1); - if (mxl_fail(ret)) - goto fail; - - ret = mxl5007t_read_reg(state, 0xbf, &d2); - if (mxl_fail(ret)) - goto fail; - - d2 = d2 >> 4; - if (d2 > 7) - d2 += 0xf0; - - *rf_input_level = (s32)(d1 + d2 - 113); -fail: - return ret; -} - /* ------------------------------------------------------------------------- */ static int mxl5007t_get_status(struct dvb_frontend *fe, u32 *status) { struct mxl5007t_state *state = fe->tuner_priv; - int rf_locked, ref_locked; - s32 rf_input_level = 0; - int ret; + int rf_locked, ref_locked, ret; + + *status = 0; if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 1); @@ -674,10 +605,8 @@ static int mxl5007t_get_status(struct dvb_frontend *fe, u32 *status) mxl_debug("%s%s", rf_locked ? "rf locked " : "", ref_locked ? "ref locked" : ""); - ret = mxl5007t_check_rf_input_power(state, &rf_input_level); - if (mxl_fail(ret)) - goto fail; - mxl_debug("rf input power: %d", rf_input_level); + if ((rf_locked) || (ref_locked)) + *status |= TUNER_STATUS_LOCKED; fail: if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); @@ -700,11 +629,11 @@ static int mxl5007t_set_params(struct dvb_frontend *fe, switch (params->u.vsb.modulation) { case VSB_8: case VSB_16: - mode = MxL_MODE_OTA_DVBT_ATSC; + mode = MxL_MODE_ATSC; break; case QAM_64: case QAM_256: - mode = MxL_MODE_CABLE_DIGITAL; + mode = MxL_MODE_CABLE; break; default: mxl_err("modulation not set!"); @@ -726,7 +655,7 @@ static int mxl5007t_set_params(struct dvb_frontend *fe, mxl_err("bandwidth not set!"); return -EINVAL; } - mode = MxL_MODE_OTA_DVBT_ATSC; + mode = MxL_MODE_DVBT; } else { mxl_err("modulation type not supported!"); return -EINVAL; @@ -757,103 +686,20 @@ fail: return ret; } -static int mxl5007t_set_analog_params(struct dvb_frontend *fe, - struct analog_parameters *params) -{ - struct mxl5007t_state *state = fe->tuner_priv; - enum mxl5007t_bw_mhz bw = 0; /* FIXME */ - enum mxl5007t_mode cbl_mode; - enum mxl5007t_mode ota_mode; - char *mode_name; - int ret; - u32 freq = params->frequency * 62500; - -#if 0 - if (params->mode == V4L2_TUNER_RADIO) { - freq = freq / 1000; - mode_name = "fm"; - } else -#else -#define cable 1 -#endif - if (params->std & V4L2_STD_MN) { - cbl_mode = MxL_MODE_CABLE_NTSC_PAL_GH; - ota_mode = MxL_MODE_OTA_NTSC_PAL_GH; - mode_name = "MN"; - } else if (params->std & V4L2_STD_B) { - cbl_mode = MxL_MODE_CABLE_PAL_IB; - ota_mode = MxL_MODE_OTA_PAL_IB; - mode_name = "B"; - } else if (params->std & V4L2_STD_GH) { - cbl_mode = MxL_MODE_CABLE_NTSC_PAL_GH; - ota_mode = MxL_MODE_OTA_NTSC_PAL_GH; - mode_name = "GH"; - } else if (params->std & V4L2_STD_PAL_I) { - cbl_mode = MxL_MODE_CABLE_PAL_IB; - ota_mode = MxL_MODE_OTA_PAL_IB; - mode_name = "I"; - } else if (params->std & V4L2_STD_DK) { - cbl_mode = MxL_MODE_CABLE_PAL_D_SECAM_KL; - ota_mode = MxL_MODE_OTA_PAL_D_SECAM_KL; - mode_name = "DK"; - } else if (params->std & V4L2_STD_SECAM_L) { - cbl_mode = MxL_MODE_CABLE_PAL_D_SECAM_KL; - ota_mode = MxL_MODE_OTA_PAL_D_SECAM_KL; - mode_name = "L"; - } else if (params->std & V4L2_STD_SECAM_LC) { - cbl_mode = MxL_MODE_CABLE_PAL_D_SECAM_KL; - ota_mode = MxL_MODE_OTA_PAL_D_SECAM_KL; - mode_name = "L'"; - } else { - mode_name = "xx"; - /* FIXME */ - cbl_mode = MxL_MODE_CABLE_NTSC_PAL_GH; - ota_mode = MxL_MODE_OTA_NTSC_PAL_GH; - } - mxl_debug("setting mxl5007 to system %s", mode_name); - - if (fe->ops.i2c_gate_ctrl) - fe->ops.i2c_gate_ctrl(fe, 1); - - mutex_lock(&state->lock); - - ret = mxl5007t_tuner_init(state, cable ? cbl_mode : ota_mode); - if (mxl_fail(ret)) - goto fail; - - ret = mxl5007t_tuner_rf_tune(state, freq, bw); - if (mxl_fail(ret)) - goto fail; - - state->frequency = freq; - state->bandwidth = 0; -fail: - mutex_unlock(&state->lock); - - if (fe->ops.i2c_gate_ctrl) - fe->ops.i2c_gate_ctrl(fe, 0); - - return ret; -} - /* ------------------------------------------------------------------------- */ static int mxl5007t_init(struct dvb_frontend *fe) { struct mxl5007t_state *state = fe->tuner_priv; int ret; - u8 d; if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 1); - ret = mxl5007t_read_reg(state, 0x05, &d); - if (mxl_fail(ret)) - goto fail; - - ret = mxl5007t_write_reg(state, 0x05, d | 0x01); + /* wake from standby */ + ret = mxl5007t_write_reg(state, 0x01, 0x01); mxl_fail(ret); -fail: + if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); @@ -864,18 +710,16 @@ static int mxl5007t_sleep(struct dvb_frontend *fe) { struct mxl5007t_state *state = fe->tuner_priv; int ret; - u8 d; if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 1); - ret = mxl5007t_read_reg(state, 0x05, &d); - if (mxl_fail(ret)) - goto fail; - - ret = mxl5007t_write_reg(state, 0x05, d & ~0x01); + /* enter standby mode */ + ret = mxl5007t_write_reg(state, 0x01, 0x00); mxl_fail(ret); -fail: + ret = mxl5007t_write_reg(state, 0x0f, 0x00); + mxl_fail(ret); + if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); @@ -928,7 +772,6 @@ static struct dvb_tuner_ops mxl5007t_tuner_ops = { .init = mxl5007t_init, .sleep = mxl5007t_sleep, .set_params = mxl5007t_set_params, - .set_analog_params = mxl5007t_set_analog_params, .get_status = mxl5007t_get_status, .get_frequency = mxl5007t_get_frequency, .get_bandwidth = mxl5007t_get_bandwidth, @@ -941,7 +784,7 @@ static int mxl5007t_get_chip_id(struct mxl5007t_state *state) int ret; u8 id; - ret = mxl5007t_read_reg(state, 0xd3, &id); + ret = mxl5007t_read_reg(state, 0xd9, &id); if (mxl_fail(ret)) goto fail; @@ -964,12 +807,16 @@ static int mxl5007t_get_chip_id(struct mxl5007t_state *state) case MxL_5007_V2_200_F2: name = "MxL5007.v2.200.f2"; break; + case MxL_5007_V4: + name = "MxL5007T.v4"; + break; default: #if 0 ret = -EINVAL; goto fail; #else name = "MxL5007T"; + printk(KERN_WARNING "%s: unknown rev (%02x)\n", __func__, id); id = MxL_UNKNOWN_ID; #endif } @@ -997,7 +844,7 @@ struct dvb_frontend *mxl5007t_attach(struct dvb_frontend *fe, mutex_lock(&mxl5007t_list_mutex); instance = hybrid_tuner_request_state(struct mxl5007t_state, state, hybrid_tuner_instance_list, - i2c, addr, "mxl5007"); + i2c, addr, "mxl5007t"); switch (instance) { case 0: goto fail; @@ -1040,7 +887,7 @@ EXPORT_SYMBOL_GPL(mxl5007t_attach); MODULE_DESCRIPTION("MaxLinear MxL5007T Silicon IC tuner driver"); MODULE_AUTHOR("Michael Krufky <mkrufky@linuxtv.org>"); MODULE_LICENSE("GPL"); -MODULE_VERSION("0.1"); +MODULE_VERSION("0.2"); /* * Overrides for Emacs so that we follow Linus's tabbing style. diff --git a/linux/drivers/media/common/tuners/tda18271-fe.c b/linux/drivers/media/common/tuners/tda18271-fe.c index 33bc96ea6..85e30af31 100644 --- a/linux/drivers/media/common/tuners/tda18271-fe.c +++ b/linux/drivers/media/common/tuners/tda18271-fe.c @@ -819,6 +819,38 @@ fail: return ret; } +/* ------------------------------------------------------------------ */ + +static int tda18271_agc(struct dvb_frontend *fe) +{ + struct tda18271_priv *priv = fe->tuner_priv; + int ret = 0; + + switch (priv->config) { + case 0: + /* no LNA */ + tda_dbg("no agc configuration provided\n"); + break; + case 3: + /* switch with GPIO of saa713x */ + tda_dbg("invoking callback\n"); + if (fe->callback) + ret = fe->callback(priv->i2c_props.adap->algo_data, + DVB_FRONTEND_COMPONENT_TUNER, + TDA18271_CALLBACK_CMD_AGC_ENABLE, + priv->mode); + break; + case 1: + case 2: + default: + /* n/a - currently not supported */ + tda_err("unsupported configuration: %d\n", priv->config); + ret = -EINVAL; + break; + } + return ret; +} + static int tda18271_tune(struct dvb_frontend *fe, struct tda18271_std_map_item *map, u32 freq, u32 bw) { @@ -828,6 +860,10 @@ static int tda18271_tune(struct dvb_frontend *fe, tda_dbg("freq = %d, ifc = %d, bw = %d, agc_mode = %d, std = %d\n", freq, map->if_freq, bw, map->agc_mode, map->std); + ret = tda18271_agc(fe); + if (tda_fail(ret)) + tda_warn("failed to configure agc\n"); + ret = tda18271_init(fe); if (tda_fail(ret)) goto fail; @@ -1160,6 +1196,7 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr, /* new tuner instance */ priv->gate = (cfg) ? cfg->gate : TDA18271_GATE_AUTO; priv->role = (cfg) ? cfg->role : TDA18271_MASTER; + priv->config = (cfg) ? cfg->config : 0; priv->cal_initialized = false; mutex_init(&priv->lock); diff --git a/linux/drivers/media/common/tuners/tda18271-priv.h b/linux/drivers/media/common/tuners/tda18271-priv.h index 78417b7c1..f3adbb212 100644 --- a/linux/drivers/media/common/tuners/tda18271-priv.h +++ b/linux/drivers/media/common/tuners/tda18271-priv.h @@ -92,11 +92,6 @@ enum tda18271_pll { TDA18271_CAL_PLL, }; -enum tda18271_mode { - TDA18271_ANALOG, - TDA18271_DIGITAL, -}; - struct tda18271_map_layout; enum tda18271_ver { @@ -115,6 +110,7 @@ struct tda18271_priv { enum tda18271_i2c_gate gate; enum tda18271_ver id; + unsigned int config; /* interface to saa713x / tda829x */ unsigned int tm_rfcal; unsigned int cal_initialized:1; unsigned int small_i2c:1; diff --git a/linux/drivers/media/common/tuners/tda18271.h b/linux/drivers/media/common/tuners/tda18271.h index 7db9831c0..53a9892a1 100644 --- a/linux/drivers/media/common/tuners/tda18271.h +++ b/linux/drivers/media/common/tuners/tda18271.h @@ -79,6 +79,16 @@ struct tda18271_config { /* some i2c providers cant write all 39 registers at once */ unsigned int small_i2c:1; + + /* interface to saa713x / tda829x */ + unsigned int config; +}; + +#define TDA18271_CALLBACK_CMD_AGC_ENABLE 0 + +enum tda18271_mode { + TDA18271_ANALOG = 0, + TDA18271_DIGITAL, }; #if defined(CONFIG_MEDIA_TUNER_TDA18271) || (defined(CONFIG_MEDIA_TUNER_TDA18271_MODULE) && defined(MODULE)) diff --git a/linux/drivers/media/common/tuners/tda827x.c b/linux/drivers/media/common/tuners/tda827x.c index eb989c241..6653ebcdf 100644 --- a/linux/drivers/media/common/tuners/tda827x.c +++ b/linux/drivers/media/common/tuners/tda827x.c @@ -352,7 +352,7 @@ struct tda827xa_data { u8 gc3; }; -static const struct tda827xa_data tda827xa_dvbt[] = { +static 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}, @@ -382,6 +382,36 @@ static const struct tda827xa_data tda827xa_dvbt[] = { { .lomax = 0, .svco = 0, .spd = 0, .scr = 0, .sbs = 0, .gc3 = 0} }; +static struct tda827xa_data tda827xa_dvbc[] = { + { .lomax = 50125000, .svco = 2, .spd = 4, .scr = 2, .sbs = 0, .gc3 = 3}, + { .lomax = 58500000, .svco = 3, .spd = 4, .scr = 2, .sbs = 0, .gc3 = 3}, + { .lomax = 69250000, .svco = 0, .spd = 3, .scr = 2, .sbs = 0, .gc3 = 3}, + { .lomax = 83625000, .svco = 1, .spd = 3, .scr = 2, .sbs = 0, .gc3 = 3}, + { .lomax = 97500000, .svco = 2, .spd = 3, .scr = 2, .sbs = 0, .gc3 = 3}, + { .lomax = 100250000, .svco = 2, .spd = 3, .scr = 2, .sbs = 1, .gc3 = 1}, + { .lomax = 117000000, .svco = 3, .spd = 3, .scr = 2, .sbs = 1, .gc3 = 1}, + { .lomax = 138500000, .svco = 0, .spd = 2, .scr = 2, .sbs = 1, .gc3 = 1}, + { .lomax = 167250000, .svco = 1, .spd = 2, .scr = 2, .sbs = 1, .gc3 = 1}, + { .lomax = 187000000, .svco = 2, .spd = 2, .scr = 2, .sbs = 1, .gc3 = 1}, + { .lomax = 200500000, .svco = 2, .spd = 2, .scr = 2, .sbs = 2, .gc3 = 1}, + { .lomax = 234000000, .svco = 3, .spd = 2, .scr = 2, .sbs = 2, .gc3 = 3}, + { .lomax = 277000000, .svco = 0, .spd = 1, .scr = 2, .sbs = 2, .gc3 = 3}, + { .lomax = 325000000, .svco = 1, .spd = 1, .scr = 2, .sbs = 2, .gc3 = 1}, + { .lomax = 334500000, .svco = 1, .spd = 1, .scr = 2, .sbs = 3, .gc3 = 3}, + { .lomax = 401000000, .svco = 2, .spd = 1, .scr = 2, .sbs = 3, .gc3 = 3}, + { .lomax = 468000000, .svco = 3, .spd = 1, .scr = 2, .sbs = 3, .gc3 = 1}, + { .lomax = 535000000, .svco = 0, .spd = 0, .scr = 1, .sbs = 3, .gc3 = 1}, + { .lomax = 554000000, .svco = 0, .spd = 0, .scr = 2, .sbs = 3, .gc3 = 1}, + { .lomax = 638000000, .svco = 1, .spd = 0, .scr = 1, .sbs = 4, .gc3 = 1}, + { .lomax = 669000000, .svco = 1, .spd = 0, .scr = 2, .sbs = 4, .gc3 = 1}, + { .lomax = 720000000, .svco = 2, .spd = 0, .scr = 1, .sbs = 4, .gc3 = 1}, + { .lomax = 802000000, .svco = 2, .spd = 0, .scr = 2, .sbs = 4, .gc3 = 1}, + { .lomax = 835000000, .svco = 3, .spd = 0, .scr = 1, .sbs = 4, .gc3 = 1}, + { .lomax = 885000000, .svco = 3, .spd = 0, .scr = 1, .sbs = 4, .gc3 = 1}, + { .lomax = 911000000, .svco = 3, .spd = 0, .scr = 2, .sbs = 4, .gc3 = 1}, + { .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}, @@ -485,6 +515,7 @@ static int tda827xa_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) { struct tda827x_priv *priv = fe->tuner_priv; + struct tda827xa_data *frequency_map = tda827xa_dvbt; u8 buf[11]; struct i2c_msg msg = { .addr = priv->i2c_addr, .flags = 0, @@ -511,22 +542,27 @@ static int tda827xa_set_params(struct dvb_frontend *fe, } tuner_freq = params->frequency + if_freq; + if (fe->ops.info.type == FE_QAM) { + dprintk("%s select tda827xa_dvbc\n", __func__); + frequency_map = tda827xa_dvbc; + } + i = 0; - while (tda827xa_dvbt[i].lomax < tuner_freq) { - if(tda827xa_dvbt[i + 1].lomax == 0) + while (frequency_map[i].lomax < tuner_freq) { + if (frequency_map[i + 1].lomax == 0) break; i++; } - N = ((tuner_freq + 31250) / 62500) << tda827xa_dvbt[i].spd; + N = ((tuner_freq + 31250) / 62500) << frequency_map[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[5] = (frequency_map[i].spd << 5) + (frequency_map[i].svco << 3) + + frequency_map[i].sbs; + buf[6] = 0x4b + (frequency_map[i].gc3 << 4); buf[7] = 0x1c; buf[8] = 0x06; buf[9] = 0x24; @@ -585,7 +621,7 @@ static int tda827xa_set_params(struct dvb_frontend *fe, /* correct CP value */ buf[0] = 0x30; - buf[1] = 0x10 + tda827xa_dvbt[i].scr; + buf[1] = 0x10 + frequency_map[i].scr; rc = tuner_transfer(fe, &msg, 1); if (rc < 0) goto err; @@ -600,7 +636,7 @@ static int tda827xa_set_params(struct dvb_frontend *fe, msleep(3); /* freeze AGC1 */ buf[0] = 0x50; - buf[1] = 0x4f + (tda827xa_dvbt[i].gc3 << 4); + buf[1] = 0x4f + (frequency_map[i].gc3 << 4); rc = tuner_transfer(fe, &msg, 1); if (rc < 0) goto err; diff --git a/linux/drivers/media/common/tuners/tda8290.c b/linux/drivers/media/common/tuners/tda8290.c index b1ef5f1e4..02ebc22a9 100644 --- a/linux/drivers/media/common/tuners/tda8290.c +++ b/linux/drivers/media/common/tuners/tda8290.c @@ -647,6 +647,7 @@ static int tda829x_find_tuner(struct dvb_frontend *fe) if ((data == 0x83) || (data == 0x84)) { priv->ver |= TDA18271; + tda829x_tda18271_config.config = priv->cfg.config; dvb_attach(tda18271_attach, fe, priv->tda827x_addr, priv->i2c_props.adap, &tda829x_tda18271_config); } else { diff --git a/linux/drivers/media/common/tuners/xc5000.c b/linux/drivers/media/common/tuners/xc5000.c index 36c81febb..39c415df0 100644 --- a/linux/drivers/media/common/tuners/xc5000.c +++ b/linux/drivers/media/common/tuners/xc5000.c @@ -758,7 +758,10 @@ static int xc5000_set_analog_params(struct dvb_frontend *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. */ + /* Fix me: it could be air. */ + priv->rf_mode = params->mode; + if (params->mode > XC_RF_MODE_CABLE) + priv->rf_mode = XC_RF_MODE_CABLE; /* params->frequency is in units of 62.5khz */ priv->freq_hz = params->frequency * 62500; @@ -989,8 +992,6 @@ struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe, case 1: /* new tuner instance */ priv->bandwidth = BANDWIDTH_6_MHZ; - priv->if_khz = cfg->if_khz; - fe->tuner_priv = priv; break; default: @@ -999,6 +1000,13 @@ struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe, break; } + if (priv->if_khz == 0) { + /* If the IF hasn't been set yet, use the value provided by + the caller (occurs in hybrid devices where the analog + call to xc5000_attach occurs before the digital side) */ + priv->if_khz = cfg->if_khz; + } + /* Check if firmware has been loaded. It is possible that another instance of the driver has loaded the firmware. */ |