@@ -34,6 +34,7 @@
#include "mantis_link.h"
#include "mantis_hif.h"
#include "mantis_reg.h"
+#include "mantis_pci.h"
#include "mantis_ca.h"
@@ -125,6 +126,7 @@ static int mantis_ca_slot_shutdown(struct dvb_ca_en50221 *en50221, int slot)
struct mantis_pci *mantis = ca->ca_priv;
dprintk(MANTIS_DEBUG, 1, "Slot(%d): Slot shutdown", slot);
+ mantis_set_direction(mantis, 0); /* Disable TS through CAM */
return 0;
}
@@ -135,7 +137,7 @@ static int mantis_ts_control(struct dvb_ca_en50221 *en50221, int slot)
struct mantis_pci *mantis = ca->ca_priv;
dprintk(MANTIS_DEBUG, 1, "Slot(%d): TS control", slot);
-/* mantis_set_direction(mantis, 1); */ /* Enable TS through CAM */
+ mantis_set_direction(mantis, 1); /* Enable TS through CAM */
return 0;
}
@@ -213,23 +213,3 @@ void gpio_set_bits(struct mantis_pci *mantis, u32 bitpos, u8 value)
udelay(100);
}
-/* direction = 0 , no CI passthrough ; 1 , CI passthrough */
-void mantis_set_direction(struct mantis_pci *mantis, int direction)
-{
- u32 reg;
-
- reg = mmread(0x28);
- dprintk(verbose, MANTIS_DEBUG, 1, "TS direction setup");
- if (direction == 0x01) {
- /* to CI */
- reg |= 0x04;
- mmwrite(reg, 0x28);
- reg &= 0xff - 0x04;
- mmwrite(reg, 0x28);
- } else {
- reg &= 0xff - 0x04;
- mmwrite(reg, 0x28);
- reg |= 0x04;
- mmwrite(reg, 0x28);
- }
-}
@@ -239,6 +239,8 @@ int __devinit mantis_dvb_init(struct mantis_pci *mantis)
mantis->fe = NULL;
goto err5;
}
+
+ mantis_ca_init(mantis);
}
}
@@ -274,7 +276,6 @@ int __devexit mantis_dvb_exit(struct mantis_pci *mantis)
int err;
if (mantis->fe) {
- /* mantis_ca_exit(mantis); */
err = mantis_frontend_shutdown(mantis);
if (err != 0)
dprintk(MANTIS_ERROR, 1, "Frontend exit while POWER ON! <%d>", err);
@@ -282,6 +283,7 @@ int __devexit mantis_dvb_exit(struct mantis_pci *mantis)
dvb_frontend_detach(mantis->fe);
}
+ mantis_ca_exit(mantis);
tasklet_kill(&mantis->tasklet);
dvb_net_release(&mantis->dvbnet);
@@ -97,6 +97,7 @@ int __devinit mantis_pci_init(struct mantis_pci *mantis)
pci_read_config_byte(pdev, PCI_LATENCY_TIMER, &latency);
mantis->latency = latency;
mantis->revision = pdev->revision;
+ mantis_set_direction(mantis, 0);
dprintk(MANTIS_ERROR, 0, " Mantis Rev %d [%04x:%04x], ",
mantis->revision,
@@ -110,6 +111,7 @@ int __devinit mantis_pci_init(struct mantis_pci *mantis)
mantis->mantis_addr,
mantis->mmio);
+ mmwrite(0x00, MANTIS_INT_MASK);
err = request_irq(pdev->irq,
config->irq_handler,
IRQF_SHARED,
@@ -165,6 +167,27 @@ void mantis_pci_exit(struct mantis_pci *mantis)
}
EXPORT_SYMBOL_GPL(mantis_pci_exit);
+/* direction = 0 , no CI passthrough ; 1 , CI passthrough */
+void mantis_set_direction(struct mantis_pci *mantis, int direction)
+{
+ u32 reg;
+
+ reg = mmread(0x28);
+ dprintk(MANTIS_DEBUG, 1, "TS direction setup");
+ if (direction == 0x01) {
+ /* to CI */
+ reg |= 0x04;
+ mmwrite(reg, 0x28);
+ reg &= 0xff - 0x04;
+ mmwrite(reg, 0x28);
+ } else {
+ reg &= 0xff - 0x04;
+ mmwrite(reg, 0x28);
+ reg |= 0x04;
+ mmwrite(reg, 0x28);
+ }
+}
+
MODULE_DESCRIPTION("Mantis PCI DTV bridge driver");
MODULE_AUTHOR("Manu Abraham");
MODULE_LICENSE("GPL");
@@ -24,4 +24,6 @@
extern int mantis_pci_init(struct mantis_pci *mantis);
extern void mantis_pci_exit(struct mantis_pci *mantis);
+void mantis_set_direction(struct mantis_pci *mantis, int direction);
+
#endif /* __MANTIS_PCI_H */