summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--linux/drivers/media/video/bttv-cards.c12
-rw-r--r--linux/drivers/media/video/bttv-driver.c4
-rw-r--r--linux/drivers/media/video/bttv-i2c.c12
-rw-r--r--linux/drivers/media/video/cx88/cx88-i2c.c20
-rw-r--r--linux/drivers/media/video/cx88/cx88-video.c20
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-cards.c79
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-core.c77
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-i2c.c31
-rw-r--r--linux/drivers/media/video/tda8290.c4
-rw-r--r--linux/drivers/media/video/tea5767.c31
-rw-r--r--linux/drivers/media/video/tuner-core.c174
-rw-r--r--linux/drivers/media/video/tuner-simple.c4
-rw-r--r--linux/include/media/tuner.h25
-rw-r--r--v4l/ChangeLog7
14 files changed, 246 insertions, 254 deletions
diff --git a/linux/drivers/media/video/bttv-cards.c b/linux/drivers/media/video/bttv-cards.c
index 35d7fab28..b89f6cb2f 100644
--- a/linux/drivers/media/video/bttv-cards.c
+++ b/linux/drivers/media/video/bttv-cards.c
@@ -1,5 +1,5 @@
/*
- $Id: bttv-cards.c,v 1.52 2005/07/02 16:24:34 mkrufky Exp $
+ $Id: bttv-cards.c,v 1.53 2005/07/05 17:37:35 nsh Exp $
bttv-cards.c
@@ -2826,13 +2826,13 @@ void __devinit bttv_init_card2(struct bttv *btv)
bttv_call_i2c_clients(btv, AUDC_CONFIG_PINNACLE,
&btv->pinnacle_id);
if (btv->tuner_type != UNSET) {
- struct tuner_addr tun_addr;
+ struct tuner_setup tun_setup;
- tun_addr.state = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV;
- tun_addr.type = btv->tuner_type;
- tun_addr.addr = ADDR_UNSET;
+ tun_setup.mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV;
+ tun_setup.type = btv->tuner_type;
+ tun_setup.addr = ADDR_UNSET;
- bttv_call_i2c_clients(btv, TUNER_SET_TYPE_ADDR, &tun_addr);
+ bttv_call_i2c_clients(btv, TUNER_SET_TYPE_ADDR, &tun_setup);
}
btv->svhs = bttv_tvcards[btv->c.type].svhs;
diff --git a/linux/drivers/media/video/bttv-driver.c b/linux/drivers/media/video/bttv-driver.c
index 014d61398..7897769e8 100644
--- a/linux/drivers/media/video/bttv-driver.c
+++ b/linux/drivers/media/video/bttv-driver.c
@@ -1,5 +1,5 @@
/*
- $Id: bttv-driver.c,v 1.41 2005/06/22 22:31:38 nsh Exp $
+ $Id: bttv-driver.c,v 1.42 2005/07/05 17:37:35 nsh Exp $
bttv - Bt848 frame grabber driver
@@ -1857,7 +1857,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
if (unlikely(f->tuner != 0))
return -EINVAL;
- if (unlikely(f->type != V4L2_TUNER_ANALOG_TV))
+ if (unlikely (f->type != V4L2_TUNER_ANALOG_TV))
return -EINVAL;
down(&btv->lock);
btv->freq = f->frequency;
diff --git a/linux/drivers/media/video/bttv-i2c.c b/linux/drivers/media/video/bttv-i2c.c
index ce7f5ae8a..c767d6a27 100644
--- a/linux/drivers/media/video/bttv-i2c.c
+++ b/linux/drivers/media/video/bttv-i2c.c
@@ -1,5 +1,5 @@
/*
- $Id: bttv-i2c.c,v 1.24 2005/07/03 13:41:38 mchehab Exp $
+ $Id: bttv-i2c.c,v 1.25 2005/07/05 17:37:35 nsh Exp $
bttv-i2c.c -- all the i2c code is here
@@ -303,13 +303,13 @@ static int attach_inform(struct i2c_client *client)
return 0;
if (btv->tuner_type != UNSET) {
- struct tuner_addr tun_addr;
+ struct tuner_setup tun_setup;
- tun_addr.state = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV;
- tun_addr.type = btv->tuner_type;
- tun_addr.addr = ADDR_UNSET;
+ tun_setup.mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV;
+ tun_setup.type = btv->tuner_type;
+ tun_setup.addr = ADDR_UNSET;
- client->driver->command(client,TUNER_SET_TYPE_ADDR, &tun_addr);
+ client->driver->command (client, TUNER_SET_TYPE_ADDR, &tun_setup);
}
if (btv->pinnacle_id != UNSET)
diff --git a/linux/drivers/media/video/cx88/cx88-i2c.c b/linux/drivers/media/video/cx88/cx88-i2c.c
index 7f1f4a6c5..8403c4e95 100644
--- a/linux/drivers/media/video/cx88/cx88-i2c.c
+++ b/linux/drivers/media/video/cx88/cx88-i2c.c
@@ -1,5 +1,5 @@
/*
- $Id: cx88-i2c.c,v 1.27 2005/07/03 13:41:38 mchehab Exp $
+ $Id: cx88-i2c.c,v 1.28 2005/07/05 17:37:35 nsh Exp $
cx88-i2c.c -- all the i2c code is here
@@ -91,7 +91,7 @@ static int cx8800_bit_getsda(void *data)
static int attach_inform(struct i2c_client *client)
{
- struct tuner_addr tun_addr;
+ struct tuner_setup tun_setup;
struct cx88_core *core = i2c_get_adapdata(client->adapter);
dprintk(1, "%s i2c attach [addr=0x%x,client=%s]\n",
@@ -101,21 +101,21 @@ static int attach_inform(struct i2c_client *client)
if (core->radio_type != UNSET) {
if ((core->radio_addr==ADDR_UNSET)||(core->radio_addr==client->addr)) {
- tun_addr.state = T_RADIO;
- tun_addr.type = core->radio_type;
- tun_addr.addr = core->radio_addr;
+ tun_setup.mode_mask = T_RADIO;
+ tun_setup.type = core->radio_type;
+ tun_setup.addr = core->radio_addr;
- client->driver->command(client,TUNER_SET_TYPE_ADDR, &tun_addr);
+ client->driver->command (client, TUNER_SET_TYPE_ADDR, &tun_setup);
}
}
if (core->tuner_type != UNSET) {
if ((core->tuner_addr==ADDR_UNSET)||(core->tuner_addr==client->addr)) {
- tun_addr.state = T_ANALOG_TV;
- tun_addr.type = core->tuner_type;
- tun_addr.addr = core->tuner_addr;
+ tun_setup.mode_mask = T_ANALOG_TV;
+ tun_setup.type = core->tuner_type;
+ tun_setup.addr = core->tuner_addr;
- client->driver->command(client,TUNER_SET_TYPE_ADDR, &tun_addr);
+ client->driver->command (client,TUNER_SET_TYPE_ADDR, &tun_setup);
}
}
diff --git a/linux/drivers/media/video/cx88/cx88-video.c b/linux/drivers/media/video/cx88/cx88-video.c
index 350e63db7..fc6432e99 100644
--- a/linux/drivers/media/video/cx88/cx88-video.c
+++ b/linux/drivers/media/video/cx88/cx88-video.c
@@ -1,5 +1,5 @@
/*
- * $Id: cx88-video.c,v 1.76 2005/07/04 16:05:50 mkrufky Exp $
+ * $Id: cx88-video.c,v 1.77 2005/07/05 17:37:35 nsh Exp $
*
* device driver for Conexant 2388x based TV cards
* video4linux video interface
@@ -2025,7 +2025,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
struct cx8800_dev *dev;
struct cx88_core *core;
#if 0
- struct tuner_addr tun_addr;
+ struct tuner_setup tun_setup;
#endif
int err;
@@ -2102,18 +2102,18 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
request_module("tda9887");
#if 0 /* cx88-i2c has already this function */
if (core->radio_type != UNSET) {
- tun_addr.state = T_RADIO;
- tun_addr.type = core->radio_type;
- tun_addr.addr = core->radio_addr;
- cx88_call_i2c_clients(dev->core,TUNER_SET_TYPE_ADDR, &tun_addr);
+ tun_setup.mode_mask = T_RADIO;
+ tun_setup.type = core->radio_type;
+ tun_setup.addr = core->radio_addr;
+ cx88_call_i2c_clients (dev->core, TUNER_SET_TYPE_ADDR, &tun_setup);
}
if (core->tuner_type != UNSET) {
- tun_addr.state = T_ANALOG_TV;
- tun_addr.type = core->tuner_type;
- tun_addr.addr = core->tuner_addr;
+ tun_setup.mode_mask = T_ANALOG_TV;
+ tun_setup.type = core->tuner_type;
+ tun_setup.addr = core->tuner_addr;
- cx88_call_i2c_clients(dev->core,TUNER_SET_TYPE_ADDR, &tun_addr);
+ cx88_call_i2c_clients(dev->core, TUNER_SET_TYPE_ADDR, &tun_setup);
}
if (core->tda9887_conf)
diff --git a/linux/drivers/media/video/saa7134/saa7134-cards.c b/linux/drivers/media/video/saa7134/saa7134-cards.c
index f69567c16..a6a5d90e7 100644
--- a/linux/drivers/media/video/saa7134/saa7134-cards.c
+++ b/linux/drivers/media/video/saa7134/saa7134-cards.c
@@ -1,5 +1,5 @@
/*
- * $Id: saa7134-cards.c,v 1.78 2005/07/02 16:24:34 mkrufky Exp $
+ * $Id: saa7134-cards.c,v 1.79 2005/07/05 17:37:35 nsh Exp $
*
* device driver for philips saa7134 based TV cards
* card-specific stuff.
@@ -2527,13 +2527,80 @@ int saa7134_board_init2(struct saa7134_dev *dev)
dev->tuner_type = saa7134_boards[dev->board].tuner_type;
if (TUNER_ABSENT != dev->tuner_type) {
- struct tuner_addr tun_addr;
+ struct tuner_setup tun_setup;
- tun_addr.state = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV;
- tun_addr.type = dev->tuner_type;
- tun_addr.addr = ADDR_UNSET;
+ tun_setup.mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV;
+ tun_setup.type = dev->tuner_type;
+ tun_setup.addr = ADDR_UNSET;
- saa7134_i2c_call_clients(dev, TUNER_SET_TYPE_ADDR, &tun_addr);
+ saa7134_i2c_call_clients (dev, TUNER_SET_TYPE_ADDR, &tun_setup);
+ }
+ break;
+ case SAA7134_BOARD_MD7134:
+ {
+ struct tuner_setup tun_setup;
+ u8 subaddr;
+ u8 data[3];
+ int ret, tuner_t;
+
+ struct i2c_msg msg[] = {{.addr=0x50, .flags=0, .buf=&subaddr, .len = 1},
+ {.addr=0x50, .flags=I2C_M_RD, .buf=data, .len = 3}};
+ subaddr= 0x14;
+ tuner_t = 0;
+ ret = i2c_transfer(&dev->i2c_adap, msg, 2);
+ if (ret != 2) {
+ printk(KERN_ERR "EEPROM read failure\n");
+ } else if ((data[0] != 0) && (data[0] != 0xff)) {
+ /* old config structure */
+ subaddr = data[0] + 2;
+ msg[1].len = 2;
+ i2c_transfer(&dev->i2c_adap, msg, 2);
+ tuner_t = (data[0] << 8) + data[1];
+ switch (tuner_t){
+ case 0x0103:
+ dev->tuner_type = TUNER_PHILIPS_PAL;
+ break;
+ case 0x010C:
+ dev->tuner_type = TUNER_PHILIPS_FM1216ME_MK3;
+ break;
+ default:
+ printk(KERN_ERR "%s Cant determine tuner type %x from EEPROM\n", dev->name, tuner_t);
+ }
+ } else if ((data[1] != 0) && (data[1] != 0xff)) {
+ /* new config structure */
+ subaddr = data[1] + 1;
+ msg[1].len = 1;
+ i2c_transfer(&dev->i2c_adap, msg, 2);
+ subaddr = data[0] + 1;
+ msg[1].len = 2;
+ i2c_transfer(&dev->i2c_adap, msg, 2);
+ tuner_t = (data[1] << 8) + data[0];
+ switch (tuner_t) {
+ case 0x0005:
+ dev->tuner_type = TUNER_PHILIPS_FM1216ME_MK3;
+ break;
+ case 0x001d:
+ dev->tuner_type = TUNER_PHILIPS_FMD1216ME_MK3;
+ printk(KERN_INFO "%s Board has DVB-T\n", dev->name);
+ break;
+ default:
+ printk(KERN_ERR "%s Cant determine tuner type %x from EEPROM\n", dev->name, tuner_t);
+ }
+ } else {
+ printk(KERN_ERR "%s unexpected config structure\n", dev->name);
+ }
+
+ printk(KERN_INFO "%s Tuner type is %d\n", dev->name, dev->tuner_type);
+ if (dev->tuner_type == TUNER_PHILIPS_FMD1216ME_MK3) {
+ dev->tda9887_conf = TDA9887_PRESENT | TDA9887_PORT1_ACTIVE | TDA9887_PORT2_ACTIVE;
+ saa7134_i2c_call_clients(dev,TDA9887_SET_CONFIG, &dev->tda9887_conf);
+ }
+
+ tun_setup.mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV;
+ tun_setup.type = dev->tuner_type;
+ tun_setup.addr = ADDR_UNSET;
+
+ saa7134_i2c_call_clients (dev, TUNER_SET_TYPE_ADDR,&tun_setup);
}
break;
}
diff --git a/linux/drivers/media/video/saa7134/saa7134-core.c b/linux/drivers/media/video/saa7134/saa7134-core.c
index 16c4bb041..689453f2f 100644
--- a/linux/drivers/media/video/saa7134/saa7134-core.c
+++ b/linux/drivers/media/video/saa7134/saa7134-core.c
@@ -1,5 +1,5 @@
/*
- * $Id: saa7134-core.c,v 1.38 2005/07/02 16:24:34 mkrufky Exp $
+ * $Id: saa7134-core.c,v 1.39 2005/07/05 17:37:35 nsh Exp $
*
* device driver for philips saa7134 based TV cards
* driver core
@@ -996,80 +996,6 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
msleep(100);
saa7134_i2c_register(dev);
- /* Hac: cards with this id have different tuners, find the type in the eeprom
- and patch the data structures if necessary
- */
- if (dev->board == SAA7134_BOARD_MD7134) {
- struct tuner_addr tun_addr;
- u8 subaddr;
- u8 data[3];
- int ret, tuner_t;
-
- struct i2c_msg msg[] = {{.addr=0x50, .flags=0, .buf=&subaddr, .len = 1},
- {.addr=0x50, .flags=I2C_M_RD, .buf=data, .len = 3}};
- subaddr= 0x14;
- tuner_t = 0;
- ret = i2c_transfer(&dev->i2c_adap, msg, 2);
- if (ret != 2) {
- printk(KERN_ERR "EEPROM read failure\n");
- } else {
- if ((data[0] != 0) && (data[0] != 0xff)) {
- /* Hac: old config structure */
- subaddr = data[0] + 2;
- msg[1].len = 2;
- i2c_transfer(&dev->i2c_adap, msg, 2);
- tuner_t = (data[0] << 8) + data[1];
- switch (tuner_t){
- case 0x0103:
- dev->tuner_type = TUNER_PHILIPS_PAL;
- break;
- case 0x010C:
- dev->tuner_type = TUNER_PHILIPS_FM1216ME_MK3;
- break;
- default:
- printk(KERN_ERR "%s Cant determine tuner type %x from EEPROM\n", dev->name, tuner_t);
- }
- } else {
- if ((data[1] != 0) && (data[1] != 0xff)) {
- /* Hac: new config structure */
- subaddr = data[1] + 1;
- msg[1].len = 1;
- i2c_transfer(&dev->i2c_adap, msg, 2);
- subaddr = data[0] + 1;
- msg[1].len = 2;
- i2c_transfer(&dev->i2c_adap, msg, 2);
- tuner_t = (data[1] << 8) + data[0];
- switch (tuner_t){
- case 0x0005:
- dev->tuner_type = TUNER_PHILIPS_FM1216ME_MK3;
- break;
- case 0x001d:
- dev->tuner_type = TUNER_PHILIPS_FMD1216ME_MK3;
- printk(KERN_INFO "%s Board has DVB-T\n", dev->name);
- break;
- default:
- printk(KERN_ERR "%s Cant determine tuner type %x from EEPROM\n", dev->name, tuner_t);
- }
- } else {
- printk(KERN_ERR "%s unexpected config structure\n", dev->name);
- }
- }
- }
- printk(KERN_INFO "%s Tuner type is %d\n", dev->name, dev->tuner_type);
- saa7134_boards[SAA7134_BOARD_MD7134].tuner_type = dev->tuner_type;
- if (dev->tuner_type == TUNER_PHILIPS_FMD1216ME_MK3) {
- dev->tda9887_conf = TDA9887_PRESENT | TDA9887_PORT1_ACTIVE | TDA9887_PORT2_ACTIVE;
- saa7134_boards[SAA7134_BOARD_MD7134].tda9887_conf = dev->tda9887_conf;
- saa7134_i2c_call_clients(dev,TDA9887_SET_CONFIG, &dev->tda9887_conf);
- }
-
- tun_addr.state = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV;
- tun_addr.type = dev->tuner_type;
- tun_addr.addr = ADDR_UNSET;
-
- saa7134_i2c_call_clients(dev,TUNER_SET_TYPE_ADDR,&tun_addr);
- }
-
/* initialize hardware #2 */
saa7134_board_init2(dev);
saa7134_hwinit2(dev);
@@ -1083,6 +1009,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
request_module("saa6752hs");
request_module_depend("saa7134-empress",&need_empress);
}
+
if (card_is_dvb(dev))
request_module_depend("saa7134-dvb",&need_dvb);
diff --git a/linux/drivers/media/video/saa7134/saa7134-i2c.c b/linux/drivers/media/video/saa7134/saa7134-i2c.c
index 4e2b17a8f..3a71fa42a 100644
--- a/linux/drivers/media/video/saa7134/saa7134-i2c.c
+++ b/linux/drivers/media/video/saa7134/saa7134-i2c.c
@@ -1,5 +1,5 @@
/*
- * $Id: saa7134-i2c.c,v 1.17 2005/07/04 17:06:39 mchehab Exp $
+ * $Id: saa7134-i2c.c,v 1.18 2005/07/05 17:37:35 nsh Exp $
*
* device driver for philips saa7134 based TV cards
* i2c interface support
@@ -334,7 +334,7 @@ static int attach_inform(struct i2c_client *client)
struct saa7134_dev *dev = client->adapter->algo_data;
int tuner = dev->tuner_type;
int conf = dev->tda9887_conf;
- struct tuner_addr tun_addr;
+ struct tuner_setup tun_setup;
d1printk( "%s i2c attach [addr=0x%x,client=%s]\n",
client->driver->name,client->addr,i2c_clientname(client));
@@ -342,25 +342,28 @@ static int attach_inform(struct i2c_client *client)
if (!client->driver->command)
return 0;
- tun_addr.type = saa7134_boards[dev->board].radio_type;
- if ( tun_addr.type != UNSET) {
- tun_addr.addr = saa7134_boards[dev->board].radio_addr;
+ if (saa7134_boards[dev->board].radio_type != UNSET) {
+
+ tun_setup.type = saa7134_boards[dev->board].radio_type;
+ tun_setup.addr = saa7134_boards[dev->board].radio_addr;
- if ((tun_addr.addr==ADDR_UNSET)||(tun_addr.addr==client->addr)) {
- tun_addr.state = T_RADIO;
+ if ((tun_setup.addr == ADDR_UNSET) || (tun_setup.addr == client->addr)) {
+ tun_setup.mode_mask = T_RADIO;
- client->driver->command(client,TUNER_SET_TYPE_ADDR, &tun_addr);
+ client->driver->command(client, TUNER_SET_TYPE_ADDR, &tun_setup);
}
}
- tun_addr.type = tuner;
- if (tun_addr.type != UNSET) {
- tun_addr.addr = saa7134_boards[dev->board].tuner_addr;
- if ((tun_addr.addr==ADDR_UNSET)||(tun_addr.addr==client->addr)) {
+ if (tuner != UNSET) {
- tun_addr.state = T_ANALOG_TV;
+ tun_setup.type = tuner;
+ tun_setup.addr = saa7134_boards[dev->board].tuner_addr;
- client->driver->command(client,TUNER_SET_TYPE_ADDR, &tun_addr);
+ if ((tun_setup.addr == ADDR_UNSET)||(tun_setup.addr == client->addr)) {
+
+ tun_setup.mode_mask = T_ANALOG_TV;
+
+ client->driver->command(client,TUNER_SET_TYPE_ADDR, &tun_setup);
}
}
diff --git a/linux/drivers/media/video/tda8290.c b/linux/drivers/media/video/tda8290.c
index 44ea3c1e9..3c7f8c4c2 100644
--- a/linux/drivers/media/video/tda8290.c
+++ b/linux/drivers/media/video/tda8290.c
@@ -1,5 +1,5 @@
/*
- * $Id: tda8290.c,v 1.13 2005/06/28 23:41:47 mkrufky Exp $
+ * $Id: tda8290.c,v 1.14 2005/07/05 17:37:35 nsh Exp $
*
* i2c tv tuner chip device driver
* controls the philips tda8290+75 tuner chip combo.
@@ -141,7 +141,7 @@ static void set_frequency(struct tuner *t, u16 ifc, unsigned int freq)
{
u32 N;
- if (t->mode == V4L2_TUNER_RADIO)
+ if (t->mode == T_RADIO)
freq = freq / 1000;
N = (((freq<<3)+ifc)&0x3fffc);
diff --git a/linux/drivers/media/video/tea5767.c b/linux/drivers/media/video/tea5767.c
index 38061f94e..f34dc46b0 100644
--- a/linux/drivers/media/video/tea5767.c
+++ b/linux/drivers/media/video/tea5767.c
@@ -2,7 +2,7 @@
* For Philips TEA5767 FM Chip used on some TV Cards like Prolink Pixelview
* I2C address is allways 0xC0.
*
- * $Id: tea5767.c,v 1.15 2005/07/02 14:53:02 nsh Exp $
+ * $Id: tea5767.c,v 1.16 2005/07/05 17:37:35 nsh Exp $
*
* Copyright (c) 2005 Mauro Carvalho Chehab (mchehab@brturbo.com.br)
* This code is placed under the terms of the GNU General Public License
@@ -196,8 +196,7 @@ static void set_radio_freq(struct i2c_client *c, unsigned int frq)
unsigned div;
int rc;
- if (tuner_debug)
- printk(PREFIX "radio freq counter %d\n", frq);
+ tuner_dbg (PREFIX "radio freq counter %d\n", frq);
/* Rounds freq to next decimal value - for 62.5 KHz step */
/* frq = 20*(frq/16)+radio_frq[frq%16]; */
@@ -207,48 +206,41 @@ static void set_radio_freq(struct i2c_client *c, unsigned int frq)
TEA5767_ST_NOISE_CTL | TEA5767_JAPAN_BAND;
buffer[4] = 0;
- if (t->mode & T_STANDBY) {
- if (tuner_debug)
- tuner_dbg("TEA5767 set to standby mode\n");
+ if (t->mode == T_STANDBY) {
+ tuner_dbg("TEA5767 set to standby mode\n");
buffer[3] |= TEA5767_STDBY;
}
if (t->audmode == V4L2_TUNER_MODE_MONO) {
- if (tuner_debug)
- tuner_dbg("TEA5767 set to mono\n");
+ tuner_dbg("TEA5767 set to mono\n");
buffer[2] |= TEA5767_MONO;
} else {
- if (tuner_debug)
- tuner_dbg("TEA5767 set to stereo\n");
+ tuner_dbg("TEA5767 set to stereo\n");
}
/* Should be replaced */
switch (TEA5767_HIGH_LO_32768) {
case TEA5767_HIGH_LO_13MHz:
- if (tuner_debug)
- tuner_dbg ("TEA5767 radio HIGH LO inject xtal @ 13 MHz\n");
+ tuner_dbg ("TEA5767 radio HIGH LO inject xtal @ 13 MHz\n");
buffer[2] |= TEA5767_HIGH_LO_INJECT;
buffer[4] |= TEA5767_PLLREF_ENABLE;
div = (frq * 4 / 16 + 700 + 225 + 25) / 50;
break;
case TEA5767_LOW_LO_13MHz:
- if (tuner_debug)
- tuner_dbg ("TEA5767 radio LOW LO inject xtal @ 13 MHz\n");
+ tuner_dbg ("TEA5767 radio LOW LO inject xtal @ 13 MHz\n");
buffer[4] |= TEA5767_PLLREF_ENABLE;
div = (frq * 4 / 16 - 700 - 225 + 25) / 50;
break;
case TEA5767_LOW_LO_32768:
- if (tuner_debug)
- tuner_dbg ("TEA5767 radio LOW LO inject xtal @ 32,768 MHz\n");
+ tuner_dbg ("TEA5767 radio LOW LO inject xtal @ 32,768 MHz\n");
buffer[3] |= TEA5767_XTAL_32768;
/* const 700=4000*175 Khz - to adjust freq to right value */
div = (1000 * (frq * 4 / 16 - 700 - 225) + 16384) >> 15;
break;
case TEA5767_HIGH_LO_32768:
default:
- if (tuner_debug)
- tuner_dbg ("TEA5767 radio HIGH LO inject xtal @ 32,768 MHz\n");
+ tuner_dbg ("TEA5767 radio HIGH LO inject xtal @ 32,768 MHz\n");
buffer[2] |= TEA5767_HIGH_LO_INJECT;
buffer[3] |= TEA5767_XTAL_32768;
@@ -290,8 +282,7 @@ static int tea5767_stereo(struct i2c_client *c)
rc = buffer[2] & TEA5767_STEREO_MASK;
- if (tuner_debug)
- tuner_dbg("TEA5767 radio ST GET = %02x\n", rc);
+ tuner_dbg("TEA5767 radio ST GET = %02x\n", rc);
return ((buffer[2] & TEA5767_STEREO_MASK) ? V4L2_TUNER_SUB_STEREO : 0);
}
diff --git a/linux/drivers/media/video/tuner-core.c b/linux/drivers/media/video/tuner-core.c
index 67f956a4f..f563a57f8 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.48 2005/07/04 22:34:39 nsh Exp $
+ * $Id: tuner-core.c,v 1.49 2005/07/05 17:37:35 nsh Exp $
*
* i2c tv tuner chip device driver
* core core, i.e. kernel interfaces, registering and so on
@@ -120,23 +120,25 @@ static void set_freq(struct i2c_client *c, unsigned long freq)
struct tuner *t = i2c_get_clientdata(c);
switch (t->mode) {
- case V4L2_TUNER_RADIO:
+ case T_RADIO:
tuner_dbg("radio freq set to %lu.%02lu\n",
freq / 16000, freq % 16000 * 100 / 16000);
set_radio_freq(c, freq);
break;
- case V4L2_TUNER_ANALOG_TV:
- case V4L2_TUNER_DIGITAL_TV:
+ case T_ANALOG_TV:
+ case T_DIGITAL_TV:
tuner_dbg("tv freq set to %lu.%02lu\n",
freq / 16, freq % 16 * 100 / 16);
set_tv_freq(c, freq);
break;
+ default:
+ return;
}
t->freq = freq;
}
static void set_type(struct i2c_client *c, unsigned int type,
- enum tuner_admin_state new_admin_status)
+ unsigned int mode_mask)
{
struct tuner *t = i2c_get_clientdata(c);
unsigned char buffer[4];
@@ -154,7 +156,6 @@ static void set_type(struct i2c_client *c, unsigned int type,
/* This code detects calls by card attach_inform */
if (NULL == t->i2c.dev.driver) {
tuner_dbg ("tuner 0x%02x: called before i2c_client register by adapter's attach_inform\n", c->addr);
-
t->type=type;
return;
}
@@ -163,29 +164,29 @@ static void set_type(struct i2c_client *c, unsigned int type,
switch (t->type) {
case TUNER_MT2032:
- microtune_init(c);
+ microtune_init (c);
break;
case TUNER_PHILIPS_TDA8290:
- tda8290_init(c);
+ tda8290_init (c);
break;
case TUNER_TEA5767:
- if (tea5767_tuner_init(c) == EINVAL) {
+ if (tea5767_tuner_init (c) == EINVAL) {
t->type = TUNER_ABSENT;
- t->admin_status = T_UNINITIALIZED;
+ t->mode_mask = T_UNINITIALIZED;
return;
}
- t->admin_status = T_RADIO;
+ t->mode_mask = T_RADIO;
break;
case TUNER_PHILIPS_FMD1216ME_MK3:
buffer[0] = 0x0b;
buffer[1] = 0xdc;
buffer[2] = 0x9c;
buffer[3] = 0x60;
- i2c_master_send(c, buffer, 4);
+ i2c_master_send (c, buffer, 4);
mdelay(1);
buffer[2] = 0x86;
buffer[3] = 0x54;
- i2c_master_send(c, buffer, 4);
+ i2c_master_send (c, buffer, 4);
default_tuner_init(c);
break;
default:
@@ -193,48 +194,50 @@ static void set_type(struct i2c_client *c, unsigned int type,
break;
}
- if (t->admin_status == T_UNINITIALIZED)
- t->admin_status = new_admin_status;
+ if (t->mode_mask == T_UNINITIALIZED)
+ t->mode_mask = mode_mask;
- set_freq(c, t->freq);
- tuner_dbg("%s %s I2C addr 0x%02x with type %d used for 0x%02x\n",
- c->adapter->name, c->driver->name, c->addr << 1, type,
- t->admin_status);
+ set_freq (c, t->freq);
+ tuner_dbg ("%s %s I2C addr 0x%02x with type %d used for 0x%02x\n",
+ c->adapter->name, c->driver->name, c->addr << 1, type,
+ t->mode_mask);
}
/*
* This function apply tuner config to tuner specified
- * by tun_addr structure. I addr is unset, then admin status
+ * by tun_setup structure. I addr is unset, then admin status
* and tun addr status is more precise then current status,
* it's applied. Otherwise status and type are applied only to
* tuner with exactly the same addr.
*/
-static void set_addr(struct i2c_client *c, struct tuner_addr *tun_addr)
+static void set_addr(struct i2c_client *c, struct tuner_setup *tun_setup)
{
struct tuner *t = i2c_get_clientdata(c);
- if (tun_addr->addr == ADDR_UNSET) {
- if (t->admin_status & tun_addr->state)
- set_type(c, tun_addr->type, tun_addr->state);
- } else if (tun_addr->addr == c->addr) {
- set_type(c, tun_addr->type, tun_addr->state);
+ if (tun_setup->addr == ADDR_UNSET) {
+ if (t->mode_mask & tun_setup->mode_mask)
+ set_type(c, tun_setup->type, tun_setup->mode_mask);
+ } else if (tun_setup->addr == c->addr) {
+ set_type(c, tun_setup->type, tun_setup->mode_mask);
}
}
-static inline int check_mode(struct tuner *t, char *cmd)
+static inline int check_mode (struct tuner *t, char *cmd)
{
- if (1 << t->mode & t->admin_status) {
+ if (t->mode & t->mode_mask) {
switch (t->mode) {
- case V4L2_TUNER_RADIO:
- tuner_dbg("Cmd %s accepted for radio\n", cmd);
+ case T_RADIO:
+ tuner_dbg ("Cmd %s accepted for radio\n", cmd);
break;
- case V4L2_TUNER_ANALOG_TV:
- tuner_dbg("Cmd %s accepted for analog TV\n", cmd);
+ case T_ANALOG_TV:
+ tuner_dbg ("Cmd %s accepted for analog TV\n", cmd);
break;
- case V4L2_TUNER_DIGITAL_TV:
- tuner_dbg("Cmd %s accepted for digital TV\n", cmd);
+ case T_DIGITAL_TV:
+ tuner_dbg ("Cmd %s accepted for digital TV\n", cmd);
break;
+ default:
+ return EINVAL;
}
return 0;
}
@@ -305,7 +308,7 @@ static int tuner_fixup_std(struct tuner *t)
/* ---------------------------------------------------------------------- */
/* static var Used only in tuner_attach and tuner_probe */
-static unsigned default_admin_status;
+static unsigned int 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.
@@ -317,16 +320,17 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
client_template.adapter = adap;
client_template.addr = addr;
- t = kmalloc(sizeof(struct tuner), GFP_KERNEL);
+ t = kmalloc (sizeof(struct tuner), GFP_KERNEL);
if (NULL == t)
return -ENOMEM;
memset(t, 0, sizeof(struct tuner));
memcpy(&t->i2c, &client_template, sizeof(struct i2c_client));
- i2c_set_clientdata(&t->i2c, t);
+ i2c_set_clientdata (&t->i2c, t);
+
t->type = UNSET;
t->radio_if2 = 10700 * 1000; /* 10.7MHz - FM radio */
t->audmode = V4L2_TUNER_MODE_STEREO;
- t->admin_status = T_UNINITIALIZED;
+ t->mode_mask = T_UNINITIALIZED;
tuner_info("chip found @ 0x%x (%s)\n", addr << 1, adap->name);
@@ -335,27 +339,28 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
if (addr == 0x60) {
if (tea5767_autodetection(&t->i2c) != EINVAL) {
t->type = TUNER_TEA5767;
- t->admin_status = T_RADIO | T_STANDBY;
+ t->mode_mask = T_RADIO | T_STANDBY;
t->freq = 87.5 * 16; /* Sets freq to FM range */
- default_admin_status &= ~T_RADIO;
+ default_mode_mask &= ~T_RADIO;
i2c_attach_client (&t->i2c);
- set_type(&t->i2c,t->type, t->admin_status);
+ set_type (&t->i2c, t->type, t->mode_mask);
return 0;
}
}
/* Initializes only the first adapter found */
- if (default_admin_status != T_UNINITIALIZED) {
- tuner_dbg ("Setting admin_status to 0x%02x\n", default_admin_status);
- t->admin_status = default_admin_status;
+ if (default_mode_mask != T_UNINITIALIZED) {
+ tuner_dbg ("Setting mode_mask to 0x%02x\n", default_mode_mask);
+ t->mode_mask = default_mode_mask;
t->freq = 400 * 16; /* Sets freq to VHF High */
- default_admin_status = T_UNINITIALIZED;
+ default_mode_mask = T_UNINITIALIZED;
}
/* Should be just before return */
i2c_attach_client (&t->i2c);
- set_type (&t->i2c,t->type, t->admin_status);
+ set_type (&t->i2c, t->type, t->mode_mask);
+
return 0;
}
@@ -366,7 +371,7 @@ static int tuner_probe(struct i2c_adapter *adap)
normal_i2c[1] = I2C_CLIENT_END;
}
- default_admin_status = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV;
+ default_mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV;
if (adap->class & I2C_CLASS_TV_ANALOG)
return i2c_probe(adap, &addr_data, tuner_attach);
@@ -399,22 +404,17 @@ static int tuner_detach(struct i2c_client *client)
static inline int set_mode(struct i2c_client *client, struct tuner *t, int mode, char *cmd)
{
if (mode != t->mode) {
-
t->mode = mode;
if (check_mode(t, cmd) == EINVAL) {
- t->admin_status |= T_STANDBY;
- if (V4L2_TUNER_RADIO == mode) {
+ t->mode = T_STANDBY;
+ set_freq (client, t->freq);
+ return EINVAL;
+ } else {
+ if (T_RADIO == mode) {
set_tv_freq(client, 400 * 16);
} else {
set_radio_freq(client, 87.5 * 16000);
}
- return EINVAL;
- } else {
- t->admin_status &= ~T_STANDBY;
- if (t->mode == V4L2_TUNER_RADIO)
- set_freq (client, t->freq * 1000);
- else
- set_freq (client, t->freq / 1000);
}
}
return 0;
@@ -441,15 +441,15 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
switch (cmd) {
/* --- configuration --- */
case TUNER_SET_TYPE_ADDR:
- tuner_dbg ("Calling set_type_addr for type=%d, addr=0x%02x, mode=0x%02x\n",
- ((struct tuner_addr *)arg)->type,
- ((struct tuner_addr *)arg)->addr,
- ((struct tuner_addr *)arg)->state);
+ tuner_dbg ("Calling set_type_addr for type=%d, addr=0x%02x, mode_mask=0x%02x\n",
+ ((struct tuner_setup *)arg)->type,
+ ((struct tuner_setup *)arg)->addr,
+ ((struct tuner_setup *)arg)->mode_mask);
- set_addr(client, (struct tuner_addr *)arg);
+ set_addr(client, (struct tuner_setup *)arg);
break;
case AUDC_SET_RADIO:
- set_mode(client,t,V4L2_TUNER_RADIO, "AUDC_SET_RADIO");
+ set_mode(client, t, T_RADIO, "AUDC_SET_RADIO");
break;
case AUDC_CONFIG_PINNACLE:
if (check_mode(t, "AUDC_CONFIG_PINNACLE") == EINVAL)
@@ -485,7 +485,7 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
if (check_v4l2(t) == EINVAL)
return 0;
- if (set_mode(client,t,V4L2_TUNER_ANALOG_TV, "VIDIOCSCHAN")==EINVAL)
+ if (set_mode (client, t, T_ANALOG_TV, "VIDIOCSCHAN") == EINVAL)
return 0;
if (vc->norm < ARRAY_SIZE(map))
@@ -516,16 +516,16 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
if (check_v4l2(t) == EINVAL)
return 0;
- if (V4L2_TUNER_RADIO == t->mode) {
+ if (T_RADIO == t->mode) {
if (t->has_signal)
vt->signal = t->has_signal(client);
- if (t->is_stereo) {
- if (t->is_stereo(client))
- vt->flags |=
- VIDEO_TUNER_STEREO_ON;
- else
- vt->flags &=
- ~VIDEO_TUNER_STEREO_ON;
+
+ if (t->is_stereo && t->is_stereo(client)) {
+ vt->flags |=
+ VIDEO_TUNER_STEREO_ON;
+ } else {
+ vt->flags &=
+ ~VIDEO_TUNER_STEREO_ON;
}
vt->flags |= VIDEO_TUNER_LOW; /* Allow freqs at 62.5 Hz */
@@ -548,7 +548,7 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
if (check_v4l2(t) == EINVAL)
return 0;
- if (V4L2_TUNER_RADIO == t->mode && t->is_stereo)
+ if (T_RADIO == t->mode && t->is_stereo)
va->mode = t->is_stereo(client)
? VIDEO_SOUND_STEREO : VIDEO_SOUND_MONO;
return 0;
@@ -558,7 +558,7 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
v4l2_std_id *id = arg;
- if (set_mode (client, t, V4L2_TUNER_ANALOG_TV, "VIDIOC_S_STD")
+ if (set_mode (client, t, T_ANALOG_TV, "VIDIOC_S_STD")
== EINVAL)
return 0;
@@ -577,8 +577,8 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
t->freq = f->frequency;
switch_v4l2();
if (V4L2_TUNER_RADIO == f->type &&
- V4L2_TUNER_RADIO != t->mode) {
- if (set_mode (client, t, f->type, "VIDIOC_S_FREQUENCY")
+ T_RADIO != t->mode) {
+ if (set_mode (client, t, T_RADIO, "VIDIOC_S_FREQUENCY")
== EINVAL)
return 0;
}
@@ -601,24 +601,22 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
struct v4l2_tuner *tuner = arg;
- if (check_mode(t, "VIDIOC_G_TUNER") == EINVAL)
+ if (check_mode (t, "VIDIOC_G_TUNER") == EINVAL)
return 0;
switch_v4l2();
- if (V4L2_TUNER_RADIO == t->mode) {
+ if (T_RADIO == t->mode) {
if (t->has_signal)
tuner->signal = t->has_signal(client);
- if (t->is_stereo) {
- if (t->is_stereo(client)) {
- tuner->rxsubchans =
- V4L2_TUNER_SUB_STEREO |
- V4L2_TUNER_SUB_MONO;
- } else {
- tuner->rxsubchans =
- V4L2_TUNER_SUB_MONO;
- }
+ if (t->is_stereo && t->is_stereo (client)) {
+ tuner->rxsubchans =
+ V4L2_TUNER_SUB_STEREO |
+ V4L2_TUNER_SUB_MONO;
+ } else {
+ tuner->rxsubchans =
+ V4L2_TUNER_SUB_MONO;
}
tuner->capability |=
@@ -643,7 +641,7 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
switch_v4l2();
- if (V4L2_TUNER_RADIO == t->mode) {
+ if (T_RADIO == t->mode) {
t->audmode = tuner->audmode;
set_radio_freq(client, t->freq);
}
diff --git a/linux/drivers/media/video/tuner-simple.c b/linux/drivers/media/video/tuner-simple.c
index 7c30a3a61..6691334d2 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.36 2005/07/02 14:53:02 nsh Exp $
+ * $Id: tuner-simple.c,v 1.37 2005/07/05 17:37:35 nsh Exp $
*
* i2c tv tuner chip device driver
* controls all those simple 4-control-bytes style tuners.
@@ -457,7 +457,7 @@ static void default_set_radio_freq(struct i2c_client *c, unsigned int freq)
switch (t->type) {
case TUNER_TENA_9533_DI:
case TUNER_YMEC_TVF_5533MF:
- tuner_dbg("This tuner doesn't have FM. Most cards has a TEA5767 for FM\n");
+ tuner_dbg ("This tuner doesn't have FM. Most cards has a TEA5767 for FM\n");
return;
case TUNER_PHILIPS_FM1216ME_MK3:
case TUNER_PHILIPS_FM1236_MK3:
diff --git a/linux/include/media/tuner.h b/linux/include/media/tuner.h
index 210b75510..dd901a65f 100644
--- a/linux/include/media/tuner.h
+++ b/linux/include/media/tuner.h
@@ -1,5 +1,5 @@
-/* $Id: tuner.h,v 1.40 2005/07/03 00:22:14 nsh Exp $
+/* $Id: tuner.h,v 1.41 2005/07/05 17:37:35 nsh Exp $
*
tuner.h - definition for different tuners
@@ -154,7 +154,7 @@
#define I2C_ADDR_TDA8290 0x4b
#define I2C_ADDR_TDA8275 0x61
-enum tuner_admin_state {
+enum tuner_mode {
T_UNINITIALIZED = 0,
T_RADIO = 1 << V4L2_TUNER_RADIO,
T_ANALOG_TV = 1 << V4L2_TUNER_ANALOG_TV,
@@ -162,24 +162,26 @@ enum tuner_admin_state {
T_STANDBY = 1 << 31
};
-struct tuner_addr {
- enum tuner_admin_state state;
- unsigned int type;
+struct tuner_setup {
unsigned short addr;
+ unsigned int type;
+ unsigned int mode_mask;
};
struct tuner {
/* device */
struct i2c_client i2c;
- /* state + config */
- unsigned int admin_status;
unsigned int type; /* chip type */
+
+ enum tuner_mode mode;
+ unsigned int mode_mask; /* Combination of allowable modes */
+
unsigned int freq; /* keep track of the current settings */
+ unsigned int audmode;
v4l2_std_id std;
- int using_v4l2;
-
- enum v4l2_tuner_type mode;
+
+ int using_v4l2;
/* used by MT2032 */
unsigned int xogc;
@@ -189,9 +191,6 @@ struct tuner {
unsigned char i2c_easy_mode[2];
unsigned char i2c_set_freq[8];
- /* used to keep track of audmode */
- unsigned int audmode;
-
/* function ptrs */
void (*tv_freq)(struct i2c_client *c, unsigned int freq);
void (*radio_freq)(struct i2c_client *c, unsigned int freq);
diff --git a/v4l/ChangeLog b/v4l/ChangeLog
index 83c3539b8..0e4891f69 100644
--- a/v4l/ChangeLog
+++ b/v4l/ChangeLog
@@ -1,3 +1,10 @@
+2005-07-05 21:36 nshmyrev
+ * bttv-driver.c, saa7134-cards.c, tuner-core.c, tea5767.c:
+ * tuner-simple.c, saa7134-core.c, cx88-core.c:
+
+ Rename tuner structures fields. Move MD detection hack to
+ saa7134-cards.c
+
2005-07-04 18:23 nshmyrev
* tuner-core.c: