V4L/DVB (13738): [Mantis] Enable IRQ0 events
[deliverable/linux.git] / drivers / media / dvb / mantis / mantis_evm.c
CommitLineData
d575571e
MA
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"
fadfa070
MA
23#include "mantis_hif.h"
24
25void mantis_hifevm_tasklet(unsigned long data)
26{
27 struct mantis_ca *ca = (struct mantis_ca *) data;
28 struct mantis_pci *mantis = ca->ca_priv;
29
30 u32 gpif_stat;
31
32 gpif_stat = mmread(MANTIS_GPIF_STATUS);
33
34 if (gpif_stat & MANTIS_GPIF_DETSTAT) {
35 if (gpif_stat & MANTIS_CARD_PLUGIN) {
d9dd5f71 36 dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): CAM Plugin", mantis->num);
fadfa070
MA
37 mmwrite(0xdada0000, MANTIS_CARD_RESET);
38 // Plugin call here
39 gpif_stat = 0; // crude !
40 }
41 } else {
42 if (gpif_stat & MANTIS_CARD_PLUGOUT) {
d9dd5f71 43 dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): CAM Unplug", mantis->num);
fadfa070
MA
44 mmwrite(0xdada0000, MANTIS_CARD_RESET);
45 // Unplug call here
46 gpif_stat = 0; // crude !
47 }
48 }
49
50 if (gpif_stat & MANTIS_GPIF_EXTIRQ)
d9dd5f71 51 dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Ext IRQ", mantis->num);
fadfa070
MA
52
53 if (gpif_stat & MANTIS_SBUF_WSTO)
d9dd5f71 54 dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Timeout", mantis->num);
fadfa070
MA
55
56 if (gpif_stat & MANTIS_GPIF_OTHERR)
d9dd5f71 57 dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Alignment Error", mantis->num);
fadfa070
MA
58
59 if (gpif_stat & MANTIS_SBUF_OVFLW)
d9dd5f71 60 dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Overflow", mantis->num);
fadfa070
MA
61
62 if (gpif_stat & MANTIS_GPIF_BRRDY) {
d9dd5f71 63 dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Read Ready", mantis->num);
fadfa070
MA
64 ca->sbuf_status = MANTIS_SBUF_DATA_AVAIL;
65 if (ca->hif_job_queue & MANTIS_HIF_MEMRD)
66 wake_up(&ca->hif_brrdyw_wq);
67 }
68 if (gpif_stat & MANTIS_GPIF_WRACK)
d9dd5f71 69 dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Slave Write ACK", mantis->num);
fadfa070
MA
70
71 if (gpif_stat & MANTIS_GPIF_INTSTAT)
d9dd5f71 72 dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): GPIF IRQ", mantis->num);
fadfa070
MA
73
74 if (gpif_stat & MANTIS_SBUF_EMPTY)
d9dd5f71 75 dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Empty", mantis->num);
fadfa070
MA
76
77 if (gpif_stat & MANTIS_SBUF_OPDONE) {
d9dd5f71 78 dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer operation complete", mantis->num);
fadfa070
MA
79 if (ca->hif_job_queue) {
80 wake_up(&ca->hif_opdone_wq);
81 ca->hif_event = MANTIS_SBUF_OPDONE;
82 }
83 }
84}
d575571e
MA
85
86int mantis_evmgr_init(struct mantis_ca *ca)
87{
88 struct mantis_pci *mantis = ca->ca_priv;
89
d9dd5f71 90 dprintk(verbose, MANTIS_DEBUG, 1, "Initializing Mantis Host I/F Event manager");
fadfa070
MA
91 tasklet_init(&ca->hif_evm_tasklet, mantis_hifevm_tasklet, (unsigned long) ca);
92
50d82602
MA
93 mantis_pcmcia_init(ca);
94
d575571e
MA
95 return 0;
96}
97
98void mantis_evmgr_exit(struct mantis_ca *ca)
99{
100 struct mantis_pci *mantis = ca->ca_priv;
101
d9dd5f71 102 dprintk(verbose, MANTIS_DEBUG, 1, "Mantis Host I/F Event manager exiting");
fadfa070 103 tasklet_kill(&ca->hif_evm_tasklet);
50d82602
MA
104
105 mantis_pcmcia_exit(ca);
d575571e 106}
This page took 0.033735 seconds and 5 git commands to generate.