PM / sleep: Asynchronous threads for suspend_noirq
[linux/fpc-iii.git] / drivers / media / pci / mantis / mantis_common.h
blobf2410cf0a6bf0ec980b475f8785d5afb7a58ec52
1 /*
2 Mantis PCI bridge driver
4 Copyright (C) Manu Abraham (abraham.manu@gmail.com)
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.
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.
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.
21 #ifndef __MANTIS_COMMON_H
22 #define __MANTIS_COMMON_H
24 #include <linux/interrupt.h>
25 #include <linux/mutex.h>
26 #include <linux/workqueue.h>
28 #include "mantis_uart.h"
30 #include "mantis_link.h"
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
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)
56 #define mwrite(dat, addr) writel((dat), addr)
57 #define mread(addr) readl(addr)
59 #define mmwrite(dat, addr) mwrite((dat), (mantis->mmio + (addr)))
60 #define mmread(addr) mread(mantis->mmio + (addr))
62 #define MANTIS_TS_188 0
63 #define MANTIS_TS_204 1
65 #define TWINHAN_TECHNOLOGIES 0x1822
66 #define MANTIS 0x4e35
68 #define TECHNISAT 0x1ae4
69 #define TERRATEC 0x153b
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) \
79 enum mantis_i2c_mode {
80 MANTIS_PAGE_MODE = 0,
81 MANTIS_BYTE_MODE,
84 struct mantis_pci;
86 struct mantis_hwconfig {
87 char *model_name;
88 char *dev_type;
89 u32 ts_size;
91 enum mantis_baud baud_rate;
92 enum mantis_parity parity;
93 u32 bytes;
95 irqreturn_t (*irq_handler)(int irq, void *dev_id);
96 int (*frontend_init)(struct mantis_pci *mantis, struct dvb_frontend *fe);
98 u8 power;
99 u8 reset;
101 enum mantis_i2c_mode i2c_mode;
104 struct mantis_pci {
105 unsigned int verbose;
107 /* PCI stuff */
108 u16 vendor_id;
109 u16 device_id;
110 u16 subsystem_vendor;
111 u16 subsystem_device;
113 u8 latency;
115 struct pci_dev *pdev;
117 unsigned long mantis_addr;
118 void __iomem *mmio;
120 u8 irq;
121 u8 revision;
123 unsigned int num;
125 /* RISC Core */
126 u32 busy_block;
127 u32 last_block;
128 u8 *buf_cpu;
129 dma_addr_t buf_dma;
130 u32 *risc_cpu;
131 dma_addr_t risc_dma;
133 struct tasklet_struct tasklet;
135 struct i2c_adapter adapter;
136 int i2c_rc;
137 wait_queue_head_t i2c_wq;
138 struct mutex i2c_lock;
140 /* DVB stuff */
141 struct dvb_adapter dvb_adapter;
142 struct dvb_frontend *fe;
143 struct dvb_demux demux;
144 struct dmxdev dmxdev;
145 struct dmx_frontend fe_hw;
146 struct dmx_frontend fe_mem;
147 struct dvb_net dvbnet;
149 u8 feeds;
151 struct mantis_hwconfig *hwconfig;
153 u32 mantis_int_stat;
154 u32 mantis_int_mask;
156 /* board specific */
157 u8 mac_address[8];
158 u32 sub_vendor_id;
159 u32 sub_device_id;
161 /* A12 A13 A14 */
162 u32 gpio_status;
164 u32 gpif_status;
166 struct mantis_ca *mantis_ca;
168 wait_queue_head_t uart_wq;
169 struct work_struct uart_work;
170 spinlock_t uart_lock;
172 struct rc_dev *rc;
173 char input_name[80];
174 char input_phys[80];
177 #define MANTIS_HIF_STATUS (mantis->gpio_status)
179 #endif /* __MANTIS_COMMON_H */