summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/tuner-core.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <devnull@localhost>2005-06-15 02:43:03 +0000
committerMauro Carvalho Chehab <devnull@localhost>2005-06-15 02:43:03 +0000
commit9ca80dc4f0206c43b06abe9a42637b5e634874f5 (patch)
treeba69f6cb6f081879e03fe48af2b621026df2f953 /linux/drivers/media/video/tuner-core.c
parent91d384425a9324c328c5f2c3e648d40ddfc76c19 (diff)
downloadmediapointer-dvb-s2-9ca80dc4f0206c43b06abe9a42637b5e634874f5.tar.gz
mediapointer-dvb-s2-9ca80dc4f0206c43b06abe9a42637b5e634874f5.tar.bz2
I2C API has changed on 2.6.12-rc6-mm1: I2C_CLIENT_INSMOD macro now doesn't
require nor uses normal_i2c_range. A new define (CONFIG_USE_I2C_RANGE) is provided to provide compatibility. It is meant to be replaced by a kernel version test after aplyed to mainstream. This patch corrects it. High precision tunning on Radio is correclty supported. Some radio apps already uses it. There's an auto-detection process to check tuner range. Detailed info: * Make.config, Makefile, tuner-core.c: - CONFIG_TUNER_MULTI_I2C dropped from tuner-core.c and included on Make.config - included CONFIG_USE_I2C_RANGE for kernels that requires normal_i2c_range struct (only kernels after 2.6.12-rc6-mm1 doesn't require). * bt832.c, msp3400.c, saa6752hs.c, tda7432.c, tda9875.c, tda9887.c, tuner-core.c,tvaudio.c, tveeprom.c, - I2C range detection corrected to new behavior of 2.6.12-rc6-mm1 * cx88-video.c, tea5767, tuner-core.c: - V4L2_TUNER_CAP_LOW implemented according with V4L2 API for Radio. - tea5767 debug improved. * .bp/2.6/v4l-driver-doc - typo corrected. Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Diffstat (limited to 'linux/drivers/media/video/tuner-core.c')
-rw-r--r--linux/drivers/media/video/tuner-core.c51
1 files changed, 30 insertions, 21 deletions
diff --git a/linux/drivers/media/video/tuner-core.c b/linux/drivers/media/video/tuner-core.c
index 5f24ab97f..ca55bd188 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.16 2005/06/14 22:52:59 hhackmann Exp $
+ * $Id: tuner-core.c,v 1.17 2005/06/15 02:43:03 mchehab Exp $
*
* i2c tv tuner chip device driver
* core core, i.e. kernel interfaces, registering and so on
@@ -27,19 +27,19 @@
/*
* comment line bellow to return to old behavor, where only one I2C device is supported
*/
-#define CONFIG_TUNER_MULTI_I2C /**/
#define UNSET (-1U)
/* standard i2c insmod options */
static unsigned short normal_i2c[] = {
0x4b, /* tda8290 */
+ 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
I2C_CLIENT_END
};
-static unsigned short normal_i2c_range[] = {
- 0x60, 0x6f,
- I2C_CLIENT_END
-};
+#ifdef CONFIG_USE_I2C_RANGE
+static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
+#endif
I2C_CLIENT_INSMOD;
/* insmod options used at init time => read/only */
@@ -90,13 +90,12 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq)
return;
}
if (freq < tv_range[0]*16 || freq > tv_range[1]*16) {
-
- if (freq >= tv_range[0]*16364 && freq <= tv_range[1]*16384) {
+ if (freq >= tv_range[0]*16000 && freq <= tv_range[1]*16000) {
/* V4L2_TUNER_CAP_LOW frequency */
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);
+ t->tv_freq(c,freq/1000);
return;
} else {
@@ -126,17 +125,18 @@ static void set_radio_freq(struct i2c_client *c, unsigned int freq)
return;
}
if (freq < radio_range[0]*16 || freq > radio_range[1]*16) {
- if (freq >= tv_range[0]*16364 && freq <= tv_range[1]*16384) {
+ if (freq >= radio_range[0]*16000 && freq <= radio_range[1]*16000) {
/* 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);
+ tuner_info("radio freq step 62.5Hz (%d.%06d)\n",
+ freq/16000,freq%16000*1000/16);
+ t->radio_freq(c,freq);
return;
}
tuner_dbg("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);
+ tuner_info("radio freq (%d.%02d)\n",(freq/16000),freq%16000*100/16000);
t->radio_freq(c,freq>>10);
return;
@@ -332,9 +332,8 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
static int tuner_probe(struct i2c_adapter *adap)
{
if (0 != addr) {
- normal_i2c[0] = addr;
- normal_i2c_range[0] = addr;
- normal_i2c_range[1] = addr;
+ normal_i2c[0] = addr;
+ normal_i2c[1] = I2C_CLIENT_END;
}
this_adap = 0;
@@ -457,6 +456,13 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
vt-> flags &= 0xffff ^ VIDEO_TUNER_STEREO_ON;
}
vt->flags |= V4L2_TUNER_CAP_LOW; /* Allow freqs at 62.5 Hz */
+
+ vt->rangelow = radio_range[0] * 16000;
+ vt->rangehigh = radio_range[1] * 16000;
+
+ } else {
+ vt->rangelow = tv_range[0] * 16;
+ vt->rangehigh = tv_range[1] * 16;
}
return 0;
@@ -528,12 +534,15 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
tuner -> rxsubchans &= 0xffff ^ V4L2_TUNER_SUB_STEREO;
}
}
+ tuner -> capability |= V4L2_TUNER_CAP_LOW;
+
+ tuner->rangelow = radio_range[0] * 16000;
+ tuner->rangehigh = radio_range[1] * 16000;
+
+ } else {
+ tuner->rangelow = tv_range[0] * 16;
+ tuner->rangehigh = tv_range[1] * 16;
}
- /* 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->rangelow = tv_range[0] * 16384;
- tuner->rangehigh = tv_range[1] * 16384;
break;
}
default: