diff options
author | Andrew de Quincey <adq_dvb@lidskialf.net> | 2006-04-18 16:47:11 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-06-25 00:59:02 -0400 |
commit | 067145bdd41bcb090510c73cc6ecd7b09213f038 (patch) | |
tree | 4c05df6ad2ed987ebed986a294a22e2d76803e09 /drivers/media/dvb/ttpci/budget.c | |
parent | fa006d86716891657dc8cc9b330b546d1899a7b4 (diff) |
V4L/DVB (3875): Convert ttpci/budget to refactored tuner code
Rename pll calls to appropriate tuner calls.
Remove pll functions from demod structures.
Hook tuner call into tuner_ops.
Add pll gate control calls where appropriate.
Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/ttpci/budget.c')
-rw-r--r-- | drivers/media/dvb/ttpci/budget.c | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c index c23c02d95641..a231975cbe3c 100644 --- a/drivers/media/dvb/ttpci/budget.c +++ b/drivers/media/dvb/ttpci/budget.c | |||
@@ -186,7 +186,7 @@ static int budget_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t m | |||
186 | return 0; | 186 | return 0; |
187 | } | 187 | } |
188 | 188 | ||
189 | static int alps_bsrv2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | 189 | static int alps_bsrv2_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) |
190 | { | 190 | { |
191 | struct budget* budget = (struct budget*) fe->dvb->priv; | 191 | struct budget* budget = (struct budget*) fe->dvb->priv; |
192 | u8 pwr = 0; | 192 | u8 pwr = 0; |
@@ -209,6 +209,8 @@ static int alps_bsrv2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_param | |||
209 | // NOTE: since we're using a prescaler of 2, we set the | 209 | // NOTE: since we're using a prescaler of 2, we set the |
210 | // divisor frequency to 62.5kHz and divide by 125 above | 210 | // divisor frequency to 62.5kHz and divide by 125 above |
211 | 211 | ||
212 | if (fe->ops->i2c_gate_ctrl) | ||
213 | fe->ops->i2c_gate_ctrl(fe, 1); | ||
212 | if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO; | 214 | if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO; |
213 | return 0; | 215 | return 0; |
214 | } | 216 | } |
@@ -218,10 +220,9 @@ static struct ves1x93_config alps_bsrv2_config = | |||
218 | .demod_address = 0x08, | 220 | .demod_address = 0x08, |
219 | .xin = 90100000UL, | 221 | .xin = 90100000UL, |
220 | .invert_pwm = 0, | 222 | .invert_pwm = 0, |
221 | .pll_set = alps_bsrv2_pll_set, | ||
222 | }; | 223 | }; |
223 | 224 | ||
224 | static int alps_tdbe2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | 225 | static int alps_tdbe2_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) |
225 | { | 226 | { |
226 | struct budget* budget = (struct budget*) fe->dvb->priv; | 227 | struct budget* budget = (struct budget*) fe->dvb->priv; |
227 | u32 div; | 228 | u32 div; |
@@ -235,6 +236,8 @@ static int alps_tdbe2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_param | |||
235 | data[2] = 0x85 | ((div >> 10) & 0x60); | 236 | data[2] = 0x85 | ((div >> 10) & 0x60); |
236 | data[3] = (params->frequency < 174000000 ? 0x88 : params->frequency < 470000000 ? 0x84 : 0x81); | 237 | data[3] = (params->frequency < 174000000 ? 0x88 : params->frequency < 470000000 ? 0x84 : 0x81); |
237 | 238 | ||
239 | if (fe->ops->i2c_gate_ctrl) | ||
240 | fe->ops->i2c_gate_ctrl(fe, 1); | ||
238 | if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO; | 241 | if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO; |
239 | return 0; | 242 | return 0; |
240 | } | 243 | } |
@@ -244,10 +247,9 @@ static struct ves1820_config alps_tdbe2_config = { | |||
244 | .xin = 57840000UL, | 247 | .xin = 57840000UL, |
245 | .invert = 1, | 248 | .invert = 1, |
246 | .selagc = VES1820_SELAGC_SIGNAMPERR, | 249 | .selagc = VES1820_SELAGC_SIGNAMPERR, |
247 | .pll_set = alps_tdbe2_pll_set, | ||
248 | }; | 250 | }; |
249 | 251 | ||
250 | static int grundig_29504_401_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | 252 | static int grundig_29504_401_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) |
251 | { | 253 | { |
252 | struct budget* budget = (struct budget*) fe->dvb->priv; | 254 | struct budget* budget = (struct budget*) fe->dvb->priv; |
253 | u32 div; | 255 | u32 div; |
@@ -274,16 +276,17 @@ static int grundig_29504_401_pll_set(struct dvb_frontend* fe, struct dvb_fronten | |||
274 | data[2] = ((div >> 10) & 0x60) | cfg; | 276 | data[2] = ((div >> 10) & 0x60) | cfg; |
275 | data[3] = (cpump << 6) | band_select; | 277 | data[3] = (cpump << 6) | band_select; |
276 | 278 | ||
279 | if (fe->ops->i2c_gate_ctrl) | ||
280 | fe->ops->i2c_gate_ctrl(fe, 1); | ||
277 | if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO; | 281 | if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO; |
278 | return 0; | 282 | return 0; |
279 | } | 283 | } |
280 | 284 | ||
281 | static struct l64781_config grundig_29504_401_config = { | 285 | static struct l64781_config grundig_29504_401_config = { |
282 | .demod_address = 0x55, | 286 | .demod_address = 0x55, |
283 | .pll_set = grundig_29504_401_pll_set, | ||
284 | }; | 287 | }; |
285 | 288 | ||
286 | static int grundig_29504_451_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | 289 | static int grundig_29504_451_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) |
287 | { | 290 | { |
288 | struct budget* budget = (struct budget*) fe->dvb->priv; | 291 | struct budget* budget = (struct budget*) fe->dvb->priv; |
289 | u32 div; | 292 | u32 div; |
@@ -296,16 +299,17 @@ static int grundig_29504_451_pll_set(struct dvb_frontend* fe, struct dvb_fronten | |||
296 | data[2] = 0x8e; | 299 | data[2] = 0x8e; |
297 | data[3] = 0x00; | 300 | data[3] = 0x00; |
298 | 301 | ||
302 | if (fe->ops->i2c_gate_ctrl) | ||
303 | fe->ops->i2c_gate_ctrl(fe, 1); | ||
299 | if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO; | 304 | if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO; |
300 | return 0; | 305 | return 0; |
301 | } | 306 | } |
302 | 307 | ||
303 | static struct tda8083_config grundig_29504_451_config = { | 308 | static struct tda8083_config grundig_29504_451_config = { |
304 | .demod_address = 0x68, | 309 | .demod_address = 0x68, |
305 | .pll_set = grundig_29504_451_pll_set, | ||
306 | }; | 310 | }; |
307 | 311 | ||
308 | static int s5h1420_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, u32* freqout) | 312 | static int s5h1420_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) |
309 | { | 313 | { |
310 | struct budget* budget = (struct budget*) fe->dvb->priv; | 314 | struct budget* budget = (struct budget*) fe->dvb->priv; |
311 | u32 div; | 315 | u32 div; |
@@ -326,16 +330,16 @@ static int s5h1420_pll_set(struct dvb_frontend* fe, struct dvb_frontend_paramete | |||
326 | else | 330 | else |
327 | data[3] = 0xc0; | 331 | data[3] = 0xc0; |
328 | 332 | ||
333 | if (fe->ops->i2c_gate_ctrl) | ||
334 | fe->ops->i2c_gate_ctrl(fe, 1); | ||
329 | if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO; | 335 | if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO; |
330 | 336 | ||
331 | *freqout = div * 1000; | ||
332 | return 0; | 337 | return 0; |
333 | } | 338 | } |
334 | 339 | ||
335 | static struct s5h1420_config s5h1420_config = { | 340 | static struct s5h1420_config s5h1420_config = { |
336 | .demod_address = 0x53, | 341 | .demod_address = 0x53, |
337 | .invert = 1, | 342 | .invert = 1, |
338 | .pll_set = s5h1420_pll_set, | ||
339 | }; | 343 | }; |
340 | 344 | ||
341 | static u8 read_pwm(struct budget* budget) | 345 | static u8 read_pwm(struct budget* budget) |
@@ -359,6 +363,7 @@ static void frontend_init(struct budget *budget) | |||
359 | // try the ALPS BSRV2 first of all | 363 | // try the ALPS BSRV2 first of all |
360 | budget->dvb_frontend = ves1x93_attach(&alps_bsrv2_config, &budget->i2c_adap); | 364 | budget->dvb_frontend = ves1x93_attach(&alps_bsrv2_config, &budget->i2c_adap); |
361 | if (budget->dvb_frontend) { | 365 | if (budget->dvb_frontend) { |
366 | budget->dvb_frontend->ops->tuner_ops.set_params = alps_bsrv2_tuner_set_params; | ||
362 | budget->dvb_frontend->ops->diseqc_send_master_cmd = budget_diseqc_send_master_cmd; | 367 | budget->dvb_frontend->ops->diseqc_send_master_cmd = budget_diseqc_send_master_cmd; |
363 | budget->dvb_frontend->ops->diseqc_send_burst = budget_diseqc_send_burst; | 368 | budget->dvb_frontend->ops->diseqc_send_burst = budget_diseqc_send_burst; |
364 | budget->dvb_frontend->ops->set_tone = budget_set_tone; | 369 | budget->dvb_frontend->ops->set_tone = budget_set_tone; |
@@ -368,6 +373,8 @@ static void frontend_init(struct budget *budget) | |||
368 | // try the ALPS BSRU6 now | 373 | // try the ALPS BSRU6 now |
369 | budget->dvb_frontend = stv0299_attach(&alps_bsru6_config, &budget->i2c_adap); | 374 | budget->dvb_frontend = stv0299_attach(&alps_bsru6_config, &budget->i2c_adap); |
370 | if (budget->dvb_frontend) { | 375 | if (budget->dvb_frontend) { |
376 | budget->dvb_frontend->ops->tuner_ops.set_params = alps_bsru6_tuner_set_params; | ||
377 | budget->dvb_frontend->tuner_priv = &budget->i2c_adap; | ||
371 | budget->dvb_frontend->ops->diseqc_send_master_cmd = budget_diseqc_send_master_cmd; | 378 | budget->dvb_frontend->ops->diseqc_send_master_cmd = budget_diseqc_send_master_cmd; |
372 | budget->dvb_frontend->ops->diseqc_send_burst = budget_diseqc_send_burst; | 379 | budget->dvb_frontend->ops->diseqc_send_burst = budget_diseqc_send_burst; |
373 | budget->dvb_frontend->ops->set_tone = budget_set_tone; | 380 | budget->dvb_frontend->ops->set_tone = budget_set_tone; |
@@ -378,18 +385,26 @@ static void frontend_init(struct budget *budget) | |||
378 | case 0x1004: // Hauppauge/TT DVB-C budget (ves1820/ALPS TDBE2(sp5659)) | 385 | case 0x1004: // Hauppauge/TT DVB-C budget (ves1820/ALPS TDBE2(sp5659)) |
379 | 386 | ||
380 | budget->dvb_frontend = ves1820_attach(&alps_tdbe2_config, &budget->i2c_adap, read_pwm(budget)); | 387 | budget->dvb_frontend = ves1820_attach(&alps_tdbe2_config, &budget->i2c_adap, read_pwm(budget)); |
381 | if (budget->dvb_frontend) break; | 388 | if (budget->dvb_frontend) { |
389 | budget->dvb_frontend->ops->tuner_ops.set_params = alps_tdbe2_tuner_set_params; | ||
390 | break; | ||
391 | } | ||
382 | break; | 392 | break; |
383 | 393 | ||
384 | case 0x1005: // Hauppauge/TT Nova-T budget (L64781/Grundig 29504-401(tsa5060)) | 394 | case 0x1005: // Hauppauge/TT Nova-T budget (L64781/Grundig 29504-401(tsa5060)) |
385 | 395 | ||
386 | budget->dvb_frontend = l64781_attach(&grundig_29504_401_config, &budget->i2c_adap); | 396 | budget->dvb_frontend = l64781_attach(&grundig_29504_401_config, &budget->i2c_adap); |
387 | if (budget->dvb_frontend) break; | 397 | if (budget->dvb_frontend) { |
398 | budget->dvb_frontend->ops->tuner_ops.set_params = grundig_29504_401_tuner_set_params; | ||
399 | break; | ||
400 | } | ||
388 | break; | 401 | break; |
389 | 402 | ||
390 | case 0x4f60: // Fujitsu Siemens Activy Budget-S PCI rev AL (stv0299/ALPS BSRU6(tsa5059)) | 403 | case 0x4f60: // Fujitsu Siemens Activy Budget-S PCI rev AL (stv0299/ALPS BSRU6(tsa5059)) |
391 | budget->dvb_frontend = stv0299_attach(&alps_bsru6_config, &budget->i2c_adap); | 404 | budget->dvb_frontend = stv0299_attach(&alps_bsru6_config, &budget->i2c_adap); |
392 | if (budget->dvb_frontend) { | 405 | if (budget->dvb_frontend) { |
406 | budget->dvb_frontend->ops->tuner_ops.set_params = alps_bsru6_tuner_set_params; | ||
407 | budget->dvb_frontend->tuner_priv = &budget->i2c_adap; | ||
393 | budget->dvb_frontend->ops->set_voltage = siemens_budget_set_voltage; | 408 | budget->dvb_frontend->ops->set_voltage = siemens_budget_set_voltage; |
394 | budget->dvb_frontend->ops->dishnetwork_send_legacy_command = NULL; | 409 | budget->dvb_frontend->ops->dishnetwork_send_legacy_command = NULL; |
395 | } | 410 | } |
@@ -398,6 +413,7 @@ static void frontend_init(struct budget *budget) | |||
398 | case 0x4f61: // Fujitsu Siemens Activy Budget-S PCI rev GR (tda8083/Grundig 29504-451(tsa5522)) | 413 | case 0x4f61: // Fujitsu Siemens Activy Budget-S PCI rev GR (tda8083/Grundig 29504-451(tsa5522)) |
399 | budget->dvb_frontend = tda8083_attach(&grundig_29504_451_config, &budget->i2c_adap); | 414 | budget->dvb_frontend = tda8083_attach(&grundig_29504_451_config, &budget->i2c_adap); |
400 | if (budget->dvb_frontend) { | 415 | if (budget->dvb_frontend) { |
416 | budget->dvb_frontend->ops->tuner_ops.set_params = grundig_29504_451_tuner_set_params; | ||
401 | budget->dvb_frontend->ops->set_voltage = siemens_budget_set_voltage; | 417 | budget->dvb_frontend->ops->set_voltage = siemens_budget_set_voltage; |
402 | budget->dvb_frontend->ops->dishnetwork_send_legacy_command = NULL; | 418 | budget->dvb_frontend->ops->dishnetwork_send_legacy_command = NULL; |
403 | } | 419 | } |
@@ -406,6 +422,7 @@ static void frontend_init(struct budget *budget) | |||
406 | case 0x1016: // Hauppauge/TT Nova-S SE (samsung s5h1420/????(tda8260)) | 422 | case 0x1016: // Hauppauge/TT Nova-S SE (samsung s5h1420/????(tda8260)) |
407 | budget->dvb_frontend = s5h1420_attach(&s5h1420_config, &budget->i2c_adap); | 423 | budget->dvb_frontend = s5h1420_attach(&s5h1420_config, &budget->i2c_adap); |
408 | if (budget->dvb_frontend) { | 424 | if (budget->dvb_frontend) { |
425 | budget->dvb_frontend->ops->tuner_ops.set_params = s5h1420_tuner_set_params; | ||
409 | if (lnbp21_init(budget->dvb_frontend, &budget->i2c_adap, 0, 0)) { | 426 | if (lnbp21_init(budget->dvb_frontend, &budget->i2c_adap, 0, 0)) { |
410 | printk("%s: No LNBP21 found!\n", __FUNCTION__); | 427 | printk("%s: No LNBP21 found!\n", __FUNCTION__); |
411 | goto error_out; | 428 | goto error_out; |