summaryrefslogtreecommitdiff
path: root/linux/drivers/media
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media')
-rw-r--r--linux/drivers/media/video/bttv-input.c4
-rw-r--r--linux/drivers/media/video/tuner-core.c157
-rw-r--r--linux/drivers/media/video/tuner-simple.c6
3 files changed, 118 insertions, 49 deletions
diff --git a/linux/drivers/media/video/bttv-input.c b/linux/drivers/media/video/bttv-input.c
index 18c36774e..71d5b0cd1 100644
--- a/linux/drivers/media/video/bttv-input.c
+++ b/linux/drivers/media/video/bttv-input.c
@@ -1,5 +1,5 @@
/*
- * $Id: bttv-input.c,v 1.1 2005/12/10 17:51:31 rmcc Exp $
+ * $Id: bttv-input.c,v 1.2 2005/12/11 17:55:45 mchehab Exp $
*
* Copyright (c) 2003 Gerd Knorr
* Copyright (c) 2003 Pavel Machek
@@ -653,7 +653,7 @@ int bttv_input_init(struct bttv *btv)
/* all done */
input_register_device(btv->remote->dev);
- printk(DEVNAME ": %s detected at %s\n",ir->dev->name,ir->dev->phys);
+ printk(DEVNAME ": %s detected at %s\n",ir->name,ir->phys);
/* the remote isn't as bouncy as a keyboard */
ir->dev->rep[REP_DELAY] = repeat_delay;
diff --git a/linux/drivers/media/video/tuner-core.c b/linux/drivers/media/video/tuner-core.c
index ccc3b1af9..aa6cadda6 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.89 2005/12/07 12:30:28 mchehab Exp $
+ * $Id: tuner-core.c,v 1.90 2005/12/11 17:55:45 mchehab Exp $
*
* i2c tv tuner chip device driver
* core core, i.e. kernel interfaces, registering and so on
@@ -23,6 +23,9 @@
#include <media/tuner.h>
#include <media/audiochip.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+#include <media/i2c-compat.h>
+#endif
#include "msp3400.h"
@@ -43,21 +46,34 @@ I2C_CLIENT_INSMOD;
/* insmod options used at init time => read/only */
static unsigned int addr = 0;
-module_param(addr, int, 0444);
-
static unsigned int no_autodetect = 0;
-module_param(no_autodetect, int, 0444);
-
static unsigned int show_i2c = 0;
-module_param(show_i2c, int, 0444);
/* insmod options used at runtime => read/write */
unsigned int tuner_debug = 0;
-module_param(tuner_debug, int, 0644);
static unsigned int tv_range[2] = { 44, 958 };
static unsigned int radio_range[2] = { 65, 108 };
+static char pal[] = "--";
+static char secam[] = "--";
+static char ntsc[] = "-";
+
+module_param(addr, int, 0444);
+module_param(no_autodetect, int, 0444);
+module_param(show_i2c, int, 0444);
+module_param(tuner_debug, int, 0644);
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+MODULE_PARM(pal,"s");
+MODULE_PARM(secam,"s");
+MODULE_PARM(ntsc,"s");
+MODULE_PARM(tv_range,"2i");
+MODULE_PARM(radio_range,"2i");
+#else
+module_param_string(pal, pal, sizeof(pal), 0644);
+module_param_string(secam, secam, sizeof(secam), 0644);
+module_param_string(ntsc, ntsc, sizeof(ntsc), 0644);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
static unsigned int dummy;
module_param_array(tv_range, int, dummy, 0644);
@@ -66,6 +82,7 @@ module_param_array(radio_range, int, dummy, 0644);
module_param_array(tv_range, int, NULL, 0644);
module_param_array(radio_range, int, NULL, 0644);
#endif
+#endif
MODULE_DESCRIPTION("device driver for various TV and TV+FM radio tuners");
MODULE_AUTHOR("Ralph Metzler, Gerd Knorr, Gunther Mayer");
@@ -155,6 +172,7 @@ static void set_type(struct i2c_client *c, unsigned int type,
return;
}
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
/* This code detects calls by card attach_inform */
if (NULL == t->i2c.dev.driver) {
tuner_dbg ("tuner 0x%02x: called during i2c_client register by adapter's attach_inform\n", c->addr);
@@ -162,6 +180,7 @@ static void set_type(struct i2c_client *c, unsigned int type,
t->type=type;
return;
}
+#endif
t->type = type;
@@ -263,11 +282,6 @@ static inline int check_mode(struct tuner *t, char *cmd)
return 0;
}
-static char pal[] = "-";
-module_param_string(pal, pal, sizeof(pal), 0644);
-static char secam[] = "--";
-module_param_string(secam, secam, sizeof(secam), 0644);
-
/* get more precise norm info from insmod option */
static int tuner_fixup_std(struct tuner *t)
{
@@ -299,8 +313,13 @@ static int tuner_fixup_std(struct tuner *t)
break;
case 'N':
case 'n':
- tuner_dbg ("insmod fixup: PAL => PAL-N\n");
- t->std = V4L2_STD_PAL_N;
+ if (pal[1] == 'c' || pal[1] == 'C') {
+ tuner_dbg("insmod fixup: PAL => PAL-Nc\n");
+ t->std = V4L2_STD_PAL_Nc;
+ } else {
+ tuner_dbg ("insmod fixup: PAL => PAL-N\n");
+ t->std = V4L2_STD_PAL_N;
+ }
break;
case '-':
/* default parameter, do nothing */
@@ -312,6 +331,15 @@ static int tuner_fixup_std(struct tuner *t)
}
if ((t->std & V4L2_STD_SECAM) == V4L2_STD_SECAM) {
switch (secam[0]) {
+ case 'b':
+ case 'B':
+ case 'g':
+ case 'G':
+ case 'h':
+ case 'H':
+ tuner_dbg("insmod fixup: SECAM => SECAM-BGH\n");
+ t->std = V4L2_STD_SECAM_B | V4L2_STD_SECAM_G | V4L2_STD_SECAM_H;
+ break;
case 'd':
case 'D':
case 'k':
@@ -338,9 +366,60 @@ static int tuner_fixup_std(struct tuner *t)
}
}
+ if ((t->std & V4L2_STD_NTSC) == V4L2_STD_NTSC) {
+ switch (ntsc[0]) {
+ case 'm':
+ case 'M':
+ tuner_dbg("insmod fixup: NTSC => NTSC-M\n");
+ t->std = V4L2_STD_NTSC_M;
+ break;
+ case 'j':
+ case 'J':
+ tuner_dbg("insmod fixup: NTSC => NTSC_M_JP\n");
+ t->std = V4L2_STD_NTSC_M_JP;
+ break;
+ case '-':
+ /* default parameter, do nothing */
+ break;
+ default:
+ tuner_info("ntsc= argument not recognised\n");
+ break;
+ }
+ }
return 0;
}
+static void tuner_status(struct i2c_client *client)
+{
+ struct tuner *t = i2c_get_clientdata(client);
+ unsigned long freq, freq_fraction;
+ const char *p;
+
+ switch (t->mode) {
+ case V4L2_TUNER_RADIO: p = "radio"; break;
+ case V4L2_TUNER_ANALOG_TV: p = "analog TV"; break;
+ case V4L2_TUNER_DIGITAL_TV: p = "digital TV"; break;
+ default: p = "undefined"; break;
+ }
+ if (t->mode == V4L2_TUNER_RADIO) {
+ freq = t->freq / 16000;
+ freq_fraction = (t->freq % 16000) * 100 / 16000;
+ } else {
+ freq = t->freq / 16;
+ freq_fraction = (t->freq % 16) * 100 / 16;
+ }
+ tuner_info("Tuner mode: %s\n", p);
+ tuner_info("Frequency: %lu.%02lu MHz\n", freq, freq_fraction);
+ tuner_info("Standard: 0x%08llx\n", t->std);
+ if (t->mode == V4L2_TUNER_RADIO) {
+ if (t->has_signal) {
+ tuner_info("Signal strength: %d\n", t->has_signal(client));
+ }
+ if (t->is_stereo) {
+ tuner_info("Stereo: %s\n", t->is_stereo(client) ? "yes" : "no");
+ }
+ }
+}
/* ---------------------------------------------------------------------- */
/* static var Used only in tuner_attach and tuner_probe */
@@ -349,7 +428,12 @@ static unsigned default_mode_mask;
/* During client attach, set_type is called by adapter's attach_inform callback.
set_type must then be completed by tuner_attach.
*/
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
+#else
+static int tuner_attach(struct i2c_adapter *adap, int addr,
+ unsigned short flags, int kind)
+#endif
{
struct tuner *t;
@@ -420,6 +504,9 @@ register_client:
tuner_info("chip found @ 0x%x (%s)\n", addr << 1, adap->name);
i2c_attach_client (&t->i2c);
set_type (&t->i2c,t->type, t->mode_mask);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+MOD_INC_USE_COUNT;
+#endif
return 0;
}
@@ -432,8 +519,13 @@ static int tuner_probe(struct i2c_adapter *adap)
default_mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV;
+#ifdef I2C_CLASS_TV_ANALOG
if (adap->class & I2C_CLASS_TV_ANALOG)
return i2c_probe(adap, &addr_data, tuner_attach);
+#else
+ if (adap->id == I2C_HW_B_BT848)
+ return i2c_probe(adap, &addr_data, tuner_attach);
+#endif
return 0;
}
@@ -449,6 +541,9 @@ static int tuner_detach(struct i2c_client *client)
return err;
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+MOD_DEC_USE_COUNT;
+#endif
kfree(t);
return 0;
}
@@ -489,38 +584,6 @@ static inline int check_v4l2(struct tuner *t)
return 0;
}
-static void tuner_status(struct i2c_client *client)
-{
- struct tuner *t = i2c_get_clientdata(client);
- unsigned long freq, freq_fraction;
- const char *p;
-
- switch (t->mode) {
- case V4L2_TUNER_RADIO: p = "radio"; break;
- case V4L2_TUNER_ANALOG_TV: p = "analog TV"; break;
- case V4L2_TUNER_DIGITAL_TV: p = "digital TV"; break;
- default: p = "undefined"; break;
- }
- if (t->mode == V4L2_TUNER_RADIO) {
- freq = t->freq / 16000;
- freq_fraction = (t->freq % 16000) * 100 / 16000;
- } else {
- freq = t->freq / 16;
- freq_fraction = (t->freq % 16) * 100 / 16;
- }
- tuner_info("Tuner mode: %s\n", p);
- tuner_info("Frequency: %lu.%02lu MHz\n", freq, freq_fraction);
- tuner_info("Standard: 0x%08llx\n", t->std);
- if (t->mode == V4L2_TUNER_RADIO) {
- if (t->has_signal) {
- tuner_info("Signal strength: %d\n", t->has_signal(client));
- }
- if (t->is_stereo) {
- tuner_info("Stereo: %s\n", t->is_stereo(client) ? "yes" : "no");
- }
- }
-}
-
static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
struct tuner *t = i2c_get_clientdata(client);
@@ -792,7 +855,9 @@ static int tuner_resume(struct device *dev, u32 level)
/* ----------------------------------------------------------------------- */
static struct i2c_driver driver = {
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
.owner = THIS_MODULE,
+#endif
.name = "tuner",
.id = I2C_DRIVERID_TUNER,
.flags = I2C_DF_NOTIFY,
diff --git a/linux/drivers/media/video/tuner-simple.c b/linux/drivers/media/video/tuner-simple.c
index e4baead24..d7ca1bc5b 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.64 2005/12/11 15:35:18 mkrufky Exp $
+ * $Id: tuner-simple.c,v 1.65 2005/12/11 17:55:45 mchehab Exp $
*
* i2c tv tuner chip device driver
* controls all those simple 4-control-bytes style tuners.
@@ -9,6 +9,10 @@
#include "compat.h"
#include <linux/videodev.h>
#include <media/tuner.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+#include <media/i2c-compat.h>
+#include <linux/moduleparam.h>
+#endif
static int offset = 0;
module_param(offset, int, 0666);