summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/tuner-core.c
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/tuner-core.c
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/tuner-core.c')
-rw-r--r--linux/drivers/media/video/tuner-core.c52
1 files changed, 35 insertions, 17 deletions
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;
}