[PATCH] USB: add LD devices to hid blacklist
[linux-2.6/linux-loongson.git] / drivers / media / video / bttv-if.c
blobf7b5543a96a1bf760df9ff1c96f01fba8d4a7968
1 /*
2 $Id: bttv-if.c,v 1.4 2004/11/17 18:47:47 kraxel Exp $
4 bttv-if.c -- old gpio interface to other kernel modules
5 don't use in new code, will go away in 2.7
6 have a look at bttv-gpio.c instead.
8 bttv - Bt848 frame grabber driver
10 Copyright (C) 1996,97,98 Ralph Metzler (rjkm@thp.uni-koeln.de)
11 & Marcus Metzler (mocm@thp.uni-koeln.de)
12 (c) 1999-2003 Gerd Knorr <kraxel@bytesex.org>
14 This program is free software; you can redistribute it and/or modify
15 it under the terms of the GNU General Public License as published by
16 the Free Software Foundation; either version 2 of the License, or
17 (at your option) any later version.
19 This program is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU General Public License for more details.
24 You should have received a copy of the GNU General Public License
25 along with this program; if not, write to the Free Software
26 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
30 #include <linux/module.h>
31 #include <linux/init.h>
32 #include <linux/delay.h>
33 #include <asm/io.h>
35 #include "bttvp.h"
37 EXPORT_SYMBOL(bttv_get_cardinfo);
38 EXPORT_SYMBOL(bttv_get_pcidev);
39 EXPORT_SYMBOL(bttv_get_id);
40 EXPORT_SYMBOL(bttv_gpio_enable);
41 EXPORT_SYMBOL(bttv_read_gpio);
42 EXPORT_SYMBOL(bttv_write_gpio);
43 EXPORT_SYMBOL(bttv_get_gpio_queue);
44 EXPORT_SYMBOL(bttv_i2c_call);
46 /* ----------------------------------------------------------------------- */
47 /* Exported functions - for other modules which want to access the */
48 /* gpio ports (IR for example) */
49 /* see bttv.h for comments */
51 int bttv_get_cardinfo(unsigned int card, int *type, unsigned *cardid)
53 printk("The bttv_* interface is obsolete and will go away,\n"
54 "please use the new, sysfs based interface instead.\n");
55 if (card >= bttv_num) {
56 return -1;
58 *type = bttvs[card].c.type;
59 *cardid = bttvs[card].cardid;
60 return 0;
63 struct pci_dev* bttv_get_pcidev(unsigned int card)
65 if (card >= bttv_num)
66 return NULL;
67 return bttvs[card].c.pci;
70 int bttv_get_id(unsigned int card)
72 printk("The bttv_* interface is obsolete and will go away,\n"
73 "please use the new, sysfs based interface instead.\n");
74 if (card >= bttv_num) {
75 return -1;
77 return bttvs[card].c.type;
81 int bttv_gpio_enable(unsigned int card, unsigned long mask, unsigned long data)
83 struct bttv *btv;
85 if (card >= bttv_num) {
86 return -EINVAL;
89 btv = &bttvs[card];
90 gpio_inout(mask,data);
91 if (bttv_gpio)
92 bttv_gpio_tracking(btv,"extern enable");
93 return 0;
96 int bttv_read_gpio(unsigned int card, unsigned long *data)
98 struct bttv *btv;
100 if (card >= bttv_num) {
101 return -EINVAL;
104 btv = &bttvs[card];
106 if(btv->shutdown) {
107 return -ENODEV;
110 /* prior setting BT848_GPIO_REG_INP is (probably) not needed
111 because we set direct input on init */
112 *data = gpio_read();
113 return 0;
116 int bttv_write_gpio(unsigned int card, unsigned long mask, unsigned long data)
118 struct bttv *btv;
120 if (card >= bttv_num) {
121 return -EINVAL;
124 btv = &bttvs[card];
126 /* prior setting BT848_GPIO_REG_INP is (probably) not needed
127 because direct input is set on init */
128 gpio_bits(mask,data);
129 if (bttv_gpio)
130 bttv_gpio_tracking(btv,"extern write");
131 return 0;
134 wait_queue_head_t* bttv_get_gpio_queue(unsigned int card)
136 struct bttv *btv;
138 if (card >= bttv_num) {
139 return NULL;
142 btv = &bttvs[card];
143 if (bttvs[card].shutdown) {
144 return NULL;
146 return &btv->gpioq;
149 void bttv_i2c_call(unsigned int card, unsigned int cmd, void *arg)
151 if (card >= bttv_num)
152 return;
153 bttv_call_i2c_clients(&bttvs[card], cmd, arg);
157 * Local variables:
158 * c-basic-offset: 8
159 * End: