diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2007-03-20 22:00:18 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-10-09 21:08:11 -0400 |
commit | 44a6481dcd9ec835bbd608b1b2ee47ee62c7e1d8 (patch) | |
tree | caa2f2a13fa44ff50f207706a61199063440a35a /drivers/media/video/cx23885 | |
parent | 70ebd70573a58a2c0405ef038f1acf74c795eaa5 (diff) |
V4L/DVB (6162): cx23885: whitespace cleanups
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/cx23885')
-rw-r--r-- | drivers/media/video/cx23885/cx23885-cards.c | 3 | ||||
-rw-r--r-- | drivers/media/video/cx23885/cx23885-core.c | 275 | ||||
-rw-r--r-- | drivers/media/video/cx23885/cx23885-dvb.c | 59 | ||||
-rw-r--r-- | drivers/media/video/cx23885/cx23885-i2c.c | 40 | ||||
-rw-r--r-- | drivers/media/video/cx23885/cx23885.h | 17 |
5 files changed, 211 insertions, 183 deletions
diff --git a/drivers/media/video/cx23885/cx23885-cards.c b/drivers/media/video/cx23885/cx23885-cards.c index decf602ab164..8bb3fe4a876c 100644 --- a/drivers/media/video/cx23885/cx23885-cards.c +++ b/drivers/media/video/cx23885/cx23885-cards.c | |||
@@ -171,7 +171,8 @@ void cx23885_card_setup(struct cx23885_dev *dev) | |||
171 | 171 | ||
172 | if (dev->i2c_bus[0].i2c_rc == 0) { | 172 | if (dev->i2c_bus[0].i2c_rc == 0) { |
173 | dev->i2c_bus[0].i2c_client.addr = 0xa0 >> 1; | 173 | dev->i2c_bus[0].i2c_client.addr = 0xa0 >> 1; |
174 | tveeprom_read(&dev->i2c_bus[0].i2c_client, eeprom, sizeof(eeprom)); | 174 | tveeprom_read(&dev->i2c_bus[0].i2c_client, |
175 | eeprom, sizeof(eeprom)); | ||
175 | } | 176 | } |
176 | 177 | ||
177 | switch (dev->board) { | 178 | switch (dev->board) { |
diff --git a/drivers/media/video/cx23885/cx23885-core.c b/drivers/media/video/cx23885/cx23885-core.c index 804ba7ff9770..6f0a8dbc6b3b 100644 --- a/drivers/media/video/cx23885/cx23885-core.c +++ b/drivers/media/video/cx23885/cx23885-core.c | |||
@@ -349,15 +349,15 @@ static int cx23885_risc_decode(u32 risc) | |||
349 | 349 | ||
350 | printk("0x%08x [ %s", risc, | 350 | printk("0x%08x [ %s", risc, |
351 | instr[risc >> 28] ? instr[risc >> 28] : "INVALID"); | 351 | instr[risc >> 28] ? instr[risc >> 28] : "INVALID"); |
352 | for (i = ARRAY_SIZE(bits)-1; i >= 0; i--) | 352 | for (i = ARRAY_SIZE(bits) - 1; i >= 0; i--) |
353 | if (risc & (1 << (i + 12))) | 353 | if (risc & (1 << (i + 12))) |
354 | printk(" %s",bits[i]); | 354 | printk(" %s", bits[i]); |
355 | printk(" count=%d ]\n", risc & 0xfff); | 355 | printk(" count=%d ]\n", risc & 0xfff); |
356 | return incr[risc >> 28] ? incr[risc >> 28] : 1; | 356 | return incr[risc >> 28] ? incr[risc >> 28] : 1; |
357 | } | 357 | } |
358 | 358 | ||
359 | void cx23885_wakeup(struct cx23885_tsport *port, | 359 | void cx23885_wakeup(struct cx23885_tsport *port, |
360 | struct cx23885_dmaqueue *q, u32 count) | 360 | struct cx23885_dmaqueue *q, u32 count) |
361 | { | 361 | { |
362 | struct cx23885_dev *dev = port->dev; | 362 | struct cx23885_dev *dev = port->dev; |
363 | struct cx23885_buffer *buf; | 363 | struct cx23885_buffer *buf; |
@@ -374,7 +374,7 @@ void cx23885_wakeup(struct cx23885_tsport *port, | |||
374 | if ((s16) (count - buf->count) < 0) | 374 | if ((s16) (count - buf->count) < 0) |
375 | break; | 375 | break; |
376 | do_gettimeofday(&buf->vb.ts); | 376 | do_gettimeofday(&buf->vb.ts); |
377 | dprintk(2,"[%p/%d] wakeup reg=%d buf=%d\n",buf,buf->vb.i, | 377 | dprintk(2, "[%p/%d] wakeup reg=%d buf=%d\n", buf, buf->vb.i, |
378 | count, buf->count); | 378 | count, buf->count); |
379 | buf->vb.state = STATE_DONE; | 379 | buf->vb.state = STATE_DONE; |
380 | list_del(&buf->vb.queue); | 380 | list_del(&buf->vb.queue); |
@@ -383,31 +383,34 @@ void cx23885_wakeup(struct cx23885_tsport *port, | |||
383 | if (list_empty(&q->active)) { | 383 | if (list_empty(&q->active)) { |
384 | del_timer(&q->timeout); | 384 | del_timer(&q->timeout); |
385 | } else { | 385 | } else { |
386 | mod_timer(&q->timeout, jiffies+BUFFER_TIMEOUT); | 386 | mod_timer(&q->timeout, jiffies + BUFFER_TIMEOUT); |
387 | } | 387 | } |
388 | if (bc != 1) | 388 | if (bc != 1) |
389 | printk("%s: %d buffers handled (should be 1)\n",__FUNCTION__,bc); | 389 | printk("%s: %d buffers handled (should be 1)\n", |
390 | __FUNCTION__, bc); | ||
390 | } | 391 | } |
391 | void cx23885_sram_channel_dump(struct cx23885_dev *dev, | 392 | void cx23885_sram_channel_dump(struct cx23885_dev *dev, |
392 | struct sram_channel *ch); | 393 | struct sram_channel *ch); |
393 | 394 | ||
394 | int cx23885_sram_channel_setup(struct cx23885_dev *dev, | 395 | int cx23885_sram_channel_setup(struct cx23885_dev *dev, |
395 | struct sram_channel *ch, | 396 | struct sram_channel *ch, |
396 | unsigned int bpl, u32 risc) | 397 | unsigned int bpl, u32 risc) |
397 | { | 398 | { |
398 | unsigned int i,lines; | 399 | unsigned int i, lines; |
399 | u32 cdt; | 400 | u32 cdt; |
400 | 401 | ||
401 | if (ch->cmds_start == 0) | 402 | if (ch->cmds_start == 0) |
402 | { | 403 | { |
403 | dprintk(1, "%s() Erasing channel [%s]\n",__FUNCTION__, ch->name); | 404 | dprintk(1, "%s() Erasing channel [%s]\n", __FUNCTION__, |
405 | ch->name); | ||
404 | cx_write(ch->ptr1_reg, 0); | 406 | cx_write(ch->ptr1_reg, 0); |
405 | cx_write(ch->ptr2_reg, 0); | 407 | cx_write(ch->ptr2_reg, 0); |
406 | cx_write(ch->cnt2_reg, 0); | 408 | cx_write(ch->cnt2_reg, 0); |
407 | cx_write(ch->cnt1_reg, 0); | 409 | cx_write(ch->cnt1_reg, 0); |
408 | return 0; | 410 | return 0; |
409 | } else { | 411 | } else { |
410 | dprintk(1, "%s() Configuring channel [%s]\n",__FUNCTION__, ch->name); | 412 | dprintk(1, "%s() Configuring channel [%s]\n", __FUNCTION__, |
413 | ch->name); | ||
411 | } | 414 | } |
412 | 415 | ||
413 | bpl = (bpl + 7) & ~7; /* alignment */ | 416 | bpl = (bpl + 7) & ~7; /* alignment */ |
@@ -417,13 +420,14 @@ int cx23885_sram_channel_setup(struct cx23885_dev *dev, | |||
417 | lines = 6; | 420 | lines = 6; |
418 | BUG_ON(lines < 2); | 421 | BUG_ON(lines < 2); |
419 | 422 | ||
420 | cx_write(8+0, cpu_to_le32(RISC_JUMP | RISC_IRQ1 | RISC_CNT_INC) ); | 423 | cx_write(8 + 0, cpu_to_le32(RISC_JUMP | RISC_IRQ1 | RISC_CNT_INC) ); |
421 | cx_write(8+4, cpu_to_le32(8) ); | 424 | cx_write(8 + 4, cpu_to_le32(8) ); |
422 | cx_write(8+8, cpu_to_le32(0) ); | 425 | cx_write(8 + 8, cpu_to_le32(0) ); |
423 | 426 | ||
424 | /* write CDT */ | 427 | /* write CDT */ |
425 | for (i = 0; i < lines; i++) { | 428 | for (i = 0; i < lines; i++) { |
426 | dprintk(2, "%s() 0x%08x <- 0x%08x\n", __FUNCTION__, cdt + 16*i, ch->fifo_start + bpl*i); | 429 | dprintk(2, "%s() 0x%08x <- 0x%08x\n", __FUNCTION__, cdt + 16*i, |
430 | ch->fifo_start + bpl*i); | ||
427 | cx_write(cdt + 16*i, ch->fifo_start + bpl*i); | 431 | cx_write(cdt + 16*i, ch->fifo_start + bpl*i); |
428 | cx_write(cdt + 16*i + 4, 0); | 432 | cx_write(cdt + 16*i + 4, 0); |
429 | cx_write(cdt + 16*i + 8, 0); | 433 | cx_write(cdt + 16*i + 8, 0); |
@@ -462,7 +466,7 @@ int cx23885_sram_channel_setup(struct cx23885_dev *dev, | |||
462 | } | 466 | } |
463 | 467 | ||
464 | void cx23885_sram_channel_dump(struct cx23885_dev *dev, | 468 | void cx23885_sram_channel_dump(struct cx23885_dev *dev, |
465 | struct sram_channel *ch) | 469 | struct sram_channel *ch) |
466 | { | 470 | { |
467 | static char *name[] = { | 471 | static char *name[] = { |
468 | "init risc lo", | 472 | "init risc lo", |
@@ -481,7 +485,7 @@ void cx23885_sram_channel_dump(struct cx23885_dev *dev, | |||
481 | "line / byte", | 485 | "line / byte", |
482 | }; | 486 | }; |
483 | u32 risc; | 487 | u32 risc; |
484 | unsigned int i,j,n; | 488 | unsigned int i, j, n; |
485 | 489 | ||
486 | printk("%s: %s - dma channel status dump\n", | 490 | printk("%s: %s - dma channel status dump\n", |
487 | dev->name, ch->name); | 491 | dev->name, ch->name); |
@@ -491,16 +495,19 @@ void cx23885_sram_channel_dump(struct cx23885_dev *dev, | |||
491 | cx_read(ch->cmds_start + 4*i)); | 495 | cx_read(ch->cmds_start + 4*i)); |
492 | 496 | ||
493 | for (i = 0; i < 4; i++) { | 497 | for (i = 0; i < 4; i++) { |
494 | risc = cx_read(ch->cmds_start + 4 * (i+14)); | 498 | risc = cx_read(ch->cmds_start + 4 * (i + 14)); |
495 | printk("%s: risc%d: ", dev->name, i); | 499 | printk("%s: risc%d: ", dev->name, i); |
496 | cx23885_risc_decode(risc); | 500 | cx23885_risc_decode(risc); |
497 | } | 501 | } |
498 | for (i = 0; i < (64 >> 2); i += n) { | 502 | for (i = 0; i < (64 >> 2); i += n) { |
499 | risc = cx_read(ch->ctrl_start + 4 * i); /* No consideration for bits 63-32 */ | 503 | risc = cx_read(ch->ctrl_start + 4 * i); |
500 | printk("%s: (0x%08x) iq %x: ", dev->name, ch->ctrl_start + 4 * i, i); | 504 | /* No consideration for bits 63-32 */ |
505 | |||
506 | printk("%s: (0x%08x) iq %x: ", dev->name, | ||
507 | ch->ctrl_start + 4 * i, i); | ||
501 | n = cx23885_risc_decode(risc); | 508 | n = cx23885_risc_decode(risc); |
502 | for (j = 1; j < n; j++) { | 509 | for (j = 1; j < n; j++) { |
503 | risc = cx_read(ch->ctrl_start + 4 * (i+j)); | 510 | risc = cx_read(ch->ctrl_start + 4 * (i + j)); |
504 | printk("%s: iq %x: 0x%08x [ arg #%d ]\n", | 511 | printk("%s: iq %x: 0x%08x [ arg #%d ]\n", |
505 | dev->name, i+j, risc, j); | 512 | dev->name, i+j, risc, j); |
506 | } | 513 | } |
@@ -509,7 +516,7 @@ void cx23885_sram_channel_dump(struct cx23885_dev *dev, | |||
509 | printk("%s: fifo: 0x%08x -> 0x%x\n", | 516 | printk("%s: fifo: 0x%08x -> 0x%x\n", |
510 | dev->name, ch->fifo_start, ch->fifo_start+ch->fifo_size); | 517 | dev->name, ch->fifo_start, ch->fifo_start+ch->fifo_size); |
511 | printk("%s: ctrl: 0x%08x -> 0x%x\n", | 518 | printk("%s: ctrl: 0x%08x -> 0x%x\n", |
512 | dev->name, ch->ctrl_start, ch->ctrl_start+6*16); | 519 | dev->name, ch->ctrl_start, ch->ctrl_start + 6*16); |
513 | printk("%s: ptr1_reg: 0x%08x\n", | 520 | printk("%s: ptr1_reg: 0x%08x\n", |
514 | dev->name, cx_read(ch->ptr1_reg)); | 521 | dev->name, cx_read(ch->ptr1_reg)); |
515 | printk("%s: ptr2_reg: 0x%08x\n", | 522 | printk("%s: ptr2_reg: 0x%08x\n", |
@@ -520,10 +527,11 @@ void cx23885_sram_channel_dump(struct cx23885_dev *dev, | |||
520 | dev->name, cx_read(ch->cnt2_reg)); | 527 | dev->name, cx_read(ch->cnt2_reg)); |
521 | } | 528 | } |
522 | 529 | ||
523 | void cx23885_risc_disasm(struct cx23885_tsport *port, struct btcx_riscmem *risc) | 530 | void cx23885_risc_disasm(struct cx23885_tsport *port, |
531 | struct btcx_riscmem *risc) | ||
524 | { | 532 | { |
525 | struct cx23885_dev *dev = port->dev; | 533 | struct cx23885_dev *dev = port->dev; |
526 | unsigned int i,j,n; | 534 | unsigned int i, j, n; |
527 | 535 | ||
528 | printk("%s: risc disasm: %p [dma=0x%08lx]\n", | 536 | printk("%s: risc disasm: %p [dma=0x%08lx]\n", |
529 | dev->name, risc->cpu, (unsigned long)risc->dma); | 537 | dev->name, risc->cpu, (unsigned long)risc->dma); |
@@ -532,7 +540,7 @@ void cx23885_risc_disasm(struct cx23885_tsport *port, struct btcx_riscmem *risc) | |||
532 | n = cx23885_risc_decode(risc->cpu[i]); | 540 | n = cx23885_risc_decode(risc->cpu[i]); |
533 | for (j = 1; j < n; j++) | 541 | for (j = 1; j < n; j++) |
534 | printk("%s: %04d: 0x%08x [ arg #%d ]\n", | 542 | printk("%s: %04d: 0x%08x [ arg #%d ]\n", |
535 | dev->name, i+j, risc->cpu[i+j], j); | 543 | dev->name, i + j, risc->cpu[i + j], j); |
536 | if (risc->cpu[i] == RISC_JUMP) | 544 | if (risc->cpu[i] == RISC_JUMP) |
537 | break; | 545 | break; |
538 | } | 546 | } |
@@ -625,8 +633,8 @@ static int cx23885_pci_quirks(struct cx23885_dev *dev) | |||
625 | static int get_resources(struct cx23885_dev *dev) | 633 | static int get_resources(struct cx23885_dev *dev) |
626 | { | 634 | { |
627 | if (request_mem_region(pci_resource_start(dev->pci,0), | 635 | if (request_mem_region(pci_resource_start(dev->pci,0), |
628 | pci_resource_len(dev->pci,0), | 636 | pci_resource_len(dev->pci,0), |
629 | dev->name)) | 637 | dev->name)) |
630 | return 0; | 638 | return 0; |
631 | 639 | ||
632 | printk(KERN_ERR "%s: can't get MMIO memory @ 0x%llx\n", | 640 | printk(KERN_ERR "%s: can't get MMIO memory @ 0x%llx\n", |
@@ -637,7 +645,7 @@ static int get_resources(struct cx23885_dev *dev) | |||
637 | 645 | ||
638 | static void cx23885_timeout(unsigned long data); | 646 | static void cx23885_timeout(unsigned long data); |
639 | int cx23885_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc, | 647 | int cx23885_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc, |
640 | u32 reg, u32 mask, u32 value); | 648 | u32 reg, u32 mask, u32 value); |
641 | 649 | ||
642 | static int cx23885_ir_init(struct cx23885_dev *dev) | 650 | static int cx23885_ir_init(struct cx23885_dev *dev) |
643 | { | 651 | { |
@@ -726,15 +734,16 @@ static int cx23885_dev_setup(struct cx23885_dev *dev) | |||
726 | dev->ts2.gen_ctrl_val = 0xc; /* Serial bus + punctured clock */ | 734 | dev->ts2.gen_ctrl_val = 0xc; /* Serial bus + punctured clock */ |
727 | dev->ts2.ts_clk_en_val = 0x1; /* Enable TS_CLK */ | 735 | dev->ts2.ts_clk_en_val = 0x1; /* Enable TS_CLK */ |
728 | 736 | ||
729 | cx23885_risc_stopper(dev->pci, &dev->ts2.mpegq.stopper, dev->ts2.reg_dma_ctl, dev->ts2.dma_ctl_val, 0x00); | 737 | cx23885_risc_stopper(dev->pci, &dev->ts2.mpegq.stopper, |
738 | dev->ts2.reg_dma_ctl, dev->ts2.dma_ctl_val, 0x00); | ||
730 | 739 | ||
731 | sprintf(dev->name,"cx23885[%d]", dev->nr); | 740 | sprintf(dev->name, "cx23885[%d]", dev->nr); |
732 | 741 | ||
733 | if (get_resources(dev) < 0) { | 742 | if (get_resources(dev) < 0) { |
734 | printk(KERN_ERR "CORE %s No more PCIe resources for " | 743 | printk(KERN_ERR "CORE %s No more PCIe resources for " |
735 | "subsystem: %04x:%04x\n", | 744 | "subsystem: %04x:%04x\n", |
736 | dev->name, dev->pci->subsystem_vendor, | 745 | dev->name, dev->pci->subsystem_vendor, |
737 | dev->pci->subsystem_device); | 746 | dev->pci->subsystem_device); |
738 | 747 | ||
739 | cx23885_devcount--; | 748 | cx23885_devcount--; |
740 | goto fail_free; | 749 | goto fail_free; |
@@ -746,7 +755,7 @@ static int cx23885_dev_setup(struct cx23885_dev *dev) | |||
746 | 755 | ||
747 | /* PCIe stuff */ | 756 | /* PCIe stuff */ |
748 | dev->lmmio = ioremap(pci_resource_start(dev->pci,0), | 757 | dev->lmmio = ioremap(pci_resource_start(dev->pci,0), |
749 | pci_resource_len(dev->pci,0)); | 758 | pci_resource_len(dev->pci,0)); |
750 | 759 | ||
751 | dev->bmmio = (u8 __iomem *)dev->lmmio; | 760 | dev->bmmio = (u8 __iomem *)dev->lmmio; |
752 | 761 | ||
@@ -765,10 +774,10 @@ static int cx23885_dev_setup(struct cx23885_dev *dev) | |||
765 | cx23885_card_list(dev); | 774 | cx23885_card_list(dev); |
766 | } | 775 | } |
767 | printk(KERN_INFO "CORE %s: subsystem: %04x:%04x, board: %s [card=%d,%s]\n", | 776 | printk(KERN_INFO "CORE %s: subsystem: %04x:%04x, board: %s [card=%d,%s]\n", |
768 | dev->name, dev->pci->subsystem_vendor, | 777 | dev->name, dev->pci->subsystem_vendor, |
769 | dev->pci->subsystem_device, cx23885_boards[dev->board].name, | 778 | dev->pci->subsystem_device, cx23885_boards[dev->board].name, |
770 | dev->board, card[dev->nr] == dev->board ? | 779 | dev->board, card[dev->nr] == dev->board ? |
771 | "insmod option" : "autodetected"); | 780 | "insmod option" : "autodetected"); |
772 | 781 | ||
773 | /* Configure the internal memory */ | 782 | /* Configure the internal memory */ |
774 | if(dev->pci->device == 0x8880) { | 783 | if(dev->pci->device == 0x8880) { |
@@ -779,7 +788,8 @@ static int cx23885_dev_setup(struct cx23885_dev *dev) | |||
779 | dev->bridge = CX23885_BRIDGE_885; | 788 | dev->bridge = CX23885_BRIDGE_885; |
780 | dev->sram_channels = cx23885_sram_channels; | 789 | dev->sram_channels = cx23885_sram_channels; |
781 | } | 790 | } |
782 | dprintk(1, "%s() Memory configured for PCIe bridge type %d\n", __FUNCTION__, dev->bridge); | 791 | dprintk(1, "%s() Memory configured for PCIe bridge type %d\n", |
792 | __FUNCTION__, dev->bridge); | ||
783 | 793 | ||
784 | /* init hardware */ | 794 | /* init hardware */ |
785 | cx23885_reset(dev); | 795 | cx23885_reset(dev); |
@@ -793,7 +803,8 @@ static int cx23885_dev_setup(struct cx23885_dev *dev) | |||
793 | cx23885_ir_init(dev); | 803 | cx23885_ir_init(dev); |
794 | 804 | ||
795 | if (cx23885_dvb_register(&dev->ts2) < 0) { | 805 | if (cx23885_dvb_register(&dev->ts2) < 0) { |
796 | printk(KERN_ERR "%s() Failed to register dvb adapters\n", __FUNCTION__); | 806 | printk(KERN_ERR "%s() Failed to register dvb adapters\n", |
807 | __FUNCTION__); | ||
797 | } | 808 | } |
798 | 809 | ||
799 | return 0; | 810 | return 0; |
@@ -820,12 +831,12 @@ void cx23885_dev_unregister(struct cx23885_dev *dev) | |||
820 | } | 831 | } |
821 | 832 | ||
822 | static u32* cx23885_risc_field(u32 *rp, struct scatterlist *sglist, | 833 | static u32* cx23885_risc_field(u32 *rp, struct scatterlist *sglist, |
823 | unsigned int offset, u32 sync_line, | 834 | unsigned int offset, u32 sync_line, |
824 | unsigned int bpl, unsigned int padding, | 835 | unsigned int bpl, unsigned int padding, |
825 | unsigned int lines) | 836 | unsigned int lines) |
826 | { | 837 | { |
827 | struct scatterlist *sg; | 838 | struct scatterlist *sg; |
828 | unsigned int line,todo; | 839 | unsigned int line, todo; |
829 | 840 | ||
830 | /* sync instruction */ | 841 | /* sync instruction */ |
831 | if (sync_line != NO_SYNC_LINE) | 842 | if (sync_line != NO_SYNC_LINE) |
@@ -874,11 +885,11 @@ static u32* cx23885_risc_field(u32 *rp, struct scatterlist *sglist, | |||
874 | } | 885 | } |
875 | 886 | ||
876 | int cx23885_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc, | 887 | int cx23885_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc, |
877 | struct scatterlist *sglist, | 888 | struct scatterlist *sglist, unsigned int top_offset, |
878 | unsigned int top_offset, unsigned int bottom_offset, | 889 | unsigned int bottom_offset, unsigned int bpl, |
879 | unsigned int bpl, unsigned int padding, unsigned int lines) | 890 | unsigned int padding, unsigned int lines) |
880 | { | 891 | { |
881 | u32 instructions,fields; | 892 | u32 instructions, fields; |
882 | u32 *rp; | 893 | u32 *rp; |
883 | int rc; | 894 | int rc; |
884 | 895 | ||
@@ -903,10 +914,10 @@ int cx23885_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc, | |||
903 | rp = risc->cpu; | 914 | rp = risc->cpu; |
904 | if (UNSET != top_offset) | 915 | if (UNSET != top_offset) |
905 | rp = cx23885_risc_field(rp, sglist, top_offset, 0, | 916 | rp = cx23885_risc_field(rp, sglist, top_offset, 0, |
906 | bpl, padding, lines); | 917 | bpl, padding, lines); |
907 | if (UNSET != bottom_offset) | 918 | if (UNSET != bottom_offset) |
908 | rp = cx23885_risc_field(rp, sglist, bottom_offset, 0x200, | 919 | rp = cx23885_risc_field(rp, sglist, bottom_offset, 0x200, |
909 | bpl, padding, lines); | 920 | bpl, padding, lines); |
910 | 921 | ||
911 | /* save pointer to jmp instruction address */ | 922 | /* save pointer to jmp instruction address */ |
912 | risc->jmp = rp; | 923 | risc->jmp = rp; |
@@ -915,8 +926,8 @@ int cx23885_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc, | |||
915 | } | 926 | } |
916 | 927 | ||
917 | int cx23885_risc_databuffer(struct pci_dev *pci, struct btcx_riscmem *risc, | 928 | int cx23885_risc_databuffer(struct pci_dev *pci, struct btcx_riscmem *risc, |
918 | struct scatterlist *sglist, unsigned int bpl, | 929 | struct scatterlist *sglist, unsigned int bpl, |
919 | unsigned int lines) | 930 | unsigned int lines) |
920 | { | 931 | { |
921 | u32 instructions; | 932 | u32 instructions; |
922 | u32 *rp; | 933 | u32 *rp; |
@@ -945,7 +956,7 @@ int cx23885_risc_databuffer(struct pci_dev *pci, struct btcx_riscmem *risc, | |||
945 | } | 956 | } |
946 | 957 | ||
947 | int cx23885_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc, | 958 | int cx23885_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc, |
948 | u32 reg, u32 mask, u32 value) | 959 | u32 reg, u32 mask, u32 value) |
949 | { | 960 | { |
950 | u32 *rp; | 961 | u32 *rp; |
951 | int rc; | 962 | int rc; |
@@ -969,7 +980,7 @@ int cx23885_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc, | |||
969 | void cx23885_free_buffer(struct videobuf_queue *q, struct cx23885_buffer *buf) | 980 | void cx23885_free_buffer(struct videobuf_queue *q, struct cx23885_buffer *buf) |
970 | { | 981 | { |
971 | BUG_ON(in_interrupt()); | 982 | BUG_ON(in_interrupt()); |
972 | videobuf_waiton(&buf->vb,0,0); | 983 | videobuf_waiton(&buf->vb, 0, 0); |
973 | videobuf_dma_unmap(q, &buf->vb.dma); | 984 | videobuf_dma_unmap(q, &buf->vb.dma); |
974 | videobuf_dma_free(&buf->vb.dma); | 985 | videobuf_dma_free(&buf->vb.dma); |
975 | btcx_riscmem_free((struct pci_dev *)q->dev, &buf->risc); | 986 | btcx_riscmem_free((struct pci_dev *)q->dev, &buf->risc); |
@@ -977,18 +988,18 @@ void cx23885_free_buffer(struct videobuf_queue *q, struct cx23885_buffer *buf) | |||
977 | } | 988 | } |
978 | 989 | ||
979 | static int cx23885_start_dma(struct cx23885_tsport *port, | 990 | static int cx23885_start_dma(struct cx23885_tsport *port, |
980 | struct cx23885_dmaqueue *q, | 991 | struct cx23885_dmaqueue *q, |
981 | struct cx23885_buffer *buf) | 992 | struct cx23885_buffer *buf) |
982 | { | 993 | { |
983 | struct cx23885_dev *dev = port->dev; | 994 | struct cx23885_dev *dev = port->dev; |
984 | 995 | ||
985 | dprintk(1, "%s() w: %d, h: %d, f: %d\n", __FUNCTION__, | 996 | dprintk(1, "%s() w: %d, h: %d, f: %d\n", __FUNCTION__, |
986 | buf->vb.width, buf->vb.height, buf->vb.field); | 997 | buf->vb.width, buf->vb.height, buf->vb.field); |
987 | 998 | ||
988 | /* setup fifo + format */ | 999 | /* setup fifo + format */ |
989 | cx23885_sram_channel_setup(dev, | 1000 | cx23885_sram_channel_setup(dev, |
990 | &dev->sram_channels[ port->sram_chno ], | 1001 | &dev->sram_channels[ port->sram_chno ], |
991 | port->ts_packet_size, buf->risc.dma); | 1002 | port->ts_packet_size, buf->risc.dma); |
992 | if(debug > 5) { | 1003 | if(debug > 5) { |
993 | cx23885_sram_channel_dump(dev, &dev->sram_channels[ port->sram_chno ] ); | 1004 | cx23885_sram_channel_dump(dev, &dev->sram_channels[ port->sram_chno ] ); |
994 | cx23885_risc_disasm(port, &buf->risc); | 1005 | cx23885_risc_disasm(port, &buf->risc); |
@@ -998,8 +1009,8 @@ static int cx23885_start_dma(struct cx23885_tsport *port, | |||
998 | cx_write(port->reg_lngth, buf->vb.width); | 1009 | cx_write(port->reg_lngth, buf->vb.width); |
999 | 1010 | ||
1000 | if (!(cx23885_boards[dev->board].portc & CX23885_MPEG_DVB)) { | 1011 | if (!(cx23885_boards[dev->board].portc & CX23885_MPEG_DVB)) { |
1001 | printk( "%s() Failed. Unsupported value in .portc (0x%08x)\n", __FUNCTION__, | 1012 | printk( "%s() Failed. Unsupported value in .portc (0x%08x)\n", |
1002 | cx23885_boards[dev->board].portc ); | 1013 | __FUNCTION__, cx23885_boards[dev->board].portc ); |
1003 | return -EINVAL; | 1014 | return -EINVAL; |
1004 | } | 1015 | } |
1005 | 1016 | ||
@@ -1017,7 +1028,8 @@ static int cx23885_start_dma(struct cx23885_tsport *port, | |||
1017 | case CX23885_BOARD_HAUPPAUGE_HVR1800lp: | 1028 | case CX23885_BOARD_HAUPPAUGE_HVR1800lp: |
1018 | case CX23885_BOARD_HAUPPAUGE_HVR1800: | 1029 | case CX23885_BOARD_HAUPPAUGE_HVR1800: |
1019 | cx_write(port->reg_vld_misc, 0x00); | 1030 | cx_write(port->reg_vld_misc, 0x00); |
1020 | dprintk(1, "%s() Configuring HVR1800/lp/1500 board\n", __FUNCTION__); | 1031 | dprintk(1, "%s() Configuring HVR1800/lp/1500 board\n", |
1032 | __FUNCTION__); | ||
1021 | break; | 1033 | break; |
1022 | default: | 1034 | default: |
1023 | // FIXME | 1035 | // FIXME |
@@ -1103,53 +1115,54 @@ static int cx23885_restart_queue(struct cx23885_tsport *port, | |||
1103 | dprintk(5, "%s()\n", __FUNCTION__); | 1115 | dprintk(5, "%s()\n", __FUNCTION__); |
1104 | if (list_empty(&q->active)) | 1116 | if (list_empty(&q->active)) |
1105 | { | 1117 | { |
1106 | struct cx23885_buffer *prev; | 1118 | struct cx23885_buffer *prev; |
1107 | prev = NULL; | 1119 | prev = NULL; |
1108 | 1120 | ||
1109 | dprintk(5, "%s() queue is empty\n", __FUNCTION__); | 1121 | dprintk(5, "%s() queue is empty\n", __FUNCTION__); |
1110 | 1122 | ||
1111 | for (;;) { | 1123 | for (;;) { |
1112 | if (list_empty(&q->queued)) | 1124 | if (list_empty(&q->queued)) |
1113 | return 0; | 1125 | return 0; |
1114 | buf = list_entry(q->queued.next, struct cx23885_buffer, vb.queue); | 1126 | buf = list_entry(q->queued.next, struct cx23885_buffer, |
1115 | if (NULL == prev) { | 1127 | vb.queue); |
1116 | list_del(&buf->vb.queue); | 1128 | if (NULL == prev) { |
1117 | list_add_tail(&buf->vb.queue,&q->active); | 1129 | list_del(&buf->vb.queue); |
1118 | cx23885_start_dma(port, q, buf); | 1130 | list_add_tail(&buf->vb.queue, &q->active); |
1119 | buf->vb.state = STATE_ACTIVE; | 1131 | cx23885_start_dma(port, q, buf); |
1120 | buf->count = q->count++; | 1132 | buf->vb.state = STATE_ACTIVE; |
1121 | mod_timer(&q->timeout, jiffies+BUFFER_TIMEOUT); | 1133 | buf->count = q->count++; |
1122 | dprintk(5,"[%p/%d] restart_queue - first active\n", | 1134 | mod_timer(&q->timeout, jiffies+BUFFER_TIMEOUT); |
1123 | buf,buf->vb.i); | 1135 | dprintk(5, "[%p/%d] restart_queue - first active\n", |
1124 | 1136 | buf, buf->vb.i); | |
1125 | } else if (prev->vb.width == buf->vb.width && | 1137 | |
1126 | prev->vb.height == buf->vb.height && | 1138 | } else if (prev->vb.width == buf->vb.width && |
1127 | prev->fmt == buf->fmt) { | 1139 | prev->vb.height == buf->vb.height && |
1128 | list_del(&buf->vb.queue); | 1140 | prev->fmt == buf->fmt) { |
1129 | list_add_tail(&buf->vb.queue,&q->active); | 1141 | list_del(&buf->vb.queue); |
1130 | buf->vb.state = STATE_ACTIVE; | 1142 | list_add_tail(&buf->vb.queue, &q->active); |
1131 | buf->count = q->count++; | 1143 | buf->vb.state = STATE_ACTIVE; |
1132 | prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); | 1144 | buf->count = q->count++; |
1133 | prev->risc.jmp[2] = cpu_to_le32(0); /* 64 bit bits 63-32 */ | 1145 | prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); |
1134 | dprintk(5,"[%p/%d] restart_queue - move to active\n", | 1146 | prev->risc.jmp[2] = cpu_to_le32(0); /* 64 bit bits 63-32 */ |
1135 | buf,buf->vb.i); | 1147 | dprintk(5,"[%p/%d] restart_queue - move to active\n", |
1136 | } else { | 1148 | buf, buf->vb.i); |
1137 | return 0; | 1149 | } else { |
1138 | } | 1150 | return 0; |
1139 | prev = buf; | 1151 | } |
1140 | } | 1152 | prev = buf; |
1153 | } | ||
1141 | return 0; | 1154 | return 0; |
1142 | } | 1155 | } |
1143 | 1156 | ||
1144 | buf = list_entry(q->active.next, struct cx23885_buffer, vb.queue); | 1157 | buf = list_entry(q->active.next, struct cx23885_buffer, vb.queue); |
1145 | dprintk(2,"restart_queue [%p/%d]: restart dma\n", | 1158 | dprintk(2, "restart_queue [%p/%d]: restart dma\n", |
1146 | buf, buf->vb.i); | 1159 | buf, buf->vb.i); |
1147 | cx23885_start_dma(port, q, buf); | 1160 | cx23885_start_dma(port, q, buf); |
1148 | list_for_each(item,&q->active) { | 1161 | list_for_each(item, &q->active) { |
1149 | buf = list_entry(item, struct cx23885_buffer, vb.queue); | 1162 | buf = list_entry(item, struct cx23885_buffer, vb.queue); |
1150 | buf->count = q->count++; | 1163 | buf->count = q->count++; |
1151 | } | 1164 | } |
1152 | mod_timer(&q->timeout, jiffies+BUFFER_TIMEOUT); | 1165 | mod_timer(&q->timeout, jiffies + BUFFER_TIMEOUT); |
1153 | return 0; | 1166 | return 0; |
1154 | } | 1167 | } |
1155 | 1168 | ||
@@ -1172,7 +1185,7 @@ int cx23885_buf_prepare(struct videobuf_queue *q, struct cx23885_tsport *port, | |||
1172 | buf->vb.size = size; | 1185 | buf->vb.size = size; |
1173 | buf->vb.field = field /*V4L2_FIELD_TOP*/; | 1186 | buf->vb.field = field /*V4L2_FIELD_TOP*/; |
1174 | 1187 | ||
1175 | if (0 != (rc = videobuf_iolock(q,&buf->vb,NULL))) | 1188 | if (0 != (rc = videobuf_iolock(q, &buf->vb, NULL))) |
1176 | goto fail; | 1189 | goto fail; |
1177 | cx23885_risc_databuffer(dev->pci, &buf->risc, | 1190 | cx23885_risc_databuffer(dev->pci, &buf->risc, |
1178 | buf->vb.dma.sglist, | 1191 | buf->vb.dma.sglist, |
@@ -1182,7 +1195,7 @@ int cx23885_buf_prepare(struct videobuf_queue *q, struct cx23885_tsport *port, | |||
1182 | return 0; | 1195 | return 0; |
1183 | 1196 | ||
1184 | fail: | 1197 | fail: |
1185 | cx23885_free_buffer(q,buf); | 1198 | cx23885_free_buffer(q, buf); |
1186 | return rc; | 1199 | return rc; |
1187 | } | 1200 | } |
1188 | 1201 | ||
@@ -1199,51 +1212,53 @@ void cx23885_buf_queue(struct cx23885_tsport *port, struct cx23885_buffer *buf) | |||
1199 | 1212 | ||
1200 | if (list_empty(&cx88q->active)) { | 1213 | if (list_empty(&cx88q->active)) { |
1201 | dprintk( 1, "queue is empty - first active\n" ); | 1214 | dprintk( 1, "queue is empty - first active\n" ); |
1202 | list_add_tail(&buf->vb.queue,&cx88q->active); | 1215 | list_add_tail(&buf->vb.queue, &cx88q->active); |
1203 | cx23885_start_dma(port, cx88q, buf); | 1216 | cx23885_start_dma(port, cx88q, buf); |
1204 | buf->vb.state = STATE_ACTIVE; | 1217 | buf->vb.state = STATE_ACTIVE; |
1205 | buf->count = cx88q->count++; | 1218 | buf->count = cx88q->count++; |
1206 | mod_timer(&cx88q->timeout, jiffies+BUFFER_TIMEOUT); | 1219 | mod_timer(&cx88q->timeout, jiffies + BUFFER_TIMEOUT); |
1207 | dprintk(1,"[%p/%d] %s - first active\n", | 1220 | dprintk(1, "[%p/%d] %s - first active\n", |
1208 | buf, buf->vb.i, __FUNCTION__); | 1221 | buf, buf->vb.i, __FUNCTION__); |
1209 | 1222 | ||
1210 | } else { | 1223 | } else { |
1211 | dprintk( 1, "queue is not empty - append to active\n" ); | 1224 | dprintk( 1, "queue is not empty - append to active\n" ); |
1212 | prev = list_entry(cx88q->active.prev, struct cx23885_buffer, vb.queue); | 1225 | prev = list_entry(cx88q->active.prev, struct cx23885_buffer, |
1213 | list_add_tail(&buf->vb.queue,&cx88q->active); | 1226 | vb.queue); |
1227 | list_add_tail(&buf->vb.queue, &cx88q->active); | ||
1214 | buf->vb.state = STATE_ACTIVE; | 1228 | buf->vb.state = STATE_ACTIVE; |
1215 | buf->count = cx88q->count++; | 1229 | buf->count = cx88q->count++; |
1216 | prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); | 1230 | prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); |
1217 | prev->risc.jmp[2] = cpu_to_le32(0); /* 64 bit bits 63-32 */ | 1231 | prev->risc.jmp[2] = cpu_to_le32(0); /* 64 bit bits 63-32 */ |
1218 | dprintk( 1, "[%p/%d] %s - append to active\n", | 1232 | dprintk( 1, "[%p/%d] %s - append to active\n", |
1219 | buf, buf->vb.i, __FUNCTION__); | 1233 | buf, buf->vb.i, __FUNCTION__); |
1220 | } | 1234 | } |
1221 | } | 1235 | } |
1222 | 1236 | ||
1223 | /* ----------------------------------------------------------- */ | 1237 | /* ----------------------------------------------------------- */ |
1224 | 1238 | ||
1225 | static void do_cancel_buffers(struct cx23885_tsport *port, char *reason, int restart) | 1239 | static void do_cancel_buffers(struct cx23885_tsport *port, char *reason, |
1240 | int restart) | ||
1226 | { | 1241 | { |
1227 | struct cx23885_dev *dev = port->dev; | 1242 | struct cx23885_dev *dev = port->dev; |
1228 | struct cx23885_dmaqueue *q = &port->mpegq; | 1243 | struct cx23885_dmaqueue *q = &port->mpegq; |
1229 | struct cx23885_buffer *buf; | 1244 | struct cx23885_buffer *buf; |
1230 | unsigned long flags; | 1245 | unsigned long flags; |
1231 | 1246 | ||
1232 | spin_lock_irqsave(&port->slock,flags); | 1247 | spin_lock_irqsave(&port->slock, flags); |
1233 | while (!list_empty(&q->active)) { | 1248 | while (!list_empty(&q->active)) { |
1234 | buf = list_entry(q->active.next, struct cx23885_buffer, vb.queue); | 1249 | buf = list_entry(q->active.next, struct cx23885_buffer, |
1250 | vb.queue); | ||
1235 | list_del(&buf->vb.queue); | 1251 | list_del(&buf->vb.queue); |
1236 | buf->vb.state = STATE_ERROR; | 1252 | buf->vb.state = STATE_ERROR; |
1237 | wake_up(&buf->vb.done); | 1253 | wake_up(&buf->vb.done); |
1238 | dprintk(1,"[%p/%d] %s - dma=0x%08lx\n", | 1254 | dprintk(1, "[%p/%d] %s - dma=0x%08lx\n", |
1239 | buf, buf->vb.i, reason, (unsigned long)buf->risc.dma); | 1255 | buf, buf->vb.i, reason, (unsigned long)buf->risc.dma); |
1240 | } | 1256 | } |
1241 | if (restart) | 1257 | if (restart) { |
1242 | { | ||
1243 | dprintk(1, "restarting queue\n" ); | 1258 | dprintk(1, "restarting queue\n" ); |
1244 | cx23885_restart_queue(port, q); | 1259 | cx23885_restart_queue(port, q); |
1245 | } | 1260 | } |
1246 | spin_unlock_irqrestore(&port->slock,flags); | 1261 | spin_unlock_irqrestore(&port->slock, flags); |
1247 | } | 1262 | } |
1248 | 1263 | ||
1249 | void cx23885_cancel_buffers(struct cx23885_tsport *port) | 1264 | void cx23885_cancel_buffers(struct cx23885_tsport *port) |
@@ -1251,7 +1266,7 @@ void cx23885_cancel_buffers(struct cx23885_tsport *port) | |||
1251 | struct cx23885_dev *dev = port->dev; | 1266 | struct cx23885_dev *dev = port->dev; |
1252 | struct cx23885_dmaqueue *q = &port->mpegq; | 1267 | struct cx23885_dmaqueue *q = &port->mpegq; |
1253 | 1268 | ||
1254 | dprintk(1, "%s()\n", __FUNCTION__ ); | 1269 | dprintk(1, "%s()\n", __FUNCTION__); |
1255 | del_timer_sync(&q->timeout); | 1270 | del_timer_sync(&q->timeout); |
1256 | cx23885_stop_dma(port); | 1271 | cx23885_stop_dma(port); |
1257 | do_cancel_buffers(port, "cancel", 0); | 1272 | do_cancel_buffers(port, "cancel", 0); |
@@ -1312,15 +1327,15 @@ static irqreturn_t cx23885_irq(int irq, void *dev_id) | |||
1312 | dprintk(7, "ts2_status: 0x%08x ts2_mask: 0x%08x count: 0x%x\n", ts2_status, ts2_mask, count ); | 1327 | dprintk(7, "ts2_status: 0x%08x ts2_mask: 0x%08x count: 0x%x\n", ts2_status, ts2_mask, count ); |
1313 | 1328 | ||
1314 | if ( (pci_status & PCI_MSK_RISC_RD) || | 1329 | if ( (pci_status & PCI_MSK_RISC_RD) || |
1315 | (pci_status & PCI_MSK_RISC_WR) || | 1330 | (pci_status & PCI_MSK_RISC_WR) || |
1316 | (pci_status & PCI_MSK_AL_RD) || | 1331 | (pci_status & PCI_MSK_AL_RD) || |
1317 | (pci_status & PCI_MSK_AL_WR) || | 1332 | (pci_status & PCI_MSK_AL_WR) || |
1318 | (pci_status & PCI_MSK_APB_DMA) || | 1333 | (pci_status & PCI_MSK_APB_DMA) || |
1319 | (pci_status & PCI_MSK_VID_C) || | 1334 | (pci_status & PCI_MSK_VID_C) || |
1320 | (pci_status & PCI_MSK_VID_B) || | 1335 | (pci_status & PCI_MSK_VID_B) || |
1321 | (pci_status & PCI_MSK_VID_A) || | 1336 | (pci_status & PCI_MSK_VID_A) || |
1322 | (pci_status & PCI_MSK_AUD_INT) || | 1337 | (pci_status & PCI_MSK_AUD_INT) || |
1323 | (pci_status & PCI_MSK_AUD_EXT) ) | 1338 | (pci_status & PCI_MSK_AUD_EXT) ) |
1324 | { | 1339 | { |
1325 | 1340 | ||
1326 | if (pci_status & PCI_MSK_RISC_RD) | 1341 | if (pci_status & PCI_MSK_RISC_RD) |
@@ -1347,9 +1362,9 @@ static irqreturn_t cx23885_irq(int irq, void *dev_id) | |||
1347 | } | 1362 | } |
1348 | 1363 | ||
1349 | if ( (ts2_status & VID_C_MSK_OPC_ERR) || | 1364 | if ( (ts2_status & VID_C_MSK_OPC_ERR) || |
1350 | (ts2_status & VID_C_MSK_BAD_PKT) || | 1365 | (ts2_status & VID_C_MSK_BAD_PKT) || |
1351 | (ts2_status & VID_C_MSK_SYNC) || | 1366 | (ts2_status & VID_C_MSK_SYNC) || |
1352 | (ts2_status & VID_C_MSK_OF)) | 1367 | (ts2_status & VID_C_MSK_OF)) |
1353 | { | 1368 | { |
1354 | if (ts2_status & VID_C_MSK_OPC_ERR) | 1369 | if (ts2_status & VID_C_MSK_OPC_ERR) |
1355 | dprintk(7, " (VID_C_MSK_OPC_ERR 0x%08x)\n", VID_C_MSK_OPC_ERR); | 1370 | dprintk(7, " (VID_C_MSK_OPC_ERR 0x%08x)\n", VID_C_MSK_OPC_ERR); |
@@ -1392,12 +1407,12 @@ out: | |||
1392 | } | 1407 | } |
1393 | 1408 | ||
1394 | static int __devinit cx23885_initdev(struct pci_dev *pci_dev, | 1409 | static int __devinit cx23885_initdev(struct pci_dev *pci_dev, |
1395 | const struct pci_device_id *pci_id) | 1410 | const struct pci_device_id *pci_id) |
1396 | { | 1411 | { |
1397 | struct cx23885_dev *dev; | 1412 | struct cx23885_dev *dev; |
1398 | int err; | 1413 | int err; |
1399 | 1414 | ||
1400 | dev = kzalloc(sizeof(*dev),GFP_KERNEL); | 1415 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
1401 | if (NULL == dev) | 1416 | if (NULL == dev) |
1402 | return -ENOMEM; | 1417 | return -ENOMEM; |
1403 | 1418 | ||
@@ -1428,8 +1443,8 @@ static int __devinit cx23885_initdev(struct pci_dev *pci_dev, | |||
1428 | goto fail_irq; | 1443 | goto fail_irq; |
1429 | } | 1444 | } |
1430 | 1445 | ||
1431 | err = request_irq(pci_dev->irq, cx23885_irq | 1446 | err = request_irq(pci_dev->irq, cx23885_irq, |
1432 | , IRQF_SHARED | IRQF_DISABLED, dev->name, dev); | 1447 | IRQF_SHARED | IRQF_DISABLED, dev->name, dev); |
1433 | if (err < 0) { | 1448 | if (err < 0) { |
1434 | printk(KERN_ERR "%s: can't get IRQ %d\n", | 1449 | printk(KERN_ERR "%s: can't get IRQ %d\n", |
1435 | dev->name, pci_dev->irq); | 1450 | dev->name, pci_dev->irq); |
diff --git a/drivers/media/video/cx23885/cx23885-dvb.c b/drivers/media/video/cx23885/cx23885-dvb.c index 79948553901d..bd0afc2a0447 100644 --- a/drivers/media/video/cx23885/cx23885-dvb.c +++ b/drivers/media/video/cx23885/cx23885-dvb.c | |||
@@ -53,11 +53,11 @@ static int dvb_buf_setup(struct videobuf_queue *q, | |||
53 | return 0; | 53 | return 0; |
54 | } | 54 | } |
55 | 55 | ||
56 | static int dvb_buf_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, | 56 | static int dvb_buf_prepare(struct videobuf_queue *q, |
57 | enum v4l2_field field) | 57 | struct videobuf_buffer *vb, enum v4l2_field field) |
58 | { | 58 | { |
59 | struct cx23885_tsport *port = q->priv_data; | 59 | struct cx23885_tsport *port = q->priv_data; |
60 | return cx23885_buf_prepare(q, port, (struct cx23885_buffer*)vb,field); | 60 | return cx23885_buf_prepare(q, port, (struct cx23885_buffer*)vb, field); |
61 | } | 61 | } |
62 | 62 | ||
63 | static void dvb_buf_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) | 63 | static void dvb_buf_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) |
@@ -66,7 +66,8 @@ static void dvb_buf_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) | |||
66 | cx23885_buf_queue(port, (struct cx23885_buffer*)vb); | 66 | cx23885_buf_queue(port, (struct cx23885_buffer*)vb); |
67 | } | 67 | } |
68 | 68 | ||
69 | static void dvb_buf_release(struct videobuf_queue *q, struct videobuf_buffer *vb) | 69 | static void dvb_buf_release(struct videobuf_queue *q, |
70 | struct videobuf_buffer *vb) | ||
70 | { | 71 | { |
71 | cx23885_free_buffer(q, (struct cx23885_buffer*)vb); | 72 | cx23885_free_buffer(q, (struct cx23885_buffer*)vb); |
72 | } | 73 | } |
@@ -116,26 +117,22 @@ static int dvb_register(struct cx23885_tsport *port) | |||
116 | switch (dev->board) { | 117 | switch (dev->board) { |
117 | case CX23885_BOARD_HAUPPAUGE_HVR1800lp: | 118 | case CX23885_BOARD_HAUPPAUGE_HVR1800lp: |
118 | port->dvb.frontend = dvb_attach(s5h1409_attach, | 119 | port->dvb.frontend = dvb_attach(s5h1409_attach, |
119 | &hauppauge_hvr1800lp_config, | 120 | &hauppauge_hvr1800lp_config, |
120 | &dev->i2c_bus[0].i2c_adap); | 121 | &dev->i2c_bus[0].i2c_adap); |
121 | if (port->dvb.frontend != NULL) { | 122 | if (port->dvb.frontend != NULL) { |
122 | dvb_attach(mt2131_attach, | 123 | dvb_attach(mt2131_attach, port->dvb.frontend, |
123 | port->dvb.frontend, | 124 | &dev->i2c_bus[0].i2c_adap, |
124 | &dev->i2c_bus[0].i2c_adap, | 125 | &hauppauge_hvr1800lp_rev2_tunerconfig, 0); |
125 | &hauppauge_hvr1800lp_rev2_tunerconfig, | ||
126 | 0); | ||
127 | } | 126 | } |
128 | break; | 127 | break; |
129 | case CX23885_BOARD_HAUPPAUGE_HVR1800: | 128 | case CX23885_BOARD_HAUPPAUGE_HVR1800: |
130 | port->dvb.frontend = dvb_attach(s5h1409_attach, | 129 | port->dvb.frontend = dvb_attach(s5h1409_attach, |
131 | &hauppauge_hvr1800_config, | 130 | &hauppauge_hvr1800_config, |
132 | &dev->i2c_bus[0].i2c_adap); | 131 | &dev->i2c_bus[0].i2c_adap); |
133 | if (port->dvb.frontend != NULL) { | 132 | if (port->dvb.frontend != NULL) { |
134 | dvb_attach(mt2131_attach, | 133 | dvb_attach(mt2131_attach, port->dvb.frontend, |
135 | port->dvb.frontend, | 134 | &dev->i2c_bus[0].i2c_adap, |
136 | &dev->i2c_bus[0].i2c_adap, | 135 | &hauppauge_hvr1800_tunerconfig, 0); |
137 | &hauppauge_hvr1800_tunerconfig, | ||
138 | 0); | ||
139 | } | 136 | } |
140 | break; | 137 | break; |
141 | default: | 138 | default: |
@@ -152,7 +149,8 @@ static int dvb_register(struct cx23885_tsport *port) | |||
152 | cx23885_call_i2c_clients (&dev->i2c_bus[0], TUNER_SET_STANDBY, NULL); | 149 | cx23885_call_i2c_clients (&dev->i2c_bus[0], TUNER_SET_STANDBY, NULL); |
153 | 150 | ||
154 | /* register everything */ | 151 | /* register everything */ |
155 | return videobuf_dvb_register(&port->dvb, THIS_MODULE, port, &dev->pci->dev); | 152 | return videobuf_dvb_register(&port->dvb, THIS_MODULE, port, |
153 | &dev->pci->dev); | ||
156 | } | 154 | } |
157 | 155 | ||
158 | int cx23885_dvb_register(struct cx23885_tsport *port) | 156 | int cx23885_dvb_register(struct cx23885_tsport *port) |
@@ -160,8 +158,8 @@ int cx23885_dvb_register(struct cx23885_tsport *port) | |||
160 | struct cx23885_dev *dev = port->dev; | 158 | struct cx23885_dev *dev = port->dev; |
161 | int err; | 159 | int err; |
162 | 160 | ||
163 | dprintk( 1, "%s\n", __FUNCTION__); | 161 | dprintk(1, "%s\n", __FUNCTION__); |
164 | dprintk( 1, " ->being probed by Card=%d Name=%s, PCI %02x:%02x\n", | 162 | dprintk(1, " ->being probed by Card=%d Name=%s, PCI %02x:%02x\n", |
165 | dev->board, | 163 | dev->board, |
166 | dev->name, | 164 | dev->name, |
167 | dev->pci_bus, | 165 | dev->pci_bus, |
@@ -173,15 +171,9 @@ int cx23885_dvb_register(struct cx23885_tsport *port) | |||
173 | 171 | ||
174 | /* dvb stuff */ | 172 | /* dvb stuff */ |
175 | printk("%s: cx23885 based dvb card\n", dev->name); | 173 | printk("%s: cx23885 based dvb card\n", dev->name); |
176 | videobuf_queue_init( | 174 | videobuf_queue_init(&port->dvb.dvbq, &dvb_qops, dev->pci, &port->slock, |
177 | &port->dvb.dvbq, | 175 | V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_TOP, |
178 | &dvb_qops, | 176 | sizeof(struct cx23885_buffer), port); |
179 | dev->pci, | ||
180 | &port->slock, | ||
181 | V4L2_BUF_TYPE_VIDEO_CAPTURE, | ||
182 | V4L2_FIELD_TOP, | ||
183 | sizeof(struct cx23885_buffer), | ||
184 | port); | ||
185 | err = dvb_register(port); | 177 | err = dvb_register(port); |
186 | if (err != 0) | 178 | if (err != 0) |
187 | printk("%s() dvb_register failed err = %d\n", __FUNCTION__, err); | 179 | printk("%s() dvb_register failed err = %d\n", __FUNCTION__, err); |
@@ -198,3 +190,10 @@ int cx23885_dvb_unregister(struct cx23885_tsport *port) | |||
198 | 190 | ||
199 | return 0; | 191 | return 0; |
200 | } | 192 | } |
193 | |||
194 | /* | ||
195 | * Local variables: | ||
196 | * c-basic-offset: 8 | ||
197 | * End: | ||
198 | * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off | ||
199 | */ | ||
diff --git a/drivers/media/video/cx23885/cx23885-i2c.c b/drivers/media/video/cx23885/cx23885-i2c.c index dbd048d08dda..155ab928cd60 100644 --- a/drivers/media/video/cx23885/cx23885-i2c.c +++ b/drivers/media/video/cx23885/cx23885-i2c.c | |||
@@ -31,11 +31,11 @@ | |||
31 | 31 | ||
32 | static unsigned int i2c_debug = 2; | 32 | static unsigned int i2c_debug = 2; |
33 | module_param(i2c_debug, int, 0644); | 33 | module_param(i2c_debug, int, 0644); |
34 | MODULE_PARM_DESC(i2c_debug,"enable debug messages [i2c]"); | 34 | MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]"); |
35 | 35 | ||
36 | static unsigned int i2c_scan = 0; | 36 | static unsigned int i2c_scan = 0; |
37 | module_param(i2c_scan, int, 0444); | 37 | module_param(i2c_scan, int, 0444); |
38 | MODULE_PARM_DESC(i2c_scan,"scan i2c bus at insmod time"); | 38 | MODULE_PARM_DESC(i2c_scan, "scan i2c bus at insmod time"); |
39 | 39 | ||
40 | #define dprintk(level,fmt, arg...) if (i2c_debug >= level) \ | 40 | #define dprintk(level,fmt, arg...) if (i2c_debug >= level) \ |
41 | printk(KERN_DEBUG "%s: " fmt, dev->name , ## arg) | 41 | printk(KERN_DEBUG "%s: " fmt, dev->name , ## arg) |
@@ -76,7 +76,8 @@ static int i2c_wait_done(struct i2c_adapter *i2c_adap) | |||
76 | return 1; | 76 | return 1; |
77 | } | 77 | } |
78 | 78 | ||
79 | static int i2c_sendbytes(struct i2c_adapter *i2c_adap, const struct i2c_msg *msg, int last) | 79 | static int i2c_sendbytes(struct i2c_adapter *i2c_adap, |
80 | const struct i2c_msg *msg, int last) | ||
80 | { | 81 | { |
81 | struct cx23885_i2c *bus = i2c_adap->algo_data; | 82 | struct cx23885_i2c *bus = i2c_adap->algo_data; |
82 | struct cx23885_dev *dev = bus->dev; | 83 | struct cx23885_dev *dev = bus->dev; |
@@ -150,11 +151,12 @@ static int i2c_sendbytes(struct i2c_adapter *i2c_adap, const struct i2c_msg *msg | |||
150 | eio: | 151 | eio: |
151 | retval = -EIO; | 152 | retval = -EIO; |
152 | err: | 153 | err: |
153 | printk(" ERR: %d\n",retval); | 154 | printk(" ERR: %d\n", retval); |
154 | return retval; | 155 | return retval; |
155 | } | 156 | } |
156 | 157 | ||
157 | static int i2c_readbytes(struct i2c_adapter *i2c_adap, const struct i2c_msg *msg, int last) | 158 | static int i2c_readbytes(struct i2c_adapter *i2c_adap, |
159 | const struct i2c_msg *msg, int last) | ||
158 | { | 160 | { |
159 | struct cx23885_i2c *bus = i2c_adap->algo_data; | 161 | struct cx23885_i2c *bus = i2c_adap->algo_data; |
160 | struct cx23885_dev *dev = bus->dev; | 162 | struct cx23885_dev *dev = bus->dev; |
@@ -206,11 +208,12 @@ static int i2c_readbytes(struct i2c_adapter *i2c_adap, const struct i2c_msg *msg | |||
206 | eio: | 208 | eio: |
207 | retval = -EIO; | 209 | retval = -EIO; |
208 | err: | 210 | err: |
209 | printk(" ERR: %d\n",retval); | 211 | printk(" ERR: %d\n", retval); |
210 | return retval; | 212 | return retval; |
211 | } | 213 | } |
212 | 214 | ||
213 | static int i2c_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs, int num) | 215 | static int i2c_xfer(struct i2c_adapter *i2c_adap, |
216 | struct i2c_msg *msgs, int num) | ||
214 | { | 217 | { |
215 | struct cx23885_i2c *bus = i2c_adap->algo_data; | 218 | struct cx23885_i2c *bus = i2c_adap->algo_data; |
216 | struct cx23885_dev *dev = bus->dev; | 219 | struct cx23885_dev *dev = bus->dev; |
@@ -219,8 +222,8 @@ static int i2c_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs, int num) | |||
219 | dprintk(1, "%s(num = %d)\n", __FUNCTION__, num); | 222 | dprintk(1, "%s(num = %d)\n", __FUNCTION__, num); |
220 | 223 | ||
221 | for (i = 0 ; i < num; i++) { | 224 | for (i = 0 ; i < num; i++) { |
222 | dprintk(1, "%s(num = %d) addr = 0x%02x len = 0x%x\n" | 225 | dprintk(1, "%s(num = %d) addr = 0x%02x len = 0x%x\n", |
223 | , __FUNCTION__, num, msgs[i].addr, msgs[i].len); | 226 | __FUNCTION__, num, msgs[i].addr, msgs[i].len); |
224 | if (msgs[i].flags & I2C_M_RD) { | 227 | if (msgs[i].flags & I2C_M_RD) { |
225 | /* read */ | 228 | /* read */ |
226 | retval = i2c_readbytes(i2c_adap, &msgs[i], i+1 == num); | 229 | retval = i2c_readbytes(i2c_adap, &msgs[i], i+1 == num); |
@@ -261,7 +264,8 @@ static int detach_inform(struct i2c_client *client) | |||
261 | return 0; | 264 | return 0; |
262 | } | 265 | } |
263 | 266 | ||
264 | void cx23885_call_i2c_clients(struct cx23885_i2c *bus, unsigned int cmd, void *arg) | 267 | void cx23885_call_i2c_clients(struct cx23885_i2c *bus, |
268 | unsigned int cmd, void *arg) | ||
265 | { | 269 | { |
266 | // struct cx23885_dev *dev = bus->dev; | 270 | // struct cx23885_dev *dev = bus->dev; |
267 | 271 | ||
@@ -316,11 +320,11 @@ static char *i2c_devs[128] = { | |||
316 | static void do_i2c_scan(char *name, struct i2c_client *c) | 320 | static void do_i2c_scan(char *name, struct i2c_client *c) |
317 | { | 321 | { |
318 | unsigned char buf; | 322 | unsigned char buf; |
319 | int i,rc; | 323 | int i, rc; |
320 | 324 | ||
321 | for (i = 0; i < 128; i++) { | 325 | for (i = 0; i < 128; i++) { |
322 | c->addr = i; | 326 | c->addr = i; |
323 | rc = i2c_master_recv(c,&buf,0); | 327 | rc = i2c_master_recv(c, &buf, 0); |
324 | if (rc < 0) | 328 | if (rc < 0) |
325 | continue; | 329 | continue; |
326 | printk("%s: i2c scan: found device @ 0x%x [%s]\n", | 330 | printk("%s: i2c scan: found device @ 0x%x [%s]\n", |
@@ -335,13 +339,17 @@ int cx23885_i2c_register(struct cx23885_i2c *bus) | |||
335 | 339 | ||
336 | dprintk(1, "%s(bus = %d)\n", __FUNCTION__, bus->nr); | 340 | dprintk(1, "%s(bus = %d)\n", __FUNCTION__, bus->nr); |
337 | 341 | ||
338 | memcpy(&bus->i2c_adap, &cx23885_i2c_adap_template, sizeof(bus->i2c_adap)); | 342 | memcpy(&bus->i2c_adap, &cx23885_i2c_adap_template, |
339 | memcpy(&bus->i2c_algo, &cx23885_i2c_algo_template, sizeof(bus->i2c_algo)); | 343 | sizeof(bus->i2c_adap)); |
340 | memcpy(&bus->i2c_client, &cx23885_i2c_client_template, sizeof(bus->i2c_client)); | 344 | memcpy(&bus->i2c_algo, &cx23885_i2c_algo_template, |
345 | sizeof(bus->i2c_algo)); | ||
346 | memcpy(&bus->i2c_client, &cx23885_i2c_client_template, | ||
347 | sizeof(bus->i2c_client)); | ||
341 | 348 | ||
342 | bus->i2c_adap.dev.parent = &dev->pci->dev; | 349 | bus->i2c_adap.dev.parent = &dev->pci->dev; |
343 | 350 | ||
344 | strlcpy(bus->i2c_adap.name, bus->dev->name, sizeof(bus->i2c_adap.name)); | 351 | strlcpy(bus->i2c_adap.name, bus->dev->name, |
352 | sizeof(bus->i2c_adap.name)); | ||
345 | bus->i2c_algo.data = bus; | 353 | bus->i2c_algo.data = bus; |
346 | bus->i2c_adap.algo_data = bus; | 354 | bus->i2c_adap.algo_data = bus; |
347 | i2c_add_adapter(&bus->i2c_adap); | 355 | i2c_add_adapter(&bus->i2c_adap); |
diff --git a/drivers/media/video/cx23885/cx23885.h b/drivers/media/video/cx23885/cx23885.h index b60de21c2387..4312c3fcc1ec 100644 --- a/drivers/media/video/cx23885/cx23885.h +++ b/drivers/media/video/cx23885/cx23885.h | |||
@@ -183,7 +183,7 @@ struct cx23885_dev { | |||
183 | //u32 shadow[SHADOW_MAX]; | 183 | //u32 shadow[SHADOW_MAX]; |
184 | int pci_irqmask; | 184 | int pci_irqmask; |
185 | 185 | ||
186 | /* I2C adapters: Master 1 and 2 (External) and Master 3 (Internal only) */ | 186 | /* I2C adapters: Master 1 & 2 (External) & Master 3 (Internal only) */ |
187 | struct cx23885_i2c i2c_bus[3]; | 187 | struct cx23885_i2c i2c_bus[3]; |
188 | 188 | ||
189 | int nr; | 189 | int nr; |
@@ -268,17 +268,22 @@ extern void cx23885_card_setup_pre_i2c(struct cx23885_dev *dev); | |||
268 | extern int cx23885_dvb_register(struct cx23885_tsport *port); | 268 | extern int cx23885_dvb_register(struct cx23885_tsport *port); |
269 | extern int cx23885_dvb_unregister(struct cx23885_tsport *port); | 269 | extern int cx23885_dvb_unregister(struct cx23885_tsport *port); |
270 | 270 | ||
271 | extern int cx23885_buf_prepare(struct videobuf_queue *q, struct cx23885_tsport *port, | 271 | extern int cx23885_buf_prepare(struct videobuf_queue *q, |
272 | struct cx23885_buffer *buf, enum v4l2_field field); | 272 | struct cx23885_tsport *port, |
273 | struct cx23885_buffer *buf, | ||
274 | enum v4l2_field field); | ||
273 | 275 | ||
274 | extern void cx23885_buf_queue(struct cx23885_tsport *port, struct cx23885_buffer *buf); | 276 | extern void cx23885_buf_queue(struct cx23885_tsport *port, |
275 | extern void cx23885_free_buffer(struct videobuf_queue *q, struct cx23885_buffer *buf); | 277 | struct cx23885_buffer *buf); |
278 | extern void cx23885_free_buffer(struct videobuf_queue *q, | ||
279 | struct cx23885_buffer *buf); | ||
276 | 280 | ||
277 | /* ----------------------------------------------------------- */ | 281 | /* ----------------------------------------------------------- */ |
278 | /* cx23885-i2c.c */ | 282 | /* cx23885-i2c.c */ |
279 | extern int cx23885_i2c_register(struct cx23885_i2c *bus); | 283 | extern int cx23885_i2c_register(struct cx23885_i2c *bus); |
280 | extern int cx23885_i2c_unregister(struct cx23885_i2c *bus); | 284 | extern int cx23885_i2c_unregister(struct cx23885_i2c *bus); |
281 | extern void cx23885_call_i2c_clients(struct cx23885_i2c *bus, unsigned int cmd, void *arg); | 285 | extern void cx23885_call_i2c_clients(struct cx23885_i2c *bus, unsigned int cmd, |
286 | void *arg); | ||
282 | 287 | ||
283 | /* | 288 | /* |
284 | * Local variables: | 289 | * Local variables: |