aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/dvb/mantis/Makefile1
-rw-r--r--drivers/media/dvb/mantis/mantis_ca.c127
-rw-r--r--drivers/media/dvb/mantis/mantis_evm.c4
-rw-r--r--drivers/media/dvb/mantis/mantis_link.h8
4 files changed, 140 insertions, 0 deletions
diff --git a/drivers/media/dvb/mantis/Makefile b/drivers/media/dvb/mantis/Makefile
index 38d0e6dbafe..c4da0d8ed18 100644
--- a/drivers/media/dvb/mantis/Makefile
+++ b/drivers/media/dvb/mantis/Makefile
@@ -4,6 +4,7 @@ mantis-objs = mantis_core.o \
4 mantis_i2c.o \ 4 mantis_i2c.o \
5 mantis_dvb.o \ 5 mantis_dvb.o \
6 mantis_evm.o \ 6 mantis_evm.o \
7 mantis_ca.o \
7 mantis_pcmcia.o \ 8 mantis_pcmcia.o \
8 mantis_vp1033.o \ 9 mantis_vp1033.o \
9 mantis_vp1034.o \ 10 mantis_vp1034.o \
diff --git a/drivers/media/dvb/mantis/mantis_ca.c b/drivers/media/dvb/mantis/mantis_ca.c
new file mode 100644
index 00000000000..6e440d31b79
--- /dev/null
+++ b/drivers/media/dvb/mantis/mantis_ca.c
@@ -0,0 +1,127 @@
1/*
2 Mantis PCI bridge driver
3
4 Copyright (C) 2005, 2006 Manu Abraham (abraham.manu@gmail.com)
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19*/
20
21#include "mantis_common.h"
22#include "mantis_link.h"
23#include "mantis_hif.h"
24
25
26static int mantis_ca_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long parg)
27{
28 return 0;
29}
30
31static int mantis_ca_open(struct inode *inode, struct file *file)
32{
33 return 0;
34}
35
36static int mantis_ca_release(struct inode *inode, struct file *file)
37{
38 return 0;
39}
40
41static ssize_t mantis_ca_read(struct file *file, char __user *buffer, size_t count, loff_t *ofset)
42{
43 struct dvb_device *dvbdev = file->private_data;
44 struct mantis_ca *ca = dvbdev->priv;
45
46 int status;
47
48 return 0;
49error:
50 return status;
51}
52
53static ssize_t mantis_ca_write(struct file *file, const char __user *buffer, size_t count, loff_t *offset)
54{
55 struct dvb_device *dvbdev = file->private_data;
56 struct mantis_ca *ca = dvbdev->priv;
57
58 int status;
59
60 return 0;
61error:
62 return status;
63}
64
65static struct file_operations mantis_fops = {
66 .owner = THIS_MODULE,
67 .ioctl = mantis_ca_ioctl,
68 .open = mantis_ca_open,
69 .release = mantis_ca_release,
70 .read = mantis_ca_read,
71 .write = mantis_ca_write,
72};
73
74static struct dvb_device mantis_ca = {
75 .priv = NULL,
76 .users = 1,
77 .readers = 1,
78 .writers = 1,
79 .fops = &mantis_fops,
80};
81
82struct dvb_device *mantis_ca_init(struct mantis_pci *mantis)
83{
84 int ret;
85
86 struct dvb_device *dvbdev;
87 struct dvb_adapter *dvb_adapter = &mantis->dvb_adapter;
88 struct mantis_ca *ca;
89
90 if (!(ca = kzalloc(sizeof (struct mantis_ca), GFP_KERNEL))) {
91 dprintk(verbose, MANTIS_ERROR, 1, "Out of memory!, exiting ..");
92 return NULL;
93 }
94
95 ca->ca_priv = mantis;
96 mantis->mantis_ca = ca;
97 mantis_evmgr_init(ca);
98
99 dprintk(verbose, MANTIS_ERROR, 0, "CA: Registering Mantis Adapter(%d) Slot(0)\n", mantis->num);
100 if (dvb_register_device(dvb_adapter, &dvbdev, &mantis_ca, ca, DVB_DEVICE_CA) == 0) {
101 ca->ca_dev = dvbdev;
102 return ca->ca_dev;
103 }
104 return 0;
105
106error:
107 if (ca != NULL) {
108 dprintk(verbose, MANTIS_ERROR, 1, "Error ..");
109 if (ca->ca_dev != NULL)
110 dvb_unregister_device(ca->ca_dev);
111
112 kfree(ca);
113 }
114 return NULL;
115}
116
117void mantis_ca_exit(struct mantis_pci *mantis)
118{
119 struct mantis_ca *ca = mantis->mantis_ca;
120
121 mantis_evmgr_exit(ca);
122 dprintk(verbose, MANTIS_ERROR, 0, "CA: Unregister Mantis Adapter(%d) Slot(0)\n", mantis->num);
123 if (ca->ca_dev)
124 dvb_unregister_device(ca->ca_dev);
125
126 kfree(ca);
127}
diff --git a/drivers/media/dvb/mantis/mantis_evm.c b/drivers/media/dvb/mantis/mantis_evm.c
index 9f1740ea389..c4a1c89431e 100644
--- a/drivers/media/dvb/mantis/mantis_evm.c
+++ b/drivers/media/dvb/mantis/mantis_evm.c
@@ -90,6 +90,8 @@ int mantis_evmgr_init(struct mantis_ca *ca)
90 dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Initializing Mantis Host I/F Event manager"); 90 dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Initializing Mantis Host I/F Event manager");
91 tasklet_init(&ca->hif_evm_tasklet, mantis_hifevm_tasklet, (unsigned long) ca); 91 tasklet_init(&ca->hif_evm_tasklet, mantis_hifevm_tasklet, (unsigned long) ca);
92 92
93 mantis_pcmcia_init(ca);
94
93 return 0; 95 return 0;
94} 96}
95 97
@@ -99,4 +101,6 @@ void mantis_evmgr_exit(struct mantis_ca *ca)
99 101
100 dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Mantis Host I/F Event manager exiting"); 102 dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Mantis Host I/F Event manager exiting");
101 tasklet_kill(&ca->hif_evm_tasklet); 103 tasklet_kill(&ca->hif_evm_tasklet);
104
105 mantis_pcmcia_exit(ca);
102} 106}
diff --git a/drivers/media/dvb/mantis/mantis_link.h b/drivers/media/dvb/mantis/mantis_link.h
index c6b32229edd..a45dd7185e0 100644
--- a/drivers/media/dvb/mantis/mantis_link.h
+++ b/drivers/media/dvb/mantis/mantis_link.h
@@ -56,4 +56,12 @@ struct mantis_ca {
56 void *ca_priv; 56 void *ca_priv;
57}; 57};
58 58
59/* CA */
60extern void mantis_event_cam_plugin(struct mantis_ca *ca);
61extern void mantis_event_cam_unplug(struct mantis_ca *ca);
62extern int mantis_pcmcia_init(struct mantis_ca *ca);
63extern void mantis_pcmcia_exit(struct mantis_ca *ca);
64extern int mantis_evmgr_init(struct mantis_ca *ca);
65extern void mantis_evmgr_exit(struct mantis_ca *ca);
66
59#endif // __MANTIS_LINK_H 67#endif // __MANTIS_LINK_H