Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 179474
b: refs/heads/master
c: 8ce571f
h: refs/heads/master
v: v3
  • Loading branch information
Manu Abraham authored and Mauro Carvalho Chehab committed Jan 17, 2010
1 parent a457147 commit 01fd804
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fadfa070d30434dd228362c933827eb6ce137f2d
refs/heads/master: 8ce571f5e7eb7186f676af3b60af7980c2fc7929
8 changes: 8 additions & 0 deletions trunk/drivers/media/dvb/mantis/mantis_link.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ struct mantis_slot {
u32 timeout;
};

/* Physical layer */
enum mantis_slot_state {
MODULE_INSERTED = 3,
MODULE_XTRACTED = 4
};

struct mantis_ca {
struct mantis_slot slot;

Expand All @@ -44,6 +50,8 @@ struct mantis_ca {

enum mantis_sbuf_status sbuf_status;

enum mantis_slot_state slot_state;

struct dvb_device *ca_dev;
void *ca_priv;
};
Expand Down
66 changes: 66 additions & 0 deletions trunk/drivers/media/dvb/mantis/mantis_pcmcia.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,82 @@
*/

#include "mantis_common.h"
#include "mantis_link.h" /* temporary due to physical layer stuff */

/*
* If Slot state is already PLUG_IN event and we are called
* again, definitely it is jitter alone
*/
void mantis_event_cam_plugin(struct mantis_ca *ca)
{
struct mantis_pci *mantis = ca->ca_priv;

u32 gpif_irqcfg;

if (ca->slot_state == MODULE_XTRACTED) {
dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event: CAM Plugged IN: Adapter(%d) Slot(0)", mantis->num);
udelay(50);
mmwrite(0xda000000, MANTIS_CARD_RESET);
gpif_irqcfg = mmread(MANTIS_GPIF_IRQCFG);
gpif_irqcfg |= MANTIS_MASK_PLUGOUT;
gpif_irqcfg &= ~MANTIS_MASK_PLUGIN;
mmwrite(gpif_irqcfg, MANTIS_GPIF_IRQCFG);
udelay(500);
ca->slot_state = MODULE_INSERTED;
}
udelay(100);
}

/*
* If Slot state is already UN_PLUG event and we are called
* again, definitely it is jitter alone
*/
void mantis_event_cam_unplug(struct mantis_ca *ca)
{
struct mantis_pci *mantis = ca->ca_priv;

u32 gpif_irqcfg;

if (ca->slot_state == MODULE_INSERTED) {
dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event: CAM Unplugged: Adapter(%d) Slot(0)", mantis->num);
udelay(50);
mmwrite(0x00da0000, MANTIS_CARD_RESET);
gpif_irqcfg = mmread(MANTIS_GPIF_IRQCFG);
gpif_irqcfg |= MANTIS_MASK_PLUGIN;
gpif_irqcfg &= ~MANTIS_MASK_PLUGOUT;
mmwrite(gpif_irqcfg, MANTIS_GPIF_IRQCFG);
udelay(500);
ca->slot_state = MODULE_XTRACTED;
}
udelay(100);
}

int mantis_pcmcia_init(struct mantis_ca *ca)
{
struct mantis_pci *mantis = ca->ca_priv;

u32 gpif_stat, card_stat;

gpif_stat = mmread(MANTIS_GPIF_STATUS);
card_stat = mmread(MANTIS_GPIF_IRQCFG);

if (gpif_stat & MANTIS_GPIF_DETSTAT) {
dprintk(mantis->verbose, MANTIS_DEBUG, 1, "CAM found on Adapter(%d) Slot(0)", mantis->num);
mmwrite(card_stat | MANTIS_MASK_PLUGOUT, MANTIS_GPIF_IRQCFG);
ca->slot_state = MODULE_INSERTED;
} else {
dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Empty Slot on Adapter(%d) Slot(0)", mantis->num);
mmwrite(card_stat | MANTIS_MASK_PLUGIN, MANTIS_GPIF_IRQCFG);
ca->slot_state = MODULE_XTRACTED;
}

return 0;
}

void mantis_pcmcia_exit(struct mantis_ca *ca)
{
struct mantis_pci *mantis = ca->ca_priv;

mmwrite(mmread(MANTIS_GPIF_STATUS) & (~MANTIS_CARD_PLUGOUT | ~MANTIS_CARD_PLUGIN), MANTIS_GPIF_STATUS);
mmwrite(mmread(MANTIS_INT_MASK) & ~MANTIS_INT_IRQ0, MANTIS_INT_MASK);
}

0 comments on commit 01fd804

Please sign in to comment.