diff options
Diffstat (limited to 'drivers/media/video/saa7134/saa7134-i2c.c')
| -rw-r--r-- | drivers/media/video/saa7134/saa7134-i2c.c | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/drivers/media/video/saa7134/saa7134-i2c.c b/drivers/media/video/saa7134/saa7134-i2c.c index b6f002e8421d..93dd61978541 100644 --- a/drivers/media/video/saa7134/saa7134-i2c.c +++ b/drivers/media/video/saa7134/saa7134-i2c.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * $Id: saa7134-i2c.c,v 1.11 2005/06/12 01:36:14 mchehab Exp $ | 2 | * $Id: saa7134-i2c.c,v 1.19 2005/07/07 01:49:30 mkrufky Exp $ |
| 3 | * | 3 | * |
| 4 | * device driver for philips saa7134 based TV cards | 4 | * device driver for philips saa7134 based TV cards |
| 5 | * i2c interface support | 5 | * i2c interface support |
| @@ -197,10 +197,6 @@ static inline int i2c_send_byte(struct saa7134_dev *dev, | |||
| 197 | enum i2c_status status; | 197 | enum i2c_status status; |
| 198 | __u32 dword; | 198 | __u32 dword; |
| 199 | 199 | ||
| 200 | #if 0 | ||
| 201 | i2c_set_attr(dev,attr); | ||
| 202 | saa_writeb(SAA7134_I2C_DATA, data); | ||
| 203 | #else | ||
| 204 | /* have to write both attr + data in one 32bit word */ | 200 | /* have to write both attr + data in one 32bit word */ |
| 205 | dword = saa_readl(SAA7134_I2C_ATTR_STATUS >> 2); | 201 | dword = saa_readl(SAA7134_I2C_ATTR_STATUS >> 2); |
| 206 | dword &= 0x0f; | 202 | dword &= 0x0f; |
| @@ -210,7 +206,6 @@ static inline int i2c_send_byte(struct saa7134_dev *dev, | |||
| 210 | // dword |= 0x40 << 16; /* 400 kHz */ | 206 | // dword |= 0x40 << 16; /* 400 kHz */ |
| 211 | dword |= 0xf0 << 24; | 207 | dword |= 0xf0 << 24; |
| 212 | saa_writel(SAA7134_I2C_ATTR_STATUS >> 2, dword); | 208 | saa_writel(SAA7134_I2C_ATTR_STATUS >> 2, dword); |
| 213 | #endif | ||
| 214 | d2printk(KERN_DEBUG "%s: i2c data => 0x%x\n",dev->name,data); | 209 | d2printk(KERN_DEBUG "%s: i2c data => 0x%x\n",dev->name,data); |
| 215 | 210 | ||
| 216 | if (!i2c_is_busy_wait(dev)) | 211 | if (!i2c_is_busy_wait(dev)) |
| @@ -331,12 +326,44 @@ static u32 functionality(struct i2c_adapter *adap) | |||
| 331 | 326 | ||
| 332 | static int attach_inform(struct i2c_client *client) | 327 | static int attach_inform(struct i2c_client *client) |
| 333 | { | 328 | { |
| 334 | struct saa7134_dev *dev = client->adapter->algo_data; | 329 | struct saa7134_dev *dev = client->adapter->algo_data; |
| 335 | int tuner = dev->tuner_type; | 330 | int tuner = dev->tuner_type; |
| 336 | int conf = dev->tda9887_conf; | 331 | int conf = dev->tda9887_conf; |
| 332 | struct tuner_setup tun_setup; | ||
| 333 | |||
| 334 | d1printk( "%s i2c attach [addr=0x%x,client=%s]\n", | ||
| 335 | client->driver->name,client->addr,i2c_clientname(client)); | ||
| 336 | |||
| 337 | if (!client->driver->command) | ||
| 338 | return 0; | ||
| 339 | |||
| 340 | if (saa7134_boards[dev->board].radio_type != UNSET) { | ||
| 341 | |||
| 342 | tun_setup.type = saa7134_boards[dev->board].radio_type; | ||
| 343 | tun_setup.addr = saa7134_boards[dev->board].radio_addr; | ||
| 344 | |||
| 345 | if ((tun_setup.addr == ADDR_UNSET) || (tun_setup.addr == client->addr)) { | ||
| 346 | tun_setup.mode_mask = T_RADIO; | ||
| 347 | |||
| 348 | client->driver->command(client, TUNER_SET_TYPE_ADDR, &tun_setup); | ||
| 349 | } | ||
| 350 | } | ||
| 351 | |||
| 352 | if (tuner != UNSET) { | ||
| 353 | |||
| 354 | tun_setup.type = tuner; | ||
| 355 | tun_setup.addr = saa7134_boards[dev->board].tuner_addr; | ||
| 356 | |||
| 357 | if ((tun_setup.addr == ADDR_UNSET)||(tun_setup.addr == client->addr)) { | ||
| 358 | |||
| 359 | tun_setup.mode_mask = T_ANALOG_TV; | ||
| 360 | |||
| 361 | client->driver->command(client,TUNER_SET_TYPE_ADDR, &tun_setup); | ||
| 362 | } | ||
| 363 | } | ||
| 364 | |||
| 365 | client->driver->command(client, TDA9887_SET_CONFIG, &conf); | ||
| 337 | 366 | ||
| 338 | saa7134_i2c_call_clients(dev,TUNER_SET_TYPE,&tuner); | ||
| 339 | saa7134_i2c_call_clients(dev,TDA9887_SET_CONFIG,&conf); | ||
| 340 | return 0; | 367 | return 0; |
| 341 | } | 368 | } |
| 342 | 369 | ||
