aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/common
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/common')
-rw-r--r--drivers/media/common/tuners/tda9887.c9
-rw-r--r--drivers/media/common/tuners/tea5761.c33
-rw-r--r--drivers/media/common/tuners/tuner-types.c21
-rw-r--r--drivers/media/common/tuners/tuner-xc2028.c16
-rw-r--r--drivers/media/common/tuners/xc5000.c56
-rw-r--r--drivers/media/common/tuners/xc5000.h1
6 files changed, 118 insertions, 18 deletions
diff --git a/drivers/media/common/tuners/tda9887.c b/drivers/media/common/tuners/tda9887.c
index bf14bd79e2fc..cdb645d57438 100644
--- a/drivers/media/common/tuners/tda9887.c
+++ b/drivers/media/common/tuners/tda9887.c
@@ -36,6 +36,8 @@ struct tda9887_priv {
36 unsigned int mode; 36 unsigned int mode;
37 unsigned int audmode; 37 unsigned int audmode;
38 v4l2_std_id std; 38 v4l2_std_id std;
39
40 bool standby;
39}; 41};
40 42
41/* ---------------------------------------------------------------------- */ 43/* ---------------------------------------------------------------------- */
@@ -568,7 +570,7 @@ static void tda9887_configure(struct dvb_frontend *fe)
568 tda9887_do_config(fe); 570 tda9887_do_config(fe);
569 tda9887_set_insmod(fe); 571 tda9887_set_insmod(fe);
570 572
571 if (priv->mode == T_STANDBY) 573 if (priv->standby)
572 priv->data[1] |= cForcedMuteAudioON; 574 priv->data[1] |= cForcedMuteAudioON;
573 575
574 tuner_dbg("writing: b=0x%02x c=0x%02x e=0x%02x\n", 576 tuner_dbg("writing: b=0x%02x c=0x%02x e=0x%02x\n",
@@ -616,7 +618,7 @@ static void tda9887_standby(struct dvb_frontend *fe)
616{ 618{
617 struct tda9887_priv *priv = fe->analog_demod_priv; 619 struct tda9887_priv *priv = fe->analog_demod_priv;
618 620
619 priv->mode = T_STANDBY; 621 priv->standby = true;
620 622
621 tda9887_configure(fe); 623 tda9887_configure(fe);
622} 624}
@@ -626,6 +628,7 @@ static void tda9887_set_params(struct dvb_frontend *fe,
626{ 628{
627 struct tda9887_priv *priv = fe->analog_demod_priv; 629 struct tda9887_priv *priv = fe->analog_demod_priv;
628 630
631 priv->standby = false;
629 priv->mode = params->mode; 632 priv->mode = params->mode;
630 priv->audmode = params->audmode; 633 priv->audmode = params->audmode;
631 priv->std = params->std; 634 priv->std = params->std;
@@ -686,7 +689,7 @@ struct dvb_frontend *tda9887_attach(struct dvb_frontend *fe,
686 return NULL; 689 return NULL;
687 case 1: 690 case 1:
688 fe->analog_demod_priv = priv; 691 fe->analog_demod_priv = priv;
689 priv->mode = T_STANDBY; 692 priv->standby = true;
690 tuner_info("tda988[5/6/7] found\n"); 693 tuner_info("tda988[5/6/7] found\n");
691 break; 694 break;
692 default: 695 default:
diff --git a/drivers/media/common/tuners/tea5761.c b/drivers/media/common/tuners/tea5761.c
index 925399dffbed..bf78cb9fc52c 100644
--- a/drivers/media/common/tuners/tea5761.c
+++ b/drivers/media/common/tuners/tea5761.c
@@ -23,6 +23,7 @@ struct tea5761_priv {
23 struct tuner_i2c_props i2c_props; 23 struct tuner_i2c_props i2c_props;
24 24
25 u32 frequency; 25 u32 frequency;
26 bool standby;
26}; 27};
27 28
28/*****************************************************************************/ 29/*****************************************************************************/
@@ -135,18 +136,19 @@ static void tea5761_status_dump(unsigned char *buffer)
135} 136}
136 137
137/* Freq should be specifyed at 62.5 Hz */ 138/* Freq should be specifyed at 62.5 Hz */
138static int set_radio_freq(struct dvb_frontend *fe, 139static int __set_radio_freq(struct dvb_frontend *fe,
139 struct analog_parameters *params) 140 unsigned int freq,
141 bool mono)
140{ 142{
141 struct tea5761_priv *priv = fe->tuner_priv; 143 struct tea5761_priv *priv = fe->tuner_priv;
142 unsigned int frq = params->frequency; 144 unsigned int frq = freq;
143 unsigned char buffer[7] = {0, 0, 0, 0, 0, 0, 0 }; 145 unsigned char buffer[7] = {0, 0, 0, 0, 0, 0, 0 };
144 unsigned div; 146 unsigned div;
145 int rc; 147 int rc;
146 148
147 tuner_dbg("radio freq counter %d\n", frq); 149 tuner_dbg("radio freq counter %d\n", frq);
148 150
149 if (params->mode == T_STANDBY) { 151 if (priv->standby) {
150 tuner_dbg("TEA5761 set to standby mode\n"); 152 tuner_dbg("TEA5761 set to standby mode\n");
151 buffer[5] |= TEA5761_TNCTRL_MU; 153 buffer[5] |= TEA5761_TNCTRL_MU;
152 } else { 154 } else {
@@ -154,7 +156,7 @@ static int set_radio_freq(struct dvb_frontend *fe,
154 } 156 }
155 157
156 158
157 if (params->audmode == V4L2_TUNER_MODE_MONO) { 159 if (mono) {
158 tuner_dbg("TEA5761 set to mono\n"); 160 tuner_dbg("TEA5761 set to mono\n");
159 buffer[5] |= TEA5761_TNCTRL_MST; 161 buffer[5] |= TEA5761_TNCTRL_MST;
160 } else { 162 } else {
@@ -176,6 +178,26 @@ static int set_radio_freq(struct dvb_frontend *fe,
176 return 0; 178 return 0;
177} 179}
178 180
181static int set_radio_freq(struct dvb_frontend *fe,
182 struct analog_parameters *params)
183{
184 struct tea5761_priv *priv = fe->analog_demod_priv;
185
186 priv->standby = false;
187
188 return __set_radio_freq(fe, params->frequency,
189 params->audmode == V4L2_TUNER_MODE_MONO);
190}
191
192static int set_radio_sleep(struct dvb_frontend *fe)
193{
194 struct tea5761_priv *priv = fe->analog_demod_priv;
195
196 priv->standby = true;
197
198 return __set_radio_freq(fe, priv->frequency, false);
199}
200
179static int tea5761_read_status(struct dvb_frontend *fe, char *buffer) 201static int tea5761_read_status(struct dvb_frontend *fe, char *buffer)
180{ 202{
181 struct tea5761_priv *priv = fe->tuner_priv; 203 struct tea5761_priv *priv = fe->tuner_priv;
@@ -284,6 +306,7 @@ static struct dvb_tuner_ops tea5761_tuner_ops = {
284 .name = "tea5761", // Philips TEA5761HN FM Radio 306 .name = "tea5761", // Philips TEA5761HN FM Radio
285 }, 307 },
286 .set_analog_params = set_radio_freq, 308 .set_analog_params = set_radio_freq,
309 .sleep = set_radio_sleep,
287 .release = tea5761_release, 310 .release = tea5761_release,
288 .get_frequency = tea5761_get_frequency, 311 .get_frequency = tea5761_get_frequency,
289 .get_status = tea5761_get_status, 312 .get_status = tea5761_get_status,
diff --git a/drivers/media/common/tuners/tuner-types.c b/drivers/media/common/tuners/tuner-types.c
index 58a513bcd747..afba6dc5e080 100644
--- a/drivers/media/common/tuners/tuner-types.c
+++ b/drivers/media/common/tuners/tuner-types.c
@@ -971,6 +971,22 @@ static struct tuner_params tuner_tena_9533_di_params[] = {
971 }, 971 },
972}; 972};
973 973
974/* ------------ TUNER_TENA_TNF_5337 - Tena tnf5337MFD STD M/N ------------ */
975
976static struct tuner_range tuner_tena_tnf_5337_ntsc_ranges[] = {
977 { 16 * 166.25 /*MHz*/, 0x86, 0x01, },
978 { 16 * 466.25 /*MHz*/, 0x86, 0x02, },
979 { 16 * 999.99 , 0x86, 0x08, },
980};
981
982static struct tuner_params tuner_tena_tnf_5337_params[] = {
983 {
984 .type = TUNER_PARAM_TYPE_NTSC,
985 .ranges = tuner_tena_tnf_5337_ntsc_ranges,
986 .count = ARRAY_SIZE(tuner_tena_tnf_5337_ntsc_ranges),
987 },
988};
989
974/* ------------ TUNER_PHILIPS_FMD1216ME(X)_MK3 - Philips PAL ------------ */ 990/* ------------ TUNER_PHILIPS_FMD1216ME(X)_MK3 - Philips PAL ------------ */
975 991
976static struct tuner_range tuner_philips_fmd1216me_mk3_pal_ranges[] = { 992static struct tuner_range tuner_philips_fmd1216me_mk3_pal_ranges[] = {
@@ -1842,6 +1858,11 @@ struct tunertype tuners[] = {
1842 .params = tuner_philips_fq1236_mk5_params, 1858 .params = tuner_philips_fq1236_mk5_params,
1843 .count = ARRAY_SIZE(tuner_philips_fq1236_mk5_params), 1859 .count = ARRAY_SIZE(tuner_philips_fq1236_mk5_params),
1844 }, 1860 },
1861 [TUNER_TENA_TNF_5337] = { /* Tena 5337 MFD */
1862 .name = "Tena TNF5337 MFD",
1863 .params = tuner_tena_tnf_5337_params,
1864 .count = ARRAY_SIZE(tuner_tena_tnf_5337_params),
1865 },
1845}; 1866};
1846EXPORT_SYMBOL(tuners); 1867EXPORT_SYMBOL(tuners);
1847 1868
diff --git a/drivers/media/common/tuners/tuner-xc2028.c b/drivers/media/common/tuners/tuner-xc2028.c
index b6ce528e1889..16fba6b59616 100644
--- a/drivers/media/common/tuners/tuner-xc2028.c
+++ b/drivers/media/common/tuners/tuner-xc2028.c
@@ -685,7 +685,7 @@ static int check_firmware(struct dvb_frontend *fe, unsigned int type,
685{ 685{
686 struct xc2028_data *priv = fe->tuner_priv; 686 struct xc2028_data *priv = fe->tuner_priv;
687 struct firmware_properties new_fw; 687 struct firmware_properties new_fw;
688 int rc = 0, is_retry = 0; 688 int rc = 0, retry_count = 0;
689 u16 version, hwmodel; 689 u16 version, hwmodel;
690 v4l2_std_id std0; 690 v4l2_std_id std0;
691 691
@@ -855,9 +855,9 @@ read_not_reliable:
855 855
856fail: 856fail:
857 memset(&priv->cur_fw, 0, sizeof(priv->cur_fw)); 857 memset(&priv->cur_fw, 0, sizeof(priv->cur_fw));
858 if (!is_retry) { 858 if (retry_count < 8) {
859 msleep(50); 859 msleep(50);
860 is_retry = 1; 860 retry_count++;
861 tuner_dbg("Retrying firmware load\n"); 861 tuner_dbg("Retrying firmware load\n");
862 goto retry; 862 goto retry;
863 } 863 }
@@ -907,7 +907,7 @@ ret:
907#define DIV 15625 907#define DIV 15625
908 908
909static int generic_set_freq(struct dvb_frontend *fe, u32 freq /* in HZ */, 909static int generic_set_freq(struct dvb_frontend *fe, u32 freq /* in HZ */,
910 enum tuner_mode new_mode, 910 enum v4l2_tuner_type new_type,
911 unsigned int type, 911 unsigned int type,
912 v4l2_std_id std, 912 v4l2_std_id std,
913 u16 int_freq) 913 u16 int_freq)
@@ -933,7 +933,7 @@ static int generic_set_freq(struct dvb_frontend *fe, u32 freq /* in HZ */,
933 * that xc2028 will be in a safe state. 933 * that xc2028 will be in a safe state.
934 * Maybe this might also be needed for DTV. 934 * Maybe this might also be needed for DTV.
935 */ 935 */
936 if (new_mode == T_ANALOG_TV) { 936 if (new_type == V4L2_TUNER_ANALOG_TV) {
937 rc = send_seq(priv, {0x00, 0x00}); 937 rc = send_seq(priv, {0x00, 0x00});
938 938
939 /* Analog modes require offset = 0 */ 939 /* Analog modes require offset = 0 */
@@ -1054,7 +1054,7 @@ static int xc2028_set_analog_freq(struct dvb_frontend *fe,
1054 if (priv->ctrl.input1) 1054 if (priv->ctrl.input1)
1055 type |= INPUT1; 1055 type |= INPUT1;
1056 return generic_set_freq(fe, (625l * p->frequency) / 10, 1056 return generic_set_freq(fe, (625l * p->frequency) / 10,
1057 T_RADIO, type, 0, 0); 1057 V4L2_TUNER_RADIO, type, 0, 0);
1058 } 1058 }
1059 1059
1060 /* if std is not defined, choose one */ 1060 /* if std is not defined, choose one */
@@ -1069,7 +1069,7 @@ static int xc2028_set_analog_freq(struct dvb_frontend *fe,
1069 p->std |= parse_audio_std_option(); 1069 p->std |= parse_audio_std_option();
1070 1070
1071 return generic_set_freq(fe, 62500l * p->frequency, 1071 return generic_set_freq(fe, 62500l * p->frequency,
1072 T_ANALOG_TV, type, p->std, 0); 1072 V4L2_TUNER_ANALOG_TV, type, p->std, 0);
1073} 1073}
1074 1074
1075static int xc2028_set_params(struct dvb_frontend *fe, 1075static int xc2028_set_params(struct dvb_frontend *fe,
@@ -1174,7 +1174,7 @@ static int xc2028_set_params(struct dvb_frontend *fe,
1174 } 1174 }
1175 1175
1176 return generic_set_freq(fe, p->frequency, 1176 return generic_set_freq(fe, p->frequency,
1177 T_DIGITAL_TV, type, 0, demod); 1177 V4L2_TUNER_DIGITAL_TV, type, 0, demod);
1178} 1178}
1179 1179
1180static int xc2028_sleep(struct dvb_frontend *fe) 1180static int xc2028_sleep(struct dvb_frontend *fe)
diff --git a/drivers/media/common/tuners/xc5000.c b/drivers/media/common/tuners/xc5000.c
index 76ac5cd84af7..1e28f7dcb26b 100644
--- a/drivers/media/common/tuners/xc5000.c
+++ b/drivers/media/common/tuners/xc5000.c
@@ -65,7 +65,7 @@ struct xc5000_priv {
65}; 65};
66 66
67/* Misc Defines */ 67/* Misc Defines */
68#define MAX_TV_STANDARD 23 68#define MAX_TV_STANDARD 24
69#define XC_MAX_I2C_WRITE_LENGTH 64 69#define XC_MAX_I2C_WRITE_LENGTH 64
70 70
71/* Signal Types */ 71/* Signal Types */
@@ -92,6 +92,8 @@ struct xc5000_priv {
92#define XREG_IF_OUT 0x05 92#define XREG_IF_OUT 0x05
93#define XREG_SEEK_MODE 0x07 93#define XREG_SEEK_MODE 0x07
94#define XREG_POWER_DOWN 0x0A /* Obsolete */ 94#define XREG_POWER_DOWN 0x0A /* Obsolete */
95/* Set the output amplitude - SIF for analog, DTVP/DTVN for digital */
96#define XREG_OUTPUT_AMP 0x0B
95#define XREG_SIGNALSOURCE 0x0D /* 0=Air, 1=Cable */ 97#define XREG_SIGNALSOURCE 0x0D /* 0=Air, 1=Cable */
96#define XREG_SMOOTHEDCVBS 0x0E 98#define XREG_SMOOTHEDCVBS 0x0E
97#define XREG_XTALFREQ 0x0F 99#define XREG_XTALFREQ 0x0F
@@ -173,6 +175,7 @@ struct XC_TV_STANDARD {
173#define DTV7 20 175#define DTV7 20
174#define FM_Radio_INPUT2 21 176#define FM_Radio_INPUT2 21
175#define FM_Radio_INPUT1 22 177#define FM_Radio_INPUT1 22
178#define FM_Radio_INPUT1_MONO 23
176 179
177static struct XC_TV_STANDARD XC5000_Standard[MAX_TV_STANDARD] = { 180static struct XC_TV_STANDARD XC5000_Standard[MAX_TV_STANDARD] = {
178 {"M/N-NTSC/PAL-BTSC", 0x0400, 0x8020}, 181 {"M/N-NTSC/PAL-BTSC", 0x0400, 0x8020},
@@ -197,7 +200,8 @@ static struct XC_TV_STANDARD XC5000_Standard[MAX_TV_STANDARD] = {
197 {"DTV7/8", 0x00C0, 0x801B}, 200 {"DTV7/8", 0x00C0, 0x801B},
198 {"DTV7", 0x00C0, 0x8007}, 201 {"DTV7", 0x00C0, 0x8007},
199 {"FM Radio-INPUT2", 0x9802, 0x9002}, 202 {"FM Radio-INPUT2", 0x9802, 0x9002},
200 {"FM Radio-INPUT1", 0x0208, 0x9002} 203 {"FM Radio-INPUT1", 0x0208, 0x9002},
204 {"FM Radio-INPUT1_MONO", 0x0278, 0x9002}
201}; 205};
202 206
203static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe); 207static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe);
@@ -683,6 +687,24 @@ static int xc5000_set_params(struct dvb_frontend *fe,
683 return -EINVAL; 687 return -EINVAL;
684 } 688 }
685 priv->rf_mode = XC_RF_MODE_AIR; 689 priv->rf_mode = XC_RF_MODE_AIR;
690 } else if (fe->ops.info.type == FE_QAM) {
691 dprintk(1, "%s() QAM\n", __func__);
692 switch (params->u.qam.modulation) {
693 case QAM_16:
694 case QAM_32:
695 case QAM_64:
696 case QAM_128:
697 case QAM_256:
698 case QAM_AUTO:
699 dprintk(1, "%s() QAM modulation\n", __func__);
700 priv->bandwidth = BANDWIDTH_8_MHZ;
701 priv->video_standard = DTV7_8;
702 priv->freq_hz = params->frequency - 2750000;
703 priv->rf_mode = XC_RF_MODE_CABLE;
704 break;
705 default:
706 return -EINVAL;
707 }
686 } else { 708 } else {
687 printk(KERN_ERR "xc5000 modulation type not supported!\n"); 709 printk(KERN_ERR "xc5000 modulation type not supported!\n");
688 return -EINVAL; 710 return -EINVAL;
@@ -714,6 +736,8 @@ static int xc5000_set_params(struct dvb_frontend *fe,
714 return -EIO; 736 return -EIO;
715 } 737 }
716 738
739 xc_write_reg(priv, XREG_OUTPUT_AMP, 0x8a);
740
717 xc_tune_channel(priv, priv->freq_hz, XC_TUNE_DIGITAL); 741 xc_tune_channel(priv, priv->freq_hz, XC_TUNE_DIGITAL);
718 742
719 if (debug) 743 if (debug)
@@ -818,6 +842,8 @@ tune_channel:
818 return -EREMOTEIO; 842 return -EREMOTEIO;
819 } 843 }
820 844
845 xc_write_reg(priv, XREG_OUTPUT_AMP, 0x09);
846
821 xc_tune_channel(priv, priv->freq_hz, XC_TUNE_ANALOG); 847 xc_tune_channel(priv, priv->freq_hz, XC_TUNE_ANALOG);
822 848
823 if (debug) 849 if (debug)
@@ -845,6 +871,8 @@ static int xc5000_set_radio_freq(struct dvb_frontend *fe,
845 radio_input = FM_Radio_INPUT1; 871 radio_input = FM_Radio_INPUT1;
846 else if (priv->radio_input == XC5000_RADIO_FM2) 872 else if (priv->radio_input == XC5000_RADIO_FM2)
847 radio_input = FM_Radio_INPUT2; 873 radio_input = FM_Radio_INPUT2;
874 else if (priv->radio_input == XC5000_RADIO_FM1_MONO)
875 radio_input = FM_Radio_INPUT1_MONO;
848 else { 876 else {
849 dprintk(1, "%s() unknown radio input %d\n", __func__, 877 dprintk(1, "%s() unknown radio input %d\n", __func__,
850 priv->radio_input); 878 priv->radio_input);
@@ -871,6 +899,12 @@ static int xc5000_set_radio_freq(struct dvb_frontend *fe,
871 return -EREMOTEIO; 899 return -EREMOTEIO;
872 } 900 }
873 901
902 if ((priv->radio_input == XC5000_RADIO_FM1) ||
903 (priv->radio_input == XC5000_RADIO_FM2))
904 xc_write_reg(priv, XREG_OUTPUT_AMP, 0x09);
905 else if (priv->radio_input == XC5000_RADIO_FM1_MONO)
906 xc_write_reg(priv, XREG_OUTPUT_AMP, 0x06);
907
874 xc_tune_channel(priv, priv->freq_hz, XC_TUNE_ANALOG); 908 xc_tune_channel(priv, priv->freq_hz, XC_TUNE_ANALOG);
875 909
876 return 0; 910 return 0;
@@ -1021,6 +1055,23 @@ static int xc5000_release(struct dvb_frontend *fe)
1021 return 0; 1055 return 0;
1022} 1056}
1023 1057
1058static int xc5000_set_config(struct dvb_frontend *fe, void *priv_cfg)
1059{
1060 struct xc5000_priv *priv = fe->tuner_priv;
1061 struct xc5000_config *p = priv_cfg;
1062
1063 dprintk(1, "%s()\n", __func__);
1064
1065 if (p->if_khz)
1066 priv->if_khz = p->if_khz;
1067
1068 if (p->radio_input)
1069 priv->radio_input = p->radio_input;
1070
1071 return 0;
1072}
1073
1074
1024static const struct dvb_tuner_ops xc5000_tuner_ops = { 1075static const struct dvb_tuner_ops xc5000_tuner_ops = {
1025 .info = { 1076 .info = {
1026 .name = "Xceive XC5000", 1077 .name = "Xceive XC5000",
@@ -1033,6 +1084,7 @@ static const struct dvb_tuner_ops xc5000_tuner_ops = {
1033 .init = xc5000_init, 1084 .init = xc5000_init,
1034 .sleep = xc5000_sleep, 1085 .sleep = xc5000_sleep,
1035 1086
1087 .set_config = xc5000_set_config,
1036 .set_params = xc5000_set_params, 1088 .set_params = xc5000_set_params,
1037 .set_analog_params = xc5000_set_analog_params, 1089 .set_analog_params = xc5000_set_analog_params,
1038 .get_frequency = xc5000_get_frequency, 1090 .get_frequency = xc5000_get_frequency,
diff --git a/drivers/media/common/tuners/xc5000.h b/drivers/media/common/tuners/xc5000.h
index 3756e73649be..e2957451b532 100644
--- a/drivers/media/common/tuners/xc5000.h
+++ b/drivers/media/common/tuners/xc5000.h
@@ -40,6 +40,7 @@ struct xc5000_config {
40#define XC5000_RADIO_NOT_CONFIGURED 0 40#define XC5000_RADIO_NOT_CONFIGURED 0
41#define XC5000_RADIO_FM1 1 41#define XC5000_RADIO_FM1 1
42#define XC5000_RADIO_FM2 2 42#define XC5000_RADIO_FM2 2
43#define XC5000_RADIO_FM1_MONO 3
43 44
44/* For each bridge framework, when it attaches either analog or digital, 45/* For each bridge framework, when it attaches either analog or digital,
45 * it has to store a reference back to its _core equivalent structure, 46 * it has to store a reference back to its _core equivalent structure,