summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2004-02-18 04:59:42 -0800
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-02-18 04:59:42 -0800
commit7541c77e4d038366d5642701a511ade2ccd1138d (patch)
tree37eb187398cabc9709f2548d21289ab51b2b61ea
parent61ac12a0eb10224867fa820a5639a7b1feca7bf5 (diff)
[PATCH] tuner driver fixes
From: Gerd Knorr <kraxel@bytesex.org> "options tuner type=2" is just there for historical reasons and should only be used/needed if the main driver doesn't allow to configure the tuner type. I'm not sure whenever I can remove that altogether without breaking anything. There are several users of the tuner module, some outside the standard kernel tree ... > > if (type < TUNERS) { > > + t->type = type; > > printk("tuner: type forced to %d (%s) [insmod]\n", > > t->type,tuners[t->type].name); > > set_type(client,type); That is wrong, it will break in other corner cases, it may cause the set_type() function not doing the initializations. The prink can also be dropped because set_type does that too. The patch below removes that. It also makes the kernel messages a bit more verbose and adds support for two new tuners.
-rw-r--r--drivers/media/video/tuner.c28
-rw-r--r--include/media/tuner.h4
2 files changed, 20 insertions, 12 deletions
diff --git a/drivers/media/video/tuner.c b/drivers/media/video/tuner.c
index 3814c8393f0c..18009430c59d 100644
--- a/drivers/media/video/tuner.c
+++ b/drivers/media/video/tuner.c
@@ -234,6 +234,12 @@ static struct tunertype tuners[] = {
16*157.25,16*454.00,0xa0,0x90,0x30,0x8e,732},
{ "Philips NTSC MK3 (FM1236MK3 or FM1236/F)", Philips, NTSC,
16*160.00,16*442.00,0x01,0x02,0x04,0x8,732},
+
+ { "Philips 4 in 1 (ATI TV Wonder Pro/Conexant)", Philips, NTSC,
+ 16*160.00,16*442.00,0x01,0x02,0x04,0x8e,732},
+ { "Microtune 4049 FM5",Microtune,PAL,
+ 16*141.00,16*464.00,0xa0,0x90,0x30,0x8e,623},
+
};
#define TUNERS ARRAY_SIZE(tuners)
@@ -984,19 +990,22 @@ static void set_radio_freq(struct i2c_client *c, unsigned int freq)
t->radio_freq(c,freq);
}
-static void set_type(struct i2c_client *c, unsigned int type)
+static void set_type(struct i2c_client *c, unsigned int type, char *source)
{
struct tuner *t = i2c_get_clientdata(c);
if (t->type != UNSET) {
- printk("tuner: type already set (%d)\n",t->type);
+ if (t->type != type)
+ printk("tuner: type already set to %d, "
+ "ignoring request for %d\n", t->type, type);
return;
}
if (type >= TUNERS)
return;
t->type = type;
- printk("tuner: type set to %d (%s)\n", t->type,tuners[t->type].name);
+ printk("tuner: type set to %d (%s) by %s\n",
+ t->type,tuners[t->type].name, source);
strlcpy(c->name, tuners[t->type].name, sizeof(c->name));
switch (t->type) {
@@ -1024,7 +1033,8 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
client_template.adapter = adap;
client_template.addr = addr;
- printk("tuner: chip found @ 0x%x\n", addr<<1);
+ printk("tuner: chip found at addr 0x%x i2c-bus %s\n",
+ addr<<1, adap->name);
if (NULL == (client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL)))
return -ENOMEM;
@@ -1040,12 +1050,8 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
t->radio_if2 = 10700*1000; // 10.7MHz - FM radio
i2c_attach_client(client);
- if (type < TUNERS) {
- t->type = type;
- printk("tuner: type forced to %d (%s) [insmod]\n",
- t->type,tuners[t->type].name);
- set_type(client,type);
- }
+ if (type < TUNERS)
+ set_type(client, type, "insmod option");
return 0;
}
@@ -1094,7 +1100,7 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
/* --- configuration --- */
case TUNER_SET_TYPE:
- set_type(client,*iarg);
+ set_type(client,*iarg,client->adapter->name);
break;
case AUDC_SET_RADIO:
if (!t->radio) {
diff --git a/include/media/tuner.h b/include/media/tuner.h
index 15657395aa12..fb571d5965d8 100644
--- a/include/media/tuner.h
+++ b/include/media/tuner.h
@@ -67,7 +67,9 @@
#define TUNER_HITACHI_NTSC 40
#define TUNER_PHILIPS_PAL_MK 41
#define TUNER_PHILIPS_ATSC 42
-#define TUNER_PHILIPS_FM1236_MK3 43
+#define TUNER_PHILIPS_FM1236_MK3 43
+#define TUNER_PHILIPS_4IN1 44 /* ATI TV Wonder Pro - Conexant */
+#define TUNER_MICROTUNE_4049FM5 45
#define NOTUNER 0
#define PAL 1 /* PAL_BG */