Merge branch 'rmobile-latest' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal...
[pandora-kernel.git] / drivers / media / video / cx23885 / cx23885-core.c
index 3598824..9933810 100644 (file)
 #include <linux/interrupt.h>
 #include <linux/delay.h>
 #include <asm/div64.h>
+#include <linux/firmware.h>
 
 #include "cx23885.h"
 #include "cimax2.h"
+#include "altera-ci.h"
 #include "cx23888-ir.h"
 #include "cx23885-ir.h"
 #include "cx23885-av.h"
@@ -902,8 +904,6 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
        dev->pci_bus  = dev->pci->bus->number;
        dev->pci_slot = PCI_SLOT(dev->pci->devfn);
        cx23885_irq_add(dev, 0x001f00);
-       if (cx23885_boards[dev->board].cimax > 0)
-               cx23885_irq_add(dev, 0x01800000); /* for CiMaxes */
 
        /* External Master 1 Bus */
        dev->i2c_bus[0].nr = 0;
@@ -970,11 +970,12 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
        /* Assume some sensible defaults */
        dev->tuner_type = cx23885_boards[dev->board].tuner_type;
        dev->tuner_addr = cx23885_boards[dev->board].tuner_addr;
+       dev->tuner_bus = cx23885_boards[dev->board].tuner_bus;
        dev->radio_type = cx23885_boards[dev->board].radio_type;
        dev->radio_addr = cx23885_boards[dev->board].radio_addr;
 
-       dprintk(1, "%s() tuner_type = 0x%x tuner_addr = 0x%x\n",
-               __func__, dev->tuner_type, dev->tuner_addr);
+       dprintk(1, "%s() tuner_type = 0x%x tuner_addr = 0x%x tuner_bus = %d\n",
+               __func__, dev->tuner_type, dev->tuner_addr, dev->tuner_bus);
        dprintk(1, "%s() radio_type = 0x%x radio_addr = 0x%x\n",
                __func__, dev->radio_type, dev->radio_addr);
 
@@ -1004,6 +1005,9 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
        }
 
        if (cx23885_boards[dev->board].portb == CX23885_MPEG_DVB) {
+               if (cx23885_boards[dev->board].num_fds_portb)
+                       dev->ts1.num_frontends =
+                               cx23885_boards[dev->board].num_fds_portb;
                if (cx23885_dvb_register(&dev->ts1) < 0) {
                        printk(KERN_ERR "%s() Failed to register dvb adapters on VID_B\n",
                               __func__);
@@ -1018,6 +1022,9 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
        }
 
        if (cx23885_boards[dev->board].portc == CX23885_MPEG_DVB) {
+               if (cx23885_boards[dev->board].num_fds_portc)
+                       dev->ts2.num_frontends =
+                               cx23885_boards[dev->board].num_fds_portc;
                if (cx23885_dvb_register(&dev->ts2) < 0) {
                        printk(KERN_ERR
                                "%s() Failed to register dvb on VID_C\n",
@@ -1034,6 +1041,10 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
 
        cx23885_dev_checkrevision(dev);
 
+       /* disable MSI for NetUP cards, otherwise CI is not working */
+       if (cx23885_boards[dev->board].ci_type > 0)
+               cx_clear(RDR_RDRCTL1, 1 << 8);
+
        return 0;
 }
 
@@ -1822,14 +1833,13 @@ static irqreturn_t cx23885_irq(int irq, void *dev_id)
                                PCI_MSK_IR);
        }
 
-       if (cx23885_boards[dev->board].cimax > 0 &&
-               ((pci_status & PCI_MSK_GPIO0) ||
-                       (pci_status & PCI_MSK_GPIO1))) {
-
-               if (cx23885_boards[dev->board].cimax > 0)
-                       handled += netup_ci_slot_status(dev, pci_status);
+       if (cx23885_boards[dev->board].ci_type == 1 &&
+                       (pci_status & (PCI_MSK_GPIO1 | PCI_MSK_GPIO0)))
+               handled += netup_ci_slot_status(dev, pci_status);
 
-       }
+       if (cx23885_boards[dev->board].ci_type == 2 &&
+                       (pci_status & PCI_MSK_GPIO0))
+               handled += altera_ci_irq(dev);
 
        if (ts1_status) {
                if (cx23885_boards[dev->board].portb == CX23885_MPEG_DVB)
@@ -2064,7 +2074,10 @@ static int __devinit cx23885_initdev(struct pci_dev *pci_dev,
 
        switch (dev->board) {
        case CX23885_BOARD_NETUP_DUAL_DVBS2_CI:
-               cx23885_irq_add_enable(dev, 0x01800000); /* for NetUP */
+               cx23885_irq_add_enable(dev, PCI_MSK_GPIO1 | PCI_MSK_GPIO0);
+               break;
+       case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF:
+               cx23885_irq_add_enable(dev, PCI_MSK_GPIO0);
                break;
        }