summaryrefslogtreecommitdiffstats
path: root/drivers/media/pci/ttpci/budget.h
blob: 83ead34dc766b1b71b393ca58768b916a1f53c72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/* SPDX-License-Identifier: GPL-2.0 */

#ifndef __BUDGET_DVB__
#define __BUDGET_DVB__

#ifdef pr_fmt
#undef pr_fmt
#endif

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <media/dvb_frontend.h>
#include <media/dvbdev.h>
#include <media/demux.h>
#include <media/dvb_demux.h>
#include <media/dmxdev.h>
#include <media/dvb_net.h>

#include <linux/module.h>
#include <linux/mutex.h>

#include <media/drv-intf/saa7146.h>

extern int budget_debug;

#ifdef dprintk
#undef dprintk
#endif

#define dprintk(level, fmt, arg...) do {				\
	if ((level) & budget_debug)					\
		pr_info("%s(): " fmt, __func__, ##arg);			\
} while (0)

#define TS_SIZE        188

struct budget_info {
	char *name;
	int type;
};

/* place to store all the necessary device information */
struct budget {

	/* devices */
	struct dvb_device dvb_dev;
	struct dvb_net dvb_net;

	struct saa7146_dev *dev;

	struct i2c_adapter i2c_adap;
	struct budget_info *card;

	unsigned char *grabbing;
	struct saa7146_pgtable pt;

	struct tasklet_struct fidb_tasklet;
	struct tasklet_struct vpe_tasklet;

	struct dmxdev dmxdev;
	struct dvb_demux demux;

	struct dmx_frontend hw_frontend;
	struct dmx_frontend mem_frontend;

	int ci_present;
	int video_port;

	u32 buffer_width;
	u32 buffer_height;
	u32 buffer_size;
	u32 buffer_warning_threshold;
	u32 buffer_warnings;
	unsigned long buffer_warning_time;

	u32 ttbp;
	int feeding;

	spinlock_t feedlock;

	spinlock_t debilock;

	struct dvb_adapter dvb_adapter;
	struct dvb_frontend *dvb_frontend;
	int (*read_fe_status)(struct dvb_frontend *fe, enum fe_status *status);
	int fe_synced;

	void *priv;
};

#define MAKE_BUDGET_INFO(x_var, x_name, x_type) \
static struct budget_info x_var ## _info = { \
	.name = x_name,	\
	.type = x_type };	\
static struct saa7146_pci_extension_data x_var = { \
	.ext_priv = &x_var ## _info, \
	.ext = &budget_extension }

#define BUDGET_TT		   0
#define BUDGET_TT_HW_DISEQC	   1
#define BUDGET_PATCH		   3
#define BUDGET_FS_ACTIVY	   4
#define BUDGET_CIN1200S		   5
#define BUDGET_CIN1200C		   6
#define BUDGET_CIN1200T		   7
#define BUDGET_KNC1S		   8
#define BUDGET_KNC1C		   9
#define BUDGET_KNC1T		   10
#define BUDGET_KNC1SP		   11
#define BUDGET_KNC1CP		   12
#define BUDGET_KNC1TP		   13
#define BUDGET_TVSTAR		   14
#define BUDGET_CIN1200C_MK3	   15
#define BUDGET_KNC1C_MK3	   16
#define BUDGET_KNC1CP_MK3	   17
#define BUDGET_KNC1S2              18
#define BUDGET_KNC1C_TDA10024	   19

#define BUDGET_VIDEO_PORTA         0
#define BUDGET_VIDEO_PORTB         1

extern int ttpci_budget_init(struct budget *budget, struct saa7146_dev *dev,
			     struct saa7146_pci_extension_data *info,
			     struct module *owner, short *adapter_nums);
extern void ttpci_budget_init_hooks(struct budget *budget);
extern int ttpci_budget_deinit(struct budget *budget);
extern void ttpci_budget_irq10_handler(struct saa7146_dev *dev, u32 *isr);
extern void ttpci_budget_set_video_port(struct saa7146_dev *dev, int video_port);
extern int ttpci_budget_debiread(struct budget *budget, u32 config, int addr, int count,
				 int uselocks, int nobusyloop);
extern int ttpci_budget_debiwrite(struct budget *budget, u32 config, int addr, int count, u32 value,
				  int uselocks, int nobusyloop);

#endif