aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/bt8xx/bttv-if.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/bt8xx/bttv-if.c')
-rw-r--r--drivers/media/video/bt8xx/bttv-if.c159
1 files changed, 159 insertions, 0 deletions
diff --git a/drivers/media/video/bt8xx/bttv-if.c b/drivers/media/video/bt8xx/bttv-if.c
new file mode 100644
index 000000000000..19b564ab0e92
--- /dev/null
+++ b/drivers/media/video/bt8xx/bttv-if.c
@@ -0,0 +1,159 @@
1/*
2
3 bttv-if.c -- old gpio interface to other kernel modules
4 don't use in new code, will go away in 2.7
5 have a look at bttv-gpio.c instead.
6
7 bttv - Bt848 frame grabber driver
8
9 Copyright (C) 1996,97,98 Ralph Metzler (rjkm@thp.uni-koeln.de)
10 & Marcus Metzler (mocm@thp.uni-koeln.de)
11 (c) 1999-2003 Gerd Knorr <kraxel@bytesex.org>
12
13 This program is free software; you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation; either version 2 of the License, or
16 (at your option) any later version.
17
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26
27*/
28
29#include <linux/module.h>
30#include <linux/init.h>
31#include <linux/delay.h>
32#include <asm/io.h>
33
34#include "bttvp.h"
35
36EXPORT_SYMBOL(bttv_get_cardinfo);
37EXPORT_SYMBOL(bttv_get_pcidev);
38EXPORT_SYMBOL(bttv_get_id);
39EXPORT_SYMBOL(bttv_gpio_enable);
40EXPORT_SYMBOL(bttv_read_gpio);
41EXPORT_SYMBOL(bttv_write_gpio);
42EXPORT_SYMBOL(bttv_get_gpio_queue);
43EXPORT_SYMBOL(bttv_i2c_call);
44
45/* ----------------------------------------------------------------------- */
46/* Exported functions - for other modules which want to access the */
47/* gpio ports (IR for example) */
48/* see bttv.h for comments */
49
50int bttv_get_cardinfo(unsigned int card, int *type, unsigned *cardid)
51{
52 printk("The bttv_* interface is obsolete and will go away,\n"
53 "please use the new, sysfs based interface instead.\n");
54 if (card >= bttv_num) {
55 return -1;
56 }
57 *type = bttvs[card].c.type;
58 *cardid = bttvs[card].cardid;
59 return 0;
60}
61
62struct pci_dev* bttv_get_pcidev(unsigned int card)
63{
64 if (card >= bttv_num)
65 return NULL;
66 return bttvs[card].c.pci;
67}
68
69int bttv_get_id(unsigned int card)
70{
71 printk("The bttv_* interface is obsolete and will go away,\n"
72 "please use the new, sysfs based interface instead.\n");
73 if (card >= bttv_num) {
74 return -1;
75 }
76 return bttvs[card].c.type;
77}
78
79
80int bttv_gpio_enable(unsigned int card, unsigned long mask, unsigned long data)
81{
82 struct bttv *btv;
83
84 if (card >= bttv_num) {
85 return -EINVAL;
86 }
87
88 btv = &bttvs[card];
89 gpio_inout(mask,data);
90 if (bttv_gpio)
91 bttv_gpio_tracking(btv,"extern enable");
92 return 0;
93}
94
95int bttv_read_gpio(unsigned int card, unsigned long *data)
96{
97 struct bttv *btv;
98
99 if (card >= bttv_num) {
100 return -EINVAL;
101 }
102
103 btv = &bttvs[card];
104
105 if(btv->shutdown) {
106 return -ENODEV;
107 }
108
109/* prior setting BT848_GPIO_REG_INP is (probably) not needed
110 because we set direct input on init */
111 *data = gpio_read();
112 return 0;
113}
114
115int bttv_write_gpio(unsigned int card, unsigned long mask, unsigned long data)
116{
117 struct bttv *btv;
118
119 if (card >= bttv_num) {
120 return -EINVAL;
121 }
122
123 btv = &bttvs[card];
124
125/* prior setting BT848_GPIO_REG_INP is (probably) not needed
126 because direct input is set on init */
127 gpio_bits(mask,data);
128 if (bttv_gpio)
129 bttv_gpio_tracking(btv,"extern write");
130 return 0;
131}
132
133wait_queue_head_t* bttv_get_gpio_queue(unsigned int card)
134{
135 struct bttv *btv;
136
137 if (card >= bttv_num) {
138 return NULL;
139 }
140
141 btv = &bttvs[card];
142 if (bttvs[card].shutdown) {
143 return NULL;
144 }
145 return &btv->gpioq;
146}
147
148void bttv_i2c_call(unsigned int card, unsigned int cmd, void *arg)
149{
150 if (card >= bttv_num)
151 return;
152 bttv_call_i2c_clients(&bttvs[card], cmd, arg);
153}
154
155/*
156 * Local variables:
157 * c-basic-offset: 8
158 * End:
159 */