aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/b2c2
diff options
context:
space:
mode:
authorTrent Piepho <xyzzy@speakeasy.org>2009-06-11 18:31:22 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-09-12 11:17:51 -0400
commit6d67c9717bb71fd23a1f87c464df3ac886759cd0 (patch)
treea70c954d44fcaff0316041867fa71c27d7f048ff /drivers/media/dvb/b2c2
parentd799ce570871bcb3f035e753a5bb3814f9530681 (diff)
V4L/DVB (12292): b2c2: Use dvb-pll for AirStar DVB-T's tuner
The code in samsung_tdtc9251dh0_calc_regs() is equivalent to what dvb-pll's code does. Signed-off-by: Trent Piepho <xyzzy@speakeasy.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/b2c2')
-rw-r--r--drivers/media/dvb/b2c2/flexcop-fe-tuner.c38
1 files changed, 6 insertions, 32 deletions
diff --git a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c
index d5e414944a0e..c35661a5ab27 100644
--- a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c
+++ b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c
@@ -449,7 +449,7 @@ static int skystar2_rev28_attach(struct flexcop_device *fc,
449#endif 449#endif
450 450
451/* AirStar DVB-T */ 451/* AirStar DVB-T */
452#if FE_SUPPORTED(MT352) 452#if FE_SUPPORTED(MT352) && FE_SUPPORTED(PLL)
453static int samsung_tdtc9251dh0_demod_init(struct dvb_frontend *fe) 453static int samsung_tdtc9251dh0_demod_init(struct dvb_frontend *fe)
454{ 454{
455 static u8 mt352_clock_config[] = { 0x89, 0x18, 0x2d }; 455 static u8 mt352_clock_config[] = { 0x89, 0x18, 0x2d };
@@ -467,32 +467,6 @@ static int samsung_tdtc9251dh0_demod_init(struct dvb_frontend *fe)
467 return 0; 467 return 0;
468} 468}
469 469
470static int samsung_tdtc9251dh0_calc_regs(struct dvb_frontend *fe,
471 struct dvb_frontend_parameters *params, u8* pllbuf, int buf_len)
472{
473 u32 div;
474 unsigned char bs = 0;
475
476 if (buf_len < 5)
477 return -EINVAL;
478
479#define IF_FREQUENCYx6 217 /* 6 * 36.16666666667MHz */
480 div = (((params->frequency + 83333) * 3) / 500000) + IF_FREQUENCYx6;
481 if (params->frequency >= 48000000 && params->frequency <= 154000000) \
482 bs = 0x09;
483 if (params->frequency >= 161000000 && params->frequency <= 439000000) \
484 bs = 0x0a;
485 if (params->frequency >= 447000000 && params->frequency <= 863000000) \
486 bs = 0x08;
487
488 pllbuf[0] = 0x61;
489 pllbuf[1] = div >> 8;
490 pllbuf[2] = div & 0xff;
491 pllbuf[3] = 0xcc;
492 pllbuf[4] = bs;
493 return 5;
494}
495
496static struct mt352_config samsung_tdtc9251dh0_config = { 470static struct mt352_config samsung_tdtc9251dh0_config = {
497 .demod_address = 0x0f, 471 .demod_address = 0x0f,
498 .demod_init = samsung_tdtc9251dh0_demod_init, 472 .demod_init = samsung_tdtc9251dh0_demod_init,
@@ -502,11 +476,11 @@ static int airstar_dvbt_attach(struct flexcop_device *fc,
502 struct i2c_adapter *i2c) 476 struct i2c_adapter *i2c)
503{ 477{
504 fc->fe = dvb_attach(mt352_attach, &samsung_tdtc9251dh0_config, i2c); 478 fc->fe = dvb_attach(mt352_attach, &samsung_tdtc9251dh0_config, i2c);
505 if (fc->fe != NULL) { 479 if (!fc->fe)
506 fc->fe->ops.tuner_ops.calc_regs = samsung_tdtc9251dh0_calc_regs; 480 return 0;
507 return 1; 481
508 } 482 return !!dvb_attach(dvb_pll_attach, fc->fe, 0x61, NULL,
509 return 0; 483 DVB_PLL_SAMSUNG_TDTC9251DH0);
510} 484}
511#else 485#else
512#define airstar_dvbt_attach NULL 486#define airstar_dvbt_attach NULL