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