aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/bt8xx/dvb-bt8xx.c
diff options
context:
space:
mode:
authorDavid Johnson <dj@david-web.co.uk>2005-09-09 16:02:54 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-09 16:57:42 -0400
commit1f15ddd0b79d1722049952b7359533a18a72f106 (patch)
treec577da1ae2f1b2b15dc3e5cf61dfa532ca0afb54 /drivers/media/dvb/bt8xx/dvb-bt8xx.c
parent466d725ac8d9c58a5de87f72b4fe066c4bad3d9d (diff)
[PATCH] dvb: bt8xx: cleanup
Indentation fixes and remove unnecessary braces. Signed-off-by: David Johnson <dj@david-web.co.uk> Signed-off-by: Johannes Stezenbach <js@linuxtv.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/media/dvb/bt8xx/dvb-bt8xx.c')
-rw-r--r--drivers/media/dvb/bt8xx/dvb-bt8xx.c225
1 files changed, 114 insertions, 111 deletions
diff --git a/drivers/media/dvb/bt8xx/dvb-bt8xx.c b/drivers/media/dvb/bt8xx/dvb-bt8xx.c
index 6f857c6091f3..b29b0f558c70 100644
--- a/drivers/media/dvb/bt8xx/dvb-bt8xx.c
+++ b/drivers/media/dvb/bt8xx/dvb-bt8xx.c
@@ -32,9 +32,7 @@
32#include "dvbdev.h" 32#include "dvbdev.h"
33#include "dvb_demux.h" 33#include "dvb_demux.h"
34#include "dvb_frontend.h" 34#include "dvb_frontend.h"
35
36#include "dvb-bt8xx.h" 35#include "dvb-bt8xx.h"
37
38#include "bt878.h" 36#include "bt878.h"
39 37
40static int debug; 38static int debug;
@@ -43,9 +41,9 @@ module_param(debug, int, 0644);
43MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off)."); 41MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off).");
44 42
45#define dprintk( args... ) \ 43#define dprintk( args... ) \
46 do { \ 44 do \
47 if (debug) printk(KERN_DEBUG args); \ 45 if (debug) printk(KERN_DEBUG args); \
48 } while (0) 46 while (0)
49 47
50static void dvb_bt8xx_task(unsigned long data) 48static void dvb_bt8xx_task(unsigned long data)
51{ 49{
@@ -119,14 +117,12 @@ static struct bt878 __init *dvb_bt8xx_878_match(unsigned int bttv_nr, struct pci
119 unsigned int card_nr; 117 unsigned int card_nr;
120 118
121 /* Hmm, n squared. Hope n is small */ 119 /* Hmm, n squared. Hope n is small */
122 for (card_nr = 0; card_nr < bt878_num; card_nr++) { 120 for (card_nr = 0; card_nr < bt878_num; card_nr++)
123 if (is_pci_slot_eq(bt878[card_nr].dev, bttv_pci_dev)) 121 if (is_pci_slot_eq(bt878[card_nr].dev, bttv_pci_dev))
124 return &bt878[card_nr]; 122 return &bt878[card_nr];
125 }
126 return NULL; 123 return NULL;
127} 124}
128 125
129
130static int thomson_dtt7579_demod_init(struct dvb_frontend* fe) 126static int thomson_dtt7579_demod_init(struct dvb_frontend* fe)
131{ 127{
132 static u8 mt352_clock_config [] = { 0x89, 0x38, 0x38 }; 128 static u8 mt352_clock_config [] = { 0x89, 0x38, 0x38 };
@@ -157,13 +153,19 @@ static int thomson_dtt7579_pll_set(struct dvb_frontend* fe, struct dvb_frontend_
157 #define IF_FREQUENCYx6 217 /* 6 * 36.16666666667MHz */ 153 #define IF_FREQUENCYx6 217 /* 6 * 36.16666666667MHz */
158 div = (((params->frequency + 83333) * 3) / 500000) + IF_FREQUENCYx6; 154 div = (((params->frequency + 83333) * 3) / 500000) + IF_FREQUENCYx6;
159 155
160 if (params->frequency < 542000000) cp = 0xb4; 156 if (params->frequency < 542000000)
161 else if (params->frequency < 771000000) cp = 0xbc; 157 cp = 0xb4;
162 else cp = 0xf4; 158 else if (params->frequency < 771000000)
159 cp = 0xbc;
160 else
161 cp = 0xf4;
163 162
164 if (params->frequency == 0) bs = 0x03; 163 if (params->frequency == 0)
165 else if (params->frequency < 443250000) bs = 0x02; 164 bs = 0x03;
166 else bs = 0x08; 165 else if (params->frequency < 443250000)
166 bs = 0x02;
167 else
168 bs = 0x08;
167 169
168 pllbuf[0] = 0xc0; // Note: non-linux standard PLL i2c address 170 pllbuf[0] = 0xc0; // Note: non-linux standard PLL i2c address
169 pllbuf[1] = div >> 8; 171 pllbuf[1] = div >> 8;
@@ -175,7 +177,6 @@ static int thomson_dtt7579_pll_set(struct dvb_frontend* fe, struct dvb_frontend_
175} 177}
176 178
177static struct mt352_config thomson_dtt7579_config = { 179static struct mt352_config thomson_dtt7579_config = {
178
179 .demod_address = 0x0f, 180 .demod_address = 0x0f,
180 .demod_init = thomson_dtt7579_demod_init, 181 .demod_init = thomson_dtt7579_demod_init,
181 .pll_set = thomson_dtt7579_pll_set, 182 .pll_set = thomson_dtt7579_pll_set,
@@ -183,25 +184,26 @@ static struct mt352_config thomson_dtt7579_config = {
183 184
184static int cx24108_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) 185static int cx24108_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params)
185{ 186{
186 u32 freq = params->frequency; 187 u32 freq = params->frequency;
187
188 int i, a, n, pump;
189 u32 band, pll;
190 188
189 int i, a, n, pump;
190 u32 band, pll;
191 191
192 u32 osci[]={950000,1019000,1075000,1178000,1296000,1432000, 192 u32 osci[]={950000,1019000,1075000,1178000,1296000,1432000,
193 1576000,1718000,1856000,2036000,2150000}; 193 1576000,1718000,1856000,2036000,2150000};
194 u32 bandsel[]={0,0x00020000,0x00040000,0x00100800,0x00101000, 194 u32 bandsel[]={0,0x00020000,0x00040000,0x00100800,0x00101000,
195 0x00102000,0x00104000,0x00108000,0x00110000, 195 0x00102000,0x00104000,0x00108000,0x00110000,
196 0x00120000,0x00140000}; 196 0x00120000,0x00140000};
197 197
198#define XTAL 1011100 /* Hz, really 1.0111 MHz and a /10 prescaler */ 198 #define XTAL 1011100 /* Hz, really 1.0111 MHz and a /10 prescaler */
199 printk("cx24108 debug: entering SetTunerFreq, freq=%d\n",freq); 199 printk("cx24108 debug: entering SetTunerFreq, freq=%d\n",freq);
200 200
201 /* This is really the bit driving the tuner chip cx24108 */ 201 /* This is really the bit driving the tuner chip cx24108 */
202 202
203 if(freq<950000) freq=950000; /* kHz */ 203 if (freq<950000)
204 if(freq>2150000) freq=2150000; /* satellite IF is 950..2150MHz */ 204 freq = 950000; /* kHz */
205 else if (freq>2150000)
206 freq = 2150000; /* satellite IF is 950..2150MHz */
205 207
206 /* decide which VCO to use for the input frequency */ 208 /* decide which VCO to use for the input frequency */
207 for(i=1;(i<sizeof(osci)/sizeof(osci[0]))&&(osci[i]<freq);i++); 209 for(i=1;(i<sizeof(osci)/sizeof(osci[0]))&&(osci[i]<freq);i++);
@@ -228,25 +230,22 @@ static int cx24108_pll_set(struct dvb_frontend* fe, struct dvb_frontend_paramete
228 cx24110_pll_write(fe,0x500c0000); 230 cx24110_pll_write(fe,0x500c0000);
229 cx24110_pll_write(fe,0x83f1f800); 231 cx24110_pll_write(fe,0x83f1f800);
230 cx24110_pll_write(fe,pll); 232 cx24110_pll_write(fe,pll);
231/* writereg(client,0x56,0x7f);*/ 233 //writereg(client,0x56,0x7f);
232 234
233 return 0; 235 return 0;
234} 236}
235 237
236static int pinnsat_pll_init(struct dvb_frontend* fe) 238static int pinnsat_pll_init(struct dvb_frontend* fe)
237{ 239{
238 return 0; 240 return 0;
239} 241}
240 242
241
242static struct cx24110_config pctvsat_config = { 243static struct cx24110_config pctvsat_config = {
243
244 .demod_address = 0x55, 244 .demod_address = 0x55,
245 .pll_init = pinnsat_pll_init, 245 .pll_init = pinnsat_pll_init,
246 .pll_set = cx24108_pll_set, 246 .pll_set = cx24108_pll_set,
247}; 247};
248 248
249
250static int microtune_mt7202dtf_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) 249static int microtune_mt7202dtf_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params)
251{ 250{
252 struct dvb_bt8xx_card *card = (struct dvb_bt8xx_card *) fe->dvb->priv; 251 struct dvb_bt8xx_card *card = (struct dvb_bt8xx_card *) fe->dvb->priv;
@@ -258,15 +257,23 @@ static int microtune_mt7202dtf_pll_set(struct dvb_frontend* fe, struct dvb_front
258 div = (36000000 + params->frequency + 83333) / 166666; 257 div = (36000000 + params->frequency + 83333) / 166666;
259 cfg = 0x88; 258 cfg = 0x88;
260 259
261 if (params->frequency < 175000000) cpump = 2; 260 if (params->frequency < 175000000)
262 else if (params->frequency < 390000000) cpump = 1; 261 cpump = 2;
263 else if (params->frequency < 470000000) cpump = 2; 262 else if (params->frequency < 390000000)
264 else if (params->frequency < 750000000) cpump = 2; 263 cpump = 1;
265 else cpump = 3; 264 else if (params->frequency < 470000000)
265 cpump = 2;
266 else if (params->frequency < 750000000)
267 cpump = 2;
268 else
269 cpump = 3;
266 270
267 if (params->frequency < 175000000) band_select = 0x0e; 271 if (params->frequency < 175000000)
268 else if (params->frequency < 470000000) band_select = 0x05; 272 band_select = 0x0e;
269 else band_select = 0x03; 273 else if (params->frequency < 470000000)
274 band_select = 0x05;
275 else
276 band_select = 0x03;
270 277
271 data[0] = (div >> 8) & 0x7f; 278 data[0] = (div >> 8) & 0x7f;
272 data[1] = div & 0xff; 279 data[1] = div & 0xff;
@@ -285,14 +292,11 @@ static int microtune_mt7202dtf_request_firmware(struct dvb_frontend* fe, const s
285} 292}
286 293
287static struct sp887x_config microtune_mt7202dtf_config = { 294static struct sp887x_config microtune_mt7202dtf_config = {
288
289 .demod_address = 0x70, 295 .demod_address = 0x70,
290 .pll_set = microtune_mt7202dtf_pll_set, 296 .pll_set = microtune_mt7202dtf_pll_set,
291 .request_firmware = microtune_mt7202dtf_request_firmware, 297 .request_firmware = microtune_mt7202dtf_request_firmware,
292}; 298};
293 299
294
295
296static int advbt771_samsung_tdtc9251dh0_demod_init(struct dvb_frontend* fe) 300static int advbt771_samsung_tdtc9251dh0_demod_init(struct dvb_frontend* fe)
297{ 301{
298 static u8 mt352_clock_config [] = { 0x89, 0x38, 0x2d }; 302 static u8 mt352_clock_config [] = { 0x89, 0x38, 0x2d };
@@ -303,7 +307,6 @@ static int advbt771_samsung_tdtc9251dh0_demod_init(struct dvb_frontend* fe)
303 static u8 mt352_av771_extra[] = { 0xB5, 0x7A }; 307 static u8 mt352_av771_extra[] = { 0xB5, 0x7A };
304 static u8 mt352_capt_range_cfg[] = { 0x75, 0x32 }; 308 static u8 mt352_capt_range_cfg[] = { 0x75, 0x32 };
305 309
306
307 mt352_write(fe, mt352_clock_config, sizeof(mt352_clock_config)); 310 mt352_write(fe, mt352_clock_config, sizeof(mt352_clock_config));
308 udelay(2000); 311 udelay(2000);
309 mt352_write(fe, mt352_reset, sizeof(mt352_reset)); 312 mt352_write(fe, mt352_reset, sizeof(mt352_reset));
@@ -326,25 +329,43 @@ static int advbt771_samsung_tdtc9251dh0_pll_set(struct dvb_frontend* fe, struct
326 #define IF_FREQUENCYx6 217 /* 6 * 36.16666666667MHz */ 329 #define IF_FREQUENCYx6 217 /* 6 * 36.16666666667MHz */
327 div = (((params->frequency + 83333) * 3) / 500000) + IF_FREQUENCYx6; 330 div = (((params->frequency + 83333) * 3) / 500000) + IF_FREQUENCYx6;
328 331
329 if (params->frequency < 150000000) cp = 0xB4; 332 if (params->frequency < 150000000)
330 else if (params->frequency < 173000000) cp = 0xBC; 333 cp = 0xB4;
331 else if (params->frequency < 250000000) cp = 0xB4; 334 else if (params->frequency < 173000000)
332 else if (params->frequency < 400000000) cp = 0xBC; 335 cp = 0xBC;
333 else if (params->frequency < 420000000) cp = 0xF4; 336 else if (params->frequency < 250000000)
334 else if (params->frequency < 470000000) cp = 0xFC; 337 cp = 0xB4;
335 else if (params->frequency < 600000000) cp = 0xBC; 338 else if (params->frequency < 400000000)
336 else if (params->frequency < 730000000) cp = 0xF4; 339 cp = 0xBC;
337 else cp = 0xFC; 340 else if (params->frequency < 420000000)
338 341 cp = 0xF4;
339 if (params->frequency < 150000000) bs = 0x01; 342 else if (params->frequency < 470000000)
340 else if (params->frequency < 173000000) bs = 0x01; 343 cp = 0xFC;
341 else if (params->frequency < 250000000) bs = 0x02; 344 else if (params->frequency < 600000000)
342 else if (params->frequency < 400000000) bs = 0x02; 345 cp = 0xBC;
343 else if (params->frequency < 420000000) bs = 0x02; 346 else if (params->frequency < 730000000)
344 else if (params->frequency < 470000000) bs = 0x02; 347 cp = 0xF4;
345 else if (params->frequency < 600000000) bs = 0x08; 348 else
346 else if (params->frequency < 730000000) bs = 0x08; 349 cp = 0xFC;
347 else bs = 0x08; 350
351 if (params->frequency < 150000000)
352 bs = 0x01;
353 else if (params->frequency < 173000000)
354 bs = 0x01;
355 else if (params->frequency < 250000000)
356 bs = 0x02;
357 else if (params->frequency < 400000000)
358 bs = 0x02;
359 else if (params->frequency < 420000000)
360 bs = 0x02;
361 else if (params->frequency < 470000000)
362 bs = 0x02;
363 else if (params->frequency < 600000000)
364 bs = 0x08;
365 else if (params->frequency < 730000000)
366 bs = 0x08;
367 else
368 bs = 0x08;
348 369
349 pllbuf[0] = 0xc2; // Note: non-linux standard PLL i2c address 370 pllbuf[0] = 0xc2; // Note: non-linux standard PLL i2c address
350 pllbuf[1] = div >> 8; 371 pllbuf[1] = div >> 8;
@@ -356,19 +377,15 @@ static int advbt771_samsung_tdtc9251dh0_pll_set(struct dvb_frontend* fe, struct
356} 377}
357 378
358static struct mt352_config advbt771_samsung_tdtc9251dh0_config = { 379static struct mt352_config advbt771_samsung_tdtc9251dh0_config = {
359
360 .demod_address = 0x0f, 380 .demod_address = 0x0f,
361 .demod_init = advbt771_samsung_tdtc9251dh0_demod_init, 381 .demod_init = advbt771_samsung_tdtc9251dh0_demod_init,
362 .pll_set = advbt771_samsung_tdtc9251dh0_pll_set, 382 .pll_set = advbt771_samsung_tdtc9251dh0_pll_set,
363}; 383};
364 384
365
366static struct dst_config dst_config = { 385static struct dst_config dst_config = {
367
368 .demod_address = 0x55, 386 .demod_address = 0x55,
369}; 387};
370 388
371
372static int or51211_request_firmware(struct dvb_frontend* fe, const struct firmware **fw, char* name) 389static int or51211_request_firmware(struct dvb_frontend* fe, const struct firmware **fw, char* name)
373{ 390{
374 struct dvb_bt8xx_card* bt = (struct dvb_bt8xx_card*) fe->dvb->priv; 391 struct dvb_bt8xx_card* bt = (struct dvb_bt8xx_card*) fe->dvb->priv;
@@ -398,10 +415,9 @@ static void or51211_reset(struct dvb_frontend * fe)
398 */ 415 */
399 /* reset & PRM1,2&4 are outputs */ 416 /* reset & PRM1,2&4 are outputs */
400 int ret = bttv_gpio_enable(bt->bttv_nr, 0x001F, 0x001F); 417 int ret = bttv_gpio_enable(bt->bttv_nr, 0x001F, 0x001F);
401 if (ret != 0) { 418 if (ret != 0)
402 printk(KERN_WARNING "or51211: Init Error - Can't Reset DVR " 419 printk(KERN_WARNING "or51211: Init Error - Can't Reset DVR "
403 "(%i)\n", ret); 420 "(%i)\n", ret);
404 }
405 bttv_write_gpio(bt->bttv_nr, 0x001F, 0x0000); /* Reset */ 421 bttv_write_gpio(bt->bttv_nr, 0x001F, 0x0000); /* Reset */
406 msleep(20); 422 msleep(20);
407 /* Now set for normal operation */ 423 /* Now set for normal operation */
@@ -417,7 +433,6 @@ static void or51211_sleep(struct dvb_frontend * fe)
417} 433}
418 434
419static struct or51211_config or51211_config = { 435static struct or51211_config or51211_config = {
420
421 .demod_address = 0x15, 436 .demod_address = 0x15,
422 .request_firmware = or51211_request_firmware, 437 .request_firmware = or51211_request_firmware,
423 .setmode = or51211_setmode, 438 .setmode = or51211_setmode,
@@ -425,7 +440,6 @@ static struct or51211_config or51211_config = {
425 .sleep = or51211_sleep, 440 .sleep = or51211_sleep,
426}; 441};
427 442
428
429static int vp3021_alps_tded4_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) 443static int vp3021_alps_tded4_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params)
430{ 444{
431 struct dvb_bt8xx_card *card = (struct dvb_bt8xx_card *) fe->dvb->priv; 445 struct dvb_bt8xx_card *card = (struct dvb_bt8xx_card *) fe->dvb->priv;
@@ -454,13 +468,11 @@ static int vp3021_alps_tded4_pll_set(struct dvb_frontend* fe, struct dvb_fronten
454} 468}
455 469
456static struct nxt6000_config vp3021_alps_tded4_config = { 470static struct nxt6000_config vp3021_alps_tded4_config = {
457
458 .demod_address = 0x0a, 471 .demod_address = 0x0a,
459 .clock_inversion = 1, 472 .clock_inversion = 1,
460 .pll_set = vp3021_alps_tded4_pll_set, 473 .pll_set = vp3021_alps_tded4_pll_set,
461}; 474};
462 475
463
464static void frontend_init(struct dvb_bt8xx_card *card, u32 type) 476static void frontend_init(struct dvb_bt8xx_card *card, u32 type)
465{ 477{
466 int ret; 478 int ret;
@@ -468,7 +480,7 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type)
468 480
469 switch(type) { 481 switch(type) {
470#ifdef BTTV_DVICO_DVBT_LITE 482#ifdef BTTV_DVICO_DVBT_LITE
471 case BTTV_DVICO_DVBT_LITE: 483 case BTTV_DVICO_DVBT_LITE:
472 card->fe = mt352_attach(&thomson_dtt7579_config, card->i2c_adapter); 484 card->fe = mt352_attach(&thomson_dtt7579_config, card->i2c_adapter);
473 if (card->fe != NULL) { 485 if (card->fe != NULL) {
474 card->fe->ops->info.frequency_min = 174000000; 486 card->fe->ops->info.frequency_min = 174000000;
@@ -479,24 +491,22 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type)
479#endif 491#endif
480 492
481#ifdef BTTV_TWINHAN_VP3021 493#ifdef BTTV_TWINHAN_VP3021
482 case BTTV_TWINHAN_VP3021: 494 case BTTV_TWINHAN_VP3021:
483#else 495#else
484 case BTTV_NEBULA_DIGITV: 496 case BTTV_NEBULA_DIGITV:
485#endif 497#endif
486 card->fe = nxt6000_attach(&vp3021_alps_tded4_config, card->i2c_adapter); 498 card->fe = nxt6000_attach(&vp3021_alps_tded4_config, card->i2c_adapter);
487 if (card->fe != NULL) { 499 if (card->fe != NULL)
488 break; 500 break;
489 }
490 break; 501 break;
491 502
492 case BTTV_AVDVBT_761: 503 case BTTV_AVDVBT_761:
493 card->fe = sp887x_attach(&microtune_mt7202dtf_config, card->i2c_adapter); 504 card->fe = sp887x_attach(&microtune_mt7202dtf_config, card->i2c_adapter);
494 if (card->fe != NULL) { 505 if (card->fe != NULL)
495 break; 506 break;
496 }
497 break; 507 break;
498 508
499 case BTTV_AVDVBT_771: 509 case BTTV_AVDVBT_771:
500 card->fe = mt352_attach(&advbt771_samsung_tdtc9251dh0_config, card->i2c_adapter); 510 card->fe = mt352_attach(&advbt771_samsung_tdtc9251dh0_config, card->i2c_adapter);
501 if (card->fe != NULL) { 511 if (card->fe != NULL) {
502 card->fe->ops->info.frequency_min = 174000000; 512 card->fe->ops->info.frequency_min = 174000000;
@@ -505,7 +515,7 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type)
505 } 515 }
506 break; 516 break;
507 517
508 case BTTV_TWINHAN_DST: 518 case BTTV_TWINHAN_DST:
509 /* DST is not a frontend driver !!! */ 519 /* DST is not a frontend driver !!! */
510 state = (struct dst_state *) kmalloc(sizeof (struct dst_state), GFP_KERNEL); 520 state = (struct dst_state *) kmalloc(sizeof (struct dst_state), GFP_KERNEL);
511 /* Setup the Card */ 521 /* Setup the Card */
@@ -522,54 +532,48 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type)
522 532
523 /* Attach other DST peripherals if any */ 533 /* Attach other DST peripherals if any */
524 /* Conditional Access device */ 534 /* Conditional Access device */
525 if (state->dst_hw_cap & DST_TYPE_HAS_CA) { 535 if (state->dst_hw_cap & DST_TYPE_HAS_CA)
526 ret = dst_ca_attach(state, &card->dvb_adapter); 536 ret = dst_ca_attach(state, &card->dvb_adapter);
527 } 537
528 if (card->fe != NULL) { 538 if (card->fe != NULL)
529 break; 539 break;
530 }
531 break; 540 break;
532 541
533 case BTTV_PINNACLESAT: 542 case BTTV_PINNACLESAT:
534 card->fe = cx24110_attach(&pctvsat_config, card->i2c_adapter); 543 card->fe = cx24110_attach(&pctvsat_config, card->i2c_adapter);
535 if (card->fe != NULL) { 544 if (card->fe != NULL)
536 break; 545 break;
537 }
538 break; 546 break;
539 547
540 case BTTV_PC_HDTV: 548 case BTTV_PC_HDTV:
541 card->fe = or51211_attach(&or51211_config, card->i2c_adapter); 549 card->fe = or51211_attach(&or51211_config, card->i2c_adapter);
542 if (card->fe != NULL) { 550 if (card->fe != NULL)
543 break; 551 break;
544 }
545 break; 552 break;
546 } 553 }
547 554
548 if (card->fe == NULL) { 555 if (card->fe == NULL)
549 printk("dvb-bt8xx: A frontend driver was not found for device %04x/%04x subsystem %04x/%04x\n", 556 printk("dvb-bt8xx: A frontend driver was not found for device %04x/%04x subsystem %04x/%04x\n",
550 card->bt->dev->vendor, 557 card->bt->dev->vendor,
551 card->bt->dev->device, 558 card->bt->dev->device,
552 card->bt->dev->subsystem_vendor, 559 card->bt->dev->subsystem_vendor,
553 card->bt->dev->subsystem_device); 560 card->bt->dev->subsystem_device);
554 } else { 561 else
555 if (dvb_register_frontend(&card->dvb_adapter, card->fe)) { 562 if (dvb_register_frontend(&card->dvb_adapter, card->fe)) {
556 printk("dvb-bt8xx: Frontend registration failed!\n"); 563 printk("dvb-bt8xx: Frontend registration failed!\n");
557 if (card->fe->ops->release) 564 if (card->fe->ops->release)
558 card->fe->ops->release(card->fe); 565 card->fe->ops->release(card->fe);
559 card->fe = NULL; 566 card->fe = NULL;
560 } 567 }
561 }
562} 568}
563 569
564static int __init dvb_bt8xx_load_card(struct dvb_bt8xx_card *card, u32 type) 570static int __init dvb_bt8xx_load_card(struct dvb_bt8xx_card *card, u32 type)
565{ 571{
566 int result; 572 int result;
567 573
568 if ((result = dvb_register_adapter(&card->dvb_adapter, card->card_name, 574 if ((result = dvb_register_adapter(&card->dvb_adapter, card->card_name, THIS_MODULE)) < 0) {
569 THIS_MODULE)) < 0) {
570 printk("dvb_bt8xx: dvb_register_adapter failed (errno = %d)\n", result); 575 printk("dvb_bt8xx: dvb_register_adapter failed (errno = %d)\n", result);
571 return result; 576 return result;
572
573 } 577 }
574 card->dvb_adapter.priv = card; 578 card->dvb_adapter.priv = card;
575 579
@@ -664,9 +668,8 @@ static int dvb_bt8xx_probe(struct device *dev)
664 strncpy(card->card_name, sub->core->name, sizeof(sub->core->name)); 668 strncpy(card->card_name, sub->core->name, sizeof(sub->core->name));
665 card->i2c_adapter = &sub->core->i2c_adap; 669 card->i2c_adapter = &sub->core->i2c_adap;
666 670
667 switch(sub->core->type) 671 switch(sub->core->type) {
668 { 672 case BTTV_PINNACLESAT:
669 case BTTV_PINNACLESAT:
670 card->gpio_mode = 0x0400c060; 673 card->gpio_mode = 0x0400c060;
671 /* should be: BT878_A_GAIN=0,BT878_A_PWRDN,BT878_DA_DPM,BT878_DA_SBR, 674 /* should be: BT878_A_GAIN=0,BT878_A_PWRDN,BT878_DA_DPM,BT878_DA_SBR,
672 BT878_DA_IOM=1,BT878_DA_APP to enable serial highspeed mode. */ 675 BT878_DA_IOM=1,BT878_DA_APP to enable serial highspeed mode. */
@@ -675,7 +678,7 @@ static int dvb_bt8xx_probe(struct device *dev)
675 break; 678 break;
676 679
677#ifdef BTTV_DVICO_DVBT_LITE 680#ifdef BTTV_DVICO_DVBT_LITE
678 case BTTV_DVICO_DVBT_LITE: 681 case BTTV_DVICO_DVBT_LITE:
679#endif 682#endif
680 card->gpio_mode = 0x0400C060; 683 card->gpio_mode = 0x0400C060;
681 card->op_sync_orin = 0; 684 card->op_sync_orin = 0;
@@ -686,25 +689,25 @@ static int dvb_bt8xx_probe(struct device *dev)
686 break; 689 break;
687 690
688#ifdef BTTV_TWINHAN_VP3021 691#ifdef BTTV_TWINHAN_VP3021
689 case BTTV_TWINHAN_VP3021: 692 case BTTV_TWINHAN_VP3021:
690#else 693#else
691 case BTTV_NEBULA_DIGITV: 694 case BTTV_NEBULA_DIGITV:
692#endif 695#endif
693 case BTTV_AVDVBT_761: 696 case BTTV_AVDVBT_761:
694 card->gpio_mode = (1 << 26) | (1 << 14) | (1 << 5); 697 card->gpio_mode = (1 << 26) | (1 << 14) | (1 << 5);
695 card->op_sync_orin = 0; 698 card->op_sync_orin = 0;
696 card->irq_err_ignore = 0; 699 card->irq_err_ignore = 0;
697 /* A_PWRDN DA_SBR DA_APP (high speed serial) */ 700 /* A_PWRDN DA_SBR DA_APP (high speed serial) */
698 break; 701 break;
699 702
700 case BTTV_AVDVBT_771: //case 0x07711461: 703 case BTTV_AVDVBT_771: //case 0x07711461:
701 card->gpio_mode = 0x0400402B; 704 card->gpio_mode = 0x0400402B;
702 card->op_sync_orin = BT878_RISC_SYNC_MASK; 705 card->op_sync_orin = BT878_RISC_SYNC_MASK;
703 card->irq_err_ignore = 0; 706 card->irq_err_ignore = 0;
704 /* A_PWRDN DA_SBR DA_APP[0] PKTP=10 RISC_ENABLE FIFO_ENABLE*/ 707 /* A_PWRDN DA_SBR DA_APP[0] PKTP=10 RISC_ENABLE FIFO_ENABLE*/
705 break; 708 break;
706 709
707 case BTTV_TWINHAN_DST: 710 case BTTV_TWINHAN_DST:
708 card->gpio_mode = 0x2204f2c; 711 card->gpio_mode = 0x2204f2c;
709 card->op_sync_orin = BT878_RISC_SYNC_MASK; 712 card->op_sync_orin = BT878_RISC_SYNC_MASK;
710 card->irq_err_ignore = BT878_APABORT | BT878_ARIPERR | 713 card->irq_err_ignore = BT878_APABORT | BT878_ARIPERR |
@@ -722,13 +725,13 @@ static int dvb_bt8xx_probe(struct device *dev)
722 * RISC+FIFO ENABLE */ 725 * RISC+FIFO ENABLE */
723 break; 726 break;
724 727
725 case BTTV_PC_HDTV: 728 case BTTV_PC_HDTV:
726 card->gpio_mode = 0x0100EC7B; 729 card->gpio_mode = 0x0100EC7B;
727 card->op_sync_orin = 0; 730 card->op_sync_orin = 0;
728 card->irq_err_ignore = 0; 731 card->irq_err_ignore = 0;
729 break; 732 break;
730 733
731 default: 734 default:
732 printk(KERN_WARNING "dvb_bt8xx: Unknown bttv card type: %d.\n", 735 printk(KERN_WARNING "dvb_bt8xx: Unknown bttv card type: %d.\n",
733 sub->core->type); 736 sub->core->type);
734 kfree(card); 737 kfree(card);
@@ -751,7 +754,6 @@ static int dvb_bt8xx_probe(struct device *dev)
751 754
752 kfree(card); 755 kfree(card);
753 return -EFAULT; 756 return -EFAULT;
754
755 } 757 }
756 758
757 init_MUTEX(&card->bt->gpio_lock); 759 init_MUTEX(&card->bt->gpio_lock);
@@ -779,7 +781,8 @@ static int dvb_bt8xx_remove(struct device *dev)
779 card->demux.dmx.remove_frontend(&card->demux.dmx, &card->fe_hw); 781 card->demux.dmx.remove_frontend(&card->demux.dmx, &card->fe_hw);
780 dvb_dmxdev_release(&card->dmxdev); 782 dvb_dmxdev_release(&card->dmxdev);
781 dvb_dmx_release(&card->demux); 783 dvb_dmx_release(&card->demux);
782 if (card->fe) dvb_unregister_frontend(card->fe); 784 if (card->fe)
785 dvb_unregister_frontend(card->fe);
783 dvb_unregister_adapter(&card->dvb_adapter); 786 dvb_unregister_adapter(&card->dvb_adapter);
784 787
785 kfree(card); 788 kfree(card);