~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to drivers/media/video/cx23885/cx23885-core.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
#include <linux/interrupt.h>
30
30
#include <linux/delay.h>
31
31
#include <asm/div64.h>
 
32
#include <linux/firmware.h>
32
33
 
33
34
#include "cx23885.h"
34
35
#include "cimax2.h"
 
36
#include "altera-ci.h"
35
37
#include "cx23888-ir.h"
36
38
#include "cx23885-ir.h"
37
39
#include "cx23885-av.h"
902
904
        dev->pci_bus  = dev->pci->bus->number;
903
905
        dev->pci_slot = PCI_SLOT(dev->pci->devfn);
904
906
        cx23885_irq_add(dev, 0x001f00);
905
 
        if (cx23885_boards[dev->board].cimax > 0)
906
 
                cx23885_irq_add(dev, 0x01800000); /* for CiMaxes */
907
907
 
908
908
        /* External Master 1 Bus */
909
909
        dev->i2c_bus[0].nr = 0;
970
970
        /* Assume some sensible defaults */
971
971
        dev->tuner_type = cx23885_boards[dev->board].tuner_type;
972
972
        dev->tuner_addr = cx23885_boards[dev->board].tuner_addr;
 
973
        dev->tuner_bus = cx23885_boards[dev->board].tuner_bus;
973
974
        dev->radio_type = cx23885_boards[dev->board].radio_type;
974
975
        dev->radio_addr = cx23885_boards[dev->board].radio_addr;
975
976
 
976
 
        dprintk(1, "%s() tuner_type = 0x%x tuner_addr = 0x%x\n",
977
 
                __func__, dev->tuner_type, dev->tuner_addr);
 
977
        dprintk(1, "%s() tuner_type = 0x%x tuner_addr = 0x%x tuner_bus = %d\n",
 
978
                __func__, dev->tuner_type, dev->tuner_addr, dev->tuner_bus);
978
979
        dprintk(1, "%s() radio_type = 0x%x radio_addr = 0x%x\n",
979
980
                __func__, dev->radio_type, dev->radio_addr);
980
981
 
1004
1005
        }
1005
1006
 
1006
1007
        if (cx23885_boards[dev->board].portb == CX23885_MPEG_DVB) {
 
1008
                if (cx23885_boards[dev->board].num_fds_portb)
 
1009
                        dev->ts1.num_frontends =
 
1010
                                cx23885_boards[dev->board].num_fds_portb;
1007
1011
                if (cx23885_dvb_register(&dev->ts1) < 0) {
1008
1012
                        printk(KERN_ERR "%s() Failed to register dvb adapters on VID_B\n",
1009
1013
                               __func__);
1018
1022
        }
1019
1023
 
1020
1024
        if (cx23885_boards[dev->board].portc == CX23885_MPEG_DVB) {
 
1025
                if (cx23885_boards[dev->board].num_fds_portc)
 
1026
                        dev->ts2.num_frontends =
 
1027
                                cx23885_boards[dev->board].num_fds_portc;
1021
1028
                if (cx23885_dvb_register(&dev->ts2) < 0) {
1022
1029
                        printk(KERN_ERR
1023
1030
                                "%s() Failed to register dvb on VID_C\n",
1034
1041
 
1035
1042
        cx23885_dev_checkrevision(dev);
1036
1043
 
 
1044
        /* disable MSI for NetUP cards, otherwise CI is not working */
 
1045
        if (cx23885_boards[dev->board].ci_type > 0)
 
1046
                cx_clear(RDR_RDRCTL1, 1 << 8);
 
1047
 
1037
1048
        return 0;
1038
1049
}
1039
1050
 
1822
1833
                                PCI_MSK_IR);
1823
1834
        }
1824
1835
 
1825
 
        if (cx23885_boards[dev->board].cimax > 0 &&
1826
 
                ((pci_status & PCI_MSK_GPIO0) ||
1827
 
                        (pci_status & PCI_MSK_GPIO1))) {
1828
 
 
1829
 
                if (cx23885_boards[dev->board].cimax > 0)
1830
 
                        handled += netup_ci_slot_status(dev, pci_status);
1831
 
 
1832
 
        }
 
1836
        if (cx23885_boards[dev->board].ci_type == 1 &&
 
1837
                        (pci_status & (PCI_MSK_GPIO1 | PCI_MSK_GPIO0)))
 
1838
                handled += netup_ci_slot_status(dev, pci_status);
 
1839
 
 
1840
        if (cx23885_boards[dev->board].ci_type == 2 &&
 
1841
                        (pci_status & PCI_MSK_GPIO0))
 
1842
                handled += altera_ci_irq(dev);
1833
1843
 
1834
1844
        if (ts1_status) {
1835
1845
                if (cx23885_boards[dev->board].portb == CX23885_MPEG_DVB)
2035
2045
        }
2036
2046
 
2037
2047
        /* print pci info */
2038
 
        pci_read_config_byte(pci_dev, PCI_CLASS_REVISION, &dev->pci_rev);
 
2048
        dev->pci_rev = pci_dev->revision;
2039
2049
        pci_read_config_byte(pci_dev, PCI_LATENCY_TIMER,  &dev->pci_lat);
2040
2050
        printk(KERN_INFO "%s/0: found at %s, rev: %d, irq: %d, "
2041
2051
               "latency: %d, mmio: 0x%llx\n", dev->name,
2050
2060
                goto fail_irq;
2051
2061
        }
2052
2062
 
2053
 
        if (!pci_enable_msi(pci_dev))
2054
 
                err = request_irq(pci_dev->irq, cx23885_irq,
2055
 
                                  IRQF_DISABLED, dev->name, dev);
2056
 
        else
2057
 
                err = request_irq(pci_dev->irq, cx23885_irq,
2058
 
                                  IRQF_SHARED | IRQF_DISABLED, dev->name, dev);
 
2063
        err = request_irq(pci_dev->irq, cx23885_irq,
 
2064
                          IRQF_SHARED | IRQF_DISABLED, dev->name, dev);
2059
2065
        if (err < 0) {
2060
2066
                printk(KERN_ERR "%s: can't get IRQ %d\n",
2061
2067
                       dev->name, pci_dev->irq);
2064
2070
 
2065
2071
        switch (dev->board) {
2066
2072
        case CX23885_BOARD_NETUP_DUAL_DVBS2_CI:
2067
 
                cx23885_irq_add_enable(dev, 0x01800000); /* for NetUP */
 
2073
                cx23885_irq_add_enable(dev, PCI_MSK_GPIO1 | PCI_MSK_GPIO0);
 
2074
                break;
 
2075
        case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF:
 
2076
                cx23885_irq_add_enable(dev, PCI_MSK_GPIO0);
2068
2077
                break;
2069
2078
        }
2070
2079
 
2101
2110
 
2102
2111
        /* unregister stuff */
2103
2112
        free_irq(pci_dev->irq, dev);
2104
 
        pci_disable_msi(pci_dev);
2105
2113
 
2106
2114
        cx23885_dev_unregister(dev);
2107
2115
        v4l2_device_unregister(v4l2_dev);