summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/tveeprom.c
diff options
context:
space:
mode:
authorGerd Knorr <devnull@localhost>2005-01-07 13:58:49 +0000
committerGerd Knorr <devnull@localhost>2005-01-07 13:58:49 +0000
commitefce3c0310a899d62906b8d0b9aec584d69ba0c3 (patch)
treecf41db785f62732bebd44531642347fc53569fbe /linux/drivers/media/video/tveeprom.c
parentbd43dd87f5e1b86295caf0c65eec8cdcdf566171 (diff)
downloadmediapointer-dvb-s2-efce3c0310a899d62906b8d0b9aec584d69ba0c3.tar.gz
mediapointer-dvb-s2-efce3c0310a899d62906b8d0b9aec584d69ba0c3.tar.bz2
- tveeprom tweaks.
- keytable for the new hauppauge remotes.
Diffstat (limited to 'linux/drivers/media/video/tveeprom.c')
-rw-r--r--linux/drivers/media/video/tveeprom.c108
1 files changed, 108 insertions, 0 deletions
diff --git a/linux/drivers/media/video/tveeprom.c b/linux/drivers/media/video/tveeprom.c
index 7ac3532e3..0bba7d25f 100644
--- a/linux/drivers/media/video/tveeprom.c
+++ b/linux/drivers/media/video/tveeprom.c
@@ -460,6 +460,114 @@ int tveeprom_dump(unsigned char *eedata, int len)
}
EXPORT_SYMBOL(tveeprom_dump);
+/* ----------------------------------------------------------------------- */
+/* 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() */
+
+#ifndef I2C_DRIVERID_TVEEPROM
+# define I2C_DRIVERID_TVEEPROM I2C_DRIVERID_EXP2
+#endif
+
+static unsigned short normal_i2c[] = {
+ 0xa0 >> 1,
+ I2C_CLIENT_END,
+};
+static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
+I2C_CLIENT_INSMOD;
+
+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 = kmalloc(256,GFP_KERNEL);
+ memset(buf,0,256);
+ tveeprom_read(client,buf,256);
+ tveeprom_hauppauge_analog(&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;
+ break;
+ default:
+ return -EINVAL;
+ }
+ return 0;
+}
+
+static int
+tveeprom_detect_client(struct i2c_adapter *adapter,
+ int address,
+ int kind)
+{
+ struct i2c_client *client;
+
+ client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
+ if (client == 0)
+ return -ENOMEM;
+ memset(client, 0, sizeof(struct i2c_client));
+ client->addr = address;
+ client->adapter = adapter;
+ client->driver = &i2c_driver_tveeprom;
+ client->flags = I2C_CLIENT_ALLOW_USE;
+ snprintf(client->name, sizeof(client->name), "tveeprom");
+ return 0;
+}
+
+static int
+tveeprom_attach_adapter (struct i2c_adapter *adapter)
+{
+ if (adapter->id != (I2C_ALGO_BIT | I2C_HW_B_BT848))
+ return 0;
+ return i2c_probe(adapter, &addr_data, tveeprom_detect_client);
+}
+
+static int
+tveeprom_detach_client (struct i2c_client *client)
+{
+ int err;
+
+ err = i2c_detach_client(client);
+ if (err)
+ return err;
+
+ kfree(client);
+ return 0;
+}
+
+struct i2c_driver i2c_driver_tveeprom = {
+ .owner = THIS_MODULE,
+ .name = "tveeprom",
+ .id = I2C_DRIVERID_TVEEPROM,
+ .flags = I2C_DF_NOTIFY,
+ .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