Commit 7541c77e authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[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.
parent 61ac12a0
......@@ -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) {
......
......@@ -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 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment