xref: /openbmc/linux/drivers/media/pci/ttpci/budget.h (revision 5a244f48)
1 
2 #ifndef __BUDGET_DVB__
3 #define __BUDGET_DVB__
4 
5 #include "dvb_frontend.h"
6 #include "dvbdev.h"
7 #include "demux.h"
8 #include "dvb_demux.h"
9 #include "dmxdev.h"
10 #include "dvb_filter.h"
11 #include "dvb_net.h"
12 
13 #include <linux/module.h>
14 #include <linux/mutex.h>
15 
16 #include <media/drv-intf/saa7146.h>
17 
18 extern int budget_debug;
19 
20 #ifdef dprintk
21 #undef dprintk
22 #endif
23 
24 #define dprintk(level, fmt, arg...) do {				\
25 	if (level & budget_debug)					\
26 		printk(KERN_DEBUG KBUILD_MODNAME ": %s(): " fmt,	\
27 		       __func__, ##arg);				\
28 } while (0)
29 
30 
31 struct budget_info {
32 	char *name;
33 	int type;
34 };
35 
36 /* place to store all the necessary device information */
37 struct budget {
38 
39 	/* devices */
40 	struct dvb_device dvb_dev;
41 	struct dvb_net dvb_net;
42 
43 	struct saa7146_dev *dev;
44 
45 	struct i2c_adapter i2c_adap;
46 	struct budget_info *card;
47 
48 	unsigned char *grabbing;
49 	struct saa7146_pgtable pt;
50 
51 	struct tasklet_struct fidb_tasklet;
52 	struct tasklet_struct vpe_tasklet;
53 
54 	struct dmxdev dmxdev;
55 	struct dvb_demux demux;
56 
57 	struct dmx_frontend hw_frontend;
58 	struct dmx_frontend mem_frontend;
59 
60 	int ci_present;
61 	int video_port;
62 
63 	u32 buffer_width;
64 	u32 buffer_height;
65 	u32 buffer_size;
66 	u32 buffer_warning_threshold;
67 	u32 buffer_warnings;
68 	unsigned long buffer_warning_time;
69 
70 	u32 ttbp;
71 	int feeding;
72 
73 	spinlock_t feedlock;
74 
75 	spinlock_t debilock;
76 
77 	struct dvb_adapter dvb_adapter;
78 	struct dvb_frontend *dvb_frontend;
79 	int (*read_fe_status)(struct dvb_frontend *fe, enum fe_status *status);
80 	int fe_synced;
81 
82 	void *priv;
83 };
84 
85 #define MAKE_BUDGET_INFO(x_var,x_name,x_type) \
86 static struct budget_info x_var ## _info = { \
87 	.name=x_name,	\
88 	.type=x_type };	\
89 static struct saa7146_pci_extension_data x_var = { \
90 	.ext_priv = &x_var ## _info, \
91 	.ext = &budget_extension };
92 
93 #define BUDGET_TT		   0
94 #define BUDGET_TT_HW_DISEQC	   1
95 #define BUDGET_PATCH		   3
96 #define BUDGET_FS_ACTIVY	   4
97 #define BUDGET_CIN1200S		   5
98 #define BUDGET_CIN1200C		   6
99 #define BUDGET_CIN1200T		   7
100 #define BUDGET_KNC1S		   8
101 #define BUDGET_KNC1C		   9
102 #define BUDGET_KNC1T		   10
103 #define BUDGET_KNC1SP		   11
104 #define BUDGET_KNC1CP		   12
105 #define BUDGET_KNC1TP		   13
106 #define BUDGET_TVSTAR		   14
107 #define BUDGET_CIN1200C_MK3	   15
108 #define BUDGET_KNC1C_MK3	   16
109 #define BUDGET_KNC1CP_MK3	   17
110 #define BUDGET_KNC1S2              18
111 #define BUDGET_KNC1C_TDA10024	   19
112 
113 #define BUDGET_VIDEO_PORTA         0
114 #define BUDGET_VIDEO_PORTB         1
115 
116 extern int ttpci_budget_init(struct budget *budget, struct saa7146_dev *dev,
117 			     struct saa7146_pci_extension_data *info,
118 			     struct module *owner, short *adapter_nums);
119 extern void ttpci_budget_init_hooks(struct budget *budget);
120 extern int ttpci_budget_deinit(struct budget *budget);
121 extern void ttpci_budget_irq10_handler(struct saa7146_dev *dev, u32 * isr);
122 extern void ttpci_budget_set_video_port(struct saa7146_dev *dev, int video_port);
123 extern int ttpci_budget_debiread(struct budget *budget, u32 config, int addr, int count,
124 				 int uselocks, int nobusyloop);
125 extern int ttpci_budget_debiwrite(struct budget *budget, u32 config, int addr, int count, u32 value,
126 				  int uselocks, int nobusyloop);
127 
128 #endif
129