|
@@ -745,109 +745,6 @@ int tveeprom_read(struct i2c_client *c, unsigned char *eedata, int len)
|
|
|
}
|
|
|
EXPORT_SYMBOL(tveeprom_read);
|
|
|
|
|
|
-/* ----------------------------------------------------------------------- */
|
|
|
-/* needed for ivtv.sf.net at the moment. Should go away in the long */
|
|
|
-/* run, just call the exported tveeprom_* directly, there is no point in */
|
|
|
-/* using the indirect way via i2c_driver->command() */
|
|
|
-
|
|
|
-static unsigned short normal_i2c[] = {
|
|
|
- 0xa0 >> 1,
|
|
|
- I2C_CLIENT_END,
|
|
|
-};
|
|
|
-
|
|
|
-I2C_CLIENT_INSMOD;
|
|
|
-
|
|
|
-static struct i2c_driver i2c_driver_tveeprom;
|
|
|
-
|
|
|
-static int
|
|
|
-tveeprom_command(struct i2c_client *client,
|
|
|
- unsigned int cmd,
|
|
|
- void *arg)
|
|
|
-{
|
|
|
- struct tveeprom eeprom;
|
|
|
- u32 *eeprom_props = arg;
|
|
|
- u8 *buf;
|
|
|
-
|
|
|
- switch (cmd) {
|
|
|
- case 0:
|
|
|
- buf = kzalloc(256, GFP_KERNEL);
|
|
|
- tveeprom_read(client, buf, 256);
|
|
|
- tveeprom_hauppauge_analog(client, &eeprom, buf);
|
|
|
- kfree(buf);
|
|
|
- eeprom_props[0] = eeprom.tuner_type;
|
|
|
- eeprom_props[1] = eeprom.tuner_formats;
|
|
|
- eeprom_props[2] = eeprom.model;
|
|
|
- eeprom_props[3] = eeprom.revision;
|
|
|
- eeprom_props[4] = eeprom.has_radio;
|
|
|
- break;
|
|
|
- default:
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-static int
|
|
|
-tveeprom_detect_client(struct i2c_adapter *adapter,
|
|
|
- int address,
|
|
|
- int kind)
|
|
|
-{
|
|
|
- struct i2c_client *client;
|
|
|
-
|
|
|
- client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
|
|
|
- if (NULL == client)
|
|
|
- return -ENOMEM;
|
|
|
- client->addr = address;
|
|
|
- client->adapter = adapter;
|
|
|
- client->driver = &i2c_driver_tveeprom;
|
|
|
- snprintf(client->name, sizeof(client->name), "tveeprom");
|
|
|
- i2c_attach_client(client);
|
|
|
-
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-static int
|
|
|
-tveeprom_attach_adapter(struct i2c_adapter *adapter)
|
|
|
-{
|
|
|
- if (adapter->class & I2C_CLASS_TV_ANALOG)
|
|
|
- return i2c_probe(adapter, &addr_data, tveeprom_detect_client);
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-static int
|
|
|
-tveeprom_detach_client(struct i2c_client *client)
|
|
|
-{
|
|
|
- int err;
|
|
|
-
|
|
|
- err = i2c_detach_client(client);
|
|
|
- if (err < 0)
|
|
|
- return err;
|
|
|
- kfree(client);
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-static struct i2c_driver i2c_driver_tveeprom = {
|
|
|
- .driver = {
|
|
|
- .name = "tveeprom",
|
|
|
- },
|
|
|
- .id = I2C_DRIVERID_TVEEPROM,
|
|
|
- .attach_adapter = tveeprom_attach_adapter,
|
|
|
- .detach_client = tveeprom_detach_client,
|
|
|
- .command = tveeprom_command,
|
|
|
-};
|
|
|
-
|
|
|
-static int __init tveeprom_init(void)
|
|
|
-{
|
|
|
- return i2c_add_driver(&i2c_driver_tveeprom);
|
|
|
-}
|
|
|
-
|
|
|
-static void __exit tveeprom_exit(void)
|
|
|
-{
|
|
|
- i2c_del_driver(&i2c_driver_tveeprom);
|
|
|
-}
|
|
|
-
|
|
|
-module_init(tveeprom_init);
|
|
|
-module_exit(tveeprom_exit);
|
|
|
-
|
|
|
/*
|
|
|
* Local variables:
|
|
|
* c-basic-offset: 8
|