net: remove interrupt.h inclusion from netdevice.h
[linux-3.10.git] / drivers / media / dvb / mantis / mantis_common.h
1 /*
2         Mantis PCI bridge driver
3
4         Copyright (C) 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 #ifndef __MANTIS_COMMON_H
22 #define __MANTIS_COMMON_H
23
24 #include <linux/interrupt.h>
25 #include <linux/mutex.h>
26 #include <linux/workqueue.h>
27
28 #include "mantis_uart.h"
29
30 #include "mantis_link.h"
31
32 #define MANTIS_ERROR            0
33 #define MANTIS_NOTICE           1
34 #define MANTIS_INFO             2
35 #define MANTIS_DEBUG            3
36 #define MANTIS_TMG              9
37
38 #define dprintk(y, z, format, arg...) do {                                                              \
39         if (z) {                                                                                        \
40                 if      ((mantis->verbose > MANTIS_ERROR) && (mantis->verbose > y))                     \
41                         printk(KERN_ERR "%s (%d): " format "\n" , __func__ , mantis->num , ##arg);      \
42                 else if ((mantis->verbose > MANTIS_NOTICE) && (mantis->verbose > y))                    \
43                         printk(KERN_NOTICE "%s (%d): " format "\n" , __func__ , mantis->num , ##arg);   \
44                 else if ((mantis->verbose > MANTIS_INFO) && (mantis->verbose > y))                      \
45                         printk(KERN_INFO "%s (%d): " format "\n" , __func__ , mantis->num , ##arg);     \
46                 else if ((mantis->verbose > MANTIS_DEBUG) && (mantis->verbose > y))                     \
47                         printk(KERN_DEBUG "%s (%d): " format "\n" , __func__ , mantis->num , ##arg);    \
48                 else if ((mantis->verbose > MANTIS_TMG) && (mantis->verbose > y))                       \
49                         printk(KERN_DEBUG "%s (%d): " format "\n" , __func__ , mantis->num , ##arg);    \
50         } else {                                                                                        \
51                 if (mantis->verbose > y)                                                                \
52                         printk(format , ##arg);                                                         \
53         }                                                                                               \
54 } while(0)
55
56 #define mwrite(dat, addr)       writel((dat), addr)
57 #define mread(addr)             readl(addr)
58
59 #define mmwrite(dat, addr)      mwrite((dat), (mantis->mmio + (addr)))
60 #define mmread(addr)            mread(mantis->mmio + (addr))
61
62 #define MANTIS_TS_188           0
63 #define MANTIS_TS_204           1
64
65 #define TWINHAN_TECHNOLOGIES    0x1822
66 #define MANTIS                  0x4e35
67
68 #define TECHNISAT               0x1ae4
69 #define TERRATEC                0x153b
70
71 #define MAKE_ENTRY(__subven, __subdev, __configptr) {                   \
72                 .vendor         = TWINHAN_TECHNOLOGIES,                 \
73                 .device         = MANTIS,                               \
74                 .subvendor      = (__subven),                           \
75                 .subdevice      = (__subdev),                           \
76                 .driver_data    = (unsigned long) (__configptr)         \
77 }
78
79 enum mantis_i2c_mode {
80         MANTIS_PAGE_MODE = 0,
81         MANTIS_BYTE_MODE,
82 };
83
84 struct mantis_pci;
85
86 struct mantis_hwconfig {
87         char                    *model_name;
88         char                    *dev_type;
89         u32                     ts_size;
90
91         enum mantis_baud        baud_rate;
92         enum mantis_parity      parity;
93         u32                     bytes;
94
95         irqreturn_t (*irq_handler)(int irq, void *dev_id);
96         int (*frontend_init)(struct mantis_pci *mantis, struct dvb_frontend *fe);
97
98         u8                      power;
99         u8                      reset;
100
101         enum mantis_i2c_mode    i2c_mode;
102 };
103
104 struct mantis_pci {
105         unsigned int            verbose;
106
107         /*      PCI stuff               */
108         u16                     vendor_id;
109         u16                     device_id;
110         u16                     subsystem_vendor;
111         u16                     subsystem_device;
112
113         u8                      latency;
114
115         struct pci_dev          *pdev;
116
117         unsigned long           mantis_addr;
118         void __iomem            *mmio;
119
120         u8                      irq;
121         u8                      revision;
122
123         unsigned int            num;
124
125         /*      RISC Core               */
126         u32                     finished_block;
127         u32                     last_block;
128         u32                     line_bytes;
129         u32                     line_count;
130         u32                     risc_pos;
131         u8                      *buf_cpu;
132         dma_addr_t              buf_dma;
133         u32                     *risc_cpu;
134         dma_addr_t              risc_dma;
135
136         struct tasklet_struct   tasklet;
137
138         struct i2c_adapter      adapter;
139         int                     i2c_rc;
140         wait_queue_head_t       i2c_wq;
141         struct mutex            i2c_lock;
142
143         /*      DVB stuff               */
144         struct dvb_adapter      dvb_adapter;
145         struct dvb_frontend     *fe;
146         struct dvb_demux        demux;
147         struct dmxdev           dmxdev;
148         struct dmx_frontend     fe_hw;
149         struct dmx_frontend     fe_mem;
150         struct dvb_net          dvbnet;
151
152         u8                      feeds;
153
154         struct mantis_hwconfig  *hwconfig;
155
156         u32                     mantis_int_stat;
157         u32                     mantis_int_mask;
158
159         /*      board specific          */
160         u8                      mac_address[8];
161         u32                     sub_vendor_id;
162         u32                     sub_device_id;
163
164          /*     A12 A13 A14             */
165         u32                     gpio_status;
166
167         u32                     gpif_status;
168
169         struct mantis_ca        *mantis_ca;
170
171         wait_queue_head_t       uart_wq;
172         struct work_struct      uart_work;
173         spinlock_t              uart_lock;
174
175         struct rc_dev           *rc;
176         char                    input_name[80];
177         char                    input_phys[80];
178 };
179
180 #define MANTIS_HIF_STATUS       (mantis->gpio_status)
181
182 #endif /* __MANTIS_COMMON_H */