aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/common/tuners
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-12-31 02:19:48 -0500
committerIngo Molnar <mingo@elte.hu>2008-12-31 02:19:48 -0500
commit818fa7f3908c7bd6c0045e9d94dc23a899ef6144 (patch)
treead3435c3f57c8222ad61709b716168932f13be6c /drivers/media/common/tuners
parent3fd4bc015ef879a7d2b955ce97fb125e3a51ba7e (diff)
parent5fdf7e5975a0b0f6a0370655612c5dca3fd6311b (diff)
Merge branch 'tracing/kmemtrace' into tracing/kmemtrace2
Diffstat (limited to 'drivers/media/common/tuners')
-rw-r--r--drivers/media/common/tuners/mxl5005s.c6
-rw-r--r--drivers/media/common/tuners/tda827x.c15
-rw-r--r--drivers/media/common/tuners/tda8290.c63
-rw-r--r--drivers/media/common/tuners/tda9887.c5
-rw-r--r--drivers/media/common/tuners/tuner-xc2028.c35
-rw-r--r--drivers/media/common/tuners/xc5000.c7
6 files changed, 101 insertions, 30 deletions
diff --git a/drivers/media/common/tuners/mxl5005s.c b/drivers/media/common/tuners/mxl5005s.c
index a8878244bb3c..31522d2e318e 100644
--- a/drivers/media/common/tuners/mxl5005s.c
+++ b/drivers/media/common/tuners/mxl5005s.c
@@ -3598,7 +3598,7 @@ static u16 MXL_GetInitRegister(struct dvb_frontend *fe, u8 *RegNum,
3598 76, 77, 91, 134, 135, 137, 147, 3598 76, 77, 91, 134, 135, 137, 147,
3599 156, 166, 167, 168, 25 }; 3599 156, 166, 167, 168, 25 };
3600 3600
3601 *count = sizeof(RegAddr) / sizeof(u8); 3601 *count = ARRAY_SIZE(RegAddr);
3602 3602
3603 status += MXL_BlockInit(fe); 3603 status += MXL_BlockInit(fe);
3604 3604
@@ -3630,7 +3630,7 @@ static u16 MXL_GetCHRegister(struct dvb_frontend *fe, u8 *RegNum, u8 *RegVal,
3630 */ 3630 */
3631#endif 3631#endif
3632 3632
3633 *count = sizeof(RegAddr) / sizeof(u8); 3633 *count = ARRAY_SIZE(RegAddr);
3634 3634
3635 for (i = 0 ; i < *count; i++) { 3635 for (i = 0 ; i < *count; i++) {
3636 RegNum[i] = RegAddr[i]; 3636 RegNum[i] = RegAddr[i];
@@ -3648,7 +3648,7 @@ static u16 MXL_GetCHRegister_ZeroIF(struct dvb_frontend *fe, u8 *RegNum,
3648 3648
3649 u8 RegAddr[] = {43, 136}; 3649 u8 RegAddr[] = {43, 136};
3650 3650
3651 *count = sizeof(RegAddr) / sizeof(u8); 3651 *count = ARRAY_SIZE(RegAddr);
3652 3652
3653 for (i = 0; i < *count; i++) { 3653 for (i = 0; i < *count; i++) {
3654 RegNum[i] = RegAddr[i]; 3654 RegNum[i] = RegAddr[i];
diff --git a/drivers/media/common/tuners/tda827x.c b/drivers/media/common/tuners/tda827x.c
index 4a74f65e759a..f4d931f14fad 100644
--- a/drivers/media/common/tuners/tda827x.c
+++ b/drivers/media/common/tuners/tda827x.c
@@ -80,10 +80,11 @@ static void tda827x_set_std(struct dvb_frontend *fe,
80 mode = "xx"; 80 mode = "xx";
81 } 81 }
82 82
83 if (params->mode == V4L2_TUNER_RADIO) 83 if (params->mode == V4L2_TUNER_RADIO) {
84 priv->sgIF = 88; /* if frequency is 5.5 MHz */ 84 priv->sgIF = 88; /* if frequency is 5.5 MHz */
85 85 dprintk("setting tda827x to radio FM\n");
86 dprintk("setting tda827x to system %s\n", mode); 86 } else
87 dprintk("setting tda827x to system %s\n", mode);
87} 88}
88 89
89 90
@@ -199,7 +200,7 @@ static int tda827xo_set_params(struct dvb_frontend *fe,
199 fe->ops.i2c_gate_ctrl(fe, 1); 200 fe->ops.i2c_gate_ctrl(fe, 1);
200 i2c_transfer(priv->i2c_adap, &msg, 1); 201 i2c_transfer(priv->i2c_adap, &msg, 1);
201 202
202 priv->frequency = tuner_freq - if_freq; // FIXME 203 priv->frequency = params->frequency;
203 priv->bandwidth = (fe->ops.info.type == FE_OFDM) ? params->u.ofdm.bandwidth : 0; 204 priv->bandwidth = (fe->ops.info.type == FE_OFDM) ? params->u.ofdm.bandwidth : 0;
204 205
205 return 0; 206 return 0;
@@ -304,7 +305,7 @@ static int tda827xo_set_analog_params(struct dvb_frontend *fe,
304 reg2[1] = 0x08; /* Vsync en */ 305 reg2[1] = 0x08; /* Vsync en */
305 i2c_transfer(priv->i2c_adap, &msg, 1); 306 i2c_transfer(priv->i2c_adap, &msg, 1);
306 307
307 priv->frequency = freq * 62500; 308 priv->frequency = params->frequency;
308 309
309 return 0; 310 return 0;
310} 311}
@@ -591,7 +592,7 @@ static int tda827xa_set_params(struct dvb_frontend *fe,
591 fe->ops.i2c_gate_ctrl(fe, 1); 592 fe->ops.i2c_gate_ctrl(fe, 1);
592 i2c_transfer(priv->i2c_adap, &msg, 1); 593 i2c_transfer(priv->i2c_adap, &msg, 1);
593 594
594 priv->frequency = tuner_freq - if_freq; // FIXME 595 priv->frequency = params->frequency;
595 priv->bandwidth = (fe->ops.info.type == FE_OFDM) ? params->u.ofdm.bandwidth : 0; 596 priv->bandwidth = (fe->ops.info.type == FE_OFDM) ? params->u.ofdm.bandwidth : 0;
596 597
597 return 0; 598 return 0;
@@ -691,7 +692,7 @@ static int tda827xa_set_analog_params(struct dvb_frontend *fe,
691 tuner_reg[1] = 0x19 + (priv->lpsel << 1); 692 tuner_reg[1] = 0x19 + (priv->lpsel << 1);
692 i2c_transfer(priv->i2c_adap, &msg, 1); 693 i2c_transfer(priv->i2c_adap, &msg, 1);
693 694
694 priv->frequency = freq * 62500; 695 priv->frequency = params->frequency;
695 696
696 return 0; 697 return 0;
697} 698}
diff --git a/drivers/media/common/tuners/tda8290.c b/drivers/media/common/tuners/tda8290.c
index c112bdd4e0f0..0ee79fd7c7a9 100644
--- a/drivers/media/common/tuners/tda8290.c
+++ b/drivers/media/common/tuners/tda8290.c
@@ -32,6 +32,9 @@ static int debug;
32module_param(debug, int, 0644); 32module_param(debug, int, 0644);
33MODULE_PARM_DESC(debug, "enable verbose debug messages"); 33MODULE_PARM_DESC(debug, "enable verbose debug messages");
34 34
35static int deemphasis_50;
36MODULE_PARM_DESC(deemphasis_50, "0 - 75us deemphasis; 1 - 50us deemphasis");
37
35/* ---------------------------------------------------------------------- */ 38/* ---------------------------------------------------------------------- */
36 39
37struct tda8290_priv { 40struct tda8290_priv {
@@ -139,9 +142,34 @@ static void set_audio(struct dvb_frontend *fe,
139 mode = "xx"; 142 mode = "xx";
140 } 143 }
141 144
142 tuner_dbg("setting tda829x to system %s\n", mode); 145 if (params->mode == V4L2_TUNER_RADIO) {
146 priv->tda8290_easy_mode = 0x01; /* Start with MN values */
147 tuner_dbg("setting to radio FM\n");
148 } else {
149 tuner_dbg("setting tda829x to system %s\n", mode);
150 }
143} 151}
144 152
153struct {
154 unsigned char seq[2];
155} fm_mode[] = {
156 { { 0x01, 0x81} }, /* Put device into expert mode */
157 { { 0x03, 0x48} }, /* Disable NOTCH and VIDEO filters */
158 { { 0x04, 0x04} }, /* Disable color carrier filter (SSIF) */
159 { { 0x05, 0x04} }, /* ADC headroom */
160 { { 0x06, 0x10} }, /* group delay flat */
161
162 { { 0x07, 0x00} }, /* use the same radio DTO values as a tda8295 */
163 { { 0x08, 0x00} },
164 { { 0x09, 0x80} },
165 { { 0x0a, 0xda} },
166 { { 0x0b, 0x4b} },
167 { { 0x0c, 0x68} },
168
169 { { 0x0d, 0x00} }, /* PLL off, no video carrier detect */
170 { { 0x14, 0x00} }, /* disable auto mute if no video */
171};
172
145static void tda8290_set_params(struct dvb_frontend *fe, 173static void tda8290_set_params(struct dvb_frontend *fe,
146 struct analog_parameters *params) 174 struct analog_parameters *params)
147{ 175{
@@ -178,15 +206,30 @@ static void tda8290_set_params(struct dvb_frontend *fe,
178 tuner_i2c_xfer_send(&priv->i2c_props, soft_reset, 2); 206 tuner_i2c_xfer_send(&priv->i2c_props, soft_reset, 2);
179 msleep(1); 207 msleep(1);
180 208
181 expert_mode[1] = priv->tda8290_easy_mode + 0x80; 209 if (params->mode == V4L2_TUNER_RADIO) {
182 tuner_i2c_xfer_send(&priv->i2c_props, expert_mode, 2); 210 int i;
183 tuner_i2c_xfer_send(&priv->i2c_props, gainset_off, 2); 211 unsigned char deemphasis[] = { 0x13, 1 };
184 tuner_i2c_xfer_send(&priv->i2c_props, if_agc_spd, 2); 212
185 if (priv->tda8290_easy_mode & 0x60) 213 /* FIXME: allow using a different deemphasis */
186 tuner_i2c_xfer_send(&priv->i2c_props, adc_head_9, 2); 214
187 else 215 if (deemphasis_50)
188 tuner_i2c_xfer_send(&priv->i2c_props, adc_head_6, 2); 216 deemphasis[1] = 2;
189 tuner_i2c_xfer_send(&priv->i2c_props, pll_bw_nom, 2); 217
218 for (i = 0; i < ARRAY_SIZE(fm_mode); i++)
219 tuner_i2c_xfer_send(&priv->i2c_props, fm_mode[i].seq, 2);
220
221 tuner_i2c_xfer_send(&priv->i2c_props, deemphasis, 2);
222 } else {
223 expert_mode[1] = priv->tda8290_easy_mode + 0x80;
224 tuner_i2c_xfer_send(&priv->i2c_props, expert_mode, 2);
225 tuner_i2c_xfer_send(&priv->i2c_props, gainset_off, 2);
226 tuner_i2c_xfer_send(&priv->i2c_props, if_agc_spd, 2);
227 if (priv->tda8290_easy_mode & 0x60)
228 tuner_i2c_xfer_send(&priv->i2c_props, adc_head_9, 2);
229 else
230 tuner_i2c_xfer_send(&priv->i2c_props, adc_head_6, 2);
231 tuner_i2c_xfer_send(&priv->i2c_props, pll_bw_nom, 2);
232 }
190 233
191 tda8290_i2c_bridge(fe, 1); 234 tda8290_i2c_bridge(fe, 1);
192 235
diff --git a/drivers/media/common/tuners/tda9887.c b/drivers/media/common/tuners/tda9887.c
index ff1788cc5d48..544cdbe88a6c 100644
--- a/drivers/media/common/tuners/tda9887.c
+++ b/drivers/media/common/tuners/tda9887.c
@@ -180,11 +180,10 @@ static struct tvnorm tvnorms[] = {
180 },{ 180 },{
181 .std = V4L2_STD_SECAM_B | V4L2_STD_SECAM_G | V4L2_STD_SECAM_H, 181 .std = V4L2_STD_SECAM_B | V4L2_STD_SECAM_G | V4L2_STD_SECAM_H,
182 .name = "SECAM-BGH", 182 .name = "SECAM-BGH",
183 .b = ( cPositiveAmTV | 183 .b = ( cNegativeFmTV |
184 cQSS ), 184 cQSS ),
185 .c = ( cTopDefault), 185 .c = ( cTopDefault),
186 .e = ( cGating_36 | 186 .e = ( cAudioIF_5_5 |
187 cAudioIF_5_5 |
188 cVideoIF_38_90 ), 187 cVideoIF_38_90 ),
189 },{ 188 },{
190 .std = V4L2_STD_SECAM_L, 189 .std = V4L2_STD_SECAM_L,
diff --git a/drivers/media/common/tuners/tuner-xc2028.c b/drivers/media/common/tuners/tuner-xc2028.c
index b65e6803e6c6..1adce9ff52ce 100644
--- a/drivers/media/common/tuners/tuner-xc2028.c
+++ b/drivers/media/common/tuners/tuner-xc2028.c
@@ -28,6 +28,12 @@ static int debug;
28module_param(debug, int, 0644); 28module_param(debug, int, 0644);
29MODULE_PARM_DESC(debug, "enable verbose debug messages"); 29MODULE_PARM_DESC(debug, "enable verbose debug messages");
30 30
31static int no_poweroff;
32module_param(no_poweroff, int, 0644);
33MODULE_PARM_DESC(debug, "0 (default) powers device off when not used.\n"
34 "1 keep device energized and with tuner ready all the times.\n"
35 " Faster, but consumes more power and keeps the device hotter\n");
36
31static char audio_std[8]; 37static char audio_std[8];
32module_param_string(audio_std, audio_std, sizeof(audio_std), 0); 38module_param_string(audio_std, audio_std, sizeof(audio_std), 0);
33MODULE_PARM_DESC(audio_std, 39MODULE_PARM_DESC(audio_std,
@@ -1091,6 +1097,34 @@ static int xc2028_set_params(struct dvb_frontend *fe,
1091 T_DIGITAL_TV, type, 0, demod); 1097 T_DIGITAL_TV, type, 0, demod);
1092} 1098}
1093 1099
1100static int xc2028_sleep(struct dvb_frontend *fe)
1101{
1102 struct xc2028_data *priv = fe->tuner_priv;
1103 int rc = 0;
1104
1105 /* Avoid firmware reload on slow devices */
1106 if (no_poweroff)
1107 return 0;
1108
1109 tuner_dbg("Putting xc2028/3028 into poweroff mode.\n");
1110 if (debug > 1) {
1111 tuner_dbg("Printing sleep stack trace:\n");
1112 dump_stack();
1113 }
1114
1115 mutex_lock(&priv->lock);
1116
1117 if (priv->firm_version < 0x0202)
1118 rc = send_seq(priv, {0x00, 0x08, 0x00, 0x00});
1119 else
1120 rc = send_seq(priv, {0x80, 0x08, 0x00, 0x00});
1121
1122 priv->cur_fw.type = 0; /* need firmware reload */
1123
1124 mutex_unlock(&priv->lock);
1125
1126 return rc;
1127}
1094 1128
1095static int xc2028_dvb_release(struct dvb_frontend *fe) 1129static int xc2028_dvb_release(struct dvb_frontend *fe)
1096{ 1130{
@@ -1171,6 +1205,7 @@ static const struct dvb_tuner_ops xc2028_dvb_tuner_ops = {
1171 .get_frequency = xc2028_get_frequency, 1205 .get_frequency = xc2028_get_frequency,
1172 .get_rf_strength = xc2028_signal, 1206 .get_rf_strength = xc2028_signal,
1173 .set_params = xc2028_set_params, 1207 .set_params = xc2028_set_params,
1208 .sleep = xc2028_sleep,
1174}; 1209};
1175 1210
1176struct dvb_frontend *xc2028_attach(struct dvb_frontend *fe, 1211struct dvb_frontend *xc2028_attach(struct dvb_frontend *fe,
diff --git a/drivers/media/common/tuners/xc5000.c b/drivers/media/common/tuners/xc5000.c
index e12d13e0cbe9..493ce93caf43 100644
--- a/drivers/media/common/tuners/xc5000.c
+++ b/drivers/media/common/tuners/xc5000.c
@@ -36,10 +36,6 @@ static int debug;
36module_param(debug, int, 0644); 36module_param(debug, int, 0644);
37MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off)."); 37MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off).");
38 38
39static int xc5000_load_fw_on_attach;
40module_param_named(init_fw, xc5000_load_fw_on_attach, int, 0644);
41MODULE_PARM_DESC(init_fw, "Load firmware during driver initialization.");
42
43static DEFINE_MUTEX(xc5000_list_mutex); 39static DEFINE_MUTEX(xc5000_list_mutex);
44static LIST_HEAD(hybrid_tuner_instance_list); 40static LIST_HEAD(hybrid_tuner_instance_list);
45 41
@@ -1017,9 +1013,6 @@ struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe,
1017 memcpy(&fe->ops.tuner_ops, &xc5000_tuner_ops, 1013 memcpy(&fe->ops.tuner_ops, &xc5000_tuner_ops,
1018 sizeof(struct dvb_tuner_ops)); 1014 sizeof(struct dvb_tuner_ops));
1019 1015
1020 if (xc5000_load_fw_on_attach)
1021 xc5000_init(fe);
1022
1023 return fe; 1016 return fe;
1024fail: 1017fail:
1025 mutex_unlock(&xc5000_list_mutex); 1018 mutex_unlock(&xc5000_list_mutex);