summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb/ttpci-budget/budget.c
blob: 550936044497bed506d60701c3c8c9ba2fabedbb (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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
/*
 * budget.c: driver for the SAA7146 based Budget DVB cards 
 *
 * Compiled from various sources by Michael Hunold <michael@mihu.de> 
 *
 * Copyright (C) 2002 Ralph Metzler <rjkm@metzlerbros.de>
 *
 * Copyright (C) 1999-2002 Ralph  Metzler 
 *                       & Marcus Metzler for convergence integrated media GmbH
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
 * 
 *
 * the project's page is at http://www.linuxtv.org/dvb/
 */

#include "budget.h"
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,51)
        #define KBUILD_MODNAME budget
#endif

static struct saa7146_extension budget_extension;

struct budget_info ttbs_info = {
	.name = "TT-Budget/WinTV-NOVA-S  PCI",
	.type = DVB_CARD_TT_BUDGET,
};
struct budget_info ttbc_info = {
	.name = "TT-Budget/WinTV-NOVA-C  PCI",
	.type = DVB_CARD_TT_BUDGET,
};
struct budget_info ttbt_info = {
	.name = "TT-Budget/WinTV-NOVA-T  PCI",
	.type = DVB_CARD_TT_BUDGET,
};
struct budget_info ttbci_info = {
	.name = "TT-Budget/WinTV-NOVA-CI PCI",
	.type = DVB_CARD_TT_BUDGET,
};
struct budget_info satel_info = {
	.name = "SATELCO Multimedia PCI",
	.type = DVB_CARD_TT_BUDGET_CI,
};

static
struct saa7146_pci_extension_data ttbs = {
	.ext_priv = &ttbs_info,
	.ext = &budget_extension,
};
static
struct saa7146_pci_extension_data ttbc = {
	.ext_priv = &ttbc_info,
	.ext = &budget_extension,
};
static
struct saa7146_pci_extension_data ttbt = {
	.ext_priv = &ttbt_info,
	.ext = &budget_extension,
};
static
struct saa7146_pci_extension_data ttbci = {
	.ext_priv = &ttbci_info,
	.ext = &budget_extension,
};
static
struct saa7146_pci_extension_data satel = {
	.ext_priv = &satel_info,
	.ext = &budget_extension,
};

static
struct pci_device_id pci_tbl[] = {
	   {
		.vendor    = PCI_VENDOR_ID_PHILIPS,
		.device	   = PCI_DEVICE_ID_PHILIPS_SAA7146,
		.subvendor = 0x13c2,
		.subdevice = 0x1003,
		.driver_data = (unsigned long)&ttbs,
	}, {
		.vendor    = PCI_VENDOR_ID_PHILIPS,
		.device	   = PCI_DEVICE_ID_PHILIPS_SAA7146,
		.subvendor = 0x13c2,
		.subdevice = 0x1004,
		.driver_data = (unsigned long)&ttbc,
	}, {
		.vendor    = PCI_VENDOR_ID_PHILIPS,
		.device	   = PCI_DEVICE_ID_PHILIPS_SAA7146,
		.subvendor = 0x13c2,
		.subdevice = 0x1005,
		.driver_data = (unsigned long)&ttbt,
	}, {
		.vendor    = PCI_VENDOR_ID_PHILIPS,
		.device	   = PCI_DEVICE_ID_PHILIPS_SAA7146,
		 /* TT_BUDGET_CI without CI (connector not soldered in) */ 
		.subvendor = 0x13c2,
		.subdevice = 0x100f,
		.driver_data = (unsigned long)&ttbci,
	}, {
		.vendor    = PCI_VENDOR_ID_PHILIPS,
		.device	   = PCI_DEVICE_ID_PHILIPS_SAA7146,
		.subvendor = 0x13c2,
		.subdevice = 0x100c,
		.driver_data = (unsigned long)&ttbci,
	}, {
		.vendor    = PCI_VENDOR_ID_PHILIPS,
		.device	   = PCI_DEVICE_ID_PHILIPS_SAA7146,
		.subvendor = 0x13c2,
		.subdevice = 0x1013,
		.driver_data = (unsigned long)&satel,
	}, {
		.vendor    = 0,
	}
};

static
int this_budget_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_data *info)
{
	struct budget_s *budget  = NULL;
	DEB_EE(("budget: %p\n",budget));

	if( 0 != budget_attach(dev,info)) {
		return -1;
	}
	budget = (struct budget_s*)dev->ext_priv;
	
	/* set dd1 stream a & b */
      	saa7146_write(dev, DD1_STREAM_B, 0x00000000);
	saa7146_write(dev, DD1_INIT, 0x02000000);
	saa7146_write(dev, MC2, (MASK_09 | MASK_25 | MASK_10 | MASK_26));

	// FIXME: cope with error here!
	budget_register(budget);
	printk(KERN_INFO "budget: found budget card '%s'.\n",budget->card->name);

	return 0;
}

static
struct saa7146_extension budget_extension = {
	.name		= "budget dvb\0",
	.flags	 	= 0,
	.ext_vv_data	= NULL,
	
	.module		= THIS_MODULE,
	.pci_tbl	= &pci_tbl[0],
	.attach		= this_budget_attach,
	.detach		= budget_detach,

	.irq_mask	= MASK_07,
	.irq_func	= budget_irq,
};	


static
int __init budget_init(void) 
{
	if (saa7146_register_extension(&budget_extension))
		return -ENODEV;
	
	return 0;
}


static
void __exit budget_exit(void)
{
	DEB_EE((".\n"));
	saa7146_unregister_extension(&budget_extension); 
}

module_init(budget_init);
module_exit(budget_exit);

MODULE_DESCRIPTION("driver for the SAA7146 based so-called budget PCI DVB cards by "
		   "Siemens, Technotrend, Hauppauge");
MODULE_AUTHOR("Ralph Metzler, Marcus Metzler, others");
MODULE_LICENSE("GPL");