[PATCH] dvb: stv0299: reduce i2c xfer and set register 0x12 from inittab
[linux/fpc-iii.git] / drivers / media / dvb / ttpci / av7110.h
blobcce00ef293e94fa41daa0419f54cca8b85778d61
1 #ifndef _AV7110_H_
2 #define _AV7110_H_
4 #include <linux/interrupt.h>
5 #include <linux/socket.h>
6 #include <linux/netdevice.h>
7 #include <linux/i2c.h>
9 #ifdef CONFIG_DEVFS_FS
10 #include <linux/devfs_fs_kernel.h>
11 #endif
13 #include <linux/dvb/video.h>
14 #include <linux/dvb/audio.h>
15 #include <linux/dvb/dmx.h>
16 #include <linux/dvb/ca.h>
17 #include <linux/dvb/osd.h>
18 #include <linux/dvb/net.h>
20 #include "dvbdev.h"
21 #include "demux.h"
22 #include "dvb_demux.h"
23 #include "dmxdev.h"
24 #include "dvb_filter.h"
25 #include "dvb_net.h"
26 #include "dvb_ringbuffer.h"
27 #include "dvb_frontend.h"
28 #include "ves1820.h"
29 #include "ves1x93.h"
30 #include "stv0299.h"
31 #include "tda8083.h"
32 #include "sp8870.h"
33 #include "stv0297.h"
34 #include "l64781.h"
36 #include <media/saa7146_vv.h>
39 #define ANALOG_TUNER_VES1820 1
40 #define ANALOG_TUNER_STV0297 2
41 #define ANALOG_TUNER_VBI 0x100
43 extern int av7110_debug;
45 #define dprintk(level,args...) \
46 do { if ((av7110_debug & level)) { printk("dvb-ttpci: %s(): ", __FUNCTION__); printk(args); } } while (0)
48 #define MAXFILT 32
50 enum {AV_PES_STREAM, PS_STREAM, TS_STREAM, PES_STREAM};
52 struct av7110_p2t {
53 u8 pes[TS_SIZE];
54 u8 counter;
55 long int pos;
56 int frags;
57 struct dvb_demux_feed *feed;
60 /* video MPEG decoder events: */
61 /* (code copied from dvb_frontend.c, should maybe be factored out...) */
62 #define MAX_VIDEO_EVENT 8
63 struct dvb_video_events {
64 struct video_event events[MAX_VIDEO_EVENT];
65 int eventw;
66 int eventr;
67 int overflow;
68 wait_queue_head_t wait_queue;
69 spinlock_t lock;
73 /* place to store all the necessary device information */
74 struct av7110 {
76 /* devices */
78 struct dvb_device dvb_dev;
79 struct dvb_net dvb_net;
81 struct video_device *v4l_dev;
82 struct video_device *vbi_dev;
84 struct saa7146_dev *dev;
86 struct i2c_adapter i2c_adap;
88 char *card_name;
90 /* support for analog module of dvb-c */
91 int analog_tuner_flags;
92 int current_input;
93 u32 current_freq;
95 struct tasklet_struct debi_tasklet;
96 struct tasklet_struct gpio_tasklet;
98 int adac_type; /* audio DAC type */
99 #define DVB_ADAC_TI 0
100 #define DVB_ADAC_CRYSTAL 1
101 #define DVB_ADAC_MSP 2
102 #define DVB_ADAC_NONE -1
105 /* buffers */
107 void *iobuf; /* memory for all buffers */
108 struct dvb_ringbuffer avout; /* buffer for video or A/V mux */
109 #define AVOUTLEN (128*1024)
110 struct dvb_ringbuffer aout; /* buffer for audio */
111 #define AOUTLEN (64*1024)
112 void *bmpbuf;
113 #define BMPLEN (8*32768+1024)
115 /* bitmap buffers and states */
117 int bmpp;
118 int bmplen;
119 volatile int bmp_state;
120 #define BMP_NONE 0
121 #define BMP_LOADING 1
122 #define BMP_LOADED 2
123 wait_queue_head_t bmpq;
126 /* DEBI and polled command interface */
128 spinlock_t debilock;
129 struct semaphore dcomlock;
130 volatile int debitype;
131 volatile int debilen;
134 /* Recording and playback flags */
136 int rec_mode;
137 int playing;
138 #define RP_NONE 0
139 #define RP_VIDEO 1
140 #define RP_AUDIO 2
141 #define RP_AV 3
144 /* OSD */
146 int osdwin; /* currently active window */
147 u16 osdbpp[8];
148 struct semaphore osd_sema;
150 /* CA */
152 ca_slot_info_t ci_slot[2];
154 int vidmode;
155 struct dmxdev dmxdev;
156 struct dvb_demux demux;
158 struct dmx_frontend hw_frontend;
159 struct dmx_frontend mem_frontend;
161 /* for budget mode demux1 */
162 struct dmxdev dmxdev1;
163 struct dvb_demux demux1;
164 struct dvb_net dvb_net1;
165 spinlock_t feedlock1;
166 int feeding1;
167 u8 tsf;
168 u32 ttbp;
169 unsigned char *grabbing;
170 struct saa7146_pgtable pt;
171 struct tasklet_struct vpe_tasklet;
173 int fe_synced;
174 struct semaphore pid_mutex;
176 int video_blank;
177 struct video_status videostate;
178 int display_ar;
179 int trickmode;
180 #define TRICK_NONE 0
181 #define TRICK_FAST 1
182 #define TRICK_SLOW 2
183 #define TRICK_FREEZE 3
184 struct audio_status audiostate;
186 struct dvb_demux_filter *handle2filter[32];
187 struct av7110_p2t p2t_filter[MAXFILT];
188 struct dvb_filter_pes2ts p2t[2];
189 struct ipack ipack[2];
190 u8 *kbuf[2];
192 int sinfo;
193 int feeding;
195 int arm_errors;
196 int registered;
199 /* AV711X */
201 u32 arm_fw;
202 u32 arm_rtsl;
203 u32 arm_vid;
204 u32 arm_app;
205 u32 avtype;
206 int arm_ready;
207 struct task_struct *arm_thread;
208 wait_queue_head_t arm_wait;
209 u16 arm_loops;
210 int arm_rmmod;
212 void *debi_virt;
213 dma_addr_t debi_bus;
215 u16 pids[DMX_PES_OTHER];
217 struct dvb_ringbuffer ci_rbuffer;
218 struct dvb_ringbuffer ci_wbuffer;
220 struct audio_mixer mixer;
222 struct dvb_adapter dvb_adapter;
223 struct dvb_device *video_dev;
224 struct dvb_device *audio_dev;
225 struct dvb_device *ca_dev;
226 struct dvb_device *osd_dev;
228 struct dvb_video_events video_events;
229 video_size_t video_size;
231 u32 ir_config;
232 u32 ir_command;
233 void (*ir_handler)(struct av7110 *av7110, u32 ircom);
234 struct tasklet_struct ir_tasklet;
236 /* firmware stuff */
237 unsigned char *bin_fw;
238 unsigned long size_fw;
240 unsigned char *bin_dpram;
241 unsigned long size_dpram;
243 unsigned char *bin_root;
244 unsigned long size_root;
246 struct dvb_frontend* fe;
247 fe_status_t fe_status;
248 int (*fe_init)(struct dvb_frontend* fe);
249 int (*fe_read_status)(struct dvb_frontend* fe, fe_status_t* status);
250 int (*fe_diseqc_reset_overload)(struct dvb_frontend* fe);
251 int (*fe_diseqc_send_master_cmd)(struct dvb_frontend* fe, struct dvb_diseqc_master_cmd* cmd);
252 int (*fe_diseqc_send_burst)(struct dvb_frontend* fe, fe_sec_mini_cmd_t minicmd);
253 int (*fe_set_tone)(struct dvb_frontend* fe, fe_sec_tone_mode_t tone);
254 int (*fe_set_voltage)(struct dvb_frontend* fe, fe_sec_voltage_t voltage);
255 int (*fe_dishnetwork_send_legacy_command)(struct dvb_frontend* fe, unsigned int cmd);
256 int (*fe_set_frontend)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params);
260 extern int ChangePIDs(struct av7110 *av7110, u16 vpid, u16 apid, u16 ttpid,
261 u16 subpid, u16 pcrpid);
263 extern int av7110_setup_irc_config (struct av7110 *av7110, u32 ir_config);
265 extern int av7110_ir_init(struct av7110 *av7110);
266 extern void av7110_ir_exit(struct av7110 *av7110);
268 /* msp3400 i2c subaddresses */
269 #define MSP_WR_DEM 0x10
270 #define MSP_RD_DEM 0x11
271 #define MSP_WR_DSP 0x12
272 #define MSP_RD_DSP 0x13
274 extern int i2c_writereg(struct av7110 *av7110, u8 id, u8 reg, u8 val);
275 extern u8 i2c_readreg(struct av7110 *av7110, u8 id, u8 reg);
276 extern int msp_writereg(struct av7110 *av7110, u8 dev, u16 reg, u16 val);
279 extern int av7110_init_analog_module(struct av7110 *av7110);
280 extern int av7110_init_v4l(struct av7110 *av7110);
281 extern int av7110_exit_v4l(struct av7110 *av7110);
283 #endif /* _AV7110_H_ */