Commit df0cca17 authored by Manu Abraham's avatar Manu Abraham Committed by Mauro Carvalho Chehab

V4L/DVB (13706): [MB86A16] Overhaul

 * better ISR handling
 * I2C fixes
 * better handling of configurations
Signed-off-by: default avatarManu Abraham <manu@linuxtv.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent bd1fcac0
...@@ -65,10 +65,19 @@ ...@@ -65,10 +65,19 @@
#define mmaor(dat, addr) mmwrite((dat) | ((mask) & mmread(addr)), addr) #define mmaor(dat, addr) mmwrite((dat) | ((mask) & mmread(addr)), addr)
struct mantis_hwconfig {
char *model_name;
char *dev_type;
};
struct mantis_pci { struct mantis_pci {
/* PCI stuff */ /* PCI stuff */
u16 vendor_id; u16 vendor_id;
u16 device_id; u16 device_id;
u16 subsystem_vendor;
u16 subsystem_device;
u8 latency; u8 latency;
struct pci_dev *pdev; struct pci_dev *pdev;
...@@ -110,7 +119,7 @@ struct mantis_pci { ...@@ -110,7 +119,7 @@ struct mantis_pci {
u8 feeds; u8 feeds;
struct mantis_config *config; struct mantis_hwconfig *hwconfig;
u32 mantis_int_stat; u32 mantis_int_stat;
u32 mantis_int_mask; u32 mantis_int_mask;
...@@ -121,7 +130,8 @@ struct mantis_pci { ...@@ -121,7 +130,8 @@ struct mantis_pci {
u32 sub_device_id; u32 sub_device_id;
/* A12 A13 A14 */ /* A12 A13 A14 */
int gpio_status;}; int gpio_status;
};
extern unsigned int verbose; extern unsigned int verbose;
extern unsigned int devs; extern unsigned int devs;
......
...@@ -20,7 +20,10 @@ ...@@ -20,7 +20,10 @@
#include "mantis_common.h" #include "mantis_common.h"
#include "mantis_core.h" #include "mantis_core.h"
#include "mantis_vp1033.h"
#include "mantis_vp1034.h"
#include "mantis_vp2033.h"
#include "mantis_vp3030.h"
static int read_eeprom_byte(struct mantis_pci *mantis, u8 *data, u8 length) static int read_eeprom_byte(struct mantis_pci *mantis, u8 *data, u8 length)
{ {
...@@ -45,7 +48,7 @@ static int read_eeprom_byte(struct mantis_pci *mantis, u8 *data, u8 length) ...@@ -45,7 +48,7 @@ static int read_eeprom_byte(struct mantis_pci *mantis, u8 *data, u8 length)
return err; return err;
} }
msleep_interruptible(2); // msleep_interruptible(2);
return 0; return 0;
} }
...@@ -72,41 +75,6 @@ static int write_eeprom_byte(struct mantis_pci *mantis, u8 *data, u8 length) ...@@ -72,41 +75,6 @@ static int write_eeprom_byte(struct mantis_pci *mantis, u8 *data, u8 length)
return 0; return 0;
} }
static int get_subdevice_id(struct mantis_pci *mantis)
{
int err;
static u8 sub_device_id[2];
mantis->sub_device_id = 0;
sub_device_id[0] = 0xfc;
if ((err = read_eeprom_byte(mantis, &sub_device_id[0], 2)) < 0) {
dprintk(verbose, MANTIS_ERROR, 1, "Mantis EEPROM read error");
return err;
}
mantis->sub_device_id = (sub_device_id[0] << 8) | sub_device_id[1];
dprintk(verbose, MANTIS_ERROR, 1, "Sub Device ID=[0x%04x]",
mantis->sub_device_id);
return 0;
}
static int get_subvendor_id(struct mantis_pci *mantis)
{
int err;
static u8 sub_vendor_id[2];
mantis->sub_vendor_id = 0;
sub_vendor_id[0] = 0xfe;
if ((err = read_eeprom_byte(mantis, &sub_vendor_id[0], 2)) < 0) {
dprintk(verbose, MANTIS_ERROR, 1, "Mantis EEPROM read error");
return err;
}
mantis->sub_vendor_id = (sub_vendor_id[0] << 8) | sub_vendor_id[1];
dprintk(verbose, MANTIS_ERROR, 1, "Sub Vendor ID=[0x%04x]",
mantis->sub_vendor_id);
return 0;
}
static int get_mac_address(struct mantis_pci *mantis) static int get_mac_address(struct mantis_pci *mantis)
{ {
...@@ -118,8 +86,8 @@ static int get_mac_address(struct mantis_pci *mantis) ...@@ -118,8 +86,8 @@ static int get_mac_address(struct mantis_pci *mantis)
return err; return err;
} }
dprintk(verbose, MANTIS_ERROR, 1, dprintk(verbose, MANTIS_ERROR, 0,
"MAC Address=[%02x:%02x:%02x:%02x:%02x:%02x]", " MAC Address=[%02x:%02x:%02x:%02x:%02x:%02x]\n",
mantis->mac_address[0], mantis->mac_address[1], mantis->mac_address[0], mantis->mac_address[1],
mantis->mac_address[2], mantis->mac_address[3], mantis->mac_address[2], mantis->mac_address[3],
mantis->mac_address[4], mantis->mac_address[5]); mantis->mac_address[4], mantis->mac_address[5]);
...@@ -127,11 +95,51 @@ static int get_mac_address(struct mantis_pci *mantis) ...@@ -127,11 +95,51 @@ static int get_mac_address(struct mantis_pci *mantis)
return 0; return 0;
} }
#define MANTIS_MODEL_UNKNOWN "UNKNOWN"
#define MANTIS_DEV_UNKNOWN "UNKNOWN"
struct mantis_hwconfig unknown_device = {
.model_name = MANTIS_MODEL_UNKNOWN,
.dev_type = MANTIS_DEV_UNKNOWN,
};
static void mantis_load_config(struct mantis_pci *mantis)
{
switch (mantis->subsystem_device) {
case MANTIS_VP_1033_DVB_S: // VP-1033
mantis->hwconfig = &vp1033_mantis_config;
break;
case MANTIS_VP_1034_DVB_S: // VP-1034
mantis->hwconfig = &vp1034_mantis_config;
break;
case MANTIS_VP_2033_DVB_C: // VP-2033
mantis->hwconfig = &vp2033_mantis_config;
break;
case MANTIS_VP_3030_DVB_T: // VP-3030
mantis->hwconfig = &vp3030_mantis_config;
break;
default:
mantis->hwconfig = &unknown_device;
break;
}
}
int mantis_core_init(struct mantis_pci *mantis) int mantis_core_init(struct mantis_pci *mantis)
{ {
int err = 0; int err = 0;
mantis_load_config(mantis);
dprintk(verbose, MANTIS_ERROR, 0, "found a %s PCI %s device on (%02x:%02x.%x),\n",
mantis->hwconfig->model_name, mantis->hwconfig->dev_type,
mantis->pdev->bus->number, PCI_SLOT(mantis->pdev->devfn), PCI_FUNC(mantis->pdev->devfn));
dprintk(verbose, MANTIS_ERROR, 0, " Mantis Rev %d [%04x:%04x], ",
mantis->revision,
mantis->subsystem_vendor, mantis->subsystem_device);
dprintk(verbose, MANTIS_ERROR, 0,
"irq: %d, latency: %d\n memory: 0x%lx, mmio: 0x%p\n",
mantis->pdev->irq, mantis->latency,
mantis->mantis_addr, mantis->mantis_mmio);
if ((err = mantis_i2c_init(mantis)) < 0) { if ((err = mantis_i2c_init(mantis)) < 0) {
dprintk(verbose, MANTIS_ERROR, 1, "Mantis I2C init failed"); dprintk(verbose, MANTIS_ERROR, 1, "Mantis I2C init failed");
return err; return err;
...@@ -140,14 +148,6 @@ int mantis_core_init(struct mantis_pci *mantis) ...@@ -140,14 +148,6 @@ int mantis_core_init(struct mantis_pci *mantis)
dprintk(verbose, MANTIS_ERROR, 1, "get MAC address failed"); dprintk(verbose, MANTIS_ERROR, 1, "get MAC address failed");
return err; return err;
} }
if ((err = get_subvendor_id(mantis)) < 0) {
dprintk(verbose, MANTIS_ERROR, 1, "get Sub vendor ID failed");
return err;
}
if ((err = get_subdevice_id(mantis)) < 0) {
dprintk(verbose, MANTIS_ERROR, 1, "get Sub device ID failed");
return err;
}
if ((err = mantis_dma_init(mantis)) < 0) { if ((err = mantis_dma_init(mantis)) < 0) {
dprintk(verbose, MANTIS_ERROR, 1, "Mantis DMA init failed"); dprintk(verbose, MANTIS_ERROR, 1, "Mantis DMA init failed");
return err; return err;
...@@ -162,7 +162,6 @@ int mantis_core_init(struct mantis_pci *mantis) ...@@ -162,7 +162,6 @@ int mantis_core_init(struct mantis_pci *mantis)
int mantis_core_exit(struct mantis_pci *mantis) int mantis_core_exit(struct mantis_pci *mantis)
{ {
mantis_dma_stop(mantis); mantis_dma_stop(mantis);
dprintk(verbose, MANTIS_ERROR, 1, "DMA engine stopping"); dprintk(verbose, MANTIS_ERROR, 1, "DMA engine stopping");
if (mantis_dma_exit(mantis) < 0) if (mantis_dma_exit(mantis) < 0)
......
...@@ -206,22 +206,13 @@ int __devinit mantis_dvb_init(struct mantis_pci *mantis) ...@@ -206,22 +206,13 @@ int __devinit mantis_dvb_init(struct mantis_pci *mantis)
return result; return result;
} }
#define MANTIS_VP_1027_DVB_S 0x0013
#define MANTIS_VP_1033_DVB_S 0x0016
#define MANTIS_VP_1034_DVB_S 0x0014
#define MANTIS_VP_1040_DVB_S2
#define MANTIS_VP_1041_DVB_S2
#define MANTIS_VP_2033_DVB_C 0x0008
#define MANTIS_VP_3024_DVB_T 0x0009
#define MANTIS_VP_3030_DVB_T 0x0024
int __devinit mantis_frontend_init(struct mantis_pci *mantis) int __devinit mantis_frontend_init(struct mantis_pci *mantis)
{ {
dprintk(verbose, MANTIS_DEBUG, 1, "Mantis frontend Init"); dprintk(verbose, MANTIS_DEBUG, 1, "Mantis frontend Init");
mantis_fe_powerup(mantis); mantis_fe_powerup(mantis);
mantis_frontend_reset(mantis); mantis_frontend_reset(mantis);
dprintk(verbose, MANTIS_DEBUG, 1, "Device ID=%02x", mantis->sub_device_id); dprintk(verbose, MANTIS_DEBUG, 1, "Device ID=%02x", mantis->subsystem_device);
switch (mantis->sub_device_id) { switch (mantis->subsystem_device) {
case MANTIS_VP_1033_DVB_S: // VP-1033 case MANTIS_VP_1033_DVB_S: // VP-1033
dprintk(verbose, MANTIS_ERROR, 1, "Probing for STV0299 (DVB-S)"); dprintk(verbose, MANTIS_ERROR, 1, "Probing for STV0299 (DVB-S)");
mantis->fe = stv0299_attach(&lgtdqcs001f_config, mantis->fe = stv0299_attach(&lgtdqcs001f_config,
......
...@@ -33,32 +33,27 @@ ...@@ -33,32 +33,27 @@
static int mantis_ack_wait(struct mantis_pci *mantis) static int mantis_ack_wait(struct mantis_pci *mantis)
{ {
int rc = 0; int rc = 0;
u32 timeout = 0;
if (wait_event_interruptible_timeout(mantis->i2c_wq, if (wait_event_interruptible_timeout(mantis->i2c_wq,
mantis->mantis_int_stat & MANTIS_INT_I2CRACK, mantis->mantis_int_stat & MANTIS_INT_I2CDONE,
msecs_to_jiffies(50)) == -ERESTARTSYS) msecs_to_jiffies(50)) == -ERESTARTSYS) {
dprintk(verbose, MANTIS_DEBUG, 1, "I2C Transfer failed, Master !I2CDONE");
rc = -EREMOTEIO; rc = -EREMOTEIO;
/* }
// Wait till we are done while (!(mantis->mantis_int_stat & MANTIS_INT_I2CRACK)) {
while (mantis->mantis_int_stat & MANTIS_INT_I2CRACK){ dprintk(verbose, MANTIS_DEBUG, 1, "Waiting for Slave RACK");
if (mantis->mantis_int_stat & MANTIS_INT_I2CDONE) { mantis->mantis_int_stat = mmread(MANTIS_INT_STAT);
mantis->mantis_int_stat &= ~MANTIS_INT_I2CRACK; msleep(5);
// dprintk(verbose, MANTIS_DEBUG, 1, "SLAVE RACK 'ed .. Waiting for I2CDONE"); timeout++;
if (timeout > 500) {
dprintk(verbose, MANTIS_ERROR, 1, "Slave RACK Fail !");
rc = -EREMOTEIO;
break; break;
} }
} }
udelay(350);
if (mantis->mantis_int_stat & MANTIS_INT_I2CDONE) {
// dprintk(verbose, MANTIS_DEBUG, 1, "Mantis Int I2CDONE");
rc = 1;
}
mantis->mantis_int_stat &= ~MANTIS_INT_I2CDONE;
*/
// ..
if (mantis->mantis_int_stat & MANTIS_INT_I2CRACK)
msleep_interruptible(10);
return rc; return rc;
} }
...@@ -67,7 +62,7 @@ static int mantis_i2c_read(struct mantis_pci *mantis, const struct i2c_msg *msg) ...@@ -67,7 +62,7 @@ static int mantis_i2c_read(struct mantis_pci *mantis, const struct i2c_msg *msg)
{ {
u32 rxd, i; u32 rxd, i;
dprintk(verbose, MANTIS_DEBUG, 1, "Address=[0x%02x]", msg->addr); dprintk(verbose, MANTIS_INFO, 0, " %s: Address=[0x%02x] <R>[ ", __func__, msg->addr);
for (i = 0; i < msg->len; i++) { for (i = 0; i < msg->len; i++) {
rxd = (msg->addr << 25) | (1 << 24) rxd = (msg->addr << 25) | (1 << 24)
| MANTIS_I2C_RATE_3 | MANTIS_I2C_RATE_3
...@@ -77,18 +72,17 @@ static int mantis_i2c_read(struct mantis_pci *mantis, const struct i2c_msg *msg) ...@@ -77,18 +72,17 @@ static int mantis_i2c_read(struct mantis_pci *mantis, const struct i2c_msg *msg)
if (i == (msg->len - 1)) if (i == (msg->len - 1))
rxd &= ~MANTIS_I2C_STOP; rxd &= ~MANTIS_I2C_STOP;
mmwrite(MANTIS_INT_I2CDONE, MANTIS_INT_STAT);
mmwrite(rxd, MANTIS_I2CDATA_CTL); mmwrite(rxd, MANTIS_I2CDATA_CTL);
if (mantis_ack_wait(mantis) < 0) { if (mantis_ack_wait(mantis) != 0) {
dprintk(verbose, MANTIS_DEBUG, 1, "ACK failed<R>"); dprintk(verbose, MANTIS_DEBUG, 1, "ACK failed<R>");
return -EIO; return -EREMOTEIO;
} }
rxd = mmread(MANTIS_I2CDATA_CTL); rxd = mmread(MANTIS_I2CDATA_CTL);
msg->buf[i] = (u8)((rxd >> 8) & 0xFF); msg->buf[i] = (u8)((rxd >> 8) & 0xFF);
dprintk(verbose, MANTIS_DEBUG, 1, dprintk(verbose, MANTIS_INFO, 0, "%02x ", msg->buf[i]);
"Data<R[%d]>=[0x%02x]", i, msg->buf[i]);
msleep_interruptible(2);
} }
dprintk(verbose, MANTIS_INFO, 0, "]\n");
return 0; return 0;
} }
...@@ -98,9 +92,9 @@ static int mantis_i2c_write(struct mantis_pci *mantis, const struct i2c_msg *msg ...@@ -98,9 +92,9 @@ static int mantis_i2c_write(struct mantis_pci *mantis, const struct i2c_msg *msg
int i; int i;
u32 txd = 0; u32 txd = 0;
dprintk(verbose, MANTIS_DEBUG, 1, "Address=[0x%02x]", msg->addr); dprintk(verbose, MANTIS_INFO, 0, " %s: Address=[0x%02x] <W>[ ", __func__, msg->addr);
for (i = 0; i < msg->len; i++) { for (i = 0; i < msg->len; i++) {
dprintk(verbose, MANTIS_DEBUG, 1, "Data<W[%d]>=[0x%02x]", i, msg->buf[i]); dprintk(verbose, MANTIS_INFO, 0, "%02x ", msg->buf[i]);
txd = (msg->addr << 25) | (msg->buf[i] << 8) txd = (msg->addr << 25) | (msg->buf[i] << 8)
| MANTIS_I2C_RATE_3 | MANTIS_I2C_RATE_3
| MANTIS_I2C_STOP | MANTIS_I2C_STOP
...@@ -109,13 +103,14 @@ static int mantis_i2c_write(struct mantis_pci *mantis, const struct i2c_msg *msg ...@@ -109,13 +103,14 @@ static int mantis_i2c_write(struct mantis_pci *mantis, const struct i2c_msg *msg
if (i == (msg->len - 1)) if (i == (msg->len - 1))
txd &= ~MANTIS_I2C_STOP; txd &= ~MANTIS_I2C_STOP;
mmwrite(MANTIS_INT_I2CDONE, MANTIS_INT_STAT);
mmwrite(txd, MANTIS_I2CDATA_CTL); mmwrite(txd, MANTIS_I2CDATA_CTL);
if (mantis_ack_wait(mantis) < 0) { if (mantis_ack_wait(mantis) != 0) {
dprintk(verbose, MANTIS_DEBUG, 1, "ACK failed<W>"); dprintk(verbose, MANTIS_DEBUG, 1, "ACK failed<W>");
return -1; return -EREMOTEIO;
} }
udelay(500);
} }
dprintk(verbose, MANTIS_INFO, 0, "]\n");
return 0; return 0;
} }
...@@ -159,7 +154,7 @@ static struct i2c_adapter mantis_i2c_adapter = { ...@@ -159,7 +154,7 @@ static struct i2c_adapter mantis_i2c_adapter = {
int __devinit mantis_i2c_init(struct mantis_pci *mantis) int __devinit mantis_i2c_init(struct mantis_pci *mantis)
{ {
u32 intstat; u32 intstat, intmask;
memcpy(&mantis->adapter, &mantis_i2c_adapter, sizeof (mantis_i2c_adapter)); memcpy(&mantis->adapter, &mantis_i2c_adapter, sizeof (mantis_i2c_adapter));
i2c_set_adapdata(&mantis->adapter, mantis); i2c_set_adapdata(&mantis->adapter, mantis);
...@@ -169,15 +164,12 @@ int __devinit mantis_i2c_init(struct mantis_pci *mantis) ...@@ -169,15 +164,12 @@ int __devinit mantis_i2c_init(struct mantis_pci *mantis)
dprintk(verbose, MANTIS_DEBUG, 1, "Initializing I2C .."); dprintk(verbose, MANTIS_DEBUG, 1, "Initializing I2C ..");
// Clear all interrupts
intstat = mmread(MANTIS_INT_STAT); intstat = mmread(MANTIS_INT_STAT);
intmask = mmread(MANTIS_INT_MASK);
mmwrite(intstat, MANTIS_INT_STAT); mmwrite(intstat, MANTIS_INT_STAT);
mmwrite(intmask | MANTIS_INT_I2CDONE, MANTIS_INT_MASK);
mmwrite(mmread(MANTIS_INT_MASK) | MANTIS_INT_I2CDONE, dprintk(verbose, MANTIS_DEBUG, 1, "[0x%08x/%08x]", intstat, intmask);
MANTIS_INT_MASK);
dprintk(verbose, MANTIS_DEBUG, 1, "[0x%08x/%08x]",
mmread(MANTIS_INT_STAT), mmread(MANTIS_INT_MASK));
return 0; return 0;
} }
......
...@@ -52,7 +52,6 @@ MODULE_DEVICE_TABLE(pci, mantis_pci_table); ...@@ -52,7 +52,6 @@ MODULE_DEVICE_TABLE(pci, mantis_pci_table);
static irqreturn_t mantis_pci_irq(int irq, void *dev_id) static irqreturn_t mantis_pci_irq(int irq, void *dev_id)
{ {
int i = 0, interrupts = 0;
u32 stat = 0, mask = 0, lstat = 0, mstat = 0; u32 stat = 0, mask = 0, lstat = 0, mstat = 0;
struct mantis_pci *mantis; struct mantis_pci *mantis;
...@@ -64,109 +63,67 @@ static irqreturn_t mantis_pci_irq(int irq, void *dev_id) ...@@ -64,109 +63,67 @@ static irqreturn_t mantis_pci_irq(int irq, void *dev_id)
stat = mmread(MANTIS_INT_STAT); stat = mmread(MANTIS_INT_STAT);
mask = mmread(MANTIS_INT_MASK); mask = mmread(MANTIS_INT_MASK);
mstat = lstat = stat & ~MANTIS_INT_RISCSTAT; mstat = lstat = stat & ~MANTIS_INT_RISCSTAT;
if (!(stat & mask))
if (!(stat & mask)) {
dprintk(verbose, MANTIS_DEBUG, 1, "Not ours !");
return IRQ_NONE; return IRQ_NONE;
mantis->mantis_int_stat = stat;
mantis->mantis_int_mask = mask;
dprintk(verbose, MANTIS_DEBUG, 0, "=== Interrupts[%04x/%04x]= [", stat, mask);
if (stat & MANTIS_INT_RISCEN) {
dprintk(verbose, MANTIS_DEBUG, 0, "* DMA enabl *");
}
if (stat & MANTIS_INT_I2CRACK) {
dprintk(verbose, MANTIS_DEBUG, 0, "* I2C R-ACK *");
// wake_up(&mantis->i2c_wq);
}
if (stat & MANTIS_INT_PCMCIA7) {
dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-07 *");
}
if (stat & MANTIS_INT_IRQ0) {
dprintk(verbose, MANTIS_DEBUG, 0, "* INT IRQ-0 *");
}
if (stat & MANTIS_INT_IRQ1) {
dprintk(verbose, MANTIS_DEBUG, 0, "* INT IRQ-1 *");
}
if (stat & MANTIS_INT_OCERR) {
dprintk(verbose, MANTIS_DEBUG, 0, "* INT OCERR *");
}
if (stat & MANTIS_INT_PABORT) {
dprintk(verbose, MANTIS_DEBUG, 0, "* INT PABRT *");
}
if (stat & MANTIS_INT_RIPERR) {
dprintk(verbose, MANTIS_DEBUG, 0, "* INT RIPRR *");
} }
mmwrite(lstat, MANTIS_INT_STAT); if (stat & MANTIS_INT_PPERR) {
interrupts = hweight32(stat); dprintk(verbose, MANTIS_DEBUG, 0, "* INT PPERR *");
dprintk(verbose, MANTIS_DEBUG, 0, "=== Interrupts[%04x/%04x]=%d [", stat, mask, interrupts);
while (lstat) {
if (lstat & MANTIS_INT_RISCEN) {
dprintk(verbose, MANTIS_DEBUG, 0, "* DMA enabl *");
lstat &= ~MANTIS_INT_RISCEN;
} else if (lstat & MANTIS_INT_I2CRACK) {
dprintk(verbose, MANTIS_DEBUG, 0, "* I2C R-ACK *");
mantis->mantis_int_stat = stat;
mantis->mantis_int_mask = mask;
wake_up(&mantis->i2c_wq);
lstat &= ~MANTIS_INT_I2CRACK;
} else if (lstat & MANTIS_INT_PCMCIA7) {
dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-07 *");
lstat &= ~MANTIS_INT_PCMCIA7;
} else if (lstat & MANTIS_INT_PCMCIA6) {
dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-06 *");
lstat &= ~MANTIS_INT_PCMCIA6;
} else if (lstat & MANTIS_INT_PCMCIA5) {
dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-05 *");
lstat &= ~MANTIS_INT_PCMCIA5;
} else if (lstat & MANTIS_INT_PCMCIA4) {
dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-04 *");
lstat &= ~MANTIS_INT_PCMCIA4;
} else if (lstat & MANTIS_INT_PCMCIA3) {
dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-03 *");
lstat &= ~MANTIS_INT_PCMCIA3;
} else if (lstat & MANTIS_INT_PCMCIA2) {
dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-02 *");
lstat &= ~MANTIS_INT_PCMCIA2;
} else if (lstat & MANTIS_INT_PCMCIA1) {
dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-01 *");
lstat &= ~MANTIS_INT_PCMCIA1;
} else if (lstat & MANTIS_INT_PCMCIA0) {
dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-00 *");
lstat &= ~MANTIS_INT_PCMCIA0;
} else if (lstat & MANTIS_INT_IRQ0) {
dprintk(verbose, MANTIS_DEBUG, 0, "* INT IRQ-0 *");
lstat &= ~MANTIS_INT_IRQ0;
} else if (lstat & MANTIS_INT_IRQ1) {
dprintk(verbose, MANTIS_DEBUG, 0, "* INT IRQ-1 *");
lstat &= ~MANTIS_INT_IRQ1;
} else if (lstat & MANTIS_INT_OCERR) {
dprintk(verbose, MANTIS_DEBUG, 0, "* INT OCERR *");
lstat &= ~MANTIS_INT_OCERR;
} else if (lstat & MANTIS_INT_PABORT) {
dprintk(verbose, MANTIS_DEBUG, 0, "* INT PABRT *");
lstat &= ~MANTIS_INT_PABORT;
} else if (lstat & MANTIS_INT_RIPERR) {
dprintk(verbose, MANTIS_DEBUG, 0, "* INT RIPRR *");
lstat &= ~MANTIS_INT_RIPERR;
} else if (lstat & MANTIS_INT_PPERR) {
dprintk(verbose, MANTIS_DEBUG, 0, "* INT PPERR *");
lstat &= ~MANTIS_INT_PPERR;
} else if (lstat & MANTIS_INT_FTRGT) {
dprintk(verbose, MANTIS_DEBUG, 0, "* INT FTRGT *");
lstat &= ~MANTIS_INT_FTRGT;
} else if (lstat & MANTIS_INT_RISCI) {
dprintk(verbose, MANTIS_DEBUG, 0, "* INT RISCI *");
mantis->finished_block = (stat & MANTIS_INT_RISCSTAT) >> 28;
tasklet_schedule(&mantis->tasklet);
lstat &= ~MANTIS_INT_RISCI;
} else if (lstat & MANTIS_INT_I2CDONE) {
dprintk(verbose, MANTIS_DEBUG, 0, "* I2C DONE *");
mantis->mantis_int_stat = stat;
mantis->mantis_int_mask = mask;
lstat &= ~MANTIS_INT_I2CDONE;
} else {
dprintk(verbose, MANTIS_DEBUG, 0,
"* Unknown [%04x/%04x] *", stat, mask);
break;
}
i++;
if (i > interrupts) {
dprintk(verbose, MANTIS_ERROR, 1, "going Loopy ! -- BREAK --");
break;
}
} }
if (stat & MANTIS_INT_FTRGT) {
dprintk(verbose, MANTIS_DEBUG, 0, "* INT FTRGT *");
}
if (stat & MANTIS_INT_RISCI) {
dprintk(verbose, MANTIS_DEBUG, 0, "* INT RISCI *");
mantis->finished_block = (stat & MANTIS_INT_RISCSTAT) >> 28;
tasklet_schedule(&mantis->tasklet);
}
if (stat & MANTIS_INT_I2CDONE) {
dprintk(verbose, MANTIS_DEBUG, 0, "* I2C DONE *");
wake_up(&mantis->i2c_wq);
}
mmwrite(stat, MANTIS_INT_STAT);
stat &= ~(MANTIS_INT_RISCEN | MANTIS_INT_I2CDONE |
MANTIS_INT_I2CRACK | MANTIS_INT_PCMCIA7 |
MANTIS_INT_PCMCIA6 | MANTIS_INT_PCMCIA5 |
MANTIS_INT_PCMCIA4 | MANTIS_INT_PCMCIA3 |
MANTIS_INT_PCMCIA2 | MANTIS_INT_PCMCIA1 |
MANTIS_INT_PCMCIA0 | MANTIS_INT_IRQ1 |
MANTIS_INT_IRQ0 | MANTIS_INT_OCERR |
MANTIS_INT_PABORT | MANTIS_INT_RIPERR |
MANTIS_INT_PPERR | MANTIS_INT_FTRGT |
MANTIS_INT_RISCI);
if (stat)
dprintk(verbose, MANTIS_DEBUG, 0, "* Unknown [%04x] *", stat);
dprintk(verbose, MANTIS_DEBUG, 0, "] ===\n"); dprintk(verbose, MANTIS_DEBUG, 0, "] ===\n");
return IRQ_HANDLED; return IRQ_HANDLED;
...@@ -180,8 +137,6 @@ static int __devinit mantis_pci_probe(struct pci_dev *pdev, ...@@ -180,8 +137,6 @@ static int __devinit mantis_pci_probe(struct pci_dev *pdev,
struct mantis_pci *mantis; struct mantis_pci *mantis;
int ret = 0; int ret = 0;
devs++;
mantis = kmalloc(sizeof (struct mantis_pci), GFP_KERNEL); mantis = kmalloc(sizeof (struct mantis_pci), GFP_KERNEL);
if (mantis == NULL) { if (mantis == NULL) {
printk("%s: Out of memory\n", __func__); printk("%s: Out of memory\n", __func__);
...@@ -190,6 +145,8 @@ static int __devinit mantis_pci_probe(struct pci_dev *pdev, ...@@ -190,6 +145,8 @@ static int __devinit mantis_pci_probe(struct pci_dev *pdev,
} }
memset(mantis, 0, sizeof (struct mantis_pci)); memset(mantis, 0, sizeof (struct mantis_pci));
mantis->num = devs; mantis->num = devs;
devs++;
if (pci_enable_device(pdev)) { if (pci_enable_device(pdev)) {
dprintk(verbose, MANTIS_ERROR, 1, "Mantis PCI enable failed"); dprintk(verbose, MANTIS_ERROR, 1, "Mantis PCI enable failed");
ret = -ENODEV; ret = -ENODEV;
...@@ -225,11 +182,13 @@ static int __devinit mantis_pci_probe(struct pci_dev *pdev, ...@@ -225,11 +182,13 @@ static int __devinit mantis_pci_probe(struct pci_dev *pdev,
mantis->latency = latency; mantis->latency = latency;
mantis->revision = revision; mantis->revision = revision;
mantis->pdev = pdev; mantis->pdev = pdev;
mantis->subsystem_vendor = pdev->subsystem_vendor;
mantis->subsystem_device = pdev->subsystem_device;
init_waitqueue_head(&mantis->i2c_wq); init_waitqueue_head(&mantis->i2c_wq);
// CAM bypass // CAM bypass
//mmwrite(mmread(MANTIS_INT_MASK) | MANTIS_INT_IRQ1, MANTIS_INT_MASK); //mmwrite(mmread(MANTIS_INT_MASK) | MANTIS_INT_IRQ1, MANTIS_INT_MASK);
dprintk(verbose, MANTIS_INFO, 1, "gpif status: %04x irqcfg: %04x", mmread(0x9c), mmread(0x98)); dprintk(verbose, MANTIS_INFO, 0, "\ngpif status: %04x irqcfg: %04x\n", mmread(0x9c), mmread(0x98));
if ((mmread(0x9c) & 0x200) != 0) { //CAM inserted if ((mmread(0x9c) & 0x200) != 0) { //CAM inserted
msleep_interruptible(1); msleep_interruptible(1);
if ((mmread(0x9c) & 0x200) != 0) if ((mmread(0x9c) & 0x200) != 0)
...@@ -242,11 +201,8 @@ static int __devinit mantis_pci_probe(struct pci_dev *pdev, ...@@ -242,11 +201,8 @@ static int __devinit mantis_pci_probe(struct pci_dev *pdev,
} }
mantis_set_direction(mantis, 0); mantis_set_direction(mantis, 0);
// default latency if none specified
if (!latency) if (!latency)
pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 32); pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 32);
dprintk(verbose, MANTIS_ERROR, 0, "Mantis Rev %d, ",
mantis->revision);
dprintk(verbose, MANTIS_ERROR, 0, dprintk(verbose, MANTIS_ERROR, 0,
"irq: %d, latency: %d\n memory: 0x%lx, mmio: 0x%p\n", "irq: %d, latency: %d\n memory: 0x%lx, mmio: 0x%p\n",
......
...@@ -81,6 +81,14 @@ struct stv0299_config lgtdqcs001f_config = { ...@@ -81,6 +81,14 @@ struct stv0299_config lgtdqcs001f_config = {
// .pll_set = lgtdqcs001f_pll_set, // .pll_set = lgtdqcs001f_pll_set,
}; };
#define MANTIS_MODEL_NAME "VP-1033"
#define MANTIS_DEV_TYPE "DVB-S/DSS"
struct mantis_hwconfig vp1033_mantis_config = {
.model_name = MANTIS_MODEL_NAME,
.dev_type = MANTIS_DEV_TYPE,
};
int lgtdqcs001f_tuner_set(struct dvb_frontend *fe, int lgtdqcs001f_tuner_set(struct dvb_frontend *fe,
struct dvb_frontend_parameters *params) struct dvb_frontend_parameters *params)
{ {
......
...@@ -21,10 +21,14 @@ ...@@ -21,10 +21,14 @@
#ifndef __MANTIS_VP1033_H #ifndef __MANTIS_VP1033_H
#define __MANTIS_VP1033_H #define __MANTIS_VP1033_H
#include "stv0299.h"
#include "dvb_frontend.h" #include "dvb_frontend.h"
#include "mantis_common.h"
#include "stv0299.h"
#define MANTIS_VP_1033_DVB_S 0x0016
extern struct stv0299_config lgtdqcs001f_config; extern struct stv0299_config lgtdqcs001f_config;
extern struct mantis_hwconfig vp1033_mantis_config;
extern int lgtdqcs001f_tuner_set(struct dvb_frontend *fe, extern int lgtdqcs001f_tuner_set(struct dvb_frontend *fe,
struct dvb_frontend_parameters *params); struct dvb_frontend_parameters *params);
......
...@@ -26,6 +26,14 @@ struct mb86a16_config vp1034_config = { ...@@ -26,6 +26,14 @@ struct mb86a16_config vp1034_config = {
.set_voltage = vp1034_set_voltage, .set_voltage = vp1034_set_voltage,
}; };
#define MANTIS_MODEL_NAME "VP-1034"
#define MANTIS_DEV_TYPE "DVB-S/DSS"
struct mantis_hwconfig vp1034_mantis_config = {
.model_name = MANTIS_MODEL_NAME,
.dev_type = MANTIS_DEV_TYPE,
};
int vp1034_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) int vp1034_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
{ {
struct mantis_pci *mantis = fe->dvb->priv; struct mantis_pci *mantis = fe->dvb->priv;
......
...@@ -21,9 +21,14 @@ ...@@ -21,9 +21,14 @@
#ifndef __MANTIS_VP1034_H #ifndef __MANTIS_VP1034_H
#define __MANTIS_VP1034_H #define __MANTIS_VP1034_H
#include "mb86a16.h"
#include "dvb_frontend.h" #include "dvb_frontend.h"
#include "mantis_common.h"
#include "mb86a16.h"
#define MANTIS_VP_1034_DVB_S 0x0014
extern struct mantis_hwconfig vp1034_mantis_config;
extern struct mb86a16_config vp1034_config; extern struct mb86a16_config vp1034_config;
extern int vp1034_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage); extern int vp1034_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage);
......
...@@ -32,9 +32,17 @@ struct tda10021_state { ...@@ -32,9 +32,17 @@ struct tda10021_state {
u8 reg0; u8 reg0;
}; };
#define MANTIS_MODEL_NAME "VP-2033"
#define MANTIS_DEV_TYPE "DVB-C"
struct mantis_hwconfig vp2033_mantis_config = {
.model_name = MANTIS_MODEL_NAME,
.dev_type = MANTIS_DEV_TYPE,
};
struct cu1216_config philips_cu1216_config = { struct cu1216_config philips_cu1216_config = {
.demod_address = 0x18 >> 1, .demod_address = 0x18 >> 1,
.pll_set = philips_cu1216_tuner_set, .pll_set = philips_cu1216_tuner_set,
// .fe_reset = mantis_fe_reset, // .fe_reset = mantis_fe_reset,
}; };
...@@ -47,10 +55,10 @@ int philips_cu1216_tuner_set(struct dvb_frontend *fe, ...@@ -47,10 +55,10 @@ int philips_cu1216_tuner_set(struct dvb_frontend *fe,
u8 buf[4]; u8 buf[4];
struct i2c_msg msg = { struct i2c_msg msg = {
.addr = 0xc0 >> 1, .addr = 0xc0 >> 1,
.flags = 0, .flags = 0,
.buf = buf, .buf = buf,
.len = sizeof (buf) .len = sizeof (buf)
}; };
#define TUNER_MUL 62500 #define TUNER_MUL 62500
......
...@@ -21,10 +21,14 @@ ...@@ -21,10 +21,14 @@
#ifndef __MANTIS_VP2033_H #ifndef __MANTIS_VP2033_H
#define __MANTIS_VP2033_H #define __MANTIS_VP2033_H
#include "cu1216.h"
#include "dvb_frontend.h" #include "dvb_frontend.h"
#include "mantis_common.h"
#include "cu1216.h"
#define MANTIS_VP_2033_DVB_C 0x0008
extern struct cu1216_config philips_cu1216_config; extern struct cu1216_config philips_cu1216_config;
extern struct mantis_hwconfig vp2033_mantis_config;
extern int philips_cu1216_tuner_set(struct dvb_frontend *fe, extern int philips_cu1216_tuner_set(struct dvb_frontend *fe,
struct dvb_frontend_parameters *params); struct dvb_frontend_parameters *params);
......
...@@ -22,7 +22,15 @@ ...@@ -22,7 +22,15 @@
#include "mantis_vp3030.h" #include "mantis_vp3030.h"
struct zl10353_config mantis_vp3030_config = { struct zl10353_config mantis_vp3030_config = {
.demod_address = 0x0f, .demod_address = 0x0f,
};
#define MANTIS_MODEL_NAME "VP-3030"
#define MANTIS_DEV_TYPE "DVB-T"
struct mantis_hwconfig vp3030_mantis_config = {
.model_name = MANTIS_MODEL_NAME,
.dev_type = MANTIS_DEV_TYPE,
}; };
int panasonic_en57h12d5_set_params(struct dvb_frontend *fe, int panasonic_en57h12d5_set_params(struct dvb_frontend *fe,
......
...@@ -21,10 +21,14 @@ ...@@ -21,10 +21,14 @@
#ifndef __MANTIS_VP3030_H #ifndef __MANTIS_VP3030_H
#define __MANTIS_VP3030_H #define __MANTIS_VP3030_H
#include "zl10353.h"
#include "dvb-pll.h"
#include "dvb_frontend.h" #include "dvb_frontend.h"
#include "mantis_common.h"
#include "dvb-pll.h"
#include "zl10353.h"
#define MANTIS_VP_3030_DVB_T 0x0024
extern struct zl10353_config mantis_vp3030_config; extern struct zl10353_config mantis_vp3030_config;
extern struct mantis_hwconfig vp3030_mantis_config;
#endif // __MANTIS_VP3030_H #endif // __MANTIS_VP3030_H
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment