MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / drivers / media / video / bttv-if.c
blob74da71195ba811d9b1abecdf0628509d99c78f88
1 /*
2 bttv-if.c -- old gpio interface to other kernel modules
3 don't use in new code, will go away in 2.7
4 have a look at bttv-gpio.c instead.
6 bttv - Bt848 frame grabber driver
8 Copyright (C) 1996,97,98 Ralph Metzler (rjkm@thp.uni-koeln.de)
9 & Marcus Metzler (mocm@thp.uni-koeln.de)
10 (c) 1999-2003 Gerd Knorr <kraxel@bytesex.org>
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 #include <linux/module.h>
29 #include <linux/init.h>
30 #include <linux/delay.h>
31 #include <asm/io.h>
33 #include "bttvp.h"
35 EXPORT_SYMBOL(bttv_get_cardinfo);
36 EXPORT_SYMBOL(bttv_get_pcidev);
37 EXPORT_SYMBOL(bttv_get_id);
38 EXPORT_SYMBOL(bttv_gpio_enable);
39 EXPORT_SYMBOL(bttv_read_gpio);
40 EXPORT_SYMBOL(bttv_write_gpio);
41 EXPORT_SYMBOL(bttv_get_gpio_queue);
42 EXPORT_SYMBOL(bttv_i2c_call);
44 /* ----------------------------------------------------------------------- */
45 /* Exported functions - for other modules which want to access the */
46 /* gpio ports (IR for example) */
47 /* see bttv.h for comments */
49 int bttv_get_cardinfo(unsigned int card, int *type, unsigned *cardid)
51 if (card >= bttv_num) {
52 return -1;
54 *type = bttvs[card].c.type;
55 *cardid = bttvs[card].cardid;
56 return 0;
59 struct pci_dev* bttv_get_pcidev(unsigned int card)
61 if (card >= bttv_num)
62 return NULL;
63 return bttvs[card].c.pci;
66 int bttv_get_id(unsigned int card)
68 printk("bttv_get_id is obsolete, use bttv_get_cardinfo instead\n");
69 if (card >= bttv_num) {
70 return -1;
72 return bttvs[card].c.type;
76 int bttv_gpio_enable(unsigned int card, unsigned long mask, unsigned long data)
78 struct bttv *btv;
80 if (card >= bttv_num) {
81 return -EINVAL;
84 btv = &bttvs[card];
85 gpio_inout(mask,data);
86 if (bttv_gpio)
87 bttv_gpio_tracking(btv,"extern enable");
88 return 0;
91 int bttv_read_gpio(unsigned int card, unsigned long *data)
93 struct bttv *btv;
95 if (card >= bttv_num) {
96 return -EINVAL;
99 btv = &bttvs[card];
101 if(btv->shutdown) {
102 return -ENODEV;
105 /* prior setting BT848_GPIO_REG_INP is (probably) not needed
106 because we set direct input on init */
107 *data = gpio_read();
108 return 0;
111 int bttv_write_gpio(unsigned int card, unsigned long mask, unsigned long data)
113 struct bttv *btv;
115 if (card >= bttv_num) {
116 return -EINVAL;
119 btv = &bttvs[card];
121 /* prior setting BT848_GPIO_REG_INP is (probably) not needed
122 because direct input is set on init */
123 gpio_bits(mask,data);
124 if (bttv_gpio)
125 bttv_gpio_tracking(btv,"extern write");
126 return 0;
129 wait_queue_head_t* bttv_get_gpio_queue(unsigned int card)
131 struct bttv *btv;
133 if (card >= bttv_num) {
134 return NULL;
137 btv = &bttvs[card];
138 if (bttvs[card].shutdown) {
139 return NULL;
141 return &btv->gpioq;
145 * Local variables:
146 * c-basic-offset: 8
147 * End: