summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <devnull@localhost>2005-06-06 04:54:42 +0000
committerMauro Carvalho Chehab <devnull@localhost>2005-06-06 04:54:42 +0000
commita1c94280a70a682e3468e3710c3f5790d22a3574 (patch)
tree53cec362b436ce2a2720e304fef42a07e4bddf8f /linux
parent8a59c7d103ce703187bbc6aa1498adfb25dbb12d (diff)
downloadmediapointer-dvb-s2-a1c94280a70a682e3468e3710c3f5790d22a3574.tar.gz
mediapointer-dvb-s2-a1c94280a70a682e3468e3710c3f5790d22a3574.tar.bz2
tea5767.c:
- Implemented status dump information for debug - Signal strengh indication corrected - Mono/Stereo detection corrected tuner-core.c: - Implemented radio stereo indication according w/ V4L and V4L2 API
Diffstat (limited to 'linux')
-rw-r--r--linux/drivers/media/video/tea5767.c48
-rw-r--r--linux/drivers/media/video/tuner-core.c27
2 files changed, 65 insertions, 10 deletions
diff --git a/linux/drivers/media/video/tea5767.c b/linux/drivers/media/video/tea5767.c
index e49a53a1b..7e68f1cd8 100644
--- a/linux/drivers/media/video/tea5767.c
+++ b/linux/drivers/media/video/tea5767.c
@@ -2,7 +2,7 @@
* For Philips TEA5767 FM Chip used on some TV Cards like Prolink Pixelview
* I2C address is allways 0xC0.
*
- * $Id: tea5767.c,v 1.1 2005/06/05 17:44:04 mchehab Exp $
+ * $Id: tea5767.c,v 1.2 2005/06/06 04:54:42 mchehab Exp $
*
* Copyright (c) 2005 Mauro Carvalho Chehab (mchehab@brturbo.com.br)
* This code is placed under the terms of the GNU General Public License
@@ -185,6 +185,39 @@ static void set_radio_freq(struct i2c_client *c, unsigned int frq)
tuner_warn("i2c i/o error: rc == %d (should be 5)\n",rc);
}
+#define PREFIX "TEA5767 "
+static void tea5767_status_dump(unsigned char *buffer)
+{
+ unsigned int div;
+
+ if (TEA5767_READY_FLAG_MASK & buffer[0])
+ printk(PREFIX "Ready Flag ON\n");
+ else
+ printk(PREFIX "Ready Flag OFF\n");
+
+ if (TEA5767_BAND_LIMIT_MASK & buffer[0])
+ printk(PREFIX "Tuner at band limit\n");
+ else
+ printk(PREFIX "Tuner not at band limit\n");
+
+ div=((buffer[0]&0x3f)<<8) | buffer[1];
+
+ printk(PREFIX "Frequency divider = 0x%4x\n",div);
+
+ if (TEA5767_STEREO_MASK & buffer[2])
+ printk(PREFIX "Stereo\n");
+ else
+ printk(PREFIX "Mono\n");
+
+ printk(PREFIX "IF Counter = %d\n",buffer[2] & TEA5767_IF_CNTR_MASK);
+
+ printk(PREFIX "ADC Level = %d\n",(buffer[3] & TEA5767_ADC_LEVEL_MASK) >> 4);
+
+ printk(PREFIX "Chip ID = %d\n",(buffer[3] & TEA5767_CHIP_ID_MASK));
+
+ printk(PREFIX "Reserved = 0x%02x\n",(buffer[4] & TEA5767_RESERVED_MASK));
+}
+
static int tea5767_signal(struct i2c_client *c)
{
unsigned char buffer[5];
@@ -198,7 +231,8 @@ static int tea5767_signal(struct i2c_client *c)
tuner_dbg("TEA5767 radio SIG GET 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",
buffer[0],buffer[1],buffer[2],buffer[3],buffer[4]);
- return ( (buffer[0] & TEA5767_READY_FLAG_MASK) ? 0x7<<13 : 0);
+ tea5767_status_dump(buffer);
+ return ((buffer[3] & TEA5767_ADC_LEVEL_MASK) <<(13-4));
}
static int tea5767_stereo(struct i2c_client *c)
@@ -211,10 +245,14 @@ static int tea5767_stereo(struct i2c_client *c)
if (5 != (rc = i2c_master_recv(c,buffer,5)))
tuner_warn ( "i2c i/o error: rc == %d (should be 5)\n",rc);
- tuner_dbg("TEA5767 radio ST GET 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",
- buffer[0],buffer[1],buffer[2],buffer[3],buffer[4]);
+// tuner_dbg("TEA5767 radio ST GET 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",
+// buffer[0],buffer[1],buffer[2],buffer[3],buffer[4]);
+
+ rc = buffer[2] & TEA5767_STEREO_MASK;
- return ( (buffer[2] & TEA5767_STEREO_MASK) ? 0x10: 0);
+ tuner_dbg("TEA5767 radio ST GET = %02x\n", rc);
+
+ return ( (buffer[2] & TEA5767_STEREO_MASK) ? V4L2_TUNER_SUB_STEREO: 0);
}
int tea5767_tuner_init(struct i2c_client *c)
diff --git a/linux/drivers/media/video/tuner-core.c b/linux/drivers/media/video/tuner-core.c
index cb954082b..f44f7d9be 100644
--- a/linux/drivers/media/video/tuner-core.c
+++ b/linux/drivers/media/video/tuner-core.c
@@ -1,5 +1,5 @@
/*
- * $Id: tuner-core.c,v 1.8 2005/06/05 17:44:04 mchehab Exp $
+ * $Id: tuner-core.c,v 1.9 2005/06/06 04:54:42 mchehab Exp $
*
* i2c tv tuner chip device driver
* core core, i.e. kernel interfaces, registering and so on
@@ -400,8 +400,15 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
CHECK_ADDR(radio_tuner,"VIDIOCGTUNER:");
CHECK_V4L2;
- if (V4L2_TUNER_RADIO == t->mode && t->has_signal)
- vt->signal = t->has_signal(client);
+ if (V4L2_TUNER_RADIO == t->mode) {
+ if (t->has_signal)
+ vt->signal = t->has_signal(client);
+ if (t->is_stereo(client))
+ vt-> flags |= VIDEO_TUNER_STEREO_ON;
+ else
+ vt-> flags &= 0xffff ^ VIDEO_TUNER_STEREO_ON;
+ }
+
return 0;
}
case VIDIOCGAUDIO:
@@ -459,8 +466,18 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
CHECK_MODE("VIDIOC_G_TUNER");
SWITCH_V4L2;
- if (V4L2_TUNER_RADIO == t->mode && t->has_signal)
- tuner->signal = t->has_signal(client);
+ if (V4L2_TUNER_RADIO == t->mode) {
+ if (t->has_signal)
+ tuner -> signal = t->has_signal(client);
+ if (t->is_stereo(client)) {
+ tuner -> capability |= V4L2_TUNER_CAP_STEREO;
+ tuner -> rxsubchans |= V4L2_TUNER_SUB_STEREO;
+ tuner_dbg("stereo");
+ } else {
+ tuner -> rxsubchans &= 0xffff ^ V4L2_TUNER_SUB_STEREO;
+ tuner_dbg("mono");
+ }
+ }
tuner->rangelow = tv_range[0] * 16;
tuner->rangehigh = tv_range[1] * 16;
break;