4 #include <linux/interrupt.h>
5 #include <linux/socket.h>
6 #include <linux/netdevice.h>
8 #include <linux/input.h>
9 #include <linux/time.h>
11 #include <linux/dvb/video.h>
12 #include <linux/dvb/audio.h>
13 #include <linux/dvb/dmx.h>
14 #include <linux/dvb/ca.h>
15 #include <linux/dvb/osd.h>
16 #include <linux/dvb/net.h>
17 #include <linux/mutex.h>
21 #include "dvb_demux.h"
23 #include "dvb_filter.h"
25 #include "dvb_ringbuffer.h"
26 #include "dvb_frontend.h"
35 #include <media/drv-intf/saa7146_vv.h>
38 #define ANALOG_TUNER_VES1820 1
39 #define ANALOG_TUNER_STV0297 2
41 extern int av7110_debug
;
43 #define dprintk(level, fmt, arg...) do { \
44 if (level & av7110_debug) \
45 printk(KERN_DEBUG KBUILD_MODNAME ": %s(): " fmt, \
51 enum {AV_PES_STREAM
, PS_STREAM
, TS_STREAM
, PES_STREAM
};
53 enum av7110_video_mode
{
54 AV7110_VIDEO_MODE_PAL
= 0,
55 AV7110_VIDEO_MODE_NTSC
= 1
63 struct dvb_demux_feed
*feed
;
66 /* video MPEG decoder events: */
67 /* (code copied from dvb_frontend.c, should maybe be factored out...) */
68 #define MAX_VIDEO_EVENT 8
69 struct dvb_video_events
{
70 struct video_event events
[MAX_VIDEO_EVENT
];
74 wait_queue_head_t wait_queue
;
81 /* infrared remote control */
84 struct input_dev
*input_dev
;
86 struct timer_list keyup_timer
;
87 struct tasklet_struct ir_tasklet
;
88 void (*ir_handler
)(struct av7110
*av7110
, u32 ircom
);
96 u8 delay_timer_finished
;
100 /* place to store all the necessary device information */
105 struct dvb_device dvb_dev
;
106 struct dvb_net dvb_net
;
108 struct video_device v4l_dev
;
109 struct video_device vbi_dev
;
111 struct saa7146_dev
*dev
;
113 struct i2c_adapter i2c_adap
;
117 /* support for analog module of dvb-c */
118 int analog_tuner_flags
;
122 struct tasklet_struct debi_tasklet
;
123 struct tasklet_struct gpio_tasklet
;
125 int adac_type
; /* audio DAC type */
126 #define DVB_ADAC_TI 0
127 #define DVB_ADAC_CRYSTAL 1
128 #define DVB_ADAC_MSP34x0 2
129 #define DVB_ADAC_MSP34x5 3
130 #define DVB_ADAC_NONE -1
135 void *iobuf
; /* memory for all buffers */
136 struct dvb_ringbuffer avout
; /* buffer for video or A/V mux */
137 #define AVOUTLEN (128*1024)
138 struct dvb_ringbuffer aout
; /* buffer for audio */
139 #define AOUTLEN (64*1024)
141 #define BMPLEN (8*32768+1024)
143 /* bitmap buffers and states */
147 volatile int bmp_state
;
149 #define BMP_LOADING 1
151 wait_queue_head_t bmpq
;
154 /* DEBI and polled command interface */
157 struct mutex dcomlock
;
158 volatile int debitype
;
159 volatile int debilen
;
162 /* Recording and playback flags */
174 int osdwin
; /* currently active window */
176 struct mutex osd_mutex
;
180 ca_slot_info_t ci_slot
[2];
182 enum av7110_video_mode vidmode
;
183 struct dmxdev dmxdev
;
184 struct dvb_demux demux
;
186 struct dmx_frontend hw_frontend
;
187 struct dmx_frontend mem_frontend
;
189 /* for budget mode demux1 */
190 struct dmxdev dmxdev1
;
191 struct dvb_demux demux1
;
192 struct dvb_net dvb_net1
;
193 spinlock_t feedlock1
;
196 unsigned char *grabbing
;
197 struct saa7146_pgtable pt
;
198 struct tasklet_struct vpe_tasklet
;
202 struct mutex pid_mutex
;
205 struct video_status videostate
;
212 #define TRICK_FREEZE 3
213 struct audio_status audiostate
;
215 struct dvb_demux_filter
*handle2filter
[32];
216 struct av7110_p2t p2t_filter
[MAXFILT
];
217 struct dvb_filter_pes2ts p2t
[2];
218 struct ipack ipack
[2];
236 struct task_struct
*arm_thread
;
237 wait_queue_head_t arm_wait
;
243 u16 pids
[DMX_PES_OTHER
];
245 struct dvb_ringbuffer ci_rbuffer
;
246 struct dvb_ringbuffer ci_wbuffer
;
248 struct audio_mixer mixer
;
250 struct dvb_adapter dvb_adapter
;
251 struct dvb_device
*video_dev
;
252 struct dvb_device
*audio_dev
;
253 struct dvb_device
*ca_dev
;
254 struct dvb_device
*osd_dev
;
256 struct dvb_video_events video_events
;
257 video_size_t video_size
;
265 unsigned char *bin_fw
;
266 unsigned long size_fw
;
268 unsigned char *bin_dpram
;
269 unsigned long size_dpram
;
271 unsigned char *bin_root
;
272 unsigned long size_root
;
274 struct dvb_frontend
* fe
;
275 enum fe_status fe_status
;
277 struct mutex ioctl_mutex
;
280 void (*recover
)(struct av7110
* av7110
);
281 enum fe_sec_voltage saved_voltage
;
282 enum fe_sec_tone_mode saved_tone
;
283 struct dvb_diseqc_master_cmd saved_master_cmd
;
284 enum fe_sec_mini_cmd saved_minicmd
;
286 int (*fe_init
)(struct dvb_frontend
* fe
);
287 int (*fe_read_status
)(struct dvb_frontend
*fe
, enum fe_status
*status
);
288 int (*fe_diseqc_reset_overload
)(struct dvb_frontend
*fe
);
289 int (*fe_diseqc_send_master_cmd
)(struct dvb_frontend
*fe
,
290 struct dvb_diseqc_master_cmd
*cmd
);
291 int (*fe_diseqc_send_burst
)(struct dvb_frontend
*fe
,
292 enum fe_sec_mini_cmd minicmd
);
293 int (*fe_set_tone
)(struct dvb_frontend
*fe
,
294 enum fe_sec_tone_mode tone
);
295 int (*fe_set_voltage
)(struct dvb_frontend
*fe
,
296 enum fe_sec_voltage voltage
);
297 int (*fe_dishnetwork_send_legacy_command
)(struct dvb_frontend
*fe
,
299 int (*fe_set_frontend
)(struct dvb_frontend
*fe
);
303 extern int ChangePIDs(struct av7110
*av7110
, u16 vpid
, u16 apid
, u16 ttpid
,
304 u16 subpid
, u16 pcrpid
);
306 extern int av7110_check_ir_config(struct av7110
*av7110
, int force
);
307 extern int av7110_ir_init(struct av7110
*av7110
);
308 extern void av7110_ir_exit(struct av7110
*av7110
);
310 /* msp3400 i2c subaddresses */
311 #define MSP_WR_DEM 0x10
312 #define MSP_RD_DEM 0x11
313 #define MSP_WR_DSP 0x12
314 #define MSP_RD_DSP 0x13
316 extern int i2c_writereg(struct av7110
*av7110
, u8 id
, u8 reg
, u8 val
);
317 extern u8
i2c_readreg(struct av7110
*av7110
, u8 id
, u8 reg
);
318 extern int msp_writereg(struct av7110
*av7110
, u8 dev
, u16 reg
, u16 val
);
321 extern int av7110_init_analog_module(struct av7110
*av7110
);
322 extern int av7110_init_v4l(struct av7110
*av7110
);
323 extern int av7110_exit_v4l(struct av7110
*av7110
);
325 #endif /* _AV7110_H_ */