summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <devnull@localhost>2005-06-10 10:57:18 +0000
committerMauro Carvalho Chehab <devnull@localhost>2005-06-10 10:57:18 +0000
commit7b4d77f88caf46e29fabd3390e6aa06904ce4181 (patch)
tree8f17a34b946ee2e0a0075aeb1f96276139cfe206 /linux/drivers/media/video
parenta3fba27b25767905b9608ef9adf68ada1c04776e (diff)
downloadmediapointer-dvb-s2-7b4d77f88caf46e29fabd3390e6aa06904ce4181.tar.gz
mediapointer-dvb-s2-7b4d77f88caf46e29fabd3390e6aa06904ce4181.tar.bz2
Mostly corrected a bug when changing from audio <-> Tv mode and having separated tuners.
* tuner-core.c: - Improved debug for radio/TV tuner calls. - Corrected set radio/TV mode calls to change status go to both tuners. - Improved V4L2_TUNER_CAP_LOW support (tv_range hack) * tea5767.c: - Included a new debug message. * cx88-video.c: - Enabled V4L2_TUNER_CAP_LOW to radio.
Diffstat (limited to 'linux/drivers/media/video')
-rw-r--r--linux/drivers/media/video/cx88/cx88-video.c5
-rw-r--r--linux/drivers/media/video/tea5767.c8
-rw-r--r--linux/drivers/media/video/tuner-core.c52
3 files changed, 44 insertions, 21 deletions
diff --git a/linux/drivers/media/video/cx88/cx88-video.c b/linux/drivers/media/video/cx88/cx88-video.c
index 1ca1f94c0..e1e1d469b 100644
--- a/linux/drivers/media/video/cx88/cx88-video.c
+++ b/linux/drivers/media/video/cx88/cx88-video.c
@@ -1,5 +1,5 @@
/*
- * $Id: cx88-video.c,v 1.61 2005/06/09 11:44:24 mchehab Exp $
+ * $Id: cx88-video.c,v 1.62 2005/06/10 10:57:18 mchehab Exp $
*
* device driver for Conexant 2388x based TV cards
* video4linux video interface
@@ -1719,7 +1719,8 @@ static int radio_do_ioctl(struct inode *inode, struct file *file,
sizeof(cap->card));
sprintf(cap->bus_info,"PCI:%s", pci_name(dev->pci));
cap->version = CX88_VERSION_CODE;
- cap->capabilities = V4L2_CAP_TUNER;
+ cap->capabilities = V4L2_CAP_TUNER |
+ V4L2_TUNER_CAP_LOW;
return 0;
}
case VIDIOC_G_TUNER:
diff --git a/linux/drivers/media/video/tea5767.c b/linux/drivers/media/video/tea5767.c
index 3539babce..153e4aa90 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.5 2005/06/08 01:28:09 mchehab Exp $
+ * $Id: tea5767.c,v 1.6 2005/06/10 10:57:18 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
@@ -28,6 +28,8 @@
#include <media/tuner.h>
#endif
+#define PREFIX "TEA5767 "
+
/* Write mode register values */
/* First register */
@@ -146,6 +148,9 @@ static void set_radio_freq(struct i2c_client *c, unsigned int frq)
unsigned div;
int rc;
+ printk(PREFIX "radio freq counter %d\n",frq);
+
+
/* Rounds freq to next decimal value */
frq = 20*(frq/16)+radio_frq[frq%16];
@@ -191,7 +196,6 @@ 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;
diff --git a/linux/drivers/media/video/tuner-core.c b/linux/drivers/media/video/tuner-core.c
index 424729d58..1033b74ae 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.13 2005/06/09 11:44:24 mchehab Exp $
+ * $Id: tuner-core.c,v 1.14 2005/06/10 10:57:18 mchehab Exp $
*
* i2c tv tuner chip device driver
* core core, i.e. kernel interfaces, registering and so on
@@ -94,7 +94,7 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq)
if (freq >= tv_range[0]*16364 && freq <= tv_range[1]*16384) {
/* V4L2_TUNER_CAP_LOW frequency */
- tuner_info("V4L2_TUNER_CAP_LOW freq selected for TV. Tuners yet doesn't support converting it to valid freq.\n");
+ tuner_dbg("V4L2_TUNER_CAP_LOW freq selected for TV. Tuners yet doesn't support converting it to valid freq.\n");
t->tv_freq(c,freq>>10);
@@ -109,6 +109,7 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq)
return;
}
}
+ tuner_dbg("62.5 Khz freq step selected for TV.\n");
t->tv_freq(c,freq);
}
@@ -127,10 +128,18 @@ static void set_radio_freq(struct i2c_client *c, unsigned int freq)
if (freq < radio_range[0]*16 || freq > radio_range[1]*16) {
if (freq >= tv_range[0]*16364 && freq <= tv_range[1]*16384) {
/* V4L2_TUNER_CAP_LOW frequency */
+ if (t->type == TUNER_TEA5767) {
+ tuner_info("radio freq step 62.5Hz (%d.%06d)\n",(freq>>14),freq%(1<<14)*10000);
+ t->radio_freq(c,freq>>10);
+ return;
+ }
+
+ tuner_dbg("V4L2_TUNER_CAP_LOW freq selected for Radio. Tuners yet doesn't support converting it to valid freq.\n");
- tuner_info("V4L2_TUNER_CAP_LOW freq selected for Radio. Tuners yet doesn't support converting it to valid freq.\n");
+ tuner_info("radio freq (%d.%06d)\n",(freq>>14),freq%(1<<14)*10000);
t->radio_freq(c,freq>>10);
+ return;
} else {
tuner_info("radio freq (%d.%02d) out of range (%d-%d)\n",
@@ -139,6 +148,7 @@ static void set_radio_freq(struct i2c_client *c, unsigned int freq)
return;
}
}
+ tuner_dbg("62.5 Khz freq step selected for Radio.\n");
t->radio_freq(c,freq);
}
@@ -166,6 +176,7 @@ static void set_type(struct i2c_client *c, unsigned int type)
{
struct tuner *t = i2c_get_clientdata(c);
+ tuner_dbg ("I2C addr 0x%02x with type %d\n",c->addr<<1,type);
/* sanity check */
if (type == UNSET || type == TUNER_ABSENT)
return;
@@ -201,14 +212,15 @@ static void set_type(struct i2c_client *c, unsigned int type)
}
#ifdef CONFIG_TUNER_MULTI_I2C
-#define CHECK_ADDR(tp,cmd) if (client->addr!=tp) { \
- tuner_info ("Cmd %s to addr 0x%02x rejected.\n",cmd,client->addr<<1); \
- return 0; }
+#define CHECK_ADDR(tp,cmd,tun) if (client->addr!=tp) { \
+ return 0; } else \
+ tuner_info ("Cmd %s accepted to "tun"\n",cmd);
#define CHECK_MODE(cmd) if (t->mode == V4L2_TUNER_RADIO) { \
- CHECK_ADDR(radio_tuner,cmd) } else { CHECK_ADDR(tv_tuner,cmd); }
+ CHECK_ADDR(radio_tuner,cmd,"radio") } else \
+ { CHECK_ADDR(tv_tuner,cmd,"TV"); }
#else
-#define CHECK_ADDR(tp,cmd)
-#define CHECK_MODE(cmd)
+#define CHECK_ADDR(tp,cmd,tun) tuner_info ("Cmd %s accepted to %s".\n",cmd,tun);
+#define CHECK_MODE(cmd) tuner_info ("Cmd %s accepted".\n",cmd);
#endif
#ifdef CONFIG_TUNER_MULTI_I2C
@@ -374,15 +386,15 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
set_addr(client,(struct tuner_addr *)arg);
break;
case AUDC_SET_RADIO:
- CHECK_ADDR(radio_tuner,"AUDC_SET_RADIO");
+ t->mode = V4L2_TUNER_RADIO;
+ CHECK_ADDR(tv_tuner,"AUDC_SET_RADIO","TV");
if (V4L2_TUNER_RADIO != t->mode) {
set_tv_freq(client,400 * 16);
- t->mode = V4L2_TUNER_RADIO;
}
break;
case AUDC_CONFIG_PINNACLE:
- CHECK_ADDR(tv_tuner,"AUDC_CONFIG_PINNACLE");
+ CHECK_ADDR(tv_tuner,"AUDC_CONFIG_PINNACLE","TV");
switch (*iarg) {
case 2:
tuner_dbg("pinnacle pal\n");
@@ -410,9 +422,10 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
};
struct video_channel *vc = arg;
- CHECK_ADDR(tv_tuner,"VIDIOCSCHAN");
CHECK_V4L2;
t->mode = V4L2_TUNER_ANALOG_TV;
+ CHECK_ADDR(tv_tuner,"VIDIOCSCHAN","TV");
+
if (vc->norm < ARRAY_SIZE(map))
t->std = map[vc->norm];
tuner_fixup_std(t);
@@ -433,7 +446,7 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
struct video_tuner *vt = arg;
- CHECK_ADDR(radio_tuner,"VIDIOCGTUNER:");
+ CHECK_ADDR(radio_tuner,"VIDIOCGTUNER","radio");
CHECK_V4L2;
if (V4L2_TUNER_RADIO == t->mode) {
if (t->has_signal)
@@ -453,7 +466,7 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
struct video_audio *va = arg;
- CHECK_ADDR(radio_tuner,"VIDIOCGAUDIO");
+ CHECK_ADDR(radio_tuner,"VIDIOCGAUDIO","radio");
CHECK_V4L2;
if (V4L2_TUNER_RADIO == t->mode && t->is_stereo)
va->mode = t->is_stereo(client)
@@ -466,9 +479,10 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
v4l2_std_id *id = arg;
- CHECK_ADDR(tv_tuner,"VIDIOC_S_STD");
SWITCH_V4L2;
t->mode = V4L2_TUNER_ANALOG_TV;
+ CHECK_ADDR(tv_tuner,"VIDIOC_S_STD","TV");
+
t->std = *id;
tuner_fixup_std(t);
if (t->freq)
@@ -516,11 +530,15 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
}
}
}
+ /* Wow to deal with V4L2_TUNER_CAP_LOW ? For now, it accepts from low at 62.5KHz step to high at 62.5 Hz */
tuner->rangelow = tv_range[0] * 16;
- tuner->rangehigh = tv_range[1] * 16;
+// tuner->rangehigh = tv_range[1] * 16;
+// tuner->rangelow = tv_range[0] * 16384;
+ tuner->rangehigh = tv_range[1] * 16384;
break;
}
default:
+ tuner_dbg ("Unimplemented IOCTL 0x%08x called to tuner.\n", cmd);
/* nothing */
break;
}