summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/saa7134/saa7134-dvb.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/video/saa7134/saa7134-dvb.c')
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-dvb.c77
1 files changed, 4 insertions, 73 deletions
diff --git a/linux/drivers/media/video/saa7134/saa7134-dvb.c b/linux/drivers/media/video/saa7134/saa7134-dvb.c
index 996486394..5e2e28bb3 100644
--- a/linux/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/linux/drivers/media/video/saa7134/saa7134-dvb.c
@@ -34,6 +34,7 @@
#include "saa7134-reg.h"
#include "saa7134.h"
#include <media/v4l2-common.h>
+#include "dvb-pll.h"
#ifdef HAVE_MT352
# include "mt352.h"
@@ -44,7 +45,6 @@
#endif
#ifdef HAVE_NXT200X
# include "nxt200x.h"
-# include "dvb-pll.h"
#endif
MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
@@ -122,9 +122,6 @@ static int mt352_aver777_init(struct dvb_frontend* fe)
static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 };
static u8 agc_cfg [] = { AGC_TARGET, 0x28, 0xa0 };
static u8 capt_range_cfg[] = { CAPT_RANGE, 0x33 };
- struct saa7134_dev *dev= fe->dvb->priv;
-
- printk("%s: %s called\n",dev->name,__FUNCTION__);
mt352_write(fe, clock_config, sizeof(clock_config));
udelay(200);
@@ -167,76 +164,10 @@ static int mt352_pinnacle_pll_set(struct dvb_frontend* fe,
static int mt352_aver777_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params, u8* pllbuf)
{
- int tuner_frequency = 0;
- u8 band, cp, filter;
-
- /* determine charge pump */
- tuner_frequency = params->frequency + 36166000;
- if (tuner_frequency < 87000000)
- return -EINVAL;
- else if (tuner_frequency < 130000000)
- cp = 3;
- else if (tuner_frequency < 160000000)
- cp = 5;
- else if (tuner_frequency < 200000000)
- cp = 6;
- else if (tuner_frequency < 290000000)
- cp = 3;
- else if (tuner_frequency < 420000000)
- cp = 5;
- else if (tuner_frequency < 480000000)
- cp = 6;
- else if (tuner_frequency < 620000000)
- cp = 3;
- else if (tuner_frequency < 830000000)
- cp = 5;
- else if (tuner_frequency < 895000000)
- cp = 7;
- else
- return -EINVAL;
-
- /* determine band */
- if (params->frequency < 49000000)
- return -EINVAL;
- else if (params->frequency < 161000000)
- band = 1;
- else if (params->frequency < 444000000)
- band = 2;
- else if (params->frequency < 861000000)
- band = 4;
- else
- return -EINVAL;
-
- /* setup PLL filter */
- switch (params->u.ofdm.bandwidth) {
- case BANDWIDTH_6_MHZ:
- filter = 0;
- break;
-
- case BANDWIDTH_7_MHZ:
- filter = 0;
- break;
-
- case BANDWIDTH_8_MHZ:
- filter = 1;
- break;
-
- default:
- return -EINVAL;
- }
-
- /* calculate divisor
- * ((36166000+((1000000/6)/2)) + Finput)/(1000000/6)
- */
- tuner_frequency = (((params->frequency / 1000) * 6) + 217496) / 1000;
-
- /* setup tuner buffer */
pllbuf[0] = 0xc2;
- pllbuf[1] = (tuner_frequency >> 8) & 0x7f;
- pllbuf[2] = tuner_frequency & 0xff;
- pllbuf[3] = 0xca;
- pllbuf[4] = (cp << 5) | (filter << 3) | band;
-
+ dvb_pll_configure(&dvb_pll_philips_td1316, pllbuf+1,
+ params->frequency,
+ params->u.ofdm.bandwidth);
return 0;
}