summaryrefslogtreecommitdiff
path: root/linux/drivers/media
diff options
context:
space:
mode:
authorNickolay V. Shmyrev <devnull@localhost>2005-07-06 21:46:25 +0000
committerNickolay V. Shmyrev <devnull@localhost>2005-07-06 21:46:25 +0000
commitfa9f3c40eb5f4bfeb745c2849a06c28672e99464 (patch)
tree70b84528ce51eb92bfba32f22518c397bbd97081 /linux/drivers/media
parent990acfb41cb9e0c73271521b8d9aae198a5ecfb1 (diff)
downloadmediapointer-dvb-s2-fa9f3c40eb5f4bfeb745c2849a06c28672e99464.tar.gz
mediapointer-dvb-s2-fa9f3c40eb5f4bfeb745c2849a06c28672e99464.tar.bz2
* tuner-simple.c:
- Use 50 kHz step when tunning radio for most tuners. Signed-Off-By: Nickolay V. Shmyrev <nshmyrev@yandex.ru>
Diffstat (limited to 'linux/drivers/media')
-rw-r--r--linux/drivers/media/video/tuner-simple.c48
1 files changed, 29 insertions, 19 deletions
diff --git a/linux/drivers/media/video/tuner-simple.c b/linux/drivers/media/video/tuner-simple.c
index 6691334d2..ee10dbad1 100644
--- a/linux/drivers/media/video/tuner-simple.c
+++ b/linux/drivers/media/video/tuner-simple.c
@@ -1,5 +1,5 @@
/*
- * $Id: tuner-simple.c,v 1.37 2005/07/05 17:37:35 nsh Exp $
+ * $Id: tuner-simple.c,v 1.38 2005/07/06 21:46:25 nsh Exp $
*
* i2c tv tuner chip device driver
* controls all those simple 4-control-bytes style tuners.
@@ -55,6 +55,27 @@
#define PHILIPS_MF_SET_PAL_L 0x03 // France
#define PHILIPS_MF_SET_PAL_L2 0x02 // L'
+/* Control byte */
+
+#define TUNER_RATIO_MASK 0x06 /* Bit cb1:cb2 */
+#define TUNER_RATIO_SELECT_50 0x00
+#define TUNER_RATIO_SELECT_32 0x02
+#define TUNER_RATIO_SELECT_166 0x04
+#define TUNER_RATIO_SELECT_62 0x06
+
+#define TUNER_CHARGE_PUMP 0x40 /* Bit cb6 */
+
+/* Status byte */
+
+#define TUNER_POR 0x80
+#define TUNER_FL 0x40
+#define TUNER_MODE 0x38
+#define TUNER_AFC 0x07
+#define TUNER_SIGNAL 0x07
+#define TUNER_STEREO 0x10
+
+#define TUNER_PLL_LOCKED 0x40
+#define TUNER_STEREO_MK3 0x04
/* ---------------------------------------------------------------------- */
@@ -241,15 +262,6 @@ static int tuner_getstatus(struct i2c_client *c)
return byte;
}
-#define TUNER_POR 0x80
-#define TUNER_FL 0x40
-#define TUNER_MODE 0x38
-#define TUNER_AFC 0x07
-
-#define TUNER_STEREO 0x10 /* radio mode */
-#define TUNER_STEREO_MK3 0x04 /* radio mode */
-#define TUNER_SIGNAL 0x07 /* radio mode */
-
static int tuner_signal(struct i2c_client *c)
{
return (tuner_getstatus(c) & TUNER_SIGNAL) << 13;
@@ -373,7 +385,7 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq)
case TUNER_MICROTUNE_4042FI5:
/* Set the charge pump for fast tuning */
- tun->config |= 0x40;
+ tun->config |= TUNER_CHARGE_PUMP;
break;
}
@@ -422,14 +434,13 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq)
tuner_warn("i2c i/o read error: rc == %d (should be 1)\n",rc);
break;
}
- /* bit 6 is PLL locked indicator */
- if (status_byte & 0x40)
+ if (status_byte & TUNER_PLL_LOCKED)
break;
udelay(10);
}
/* Set the charge pump for optimized phase noise figure */
- tun->config &= ~0x40;
+ tun->config &= ~TUNER_CHARGE_PUMP;
buffer[0] = (div>>8) & 0x7f;
buffer[1] = div & 0xff;
buffer[2] = tun->config;
@@ -450,9 +461,9 @@ static void default_set_radio_freq(struct i2c_client *c, unsigned int freq)
unsigned div;
int rc;
- tun=&tuners[t->type];
- div = (freq / 1000) + (int)(16*10.7);
- buffer[2] = tun->config;
+ tun = &tuners[t->type];
+ div = (20 * freq / 16000) + (int)(20*10.7); /* IF 10.7 MHz */
+ buffer[2] = (tun->config & ~TUNER_RATIO_MASK) | TUNER_RATIO_SELECT_50; /* 50 kHz step */
switch (t->type) {
case TUNER_TENA_9533_DI:
@@ -465,8 +476,7 @@ static void default_set_radio_freq(struct i2c_client *c, unsigned int freq)
buffer[3] = 0x19;
break;
case TUNER_PHILIPS_FM1256_IH3:
- div = (20 * freq) / 16000 + 333 * 2;
- buffer[2] = 0x80;
+ div = (20 * freq) / 16000 + (int)(33.3 * 20); /* IF 33.3 MHz */
buffer[3] = 0x19;
break;
case TUNER_LG_PAL_FM: