aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/tda8290.c
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2007-10-21 18:39:50 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-01-25 16:01:09 -0500
commit4e9154b8a77d0f0f8f06857162823905612a50d7 (patch)
treeb4aaf7945fe52833168eabc8b581bedc2a774035 /drivers/media/video/tda8290.c
parent482b498d7a1eb0e445657fb55d2bc6d4871c0ef5 (diff)
V4L/DVB (6440): tuner: convert analog tuner demod sub-modules to dvb_frontend interface
Convert tda9887 and tda8290/5 to dvb_frontend interface Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/tda8290.c')
-rw-r--r--drivers/media/video/tda8290.c164
1 files changed, 87 insertions, 77 deletions
diff --git a/drivers/media/video/tda8290.c b/drivers/media/video/tda8290.c
index e001c397ccfc..288865c3c714 100644
--- a/drivers/media/video/tda8290.c
+++ b/drivers/media/video/tda8290.c
@@ -44,13 +44,15 @@ struct tda8290_priv {
44 unsigned char tda827x_ver; 44 unsigned char tda827x_ver;
45 45
46 struct tda827x_config cfg; 46 struct tda827x_config cfg;
47
48 struct tuner *t;
47}; 49};
48 50
49/*---------------------------------------------------------------------*/ 51/*---------------------------------------------------------------------*/
50 52
51static void tda8290_i2c_bridge(struct tuner *t, int close) 53static void tda8290_i2c_bridge(struct dvb_frontend *fe, int close)
52{ 54{
53 struct tda8290_priv *priv = t->fe.analog_demod_priv; 55 struct tda8290_priv *priv = fe->analog_demod_priv;
54 56
55 unsigned char enable[2] = { 0x21, 0xC0 }; 57 unsigned char enable[2] = { 0x21, 0xC0 };
56 unsigned char disable[2] = { 0x21, 0x00 }; 58 unsigned char disable[2] = { 0x21, 0x00 };
@@ -66,9 +68,9 @@ static void tda8290_i2c_bridge(struct tuner *t, int close)
66 } 68 }
67} 69}
68 70
69static void tda8295_i2c_bridge(struct tuner *t, int close) 71static void tda8295_i2c_bridge(struct dvb_frontend *fe, int close)
70{ 72{
71 struct tda8290_priv *priv = t->fe.analog_demod_priv; 73 struct tda8290_priv *priv = fe->analog_demod_priv;
72 74
73 unsigned char enable[2] = { 0x45, 0xc1 }; 75 unsigned char enable[2] = { 0x45, 0xc1 };
74 unsigned char disable[2] = { 0x46, 0x00 }; 76 unsigned char disable[2] = { 0x46, 0x00 };
@@ -96,9 +98,10 @@ static void tda8295_i2c_bridge(struct tuner *t, int close)
96 98
97/*---------------------------------------------------------------------*/ 99/*---------------------------------------------------------------------*/
98 100
99static void set_audio(struct tuner *t) 101static void set_audio(struct dvb_frontend *fe)
100{ 102{
101 struct tda8290_priv *priv = t->fe.analog_demod_priv; 103 struct tda8290_priv *priv = fe->analog_demod_priv;
104 struct tuner *t = priv->t;
102 char* mode; 105 char* mode;
103 106
104 priv->cfg.tda827x_lpsel = 0; 107 priv->cfg.tda827x_lpsel = 0;
@@ -143,9 +146,11 @@ static void set_audio(struct tuner *t)
143 tuner_dbg("setting tda8290 to system %s\n", mode); 146 tuner_dbg("setting tda8290 to system %s\n", mode);
144} 147}
145 148
146static void tda8290_set_freq(struct tuner *t, unsigned int freq) 149static void tda8290_set_freq(struct dvb_frontend *fe, unsigned int freq)
147{ 150{
148 struct tda8290_priv *priv = t->fe.analog_demod_priv; 151 struct tda8290_priv *priv = fe->analog_demod_priv;
152 struct tuner *t = priv->t;
153
149 unsigned char soft_reset[] = { 0x00, 0x00 }; 154 unsigned char soft_reset[] = { 0x00, 0x00 };
150 unsigned char easy_mode[] = { 0x01, priv->tda8290_easy_mode }; 155 unsigned char easy_mode[] = { 0x01, priv->tda8290_easy_mode };
151 unsigned char expert_mode[] = { 0x01, 0x80 }; 156 unsigned char expert_mode[] = { 0x01, 0x80 };
@@ -175,7 +180,7 @@ static void tda8290_set_freq(struct tuner *t, unsigned int freq)
175 .std = t->std 180 .std = t->std
176 }; 181 };
177 182
178 set_audio(t); 183 set_audio(fe);
179 184
180 tuner_dbg("tda827xa config is 0x%02x\n", t->config); 185 tuner_dbg("tda827xa config is 0x%02x\n", t->config);
181 tuner_i2c_xfer_send(&priv->i2c_props, easy_mode, 2); 186 tuner_i2c_xfer_send(&priv->i2c_props, easy_mode, 2);
@@ -193,10 +198,10 @@ static void tda8290_set_freq(struct tuner *t, unsigned int freq)
193 tuner_i2c_xfer_send(&priv->i2c_props, adc_head_6, 2); 198 tuner_i2c_xfer_send(&priv->i2c_props, adc_head_6, 2);
194 tuner_i2c_xfer_send(&priv->i2c_props, pll_bw_nom, 2); 199 tuner_i2c_xfer_send(&priv->i2c_props, pll_bw_nom, 2);
195 200
196 tda8290_i2c_bridge(t, 1); 201 tda8290_i2c_bridge(fe, 1);
197 202
198 if (t->fe.ops.tuner_ops.set_analog_params) 203 if (fe->ops.tuner_ops.set_analog_params)
199 t->fe.ops.tuner_ops.set_analog_params(&t->fe, &params); 204 fe->ops.tuner_ops.set_analog_params(fe, &params);
200 205
201 for (i = 0; i < 3; i++) { 206 for (i = 0; i < 3; i++) {
202 tuner_i2c_xfer_send(&priv->i2c_props, &addr_pll_stat, 1); 207 tuner_i2c_xfer_send(&priv->i2c_props, &addr_pll_stat, 1);
@@ -227,7 +232,7 @@ static void tda8290_set_freq(struct tuner *t, unsigned int freq)
227 tuner_dbg("adjust gain, step 2. Agc: %d, lock: %d\n", 232 tuner_dbg("adjust gain, step 2. Agc: %d, lock: %d\n",
228 agc_stat, pll_stat & 0x80); 233 agc_stat, pll_stat & 0x80);
229 if (priv->cfg.agcf) 234 if (priv->cfg.agcf)
230 priv->cfg.agcf(&t->fe); 235 priv->cfg.agcf(fe);
231 msleep(100); 236 msleep(100);
232 tuner_i2c_xfer_send(&priv->i2c_props, &addr_agc_stat, 1); 237 tuner_i2c_xfer_send(&priv->i2c_props, &addr_agc_stat, 1);
233 tuner_i2c_xfer_recv(&priv->i2c_props, &agc_stat, 1); 238 tuner_i2c_xfer_recv(&priv->i2c_props, &agc_stat, 1);
@@ -256,15 +261,15 @@ static void tda8290_set_freq(struct tuner *t, unsigned int freq)
256 } 261 }
257 } 262 }
258 263
259 tda8290_i2c_bridge(t, 0); 264 tda8290_i2c_bridge(fe, 0);
260 tuner_i2c_xfer_send(&priv->i2c_props, if_agc_set, 2); 265 tuner_i2c_xfer_send(&priv->i2c_props, if_agc_set, 2);
261} 266}
262 267
263/*---------------------------------------------------------------------*/ 268/*---------------------------------------------------------------------*/
264 269
265static void tda8295_power(struct tuner *t, int enable) 270static void tda8295_power(struct dvb_frontend *fe, int enable)
266{ 271{
267 struct tda8290_priv *priv = t->fe.analog_demod_priv; 272 struct tda8290_priv *priv = fe->analog_demod_priv;
268 unsigned char buf[] = { 0x30, 0x00 }; /* clb_stdbt */ 273 unsigned char buf[] = { 0x30, 0x00 }; /* clb_stdbt */
269 274
270 tuner_i2c_xfer_send(&priv->i2c_props, &buf[0], 1); 275 tuner_i2c_xfer_send(&priv->i2c_props, &buf[0], 1);
@@ -278,9 +283,9 @@ static void tda8295_power(struct tuner *t, int enable)
278 tuner_i2c_xfer_send(&priv->i2c_props, buf, 2); 283 tuner_i2c_xfer_send(&priv->i2c_props, buf, 2);
279} 284}
280 285
281static void tda8295_set_easy_mode(struct tuner *t, int enable) 286static void tda8295_set_easy_mode(struct dvb_frontend *fe, int enable)
282{ 287{
283 struct tda8290_priv *priv = t->fe.analog_demod_priv; 288 struct tda8290_priv *priv = fe->analog_demod_priv;
284 unsigned char buf[] = { 0x01, 0x00 }; 289 unsigned char buf[] = { 0x01, 0x00 };
285 290
286 tuner_i2c_xfer_send(&priv->i2c_props, &buf[0], 1); 291 tuner_i2c_xfer_send(&priv->i2c_props, &buf[0], 1);
@@ -294,23 +299,23 @@ static void tda8295_set_easy_mode(struct tuner *t, int enable)
294 tuner_i2c_xfer_send(&priv->i2c_props, buf, 2); 299 tuner_i2c_xfer_send(&priv->i2c_props, buf, 2);
295} 300}
296 301
297static void tda8295_set_video_std(struct tuner *t) 302static void tda8295_set_video_std(struct dvb_frontend *fe)
298{ 303{
299 struct tda8290_priv *priv = t->fe.analog_demod_priv; 304 struct tda8290_priv *priv = fe->analog_demod_priv;
300 unsigned char buf[] = { 0x00, priv->tda8290_easy_mode }; 305 unsigned char buf[] = { 0x00, priv->tda8290_easy_mode };
301 306
302 tuner_i2c_xfer_send(&priv->i2c_props, buf, 2); 307 tuner_i2c_xfer_send(&priv->i2c_props, buf, 2);
303 308
304 tda8295_set_easy_mode(t, 1); 309 tda8295_set_easy_mode(fe, 1);
305 msleep(20); 310 msleep(20);
306 tda8295_set_easy_mode(t, 0); 311 tda8295_set_easy_mode(fe, 0);
307} 312}
308 313
309/*---------------------------------------------------------------------*/ 314/*---------------------------------------------------------------------*/
310 315
311static void tda8295_agc1_out(struct tuner *t, int enable) 316static void tda8295_agc1_out(struct dvb_frontend *fe, int enable)
312{ 317{
313 struct tda8290_priv *priv = t->fe.analog_demod_priv; 318 struct tda8290_priv *priv = fe->analog_demod_priv;
314 unsigned char buf[] = { 0x02, 0x00 }; /* DIV_FUNC */ 319 unsigned char buf[] = { 0x02, 0x00 }; /* DIV_FUNC */
315 320
316 tuner_i2c_xfer_send(&priv->i2c_props, &buf[0], 1); 321 tuner_i2c_xfer_send(&priv->i2c_props, &buf[0], 1);
@@ -324,9 +329,9 @@ static void tda8295_agc1_out(struct tuner *t, int enable)
324 tuner_i2c_xfer_send(&priv->i2c_props, buf, 2); 329 tuner_i2c_xfer_send(&priv->i2c_props, buf, 2);
325} 330}
326 331
327static void tda8295_agc2_out(struct tuner *t, int enable) 332static void tda8295_agc2_out(struct dvb_frontend *fe, int enable)
328{ 333{
329 struct tda8290_priv *priv = t->fe.analog_demod_priv; 334 struct tda8290_priv *priv = fe->analog_demod_priv;
330 unsigned char set_gpio_cf[] = { 0x44, 0x00 }; 335 unsigned char set_gpio_cf[] = { 0x44, 0x00 };
331 unsigned char set_gpio_val[] = { 0x46, 0x00 }; 336 unsigned char set_gpio_val[] = { 0x46, 0x00 };
332 337
@@ -345,9 +350,9 @@ static void tda8295_agc2_out(struct tuner *t, int enable)
345 tuner_i2c_xfer_send(&priv->i2c_props, set_gpio_val, 2); 350 tuner_i2c_xfer_send(&priv->i2c_props, set_gpio_val, 2);
346} 351}
347 352
348static int tda8295_has_signal(struct tuner *t) 353static int tda8295_has_signal(struct dvb_frontend *fe)
349{ 354{
350 struct tda8290_priv *priv = t->fe.analog_demod_priv; 355 struct tda8290_priv *priv = fe->analog_demod_priv;
351 356
352 unsigned char hvpll_stat = 0x26; 357 unsigned char hvpll_stat = 0x26;
353 unsigned char ret; 358 unsigned char ret;
@@ -359,9 +364,10 @@ static int tda8295_has_signal(struct tuner *t)
359 364
360/*---------------------------------------------------------------------*/ 365/*---------------------------------------------------------------------*/
361 366
362static void tda8295_set_freq(struct tuner *t, unsigned int freq) 367static void tda8295_set_freq(struct dvb_frontend *fe, unsigned int freq)
363{ 368{
364 struct tda8290_priv *priv = t->fe.analog_demod_priv; 369 struct tda8290_priv *priv = fe->analog_demod_priv;
370 struct tuner *t = priv->t;
365 u16 ifc; 371 u16 ifc;
366 372
367 unsigned char blanking_mode[] = { 0x1d, 0x00 }; 373 unsigned char blanking_mode[] = { 0x1d, 0x00 };
@@ -373,45 +379,45 @@ static void tda8295_set_freq(struct tuner *t, unsigned int freq)
373 .std = t->std 379 .std = t->std
374 }; 380 };
375 381
376 set_audio(t); 382 set_audio(fe);
377 383
378 ifc = priv->cfg.sgIF; /* FIXME */ 384 ifc = priv->cfg.sgIF; /* FIXME */
379 385
380 tuner_dbg("%s: ifc = %u, freq = %d\n", __FUNCTION__, ifc, freq); 386 tuner_dbg("%s: ifc = %u, freq = %d\n", __FUNCTION__, ifc, freq);
381 387
382 tda8295_power(t, 1); 388 tda8295_power(fe, 1);
383 tda8295_agc1_out(t, 1); 389 tda8295_agc1_out(fe, 1);
384 390
385 tuner_i2c_xfer_send(&priv->i2c_props, &blanking_mode[0], 1); 391 tuner_i2c_xfer_send(&priv->i2c_props, &blanking_mode[0], 1);
386 tuner_i2c_xfer_recv(&priv->i2c_props, &blanking_mode[1], 1); 392 tuner_i2c_xfer_recv(&priv->i2c_props, &blanking_mode[1], 1);
387 393
388 tda8295_set_video_std(t); 394 tda8295_set_video_std(fe);
389 395
390 blanking_mode[1] = 0x03; 396 blanking_mode[1] = 0x03;
391 tuner_i2c_xfer_send(&priv->i2c_props, blanking_mode, 2); 397 tuner_i2c_xfer_send(&priv->i2c_props, blanking_mode, 2);
392 msleep(20); 398 msleep(20);
393 399
394 tda8295_i2c_bridge(t, 1); 400 tda8295_i2c_bridge(fe, 1);
395 401
396 if (t->fe.ops.tuner_ops.set_analog_params) 402 if (fe->ops.tuner_ops.set_analog_params)
397 t->fe.ops.tuner_ops.set_analog_params(&t->fe, &params); 403 fe->ops.tuner_ops.set_analog_params(fe, &params);
398 404
399 if (priv->cfg.agcf) 405 if (priv->cfg.agcf)
400 priv->cfg.agcf(&t->fe); 406 priv->cfg.agcf(fe);
401 407
402 if (tda8295_has_signal(t)) 408 if (tda8295_has_signal(fe))
403 tuner_dbg("tda8295 is locked\n"); 409 tuner_dbg("tda8295 is locked\n");
404 else 410 else
405 tuner_dbg("tda8295 not locked, no signal?\n"); 411 tuner_dbg("tda8295 not locked, no signal?\n");
406 412
407 tda8295_i2c_bridge(t, 0); 413 tda8295_i2c_bridge(fe, 0);
408} 414}
409 415
410/*---------------------------------------------------------------------*/ 416/*---------------------------------------------------------------------*/
411 417
412static int tda8290_has_signal(struct tuner *t) 418static int tda8290_has_signal(struct dvb_frontend *fe)
413{ 419{
414 struct tda8290_priv *priv = t->fe.analog_demod_priv; 420 struct tda8290_priv *priv = fe->analog_demod_priv;
415 421
416 unsigned char i2c_get_afc[1] = { 0x1B }; 422 unsigned char i2c_get_afc[1] = { 0x1B };
417 unsigned char afc = 0; 423 unsigned char afc = 0;
@@ -423,33 +429,35 @@ static int tda8290_has_signal(struct tuner *t)
423 429
424/*---------------------------------------------------------------------*/ 430/*---------------------------------------------------------------------*/
425 431
426static void tda8290_standby(struct tuner *t) 432static void tda8290_standby(struct dvb_frontend *fe)
427{ 433{
428 struct tda8290_priv *priv = t->fe.analog_demod_priv; 434 struct tda8290_priv *priv = fe->analog_demod_priv;
435
429 unsigned char cb1[] = { 0x30, 0xD0 }; 436 unsigned char cb1[] = { 0x30, 0xD0 };
430 unsigned char tda8290_standby[] = { 0x00, 0x02 }; 437 unsigned char tda8290_standby[] = { 0x00, 0x02 };
431 unsigned char tda8290_agc_tri[] = { 0x02, 0x20 }; 438 unsigned char tda8290_agc_tri[] = { 0x02, 0x20 };
432 struct i2c_msg msg = {.addr = priv->tda827x_addr, .flags=0, .buf=cb1, .len = 2}; 439 struct i2c_msg msg = {.addr = priv->tda827x_addr, .flags=0, .buf=cb1, .len = 2};
433 440
434 tda8290_i2c_bridge(t, 1); 441 tda8290_i2c_bridge(fe, 1);
435 if (priv->tda827x_ver != 0) 442 if (priv->tda827x_ver != 0)
436 cb1[1] = 0x90; 443 cb1[1] = 0x90;
437 i2c_transfer(priv->i2c_props.adap, &msg, 1); 444 i2c_transfer(priv->i2c_props.adap, &msg, 1);
438 tda8290_i2c_bridge(t, 0); 445 tda8290_i2c_bridge(fe, 0);
439 tuner_i2c_xfer_send(&priv->i2c_props, tda8290_agc_tri, 2); 446 tuner_i2c_xfer_send(&priv->i2c_props, tda8290_agc_tri, 2);
440 tuner_i2c_xfer_send(&priv->i2c_props, tda8290_standby, 2); 447 tuner_i2c_xfer_send(&priv->i2c_props, tda8290_standby, 2);
441} 448}
442 449
443static void tda8295_standby(struct tuner *t) 450static void tda8295_standby(struct dvb_frontend *fe)
444{ 451{
445 tda8295_agc1_out(t, 0); /* Put AGC in tri-state */ 452 tda8295_agc1_out(fe, 0); /* Put AGC in tri-state */
446 453
447 tda8295_power(t, 0); 454 tda8295_power(fe, 0);
448} 455}
449 456
450static void tda8290_init_if(struct tuner *t) 457static void tda8290_init_if(struct dvb_frontend *fe)
451{ 458{
452 struct tda8290_priv *priv = t->fe.analog_demod_priv; 459 struct tda8290_priv *priv = fe->analog_demod_priv;
460 struct tuner *t = priv->t;
453 461
454 unsigned char set_VS[] = { 0x30, 0x6F }; 462 unsigned char set_VS[] = { 0x30, 0x6F };
455 unsigned char set_GP00_CF[] = { 0x20, 0x01 }; 463 unsigned char set_GP00_CF[] = { 0x20, 0x01 };
@@ -462,9 +470,9 @@ static void tda8290_init_if(struct tuner *t)
462 tuner_i2c_xfer_send(&priv->i2c_props, set_VS, 2); 470 tuner_i2c_xfer_send(&priv->i2c_props, set_VS, 2);
463} 471}
464 472
465static void tda8295_init_if(struct tuner *t) 473static void tda8295_init_if(struct dvb_frontend *fe)
466{ 474{
467 struct tda8290_priv *priv = t->fe.analog_demod_priv; 475 struct tda8290_priv *priv = fe->analog_demod_priv;
468 476
469 static unsigned char set_adc_ctl[] = { 0x33, 0x14 }; 477 static unsigned char set_adc_ctl[] = { 0x33, 0x14 };
470 static unsigned char set_adc_ctl2[] = { 0x34, 0x00 }; 478 static unsigned char set_adc_ctl2[] = { 0x34, 0x00 };
@@ -474,10 +482,10 @@ static void tda8295_init_if(struct tuner *t)
474 static unsigned char set_pll_reg10[] = { 0x42, 0x61 }; 482 static unsigned char set_pll_reg10[] = { 0x42, 0x61 };
475 static unsigned char set_gpio_reg0[] = { 0x44, 0x0b }; 483 static unsigned char set_gpio_reg0[] = { 0x44, 0x0b };
476 484
477 tda8295_power(t, 1); 485 tda8295_power(fe, 1);
478 486
479 tda8295_set_easy_mode(t, 0); 487 tda8295_set_easy_mode(fe, 0);
480 tda8295_set_video_std(t); 488 tda8295_set_video_std(fe);
481 489
482 tuner_i2c_xfer_send(&priv->i2c_props, set_adc_ctl, 2); 490 tuner_i2c_xfer_send(&priv->i2c_props, set_adc_ctl, 2);
483 tuner_i2c_xfer_send(&priv->i2c_props, set_adc_ctl2, 2); 491 tuner_i2c_xfer_send(&priv->i2c_props, set_adc_ctl2, 2);
@@ -487,13 +495,13 @@ static void tda8295_init_if(struct tuner *t)
487 tuner_i2c_xfer_send(&priv->i2c_props, set_pll_reg10, 2); 495 tuner_i2c_xfer_send(&priv->i2c_props, set_pll_reg10, 2);
488 tuner_i2c_xfer_send(&priv->i2c_props, set_gpio_reg0, 2); 496 tuner_i2c_xfer_send(&priv->i2c_props, set_gpio_reg0, 2);
489 497
490 tda8295_agc1_out(t, 0); 498 tda8295_agc1_out(fe, 0);
491 tda8295_agc2_out(t, 0); 499 tda8295_agc2_out(fe, 0);
492} 500}
493 501
494static void tda8290_init_tuner(struct tuner *t) 502static void tda8290_init_tuner(struct dvb_frontend *fe)
495{ 503{
496 struct tda8290_priv *priv = t->fe.analog_demod_priv; 504 struct tda8290_priv *priv = fe->analog_demod_priv;
497 unsigned char tda8275_init[] = { 0x00, 0x00, 0x00, 0x40, 0xdC, 0x04, 0xAf, 505 unsigned char tda8275_init[] = { 0x00, 0x00, 0x00, 0x40, 0xdC, 0x04, 0xAf,
498 0x3F, 0x2A, 0x04, 0xFF, 0x00, 0x00, 0x40 }; 506 0x3F, 0x2A, 0x04, 0xFF, 0x00, 0x00, 0x40 };
499 unsigned char tda8275a_init[] = { 0x00, 0x00, 0x00, 0x00, 0xdC, 0x05, 0x8b, 507 unsigned char tda8275a_init[] = { 0x00, 0x00, 0x00, 0x00, 0xdC, 0x05, 0x8b,
@@ -503,20 +511,20 @@ static void tda8290_init_tuner(struct tuner *t)
503 if (priv->tda827x_ver != 0) 511 if (priv->tda827x_ver != 0)
504 msg.buf = tda8275a_init; 512 msg.buf = tda8275a_init;
505 513
506 tda8290_i2c_bridge(t, 1); 514 tda8290_i2c_bridge(fe, 1);
507 i2c_transfer(priv->i2c_props.adap, &msg, 1); 515 i2c_transfer(priv->i2c_props.adap, &msg, 1);
508 tda8290_i2c_bridge(t, 0); 516 tda8290_i2c_bridge(fe, 0);
509} 517}
510 518
511/*---------------------------------------------------------------------*/ 519/*---------------------------------------------------------------------*/
512 520
513static void tda829x_release(struct tuner *t) 521static void tda829x_release(struct dvb_frontend *fe)
514{ 522{
515 if (t->fe.ops.tuner_ops.release) 523 if (fe->ops.tuner_ops.release)
516 t->fe.ops.tuner_ops.release(&t->fe); 524 fe->ops.tuner_ops.release(fe);
517 525
518 kfree(t->fe.analog_demod_priv); 526 kfree(fe->analog_demod_priv);
519 t->fe.analog_demod_priv = NULL; 527 fe->analog_demod_priv = NULL;
520} 528}
521 529
522static struct analog_tuner_ops tda8290_tuner_ops = { 530static struct analog_tuner_ops tda8290_tuner_ops = {
@@ -552,8 +560,9 @@ int tda8290_attach(struct tuner *t)
552 priv->i2c_props.adap = t->i2c.adapter; 560 priv->i2c_props.adap = t->i2c.adapter;
553 priv->cfg.config = &t->config; 561 priv->cfg.config = &t->config;
554 priv->cfg.tuner_callback = t->tuner_callback; 562 priv->cfg.tuner_callback = t->tuner_callback;
563 priv->t = t;
555 564
556 tda8290_i2c_bridge(t, 1); 565 tda8290_i2c_bridge(&t->fe, 1);
557 /* probe for tuner chip */ 566 /* probe for tuner chip */
558 tuners_found = 0; 567 tuners_found = 0;
559 tuner_addrs = 0; 568 tuner_addrs = 0;
@@ -569,7 +578,7 @@ int tda8290_attach(struct tuner *t)
569 behind the bridge and we choose the highest address that doesn't 578 behind the bridge and we choose the highest address that doesn't
570 give a response now 579 give a response now
571 */ 580 */
572 tda8290_i2c_bridge(t, 0); 581 tda8290_i2c_bridge(&t->fe, 0);
573 if(tuners_found > 1) 582 if(tuners_found > 1)
574 for (i = 0; i < tuners_found; i++) { 583 for (i = 0; i < tuners_found; i++) {
575 msg.addr = tuner_addrs & 0xff; 584 msg.addr = tuner_addrs & 0xff;
@@ -590,7 +599,7 @@ int tda8290_attach(struct tuner *t)
590 priv->tda827x_addr = tuner_addrs; 599 priv->tda827x_addr = tuner_addrs;
591 msg.addr = tuner_addrs; 600 msg.addr = tuner_addrs;
592 601
593 tda8290_i2c_bridge(t, 1); 602 tda8290_i2c_bridge(&t->fe, 1);
594 603
595 ret = i2c_transfer(priv->i2c_props.adap, &msg, 1); 604 ret = i2c_transfer(priv->i2c_props.adap, &msg, 1);
596 if( ret != 1) 605 if( ret != 1)
@@ -619,8 +628,8 @@ int tda8290_attach(struct tuner *t)
619 priv->cfg.tda827x_lpsel = 0; 628 priv->cfg.tda827x_lpsel = 0;
620 t->mode = V4L2_TUNER_ANALOG_TV; 629 t->mode = V4L2_TUNER_ANALOG_TV;
621 630
622 tda8290_init_tuner(t); 631 tda8290_init_tuner(&t->fe);
623 tda8290_init_if(t); 632 tda8290_init_if(&t->fe);
624 return 0; 633 return 0;
625} 634}
626EXPORT_SYMBOL_GPL(tda8290_attach); 635EXPORT_SYMBOL_GPL(tda8290_attach);
@@ -640,8 +649,9 @@ int tda8295_attach(struct tuner *t)
640 649
641 priv->i2c_props.addr = t->i2c.addr; 650 priv->i2c_props.addr = t->i2c.addr;
642 priv->i2c_props.adap = t->i2c.adapter; 651 priv->i2c_props.adap = t->i2c.adapter;
652 priv->t = t;
643 653
644 tda8295_i2c_bridge(t, 1); 654 tda8295_i2c_bridge(&t->fe, 1);
645 /* probe for tuner chip */ 655 /* probe for tuner chip */
646 tuners_found = 0; 656 tuners_found = 0;
647 tuner_addrs = 0; 657 tuner_addrs = 0;
@@ -657,7 +667,7 @@ int tda8295_attach(struct tuner *t)
657 behind the bridge and we choose the highest address that doesn't 667 behind the bridge and we choose the highest address that doesn't
658 give a response now 668 give a response now
659 */ 669 */
660 tda8295_i2c_bridge(t, 0); 670 tda8295_i2c_bridge(&t->fe, 0);
661 if (tuners_found > 1) 671 if (tuners_found > 1)
662 for (i = 0; i < tuners_found; i++) { 672 for (i = 0; i < tuners_found; i++) {
663 msg.addr = tuner_addrs & 0xff; 673 msg.addr = tuner_addrs & 0xff;
@@ -678,9 +688,9 @@ int tda8295_attach(struct tuner *t)
678 priv->tda827x_addr = tuner_addrs; 688 priv->tda827x_addr = tuner_addrs;
679 msg.addr = tuner_addrs; 689 msg.addr = tuner_addrs;
680 690
681 tda8295_i2c_bridge(t, 1); 691 tda8295_i2c_bridge(&t->fe, 1);
682 ret = i2c_transfer(priv->i2c_props.adap, &msg, 1); 692 ret = i2c_transfer(priv->i2c_props.adap, &msg, 1);
683 tda8295_i2c_bridge(t, 0); 693 tda8295_i2c_bridge(&t->fe, 0);
684 if (ret != 1) 694 if (ret != 1)
685 tuner_warn("TDA827x access failed!\n"); 695 tuner_warn("TDA827x access failed!\n");
686 if ((data & 0x3c) == 0) { 696 if ((data & 0x3c) == 0) {
@@ -708,7 +718,7 @@ int tda8295_attach(struct tuner *t)
708 priv->cfg.tda827x_lpsel = 0; 718 priv->cfg.tda827x_lpsel = 0;
709 t->mode = V4L2_TUNER_ANALOG_TV; 719 t->mode = V4L2_TUNER_ANALOG_TV;
710 720
711 tda8295_init_if(t); 721 tda8295_init_if(&t->fe);
712 return 0; 722 return 0;
713} 723}
714EXPORT_SYMBOL_GPL(tda8295_attach); 724EXPORT_SYMBOL_GPL(tda8295_attach);