diff options
author | Michael Hunold <devnull@localhost> | 2003-05-06 14:29:34 +0000 |
---|---|---|
committer | Michael Hunold <devnull@localhost> | 2003-05-06 14:29:34 +0000 |
commit | 5b30c2e4c3167d50c40e49520bc9530bab2b47f5 (patch) | |
tree | d411865d34beeb29edce0800c69581eee526721e | |
parent | e4e3a26f4c976328c77dc109828f8e41acf27f37 (diff) | |
download | mediapointer-dvb-s2-5b30c2e4c3167d50c40e49520bc9530bab2b47f5.tar.gz mediapointer-dvb-s2-5b30c2e4c3167d50c40e49520bc9530bab2b47f5.tar.bz2 |
It's hard to keep these drivers to compile under 2.4. because of the
ongoing i2c changes in 2.5. Because of the fact that they are already
in the kernel and won't change any more, they can be removed here
and added to the build-2.4 directory.
-rw-r--r-- | linux/drivers/media/video/saa7111.c | 460 | ||||
-rw-r--r-- | linux/drivers/media/video/tda9840.c | 300 | ||||
-rw-r--r-- | linux/drivers/media/video/tda9840.h | 35 | ||||
-rw-r--r-- | linux/drivers/media/video/tea6415c.c | 251 | ||||
-rw-r--r-- | linux/drivers/media/video/tea6415c.h | 39 | ||||
-rw-r--r-- | linux/drivers/media/video/tea6420.c | 228 | ||||
-rw-r--r-- | linux/drivers/media/video/tea6420.h | 17 |
7 files changed, 0 insertions, 1330 deletions
diff --git a/linux/drivers/media/video/saa7111.c b/linux/drivers/media/video/saa7111.c deleted file mode 100644 index 286ee8f0d..000000000 --- a/linux/drivers/media/video/saa7111.c +++ /dev/null @@ -1,460 +0,0 @@ -/* - saa7111 - Philips SAA7111A video decoder driver version 0.0.3 - - Copyright (C) 1998 Dave Perks <dperks@ibm.net> - - Slight changes for video timing and attachment output by - Wolfgang Scherr <scherr@net4you.net> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include <linux/module.h> -#include <linux/init.h> -#include <linux/delay.h> -#include <linux/errno.h> -#include <linux/fs.h> -#include <linux/kernel.h> -#include <linux/major.h> -#include <linux/slab.h> -#include <linux/mm.h> -#include <linux/sched.h> - -#include <linux/videodev.h> -#include <linux/version.h> -#include <linux/i2c.h> - -#include <linux/video_decoder.h> - -#define DEBUG(x) /* Debug driver */ - -/* ----------------------------------------------------------------------- */ - -struct saa7111 { - struct i2c_client *client; - int addr; - struct semaphore lock; - unsigned char reg[32]; - - int norm; - int input; - int enable; - int bright; - int contrast; - int hue; - int sat; -}; - -static unsigned short normal_i2c[] = { 0x24, 0x25, I2C_CLIENT_END }; -static unsigned short normal_i2c_range[] = { I2C_CLIENT_END }; - -I2C_CLIENT_INSMOD; - -static struct i2c_client client_template; -/* ----------------------------------------------------------------------- */ -static int saa7111_attach(struct i2c_adapter *adap, int addr, unsigned short flags, int kind) -{ - int i; - struct saa7111 *decoder; - struct i2c_client *client; - - /* who wrote this? init[] is used for i2c_master_send() which expects an array that - will be used for the 'buf' part of an i2c message unchanged. so, the first byte - needs to be the subaddress to start with, then follow the data bytes... */ - static const unsigned char init[] = { - 0x00, /* start address */ - - 0x00, /* 00 - ID byte */ - 0x00, /* 01 - reserved */ - - /*front end */ - 0xd0, /* 02 - FUSE=3, GUDL=2, MODE=0 */ - 0x23, /* 03 - HLNRS=0, VBSL=1, WPOFF=0, HOLDG=0, GAFIX=0, GAI1=256, GAI2=256 */ - 0x00, /* 04 - GAI1=256 */ - 0x00, /* 05 - GAI2=256 */ - - /* decoder */ - 0xf3, /* 06 - HSB at 13(50Hz) / 17(60Hz) pixels after end of last line */ - 0x13, /* 07 - HSS at 113(50Hz) / 117(60Hz) pixels after end of last line */ - 0xc8, /* 08 - AUFD=1, FSEL=1, EXFIL=0, VTRC=1, HPLL=0, VNOI=0 */ - 0x01, /* 09 - BYPS=0, PREF=0, BPSS=0, VBLB=0, UPTCV=0, APER=1 */ - 0x80, /* 0a - BRIG=128 */ - 0x47, /* 0b - CONT=1.109 */ - 0x40, /* 0c - SATN=1.0 */ - 0x00, /* 0d - HUE=0 */ - 0x01, /* 0e - CDTO=0, CSTD=0, DCCF=0, FCTC=0, CHBW=1 */ - 0x00, /* 0f - reserved */ - 0x48, /* 10 - OFTS=1, HDEL=0, VRLN=1, YDEL=0 */ - 0x1c, /* 11 - GPSW=0, CM99=0, FECO=0, COMPO=1, OEYC=1, OEHV=1, VIPB=0, COLO=0 */ - 0x00, /* 12 - output control 2 */ - 0x00, /* 13 - output control 3 */ - 0x00, /* 14 - reserved */ - 0x00, /* 15 - VBI */ - 0x00, /* 16 - VBI */ - 0x00, /* 17 - VBI */ - }; - client = kmalloc(sizeof(*client), GFP_KERNEL); - if(client == NULL) - return -ENOMEM; - client_template.adapter = adap; - client_template.addr = addr; - memcpy(client, &client_template, sizeof(*client)); - - decoder = kmalloc(sizeof(*decoder), GFP_KERNEL); - if (decoder == NULL) - { - kfree(client); - return -ENOMEM; - } - - memset(decoder, 0, sizeof(*decoder)); - decoder->client = client; -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) - client->data = decoder; -#else - i2c_set_clientdata(client, decoder); -#endif - decoder->addr = addr; - decoder->norm = VIDEO_MODE_NTSC; - decoder->input = 0; - decoder->enable = 1; - decoder->bright = 32768; - decoder->contrast = 32768; - decoder->hue = 32768; - decoder->sat = 32768; - - i = i2c_master_send(client, init, sizeof(init)); - if (i < 0) { - printk(KERN_ERR "%s_attach: init status %d\n", -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) - client->name, i); -#else - client->dev.name, i); -#endif - } else { - printk(KERN_INFO "%s_attach: chip version %x @ 0x%08x\n", -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) - client->name, i2c_smbus_read_byte_data(client, 0x00) >> 4,addr); -#else - client->dev.name, i2c_smbus_read_byte_data(client, 0x00) >> 4,addr); -#endif - } - - init_MUTEX(&decoder->lock); - i2c_attach_client(client); - MOD_INC_USE_COUNT; - return 0; -} -static int saa7111_probe(struct i2c_adapter *adap) -{ - /* probing unknown devices on any Matrox i2c-bus takes ages due to the - slow bit banging algorithm used. because of the fact a saa7111(a) - is *never* present on a Matrox gfx card, we can skip such adapters - here */ - if( 0 != (adap->id & I2C_HW_B_G400)) { - return -ENODEV; - } - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) - printk("saa7111: probing %s i2c adapter [id=0x%x]\n", - adap->name,adap->id); -#else - printk("saa7111: probing %s i2c adapter [id=0x%x]\n", - adap->dev.name,adap->id); -#endif - return i2c_probe(adap, &addr_data, saa7111_attach); -} - -static int saa7111_detach(struct i2c_client *client) -{ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) - struct saa7111 *decoder = client->data; -#else - struct saa7111 *decoder = i2c_get_clientdata(client); -#endif - i2c_detach_client(client); - kfree(decoder); - kfree(client); - MOD_DEC_USE_COUNT; - return 0; -} - -static int saa7111_command(struct i2c_client *client, unsigned int cmd, - void *arg) -{ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) - struct saa7111 *decoder = client->data; -#else - struct saa7111 *decoder = i2c_get_clientdata(client); -#endif - switch (cmd) { - -#if defined(DECODER_DUMP) - case DECODER_DUMP: - { - int i; - - for (i = 0; i < 32; i += 16) { - int j; - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) - printk("KERN_DEBUG %s: %03x", client->name, -#else - printk("KERN_DEBUG %s: %03x", client->dev.name, -#endif - i); - for (j = 0; j < 16; ++j) { - printk(" %02x", - i2c_smbus_read_byte_data(client, - i + j)); - } - printk("\n"); - } - } - break; -#endif /* defined(DECODER_DUMP) */ - case DECODER_GET_CAPABILITIES: - { - struct video_decoder_capability *cap = arg; - - cap->flags - = VIDEO_DECODER_PAL - | VIDEO_DECODER_NTSC - | VIDEO_DECODER_AUTO | VIDEO_DECODER_CCIR; - cap->inputs = 8; - cap->outputs = 1; - } - break; - case DECODER_GET_STATUS: - { - int *iarg = arg; - int status; - int res; - - status = i2c_smbus_read_byte_data(client, 0x1f); - res = 0; - if ((status & (1 << 6)) == 0) { - res |= DECODER_STATUS_GOOD; - } - switch (decoder->norm) { - case VIDEO_MODE_NTSC: - res |= DECODER_STATUS_NTSC; - break; - case VIDEO_MODE_PAL: - res |= DECODER_STATUS_PAL; - break; - default: - case VIDEO_MODE_AUTO: - if ((status & (1 << 5)) != 0) { - res |= DECODER_STATUS_NTSC; - } else { - res |= DECODER_STATUS_PAL; - } - break; - } - if ((status & (1 << 0)) != 0) { - res |= DECODER_STATUS_COLOR; - } - *iarg = res; - } - break; - - case DECODER_SET_NORM: - { - int *iarg = arg; - - switch (*iarg) { - - case VIDEO_MODE_NTSC: - i2c_smbus_write_byte_data(client, 0x08, - (decoder-> - reg[0x08] & 0x3f) | 0x40); - break; - - case VIDEO_MODE_PAL: - i2c_smbus_write_byte_data(client, 0x08, - (decoder-> - reg[0x08] & 0x3f) | 0x00); - break; - - case VIDEO_MODE_AUTO: - i2c_smbus_write_byte_data(client, 0x08, - (decoder-> - reg[0x08] & 0x3f) | 0x80); - break; - - default: - return -EINVAL; - - } - decoder->norm = *iarg; - } - break; - - case DECODER_SET_INPUT: - { - int *iarg = arg; - - if (*iarg < 0 || *iarg > 7) { - return -EINVAL; - } - - if (decoder->input != *iarg) { - decoder->input = *iarg; - /* select mode */ - i2c_smbus_write_byte_data(client, 0x02, - (decoder-> - reg[0x02] & 0xf8) | - decoder->input); - /* bypass chrominance trap for modes 4..7 */ - i2c_smbus_write_byte_data(client, 0x09, - (decoder-> - reg[0x09] & 0x7f) | - ((decoder->input > - 3) ? 0x80 : 0)); - } - } - break; - - case DECODER_SET_OUTPUT: - { - int *iarg = arg; - - /* not much choice of outputs */ - if (*iarg != 0) { - return -EINVAL; - } - } - break; - - case DECODER_ENABLE_OUTPUT: - { - int *iarg = arg; - int enable = (*iarg != 0); - - if (decoder->enable != enable) { - decoder->enable = enable; - -// RJ: If output should be disabled (for playing videos), we also need a open PLL. -// The input is set to 0 (where no input source is connected), although this -// is not necessary. -// -// If output should be enabled, we have to reverse the above. - - if (decoder->enable) { - i2c_smbus_write_byte_data(client, 0x02, - (decoder-> - reg[0x02] & 0xf8) | - decoder->input); - i2c_smbus_write_byte_data(client, 0x08, - (decoder-> - reg[0x08] & 0xfb)); - i2c_smbus_write_byte_data(client, 0x11, - (decoder-> - reg[0x11] & 0xf3) | - 0x0c); - } else { - i2c_smbus_write_byte_data(client, 0x02, - (decoder-> - reg[0x02] & 0xf8)); - i2c_smbus_write_byte_data(client, 0x08, - (decoder-> - reg[0x08] & 0xfb) | - 0x04); - i2c_smbus_write_byte_data(client, 0x11, - (decoder-> - reg[0x11] & 0xf3)); - } - } - } - break; - - case DECODER_SET_PICTURE: - { - struct video_picture *pic = arg; - - if (decoder->bright != pic->brightness) { - /* We want 0 to 255 we get 0-65535 */ - decoder->bright = pic->brightness; - i2c_smbus_write_byte_data(client, 0x0a, - decoder->bright >> 8); - } - if (decoder->contrast != pic->contrast) { - /* We want 0 to 127 we get 0-65535 */ - decoder->contrast = pic->contrast; - i2c_smbus_write_byte_data(client, 0x0b, - decoder->contrast >> 9); - } - if (decoder->sat != pic->colour) { - /* We want 0 to 127 we get 0-65535 */ - decoder->sat = pic->colour; - i2c_smbus_write_byte_data(client, 0x0c, - decoder->sat >> 9); - } - if (decoder->hue != pic->hue) { - /* We want -128 to 127 we get 0-65535 */ - decoder->hue = pic->hue; - i2c_smbus_write_byte_data(client, 0x0d, - (decoder->hue - 32768) >> 8); - } - } - break; - - default: - return -EINVAL; - } - - return 0; -} - -/* ----------------------------------------------------------------------- */ - -static struct i2c_driver i2c_driver_saa7111 = { -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,54) - .owner = THIS_MODULE, -#endif - .name = "saa7111", /* name */ - .id = I2C_DRIVERID_SAA7111A, /* ID */ - .flags = I2C_DF_NOTIFY, - .attach_adapter = saa7111_probe, - .detach_client = saa7111_detach, - .command = saa7111_command -}; - -static struct i2c_client client_template = { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) - .name = "saa7111_client", -#else - .dev = { - .name = "saa7111_client", - }, -#endif - .id = -1, - .driver = &i2c_driver_saa7111 -}; - -static int saa7111_init(void) -{ - return i2c_add_driver(&i2c_driver_saa7111); -} - -static void saa7111_exit(void) -{ - i2c_del_driver(&i2c_driver_saa7111); -} - -module_init(saa7111_init); -module_exit(saa7111_exit); -MODULE_LICENSE("GPL"); diff --git a/linux/drivers/media/video/tda9840.c b/linux/drivers/media/video/tda9840.c deleted file mode 100644 index a3bc1c729..000000000 --- a/linux/drivers/media/video/tda9840.c +++ /dev/null @@ -1,300 +0,0 @@ - /* - tda9840.h - i2c-driver for the tda9840 by SGS Thomson - - Copyright (C) 1998-2003 Michael Hunold <michael@mihu.de> - - The tda9840 is a stereo/dual sound processor with digital - identification. It can be found at address 0x42 on the i2c-bus. - - For detailed informations download the specifications directly - from SGS Thomson at http://www.st.com - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <linux/version.h> -#include <linux/module.h> -#include <linux/kernel.h> -#include <linux/poll.h> -#include <linux/slab.h> -#include <linux/i2c.h> -#include <linux/init.h> - -#include "tda9840.h" - -static int debug = 0; /* insmod parameter */ -MODULE_PARM(debug,"i"); -#define dprintk if (debug) printk - -#define SWITCH 0x00 -#define LEVEL_ADJUST 0x02 -#define STEREO_ADJUST 0x03 -#define TEST 0x04 - -/* addresses to scan, found only at 0x42 (7-Bit) */ -static unsigned short normal_i2c[] = {I2C_TDA9840, I2C_CLIENT_END}; -static unsigned short normal_i2c_range[] = {I2C_CLIENT_END}; - -/* magic definition of all other variables and things */ -I2C_CLIENT_INSMOD; - -/* unique ID allocation */ -static int tda9840_id = 0; - -static struct i2c_driver driver; - -static int tda9840_command(struct i2c_client *client, unsigned int cmd, void* arg) -{ - int result = 0; - - switch (cmd) { - case TDA9840_SWITCH: - { - int byte = *(int*)arg; - - dprintk("tda9840.o: TDA9840_SWITCH: 0x%02x\n",byte); - - if ( byte != TDA9840_SET_MONO - && byte != TDA9840_SET_MUTE - && byte != TDA9840_SET_STEREO - && byte != TDA9840_SET_LANG1 - && byte != TDA9840_SET_LANG2 - && byte != TDA9840_SET_BOTH - && byte != TDA9840_SET_BOTH_R - && byte != TDA9840_SET_EXTERNAL ) { - return -EINVAL; - } - - if ( 0 != (result = i2c_smbus_write_byte_data(client, SWITCH, byte))) { - printk("tda9840.o: TDA9840_SWITCH error.\n"); - return -EFAULT; - } - - return 0; - } - - case TDA9840_LEVEL_ADJUST: - { - int byte = *(int*)arg; - - dprintk("tda9840.o: TDA9840_LEVEL_ADJUST: %d\n",byte); - - /* check for correct range */ - if ( byte > 25 || byte < -20 ) - return -EINVAL; - - /* calculate actual value to set, see specs, page 18 */ - byte /= 5; - if ( 0 < byte ) - byte += 0x8; - else - byte = -byte; - - if ( 0 != (result = i2c_smbus_write_byte_data(client, LEVEL_ADJUST, byte))) { - printk("tda9840.o: TDA9840_LEVEL_ADJUST error.\n"); - return -EFAULT; - } - - return 0; - } - - case TDA9840_STEREO_ADJUST: - { - int byte = *(int*)arg; - - dprintk("tda9840.o: TDA9840_STEREO_ADJUST: %d\n",byte); - - /* check for correct range */ - if ( byte > 25 || byte < -24 ) - return -EINVAL; - - /* calculate actual value to set */ - byte /= 5; - if ( 0 < byte ) - byte += 0x20; - else - byte = -byte; - - if ( 0 != (result = i2c_smbus_write_byte_data(client, STEREO_ADJUST, byte))) { - printk("tda9840.o: TDA9840_STEREO_ADJUST error.\n"); - return -EFAULT; - } - - return 0; - } - - case TDA9840_DETECT: - { - int byte = 0x0; - - if ( -1 == (byte = i2c_smbus_read_byte_data(client, STEREO_ADJUST))) { - printk("tda9840.o: TDA9840_DETECT error while reading.\n"); - return -EFAULT; - } - - if( 0 != (byte & 0x80)) { - dprintk("tda9840.o: TDA9840_DETECT, register contents invalid.\n"); - return -EFAULT; - } - - dprintk("tda9840.o: TDA9840_DETECT, result: 0x%02x (original byte)\n",byte); - - return ((byte & 0x60) >> 5); - } - - case TDA9840_TEST: - { - int byte = *(int*)arg; - - dprintk("tda9840.o: TDA9840_TEST: 0x%02x\n",byte); - - /* mask out irrelevant bits */ - byte &= 0x3; - - if ( 0 != (result = i2c_smbus_write_byte_data(client, TEST, byte))) { - printk("tda9840.o: TDA9840_TEST error.\n"); - return -EFAULT; - } - - return 0; - } - - default: - return -ENOIOCTLCMD; - } - - return 0; -} - -static int tda9840_detect(struct i2c_adapter *adapter, int address, unsigned short flags, int kind) -{ - struct i2c_client *client; - int result = 0; - - int byte = 0x0; - - /* let's see whether this adapter can support what we need */ - if ( 0 == i2c_check_functionality(adapter, I2C_FUNC_SMBUS_READ_BYTE_DATA|I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) { - return 0; - } - - /* allocate memory for client structure */ - client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); - if (0 == client) { - printk("tda9840.o: not enough kernel memory.\n"); - return -ENOMEM; - } - memset(client, 0, sizeof(struct i2c_client)); - - /* fill client structure */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) - sprintf(client->name,"tda9840 (0x%02x)", address); -#else - sprintf(client->dev.name,"tda9840 (0x%02x)", address); -#endif - client->id = tda9840_id++; - client->flags = 0; - client->addr = address; - client->adapter = adapter; - client->driver = &driver; - - /* tell the i2c layer a new client has arrived */ - if (0 != (result = i2c_attach_client(client))) { - kfree(client); - return result; - } - - /* set initial values for level & stereo - adjustment, mode */ - byte = 0; - if ( 0 != (result = tda9840_command(client, TDA9840_LEVEL_ADJUST, &byte))) { - printk("tda9840.o: could not initialize ic #1. continuing anyway. (result:%d)\n",result); - } - - if ( 0 != (result = tda9840_command(client, TDA9840_STEREO_ADJUST, &byte))) { - printk("tda9840.o: could not initialize ic #2. continuing anyway. (result:%d)\n",result); - } - - byte = TDA9840_SET_MONO; - if ( 0 != (result = tda9840_command(client, TDA9840_SWITCH, &byte))) { - printk("tda9840.o: could not initialize ic #3. continuing anyway. (result:%d)\n",result); - } - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) - printk("tda9840.o: detected @ 0x%02x on adapter %s\n",address,&client->adapter->name[0]); -#else - printk("tda9840.o: detected @ 0x%02x on adapter %s\n",address,&client->adapter->dev.name[0]); -#endif - return 0; -} - -static int tda9840_attach(struct i2c_adapter *adapter) -{ - /* let's see whether this is a know adapter we can attach to */ - if( adapter->id != I2C_ALGO_SAA7146 ) { -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) - dprintk("tda9840.o: refusing to probe on unknown adapter [name='%s',id=0x%x]\n",adapter->name,adapter->id); -#else - dprintk("tda9840.o: refusing to probe on unknown adapter [name='%s',id=0x%x]\n",adapter->dev.name,adapter->id); -#endif - return -ENODEV; - } - - return i2c_probe(adapter,&addr_data,&tda9840_detect); -} - -static int tda9840_detach(struct i2c_client *client) -{ - int err = 0; - - if ( 0 != (err = i2c_detach_client(client))) { - printk("tda9840.o: Client deregistration failed, client not detached.\n"); - return err; - } - - kfree(client); - - return 0; -} - -static struct i2c_driver driver = { -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,54) - .owner = THIS_MODULE, -#endif - .name = "tda9840 driver", - .id = I2C_DRIVERID_TDA9840, - .flags = I2C_DF_NOTIFY, - .attach_adapter = tda9840_attach, - .detach_client = tda9840_detach, - .command = tda9840_command, -}; - -static int tda9840_init_module(void) -{ - i2c_add_driver(&driver); - return 0; -} - -static void tda9840_cleanup_module(void) -{ - i2c_del_driver(&driver); -} - -module_init(tda9840_init_module); -module_exit(tda9840_cleanup_module); - -MODULE_AUTHOR("Michael Hunold <michael@mihu.de>"); -MODULE_DESCRIPTION("tda9840 driver"); -MODULE_LICENSE("GPL"); - diff --git a/linux/drivers/media/video/tda9840.h b/linux/drivers/media/video/tda9840.h deleted file mode 100644 index 28021053b..000000000 --- a/linux/drivers/media/video/tda9840.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef __INCLUDED_TDA9840__ -#define __INCLUDED_TDA9840__ - -#define I2C_TDA9840 0x42 - -#define TDA9840_DETECT _IOR('v',1,int) -/* return values for TDA9840_DETCT */ -#define TDA9840_MONO_DETECT 0x0 -#define TDA9840_DUAL_DETECT 0x1 -#define TDA9840_STEREO_DETECT 0x2 -#define TDA9840_INCORRECT_DETECT 0x3 - -#define TDA9840_SWITCH _IOW('v',2,int) -/* modes than can be set with TDA9840_SWITCH */ -#define TDA9840_SET_MUTE 0x00 -#define TDA9840_SET_MONO 0x10 -#define TDA9840_SET_STEREO 0x2a -#define TDA9840_SET_LANG1 0x12 -#define TDA9840_SET_LANG2 0x1e -#define TDA9840_SET_BOTH 0x1a -#define TDA9840_SET_BOTH_R 0x16 -#define TDA9840_SET_EXTERNAL 0x7a - -/* values may range between +2.5 and -2.0; - the value has to be multiplied with 10 */ -#define TDA9840_LEVEL_ADJUST _IOW('v',3,int) - -/* values may range between +2.5 and -2.4; - the value has to be multiplied with 10 */ -#define TDA9840_STEREO_ADJUST _IOW('v',4,int) - -/* currently not implemented */ -#define TDA9840_TEST _IOW('v',5,int) - -#endif diff --git a/linux/drivers/media/video/tea6415c.c b/linux/drivers/media/video/tea6415c.c deleted file mode 100644 index f8db1aacc..000000000 --- a/linux/drivers/media/video/tea6415c.c +++ /dev/null @@ -1,251 +0,0 @@ - /* - tea6415c.h - i2c-driver for the tea6415c by SGS Thomson - - Copyright (C) 1998-2003 Michael Hunold <michael@mihu.de> - - The tea6415c is a bus controlled video-matrix-switch - with 8 inputs and 6 outputs. - It is cascadable, i.e. it can be found at the addresses - 0x43 and 0x03 on the i2c-bus. - - For detailed informations download the specifications directly - from SGS Thomson at http://www.st.com - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License vs published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mvss Ave, Cambridge, MA 02139, USA. - */ - -#include <linux/version.h> -#include <linux/module.h> -#include <linux/kernel.h> -#include <linux/poll.h> -#include <linux/slab.h> -#include <linux/i2c.h> -#include <linux/init.h> -#include "tea6415c.h" - -static int debug = 0; /* insmod parameter */ -MODULE_PARM(debug,"i"); -#define dprintk if (debug) printk - -#define TEA6415C_NUM_INPUTS 8 -#define TEA6415C_NUM_OUTPUTS 6 - -/* addresses to scan, found only at 0x03 and/or 0x43 (7-bit) */ -static unsigned short normal_i2c[] = {I2C_TEA6415C_1, I2C_TEA6415C_2, I2C_CLIENT_END}; -static unsigned short normal_i2c_range[] = {I2C_CLIENT_END}; - -/* magic definition of all other variables and things */ -I2C_CLIENT_INSMOD; - -static struct i2c_driver driver; - -/* unique ID allocation */ -static int tea6415c_id = 0; - -/* this function is called by i2c_probe */ -static int tea6415c_detect(struct i2c_adapter *adapter, int address, unsigned short flags, int kind) -{ - struct i2c_client *client = 0; - int err = 0; - - /* let's see whether this adapter can support what we need */ - if ( 0 == i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WRITE_BYTE)) { - return 0; - } - - /* allocate memory for client structure */ - client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); - if (0 == client) { - return -ENOMEM; - } - memset(client, 0, sizeof(struct i2c_client)); - - /* fill client structure */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) - sprintf(client->name,"tea6415c (0x%02x)", address); -#else - sprintf(client->dev.name,"tea6415c (0x%02x)", address); -#endif - client->id = tea6415c_id++; - client->flags = 0; - client->addr = address; - client->adapter = adapter; - client->driver = &driver; - - /* tell the i2c layer a new client has arrived */ - if (0 != (err = i2c_attach_client(client))) { - kfree(client); - return err; - } - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) - printk("tea6415c.o: detected @ 0x%02x on adapter %s\n",address,&client->adapter->name[0]); -#else - printk("tea6415c.o: detected @ 0x%02x on adapter %s\n",address,&client->adapter->dev.name[0]); -#endif - - return 0; -} - -static int tea6415c_attach(struct i2c_adapter *adapter) -{ - /* let's see whether this is a know adapter we can attach to */ - if( adapter->id != I2C_ALGO_SAA7146 ) { -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) - dprintk("tea6415c.o: refusing to probe on unknown adapter [name='%s',id=0x%x]\n",adapter->name,adapter->id); -#else - dprintk("tea6415c.o: refusing to probe on unknown adapter [name='%s',id=0x%x]\n",adapter->dev.name,adapter->id); -#endif - return -ENODEV; - } - - return i2c_probe(adapter,&addr_data,&tea6415c_detect); -} - -static int tea6415c_detach(struct i2c_client *client) -{ - int err = 0; - - if ( 0 != (err = i2c_detach_client(client))) { - printk("tea6415c.o: Client deregistration failed, client not detached.\n"); - return err; - } - - kfree(client); - - return 0; -} - -/* makes a connection between the input-pin 'i' and the output-pin 'o' - for the tea6415c-client 'client' */ -static int tea6415c_switch(struct i2c_client *client, int i, int o) -{ - u8 byte = 0; - - dprintk("tea6415c.o: tea6415c_switch: adr:0x%02x, i:%d, o:%d\n", client->addr, i, o); - - /* check if the pins are valid */ - if ( 0 == (( 1 == i || 3 == i || 5 == i || 6 == i || 8 == i || 10 == i || 20 == i || 11 == i ) && - (18 == o || 17 == o || 16 == o || 15 == o || 14 == o || 13 == o ))) - return -1; - - /* to understand this, have a look at the tea6415c-specs (p.5) */ - switch(o) { - case 18: - byte = 0x00; - break; - case 14: - byte = 0x20; - break; - case 16: - byte = 0x10; - break; - case 17: - byte = 0x08; - break; - case 15: - byte = 0x18; - break; - case 13: - byte = 0x28; - break; - }; - - switch(i) { - case 5: - byte |= 0x00; - break; - case 8: - byte |= 0x04; - break; - case 3: - byte |= 0x02; - break; - case 20: - byte |= 0x06; - break; - case 6: - byte |= 0x01; - break; - case 10: - byte |= 0x05; - break; - case 1: - byte |= 0x03; - break; - case 11: - byte |= 0x07; - break; - }; - - if ( 0 != i2c_smbus_write_byte(client,byte)) { - dprintk("tea6415c.o: tea6415c_switch: could not write to tea6415c\n"); - return -1; - } - - return 0; -} - -static int tea6415c_command(struct i2c_client *client, unsigned int cmd, void* arg) -{ - struct tea6415c_multiplex *v = (struct tea6415c_multiplex*)arg; - int result = 0; - - switch (cmd) { - case TEA6415C_SWITCH: { - result = tea6415c_switch(client,v->in,v->out); - break; - } - default: { - return -ENOIOCTLCMD; - } - } - - if ( 0 != result ) - return result; - - return 0; -} - -static struct i2c_driver driver = { -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,54) - .owner = THIS_MODULE, -#endif - .name = "tea6415c driver", - .id = I2C_DRIVERID_TEA6415C, - .flags = I2C_DF_NOTIFY, - .attach_adapter = tea6415c_attach, - .detach_client = tea6415c_detach, - .command = tea6415c_command, -}; - -static int tea6415c_init_module(void) -{ - i2c_add_driver(&driver); - return 0; -} - -static void tea6415c_cleanup_module(void) -{ - i2c_del_driver(&driver); -} - -module_init(tea6415c_init_module); -module_exit(tea6415c_cleanup_module); - -MODULE_AUTHOR("Michael Hunold <michael@mihu.de>"); -MODULE_DESCRIPTION("tea6415c driver"); -MODULE_LICENSE("GPL"); - diff --git a/linux/drivers/media/video/tea6415c.h b/linux/drivers/media/video/tea6415c.h deleted file mode 100644 index f84ed8005..000000000 --- a/linux/drivers/media/video/tea6415c.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef __INCLUDED_TEA6415C__ -#define __INCLUDED_TEA6415C__ - -/* possible i2c-addresses */ -#define I2C_TEA6415C_1 0x03 -#define I2C_TEA6415C_2 0x43 - -/* the tea6415c's design is quite brain-dead. although there are - 8 inputs and 6 outputs, these aren't enumerated in any way. because - I don't want to say "connect input pin 20 to output pin 17", I define - a "virtual" pin-order. */ - -/* input pins */ -#define TEA6415C_OUTPUT1 18 -#define TEA6415C_OUTPUT2 14 -#define TEA6415C_OUTPUT3 16 -#define TEA6415C_OUTPUT4 17 -#define TEA6415C_OUTPUT5 13 -#define TEA6415C_OUTPUT6 15 - -/* output pins */ -#define TEA6415C_INPUT1 5 -#define TEA6415C_INPUT2 8 -#define TEA6415C_INPUT3 3 -#define TEA6415C_INPUT4 20 -#define TEA6415C_INPUT5 6 -#define TEA6415C_INPUT6 10 -#define TEA6415C_INPUT7 1 -#define TEA6415C_INPUT8 11 - -struct tea6415c_multiplex -{ - int in; /* input-pin */ - int out; /* output-pin */ -}; - -#define TEA6415C_SWITCH _IOW('v',1,struct tea6415c_multiplex) - -#endif diff --git a/linux/drivers/media/video/tea6420.c b/linux/drivers/media/video/tea6420.c deleted file mode 100644 index 6619439b0..000000000 --- a/linux/drivers/media/video/tea6420.c +++ /dev/null @@ -1,228 +0,0 @@ - /* - tea6420.o - i2c-driver for the tea6420 by SGS Thomson - - Copyright (C) 1998-2003 Michael Hunold <michael@mihu.de> - - The tea6420 is a bus controlled audio-matrix with 5 stereo inputs, - 4 stereo outputs and gain control for each output. - It is cascadable, i.e. it can be found at the adresses 0x98 - and 0x9a on the i2c-bus. - - For detailed informations download the specifications directly - from SGS Thomson at http://www.st.com - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <linux/version.h> -#include <linux/module.h> -#include <linux/kernel.h> -#include <linux/poll.h> -#include <linux/slab.h> -#include <linux/i2c.h> -#include <linux/init.h> - -#include "tea6420.h" - -static int debug = 0; /* insmod parameter */ -MODULE_PARM(debug,"i"); -#define dprintk if (debug) printk - -/* addresses to scan, found only at 0x4c and/or 0x4d (7-Bit) */ -static unsigned short normal_i2c[] = {I2C_TEA6420_1, I2C_TEA6420_2, I2C_CLIENT_END}; -static unsigned short normal_i2c_range[] = {I2C_CLIENT_END}; - -/* magic definition of all other variables and things */ -I2C_CLIENT_INSMOD; - -static struct i2c_driver driver; - -/* unique ID allocation */ -static int tea6420_id = 0; - -/* make a connection between the input 'i' and the output 'o' - with gain 'g' for the tea6420-client 'client' (note: i = 6 means 'mute') */ -static int tea6420_switch(struct i2c_client *client, int i, int o, int g) -{ - u8 byte = 0; - - int result = 0; - - dprintk("tea6420.o: tea6420_switch: adr:0x%02x, i:%d, o:%d, g:%d\n",client->addr,i,o,g); - - /* check if the paramters are valid */ - if ( i < 1 || i > 6 || o < 1 || o > 4 || g < 0 || g > 6 || g%2 != 0 ) - return -1; - - byte = ((o-1)<<5); - byte |= (i-1); - - /* to understand this, have a look at the tea6420-specs (p.5) */ - switch(g) { - case 0: - byte |= (3<<3); - break; - case 2: - byte |= (2<<3); - break; - case 4: - byte |= (1<<3); - break; - case 6: - break; - } - - /* fixme?: 1 != ... => 0 != */ - if ( 0 != (result = i2c_smbus_write_byte(client,byte))) { - printk("tea6402:%d\n",result); - dprintk(KERN_ERR "tea6420.o: could not switch, result:%d\n",result); - return -EFAULT; - } - - return 0; -} - -/* this function is called by i2c_probe */ -static int tea6420_detect(struct i2c_adapter *adapter, int address, unsigned short flags, int kind) -{ - struct i2c_client *client; - int err = 0, i = 0; - - /* let's see whether this adapter can support what we need */ - if ( 0 == i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WRITE_BYTE)) { - return 0; - } - - /* allocate memory for client structure */ - client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); - if (0 == client) { - return -ENOMEM; - } - memset(client, 0, sizeof(struct i2c_client)); - - /* fill client structure */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) - sprintf(client->name,"tea6420 (0x%02x)", address); -#else - sprintf(client->dev.name,"tea6420 (0x%02x)", address); -#endif - client->id = tea6420_id++; - client->flags = 0; - client->addr = address; - client->adapter = adapter; - client->driver = &driver; - - /* tell the i2c layer a new client has arrived */ - if (0 != (err = i2c_attach_client(client))) { - kfree(client); - return err; - } - - /* set initial values: set "mute"-input to all outputs at gain 0 */ - err = 0; - for(i = 1; i < 5; i++) { - err += tea6420_switch(client, 6, i, 0); - } - if( 0 != err) { - printk("tea6420.o: could not initialize chipset. continuing anyway.\n"); - } - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) - printk("tea6420.o: detected @ 0x%02x on adapter %s\n",address,&client->adapter->name[0]); -#else - printk("tea6420.o: detected @ 0x%02x on adapter %s\n",address,&client->adapter->dev.name[0]); -#endif - return 0; -} - -static int tea6420_attach(struct i2c_adapter *adapter) -{ - /* let's see whether this is a know adapter we can attach to */ - if( adapter->id != I2C_ALGO_SAA7146 ) { -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) - dprintk("tea6420.o: refusing to probe on unknown adapter [name='%s',id=0x%x]\n",adapter->name,adapter->id); -#else - dprintk("tea6420.o: refusing to probe on unknown adapter [name='%s',id=0x%x]\n",adapter->dev.name,adapter->id); -#endif - return -ENODEV; - } - - return i2c_probe(adapter,&addr_data,&tea6420_detect); -} - -static int tea6420_detach(struct i2c_client *client) -{ - int err = 0; - - if ( 0 != (err = i2c_detach_client(client))) { - printk("tea6420.o: Client deregistration failed, client not detached.\n"); - return err; - } - - kfree(client); - - return 0; -} - -static int tea6420_command(struct i2c_client *client, unsigned int cmd, void* arg) -{ - struct tea6420_multiplex *a = (struct tea6420_multiplex*)arg; - int result = 0; - - switch (cmd) { - case TEA6420_SWITCH: { - result = tea6420_switch(client,a->in,a->out,a->gain); - break; - } - default: { - return -ENOIOCTLCMD; - } - } - - if ( 0 != result ) - return result; - - return 0; -} - -static struct i2c_driver driver = { -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,54) - .owner = THIS_MODULE, -#endif - .name = "tea6420 driver", - .id = I2C_DRIVERID_TEA6420, - .flags = I2C_DF_NOTIFY, - .attach_adapter = tea6420_attach, - .detach_client = tea6420_detach, - .command = tea6420_command, -}; - -static int tea6420_init_module(void) -{ - i2c_add_driver(&driver); - return 0; -} - -static void tea6420_cleanup_module(void) -{ - i2c_del_driver(&driver); -} - -module_init(tea6420_init_module); -module_exit(tea6420_cleanup_module); - -MODULE_AUTHOR("Michael Hunold <michael@mihu.de>"); -MODULE_DESCRIPTION("tea6420 driver"); -MODULE_LICENSE("GPL"); diff --git a/linux/drivers/media/video/tea6420.h b/linux/drivers/media/video/tea6420.h deleted file mode 100644 index ea664df15..000000000 --- a/linux/drivers/media/video/tea6420.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef __INCLUDED_TEA6420__ -#define __INCLUDED_TEA6420__ - -/* possible addresses */ -#define I2C_TEA6420_1 0x4c -#define I2C_TEA6420_2 0x4d - -struct tea6420_multiplex -{ - int in; /* input of audio switch */ - int out; /* output of audio switch */ - int gain; /* gain of connection */ -}; - -#define TEA6420_SWITCH _IOW('v',1,struct tea6420_multiplex) - -#endif |