diff options
Diffstat (limited to 'drivers/media/dvb/ttpci/av7110.h')
-rw-r--r-- | drivers/media/dvb/ttpci/av7110.h | 315 |
1 files changed, 315 insertions, 0 deletions
diff --git a/drivers/media/dvb/ttpci/av7110.h b/drivers/media/dvb/ttpci/av7110.h new file mode 100644 index 00000000000..d85b8512ac3 --- /dev/null +++ b/drivers/media/dvb/ttpci/av7110.h | |||
@@ -0,0 +1,315 @@ | |||
1 | #ifndef _AV7110_H_ | ||
2 | #define _AV7110_H_ | ||
3 | |||
4 | #include <linux/interrupt.h> | ||
5 | #include <linux/socket.h> | ||
6 | #include <linux/netdevice.h> | ||
7 | #include <linux/i2c.h> | ||
8 | #include <linux/input.h> | ||
9 | |||
10 | #include <linux/dvb/video.h> | ||
11 | #include <linux/dvb/audio.h> | ||
12 | #include <linux/dvb/dmx.h> | ||
13 | #include <linux/dvb/ca.h> | ||
14 | #include <linux/dvb/osd.h> | ||
15 | #include <linux/dvb/net.h> | ||
16 | #include <linux/mutex.h> | ||
17 | |||
18 | #include "dvbdev.h" | ||
19 | #include "demux.h" | ||
20 | #include "dvb_demux.h" | ||
21 | #include "dmxdev.h" | ||
22 | #include "dvb_filter.h" | ||
23 | #include "dvb_net.h" | ||
24 | #include "dvb_ringbuffer.h" | ||
25 | #include "dvb_frontend.h" | ||
26 | #include "ves1820.h" | ||
27 | #include "ves1x93.h" | ||
28 | #include "stv0299.h" | ||
29 | #include "tda8083.h" | ||
30 | #include "sp8870.h" | ||
31 | #include "stv0297.h" | ||
32 | #include "l64781.h" | ||
33 | |||
34 | #include <media/saa7146_vv.h> | ||
35 | |||
36 | |||
37 | #define ANALOG_TUNER_VES1820 1 | ||
38 | #define ANALOG_TUNER_STV0297 2 | ||
39 | |||
40 | extern int av7110_debug; | ||
41 | |||
42 | #define dprintk(level,args...) \ | ||
43 | do { if ((av7110_debug & level)) { printk("dvb-ttpci: %s(): ", __func__); printk(args); } } while (0) | ||
44 | |||
45 | #define MAXFILT 32 | ||
46 | |||
47 | enum {AV_PES_STREAM, PS_STREAM, TS_STREAM, PES_STREAM}; | ||
48 | |||
49 | enum av7110_video_mode { | ||
50 | AV7110_VIDEO_MODE_PAL = 0, | ||
51 | AV7110_VIDEO_MODE_NTSC = 1 | ||
52 | }; | ||
53 | |||
54 | struct av7110_p2t { | ||
55 | u8 pes[TS_SIZE]; | ||
56 | u8 counter; | ||
57 | long int pos; | ||
58 | int frags; | ||
59 | struct dvb_demux_feed *feed; | ||
60 | }; | ||
61 | |||
62 | /* video MPEG decoder events: */ | ||
63 | /* (code copied from dvb_frontend.c, should maybe be factored out...) */ | ||
64 | #define MAX_VIDEO_EVENT 8 | ||
65 | struct dvb_video_events { | ||
66 | struct video_event events[MAX_VIDEO_EVENT]; | ||
67 | int eventw; | ||
68 | int eventr; | ||
69 | int overflow; | ||
70 | wait_queue_head_t wait_queue; | ||
71 | spinlock_t lock; | ||
72 | }; | ||
73 | |||
74 | |||
75 | struct av7110; | ||
76 | |||
77 | /* infrared remote control */ | ||
78 | struct infrared { | ||
79 | u16 key_map[256]; | ||
80 | struct input_dev *input_dev; | ||
81 | char input_phys[32]; | ||
82 | struct timer_list keyup_timer; | ||
83 | struct tasklet_struct ir_tasklet; | ||
84 | void (*ir_handler)(struct av7110 *av7110, u32 ircom); | ||
85 | u32 ir_command; | ||
86 | u32 ir_config; | ||
87 | u32 device_mask; | ||
88 | u8 protocol; | ||
89 | u8 inversion; | ||
90 | u16 last_key; | ||
91 | u16 last_toggle; | ||
92 | u8 delay_timer_finished; | ||
93 | }; | ||
94 | |||
95 | |||
96 | /* place to store all the necessary device information */ | ||
97 | struct av7110 { | ||
98 | |||
99 | /* devices */ | ||
100 | |||
101 | struct dvb_device dvb_dev; | ||
102 | struct dvb_net dvb_net; | ||
103 | |||
104 | struct video_device *v4l_dev; | ||
105 | struct video_device *vbi_dev; | ||
106 | |||
107 | struct saa7146_dev *dev; | ||
108 | |||
109 | struct i2c_adapter i2c_adap; | ||
110 | |||
111 | char *card_name; | ||
112 | |||
113 | /* support for analog module of dvb-c */ | ||
114 | int analog_tuner_flags; | ||
115 | int current_input; | ||
116 | u32 current_freq; | ||
117 | |||
118 | struct tasklet_struct debi_tasklet; | ||
119 | struct tasklet_struct gpio_tasklet; | ||
120 | |||
121 | int adac_type; /* audio DAC type */ | ||
122 | #define DVB_ADAC_TI 0 | ||
123 | #define DVB_ADAC_CRYSTAL 1 | ||
124 | #define DVB_ADAC_MSP34x0 2 | ||
125 | #define DVB_ADAC_MSP34x5 3 | ||
126 | #define DVB_ADAC_NONE -1 | ||
127 | |||
128 | |||
129 | /* buffers */ | ||
130 | |||
131 | void *iobuf; /* memory for all buffers */ | ||
132 | struct dvb_ringbuffer avout; /* buffer for video or A/V mux */ | ||
133 | #define AVOUTLEN (128*1024) | ||
134 | struct dvb_ringbuffer aout; /* buffer for audio */ | ||
135 | #define AOUTLEN (64*1024) | ||
136 | void *bmpbuf; | ||
137 | #define BMPLEN (8*32768+1024) | ||
138 | |||
139 | /* bitmap buffers and states */ | ||
140 | |||
141 | int bmpp; | ||
142 | int bmplen; | ||
143 | volatile int bmp_state; | ||
144 | #define BMP_NONE 0 | ||
145 | #define BMP_LOADING 1 | ||
146 | #define BMP_LOADED 2 | ||
147 | wait_queue_head_t bmpq; | ||
148 | |||
149 | |||
150 | /* DEBI and polled command interface */ | ||
151 | |||
152 | spinlock_t debilock; | ||
153 | struct mutex dcomlock; | ||
154 | volatile int debitype; | ||
155 | volatile int debilen; | ||
156 | |||
157 | |||
158 | /* Recording and playback flags */ | ||
159 | |||
160 | int rec_mode; | ||
161 | int playing; | ||
162 | #define RP_NONE 0 | ||
163 | #define RP_VIDEO 1 | ||
164 | #define RP_AUDIO 2 | ||
165 | #define RP_AV 3 | ||
166 | |||
167 | |||
168 | /* OSD */ | ||
169 | |||
170 | int osdwin; /* currently active window */ | ||
171 | u16 osdbpp[8]; | ||
172 | struct mutex osd_mutex; | ||
173 | |||
174 | /* CA */ | ||
175 | |||
176 | ca_slot_info_t ci_slot[2]; | ||
177 | |||
178 | enum av7110_video_mode vidmode; | ||
179 | struct dmxdev dmxdev; | ||
180 | struct dvb_demux demux; | ||
181 | |||
182 | struct dmx_frontend hw_frontend; | ||
183 | struct dmx_frontend mem_frontend; | ||
184 | |||
185 | /* for budget mode demux1 */ | ||
186 | struct dmxdev dmxdev1; | ||
187 | struct dvb_demux demux1; | ||
188 | struct dvb_net dvb_net1; | ||
189 | spinlock_t feedlock1; | ||
190 | int feeding1; | ||
191 | u32 ttbp; | ||
192 | unsigned char *grabbing; | ||
193 | struct saa7146_pgtable pt; | ||
194 | struct tasklet_struct vpe_tasklet; | ||
195 | bool full_ts; | ||
196 | |||
197 | int fe_synced; | ||
198 | struct mutex pid_mutex; | ||
199 | |||
200 | int video_blank; | ||
201 | struct video_status videostate; | ||
202 | u16 display_panscan; | ||
203 | int display_ar; | ||
204 | int trickmode; | ||
205 | #define TRICK_NONE 0 | ||
206 | #define TRICK_FAST 1 | ||
207 | #define TRICK_SLOW 2 | ||
208 | #define TRICK_FREEZE 3 | ||
209 | struct audio_status audiostate; | ||
210 | |||
211 | struct dvb_demux_filter *handle2filter[32]; | ||
212 | struct av7110_p2t p2t_filter[MAXFILT]; | ||
213 | struct dvb_filter_pes2ts p2t[2]; | ||
214 | struct ipack ipack[2]; | ||
215 | u8 *kbuf[2]; | ||
216 | |||
217 | int sinfo; | ||
218 | int feeding; | ||
219 | |||
220 | int arm_errors; | ||
221 | int registered; | ||
222 | |||
223 | |||
224 | /* AV711X */ | ||
225 | |||
226 | u32 arm_fw; | ||
227 | u32 arm_rtsl; | ||
228 | u32 arm_vid; | ||
229 | u32 arm_app; | ||
230 | u32 avtype; | ||
231 | int arm_ready; | ||
232 | struct task_struct *arm_thread; | ||
233 | wait_queue_head_t arm_wait; | ||
234 | u16 arm_loops; | ||
235 | |||
236 | void *debi_virt; | ||
237 | dma_addr_t debi_bus; | ||
238 | |||
239 | u16 pids[DMX_PES_OTHER]; | ||
240 | |||
241 | struct dvb_ringbuffer ci_rbuffer; | ||
242 | struct dvb_ringbuffer ci_wbuffer; | ||
243 | |||
244 | struct audio_mixer mixer; | ||
245 | |||
246 | struct dvb_adapter dvb_adapter; | ||
247 | struct dvb_device *video_dev; | ||
248 | struct dvb_device *audio_dev; | ||
249 | struct dvb_device *ca_dev; | ||
250 | struct dvb_device *osd_dev; | ||
251 | |||
252 | struct dvb_video_events video_events; | ||
253 | video_size_t video_size; | ||
254 | |||
255 | u16 wssMode; | ||
256 | u16 wssData; | ||
257 | |||
258 | struct infrared ir; | ||
259 | |||
260 | /* firmware stuff */ | ||
261 | unsigned char *bin_fw; | ||
262 | unsigned long size_fw; | ||
263 | |||
264 | unsigned char *bin_dpram; | ||
265 | unsigned long size_dpram; | ||
266 | |||
267 | unsigned char *bin_root; | ||
268 | unsigned long size_root; | ||
269 | |||
270 | struct dvb_frontend* fe; | ||
271 | fe_status_t fe_status; | ||
272 | |||
273 | /* crash recovery */ | ||
274 | void (*recover)(struct av7110* av7110); | ||
275 | struct dvb_frontend_parameters saved_fe_params; | ||
276 | fe_sec_voltage_t saved_voltage; | ||
277 | fe_sec_tone_mode_t saved_tone; | ||
278 | struct dvb_diseqc_master_cmd saved_master_cmd; | ||
279 | fe_sec_mini_cmd_t saved_minicmd; | ||
280 | |||
281 | int (*fe_init)(struct dvb_frontend* fe); | ||
282 | int (*fe_read_status)(struct dvb_frontend* fe, fe_status_t* status); | ||
283 | int (*fe_diseqc_reset_overload)(struct dvb_frontend* fe); | ||
284 | int (*fe_diseqc_send_master_cmd)(struct dvb_frontend* fe, struct dvb_diseqc_master_cmd* cmd); | ||
285 | int (*fe_diseqc_send_burst)(struct dvb_frontend* fe, fe_sec_mini_cmd_t minicmd); | ||
286 | int (*fe_set_tone)(struct dvb_frontend* fe, fe_sec_tone_mode_t tone); | ||
287 | int (*fe_set_voltage)(struct dvb_frontend* fe, fe_sec_voltage_t voltage); | ||
288 | int (*fe_dishnetwork_send_legacy_command)(struct dvb_frontend* fe, unsigned long cmd); | ||
289 | int (*fe_set_frontend)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params); | ||
290 | }; | ||
291 | |||
292 | |||
293 | extern int ChangePIDs(struct av7110 *av7110, u16 vpid, u16 apid, u16 ttpid, | ||
294 | u16 subpid, u16 pcrpid); | ||
295 | |||
296 | extern int av7110_check_ir_config(struct av7110 *av7110, int force); | ||
297 | extern int av7110_ir_init(struct av7110 *av7110); | ||
298 | extern void av7110_ir_exit(struct av7110 *av7110); | ||
299 | |||
300 | /* msp3400 i2c subaddresses */ | ||
301 | #define MSP_WR_DEM 0x10 | ||
302 | #define MSP_RD_DEM 0x11 | ||
303 | #define MSP_WR_DSP 0x12 | ||
304 | #define MSP_RD_DSP 0x13 | ||
305 | |||
306 | extern int i2c_writereg(struct av7110 *av7110, u8 id, u8 reg, u8 val); | ||
307 | extern u8 i2c_readreg(struct av7110 *av7110, u8 id, u8 reg); | ||
308 | extern int msp_writereg(struct av7110 *av7110, u8 dev, u16 reg, u16 val); | ||
309 | |||
310 | |||
311 | extern int av7110_init_analog_module(struct av7110 *av7110); | ||
312 | extern int av7110_init_v4l(struct av7110 *av7110); | ||
313 | extern int av7110_exit_v4l(struct av7110 *av7110); | ||
314 | |||
315 | #endif /* _AV7110_H_ */ | ||