Path: blob/master/drivers/media/dvb/ttpci/av7110.h
15112 views
#ifndef _AV7110_H_1#define _AV7110_H_23#include <linux/interrupt.h>4#include <linux/socket.h>5#include <linux/netdevice.h>6#include <linux/i2c.h>7#include <linux/input.h>89#include <linux/dvb/video.h>10#include <linux/dvb/audio.h>11#include <linux/dvb/dmx.h>12#include <linux/dvb/ca.h>13#include <linux/dvb/osd.h>14#include <linux/dvb/net.h>15#include <linux/mutex.h>1617#include "dvbdev.h"18#include "demux.h"19#include "dvb_demux.h"20#include "dmxdev.h"21#include "dvb_filter.h"22#include "dvb_net.h"23#include "dvb_ringbuffer.h"24#include "dvb_frontend.h"25#include "ves1820.h"26#include "ves1x93.h"27#include "stv0299.h"28#include "tda8083.h"29#include "sp8870.h"30#include "stv0297.h"31#include "l64781.h"3233#include <media/saa7146_vv.h>343536#define ANALOG_TUNER_VES1820 137#define ANALOG_TUNER_STV0297 23839extern int av7110_debug;4041#define dprintk(level,args...) \42do { if ((av7110_debug & level)) { printk("dvb-ttpci: %s(): ", __func__); printk(args); } } while (0)4344#define MAXFILT 324546enum {AV_PES_STREAM, PS_STREAM, TS_STREAM, PES_STREAM};4748enum av7110_video_mode {49AV7110_VIDEO_MODE_PAL = 0,50AV7110_VIDEO_MODE_NTSC = 151};5253struct av7110_p2t {54u8 pes[TS_SIZE];55u8 counter;56long int pos;57int frags;58struct dvb_demux_feed *feed;59};6061/* video MPEG decoder events: */62/* (code copied from dvb_frontend.c, should maybe be factored out...) */63#define MAX_VIDEO_EVENT 864struct dvb_video_events {65struct video_event events[MAX_VIDEO_EVENT];66int eventw;67int eventr;68int overflow;69wait_queue_head_t wait_queue;70spinlock_t lock;71};727374struct av7110;7576/* infrared remote control */77struct infrared {78u16 key_map[256];79struct input_dev *input_dev;80char input_phys[32];81struct timer_list keyup_timer;82struct tasklet_struct ir_tasklet;83void (*ir_handler)(struct av7110 *av7110, u32 ircom);84u32 ir_command;85u32 ir_config;86u32 device_mask;87u8 protocol;88u8 inversion;89u16 last_key;90u16 last_toggle;91u8 delay_timer_finished;92};939495/* place to store all the necessary device information */96struct av7110 {9798/* devices */99100struct dvb_device dvb_dev;101struct dvb_net dvb_net;102103struct video_device *v4l_dev;104struct video_device *vbi_dev;105106struct saa7146_dev *dev;107108struct i2c_adapter i2c_adap;109110char *card_name;111112/* support for analog module of dvb-c */113int analog_tuner_flags;114int current_input;115u32 current_freq;116117struct tasklet_struct debi_tasklet;118struct tasklet_struct gpio_tasklet;119120int adac_type; /* audio DAC type */121#define DVB_ADAC_TI 0122#define DVB_ADAC_CRYSTAL 1123#define DVB_ADAC_MSP34x0 2124#define DVB_ADAC_MSP34x5 3125#define DVB_ADAC_NONE -1126127128/* buffers */129130void *iobuf; /* memory for all buffers */131struct dvb_ringbuffer avout; /* buffer for video or A/V mux */132#define AVOUTLEN (128*1024)133struct dvb_ringbuffer aout; /* buffer for audio */134#define AOUTLEN (64*1024)135void *bmpbuf;136#define BMPLEN (8*32768+1024)137138/* bitmap buffers and states */139140int bmpp;141int bmplen;142volatile int bmp_state;143#define BMP_NONE 0144#define BMP_LOADING 1145#define BMP_LOADED 2146wait_queue_head_t bmpq;147148149/* DEBI and polled command interface */150151spinlock_t debilock;152struct mutex dcomlock;153volatile int debitype;154volatile int debilen;155156157/* Recording and playback flags */158159int rec_mode;160int playing;161#define RP_NONE 0162#define RP_VIDEO 1163#define RP_AUDIO 2164#define RP_AV 3165166167/* OSD */168169int osdwin; /* currently active window */170u16 osdbpp[8];171struct mutex osd_mutex;172173/* CA */174175ca_slot_info_t ci_slot[2];176177enum av7110_video_mode vidmode;178struct dmxdev dmxdev;179struct dvb_demux demux;180181struct dmx_frontend hw_frontend;182struct dmx_frontend mem_frontend;183184/* for budget mode demux1 */185struct dmxdev dmxdev1;186struct dvb_demux demux1;187struct dvb_net dvb_net1;188spinlock_t feedlock1;189int feeding1;190u32 ttbp;191unsigned char *grabbing;192struct saa7146_pgtable pt;193struct tasklet_struct vpe_tasklet;194bool full_ts;195196int fe_synced;197struct mutex pid_mutex;198199int video_blank;200struct video_status videostate;201u16 display_panscan;202int display_ar;203int trickmode;204#define TRICK_NONE 0205#define TRICK_FAST 1206#define TRICK_SLOW 2207#define TRICK_FREEZE 3208struct audio_status audiostate;209210struct dvb_demux_filter *handle2filter[32];211struct av7110_p2t p2t_filter[MAXFILT];212struct dvb_filter_pes2ts p2t[2];213struct ipack ipack[2];214u8 *kbuf[2];215216int sinfo;217int feeding;218219int arm_errors;220int registered;221222223/* AV711X */224225u32 arm_fw;226u32 arm_rtsl;227u32 arm_vid;228u32 arm_app;229u32 avtype;230int arm_ready;231struct task_struct *arm_thread;232wait_queue_head_t arm_wait;233u16 arm_loops;234235void *debi_virt;236dma_addr_t debi_bus;237238u16 pids[DMX_PES_OTHER];239240struct dvb_ringbuffer ci_rbuffer;241struct dvb_ringbuffer ci_wbuffer;242243struct audio_mixer mixer;244245struct dvb_adapter dvb_adapter;246struct dvb_device *video_dev;247struct dvb_device *audio_dev;248struct dvb_device *ca_dev;249struct dvb_device *osd_dev;250251struct dvb_video_events video_events;252video_size_t video_size;253254u16 wssMode;255u16 wssData;256257struct infrared ir;258259/* firmware stuff */260unsigned char *bin_fw;261unsigned long size_fw;262263unsigned char *bin_dpram;264unsigned long size_dpram;265266unsigned char *bin_root;267unsigned long size_root;268269struct dvb_frontend* fe;270fe_status_t fe_status;271272/* crash recovery */273void (*recover)(struct av7110* av7110);274struct dvb_frontend_parameters saved_fe_params;275fe_sec_voltage_t saved_voltage;276fe_sec_tone_mode_t saved_tone;277struct dvb_diseqc_master_cmd saved_master_cmd;278fe_sec_mini_cmd_t saved_minicmd;279280int (*fe_init)(struct dvb_frontend* fe);281int (*fe_read_status)(struct dvb_frontend* fe, fe_status_t* status);282int (*fe_diseqc_reset_overload)(struct dvb_frontend* fe);283int (*fe_diseqc_send_master_cmd)(struct dvb_frontend* fe, struct dvb_diseqc_master_cmd* cmd);284int (*fe_diseqc_send_burst)(struct dvb_frontend* fe, fe_sec_mini_cmd_t minicmd);285int (*fe_set_tone)(struct dvb_frontend* fe, fe_sec_tone_mode_t tone);286int (*fe_set_voltage)(struct dvb_frontend* fe, fe_sec_voltage_t voltage);287int (*fe_dishnetwork_send_legacy_command)(struct dvb_frontend* fe, unsigned long cmd);288int (*fe_set_frontend)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params);289};290291292extern int ChangePIDs(struct av7110 *av7110, u16 vpid, u16 apid, u16 ttpid,293u16 subpid, u16 pcrpid);294295extern int av7110_check_ir_config(struct av7110 *av7110, int force);296extern int av7110_ir_init(struct av7110 *av7110);297extern void av7110_ir_exit(struct av7110 *av7110);298299/* msp3400 i2c subaddresses */300#define MSP_WR_DEM 0x10301#define MSP_RD_DEM 0x11302#define MSP_WR_DSP 0x12303#define MSP_RD_DSP 0x13304305extern int i2c_writereg(struct av7110 *av7110, u8 id, u8 reg, u8 val);306extern u8 i2c_readreg(struct av7110 *av7110, u8 id, u8 reg);307extern int msp_writereg(struct av7110 *av7110, u8 dev, u16 reg, u16 val);308309310extern int av7110_init_analog_module(struct av7110 *av7110);311extern int av7110_init_v4l(struct av7110 *av7110);312extern int av7110_exit_v4l(struct av7110 *av7110);313314#endif /* _AV7110_H_ */315316317